80ab81700050b5a5bfe2b4b3072859d0f27e94a9
[project/tinymce.git] / plugins / drupalbreak / editor_plugin.js
1 tinyMCE.importPluginLanguagePack("drupalbreak","en");function TinyMCE_drupalbreak_getInfo(){return {longname:"Drupal Teaser/Body Break",author:"Nathan Haug",authorurl:"http://www.quicksketch.org",infourl:"",version:"1.1"};}function TinyMCE_drupalbreak_initInstance(_1){tinyMCE.importCSS(_1.getDoc(),tinyMCE.baseURL+"/plugins/drupalbreak/drupalbreak.css");}function TinyMCE_drupalbreak_getControlHTML(_2){switch(_2){case "drupalbreak":var _3="tinyMCE.execInstanceCommand('{$editor_id}','mcedrupalbreak',true);return false;";return "<a href=\"javascript:"+_3+"\" onclick=\""+_3+"\" target=\"_self\" onmousedown=\"return false;\"><img id=\"{$editor_id}_drupalbreak\" src=\"{$pluginurl}/images/drupalbreak.gif\" title=\"{$lang_drupalbreak_desc}\" width=\"20\" height=\"20\" class=\"mceButtonNormal\" onmouseover=\"tinyMCE.switchClass(this,'mceButtonOver');\" onmouseout=\"tinyMCE.restoreClass(this);\" onmousedown=\"tinyMCE.restoreAndSwitchClass(this,'mceButtonDown');\" /></a>";case "drupalpagebreak":var _4="tinyMCE.execInstanceCommand('{$editor_id}','mcedrupalpagebreak',true);return false;";return "<a href=\"javascript:"+_4+"\" onclick=\""+_4+"\" target=\"_self\" onmousedown=\"return false;\"><img id=\"{$editor_id}_drupalpagebreak\" src=\"{$pluginurl}/images/drupalpagebreak.gif\" title=\"{$lang_drupalpagebreak_desc}\" width=\"20\" height=\"20\" class=\"mceButtonNormal\" onmouseover=\"tinyMCE.switchClass(this,'mceButtonOver');\" onmouseout=\"tinyMCE.restoreClass(this);\" onmousedown=\"tinyMCE.restoreAndSwitchClass(this,'mceButtonDown');\" /></a>";}return "";}function TinyMCE_drupalbreak_parseAttributes(_5){var _6="";var _7="";var _8;var _9;var _a=new Array();var _b=new RegExp("^[ \n\r\t]+","g");if(_5==null||_5.length<2){return null;}_8=_9=false;for(var i=0;i<_5.length;i++){var _d=_5.charAt(i);if((_d=="\""||_d=="'")&&!_9){_9=true;}else{if((_d=="\""||_d=="'")&&_9){_9=false;var _e=_6.lastIndexOf(" ");if(_e!=-1){_6=_6.substring(_e+1);}_a[_6.toLowerCase()]=_7.substring(1).toLowerCase();_6="";_7="";}else{if(!_b.test(_d)&&!_8&&!_9){_8=true;}}}if(_d=="="&&_8){_8=false;}if(_8){_6+=_d;}if(_9){_7+=_d;}}return _a;}function TinyMCE_drupalbreak_execCommand(_f,_10,_11,_12,_13){function getAttrib(elm,_15){return elm.getAttribute(_15)?elm.getAttribute(_15):"";}switch(_11){case "mcedrupalbreak":var _16="";var _17=new Array();var _18=tinyMCE.getInstanceById(_f);var _19=_18.getFocusElement();if(_19!=null&&_19.nodeName.toLowerCase()=="img"){_16=getAttrib(_19,"class");if(_16!="mce_plugin_drupalbreak_break"){return true;}action="update";}html=""+"<img src=\""+(tinyMCE.getParam("theme_href")+"/images/spacer.gif")+"\" "+" width=\"100%\" height=\"12px\" "+"alt=\"&lt;--break-&gt;\" title=\"&lt;--break--&gt;\" class=\"mce_plugin_drupalbreak_break\" />";tinyMCE.execCommand("mceInsertContent",true,html);tinyMCE.selectedInstance.repaint();return true;case "mcedrupalpagebreak":var _1a="";var _1b=new Array();var _1c=tinyMCE.getInstanceById(_f);var _1d=_1c.getFocusElement();if(_1d!=null&&_1d.nodeName.toLowerCase()=="img"){_1a=getAttrib(_1d,"class");if(_1a!="mce_plugin_drupalbreak_pagebreak"){return true;}action="update";}html=""+"<img src=\""+(tinyMCE.getParam("theme_href")+"/images/spacer.gif")+"\" "+" width=\"100%\" height=\"12px\" "+"alt=\"&lt;--pagebreak-&gt;\" title=\"&lt;--pagebreak--&gt;\" class=\"mce_plugin_drupalbreak_pagebreak\" />";tinyMCE.execCommand("mceInsertContent",true,html);tinyMCE.selectedInstance.repaint();return true;}return false;}function TinyMCE_drupalbreak_cleanup(_1e,_1f){switch(_1e){case "insert_to_editor":var _20=0;while((_20=_1f.indexOf("<!--break-->",_20))!=-1){var _21=_1f.substring(_20+12);_1f=_1f.substring(0,_20);_1f+="<img src=\""+(tinyMCE.getParam("theme_href")+"/images/spacer.gif")+"\" ";_1f+=" width=\"100%\" height=\"12px\" ";_1f+="alt=\"&lt;--break-&gt;\" title=\"&lt;--break--&gt;\" class=\"mce_plugin_drupalbreak_break\" />";_1f+=_21;_20++;}var _22=0;while((_22=_1f.indexOf("<!--pagebreak-->",_22))!=-1){var _23=_1f.substring(_22+16);_1f=_1f.substring(0,_22);_1f+="<img src=\""+(tinyMCE.getParam("theme_href")+"/images/spacer.gif")+"\" ";_1f+=" width=\"100%\" height=\"12px\" ";_1f+="alt=\"&lt;--pagebreak-&gt;\" title=\"&lt;--pagebreak--&gt;\" class=\"mce_plugin_drupalbreak_pagebreak\" />";_1f+=_23;_22++;}break;case "get_from_editor":var _24=-1;while((_24=_1f.indexOf("<img",_24+1))!=-1){var _25=_1f.indexOf("/>",_24);var _26=TinyMCE_drupalbreak_parseAttributes(_1f.substring(_24+4,_25));if(_26["class"]=="mce_plugin_drupalbreak_break"){_25+=2;var _27="<!--break-->";chunkBefore=_1f.substring(0,_24);chunkAfter=_1f.substring(_25);_1f=chunkBefore+_27+chunkAfter;}if(_26["class"]=="mce_plugin_drupalbreak_pagebreak"){_25+=2;var _28="<!--pagebreak-->";chunkBefore=_1f.substring(0,_24);chunkAfter=_1f.substring(_25);_1f=chunkBefore+_28+chunkAfter;}}break;}return _1f;}function TinyMCE_drupalbreak_handleNodeChange(_29,_2a,_2b,_2c,_2d,_2e){function getAttrib(elm,_30){return elm.getAttribute(_30)?elm.getAttribute(_30):"";}tinyMCE.switchClassSticky(_29+"_drupalbreak_break","mceButtonNormal");tinyMCE.switchClassSticky(_29+"_drupalbreak_pagebreak","mceButtonNormal");if(_2a==null){return;}do{if(_2a.nodeName.toLowerCase()=="img"&&getAttrib(_2a,"class").indexOf("mce_plugin_drupalbreak_break")==0){tinyMCE.switchClassSticky(_29+"_drupalbreak_break","mceButtonSelected");}if(_2a.nodeName.toLowerCase()=="img"&&getAttrib(_2a,"class").indexOf("mce_plugin_drupalbreak_pagebreak")==0){tinyMCE.switchClassSticky(_29+"_drupalbreak_pagebreak","mceButtonSelected");}}while((_2a=_2a.parentNode));return true;}