| @@ -3,89 +3,80 @@ | ||
| 3 | 3 | * |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | (function() { |
| 7 | - tinymce.create( | |
| 8 | - 'tinymce.plugins.TimedContentPlugin', | |
| 9 | - { | |
| 10 | - /** | |
| 11 | - * Initializes the plugin, this will be executed after the plugin has been created. | |
| 12 | - * This call is done before the editor instance has finished it's initialization so use the onInit event | |
| 13 | - * of the editor instance to intercept that event. | |
| 14 | - * | |
| 15 | - * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. | |
| 16 | - * @param {string} url Absolute URL to where the plugin is located. | |
| 17 | - */ | |
| 18 | - init : function(ed, url) { | |
| 19 | - var buttonOpts = {}; | |
| 20 | - // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); | |
| 21 | - ed.addCommand( | |
| 22 | - 'mceTimedContent', | |
| 23 | - function() { | |
| 24 | - ed.windowManager.open( | |
| 25 | - { | |
| 26 | - file : ajaxurl + '?action=timedContentPluginGetTinyMCEDialog', | |
| 27 | - width : 640 + parseInt( ed.getLang( 'timed_content.delta_width', 0 ) ), | |
| 28 | - height : 420 + parseInt( ed.getLang( 'timed_content.delta_height', 0 ) ), | |
| 29 | - inline : 1 | |
| 30 | - }, | |
| 31 | - { | |
| 32 | - plugin_url : url, // Plugin absolute URL | |
| 33 | - } | |
| 34 | - ); | |
| 35 | - } | |
| 36 | - ); | |
| 7 | + tinymce.create('tinymce.plugins.TimedContentPlugin', { | |
| 8 | + /** | |
| 9 | + * Initializes the plugin, this will be executed after the plugin has been created. | |
| 10 | + * This call is done before the editor instance has finished it's initialization so use the onInit event | |
| 11 | + * of the editor instance to intercept that event. | |
| 12 | + * | |
| 13 | + * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. | |
| 14 | + * @param {string} url Absolute URL to where the plugin is located. | |
| 15 | + */ | |
| 16 | + init : function(ed, url) { | |
| 17 | + var buttonOpts = {}; | |
| 18 | + // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); | |
| 19 | + ed.addCommand('mceTimedContent', function() { | |
| 20 | + ed.windowManager.open({ | |
| 21 | + file : ajaxurl + '?action=timedContentPluginGetTinyMCEDialog', | |
| 22 | + width : 640 + parseInt(ed.getLang('timed_content.delta_width', 0)), | |
| 23 | + height : 420 + parseInt(ed.getLang('timed_content.delta_height', 0)), | |
| 24 | + inline : 1 | |
| 25 | + }, { | |
| 26 | + plugin_url : url, // Plugin absolute URL | |
| 27 | + }); | |
| 28 | + }); | |
| 37 | 29 | |
| 38 | - if (timedContentAdminTinyMCEOptions.image.length > 0) { | |
| 39 | - buttonOpts.title = timedContentAdminTinyMCEOptions.desc; | |
| 40 | - buttonOpts.cmd = 'mceTimedContent'; | |
| 41 | - buttonOpts.image = url + timedContentAdminTinyMCEOptions.image; | |
| 42 | - } else { | |
| 43 | - buttonOpts.title = timedContentAdminTinyMCEOptions.desc; | |
| 44 | - buttonOpts.cmd = 'mceTimedContent'; | |
| 45 | - } | |
| 46 | - buttonOpts.stateSelector = "img"; | |
| 30 | + if (timedContentAdminTinyMCEOptions.image.length > 0) { | |
| 31 | + buttonOpts.title = timedContentAdminTinyMCEOptions.desc; | |
| 32 | + buttonOpts.cmd = 'mceTimedContent'; | |
| 33 | + buttonOpts.image = url + timedContentAdminTinyMCEOptions.image; | |
| 34 | + } else { | |
| 35 | + buttonOpts.title = timedContentAdminTinyMCEOptions.desc; | |
| 36 | + buttonOpts.cmd = 'mceTimedContent'; | |
| 37 | + } | |
| 38 | + buttonOpts.stateSelector = "img"; | |
| 47 | 39 | |
| 48 | - // Register example button | |
| 49 | - ed.addButton( 'timed_content', buttonOpts ); | |
| 40 | + // Register example button | |
| 41 | + ed.addButton('timed_content', buttonOpts); | |
| 50 | 42 | |
| 51 | - // Add a node change handler, selects the button in the UI when a image is selected | |
| 52 | - // ed.on( 'NodeChange', function(ed, cm, n) { | |
| 53 | - // cm.setActive('timed_content', n.nodeName == 'IMG'); | |
| 54 | - // }); | |
| 55 | - }, | |
| 43 | + // Add a node change handler, selects the button in the UI when a image is selected | |
| 44 | +// ed.on( 'NodeChange', function(ed, cm, n) { | |
| 45 | +// cm.setActive('timed_content', n.nodeName == 'IMG'); | |
| 46 | +// }); | |
| 47 | + }, | |
| 56 | 48 | |
| 57 | - /** | |
| 58 | - * Creates control instances based in the incoming name. This method is normally not | |
| 59 | - * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons | |
| 60 | - * but you sometimes need to create more complex controls like list-boxes, split buttons, etc. then this | |
| 61 | - * method can be used to create those. | |
| 62 | - * | |
| 63 | - * @param {String} n Name of the control to create. | |
| 64 | - * @param {tinymce.ControlManager} cm Control manager to use in order to create new control. | |
| 65 | - * @return {tinymce.ui.Control} New control instance or null if no control was created. | |
| 66 | - */ | |
| 67 | - createControl : function(n, cm) { | |
| 68 | - return null; | |
| 69 | - }, | |
| 49 | + /** | |
| 50 | + * Creates control instances based in the incoming name. This method is normally not | |
| 51 | + * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons | |
| 52 | + * but you sometimes need to create more complex controls like list-boxes, split buttons, etc. then this | |
| 53 | + * method can be used to create those. | |
| 54 | + * | |
| 55 | + * @param {String} n Name of the control to create. | |
| 56 | + * @param {tinymce.ControlManager} cm Control manager to use in order to create new control. | |
| 57 | + * @return {tinymce.ui.Control} New control instance or null if no control was created. | |
| 58 | + */ | |
| 59 | + createControl : function(n, cm) { | |
| 60 | + return null; | |
| 61 | + }, | |
| 70 | 62 | |
| 71 | - /** | |
| 72 | - * Returns information about the plugin as a name/value array. | |
| 73 | - * The current keys are longname, author, authorurl, infourl and version. | |
| 74 | - * | |
| 75 | - * @return {Object} Name/value array containing information about the plugin. | |
| 76 | - */ | |
| 77 | - getInfo : function() { | |
| 78 | - return { | |
| 79 | - longname : 'Timed Content shortcodes plugin', | |
| 80 | - author : 'K. Tough', | |
| 81 | - authorurl : 'http://wordpress.org/plugins/timed-content/', | |
| 82 | - infourl : 'http://wordpress.org/plugins/timed-content/', | |
| 83 | - version : timedContentAdminTinyMCEOptions.version | |
| 84 | - }; | |
| 85 | - } | |
| 63 | + /** | |
| 64 | + * Returns information about the plugin as a name/value array. | |
| 65 | + * The current keys are longname, author, authorurl, infourl and version. | |
| 66 | + * | |
| 67 | + * @return {Object} Name/value array containing information about the plugin. | |
| 68 | + */ | |
| 69 | + getInfo : function() { | |
| 70 | + return { | |
| 71 | + longname : 'Timed Content shortcodes plugin', | |
| 72 | + author : 'K. Tough', | |
| 73 | + authorurl : 'http://wordpress.org/plugins/timed-content/', | |
| 74 | + infourl : 'http://wordpress.org/plugins/timed-content/', | |
| 75 | + version : timedContentAdminTinyMCEOptions.version | |
| 76 | + }; | |
| 86 | 77 | } |
| 87 | - ); | |
| 78 | + }); | |
| 88 | 79 | |
| 89 | 80 | // Register plugin |
| 90 | - tinymce.PluginManager.add( 'timed_content', tinymce.plugins.TimedContentPlugin ); | |
| 91 | -})(); | |
| 81 | + tinymce.PluginManager.add('timed_content', tinymce.plugins.TimedContentPlugin); | |
| 82 | +})(); | |