-/* Import plugin specific language pack */\r
-tinyMCE.importPluginLanguagePack('advhr', 'en,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,zh_tw,zh_tw_utf8,sk');\r
-\r
-function TinyMCE_advhr_getInfo() {\r
- return {\r
- longname : 'Advanced HR',\r
- author : 'Moxiecode Systems',\r
- authorurl : 'http://tinymce.moxiecode.com',\r
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_advhr.html',\r
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
- };\r
-};\r
-\r
-function TinyMCE_advhr_getControlHTML(control_name) {\r
- switch (control_name) {\r
- case "advhr":\r
- var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceAdvancedHr\');return false;';\r
- return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_advhr" src="{$pluginurl}/images/advhr.gif" title="{$lang_insert_advhr_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';\r
- }\r
-\r
- return "";\r
-}\r
-\r
/**\r
- * Executes the mceAdvanceHr command.\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
*/\r
-function TinyMCE_advhr_execCommand(editor_id, element, command, user_interface, value) {\r
- // Handle commands\r
- switch (command) {\r
- case "mceAdvancedHr":\r
- var template = new Array();\r
-\r
- template['file'] = '../../plugins/advhr/rule.htm'; // Relative to theme\r
- template['width'] = 270;\r
- template['height'] = 180;\r
-\r
- template['width'] += tinyMCE.getLang('lang_advhr_delta_width', 0);\r
- template['height'] += tinyMCE.getLang('lang_advhr_delta_height', 0);\r
-\r
- var size = "", width = "", noshade = "";\r
- if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "hr"){\r
- tinyMCE.hrElement = tinyMCE.selectedElement;\r
- if (tinyMCE.hrElement) {\r
- size = tinyMCE.hrElement.getAttribute('size') ? tinyMCE.hrElement.getAttribute('size') : "";\r
- width = tinyMCE.hrElement.getAttribute('width') ? tinyMCE.hrElement.getAttribute('width') : "";\r
- noshade = tinyMCE.hrElement.getAttribute('noshade') ? tinyMCE.hrElement.getAttribute('noshade') : "";\r
- }\r
- tinyMCE.openWindow(template, {editor_id : editor_id, size : size, width : width, noshade : noshade, mceDo : 'update'});\r
- } else {\r
- if (tinyMCE.isMSIE) {\r
- tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false,'<hr />');\r
- } else {\r
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", size : size, width : width, noshade : noshade, mceDo : 'insert'});\r
- }\r
- }\r
- \r
- return true;\r
- }\r
- // Pass to next handler in chain\r
- return false;\r
-}\r
-\r
-function TinyMCE_advhr_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
- tinyMCE.switchClassSticky(editor_id + '_advhr', 'mceButtonNormal');\r
-\r
- if (node == null)\r
- return;\r
-\r
- do {\r
- if (node.nodeName.toLowerCase() == "hr")\r
- tinyMCE.switchClassSticky(editor_id + '_advhr', 'mceButtonSelected');\r
- } while ((node = node.parentNode));\r
\r
- return true;\r
-}
\ No newline at end of file
+(function() {\r
+ tinymce.create('tinymce.plugins.AdvancedHRPlugin', {\r
+ init : function(ed, url) {\r
+ // Register commands\r
+ ed.addCommand('mceAdvancedHr', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/rule.htm',\r
+ width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),\r
+ height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ // Register buttons\r
+ ed.addButton('advhr', {\r
+ title : 'advhr.advhr_desc',\r
+ cmd : 'mceAdvancedHr'\r
+ });\r
+\r
+ ed.onNodeChange.add(function(ed, cm, n) {\r
+ cm.setActive('advhr', n.nodeName == 'HR');\r
+ });\r
+\r
+ ed.onClick.add(function(ed, e) {\r
+ e = e.target;\r
+\r
+ if (e.nodeName === 'HR')\r
+ ed.selection.select(e);\r
+ });\r
+ },\r
+\r
+ getInfo : function() {\r
+ return {\r
+ longname : 'Advanced HR',\r
+ author : 'Moxiecode Systems AB',\r
+ authorurl : 'http://tinymce.moxiecode.com',\r
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',\r
+ version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+ };\r
+ }\r
+ });\r
+\r
+ // Register plugin\r
+ tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);\r
+})();
\ No newline at end of file