| 1 |
<?php |
| 2 |
wp_enqueue_script('jquery-ui-core'); |
| 3 |
wp_enqueue_script('jquery-ui-widget'); |
| 4 |
wp_enqueue_script('jquery-ui-position'); |
| 5 |
wp_enqueue_script('jquery'); |
| 6 |
global $wp_scripts; |
| 7 |
?> |
| 8 |
<!DOCTYPE html> |
| 9 |
<head> |
| 10 |
<title><?php _e("Insert Vimeo Video", 'kadencetoolkit'); ?></title> |
| 11 |
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> |
| 12 |
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script> |
| 13 |
<script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script> |
| 14 |
<base target="_self" /> |
| 15 |
<?php wp_print_scripts(); ?> |
| 16 |
<script type="text/javascript"> |
| 17 |
var ButtonDialog = { |
| 18 |
local_ed : 'ed', |
| 19 |
init : function(ed) { |
| 20 |
ButtonDialog.local_ed = ed; |
| 21 |
tinyMCEPopup.resizeToInnerSize(); |
| 22 |
}, |
| 23 |
insert : function insertButton(ed) { |
| 24 |
|
| 25 |
// Try and remove existing style / blockquote |
| 26 |
tinyMCEPopup.execCommand('mceRemoveNode', false, null); |
| 27 |
|
| 28 |
// set up variables to contain our input values |
| 29 |
var video_url = jQuery('#vimeo-dialog input#video').val(); |
| 30 |
var max_width = jQuery('#vimeo-dialog input#maxwidth').val(); |
| 31 |
var width = jQuery('#vimeo-dialog input#width').val(); |
| 32 |
var height = jQuery('#vimeo-dialog input#height').val(); |
| 33 |
|
| 34 |
var output = ''; |
| 35 |
output = '[kad_vimeo '; |
| 36 |
output += 'url="' + video_url + '" '; |
| 37 |
if(width) {output += ' width=' + width + ' ';} |
| 38 |
if(height) {output += ' height=' + height + ' ';} |
| 39 |
if(max_width) {output += ' maxwidth=' + max_width + ' '; } |
| 40 |
output += ']'; |
| 41 |
|
| 42 |
tinyMCEPopup.execCommand('mceInsertContent', false, output); |
| 43 |
|
| 44 |
// Return |
| 45 |
tinyMCEPopup.close(); |
| 46 |
} |
| 47 |
}; |
| 48 |
tinyMCEPopup.onInit.add(ButtonDialog.init, ButtonDialog); |
| 49 |
|
| 50 |
</script> |
| 51 |
<style type="text/css" media="screen"> #vimeo-dialog label {font-size:14px; font-weight: bold; display:block; padding:4px; margin-top: 5px;} #vimeo-dialog input[type=text] {display:block; width: 100%; |
| 52 |
padding: 8px; |
| 53 |
box-sizing: border-box; |
| 54 |
} #vimeo-dialog a#insert {margin-top:10px;} #vimeo-dialog span { |
| 55 |
font-size: 10px; |
| 56 |
} |
| 57 |
body {padding: 0 8px; font-size: 0;} |
| 58 |
|
| 59 |
</style> |
| 60 |
|
| 61 |
</head> |
| 62 |
<body> |
| 63 |
<div id="vimeo-dialog"> |
| 64 |
<form action="/" method="get" accept-charset="utf-8"> |
| 65 |
<div> |
| 66 |
<label for="video"><?php _e("Vimeo Link", 'kadencetoolkit'); ?></label> |
| 67 |
<input type="text" name="video" name="video" id="video" /> |
| 68 |
</div> |
| 69 |
<div> |
| 70 |
<label for="width"><?php _e("Width", "virtue"); ?></label> |
| 71 |
<input type="text" name="width" value="" id="width" /> |
| 72 |
<span style="display:inline-block; padding-left:5px;">(*<?php _e("note just use number", 'kadencetoolkit'); ?>)</span> |
| 73 |
</div> |
| 74 |
<div> |
| 75 |
<label for="height"><?php _e("Height", 'kadencetoolkit'); ?></label> |
| 76 |
<input type="text" name="height" value="" id="height" /> |
| 77 |
<span style="display:inline-block; padding-left:5px;">(*<?php _e("note just use number", 'kadencetoolkit'); ?>)</span> |
| 78 |
</div> |
| 79 |
<div> |
| 80 |
<label for="maxwidth"><?php _e("(Optional) Max Width", 'kadencetoolkit'); ?></label> |
| 81 |
<input type="text" name="maxwidth" value="" id="maxwidth" /> |
| 82 |
<span style="display:inline-block; padding-left:5px;">(*<?php _e("note just use number", 'kadencetoolkit'); ?>)</span> |
| 83 |
</div> |
| 84 |
<div> |
| 85 |
<a href="javascript:ButtonDialog.insert(ButtonDialog.local_ed)" id="insert" style="display: block; line-height: 24px; text-align:center"><?php _e("Insert", 'kadencetoolkit'); ?></a> |
| 86 |
</div> |
| 87 |
</form> |
| 88 |
</div> |
| 89 |
</body> |
| 90 |
</html> |