// closure to avoid namespace collision (function(){ // creates the plugin tinymce.create('tinymce.plugins.tinymce_button', { // creates control instances based on the control's id. // our button's id is "dd_button" createControl : function(id, controlManager) { if (id == 'dd_button') { // creates the button var button = controlManager.createButton('dd_button', { title : 'Custom Shortcodes', // title of the button image : '../wp-content/themes/aerial/lib/admin/images/avatar.png', // path to the button's image onclick : function() { // triggers the thickbox var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width; W = W - 80; H = H - 84; tb_show( 'Styles Shortcodes', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=shortcode-form' ); } }); return button; } return null; } }); // registers the plugin. DON'T MISS THIS STEP!!! tinymce.PluginManager.add('tinymce_button', tinymce.plugins.tinymce_button); // executes this when the DOM is ready jQuery(function(){ // creates a form to be displayed everytime the button is clicked // you should achieve this using AJAX instead of direct html code like this var form = jQuery('
| \ | \ \ |
|---|
\ \
\