Make WordPress Core

Changeset 6694


Ignore:
Timestamp:
01/31/2008 06:10:46 PM (17 years ago)
Author:
ryan
Message:

TinyMCE 3.0 Final from azaozz. see #5674

Location:
trunk
Files:
26 added
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/post.js

    r6675 r6694  
    179179    jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
    180180});
     181
     182wpEditorInit = function() {
     183    // Activate tinyMCE if it's the user's default editor
     184    if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
     185        document.getElementById('editorcontainer').style.padding = '0px';
     186        tinyMCE.execCommand("mceAddControl", true, "content");
     187    } else {
     188        var H;
     189        if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
     190            document.getElementById('content').style.height = H.ch - 30 + 'px';
     191    }
     192};
     193
     194switchEditors = {
     195   
     196    saveCallback : function(el, content, body) {
     197   
     198        document.getElementById(el).style.color = '#fff';
     199        if ( tinyMCE.activeEditor.isHidden() )
     200            content = document.getElementById(el).value;
     201        else
     202            content = this.pre_wpautop(content);
     203
     204        return content;
     205    },
     206
     207    pre_wpautop : function(content) {
     208       // We have a TON of cleanup to do.
     209
     210        // content = content.replace(/\n|\r/g, ' ');
     211        // Remove anonymous, empty paragraphs.
     212        content = content.replace(new RegExp('<p>(\\s|&nbsp;|<br>)*</p>', 'mg'), '');
     213
     214        // Mark </p> if it has any attributes.
     215        content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
     216
     217        // Get it ready for wpautop.
     218        content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
     219        content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
     220        content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
     221        content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
     222
     223        // Fix some block element newline issues
     224        var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
     225        content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
     226        content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
     227        content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
     228       
     229        if ( content.indexOf('<object') != -1 ) {
     230            content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed
     231            content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>');
     232        }
     233       
     234        // Unmark special paragraph closing tags
     235        content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
     236        content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
     237
     238        // Trim trailing whitespace
     239        content = content.replace(new RegExp('\\s*$', ''), '');
     240
     241        // Hope.
     242        return content;
     243    },
     244
     245    go : function(id) {
     246        var ed = tinyMCE.get(id);
     247        var qt = document.getElementById('quicktags');
     248        var H = document.getElementById('edButtonHTML');
     249        var P = document.getElementById('edButtonPreview');
     250        var ta = document.getElementById(id);
     251        var ec = document.getElementById('editorcontainer');
     252
     253        if ( ! ed || ed.isHidden() ) {
     254            ta.style.color = '#fff';
     255       
     256            this.edToggle(P, H);
     257            edCloseAllTags(); // :-(
     258
     259            qt.style.display = 'none';
     260            ec.style.padding = '0px';
     261
     262            ta.value = this.wpautop(ta.value);
     263
     264            if ( ed ) ed.show();
     265            else tinyMCE.execCommand("mceAddControl", false, id);
     266       
     267            this.wpSetDefaultEditor( 'tinymce' );
     268        } else {
     269            this.edToggle(H, P);
     270            tinyMCE.triggerSave();
     271            ta.style.height = tinyMCE.activeEditor.contentAreaContainer.offsetHeight + 6 + 'px';
     272
     273            if ( tinymce.isIE6 )
     274                ta.style.width = tinyMCE.activeEditor.contentAreaContainer.offsetWidth - 12 + 'px';
     275
     276            ed.hide();
     277            ta.value = this.pre_wpautop(ta.value);
     278       
     279            qt.style.display = 'block';
     280            ec.style.padding = '6px';
     281            ta.style.color = '';
     282
     283            this.wpSetDefaultEditor( 'html' );
     284        }
     285    },
     286
     287    edToggle : function(A, B) {
     288        A.className = 'active';
     289        B.className = '';
     290
     291        B.onclick = A.onclick;
     292        A.onclick = null;
     293    },
     294
     295    wpSetDefaultEditor : function( editor ) {
     296        try {
     297            editor = escape( editor.toString() );
     298        } catch(err) {
     299            editor = 'tinymce';
     300        }
     301
     302        var userID = document.getElementById('user-id');
     303        var date = new Date();
     304        date.setTime(date.getTime()+(10*365*24*60*60*1000));
     305        document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
     306    },
     307
     308    wpautop : function(pee) {
     309        var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]';
     310   
     311        pee = pee + "\n\n";
     312        pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
     313        pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
     314        pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
     315        pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
     316        pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
     317        pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
     318        pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
     319        pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
     320        pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
     321        pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
     322        pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
     323        pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
     324        pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
     325        pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
     326        pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
     327        pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
     328        pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
     329        //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' "); // Hmm...
     330        return pee;
     331    }
     332}
  • trunk/wp-admin/wp-admin.css

    r6638 r6694  
    371371}
    372372
    373 #postdivrich #content {
    374     padding: 5px;
    375     line-height: 140%;
     373#editorcontainer #content {
     374    padding: 0;
     375    line-height: 150%;
     376    border: 0 none;
     377}
     378
     379#editorcontainer {
     380    padding: 6px;
    376381}
    377382
     
    395400
    396401#postdivrich #quicktags {
    397     background: #f0f0ee;
    398     padding: 0;
    399     border: 1px solid #ccc;
    400     border-bottom: none;
     402    background: #cee1ef;
     403    padding: 0;
     404    border: 0 none;
    401405}
    402406
     
    11791183}
    11801184
    1181 #poststuff .postbox, #titlediv {
     1185#poststuff .postbox, #titlediv, #poststuff .postarea {
    11821186    margin-left: 20px;
    11831187    border: 1px solid #ebebeb;
     
    11891193
    11901194#poststuff .postarea {
    1191     margin-left: 20px;
    11921195    margin-right: 8px;
    11931196}
     
    12241227#poststuff #edButtonPreview, #poststuff #edButtonHTML {
    12251228    display: block;
    1226     height: 18px;
     1229    height: 20px;
    12271230    padding: 5px;
    12281231    margin-right: 8px;
     
    12361239    color: #333;
    12371240    font-weight: bold;
    1238     -moz-border-radius: 2px;
     1241    -moz-border-radius-topright: 2px;
     1242    -moz-border-radius-topleft: 2px;
    12391243}
    12401244
  • trunk/wp-includes/general-template.php

    r6682 r6694  
    929929        $wp_default_editor = wp_default_editor();
    930930        $active = " class='active'";
    931         $inactive = " onclick='switchEditors(\"$id\");'";
     931        $inactive = " onclick='switchEditors.go(\"$id\");'";
    932932
    933933        if ( 'tinymce' == $wp_default_editor )
    934934            add_filter('the_editor_content', 'wp_richedit_pre');
    935935
    936         //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it.
    937     ?>
    938     <style type="text/css">
     936        //  The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 
     937        ?> 
     938    <style type="text/css">
    939939        #postdivrich table, #postdivrich #quicktags {border-top: none;}
    940940        #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;}
    941941    </style>
     942   
    942943    <div id='editor-toolbar' style='display:none;'>
    943         <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div>
     944        <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div>
    944945        <a id='edButtonHTML'<?php echo 'html' == $wp_default_editor ? $active : $inactive; ?>><?php _e('HTML'); ?></a>
    945946            <a id='edButtonPreview'<?php echo 'tinymce' == $wp_default_editor ? $active : $inactive; ?>><?php _e('Visual'); ?></a>
     
    974975    <?php endif; // 'html' != $wp_default_editor
    975976
    976     $the_editor = apply_filters('the_editor', "<div><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
     977    $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
    977978    $the_editor_content = apply_filters('the_editor_content', $content);
    978979
     
    987988    if ( typeof tinyMCE != 'undefined' ) {
    988989    // This code is meant to allow tabbing from Title to Post (TinyMCE).
    989         if ( tinyMCE.isMSIE ) {
    990             document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
    991                 if ( tinyMCE.idCounter == 0 )
    992                     return true;
    993                 e = e ? e : window.event;
    994                 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    995                     var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
    996                     if(typeof i ==  'undefined')
    997                         return true;
    998                     tinyMCE.execCommand("mceStartTyping");
    999                     this.blur();
    1000                     i.contentWindow.focus();
    1001                     e.returnValue = false;
    1002                     return false;
    1003                 }
    1004             }
    1005         } else {
    1006             document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e) {
    1007                 if ( tinyMCE.idCounter == 0 )
    1008                     return true;
    1009                 e = e ? e : window.event;
    1010                 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
    1011                     var i = tinyMCE.getInstanceById('<?php echo $id; ?>');
    1012                     if(typeof i ==  'undefined')
    1013                         return true;
    1014                     tinyMCE.execCommand("mceStartTyping");
    1015                     this.blur();
    1016                     i.contentWindow.focus();
    1017                     e.returnValue = false;
    1018                     return false;
    1019                 }
    1020             }
    1021         }
     990        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
     991            e = e || window.event;
     992            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     993                if ( tinyMCE.activeEditor ) {
     994                    e = null;
     995                    if ( tinyMCE.activeEditor.isHidden() ) return true;
     996                    tinyMCE.activeEditor.focus();
     997                    return false;
     998                }
     999                return true;
     1000            }
     1001        }
    10221002    }
    10231003    <?php endif; ?>
  • trunk/wp-includes/js/autosave.js

    r6649 r6694  
    8383
    8484function autosave() {
    85     var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false;
     85    var rich = ( (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() ) ? true : false;
    8686    var post_data = {
    8787            action: "autosave",
     
    9494
    9595    /* Gotta do this up here so we can check the length when tinyMCE is in use */
    96     if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
    97         post_data["content"] = jQuery("#content").val();
    98     } else {
     96    if ( rich ) {
    9997        // Don't run while the TinyMCE spellcheck is on.
    100         if(tinyMCE.selectedInstance.spellcheckerOn) return;
    101         tinyMCE.wpTriggerSave();
    102         post_data["content"] = jQuery("#content").val();
    103     }
     98        if ( tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) return;
     99        tinyMCE.triggerSave();
     100    }
     101   
     102    post_data["content"] = jQuery("#content").val();
    104103
    105104    if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) {
     
    123122        post_data["excerpt"] = jQuery("#excerpt").val();
    124123
    125     if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) {
    126         post_data["content"] = jQuery("#content").val();
    127     } else {
    128         tinyMCE.wpTriggerSave();
    129         post_data["content"] = jQuery("#content").val();
    130     }
     124    if ( rich )
     125        tinyMCE.triggerSave();
     126   
     127    post_data["content"] = jQuery("#content").val();
    131128
    132129    if(parseInt(post_data["post_ID"]) < 1) {
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id$
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     tinymce.create('tinymce.plugins.AutoSavePlugin', {
    10         init : function(ed, url) {
    11             var t = this;
    12 
    13             t.editor = ed;
    14 
    15             window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;
    16         },
    17 
    18         getInfo : function() {
    19             return {
    20                 longname : 'Auto save',
    21                 author : 'Moxiecode Systems AB',
    22                 authorurl : 'http://tinymce.moxiecode.com',
    23                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
    24                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    25             };
    26         },
    27 
    28         // Private plugin internal methods
    29 
    30         'static' : {
    31             _beforeUnloadHandler : function() {
    32                 var msg;
    33 
    34                 tinymce.each(tinyMCE.editors, function(ed) {
    35                     if (ed.getParam("fullscreen_is_enabled"))
    36                         return;
    37 
    38                     if (ed.isDirty()) {
    39                         msg = ed.getLang("autosave.unload_msg");
    40                         return false;
    41                     }
    42                 });
    43 
    44                 return msg;
    45             }
    46         }
    47     });
    48 
    49     // Register plugin
    50     tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin);
    51 })();
     1(function(){tinymce.create('tinymce.plugins.AutoSavePlugin',{init:function(ed,url){var t=this;t.editor=ed;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;},getInfo:function(){return{longname:'Auto save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',version:tinymce.majorVersion+"."+tinymce.minorVersion};},'static':{_beforeUnloadHandler:function(){var msg;tinymce.each(tinyMCE.editors,function(ed){if(ed.getParam("fullscreen_is_enabled"))return;if(ed.isDirty()){msg=ed.getLang("autosave.unload_msg");return false;}});return msg;}}});tinymce.PluginManager.add('autosave',tinymce.plugins.AutoSavePlugin);})();
  • trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     tinymce.create('tinymce.plugins.Directionality', {
    10         init : function(ed, url) {
    11             var t = this;
    12 
    13             t.editor = ed;
    14 
    15             ed.addCommand('mceDirectionLTR', function() {
    16                 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
    17 
    18                 if (e) {
    19                     if (ed.dom.getAttrib(e, "dir") != "ltr")
    20                         ed.dom.setAttrib(e, "dir", "ltr");
    21                     else
    22                         ed.dom.setAttrib(e, "dir", "");
    23                 }
    24 
    25                 ed.nodeChanged();
    26             });
    27 
    28             ed.addCommand('mceDirectionRTL', function() {
    29                 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
    30 
    31                 if (e) {
    32                     if (ed.dom.getAttrib(e, "dir") != "rtl")
    33                         ed.dom.setAttrib(e, "dir", "rtl");
    34                     else
    35                         ed.dom.setAttrib(e, "dir", "");
    36                 }
    37 
    38                 ed.nodeChanged();
    39             });
    40 
    41             ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
    42             ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
    43 
    44             ed.onNodeChange.add(t._nodeChange, t);
    45         },
    46 
    47         getInfo : function() {
    48             return {
    49                 longname : 'Directionality',
    50                 author : 'Moxiecode Systems AB',
    51                 authorurl : 'http://tinymce.moxiecode.com',
    52                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
    53                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    54             };
    55         },
    56 
    57         // Private methods
    58 
    59         _nodeChange : function(ed, cm, n) {
    60             var dom = ed.dom, dir;
    61 
    62             n = dom.getParent(n, dom.isBlock);
    63             if (!n) {
    64                 cm.setDisabled('ltr', 1);
    65                 cm.setDisabled('rtl', 1);
    66                 return;
    67             }
    68 
    69             dir = dom.getAttrib(n, 'dir');
    70             cm.setActive('ltr', dir == "ltr");
    71             cm.setDisabled('ltr', 0);
    72             cm.setActive('rtl', dir == "rtl");
    73             cm.setDisabled('rtl', 0);
    74         }
    75     });
    76 
    77     // Register plugin
    78     tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
    79 })();
     1(function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})();
  • trunk/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js

    r6689 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 544 2008-01-17 13:07:00Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var DOM = tinymce.DOM;
    10 
    11     tinymce.create('tinymce.plugins.FullScreenPlugin', {
    12         init : function(ed, url) {
    13             var t = this, s = {}, vp;
    14 
    15             t.editor = ed;
    16 
    17             // Register commands
    18             ed.addCommand('mceFullScreen', function() {
    19                 var win, de = document.documentElement;
    20 
    21                 if (ed.getParam('fullscreen_is_enabled')) {
    22                     if (ed.getParam('fullscreen_new_window'))
    23                         closeFullscreen(); // Call to close in new window
    24                     else {
    25                         window.setTimeout(function() {
    26                             tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
    27                             tinyMCE.remove(ed);
    28                             DOM.remove('mce_fullscreen_container');
    29                             de.style.overflow = ed.getParam('fullscreen_html_overflow');
    30                             DOM.setStyle(document.body, 'overflow', ed.getParam('fullscreen_overflow'));
    31                             window.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
    32                         }, 10);
    33                     }
    34 
    35                     return;
    36                 }
    37 
    38                 if (ed.getParam('fullscreen_new_window')) {
    39                     win = window.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
    40                     try {
    41                         win.resizeTo(screen.availWidth, screen.availHeight);
    42                     } catch (e) {
    43                         // Ignore
    44                     }
    45                 } else {
    46                     s.fullscreen_overflow = DOM.getStyle(document.body, 'overflow', 1) || 'auto';
    47                     s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
    48                     vp = DOM.getViewPort();
    49                     s.fullscreen_scrollx = vp.x;
    50                     s.fullscreen_scrolly = vp.y;
    51 
    52                     // Fixes an Opera bug where the scrollbars doesn't reappear
    53                     if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
    54                         s.fullscreen_overflow = 'auto';
    55 
    56                     // Fixes an IE bug where horizontal scrollbars would appear
    57                     if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
    58                         s.fullscreen_overflow = 'auto';
    59 
    60                     if (s.fullscreen_overflow == '0px')
    61                         s.fullscreen_overflow = '';
    62 
    63                     DOM.setStyle(document.body, 'overflow', 'hidden');
    64                     de.style.overflow = 'hidden'; //Fix for IE6/7
    65                     vp = DOM.getViewPort();
    66                     window.scrollTo(0, 0);
    67 
    68                     if (tinymce.isIE)
    69                         vp.h -= 1;
    70 
    71                     n = DOM.add(document.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:150;'});
    72                     DOM.add(n, 'div', {id : 'mce_fullscreen'});
    73 
    74                     tinymce.each(ed.settings, function(v, n) {
    75                         s[n] = v;
    76                     });
    77 
    78                     s.id = 'mce_fullscreen';
    79                     s.width = n.clientWidth;
    80                     s.height = n.clientHeight - 15;
    81                     s.fullscreen_is_enabled = true;
    82                     s.fullscreen_editor_id = ed.id;
    83                     s.theme_advanced_resizing = false;
    84 
    85                     tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
    86                         s[k] = v;
    87                     });
    88 
    89                     if (s.theme_advanced_toolbar_location === 'external')
    90                         s.theme_advanced_toolbar_location = 'top';
    91 
    92                     t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
    93                     t.fullscreenEditor.onInit.add(function() {
    94                         t.fullscreenEditor.setContent(ed.getContent({format : 'raw', no_events : 1}), {format : 'raw', no_events : 1});
    95                     });
    96 
    97                     t.fullscreenEditor.render();
    98                     tinyMCE.add(t.fullscreenEditor);
    99 
    100                     t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
    101                     t.fullscreenElement.update();
    102                     //document.body.overflow = 'hidden';
    103                 }
    104             });
    105 
    106             // Register buttons
    107             ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
    108 
    109             ed.onNodeChange.add(function(ed, cm) {
    110                 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
    111             });
    112         },
    113 
    114         getInfo : function() {
    115             return {
    116                 longname : 'Fullscreen',
    117                 author : 'Moxiecode Systems AB',
    118                 authorurl : 'http://tinymce.moxiecode.com',
    119                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
    120                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    121             };
    122         }
    123     });
    124 
    125     // Register plugin
    126     tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
    127 })();
     1(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=document.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{window.setTimeout(function(){tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(document.body,'overflow',ed.getParam('fullscreen_overflow'));window.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));},10);}return;}if(ed.getParam('fullscreen_new_window')){win=window.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{s.fullscreen_overflow=DOM.getStyle(document.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(document.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();window.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(document.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:150;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent({format:'raw',no_events:1}),{format:'raw',no_events:1});});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})();
  • trunk/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm

    r6689 r6694  
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    12<html xmlns="http://www.w3.org/1999/xhtml">
    23<head>
    3     <title>{$lang_fullscreen_title}</title>
     4    <title></title>
    45    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    56    <script type="text/javascript" src="../../tiny_mce.js"></script>
     
    7071            return false;
    7172        }
    72 
    73         function init() {
    74             var e = document.getElementById('fullscreenarea');
    75             e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'});
    76             settings['width'] = e.clientWidth;
    77             settings['height'] = e.clientHeight;
    78             tinyMCE.init(settings);
    79         }
    8073    </script>
    8174    <base target="_self" />
    8275</head>
    83 <body onload="init();" style="margin:0; overflow:hidden; height:100%;" scrolling="no" scroll="no">
    84 <form onsubmit="doParentSubmit();" style="height: 100%">
     76<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
     77<form onsubmit="doParentSubmit();">
    8578<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
    8679</form>
     80
     81<script type="text/javascript">
     82        var e = document.getElementById('fullscreenarea');
     83        e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'});
     84        settings['width'] = window.innerWidth || document.body.clientWidth;
     85        settings['height'] = (window.innerHeight || document.body.clientHeight) - 18;
     86        tinyMCE.init(settings);
     87</script>
     88
    8789</body>
    8890</html>
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
    10 
    11     tinymce.create('tinymce.plugins.InlinePopups', {
    12         init : function(ed, url) {
    13             // Replace window manager
    14             ed.onBeforeRenderUI.add(function() {
    15                 ed.windowManager = new tinymce.InlineWindowManager(ed);
    16                 DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
    17             });
    18         },
    19 
    20         getInfo : function() {
    21             return {
    22                 longname : 'InlinePopups',
    23                 author : 'Moxiecode Systems AB',
    24                 authorurl : 'http://tinymce.moxiecode.com',
    25                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
    26                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    27             };
    28         }
    29     });
    30 
    31     tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
    32         InlineWindowManager : function(ed) {
    33             var t = this;
    34 
    35             t.parent(ed);
    36             t.zIndex = 1000;
    37         },
    38 
    39         open : function(f, p) {
    40             var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w;
    41 
    42             f = f || {};
    43             p = p || {};
    44 
    45             // Run native windows
    46             if (!f.inline)
    47                 return t.parent(f, p);
    48 
    49             t.bookmark = ed.selection.getBookmark('simple');
    50             id = DOM.uniqueId();
    51             vp = DOM.getViewPort();
    52             f.width = parseInt(f.width || 320);
    53             f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
    54             f.min_width = parseInt(f.min_width || 150);
    55             f.min_height = parseInt(f.min_height || 100);
    56             f.max_width = parseInt(f.max_width || 2000);
    57             f.max_height = parseInt(f.max_height || 2000);
    58             f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
    59             f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
    60             f.movable = f.resizable = true;
    61             p.mce_width = f.width;
    62             p.mce_height = f.height;
    63             p.mce_inline = true;
    64             p.mce_window_id = id;
    65 
    66             // Transpose
    67 //          po = DOM.getPos(ed.getContainer());
    68 //          f.left -= po.x;
    69 //          f.top -= po.y;
    70 
    71             t.features = f;
    72             t.params = p;
    73             t.onOpen.dispatch(t, f, p);
    74 
    75             if (f.type) {
    76                 opt += ' modal ' + f.type;
    77                 f.resizable = false;
    78             }
    79 
    80             if (f.statusbar)
    81                 opt += ' statusbar';
    82 
    83             if (f.resizable)
    84                 opt += ' resizable';
    85 
    86             if (f.minimizable)
    87                 opt += ' minimizable';
    88 
    89             if (f.maximizable)
    90                 opt += ' maximizable';
    91 
    92             if (f.movable)
    93                 opt += ' movable';
    94 
    95             // Create DOM objects
    96             t._addAll(document.body,
    97                 ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'},
    98                     ['div', {id : id + '_wrapper', 'class' : 'wrapper' + opt},
    99                         ['div', {id : id + '_top', 'class' : 'top'},
    100                             ['div', {'class' : 'left'}],
    101                             ['div', {'class' : 'center'}],
    102                             ['div', {'class' : 'right'}],
    103                             ['span', {id : id + '_title'}, f.title || '']
    104                         ],
    105 
    106                         ['div', {id : id + '_middle', 'class' : 'middle'},
    107                             ['div', {id : id + '_left', 'class' : 'left'}],
    108                             ['span', {id : id + '_content'}],
    109                             ['div', {id : id + '_right', 'class' : 'right'}]
    110                         ],
    111 
    112                         ['div', {id : id + '_bottom', 'class' : 'bottom'},
    113                             ['div', {'class' : 'left'}],
    114                             ['div', {'class' : 'center'}],
    115                             ['div', {'class' : 'right'}],
    116                             ['span', {id : id + '_status'}, 'Content']
    117                         ],
    118 
    119                         ['a', {'class' : 'move', href : 'javascript:;'}],
    120                         ['a', {'class' : 'min', href : 'javascript:;', onmousedown : 'return false;'}],
    121                         ['a', {'class' : 'max', href : 'javascript:;', onmousedown : 'return false;'}],
    122                         ['a', {'class' : 'med', href : 'javascript:;', onmousedown : 'return false;'}],
    123                         ['a', {'class' : 'close', href : 'javascript:;', onmousedown : 'return false;'}],
    124                         ['a', {id : id + '_resize_n', 'class' : 'resize resize-n', href : 'javascript:;'}],
    125                         ['a', {id : id + '_resize_s', 'class' : 'resize resize-s', href : 'javascript:;'}],
    126                         ['a', {id : id + '_resize_w', 'class' : 'resize resize-w', href : 'javascript:;'}],
    127                         ['a', {id : id + '_resize_e', 'class' : 'resize resize-e', href : 'javascript:;'}],
    128                         ['a', {id : id + '_resize_nw', 'class' : 'resize resize-nw', href : 'javascript:;'}],
    129                         ['a', {id : id + '_resize_ne', 'class' : 'resize resize-ne', href : 'javascript:;'}],
    130                         ['a', {id : id + '_resize_sw', 'class' : 'resize resize-sw', href : 'javascript:;'}],
    131                         ['a', {id : id + '_resize_se', 'class' : 'resize resize-se', href : 'javascript:;'}]
    132                     ]
    133                 ]
    134             );
    135 
    136             DOM.setStyles(id, {top : -10000, left : -10000});
    137 
    138             // Fix gecko rendering bug, where the editors iframe messed with window contents
    139             if (tinymce.isGecko)
    140                 DOM.setStyle(id, 'overflow', 'auto');
    141 
    142             // Measure borders
    143             if (!f.type) {
    144                 dw += DOM.get(id + '_left').clientWidth;
    145                 dw += DOM.get(id + '_right').clientWidth;
    146                 dh += DOM.get(id + '_top').clientHeight;
    147                 dh += DOM.get(id + '_bottom').clientHeight;
    148             }
    149 
    150             // Resize window
    151             DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
    152 
    153             if (!f.type) {
    154                 DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
    155                 DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
    156                 DOM.setAttrib(id + '_ifr', 'src', f.url || f.file);
    157             } else {
    158                 DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'button ok', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
    159 
    160                 if (f.type == 'confirm')
    161                     DOM.add(id + '_wrapper', 'a', {'class' : 'button cancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
    162 
    163                 DOM.add(id + '_middle', 'div', {'class' : 'icon'});
    164                 DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
    165             }
    166 
    167             // Register events
    168             mdf = Event.add(id, 'mousedown', function(e) {
    169                 var n = e.target, w, vp;
    170 
    171                 w = t.windows[id];
    172                 t.focus(id);
    173 
    174                 if (n.nodeName == 'A' || n.nodeName == 'a') {
    175                     if (n.className == 'max') {
    176                         w.oldPos = w.element.getXY();
    177                         w.oldSize = w.element.getSize();
    178 
    179                         vp = DOM.getViewPort();
    180 
    181                         // Reduce viewport size to avoid scrollbars
    182                         vp.w -= 2;
    183                         vp.h -= 2;
    184 
    185                         w.element.moveTo(vp.x, vp.y);
    186                         w.element.resizeTo(vp.w, vp.h);
    187                         DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
    188                         DOM.addClass(id + '_wrapper', 'maximized');
    189                     } else if (n.className == 'med') {
    190                         // Reset to old size
    191                         w.element.moveTo(w.oldPos.x, w.oldPos.y);
    192                         w.element.resizeTo(w.oldSize.w, w.oldSize.h);
    193                         w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
    194 
    195                         DOM.removeClass(id + '_wrapper', 'maximized');
    196                     } else if (n.className == 'move')
    197                         return t._startDrag(id, e, n.className);
    198                     else if (DOM.hasClass(n, 'resize'))
    199                         return t._startDrag(id, e, n.className.substring(7));
    200                 }
    201             });
    202 
    203             clf = Event.add(id, 'click', function(e) {
    204                 var n = e.target;
    205 
    206                 t.focus(id);
    207 
    208                 if (n.nodeName == 'A' || n.nodeName == 'a') {
    209                     switch (n.className) {
    210                         case 'close':
    211                             t.close(null, id);
    212                             return Event.cancel(e);
    213 
    214                         case 'button ok':
    215                         case 'button cancel':
    216                             f.button_func(n.className == 'button ok');
    217                             return Event.cancel(e);
    218                     }
    219                 }
    220             });
    221 
    222             // Add window
    223             t.windows = t.windows || {};
    224             w = t.windows[id] = {
    225                 id : id,
    226                 mousedown_func : mdf,
    227                 click_func : clf,
    228                 element : new Element(id, {blocker : 1, container : ed.getContainer()}),
    229                 iframeElement : new Element(id + '_ifr'),
    230                 features : f,
    231                 deltaWidth : dw,
    232                 deltaHeight : dh
    233             };
    234 
    235             w.iframeElement.on('focus', function() {
    236                 t.focus(id);
    237             });
    238 
    239             t.focus(id);
    240             t._fixIELayout(id, 1);
    241 
    242 //          if (DOM.get(id + '_ok'))
    243 //              DOM.get(id + '_ok').focus();
    244 
    245             return w;
    246         },
    247 
    248         focus : function(id) {
    249             var t = this, w = t.windows[id];
    250 
    251             w.zIndex = this.zIndex++;
    252             w.element.setStyle('zIndex', w.zIndex);
    253             w.element.update();
    254 
    255             id = id + '_wrapper';
    256             DOM.removeClass(t.lastId, 'focus');
    257             DOM.addClass(id, 'focus');
    258             t.lastId = id;
    259         },
    260 
    261         _addAll : function(te, ne) {
    262             var i, n, t = this, dom = tinymce.DOM;
    263 
    264             if (is(ne, 'string'))
    265                 te.appendChild(dom.doc.createTextNode(ne));
    266             else if (ne.length) {
    267                 te = te.appendChild(dom.create(ne[0], ne[1]));
    268 
    269                 for (i=2; i<ne.length; i++)
    270                     t._addAll(te, ne[i]);
    271             }
    272         },
    273 
    274         _startDrag : function(id, se, ac) {
    275             var t = this, mu, mm, d = document, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
    276 
    277             // Get positons and sizes
    278 //          cp = DOM.getPos(t.editor.getContainer());
    279             cp = {x : 0, y : 0};
    280             vp = DOM.getViewPort();
    281 
    282             // Reduce viewport size to avoid scrollbars
    283             vp.w -= 2;
    284             vp.h -= 2;
    285 
    286             sex = se.screenX;
    287             sey = se.screenY;
    288             dx = dy = dw = dh = 0;
    289 
    290             // Handle mouse up
    291             mu = Event.add(d, 'mouseup', function(e) {
    292                 Event.remove(d, 'mouseup', mu);
    293                 Event.remove(d, 'mousemove', mm);
    294 
    295                 if (eb)
    296                     eb.remove();
    297 
    298                 we.moveBy(dx, dy);
    299                 we.resizeBy(dw, dh);
    300                 sz = we.getSize();
    301                 DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
    302                 t._fixIELayout(id, 1);
    303 
    304                 return Event.cancel(e);
    305             });
    306 
    307             if (ac != 'move')
    308                 startMove();
    309 
    310             function startMove() {
    311                 if (eb)
    312                     return;
    313 
    314                 t._fixIELayout(id, 0);
    315 
    316                 // Setup event blocker
    317                 DOM.add(d.body, 'div', {
    318                     id : 'mceEventBlocker',
    319                     'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
    320                     style : {left : vp.x, top : vp.y, width : vp.w - 20, height : vp.h - 20, zIndex : 20001}
    321                 });
    322                 eb = new Element('mceEventBlocker');
    323                 eb.update();
    324 
    325                 // Setup placeholder
    326                 p = we.getXY();
    327                 sz = we.getSize();
    328                 sx = cp.x + p.x - vp.x;
    329                 sy = cp.y + p.y - vp.y;
    330                 DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'placeholder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
    331                 ph = new Element('mcePlaceHolder');
    332             };
    333 
    334             // Handle mouse move/drag
    335             mm = Event.add(d, 'mousemove', function(e) {
    336                 var x, y, v;
    337 
    338                 startMove();
    339 
    340                 x = e.screenX - sex;
    341                 y = e.screenY - sey;
    342 
    343                 switch (ac) {
    344                     case 'resize-w':
    345                         dx = x;
    346                         dw = 0 - x;
    347                         break;
    348 
    349                     case 'resize-e':
    350                         dw = x;
    351                         break;
    352 
    353                     case 'resize-n':
    354                     case 'resize-nw':
    355                     case 'resize-ne':
    356                         if (ac == "resize-nw") {
    357                             dx = x;
    358                             dw = 0 - x;
    359                         } else if (ac == "resize-ne")
    360                             dw = x;
    361 
    362                         dy = y;
    363                         dh = 0 - y;
    364                         break;
    365 
    366                     case 'resize-s':
    367                     case 'resize-sw':
    368                     case 'resize-se':
    369                         if (ac == "resize-sw") {
    370                             dx = x;
    371                             dw = 0 - x;
    372                         } else if (ac == "resize-se")
    373                             dw = x;
    374 
    375                         dh = y;
    376                         break;
    377 
    378                     case 'move':
    379                         dx = x;
    380                         dy = y;
    381                         break;
    382                 }
    383 
    384                 // Boundary check
    385                 if (dw < (v = w.features.min_width - sz.w)) {
    386                     if (dx !== 0)
    387                         dx += dw - v;
    388 
    389                     dw = v;
    390                 }
    391    
    392                 if (dh < (v = w.features.min_height - sz.h)) {
    393                     if (dy !== 0)
    394                         dy += dh - v;
    395 
    396                     dh = v;
    397                 }
    398 
    399                 dw = Math.min(dw, w.features.max_width - sz.w);
    400                 dh = Math.min(dh, w.features.max_height - sz.h);
    401                 dx = Math.max(dx, vp.x - (sx + vp.x));
    402                 dy = Math.max(dy, vp.y - (sy + vp.y));
    403                 dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
    404                 dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
    405 
    406                 // Move if needed
    407                 if (dx + dy !== 0) {
    408                     if (sx + dx < 0)
    409                         dx = 0;
    410    
    411                     if (sy + dy < 0)
    412                         dy = 0;
    413 
    414                     ph.moveTo(sx + dx, sy + dy);
    415                 }
    416 
    417                 // Resize if needed
    418                 if (dw + dh !== 0)
    419                     ph.resizeTo(sz.w + dw, sz.h + dh);
    420 
    421                 return Event.cancel(e);
    422             });
    423 
    424             return Event.cancel(se);
    425         },
    426 
    427         resizeBy : function(dw, dh, id) {
    428             var w = this.windows[id];
    429 
    430             if (w) {
    431                 w.element.resizeBy(dw, dh);
    432                 w.iframeElement.resizeBy(dw, dh);
    433             }
    434         },
    435 
    436         close : function(win, id) {
    437             var t = this, w, d = document, ix = 0, fw;
    438 
    439             // Probably not inline
    440             if (!id && win) {
    441                 t.parent(win);
    442                 return;
    443             }
    444 
    445             if (w = t.windows[id]) {
    446                 t.onClose.dispatch(t);
    447                 Event.remove(d, 'mousedown', w.mousedownFunc);
    448                 Event.remove(d, 'click', w.clickFunc);
    449 
    450                 DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
    451                 w.element.remove();
    452                 delete t.windows[id];
    453 
    454                 // Find front most window and focus that
    455                 each (t.windows, function(w) {
    456                     if (w.zIndex > ix) {
    457                         fw = w;
    458                         ix = w.zIndex;
    459                     }
    460                 });
    461 
    462                 if (fw)
    463                     t.focus(fw.id);
    464             }
    465         },
    466 
    467         setTitle : function(ti, id) {
    468             DOM.get(id + '_title').innerHTML = DOM.encode(ti);
    469         },
    470 
    471         alert : function(txt, cb, s) {
    472             var t = this, w;
    473 
    474             w = t.open({
    475                 title : t,
    476                 type : 'alert',
    477                 button_func : function(s) {
    478                     if (cb)
    479                         cb.call(s || t, s);
    480 
    481                     t.close(null, w.id);
    482                 },
    483                 content : DOM.encode(t.editor.getLang(txt, txt)),
    484                 inline : 1,
    485                 width : 400,
    486                 height : 130
    487             });
    488         },
    489 
    490         confirm : function(txt, cb, s) {
    491             var t = this, w;
    492 
    493             w = t.open({
    494                 title : t,
    495                 type : 'confirm',
    496                 button_func : function(s) {
    497                     if (cb)
    498                         cb.call(s || t, s);
    499 
    500                     t.close(null, w.id);
    501                 },
    502                 content : DOM.encode(t.editor.getLang(txt, txt)),
    503                 inline : 1,
    504                 width : 400,
    505                 height : 130
    506             });
    507         },
    508 
    509         // Internal functions
    510 
    511         _fixIELayout : function(id, s) {
    512             var w, img;
    513 
    514             if (!tinymce.isIE6)
    515                 return;
    516 
    517             // Fixes the bug where hover flickers and does odd things in IE6
    518             each(['n','s','w','e','nw','ne','sw','se'], function(v) {
    519                 var e = DOM.get(id + '_resize_' + v);
    520 
    521                 DOM.setStyles(e, {
    522                     width : s ? e.clientWidth : '',
    523                     height : s ? e.clientHeight : '',
    524                     cursor : DOM.getStyle(e, 'cursor', 1)
    525                 });
    526 
    527                 DOM.setStyle(id + "_bottom", 'bottom', '-1px');
    528 
    529                 e = 0;
    530             });
    531 
    532             // Fixes graphics glitch
    533             if (w = this.windows[id]) {
    534                 // Fixes rendering bug after resize
    535                 w.element.hide();
    536                 w.element.show();
    537 
    538                 // Forced a repaint of the window
    539                 //DOM.get(id).style.filter = '';
    540 
    541                 // IE has a bug where images used in CSS won't get loaded
    542                 // sometimes when the cache in the browser is disabled
    543                 // This fix tries to solve it by loading the images using the image object
    544                 each(DOM.select('div,a', id), function(e, i) {
    545                     if (e.currentStyle.backgroundImage != 'none') {
    546                         img = new Image();
    547                         img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
    548                     }
    549                 });
    550 
    551                 DOM.get(id).style.filter = '';
    552             }
    553         }
    554     });
    555 
    556     // Register plugin
    557     tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
    558 })();
    559 
     1(function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=1000;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' modal '+f.type;f.resizable=false;}if(f.statusbar)opt+=' statusbar';if(f.resizable)opt+=' resizable';if(f.minimizable)opt+=' minimizable';if(f.maximizable)opt+=' maximizable';if(f.movable)opt+=' movable';t._addAll(document.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'wrapper'+opt},['div',{id:id+'_top','class':'top'},['div',{'class':'left'}],['div',{'class':'center'}],['div',{'class':'right'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'middle'},['div',{id:id+'_left','class':'left'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'right'}]],['div',{id:id+'_bottom','class':'bottom'},['div',{'class':'left'}],['div',{'class':'center'}],['div',{'class':'right'}],['span',{id:id+'_status'},'Content']],['a',{'class':'move',href:'javascript:;'}],['a',{'class':'min',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'max',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'med',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'close',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'resize resize-n',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'resize resize-s',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'resize resize-w',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'resize resize-e',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'resize resize-nw',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'resize resize-ne',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'resize resize-sw',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'resize resize-se',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',f.url||f.file);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'button ok',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'button cancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'icon'});DOM.setHTML(id+'_content',f.content.replace('\n','<br />'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='max'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','maximized');}else if(n.className=='med'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','maximized');}else if(n.className=='move')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'resize'))return t._startDrag(id,e,n.className.substring(7));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'close':t.close(null,id);return Event.cancel(e);case'button ok':case'button cancel':f.button_func(n.className=='button ok');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});t.focus(id);t._fixIELayout(id,1);return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'focus');DOM.addClass(id,'focus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i<ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=document,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,width:vp.w-20,height:vp.h-20,zIndex:20001}});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'placeholder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'resize-w':dx=x;dw=0-x;break;case'resize-e':dw=x;break;case'resize-n':case'resize-nw':case'resize-ne':if(ac=="resize-nw"){dx=x;dw=0-x;}else if(ac=="resize-ne")dw=x;dy=y;dh=0-y;break;case'resize-s':case'resize-sw':case'resize-se':if(ac=="resize-sw"){dx=x;dw=0-x;}else if(ac=="resize-se")dw=x;dh=y;break;case'move':dx=x;dy=y;break;}if(dw<(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh<(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx<0)dx=0;if(sy+dy<0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=document,ix=0,fw;if(!id&&win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);DOM.setAttrib(id+'_ifr','src','javascript:""');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex>ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(ti,id){DOM.get(id+'_title').innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})();
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css

    r6632 r6694  
    99
    1010/* Top */
    11 .clearlooks2 .top, .clearlooks2 .top div {top:0; width:100%; height:23px}
    12 .clearlooks2 .top .left {width:6px; background:url(img/corners.gif)}
    13 .clearlooks2 .top .center {right:6px; width:100%; height:23px; background:url(img/horizontal.gif) 12px 0; clip:rect(auto auto auto 12px)}
    14 .clearlooks2 .top .right {right:0; width:6px; height:23px; background:url(img/corners.gif) -12px 0}
    15 .clearlooks2 .top span {width:100%; text-align:center; vertical-align:middle; line-height:23px; font-weight:bold}
    16 .clearlooks2 .focus .top .left {background:url(img/corners.gif) -6px 0}
    17 .clearlooks2 .focus .top .center {background:url(img/horizontal.gif) 0 -23px}
    18 .clearlooks2 .focus .top .right {background:url(img/corners.gif) -18px 0}
    19 .clearlooks2 .focus .top span {color:#FFF}
     11.clearlooks2 .top,
     12.clearlooks2 .top div {
     13top:0;
     14width:100%;
     15height:23px
     16}
     17.clearlooks2 .top .left {
     18width:55%;
     19background: #cee1ef;
     20border-left: 1px solid #c6d9e9;
     21border-top: 1px solid #c6d9e9;
     22}
     23.clearlooks2 .top .center {
     24/*right:6px;
     25width:100%;
     26height:23px;
     27background: #dedede;
     28border-top: 1px solid #ccc;*/
     29}
     30.clearlooks2 .top .right {
     31right:0;
     32width:55%;
     33height:23px;
     34background: #cee1ef;
     35border-right: 1px solid #c6d9e9;
     36border-top: 1px solid #c6d9e9;
     37}
     38.clearlooks2 .top span {
     39width:100%;
     40font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
     41text-align:center;
     42vertical-align:middle;
     43line-height:23px;
     44font-weight:bold
     45}
     46.clearlooks2 .focus .top .left {
     47background: #2683ae;
     48border-left: 1px solid #464646;
     49border-top: 1px solid #464646;
     50}
     51.clearlooks2 .focus .top .center {
     52/*background: #2683ae;
     53border-top: 1px solid #454545;*/
     54}
     55.clearlooks2 .focus .top .right {
     56background: #2683ae;
     57border-right: 1px solid #464646;
     58border-top: 1px solid #464646;
     59}
     60.clearlooks2 .focus .top span {
     61color:#FFF
     62}
    2063
    2164/* Middle */
    2265.clearlooks2 .middle, .clearlooks2 .middle div {top:0}
    2366.clearlooks2 .middle {width:100%; height:100%; clip:rect(23px auto auto auto)}
    24 .clearlooks2 .middle .left {left:0; width:5px; height:100%; background:url(img/vertical.gif) -5px 0}
     67.clearlooks2 .middle .left {left:0; width:5px; height:100%; background:#eaf3ea;border-left:1px solid #c6d9e9;}
    2568.clearlooks2 .middle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
    26 .clearlooks2 .middle .right {right:0; width:5px; height:100%; background:url(img/vertical.gif)}
     69.clearlooks2 .middle .right {right:0; width:5px; height:100%; background:#eaf3ea;border-right:1px solid #c6d9e9;}
    2770
    2871/* Bottom */
    2972.clearlooks2 .bottom, .clearlooks2 .bottom div {height:6px}
    30 .clearlooks2 .bottom {left:0; bottom:0; width:100%}
    31 .clearlooks2 .bottom div {top:0}
    32 .clearlooks2 .bottom .left {left:0; width:5px; background:url(img/corners.gif) -34px -6px}
    33 .clearlooks2 .bottom .center {left:5px; width:100%; background:url(img/horizontal.gif) 0 -46px}
    34 .clearlooks2 .bottom .right {right:0; width:5px; background: url(img/corners.gif) -34px 0}
     73.clearlooks2 .bottom {left:0; bottom:0; width:100%;background:#eaf3ea;border-bottom:1px solid #c6d9e9;}
     74.clearlooks2 .bottom div {top:0;}
     75.clearlooks2 .bottom .left {left:0; width:5px; background:#eaf3ea;border-left:1px solid #c6d9e9;}
     76.clearlooks2 .bottom .center {left:5px; width:100%; }
     77.clearlooks2 .bottom .right {right:0; width:6px; background:#eaf3ea url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9;}
    3578.clearlooks2 .bottom span {display:none}
    3679.clearlooks2 .statusbar .bottom, .clearlooks2 .statusbar .bottom div {height:23px}
  • trunk/wp-includes/js/tinymce/plugins/media/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var each = tinymce.each;
    10 
    11     tinymce.create('tinymce.plugins.MediaPlugin', {
    12         init : function(ed, url) {
    13             var t = this;
    14            
    15             t.editor = ed;
    16             t.url = url;
    17 
    18             function isMediaElm(n) {
    19                 return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);
    20             };
    21 
    22             // Register commands
    23             ed.addCommand('mceMedia', function() {
    24                 ed.windowManager.open({
    25                     file : url + '/media.htm',
    26                     width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
    27                     height : 470 + parseInt(ed.getLang('media.delta_height', 0)),
    28                     inline : 1
    29                 }, {
    30                     plugin_url : url
    31                 });
    32             });
    33 
    34             // Register buttons
    35             ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
    36 
    37             ed.onNodeChange.add(function(ed, cm, n) {
    38                 cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));
    39             });
    40 
    41             ed.onInit.add(function() {
    42                 var lo = {
    43                     mceItemFlash : 'flash',
    44                     mceItemShockWave : 'shockwave',
    45                     mceItemWindowsMedia : 'windowsmedia',
    46                     mceItemQuickTime : 'quicktime',
    47                     mceItemRealMedia : 'realmedia'
    48                 };
    49 
    50                 ed.dom.loadCSS(url + "/css/content.css");
    51 
    52                 if (ed.theme.onResolveName) {
    53                     ed.theme.onResolveName.add(function(th, o) {
    54                         if (o.name == 'img') {
    55                             each(lo, function(v, k) {
    56                                 if (ed.dom.hasClass(o.node, k)) {
    57                                     o.name = v;
    58                                     o.title = ed.dom.getAttrib(o.node, 'title');
    59                                     return false;
    60                                 }
    61                             });
    62                         }
    63                     });
    64                 }
    65 
    66                 if (ed && ed.plugins.contextmenu) {
    67                     ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
    68                         if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) {
    69                             m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
    70                         }
    71                     });
    72                 }
    73             });
    74 
    75             ed.onBeforeSetContent.add(function(ed, o) {
    76                 var h = o.content;
    77 
    78                 h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {
    79                     var o = eval("({" + c + "})");
    80 
    81                     return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'
    82                 });
    83 
    84                 h = h.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
    85                 h = h.replace(/<embed([^>]*)>/gi, '<div class="mceItemEmbed" $1>');
    86                 h = h.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
    87                 h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<div ' + b.replace(/value=/g, '_value=') + ' class="mceItemParam"></div>'});
    88                 h = h.replace(/\/ class=\"mceItemParam\"><\/div>/gi, 'class="mceItemParam"></div>');
    89 
    90                 o.content = h;
    91             });
    92 
    93             ed.onSetContent.add(function() {
    94                 t._divsToImgs(ed.getBody());
    95             });
    96 
    97             ed.onPreProcess.add(function(ed, o) {
    98                 var dom = ed.dom;
    99 
    100                 if (o.set) {
    101                     t._divsToImgs(o.node);
    102 
    103                     each(dom.select('IMG', o.node), function(n) {
    104                         var p;
    105 
    106                         if (isMediaElm(n)) {
    107                             p = t._parse(n.title);
    108                             dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100));
    109                             dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100));
    110                         }
    111                     });
    112                 }
    113 
    114                 if (o.get) {
    115                     each(dom.select('IMG', o.node), function(n) {
    116                         var ci, cb, mt;
    117 
    118                         if (ed.getParam('media_use_script')) {
    119                             if (isMediaElm(n))
    120                                 n.className = n.className.replace(/mceItem/g, 'mceTemp');
    121 
    122                             return;
    123                         }
    124 
    125                         switch (n.className) {
    126                             case 'mceItemFlash':
    127                                 ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
    128                                 cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
    129                                 mt = 'application/x-shockwave-flash';
    130                                 break;
    131 
    132                             case 'mceItemShockWave':
    133                                 ci = '166b1bca-3f9c-11cf-8075-444553540000';
    134                                 cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
    135                                 mt = 'application/x-director';
    136                                 break;
    137 
    138                             case 'mceItemWindowsMedia':
    139                                 ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6';
    140                                 cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
    141                                 mt = 'application/x-mplayer2';
    142                                 break;
    143 
    144                             case 'mceItemQuickTime':
    145                                 ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b';
    146                                 cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
    147                                 mt = 'video/quicktime';
    148                                 break;
    149 
    150                             case 'mceItemRealMedia':
    151                                 ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa';
    152                                 cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
    153                                 mt = 'audio/x-pn-realaudio-plugin';
    154                                 break;
    155                         }
    156 
    157                         if (ci) {
    158                             dom.replace(t._buildObj({
    159                                 classid : ci,
    160                                 codebase : cb,
    161                                 type : mt
    162                             }, n), n);
    163                         }
    164                     });
    165                 }
    166             });
    167 
    168             ed.onPostProcess.add(function(ed, o) {
    169                 o.content = o.content.replace(/_value=/g, 'value=');
    170             });
    171 
    172             if (ed.getParam('media_use_script')) {
    173                 function getAttr(s, n) {
    174                     n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
    175 
    176                     return n ? ed.dom.decode(n[1]) : '';
    177                 };
    178 
    179                 ed.onPostProcess.add(function(ed, o) {
    180                     o.content = o.content.replace(/<img[^>]+>/g, function(im) {
    181                         var cl = getAttr(im, 'class');
    182 
    183                         if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) {
    184                             at = t._parse(getAttr(im, 'title'));
    185                             at.width = getAttr(im, 'width');
    186                             at.height = getAttr(im, 'height');
    187                             im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>';
    188                         }
    189 
    190                         return im;
    191                     });
    192                 });
    193             }
    194         },
    195 
    196         getInfo : function() {
    197             return {
    198                 longname : 'Media',
    199                 author : 'Moxiecode Systems AB',
    200                 authorurl : 'http://tinymce.moxiecode.com',
    201                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
    202                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    203             };
    204         },
    205 
    206         // Private methods
    207 
    208         _buildObj : function(o, n) {
    209             var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title);
    210 
    211             p.width = o.width = dom.getAttrib(n, 'width') || 100;
    212             p.height = o.height = dom.getAttrib(n, 'height') || 100;
    213 
    214             ob = dom.create('div', {
    215                 mce_name : 'object',
    216                 classid : "clsid:" + o.classid,
    217                 codebase : o.codebase,
    218                 width : o.width,
    219                 height : o.height
    220             });
    221 
    222             if (p.src)
    223                 p.src = ed.convertURL(p.src, 'src', n);
    224 
    225             each (p, function(v, k) {
    226                 if (v && !/^(width|height|codebase|classid)$/.test(k))
    227                     dom.add(ob, 'div', {mce_name : 'param', name : k, '_value' : v});
    228             });
    229 
    230             dom.add(ob, 'div', tinymce.extend({mce_name : 'embed', type : o.type}, p));
    231 
    232             return ob;
    233         },
    234 
    235         _divsToImgs : function(p) {
    236             var t = this, dom = t.editor.dom, im, ci;
    237 
    238             each(dom.select('div', p), function(n) {
    239                 // Convert object into image
    240                 if (dom.getAttrib(n, 'class') == 'mceItemObject') {
    241                     ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, '');
    242 
    243                     switch (ci) {
    244                         case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
    245                             dom.replace(t._createImg('mceItemFlash', n), n);
    246                             break;
    247 
    248                         case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
    249                             dom.replace(t._createImg('mceItemShockWave', n), n);
    250                             break;
    251 
    252                         case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
    253                         case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
    254                         case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
    255                             dom.replace(t._createImg('mceItemWindowsMedia', n), n);
    256                             break;
    257 
    258                         case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
    259                             dom.replace(t._createImg('mceItemQuickTime', n), n);
    260                             break;
    261 
    262                         case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
    263                             dom.replace(t._createImg('mceItemRealMedia', n), n);
    264                             break;
    265 
    266                         default:
    267                             dom.replace(t._createImg('mceItemFlash', n), n);
    268                     }
    269                 }
    270             });
    271         },
    272 
    273         _createImg : function(cl, n) {
    274             var im, dom = this.editor.dom, pa = {}, ti = '';
    275 
    276             // Create image
    277             im = dom.create('img', {
    278                 src : this.url + '/img/trans.gif',
    279                 width : dom.getAttrib(n, 'width') || 100,
    280                 height : dom.getAttrib(n, 'height') || 100,
    281                 'class' : cl
    282             });
    283 
    284             // Setup base parameters
    285             each(['id', 'name', 'width', 'height', 'bgcolor', 'align'], function(n) {
    286                 var v = dom.getAttrib(n, 'align');
    287 
    288                 if (v)
    289                     pa[v] = v;
    290             });
    291 
    292             // Add optional parameters
    293             each(dom.select('div', n), function(n) {
    294                 if (dom.hasClass(n, 'mceItemParam'))
    295                     pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value');
    296             });
    297 
    298             // Use src not movie
    299             if (pa.movie) {
    300                 pa.src = pa.movie;
    301                 delete pa.movie;
    302             }
    303 
    304             delete pa.width;
    305             delete pa.height;
    306 
    307             im.title = this._serialize(pa);
    308 
    309             return im;
    310         },
    311 
    312         _parse : function(s) {
    313             return tinymce.util.JSON.parse('{' + s + '}');
    314         },
    315 
    316         _serialize : function(o) {
    317             return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');
    318         }
    319     });
    320 
    321     // Register plugin
    322     tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
    323 })();
     1(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=eval("({"+c+"})");return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'</span>');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/g,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(v&&!/^(width|height|codebase|classid)$/.test(k))dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align'],function(n){var v=dom.getAttrib(n,'align');if(v)pa[v]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
  • trunk/wp-includes/js/tinymce/plugins/media/media.htm

    r6632 r6694  
    33<head>
    44    <title>{#media_dlg.title}</title>
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="js/media.js"></script>
    77    <script type="text/javascript" src="../../utils/mctabs.js"></script>
     
    1010    <script type="text/javascript" src="../../utils/editable_selects.js"></script>
    1111    <link href="css/media.css" rel="stylesheet" type="text/css" />
    12     <base target="_self" />
     12    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('src').focus();},500);});</script>
     13    <base target="_self" />
    1314</head>
    1415<body style="display: none">
     
    812813        <div class="mceActionPanel">
    813814            <div style="float: left">
    814                 <input type="button" id="insert" name="insert" value="{#insert}" onclick="insertMedia();" />
     815                <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
    815816            </div>
    816817
    817818            <div style="float: right">
    818                 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
     819                <input type="submit" id="insert" name="insert" value="{#insert}" onclick="insertMedia();" />
    819820            </div>
    820821        </div>
  • trunk/wp-includes/js/tinymce/plugins/paste/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var Event = tinymce.dom.Event;
    10 
    11     tinymce.create('tinymce.plugins.PastePlugin', {
    12         init : function(ed, url) {
    13             var t = this;
    14 
    15             t.editor = ed;
    16 
    17             // Register commands
    18             ed.addCommand('mcePasteText', function(ui, v) {
    19                 if (ui) {
    20                     ed.windowManager.open({
    21                         file : url + '/pastetext.htm',
    22                         width : 450,
    23                         height : 400,
    24                         inline : 1
    25                     }, {
    26                         plugin_url : url
    27                     });
    28                 } else
    29                     t._insertText(v.html, v.linebreaks);
    30             });
    31 
    32             ed.addCommand('mcePasteWord', function(ui, v) {
    33                 if (ui) {
    34                     ed.windowManager.open({
    35                         file : url + '/pasteword.htm',
    36                         width : 450,
    37                         height : 400,
    38                         inline : 1
    39                     }, {
    40                         plugin_url : url
    41                     });
    42                 } else
    43                     t._insertWordContent(v);
    44             });
    45 
    46             ed.addCommand('mceSelectAll', function() {
    47                 ed.execCommand('selectall');
    48             });
    49 
    50             // Register buttons
    51             ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true});
    52             ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true});
    53             ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'});
    54 
    55             if (ed.getParam("paste_auto_cleanup_on_paste", false)) {
    56                 ed.onPaste.add(function(ed, e) {
    57                     return t._handlePasteEvent(e)
    58                 });
    59             }
    60 
    61             if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) {
    62                 // Force paste dialog if non IE browser
    63                 ed.onKeyDown.add(function(ed, e) {
    64                     if (e.ctrlKey && e.keyCode == 86) {
    65                         window.setTimeout(function() {
    66                             ed.execCommand("mcePasteText", true);
    67                         }, 1);
    68 
    69                         Event.cancel(e);
    70                     }
    71                 });
    72             }
    73         },
    74 
    75         getInfo : function() {
    76             return {
    77                 longname : 'Paste text/word',
    78                 author : 'Moxiecode Systems AB',
    79                 authorurl : 'http://tinymce.moxiecode.com',
    80                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
    81                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    82             };
    83         },
    84 
    85         // Private methods
    86 
    87         _handlePasteEvent : function(e) {
    88             var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r;
    89 
    90             // Removes italic, strong etc, the if was needed due to bug #1437114
    91             if (ed && (r = sel.getRng()) && r.text.length > 0)
    92                 ed.execCommand('delete');
    93 
    94             if (html && html.length > 0)
    95                 ed.execCommand('mcePasteWord', false, html);
    96 
    97             return Event.cancel(e);
    98         },
    99 
    100         _insertText : function(content, bLinebreaks) {
    101             if (content && content.length > 0) {
    102                 if (bLinebreaks) {
    103                     // Special paragraph treatment
    104                     if (this.editor.getParam("paste_create_paragraphs", true)) {
    105                         var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
    106                         for (var i=0; i<rl.length; i+=2)
    107                             content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
    108 
    109                         content = content.replace(/\r\n\r\n/g, '</p><p>');
    110                         content = content.replace(/\r\r/g, '</p><p>');
    111                         content = content.replace(/\n\n/g, '</p><p>');
    112 
    113                         // Has paragraphs
    114                         if ((pos = content.indexOf('</p><p>')) != -1) {
    115                             this.editor.execCommand("Delete");
    116 
    117                             var node = this.editor.selection.getNode();
    118 
    119                             // Get list of elements to break
    120                             var breakElms = [];
    121 
    122                             do {
    123                                 if (node.nodeType == 1) {
    124                                     // Don't break tables and break at body
    125                                     if (node.nodeName == "TD" || node.nodeName == "BODY")
    126                                         break;
    127            
    128                                     breakElms[breakElms.length] = node;
    129                                 }
    130                             } while(node = node.parentNode);
    131 
    132                             var before = "", after = "</p>";
    133                             before += content.substring(0, pos);
    134 
    135                             for (var i=0; i<breakElms.length; i++) {
    136                                 before += "</" + breakElms[i].nodeName + ">";
    137                                 after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
    138                             }
    139 
    140                             before += "<p>";
    141                             content = before + content.substring(pos+7) + after;
    142                         }
    143                     }
    144 
    145                     if (this.editor.getParam("paste_create_linebreaks", true)) {
    146                         content = content.replace(/\r\n/g, '<br />');
    147                         content = content.replace(/\r/g, '<br />');
    148                         content = content.replace(/\n/g, '<br />');
    149                     }
    150                 }
    151            
    152                 this.editor.execCommand("mceInsertRawHTML", false, content);
    153             }
    154         },
    155 
    156         _insertWordContent : function(content) {
    157             var t = this, ed = t.editor;
    158 
    159             if (content && content.length > 0) {
    160                 // Cleanup Word content
    161                 var bull = String.fromCharCode(8226);
    162                 var middot = String.fromCharCode(183);
    163                 var cb;
    164 
    165                 if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "")
    166                     content = eval(cb + "('before', content)");
    167 
    168                 var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
    169                 for (var i=0; i<rl.length; i+=2)
    170                     content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
    171 
    172                 if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
    173                     content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
    174                 }
    175 
    176                 content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
    177                 content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
    178                 content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
    179                 content = content.replace(/<o:p><\/o:p>/gi, "");
    180                 content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
    181                 content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), "");  // Word comments
    182 
    183                 if (this.editor.getParam("paste_remove_spans", true))
    184                     content = content.replace(/<\/?span[^>]*>/gi, "");
    185 
    186                 if (this.editor.getParam("paste_remove_styles", true))
    187                     content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
    188 
    189                 content = content.replace(/<\/?font[^>]*>/gi, "");
    190 
    191                 // Strips class attributes.
    192                 switch (this.editor.getParam("paste_strip_class_attributes", "all")) {
    193                     case "all":
    194                         content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
    195                         break;
    196 
    197                     case "mso":
    198                         content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
    199                         break;
    200                 }
    201 
    202                 content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI());
    203                 content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
    204                 content = content.replace(/<\\?\?xml[^>]*>/gi, "");
    205                 content = content.replace(/<\/?\w+:[^>]*>/gi, "");
    206                 content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
    207                 content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
    208 
    209         //      content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
    210         //      content = content.replace(/<p>&nbsp;<\/p>/gi, '');
    211 
    212                 if (!this.editor.getParam('force_p_newlines')) {
    213                     content = content.replace('', '' ,'gi');
    214                     content = content.replace('</p>', '<br /><br />' ,'gi');
    215                 }
    216 
    217                 if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) {
    218                     content = content.replace(/<\/?p[^>]*>/gi, "");
    219                 }
    220 
    221                 content = content.replace(/<\/?div[^>]*>/gi, "");
    222 
    223                 // Convert all middlot lists to UL lists
    224                 if (this.editor.getParam("paste_convert_middot_lists", true)) {
    225                     var div = ed.dom.create("div", null, content);
    226 
    227                     // Convert all middot paragraphs to li elements
    228                     var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList");
    229 
    230                     while (this._convertMiddots(div, "--list--")) ; // bull
    231                     while (this._convertMiddots(div, middot, className)) ; // Middot
    232                     while (this._convertMiddots(div, bull)) ; // bull
    233 
    234                     content = div.innerHTML;
    235                 }
    236 
    237                 // Replace all headers with strong and fix some other issues
    238                 if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
    239                     content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
    240                     content = content.replace(/<h[1-6]>/gi, '<p><b>');
    241                     content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
    242                     content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
    243                     content = content.replace(/^(&nbsp;)*/gi, '');
    244                 }
    245 
    246                 content = content.replace(/--list--/gi, ""); // Remove --list--
    247 
    248                 if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "")
    249                     content = eval(cb + "('after', content)");
    250 
    251                 // Insert cleaned content
    252                 this.editor.execCommand("mceInsertContent", false, content);
    253 
    254                 if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {
    255                     var ed = this.editor;
    256 
    257                     window.setTimeout(function() {
    258                         ed.execCommand("mceCleanup");
    259                     }, 1); // Do normal cleanup detached from this thread
    260                 }
    261             }
    262         },
    263 
    264         _reEscape : function(s) {
    265             var l = "?.\\*[](){}+^$:";
    266             var o = "";
    267 
    268             for (var i=0; i<s.length; i++) {
    269                 var c = s.charAt(i);
    270 
    271                 if (l.indexOf(c) != -1)
    272                     o += '\\' + c;
    273                 else
    274                     o += c;
    275             }
    276 
    277             return o;
    278         },
    279 
    280         _convertMiddots : function(div, search, class_name) {
    281             var mdot = String.fromCharCode(183);
    282             var bull = String.fromCharCode(8226);
    283 
    284             var nodes = div.getElementsByTagName("p");
    285             var prevul;
    286             for (var i=0; i<nodes.length; i++) {
    287                 var p = nodes[i];
    288 
    289                 // Is middot
    290                 if (p.innerHTML.indexOf(search) == 0) {
    291                     var ul = document.createElement("ul");
    292 
    293                     if (class_name)
    294                         ul.className = class_name;
    295 
    296                     // Add the first one
    297                     var li = document.createElement("li");
    298                     li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
    299                     ul.appendChild(li);
    300 
    301                     // Add the rest
    302                     var np = p.nextSibling;
    303                     while (np) {
    304                         // If the node is whitespace, then
    305                         // ignore it and continue on.
    306                         if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
    307                                 np = np.nextSibling;
    308                                 continue;
    309                         }
    310 
    311                         if (search == mdot) {
    312                                 if (np.nodeType == 1 && new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)) {
    313                                         // Second level of nesting
    314                                         if (!prevul) {
    315                                                 prevul = ul;
    316                                                 ul = document.createElement("ul");
    317                                                 prevul.appendChild(ul);
    318                                         }
    319                                         np.innerHTML = np.innerHTML.replace(/^o/, '');
    320                                 } else {
    321                                         // Pop the stack if we're going back up to the first level
    322                                         if (prevul) {
    323                                                 ul = prevul;
    324                                                 prevul = null;
    325                                         }
    326                                         // Not element or middot paragraph
    327                                         if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
    328                                                 break;
    329                                 }
    330                         } else {
    331                                 // Not element or middot paragraph
    332                                 if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
    333                                         break;
    334                             }
    335 
    336                         var cp = np.nextSibling;
    337                         var li = document.createElement("li");
    338                         li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
    339                         np.parentNode.removeChild(np);
    340                         ul.appendChild(li);
    341                         np = cp;
    342                     }
    343 
    344                     p.parentNode.replaceChild(ul, p);
    345 
    346                     return true;
    347                 }
    348             }
    349 
    350             return false;
    351         },
    352 
    353         _clipboardHTML : function() {
    354             var div = document.getElementById('_TinyMCE_clipboardHTML');
    355 
    356             if (!div) {
    357                 var div = document.createElement('DIV');
    358                 div.id = '_TinyMCE_clipboardHTML';
    359 
    360                 with (div.style) {
    361                     visibility = 'hidden';
    362                     overflow = 'hidden';
    363                     position = 'absolute';
    364                     width = 1;
    365                     height = 1;
    366                 }
    367 
    368                 document.body.appendChild(div);
    369             }
    370 
    371             div.innerHTML = '';
    372             var rng = document.body.createTextRange();
    373             rng.moveToElementText(div);
    374             rng.execCommand('Paste');
    375             var html = div.innerHTML;
    376             div.innerHTML = '';
    377             return html;
    378         }
    379     });
    380 
    381     // Register plugin
    382     tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
    383 })();
     1(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);var cb;if((cb=this.editor.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('before', content)");var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi,'<p>&nbsp;&nbsp;</p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b>&nbsp;<\/b>/gi,'<b>&nbsp;&nbsp;</b>');content=content.replace(/^(&nbsp;)*/gi,'');}content=content.replace(/--list--/gi,"");if((cb=this.editor.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('after', content)");this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var mdot=String.fromCharCode(183);var bull=String.fromCharCode(8226);var nodes=div.getElementsByTagName("p");var prevul;for(var i=0;i<nodes.length;i++){var p=nodes[i];if(p.innerHTML.indexOf(search)==0){var ul=document.createElement("ul");if(class_name)ul.className=class_name;var li=document.createElement("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');ul.appendChild(li);var np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)){if(!prevul){prevul=ul;ul=document.createElement("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}var cp=np.nextSibling;var li=document.createElement("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--|&nbsp;',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
  • trunk/wp-includes/js/tinymce/plugins/paste/pastetext.htm

    r6632 r6694  
    33    <title>{#paste.paste_text_desc}</title>
    44    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="js/pastetext.js"></script>
    7     <base target="_self" />
     7    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('htmlSource').focus();},500);});</script>
     8    <base target="_self" />
    89</head>
    910<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
     
    2324    <div class="mceActionPanel">
    2425        <div style="float: left">
    25             <input type="button" name="insert" value="{#insert}" onclick="saveContent();" id="insert" />
     26            <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
    2627        </div>
    2728
    2829        <div style="float: right">
    29             <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
     30            <input type="submit" name="insert" value="{#insert}" onclick="saveContent();" id="insert" />
    3031        </div>
    3132    </div>
  • trunk/wp-includes/js/tinymce/plugins/paste/pasteword.htm

    r6632 r6694  
    1818        <div class="mceActionPanel">
    1919            <div style="float: left">
    20                 <input type="button" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
     20                <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
    2121            </div>
    2222
    2323            <div style="float: right">
    24                 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
     24                <input type="submit" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
    2525            </div>
    2626        </div>
  • trunk/wp-includes/js/tinymce/plugins/safari/editor_plugin.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit;
    10 
    11     tinymce.create('tinymce.plugins.Safari', {
    12         init : function(ed) {
    13             var t = this, dom;
    14 
    15             // Ignore on non webkit
    16             if (!tinymce.isWebKit)
    17                 return;
    18 
    19             t.editor = ed;
    20             t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
    21             t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
    22 
    23             // Safari will crash if the build in createlink command is used
    24 /*          ed.addCommand('CreateLink', function(u, v) {
    25                 ed.execCommand("mceInsertContent", false, '<a href="' + dom.encode(v) + '">' + ed.selection.getContent() + '</a>');
    26             });*/
    27 
    28             // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004
    29             ed.addCommand('FormatBlock', function(u, v) {
    30                 var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock);
    31 
    32                 if (e)
    33                     dom.replace(dom.create(v), e, 1);
    34                 else
    35                     ed.getDoc().execCommand("FormatBlock", false, v);
    36             });
    37 
    38             // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382
    39             ed.addCommand('mceInsertContent', function(u, v) {
    40                 ed.getDoc().execCommand("InsertText", false, 'mce_marker');
    41                 ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + '<span id="_mce_tmp">XX</span>');
    42                 ed.selection.select(ed.dom.get('_mce_tmp'));
    43                 ed.getDoc().execCommand("Delete", false, ' ');
    44             });
    45 
    46             // Workaround for List ID bug, http://bugs.webkit.org/show_bug.cgi?id=16004
    47 /*          function addList(c) {
    48                 var cb = Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
    49                     e = e.target;
    50 
    51                     if (e.nodeName == 'OL' || e.nodeName == 'UL')
    52                         e.id = '';
    53                 });
    54 
    55                 ed.getDoc().execCommand(c, false, false);
    56                 Event.remove(ed.getDoc(), 'DOMNodeInserted', cb);
    57             };
    58 
    59             ed.addCommand('InsertUnorderedList', function() {addList('InsertUnorderedList');});
    60             ed.addCommand('InsertOrderedList', function() {addList('InsertOrderedList');});*/
    61 
    62             // Safari returns incorrect values
    63             ed.addQueryValueHandler('FontSize', function(u, v) {
    64                 var e, v;
    65 
    66                 // Check for the real font size at the start of selection
    67                 if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize))
    68                     return tinymce.inArray(t.namedFontSizes, v) + 1;
    69 
    70                 // Check for the real font size at the end of selection
    71                 if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize))
    72                     return tinymce.inArray(t.namedFontSizes, v) + 1;
    73 
    74                 // Return default value it's better than nothing right!
    75                 return ed.getDoc().queryCommandValue('FontSize');
    76             });
    77 
    78             // Safari returns incorrect values
    79             ed.addQueryValueHandler('FontName', function(u, v) {
    80                 var e, v;
    81 
    82                 // Check for the real font name at the start of selection
    83                 if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily))
    84                     return v.replace(/, /g, ',');
    85 
    86                 // Check for the real font name at the end of selection
    87                 if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily))
    88                     return v.replace(/, /g, ',');
    89 
    90                 // Return default value it's better than nothing right!
    91                 return ed.getDoc().queryCommandValue('FontName');
    92             });
    93 
    94             // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
    95             ed.onClick.add(function(ed, e) {
    96                 e = e.target;
    97 
    98                 if (e.nodeName == 'IMG') {
    99                     t.selElm = e;
    100                     ed.selection.select(e);
    101                 } else
    102                     t.selElm = null;
    103             });
    104 
    105             ed.onBeforeExecCommand.add(function(ed, c, b) {
    106                 var r = t.bookmarkRng;
    107 
    108                 // Restore selection
    109                 if (r) {
    110                     ed.selection.setRng(r);
    111                     t.bookmarkRng = null;
    112                     //console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset);
    113                 }
    114             });
    115 
    116             ed.onInit.add(function() {
    117                 t._fixWebKitSpans();
    118 
    119                 ed.windowManager.onOpen.add(function() {
    120                     var r = ed.selection.getRng();
    121 
    122                     // Store selection if valid
    123                     if (r.startContainer != ed.getDoc()) {
    124                         t.bookmarkRng = r.cloneRange();
    125                         //console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset);
    126                     }
    127                 });
    128 
    129                 ed.windowManager.onClose.add(function() {
    130                     t.bookmarkRng = null;
    131                 });
    132 
    133                 if (isOldWebKit)
    134                     t._patchSafari2x(ed);
    135             });
    136 
    137             ed.onSetContent.add(function() {
    138                 dom = ed.dom;
    139 
    140                 // Convert strong,b,em,u,strike to spans
    141                 each(['strong','b','em','u','strike','sub','sup','a'], function(v) {
    142                     each(grep(dom.select(v)).reverse(), function(n) {
    143                         var nn = n.nodeName.toLowerCase(), st;
    144 
    145                         // Convert anchors into images
    146                         if (nn == 'a') {
    147                             if (n.name)
    148                                 dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n);
    149 
    150                             return;
    151                         }
    152 
    153                         switch (nn) {
    154                             case 'b':
    155                             case 'strong':
    156                                 if (nn == 'b')
    157                                     nn = 'strong';
    158 
    159                                 st = 'font-weight: bold;';
    160                                 break;
    161 
    162                             case 'em':
    163                                 st = 'font-style: italic;';
    164                                 break;
    165 
    166                             case 'u':
    167                                 st = 'text-decoration: underline;';
    168                                 break;
    169 
    170                             case 'sub':
    171                                 st = 'vertical-align: sub;';
    172                                 break;
    173 
    174                             case 'sup':
    175                                 st = 'vertical-align: super;';
    176                                 break;
    177 
    178                             case 'strike':
    179                                 st = 'text-decoration: line-through;';
    180                                 break;
    181                         }
    182 
    183                         dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1);
    184                     });
    185                 });
    186             });
    187 
    188             ed.onPreProcess.add(function(ed, o) {
    189                 dom = ed.dom;
    190 
    191                 each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) {
    192                     var v, bg;
    193 
    194                     if (o.get) {
    195                         if (dom.hasClass(n, 'Apple-style-span')) {
    196                             bg = n.style.backgroundColor;
    197 
    198                             switch (dom.getAttrib(n, 'mce_name')) {
    199                                 case 'font':
    200                                     if (!ed.settings.convert_fonts_to_spans)
    201                                         dom.setAttrib(n, 'style', '');
    202                                     break;
    203 
    204                                 case 'strong':
    205                                 case 'em':
    206                                 case 'sub':
    207                                 case 'sup':
    208                                     dom.setAttrib(n, 'style', '');
    209                                     break;
    210 
    211                                 case 'strike':
    212                                 case 'u':
    213                                     if (!ed.settings.inline_styles)
    214                                         dom.setAttrib(n, 'style', '');
    215                                     else
    216                                         dom.setAttrib(n, 'mce_name', '');
    217 
    218                                     break;
    219 
    220                                 default:
    221                                     if (!ed.settings.inline_styles)
    222                                         dom.setAttrib(n, 'style', '');
    223                             }
    224 
    225 
    226                             if (bg)
    227                                 n.style.backgroundColor = bg;
    228                         }
    229                     }
    230 
    231                     if (dom.hasClass(n, 'mceItemRemoved'))
    232                         dom.remove(n, 1);
    233                 });
    234             });
    235 
    236             ed.onPostProcess.add(function(ed, o) {
    237                 // Safari adds BR at end of all block elements
    238                 o.content = o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g, '</$1>');
    239 
    240                 // Safari adds id="undefined" to HR elements
    241                 o.content = o.content.replace(/ id=\"undefined\"/g, '');
    242             });
    243         },
    244 
    245         _fixWebKitSpans : function() {
    246             var t = this, ed = t.editor;
    247 
    248             if (!isOldWebKit) {
    249                 // Use mutator events on new WebKit
    250                 Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
    251                     e = e.target;
    252 
    253                     if (e && e.nodeType == 1)
    254                         t._fixAppleSpan(e);
    255                 });
    256             } else {
    257                 // Do post command processing in old WebKit since the browser crashes on Mutator events :(
    258                 ed.onExecCommand.add(function() {
    259                     each(ed.dom.select('span'), function(n) {
    260                         t._fixAppleSpan(n);
    261                     });
    262 
    263                     ed.nodeChanged();
    264                 });
    265             }
    266         },
    267 
    268         _fixAppleSpan : function(e) {
    269             var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p;
    270 
    271             if (dom.getAttrib(e, 'mce_fixed'))
    272                 return;
    273 
    274             // Handle Apple style spans
    275             if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') {
    276                 st = e.style;
    277 
    278                 if (!s.convert_fonts_to_spans) {
    279                     if (st.fontSize) {
    280                         dom.setAttrib(e, 'mce_name', 'font');
    281                         dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1);
    282                     }
    283 
    284                     if (st.fontFamily) {
    285                         dom.setAttrib(e, 'mce_name', 'font');
    286                         dom.setAttrib(e, 'face', st.fontFamily);
    287                     }
    288 
    289                     if (st.color) {
    290                         dom.setAttrib(e, 'mce_name', 'font');
    291                         dom.setAttrib(e, 'color', dom.toHex(st.color));
    292                     }
    293 
    294                     if (st.backgroundColor) {
    295                         dom.setAttrib(e, 'mce_name', 'font');
    296                         dom.setStyle(e, 'background-color', st.backgroundColor);
    297                     }
    298                 } else {
    299                     if (st.fontSize)
    300                         dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]);
    301                 }
    302 
    303                 if (st.fontWeight == 'bold')
    304                     dom.setAttrib(e, 'mce_name', 'strong');
    305 
    306                 if (st.fontStyle == 'italic')
    307                     dom.setAttrib(e, 'mce_name', 'em');
    308 
    309                 if (st.textDecoration == 'underline')
    310                     dom.setAttrib(e, 'mce_name', 'u');
    311 
    312                 if (st.textDecoration == 'line-through')
    313                     dom.setAttrib(e, 'mce_name', 'strike');
    314 
    315                 if (st.verticalAlign == 'super')
    316                     dom.setAttrib(e, 'mce_name', 'sup');
    317 
    318                 if (st.verticalAlign == 'sub')
    319                     dom.setAttrib(e, 'mce_name', 'sub');
    320 
    321                 dom.setAttrib(e, 'mce_fixed', '1');
    322             }
    323         },
    324 
    325         _patchSafari2x : function(ed) {
    326             var t = this, setContent, getNode, dom = ed.dom, lr;
    327 
    328             // Inline dialogs
    329             if (ed.windowManager.onBeforeOpen) {
    330                 ed.windowManager.onBeforeOpen.add(function() {
    331                     r = ed.selection.getRng();
    332                 });
    333             }
    334 
    335             // Fake select on 2.x
    336             ed.selection.select = function(n) {
    337                 this.getSel().setBaseAndExtent(n, 0, n, 1);
    338             };
    339 
    340             getNode = ed.selection.getNode;
    341             ed.selection.getNode = function() {
    342                 return t.selElm || getNode.call(this);
    343             };
    344 
    345             // Fake range on Safari 2.x
    346             ed.selection.getRng = function() {
    347                 var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di;
    348 
    349                 // Fake range on Safari 2.x
    350                 if (s.anchorNode) {
    351                     r = d.createRange();
    352 
    353                     try {
    354                         // Setup before range
    355                         rb = d.createRange();
    356                         rb.setStart(s.anchorNode, s.anchorOffset);
    357                         rb.collapse(1);
    358 
    359                         // Setup after range
    360                         ra = d.createRange();
    361                         ra.setStart(s.focusNode, s.focusOffset);
    362                         ra.collapse(1);
    363 
    364                         // Setup start/end points by comparing locations
    365                         di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
    366                         r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset);
    367                         r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset);
    368 
    369                         lr = r;
    370                     } catch (ex) {
    371                         // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!!
    372                     }
    373                 }
    374 
    375                 return r || lr;
    376             };
    377 
    378             // Fix setContent so it works
    379             setContent = ed.selection.setContent;
    380             ed.selection.setContent = function(h, s) {
    381                 var r = this.getRng(), b;
    382 
    383                 try {
    384                     setContent.call(this, h, s);
    385                 } catch (ex) {
    386                     // Workaround for Safari 2.x
    387                     b = dom.create('body');
    388                     b.innerHTML = h;
    389 
    390                     each(b.childNodes, function(n) {
    391                         r.insertNode(n.cloneNode(true));
    392                     });
    393                 }
    394             };
    395         }
    396     });
    397 
    398     // Register plugin
    399     tinymce.PluginManager.add('safari', tinymce.plugins.Safari);
    400 })();
    401 
     1(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&e.shiftKey){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onBeforeExecCommand.add(function(ed,c,b){var r=t.bookmarkRng;if(r){ed.selection.setRng(r);t.bookmarkRng=null;}});ed.onInit.add(function(){t._fixWebKitSpans();ed.windowManager.onOpen.add(function(){var r=ed.selection.getRng();if(r.startContainer!=ed.getDoc()){t.bookmarkRng=r.cloneRange();}});ed.windowManager.onClose.add(function(){t.bookmarkRng=null;});if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})();
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r6632 r6694  
    1 /* Import plugin specific language pack */
    2 //tinyMCE.importPluginLanguagePack('wordpress', 'en');
     1/**
     2 * Wordpress plugin.
     3 */
    34
    4 var TinyMCE_wordpressPlugin = {
    5     getInfo : function() {
    6         return {
    7             longname : 'WordPress Plugin',
    8             author : 'WordPress',
    9             authorurl : 'http://wordpress.org',
    10             infourl : 'http://wordpress.org',
    11             version : '1'
    12         };
    13     },
     5(function() {
     6    var DOM = tinymce.DOM;
    147
    15     getControlHTML : function(control_name) {
    16         switch (control_name) {
    17             case "wp_more":
    18                 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_more_button', '{$pluginurl}/images/more.gif', 'wpMore');
    19             case "wp_page":
    20                 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_page_button', '{$pluginurl}/images/page.gif', 'wpPage');
    21             case "wp_help":
    22                 var buttons = tinyMCE.getButtonHTML(control_name, 'lang_help_button_title', '{$pluginurl}/images/help.gif', 'wpHelp');
    23                 var hiddenControls = '<div class="zerosize">'
    24                 + '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSpellCheck\',false);" />'
    25                 + '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
    26                 + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
    27                 + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
    28                 + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
    29                 + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
    30                 + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
    31                 + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
    32                 + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
    33                 + '<input type="button" accesskey="j" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyFull\',false);" />'
    34                 + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
    35                 + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
    36                 + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
    37                 + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpMore\');" />'
    38                 + '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />'
    39                 + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
    40                 + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
    41                 + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />'
    42                 + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
    43                 + '<input type="button" accesskey="v" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />'
    44                 + '</div>';
    45                 return buttons+hiddenControls;
    46             case "wp_adv":
    47                 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_adv_button', '{$pluginurl}/images/toolbars.gif', 'wpAdv');
    48             case "wp_adv_start":
    49                 return '<div id="wpadvbar" style="display:none;"><br />';
    50             case "wp_adv_end":
    51                 return '</div>';
    52         }
    53         return '';
    54     },
     8    // Load plugin specific language pack
     9    tinymce.PluginManager.requireLangPack('wordpress');
    5510
    56     execCommand : function(editor_id, element, command, user_interface, value) {
    57         var inst = tinyMCE.getInstanceById(editor_id);
    58         var focusElm = inst.getFocusElement();
    59         var doc = inst.getDoc();
     11    tinymce.create('tinymce.plugins.WordPress', {
     12        init : function(ed, url) {
     13            var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2');
     14            var moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
     15            var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
    6016
    61         function getAttrib(elm, name) {
    62             return elm.getAttribute(name) ? elm.getAttribute(name) : "";
    63         }
     17            // Hides the specified toolbar and resizes the iframe
     18            ed.onPostRender.add(function() {
     19                DOM.hide(ed.controlManager.get(tbId).id);
     20                t._resizeIframe(ed, tbId, 28);
     21            });
    6422
    65         // Handle commands
    66         switch (command) {
    67             case "wpMore":
    68                 var flag = "";
    69                 var template = new Array();
    70                 var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     23            // Register buttons
     24            ed.addButton('wp_more', {
     25                title : 'wordpress.wp_more_desc',
     26                image : url + '/img/more.gif',
     27                onclick : function() {
     28                    ed.execCommand('mceInsertContent', 0, moreHTML);
     29                }
     30            });
    7131
    72                 // Is selection a image
    73                 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
    74                     flag = getAttrib(focusElm, 'class');
     32            ed.addButton('wp_page', {
     33                title : 'wordpress.wp_page_desc',
     34                image : url + '/img/page.gif',
     35                onclick : function() {
     36        //          ed.execCommand('mcePageBreak');
     37                    ed.execCommand('mceInsertContent', 0, nextpageHTML);
     38                }
     39            });
    7540
    76                     if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
    77                         return true;
     41            ed.addButton('wp_help', {
     42                title : 'wordpress.wp_help_desc',
     43                image : url + '/img/help.gif',
     44                onclick : function() {
     45                    ed.windowManager.open({
     46                        url : tinymce.baseURL + '/wp-mce-help.php',
     47                        width : 450,
     48                        height : 420,
     49                        inline : 1
     50                    });
     51                }
     52            });
    7853
    79                     action = "update";
    80                 }
     54            ed.addButton('wp_adv', {
     55                title : 'wordpress.wp_adv_desc',
     56                image : url + '/img/toolbars.gif',
     57                onclick : function() {
     58                    var id = ed.controlManager.get(tbId).id, cm = ed.controlManager;
    8159
    82                 html = ''
    83                     + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    84                     + ' width="100%" height="10px" '
    85                     + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
    86                 tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, html);
    87                 tinyMCE.selectedInstance.repaint();
    88                 return true;
    89 
    90             case "wpPage":
    91                 var flag = "";
    92                 var template = new Array();
    93                 var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
    94 
    95                 // Is selection a image
    96                 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
    97                     flag = getAttrib(focusElm, 'name');
    98 
    99                     if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
    100                         return true;
    101 
    102                     action = "update";
    103                 }
    104 
    105                 html = ''
    106                     + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    107                     + ' width="100%" height="10px" '
    108                     + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
    109                 tinyMCE.execCommand("mceInsertContent",true,html);
    110                 tinyMCE.selectedInstance.repaint();
    111                 return true;
    112 
    113             case "wpHelp":
    114                 var template = new Array();
    115 
    116                 template['file']   = tinyMCE.baseURL + '/wp-mce-help.php';
    117                 template['width']  = 480;
    118                 template['height'] = 380;
    119 
    120                 args = {
    121                     resizable : 'yes',
    122                     scrollbars : 'yes'
    123                 };
    124 
    125                 tinyMCE.openWindow(template, args);
    126                 return true;
    127             case "wpAdv":
    128                 var adv = document.getElementById('wpadvbar');
    129                 if ( adv.style.display == 'none' ) {
    130                     adv.style.display = 'block';
    131                     tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonSelected');
    132                 } else {
    133                     adv.style.display = 'none';
    134                     tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonNormal');
    135                 }
    136                 return true;
    137         }
    138 
    139         // Pass to next handler in chain
    140         return false;
    141     },
    142 
    143     cleanup : function(type, content) {
    144         switch (type) {
    145 
    146             case "insert_to_editor":
    147                 var startPos = 0;
    148                 var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
    149                 var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
    150 
    151                 // Parse all <!--more--> tags and replace them with images
    152                 while ((startPos = content.indexOf('<!--more', startPos)) != -1) {
    153                     var endPos = content.indexOf('-->', startPos) + 3;
    154                     // Insert image
    155                     var moreText = content.substring(startPos + 8, endPos - 3);
    156                     var contentAfter = content.substring(endPos);
    157                     content = content.substring(0, startPos);
    158                     content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    159                     content += ' width="100%" height="10px" moretext="'+moreText+'" ';
    160                     content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
    161                     content += contentAfter;
    162 
    163                     startPos++;
    164                 }
    165                 var startPos = 0;
    166 
    167                 // Parse all <!--page--> tags and replace them with images
    168                 while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {
    169                     // Insert image
    170                     var contentAfter = content.substring(startPos + 15);
    171                     content = content.substring(0, startPos);
    172                     content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    173                     content += ' width="100%" height="10px" ';
    174                     content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
    175                     content += contentAfter;
    176 
    177                     startPos++;
    178                 }
    179 
    180                 // Look for \n in <pre>, replace with <br>
    181                 var startPos = -1;
    182                 while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
    183                     var endPos = content.indexOf('</pre>', startPos+1);
    184                     var innerPos = content.indexOf('>', startPos+1);
    185                     var chunkBefore = content.substring(0, innerPos);
    186                     var chunkAfter = content.substring(endPos);
    187                    
    188                     var innards = content.substring(innerPos, endPos);
    189                     innards = innards.replace(/\n/g, '<br />');
    190                     content = chunkBefore + innards + chunkAfter;
    191                 }
    192 
    193                 break;
    194 
    195             case "get_from_editor":
    196                 // Parse all img tags and replace them with <!--more-->
    197                 var startPos = -1;
    198                 while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
    199                     var endPos = content.indexOf('/>', startPos);
    200                     var attribs = this._parseAttributes(content.substring(startPos + 4, endPos));
    201 
    202                     if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "mce_plugin_wordpress_more") {
    203                         endPos += 2;
    204 
    205                         var moreText = attribs['moretext'] ? attribs['moretext'] : '';
    206                         var embedHTML = '<!--more'+moreText+'-->';
    207 
    208                         // Insert embed/object chunk
    209                         chunkBefore = content.substring(0, startPos);
    210                         chunkAfter = content.substring(endPos);
    211                         content = chunkBefore + embedHTML + chunkAfter;
    212                     }
    213                     if (attribs['class'] == "mce_plugin_wordpress_page" || attribs['name'] == "mce_plugin_wordpress_page") {
    214                         endPos += 2;
    215 
    216                         var embedHTML = '<!--nextpage-->';
    217 
    218                         // Insert embed/object chunk
    219                         chunkBefore = content.substring(0, startPos);
    220                         chunkAfter = content.substring(endPos);
    221                         content = chunkBefore + embedHTML + chunkAfter;
     60                    if (DOM.isHidden(id)) {
     61                        cm.setActive('wp_adv', 1);
     62                        DOM.show(id);
     63                        t._resizeIframe(ed, tbId, -28);
     64                    } else {
     65                        cm.setActive('wp_adv', 0);
     66                        DOM.hide(id);
     67                        t._resizeIframe(ed, tbId, 28);
    22268                    }
    22369                }
     70            });
    22471
    225                 // Remove normal line breaks
    226                 content = content.replace(/\n|\r/g, ' ');
     72            // Add listeners to handle more break
     73            t._handleMoreBreak(ed, url);
     74        },
    22775
    228                 // Look for <br> in <pre>, replace with \n
    229                 var startPos = -1;
    230                 while ((startPos = content.indexOf('<pre', startPos+1)) != -1) {
    231                     var endPos = content.indexOf('</pre>', startPos+1);
    232                     var innerPos = content.indexOf('>', startPos+1);
    233                     var chunkBefore = content.substring(0, innerPos);
    234                     var chunkAfter = content.substring(endPos);
    235                    
    236                     var innards = content.substring(innerPos, endPos);
    237                     innards = innards.replace(new RegExp('<br\\s?/?>', 'g'), '\n');
    238                     innards = innards.replace(new RegExp('\\s$', ''), '');
    239                     content = chunkBefore + innards + chunkAfter;
     76        getInfo : function() {
     77            return {
     78                longname : 'WordPress Plugin',
     79                author : 'WordPress', // add Moxiecode?
     80                authorurl : 'http://wordpress.org',
     81                infourl : 'http://wordpress.org',
     82                version : '1.0a1'
     83            };
     84        },
     85
     86        // Internal functions
     87
     88        // Resizes the iframe by a relative height value
     89        _resizeIframe : function(ed, tb_id, dy) {
     90            var ifr = ed.getContentAreaContainer().firstChild;
     91
     92            DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
     93            ed.theme.deltaHeight += dy; // For resize cookie
     94        },
     95
     96        _handleMoreBreak : function(ed, url) {
     97            var moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
     98            var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
     99
     100            // Load plugin specific CSS into editor
     101            ed.onInit.add(function() {
     102                ed.dom.loadCSS(url + '/css/content.css');
     103            });
     104
     105            // Display morebreak instead if img in element path
     106            ed.onPostRender.add(function() {
     107                if (ed.theme.onResolveName) {
     108                    ed.theme.onResolveName.add(function(th, o) {
     109                        if (o.node.nodeName == 'IMG') {
     110                            if ( ed.dom.hasClass(o.node, 'mceWPmore') )
     111                                o.name = 'wpmore';
     112                            if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
     113                                o.name = 'wppage';
     114                        }
     115                           
     116                    });
    240117                }
     118            });
    241119
    242                 // Remove anonymous, empty paragraphs.
    243                 content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');
     120            // Replace morebreak with images
     121            ed.onBeforeSetContent.add(function(ed, o) {
     122                o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
     123                o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
     124            });
    244125
    245                 // Handle table badness.
    246                 content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');
    247                 content = content.replace(new RegExp('<((?:tr|thead|tfoot)(?: [^>]*)?)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');
    248                 content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');
    249                 content = content.replace(new RegExp('</tr>.*?<(tr( [^>]*)?|/table)>', 'mg'), '</tr><$1>');
    250                 content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');
     126            // Replace images with morebreak
     127            ed.onPostProcess.add(function(ed, o) {
     128                if (o.get)
     129                    o.content = o.content.replace(/<img[^>]+>/g, function(im) {
     130                        if (im.indexOf('class="mceWPmore') !== -1) {
     131                            var m;
     132                            var moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
    251133
    252                 // Pretty it up for the source editor.
    253                 var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';
    254                 content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
    255                 content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>');
    256                 content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');
    257                 content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');
    258                 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
    259                 content = content.replace(new RegExp('^\\s*', ''), '');
    260                 content = content.replace(new RegExp('\\s*$', ''), '');
     134                            im = '<!--more'+moretext+'-->';
     135                        }
     136                        if (im.indexOf('class="mceWPnextpage') !== -1)
     137                            im = '<!--nextpage-->';
     138                       
     139                        return im;
     140                    });
     141            });
    261142
    262                 break;
     143            // Set active buttons if user selected pagebreak or more break
     144            ed.onNodeChange.add(function(ed, cm, n) {
     145                cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
     146                cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
     147            });
    263148        }
     149    });
    264150
    265         // Pass through to next handler in chain
    266         return content;
    267     },
    268 
    269     handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
    270 
    271         tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonNormal');
    272         tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonNormal');
    273 
    274         if (node == null)
    275             return;
    276 
    277         do {
    278             if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0)
    279                 tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonSelected');
    280             if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0)
    281                 tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonSelected');
    282         } while ((node = node.parentNode));
    283 
    284         return true;
    285     },
    286 
    287     saveCallback : function(el, content, body) {
    288         // We have a TON of cleanup to do.
    289 
    290         if ( tinyMCE.activeEditor.isHidden() ) {
    291     //        return content;           
    292         }
    293    
    294         // Mark </p> if it has any attributes.
    295         content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
    296 
    297         // Decode the ampersands of time.
    298         // content = content.replace(new RegExp('&amp;', 'g'), '&');
    299 
    300         // Get it ready for wpautop.
    301         content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
    302         content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
    303         content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
    304         content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
    305 
    306         // Fix some block element newline issues
    307         var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
    308         content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
    309         content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
    310         content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
    311        
    312         if ( content.indexOf('<object') != -1 ) {
    313             content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed
    314             content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>');
    315         }
    316        
    317         // Unmark special paragraph closing tags
    318         content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
    319         content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
    320 
    321         // Trim trailing whitespace
    322         content = content.replace(new RegExp('\\s*$', ''), '');
    323 
    324         // Hope.
    325         return content;
    326 
    327     },
    328 
    329     _parseAttributes : function(attribute_string) {
    330         var attributeName = "";
    331         var attributeValue = "";
    332         var withInName;
    333         var withInValue;
    334         var attributes = new Array();
    335         var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
    336         var titleText = tinyMCE.getLang('lang_wordpress_more');
    337         var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
    338 
    339         if (attribute_string == null || attribute_string.length < 2)
    340             return null;
    341 
    342         withInName = withInValue = false;
    343 
    344         for (var i=0; i<attribute_string.length; i++) {
    345             var chr = attribute_string.charAt(i);
    346 
    347             if ((chr == '"' || chr == "'") && !withInValue)
    348                 withInValue = true;
    349             else if ((chr == '"' || chr == "'") && withInValue) {
    350                 withInValue = false;
    351 
    352                 var pos = attributeName.lastIndexOf(' ');
    353                 if (pos != -1)
    354                     attributeName = attributeName.substring(pos+1);
    355 
    356                 attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
    357 
    358                 attributeName = "";
    359                 attributeValue = "";
    360             } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
    361                 withInName = true;
    362 
    363             if (chr == '=' && withInName)
    364                 withInName = false;
    365 
    366             if (withInName)
    367                 attributeName += chr;
    368 
    369             if (withInValue)
    370                 attributeValue += chr;
    371         }
    372 
    373         return attributes;
    374     }
    375 };
    376 
    377 //tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin);
    378 
    379 /* This little hack protects our More and Page placeholders from the removeformat command */
    380 tinyMCE.orgExecCommand = tinyMCE.execCommand;
    381 tinyMCE.execCommand = function (command, user_interface, value) {
    382     re = this.orgExecCommand(command, user_interface, value);
    383 
    384     if ( command == 'removeformat' ) {
    385         var inst = tinyMCE.getInstanceById('mce_editor_0');
    386         doc = inst.getDoc();
    387         var imgs = doc.getElementsByTagName('img');
    388         for (i=0;img=imgs[i];i++)
    389             img.className = img.name;
    390     }
    391     return re;
    392 };
    393 wpInstTriggerSave = function (skip_cleanup, skip_callback) {
    394     var e, nl = new Array(), i, s;
    395 
    396     this.switchSettings();
    397     s = tinyMCE.settings;
    398 
    399     // Force hidden tabs visible while serializing
    400     if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
    401         e = this.iframeElement;
    402 
    403         do {
    404             if (e.style && e.style.display == 'none') {
    405                 e.style.display = 'block';
    406                 nl[nl.length] = {elm : e, type : 'style'};
    407             }
    408 
    409             if (e.style && s.hidden_tab_class.length > 0 && e.className.indexOf(s.hidden_tab_class) != -1) {
    410                 e.className = s.display_tab_class;
    411                 nl[nl.length] = {elm : e, type : 'class'};
    412             }
    413         } while ((e = e.parentNode) != null)
    414     }
    415 
    416     tinyMCE.settings['preformatted'] = false;
    417 
    418     // Default to false
    419     if (typeof(skip_cleanup) == "undefined")
    420         skip_cleanup = false;
    421 
    422     // Default to false
    423     if (typeof(skip_callback) == "undefined")
    424         skip_callback = false;
    425 
    426 //  tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML);
    427 
    428     // Remove visual aids when cleanup is disabled
    429     if (this.settings['cleanup'] == false) {
    430         tinyMCE.handleVisualAid(this.getBody(), true, false, this);
    431         tinyMCE._setEventsEnabled(this.getBody(), true);
    432     }
    433 
    434     tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body);
    435     tinyMCE.selectedInstance.getWin().oldfocus=tinyMCE.selectedInstance.getWin().focus;
    436     tinyMCE.selectedInstance.getWin().focus=function() {};
    437     var htm = tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);
    438     tinyMCE.selectedInstance.getWin().focus=tinyMCE.selectedInstance.getWin().oldfocus;
    439     htm = tinyMCE._customCleanup(this, "submit_content", htm);
    440 
    441     if (!skip_callback && tinyMCE.settings['save_callback'] != "")
    442         var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());");
    443 
    444     // Use callback content if available
    445     if ((typeof(content) != "undefined") && content != null)
    446         htm = content;
    447 
    448     // Replace some weird entities (Bug: #1056343)
    449     htm = tinyMCE.regexpReplace(htm, "&#40;", "(", "gi");
    450     htm = tinyMCE.regexpReplace(htm, "&#41;", ")", "gi");
    451     htm = tinyMCE.regexpReplace(htm, "&#59;", ";", "gi");
    452     htm = tinyMCE.regexpReplace(htm, "&#34;", "&quot;", "gi");
    453     htm = tinyMCE.regexpReplace(htm, "&#94;", "^", "gi");
    454 
    455     if (this.formElement)
    456         this.formElement.value = htm;
    457 
    458     if (tinyMCE.isSafari && this.formElement)
    459         this.formElement.innerText = htm;
    460 
    461     // Hide them again (tabs in MSIE)
    462     for (i=0; i<nl.length; i++) {
    463         if (nl[i].type == 'style')
    464             nl[i].elm.style.display = 'none';
    465         else
    466             nl[i].elm.className = s.hidden_tab_class;
    467     }
    468 }
    469 tinyMCE.wpTriggerSave = function () {
    470     var inst, n;
    471     for (n in tinyMCE.instances) {
    472         inst = tinyMCE.instances[n];
    473         if (!tinyMCE.isInstance(inst))
    474             continue;
    475         inst.wpTriggerSave = wpInstTriggerSave;
    476         inst.wpTriggerSave(false, false);
    477     }
    478 }
    479 
    480 function switchEditors(id) {
    481     var inst = tinyMCE.getInstanceById(id);
    482     var qt = document.getElementById('quicktags');
    483     var H = document.getElementById('edButtonHTML');
    484     var P = document.getElementById('edButtonPreview');
    485     var ta = document.getElementById(id);
    486     var pdr = ta.parentNode;
    487 
    488     if ( ! inst.isHidden(id) ) {
    489         edToggle(H, P);
    490 
    491         if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
    492             // IE rejects the later overflow assignment so we skip this step.
    493             // Alternate code might be nice. Until then, IE reflows.
    494         } else {
    495             // Lock the fieldset's height to prevent reflow/flicker
    496             pdr.style.height = pdr.clientHeight + 'px';
    497             pdr.style.overflow = 'hidden';
    498         }
    499 
    500         // Save the coords of the bottom right corner of the rich editor
    501         var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0];
    502         var y1 = table.offsetTop + table.offsetHeight;
    503 
    504         if ( tinymce.util.Cookie.get("TinyMCE_" + inst.editorId + "_height") == null ) {
    505             var expires = new Date();
    506             expires.setTime(expires.getTime() + 3600000 * 24 * 30);
    507             var offset = tinyMCE.isMSIE ? 1 : 2;
    508             tinymce.util.Cookie.set("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires);
    509         }
    510 
    511         // Unload the rich editor
    512         // inst.triggerSave(false, false);
    513         // inst.formElement.value;
    514         inst.hide(); // tinyMCE.removeMCEControl(id);
    515         // document.getElementById(id).value = htm;
    516         // --tinyMCE.idCounter;
    517 
    518         // Reveal Quicktags and textarea
    519         qt.style.display = 'block';
    520         ta.style.display = 'inline';
    521 
    522         // Set the textarea height to match the rich editor
    523         y2 = ta.offsetTop + ta.offsetHeight;
    524         ta.style.height = (ta.clientHeight + y1 - y2) + 'px';
    525 
    526         // Tweak the widths
    527         ta.parentNode.style.paddingRight = '12px';
    528 
    529         if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
    530         } else {
    531             // Unlock the fieldset's height
    532             pdr.style.height = 'auto';
    533             pdr.style.overflow = 'display';
    534         }
    535         wpSetDefaultEditor( 'html' );
    536     } else {
    537         edToggle(P, H);
    538         edCloseAllTags(); // :-(
    539 
    540         if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
    541         } else {
    542             // Lock the fieldset's height
    543             pdr.style.height = pdr.clientHeight + 'px';
    544             pdr.style.overflow = 'hidden';
    545         }
    546 
    547         // Hide Quicktags and textarea
    548         qt.style.display = 'none';
    549         ta.style.display = 'none';
    550 
    551         // Tweak the widths
    552         ta.parentNode.style.paddingRight = '0px';
    553 
    554         // Load the rich editor with formatted html
    555         //if ( tinyMCE.isMSIE ) {
    556         //  ta.value = wpautop(ta.value);
    557         //  tinyMCE.addMCEControl(ta, id);
    558         //} else {
    559             ta.value = wpautop(ta.value);
    560             inst.show() // tinyMCE.addMCEControl(ta, id);
    561             //tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm);
    562         //}
    563 
    564         if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) {
    565         } else {
    566             // Unlock the fieldset's height
    567             pdr.style.height = 'auto';
    568             pdr.style.overflow = 'display';
    569         }
    570         wpSetDefaultEditor( 'tinymce' );
    571     }
    572 }
    573 
    574 function edToggle(A, B) {
    575     A.className = 'active';
    576     B.className = '';
    577 
    578     B.onclick = A.onclick;
    579     A.onclick = null;
    580 }
    581 
    582 function wpSetDefaultEditor( editor ) {
    583     try {
    584         editor = escape( editor.toString() );
    585     } catch(err) {
    586         editor = 'tinymce';
    587     }
    588 
    589     var userID = document.getElementById('user-id');
    590     var date = new Date();
    591     date.setTime(date.getTime()+(10*365*24*60*60*1000));
    592     document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
    593 }
    594 
    595 function wpautop(pee) {
    596     pee = pee + "\n\n";
    597     pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n");
    598     pee = pee.replace(new RegExp('(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "\n$1");
    599     pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n");
    600     pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
    601     pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
    602     pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
    603     pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), '');
    604     pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
    605     pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
    606     pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
    607     pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>');
    608     pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "$1");
    609     pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1");
    610     pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
    611     pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*<br />', 'gi'), "$1");
    612     pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
    613     pee = pee.replace(new RegExp('^((?:&nbsp;)*)\\s', 'mg'), '$1&nbsp;');
    614     //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' "); // Hmm...
    615     return pee;
    616 }
     151    // Register plugin
     152    tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
     153})();
  • trunk/wp-includes/js/tinymce/plugins/wordpress/langs/en.js

    r6641 r6694  
    1 // EN lang variables
    2 
    3 if (navigator.userAgent.indexOf('Mac OS') != -1) {
    4 // Mac OS browsers use Ctrl to hit accesskeys
    5     var metaKey = 'Ctrl';
    6 }
    7 else if (navigator.userAgent.indexOf('Firefox/2') != -1) {
    8 // Firefox 2.x uses Alt+Shift to hit accesskeys
    9     var metaKey = 'Alt+Shift';
    10 }
    11 else {
    12     var metaKey = 'Alt';
    13 }
    14 
    15 tinyMCE.addI18n('',{
    16 wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
    17 wordpress_page_button : 'Split post with Page tag',
    18 wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+v)',
    19 wordpress_more_alt : 'More...',
    20 wordpress_page_alt : '...page...',
    21 help_button_title : 'Help (' + metaKey + '+h)',
    22 bold_desc : 'Bold (Ctrl+B)',
    23 italic_desc : 'Italic (Ctrl+I)',
    24 underline_desc : 'Underline (Ctrl+U)',
    25 link_desc : 'Insert/edit link (' + metaKey + '+a)',
    26 unlink_desc : 'Unlink (' + metaKey + '+s)',
    27 image_desc : 'Insert/edit image (' + metaKey + '+m)',
    28 striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
    29 justifyleft_desc : 'Align left (' + metaKey + '+f)',
    30 justifycenter_desc : 'Align center (' + metaKey + '+c)',
    31 justifyright_desc : 'Align right (' + metaKey + '+r)',
    32 justifyfull_desc : 'Align full (' + metaKey + '+j)',
    33 bullist_desc : 'Unordered list (' + metaKey + '+l)',
    34 numlist_desc : 'Ordered list (' + metaKey + '+o)',
    35 outdent_desc : 'Outdent (' + metaKey + '+w)',
    36 indent_desc : 'Indent list/blockquote (' + metaKey + '+q)'
     1tinyMCE.addI18n('en.wordpress',{
     2wp_adv_desc : 'Show/Hide Advanced Toolbar',
     3wp_more_desc : 'Split post with More tag',
     4wp_page_desc : 'Split post with Page tag',
     5wp_help_desc : 'Help',
     6wp_more_alt : 'More...',
     7wp_page_alt : 'Next page...'
    378});
  • trunk/wp-includes/js/tinymce/themes/advanced/anchor.htm

    r6632 r6694  
    33<head>
    44    <title>{#advanced_dlg.anchor_title}</title>
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="js/anchor.js"></script>
    7     <base target="_self" />
     7    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('anchorName').focus();},500);});</script>
     8    <base target="_self" />
    89</head>
    910<body style="display: none">
     
    2122    <div class="mceActionPanel">
    2223        <div style="float: left">
    23             <input type="button" id="insert" name="insert" value="{#update}" onclick="AnchorDialog.update();" />
     24            <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
    2425        </div>
    2526
    2627        <div style="float: right">
    27             <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
     28            <input type="submit" id="insert" name="insert" value="{#update}" onclick="AnchorDialog.update();" />
    2829        </div>
    2930    </div>
  • trunk/wp-includes/js/tinymce/themes/advanced/charmap.htm

    r6632 r6694  
    88</head>
    99<body style="display: none">
    10 <table align="center" border="0" cellspacing="0" cellpadding="2">
     10<table style="background:#fff;" align="center" border="0" cellspacing="0" cellpadding="2">
    1111    <tr>
    1212        <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td>
  • trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js

    r6632 r6694  
    1 /**
    2  * $Id: editor_template_src.js 520 2008-01-07 16:30:32Z spocke $
    3  *
    4  * @author Moxiecode
    5  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
    6  */
    7 
    8 (function() {
    9     var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID;
    10 
    11     // Tell it to load theme specific language pack(s)
    12     tinymce.ThemeManager.requireLangPack('advanced');
    13 
    14     tinymce.create('tinymce.themes.AdvancedTheme', {
    15         // Control name lookup, format: title, command
    16         controls : {
    17             bold : ['bold_desc', 'Bold'],
    18             italic : ['italic_desc', 'Italic'],
    19             underline : ['underline_desc', 'Underline'],
    20             strikethrough : ['striketrough_desc', 'Strikethrough'],
    21             justifyleft : ['justifyleft_desc', 'JustifyLeft'],
    22             justifycenter : ['justifycenter_desc', 'JustifyCenter'],
    23             justifyright : ['justifyright_desc', 'JustifyRight'],
    24             justifyfull : ['justifyfull_desc', 'JustifyFull'],
    25             bullist : ['bullist_desc', 'InsertUnorderedList'],
    26             numlist : ['numlist_desc', 'InsertOrderedList'],
    27             outdent : ['outdent_desc', 'Outdent'],
    28             indent : ['indent_desc', 'Indent'],
    29             cut : ['cut_desc', 'Cut'],
    30             copy : ['copy_desc', 'Copy'],
    31             paste : ['paste_desc', 'Paste'],
    32             undo : ['undo_desc', 'Undo'],
    33             redo : ['redo_desc', 'Redo'],
    34             link : ['link_desc', 'mceLink'],
    35             unlink : ['unlink_desc', 'unlink'],
    36             image : ['image_desc', 'mceImage'],
    37             cleanup : ['cleanup_desc', 'mceCleanup'],
    38             help : ['help_desc', 'mceHelp'],
    39             code : ['code_desc', 'mceCodeEditor'],
    40             hr : ['hr_desc', 'InsertHorizontalRule'],
    41             removeformat : ['removeformat_desc', 'RemoveFormat'],
    42             sub : ['sub_desc', 'subscript'],
    43             sup : ['sup_desc', 'superscript'],
    44             forecolor : ['forecolor_desc', 'ForeColor'],
    45             forecolorpicker : ['forecolor_desc', 'mceForeColor'],
    46             backcolor : ['backcolor_desc', 'HiliteColor'],
    47             backcolorpicker : ['backcolor_desc', 'mceBackColor'],
    48             charmap : ['charmap_desc', 'mceCharMap'],
    49             visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
    50             anchor : ['anchor_desc', 'mceInsertAnchor'],
    51             newdocument : ['newdocument_desc', 'mceNewDocument'],
    52             blockquote : ['blockquote_desc', 'mceBlockQuote']
    53         },
    54 
    55         stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
    56 
    57         init : function(ed, url) {
    58             var t = this, s;
    59 
    60             t.editor = ed;
    61             t.url = url;
    62             t.onResolveName = new tinymce.util.Dispatcher(this);
    63 
    64             // Default settings
    65             t.settings = s = extend({
    66                 theme_advanced_path : true,
    67                 theme_advanced_toolbar_location : 'bottom',
    68                 theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
    69                 theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
    70                 theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
    71                 theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
    72                 theme_advanced_toolbar_align : "center",
    73                 theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
    74                 theme_advanced_font_sizes : "1,2,3,4,5,6,7",
    75                 theme_advanced_more_colors : 1,
    76                 theme_advanced_row_height : 23,
    77                 theme_advanced_resize_horizontal : 1,
    78                 theme_advanced_resizing_use_cookie : 1
    79             }, ed.settings);
    80 
    81             if (s.theme_advanced_statusbar_location == 'none')
    82                 s.theme_advanced_statusbar_location = 0;
    83 
    84             // Init editor
    85             ed.onInit.add(function() {
    86                 ed.onNodeChange.add(t._nodeChanged, t);
    87                 ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
    88             });
    89 
    90             ed.onSetProgressState.add(function(ed, b, ti) {
    91                 var co, id = ed.id, tb;
    92 
    93                 if (b) {
    94                     t.progressTimer = setTimeout(function() {
    95                         co = ed.getContainer();
    96                         co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
    97                         tb = DOM.get(ed.id + '_tbl');
    98 
    99                         DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
    100                         DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
    101                     }, ti || 0);
    102                 } else {
    103                     DOM.remove(id + '_blocker');
    104                     DOM.remove(id + '_progress');
    105                     clearTimeout(t.progressTimer);
    106                 }
    107             });
    108 
    109             DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css"));
    110         },
    111 
    112         createControl : function(n, cf) {
    113             var cd, c;
    114 
    115             if (c = cf.createControl(n))
    116                 return c;
    117 
    118             switch (n) {
    119                 case "styleselect":
    120                     return this._createStyleSelect();
    121 
    122                 case "formatselect":
    123                     return this._createBlockFormats();
    124 
    125                 case "fontselect":
    126                     return this._createFontSelect();
    127 
    128                 case "fontsizeselect":
    129                     return this._createFontSizeSelect();
    130 
    131                 case "forecolor":
    132                     return this._createForeColorMenu();
    133 
    134                 case "backcolor":
    135                     return this._createBackColorMenu();
    136             }
    137 
    138             if ((cd = this.controls[n]))
    139                 return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
    140         },
    141 
    142         execCommand : function(cmd, ui, val) {
    143             var f = this['_' + cmd];
    144 
    145             if (f) {
    146                 f.call(this, ui, val);
    147                 return true;
    148             }
    149 
    150             return false;
    151         },
    152 
    153         _importClasses : function() {
    154             var ed = this.editor, c = ed.controlManager.get('styleselect');
    155 
    156             if (c.getLength() == 0) {
    157                 each(ed.dom.getClasses(), function(o) {
    158                     c.add(o['class'], o['class']);
    159                 });
    160             }
    161         },
    162 
    163         _createStyleSelect : function(n) {
    164             var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
    165                 title : 'advanced.style_select',
    166                 onselect : function(v) {
    167                     if (c.selectedValue === v) {
    168                         ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
    169                         c.select();
    170                         return false;
    171                     } else
    172                         ed.execCommand('mceSetCSSClass', 0, v);
    173                 }
    174             });
    175 
    176             each((t.settings.theme_advanced_styles || '').split(';'), function(v) {
    177                 var p = v.split('=');
    178 
    179                 if (v)
    180                     c.add(t.editor.translate(p[0]), p[1]);
    181             });
    182 
    183             c.onPostRender.add(function(ed, n) {
    184                 Event.add(n, 'focus', t._importClasses, t);
    185                 Event.add(n, 'mousedown', t._importClasses, t);
    186             });
    187 
    188             return c;
    189         },
    190 
    191         _createFontSelect : function() {
    192             var c, t = this;
    193 
    194             c = t.editor.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
    195 
    196             each(t.settings.theme_advanced_fonts.split(';'), function(v) {
    197                 var p = v.split('='), st;
    198 
    199                 if (p[1].indexOf('dings') == -1)
    200                     st = 'font-family:' + p[1];
    201 
    202                 c.add(t.editor.translate(p[0]), p[1], {style : st});
    203             });
    204 
    205             return c;
    206         },
    207 
    208         _createFontSizeSelect : function() {
    209             var c, t = this, lo = [
    210                 "1 (8 pt)",
    211                 "2 (10 pt)",
    212                 "3 (12 pt)",
    213                 "4 (14 pt)",
    214                 "5 (18 pt)",
    215                 "6 (24 pt)",
    216                 "7 (36 pt)"
    217             ], fz = [8, 10, 12, 14, 18, 24, 36];
    218 
    219             c = t.editor.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'});
    220 
    221             each(t.settings.theme_advanced_font_sizes.split(','), function(v) {
    222                 c.add(lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'fontSize' + v});
    223             });
    224 
    225             return c;
    226         },
    227 
    228         _createBlockFormats : function() {
    229             var c, fmts = {
    230                 p : 'advanced.paragraph',
    231                 address : 'advanced.address',
    232                 pre : 'advanced.pre',
    233                 h1 : 'advanced.h1',
    234                 h2 : 'advanced.h2',
    235                 h3 : 'advanced.h3',
    236                 h4 : 'advanced.h4',
    237                 h5 : 'advanced.h5',
    238                 h6 : 'advanced.h6',
    239                 div : 'advanced.div',
    240                 blockquote : 'advanced.blockquote',
    241                 code : 'advanced.code',
    242                 dt : 'advanced.dt',
    243                 dd : 'advanced.dd',
    244                 samp : 'advanced.samp'
    245             }, t = this;
    246 
    247             c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
    248 
    249             each(t.settings.theme_advanced_blockformats.split(','), function(v) {
    250                 c.add(t.editor.translate(fmts[v]), v, {element : v, 'class' : v.indexOf('h') == 0 ? '' : 'preview'});
    251             });
    252 
    253             return c;
    254         },
    255 
    256         _createForeColorMenu : function() {
    257             var c, t = this, s = t.settings, o = {}, v;
    258 
    259             if (s.theme_advanced_more_colors) {
    260                 o.more_colors_func = function() {
    261                     t._mceColorPicker(0, {
    262                         color : c.value,
    263                         func : function(co) {
    264                             c.setColor(co);
    265                         }
    266                     });
    267                 };
    268             }
    269 
    270             if (v = s.theme_advanced_text_colors)
    271                 o.colors = v;
    272 
    273             o.title = 'advanced.forecolor_desc';
    274             o.cmd = 'ForeColor';
    275             o.scope = this;
    276 
    277             c = t.editor.controlManager.createColorSplitButton('forecolor', o);
    278 
    279             return c;
    280         },
    281 
    282         _createBackColorMenu : function() {
    283             var c, t = this, s = t.settings, o = {}, v;
    284 
    285             if (s.theme_advanced_more_colors) {
    286                 o.more_colors_func = function() {
    287                     t._mceColorPicker(0, {
    288                         color : c.value,
    289                         func : function(co) {
    290                             c.setColor(co);
    291                         }
    292                     });
    293                 };
    294             }
    295 
    296             if (v = s.theme_advanced_background_colors)
    297                 o.colors = v;
    298 
    299             o.title = 'advanced.backcolor_desc';
    300             o.cmd = 'HiliteColor';
    301             o.scope = this;
    302 
    303             c = t.editor.controlManager.createColorSplitButton('backcolor', o);
    304 
    305             return c;
    306         },
    307 
    308         renderUI : function(o) {
    309             var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
    310 
    311             n = p = DOM.create('div', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin'});
    312 
    313             if (!DOM.boxModel)
    314                 n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
    315 
    316             n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
    317             n = tb = DOM.add(n, 'tbody');
    318 
    319             switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
    320                 case "rowlayout":
    321                     ic = t._rowLayout(s, tb, o);
    322                     break;
    323 
    324                 case "customlayout":
    325                     ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
    326                     break;
    327 
    328                 default:
    329                     ic = t._simpleLayout(s, tb, o, p);
    330             }
    331 
    332             n = o.targetNode;
    333 
    334             // Add classes to first and last TRs
    335             nl = sc.rows;
    336             DOM.addClass(nl[0], 'first');
    337             DOM.addClass(nl[nl.length - 1], 'last');
    338 
    339             // Add classes to first and last TDs
    340             each(DOM.select('tr', tb), function(n) {
    341                 DOM.addClass(n.firstChild, 'first');
    342                 DOM.addClass(n.childNodes[n.childNodes.length - 1], 'last');
    343             });
    344 
    345             if (DOM.get(s.theme_advanced_toolbar_container))
    346                 DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
    347             else
    348                 DOM.insertAfter(p, n);
    349 
    350             Event.add(ed.id + '_path_row', 'click', function(e) {
    351                 e = e.target;
    352 
    353                 if (e.nodeName == 'A') {
    354                     t._sel(e.href.replace(/^[^#]*#/, ''));
    355 
    356                     return Event.cancel(e);
    357                 }
    358             });
    359 /*
    360             if (DOM.get(ed.id + '_path_row')) {
    361                 Event.add(ed.id + '_tbl', 'mouseover', function(e) {
    362                     var re;
    363    
    364                     e = e.target;
    365 
    366                     if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
    367                         re = DOM.get(ed.id + '_path_row');
    368                         t.lastPath = re.innerHTML;
    369                         DOM.setHTML(re, e.parentNode.title);
    370                     }
    371                 });
    372 
    373                 Event.add(ed.id + '_tbl', 'mouseout', function(e) {
    374                     if (t.lastPath) {
    375                         DOM.setHTML(ed.id + '_path_row', t.lastPath);
    376                         t.lastPath = 0;
    377                     }
    378                 });
    379             }
    380 */
    381             if (s.theme_advanced_toolbar_location == 'external')
    382                 o.deltaHeight = 0;
    383 
    384             t.deltaHeight = o.deltaHeight;
    385             o.targetNode = null;
    386 
    387             return {
    388                 iframeContainer : ic,
    389                 editorContainer : ed.id + '_parent',
    390                 sizeContainer : sc,
    391                 deltaHeight : o.deltaHeight
    392             };
    393         },
    394 
    395         getInfo : function() {
    396             return {
    397                 longname : 'Simple theme',
    398                 author : 'Moxiecode Systems AB',
    399                 authorurl : 'http://tinymce.moxiecode.com',
    400                 version : tinymce.majorVersion + "." + tinymce.minorVersion
    401             }
    402         },
    403 
    404         _simpleLayout : function(s, tb, o, p) {
    405             var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
    406 
    407             // Create toolbar container at top
    408             if (lo == 'top')
    409                 t._addToolbars(tb, o);
    410 
    411             // Create external toolbar
    412             if (lo == 'external') {
    413                 n = c = DOM.create('div', {style : 'position:relative'});
    414                 n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
    415                 DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
    416                 n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
    417                 etb = DOM.add(n, 'tbody');
    418 
    419                 if (p.firstChild.className == 'mceOldBoxModel')
    420                     p.firstChild.appendChild(c);
    421                 else
    422                     p.insertBefore(c, p.firstChild);
    423 
    424                 t._addToolbars(etb, o);
    425 
    426                 ed.onMouseUp.add(function() {
    427                     var e = DOM.get(ed.id + '_external');
    428                     DOM.show(e);
    429 
    430                     DOM.hide(lastExtID);
    431 
    432                     var f = Event.add(ed.id + '_external_close', 'click', function() {
    433                         DOM.hide(ed.id + '_external');
    434                         Event.remove(ed.id + '_external_close', 'click', f);
    435                     });
    436 
    437                     DOM.show(e);
    438                     DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
    439 
    440                     // Fixes IE rendering bug
    441                     DOM.hide(e);
    442                     DOM.show(e);
    443                     e.style.filter = '';
    444 
    445                     lastExtID = ed.id + '_external';
    446 
    447                     e = null;
    448                 });
    449             }
    450 
    451             if (sl == 'top')
    452                 t._addStatusBar(tb, o);
    453 
    454             // Create iframe container
    455             if (!s.theme_advanced_toolbar_container) {
    456                 n = DOM.add(tb, 'tr');
    457                 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
    458             }
    459 
    460             // Create toolbar container at bottom
    461             if (lo == 'bottom')
    462                 t._addToolbars(tb, o);
    463 
    464             if (sl == 'bottom')
    465                 t._addStatusBar(tb, o);
    466 
    467             return ic;
    468         },
    469 
    470         _rowLayout : function(s, tb, o) {
    471             var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to;
    472 
    473             dc = s.theme_advanced_containers_default_class || '';
    474             da = s.theme_advanced_containers_default_align || 'center';
    475 
    476             each((s.theme_advanced_containers || '').split(','), function(c, i) {
    477                 var v = s['theme_advanced_container_' + c].toLowerCase();
    478 
    479                 switch (v) {
    480                     case 'mceeditor':
    481                         n = DOM.add(tb, 'tr');
    482                         n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
    483                         break;
    484 
    485                     case 'mceelementpath':
    486                         t._addStatusBar(tb, o);
    487                         break;
    488 
    489                     default:
    490                         n = DOM.add(DOM.add(tb, 'tr'), 'td', {
    491                             'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc),
    492                             align : s['theme_advanced_container_' + c + '_align'] || da
    493                         });
    494 
    495                         to = cf.createToolbar("toolbar" + i);
    496                         t._addControls(v, to);
    497                         DOM.setHTML(n, to.renderHTML());
    498                         o.deltaHeight -= s.theme_advanced_row_height;
    499                 }
    500             });
    501 
    502             return ic;
    503         },
    504 
    505         _addControls : function(v, tb) {
    506             var t = this, s = t.settings, di, cf = t.editor.controlManager;
    507 
    508             if (s.theme_advanced_disable && !t._disabled) {
    509                 di = {};
    510 
    511                 each(s.theme_advanced_disable.split(','), function(v) {
    512                     di[v] = 1;
    513                 });
    514 
    515                 t._disabled = di;
    516             } else
    517                 di = t._disabled;
    518 
    519             each(v.split(','), function(n) {
    520                 var c;
    521 
    522                 if (di && di[n])
    523                     return;
    524 
    525                 // Compatiblity with 2.x
    526                 if (n == 'tablecontrols') {
    527                     each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
    528                         n = t.createControl(n, cf);
    529 
    530                         if (n)
    531                             tb.add(n);
    532                     });
    533 
    534                     return;
    535                 }
    536 
    537                 c = t.createControl(n, cf);
    538 
    539                 if (c)
    540                     tb.add(c);
    541             });
    542         },
    543 
    544         _addToolbars : function(c, o) {
    545             var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [];
    546 
    547             n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar', align : s.theme_advanced_toolbar_align});
    548 
    549             if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus'))
    550                 h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
    551 
    552             h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
    553 
    554             // Create toolbar and add the controls
    555             for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
    556                 tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
    557 
    558                 if (s['theme_advanced_buttons' + i + '_add'])
    559                     v += ',' + s['theme_advanced_buttons' + i + '_add'];
    560 
    561                 if (s['theme_advanced_buttons' + i + '_add_before'])
    562                     v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
    563 
    564                 t._addControls(v, tb, di);
    565 
    566                 //n.appendChild(n = tb.render());
    567                 h.push(tb.renderHTML());
    568 
    569                 o.deltaHeight -= s.theme_advanced_row_height;
    570             }
    571 
    572             h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
    573             DOM.setHTML(n, h.join(''));
    574         },
    575 
    576         _addStatusBar : function(tb, o) {
    577             var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
    578 
    579             n = DOM.add(tb, 'tr');
    580             n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
    581             n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&nbsp;');
    582             DOM.add(n, 'a', {href : '#', accesskey : 'x'});
    583 
    584             if (s.theme_advanced_resizing && !tinymce.isOldWebKit) {
    585                 DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'resize'});
    586 
    587                 if (s.theme_advanced_resizing_use_cookie) {
    588                     ed.onPostRender.add(function() {
    589                         var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
    590 
    591                         if (!o)
    592                             return;
    593 
    594                         if (s.theme_advanced_resize_horizontal)
    595                             c.style.width = o.cw + 'px';
    596 
    597                         c.style.height = o.ch + 'px';
    598                         DOM.get(ed.id + '_ifr').style.height = (parseInt(o.ch) + t.deltaHeight) + 'px';
    599                     });
    600                 }
    601 
    602                 ed.onPostRender.add(function() {
    603                     Event.add(ed.id + '_resize', 'mousedown', function(e) {
    604                         var c, p, w, h, n, pa;
    605 
    606                         // Measure container
    607                         c = DOM.get(ed.id + '_tbl');
    608                         w = c.clientWidth;
    609                         h = c.clientHeight;
    610 
    611                         miw = s.theme_advanced_resizing_min_width || 100;
    612                         mih = s.theme_advanced_resizing_min_height || 100;
    613                         maw = s.theme_advanced_resizing_max_width || 0xFFFF;
    614                         mah = s.theme_advanced_resizing_max_height || 0xFFFF;
    615 
    616                         // Setup placeholder
    617                         p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
    618                         DOM.setStyles(p, {width : w, height : h});
    619 
    620                         // Replace with placeholder
    621                         DOM.hide(c);
    622                         DOM.show(p);
    623 
    624                         // Create internal resize obj
    625                         r = {
    626                             x : e.screenX,
    627                             y : e.screenY,
    628                             w : w,
    629                             h : h,
    630                             dx : null,
    631                             dy : null
    632                         };
    633 
    634                         // Start listening
    635                         mf = Event.add(document, 'mousemove', function(e) {
    636                             var w, h;
    637 
    638                             // Calc delta values
    639                             r.dx = e.screenX - r.x;
    640                             r.dy = e.screenY - r.y;
    641 
    642                             // Boundery fix box
    643                             w = Math.max(miw, r.w + r.dx);
    644                             h = Math.max(mih, r.h + r.dy);
    645                             w = Math.min(maw, w);
    646                             h = Math.min(mah, h);
    647 
    648                             // Resize placeholder
    649                             if (s.theme_advanced_resize_horizontal)
    650                                 p.style.width = w + 'px';
    651 
    652                             p.style.height = h + 'px';
    653 
    654                             return Event.cancel(e);
    655                         });
    656 
    657                         me = Event.add(document, 'mouseup', function(e) {
    658                             var ifr;
    659 
    660                             // Stop listening
    661                             Event.remove(document, 'mousemove', mf);
    662                             Event.remove(document, 'mouseup', me);
    663 
    664                             c.style.display = '';
    665                             DOM.remove(p);
    666 
    667                             if (r.dx === null)
    668                                 return;
    669 
    670                             ifr = DOM.get(ed.id + '_ifr');
    671 
    672                             if (s.theme_advanced_resize_horizontal)
    673                                 c.style.width = (r.w + r.dx) + 'px';
    674 
    675                             c.style.height = (r.h + r.dy) + 'px';
    676                             ifr.style.height = (ifr.clientHeight + r.dy) + 'px';
    677 
    678                             if (s.theme_advanced_resizing_use_cookie) {
    679                                 Cookie.setHash("TinyMCE_" + ed.id + "_size", {
    680                                     cw : r.w + r.dx,
    681                                     ch : r.h + r.dy
    682                                 });
    683                             }
    684                         });
    685 
    686                         return Event.cancel(e);
    687                     });
    688                 });
    689             }
    690 
    691             o.deltaHeight -= 21;
    692             n = tb = null;
    693         },
    694 
    695         _nodeChanged : function(ed, cm, n, co) {
    696             var t = this, p, de = 0, v, c, s = t.settings;
    697 
    698             tinymce.each(t.stateControls, function(c) {
    699                 cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
    700             });
    701 
    702             cm.setActive('visualaid', ed.hasVisual);
    703             cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
    704             cm.setDisabled('redo', !ed.undoManager.hasRedo());
    705             cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
    706 
    707             p = DOM.getParent(n, 'A');
    708             if (c = cm.get('link')) {
    709                 if (!p || !p.name) {
    710                     c.setDisabled(!p && co);
    711                     c.setActive(!!p);
    712                 }
    713             }
    714 
    715             if (c = cm.get('unlink')) {
    716                 c.setDisabled(!p && co);
    717                 c.setActive(!!p && !p.name);
    718             }
    719 
    720             if (c = cm.get('anchor')) {
    721                 c.setActive(!!p && p.name);
    722 
    723                 if (tinymce.isWebKit) {
    724                     p = DOM.getParent(n, 'IMG');
    725                     c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
    726                 }
    727             }
    728 
    729             p = DOM.getParent(n, 'IMG');
    730             if (c = cm.get('image'))
    731                 c.setActive(!!p && n.className.indexOf('mceItem') == -1);
    732 
    733             if (c = cm.get('styleselect')) {
    734                 if (n.className) {
    735                     t._importClasses();
    736                     c.select(n.className);
    737                 } else
    738                     c.select();
    739             }
    740 
    741             if (c = cm.get('formatselect')) {
    742                 p = DOM.getParent(n, DOM.isBlock);
    743 
    744                 if (p)
    745                     c.select(p.nodeName.toLowerCase());
    746             }
    747 
    748             if (c = cm.get('fontselect'))
    749                 c.select(ed.queryCommandValue('FontName'));
    750 
    751             if (c = cm.get('fontsizeselect'))
    752                 c.select(ed.queryCommandValue('FontSize'));
    753 
    754             if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
    755                 p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
    756                 DOM.setHTML(p, '');
    757 
    758                 ed.dom.getParent(n, function(n) {
    759                     var na = n.nodeName.toLowerCase(), u, pi, ti = '';
    760 
    761                     // Ignore non element and hidden elements
    762                     if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
    763                         return;
    764 
    765                     // Fake name
    766                     if (v = DOM.getAttrib(n, 'mce_name'))
    767                         na = v;
    768    
    769                     // Handle prefix
    770                     if (tinymce.isIE && n.scopeName !== 'HTML')
    771                         na = n.scopeName + ':' + na;
    772 
    773                     // Remove internal prefix
    774                     na = na.replace(/mce\:/g, '');
    775 
    776                     // Handle node name
    777                     switch (na) {
    778                         case 'b':
    779                             na = 'strong';
    780                             break;
    781 
    782                         case 'i':
    783                             na = 'em';
    784                             break;
    785 
    786                         case 'img':
    787                             if (v = DOM.getAttrib(n, 'src'))
    788                                 ti += 'src: ' + v + ' ';
    789 
    790                             break;
    791 
    792                         case 'a':
    793                             if (v = DOM.getAttrib(n, 'name')) {
    794                                 ti += 'name: ' + v + ' ';
    795                                 na += '#' + v;
    796                             }
    797 
    798                             if (v = DOM.getAttrib(n, 'href'))
    799                                 ti += 'href: ' + v + ' ';
    800 
    801                             break;
    802 
    803                         case 'font':
    804                             if (s.convert_fonts_to_spans)
    805                                 na = 'span';
    806 
    807                             if (v = DOM.getAttrib(n, 'face'))
    808                                 ti += 'font: ' + v + ' ';
    809 
    810                             if (v = DOM.getAttrib(n, 'size'))
    811                                 ti += 'size: ' + v + ' ';
    812 
    813                             if (v = DOM.getAttrib(n, 'color'))
    814                                 ti += 'color: ' + v + ' ';
    815 
    816                             break;
    817 
    818                         case 'span':
    819                             if (v = DOM.getAttrib(n, 'style'))
    820                                 ti += 'style: ' + v + ' ';
    821 
    822                             break;
    823                     }
    824 
    825                     if (v = DOM.getAttrib(n, 'id'))
    826                         ti += 'id: ' + v + ' ';
    827 
    828                     if (v = n.className) {
    829                         v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
    830 
    831                         if (v && v.indexOf('mceItem') == -1) {
    832                             ti += 'class: ' + v + ' ';
    833 
    834                             if (DOM.isBlock(n) || na == 'img' || na == 'span')
    835                                 na += '.' + v;
    836                         }
    837                     }
    838 
    839                     na = na.replace(/(html:)/g, '');
    840                     na = {name : na, node : n, title : ti};
    841                     t.onResolveName.dispatch(t, na);
    842                     ti = na.title;
    843                     na = na.name;
    844 
    845                     //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
    846                     pi = DOM.create('a', {'href' : "#" + (de++) + "", onmousedown : "return false;", title : ti}, na);
    847 
    848                     if (p.hasChildNodes()) {
    849                         p.insertBefore(document.createTextNode(' \u00bb '), p.firstChild);
    850                         p.insertBefore(pi, p.firstChild);
    851                     } else
    852                         p.appendChild(pi);
    853                 }, ed.getBody());
    854             }
    855         },
    856 
    857         // Commands gets called by execCommand
    858 
    859         _sel : function(v) {
    860             this.editor.execCommand('mceSelectNodeDepth', false, v);
    861         },
    862 
    863         _mceInsertAnchor : function(ui, v) {
    864             var ed = this.editor;
    865 
    866             ed.windowManager.open({
    867                 url : tinymce.baseURL + '/themes/advanced/anchor.htm',
    868                 width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
    869                 height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
    870                 inline : true
    871             }, {
    872                 theme_url : this.url
    873             });
    874         },
    875 
    876         _mceCharMap : function() {
    877             var ed = this.editor;
    878 
    879             ed.windowManager.open({
    880                 url : tinymce.baseURL + '/themes/advanced/charmap.htm',
    881                 width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
    882                 height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
    883                 inline : true
    884             }, {
    885                 theme_url : this.url
    886             });
    887         },
    888 
    889         _mceHelp : function() {
    890             var ed = this.editor;
    891 
    892             ed.windowManager.open({
    893                 url : tinymce.baseURL + '/themes/advanced/about.htm',
    894                 width : 480,
    895                 height : 380,
    896                 inline : true
    897             }, {
    898                 theme_url : this.url
    899             });
    900         },
    901 
    902         _mceColorPicker : function(u, v) {
    903             var ed = this.editor;
    904 
    905             v = v || {};
    906 
    907             ed.windowManager.open({
    908                 url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
    909                 width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
    910                 height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
    911                 close_previous : false,
    912                 inline : true
    913             }, {
    914                 input_color : v.color,
    915                 func : v.func,
    916                 theme_url : this.url
    917             });
    918         },
    919 
    920         _mceCodeEditor : function(ui, val) {
    921             var ed = this.editor;
    922 
    923             ed.windowManager.open({
    924                 url : tinymce.baseURL + '/themes/advanced/source_editor.htm',
    925                 width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
    926                 height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
    927                 inline : true,
    928                 resizable : true,
    929                 maximizable : true
    930             }, {
    931                 theme_url : this.url
    932             });
    933         },
    934 
    935         _mceImage : function(ui, val) {
    936             var ed = this.editor;
    937 
    938             ed.windowManager.open({
    939                 url : tinymce.baseURL + '/themes/advanced/image.htm',
    940                 width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
    941                 height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
    942                 inline : true
    943             }, {
    944                 theme_url : this.url
    945             });
    946         },
    947 
    948         _mceLink : function(ui, val) {
    949             var ed = this.editor;
    950 
    951             ed.windowManager.open({
    952                 url : tinymce.baseURL + '/themes/advanced/link.htm',
    953                 width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
    954                 height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
    955                 inline : true
    956             }, {
    957                 theme_url : this.url
    958             });
    959         },
    960 
    961         _mceNewDocument : function() {
    962             var ed = this.editor;
    963 
    964             ed.windowManager.confirm('advanced.newdocument', function(s) {
    965                 if (s)
    966                     ed.execCommand('mceSetContent', false, '');
    967             });
    968         },
    969 
    970         _mceForeColor : function() {
    971             var t = this;
    972 
    973             this._mceColorPicker(0, {
    974                 func : function(co) {
    975                     t.editor.execCommand('ForeColor', false, co);
    976                 }
    977             });
    978         },
    979 
    980         _mceBackColor : function() {
    981             var t = this;
    982 
    983             this._mceColorPicker(0, {
    984                 func : function(co) {
    985                     t.editor.execCommand('HiliteColor', false, co);
    986                 }
    987             });
    988         }
    989     });
    990 
    991     tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
    992 }());
     1(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if(s.theme_advanced_path_location)s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});each((t.settings.theme_advanced_styles||'').split(';'),function(v){var p=v.split('=');if(v)c.add(t.editor.translate(p[0]),p[1]);});c.onPostRender.add(function(ed,n){Event.add(n,'focus',t._importClasses,t);Event.add(n,'mousedown',t._importClasses,t);});return c;},_createFontSelect:function(){var c,t=this;c=t.editor.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});each(t.settings.theme_advanced_fonts.split(';'),function(v){var p=v.split('='),st;if(p[1].indexOf('dings')==-1)st='font-family:'+p[1];c.add(t.editor.translate(p[0]),p[1],{style:st});});return c;},_createFontSizeSelect:function(){var c,t=this,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=t.editor.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});each(t.settings.theme_advanced_font_sizes.split(','),function(v){c.add(lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'fontSize'+v});});return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});each(t.settings.theme_advanced_blockformats.split(','),function(v){c.add(t.editor.translate(fmts[v]),v,{element:v,'class':v.indexOf('h')==0?'':'preview'});});return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('div',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=sc.rows;DOM.addClass(nl[0],'first');DOM.addClass(nl[nl.length-1],'last');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'first');DOM.addClass(n.childNodes[n.childNodes.length-1],'last');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.href.replace(/^[^#]*#/,''));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},'<!-- IE -->'),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Simple theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each((s.theme_advanced_containers||'').split(','),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(c.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc),align:s['theme_advanced_container_'+c+'_align']||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(s.theme_advanced_disable.split(','),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(v.split(','),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[];n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar',align:s.theme_advanced_toolbar_align});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},'<!-- IE -->'));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},'<!-- IE -->'));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},'<!-- IE -->'));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':'&nbsp;');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'resize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=o.cw+'px';c.style.height=o.ch+'px';DOM.get(ed.id+'_ifr').style.height=(parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(document,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(document,'mouseup',function(e){var ifr;Event.remove(document,'mousemove',mf);Event.remove(document,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=(r.w+r.dx)+'px';c.style.height=(r.h+r.dy)+'px';ifr.style.height=(ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"#"+(de++)+"",onmousedown:"return false;",title:ti},na);if(p.hasChildNodes()){p.insertBefore(document.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{func:function(co){t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{func:function(co){t.editor.execCommand('HiliteColor',false,co);}});}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}());
  • trunk/wp-includes/js/tinymce/themes/advanced/image.htm

    r6632 r6694  
    33<head>
    44    <title>{#advanced_dlg.image_title}</title>
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="../../utils/mctabs.js"></script>
    77    <script type="text/javascript" src="../../utils/form_utils.js"></script>
    88    <script type="text/javascript" src="js/image.js"></script>
    9     <base target="_self" />
     9    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('src').focus();},500);});</script>
     10    <base target="_self" />
    1011</head>
    1112<body id="image" style="display: none">
     
    7576    <div class="mceActionPanel">
    7677        <div style="float: left">
    77             <input type="button" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.update();" />
     78            <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
    7879        </div>
    79 
     80           
    8081        <div style="float: right">
    81             <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
     82            <input type="submit" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.update();" />
    8283        </div>
    8384    </div>
  • trunk/wp-includes/js/tinymce/themes/advanced/js/charmap.js

    r6632 r6694  
    307307        window.focus();
    308308
     309    tinyMCEPopup.editor.focus();
    309310    tinyMCEPopup.close();
    310311}
  • trunk/wp-includes/js/tinymce/themes/advanced/link.htm

    r6632 r6694  
    33<head>
    44    <title>{#advanced_dlg.link_title}</title>
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="../../utils/mctabs.js"></script>
    77    <script type="text/javascript" src="../../utils/form_utils.js"></script>
    88    <script type="text/javascript" src="../../utils/validate.js"></script>
    99    <script type="text/javascript" src="js/link.js"></script>
    10     <base target="_self" />
     10    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('href').focus();},500);});</script>
     11    <base target="_self" />
    1112</head>
    1213<body id="link" style="display: none">
     
    5354    <div class="mceActionPanel">
    5455        <div style="float: left">
    55             <input type="button" id="insert" name="insert" value="{#insert}" onclick="LinkDialog.update();" />
     56            <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
    5657        </div>
    5758
    5859        <div style="float: right">
    59             <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
     60            <input type="submit" id="insert" name="insert" value="{#insert}" onclick="LinkDialog.update();" />
    6061        </div>
    6162    </div>
  • trunk/wp-includes/js/tinymce/themes/advanced/skins/default/content.css

    r6632 r6694  
    1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
     1body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px; }
    22body {background:#FFF;}
    33.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;}
  • trunk/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css

    r6632 r6694  
    11/* Reset */
    2 .defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline}
     2.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .text {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate}
    33.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
    44.defaultSkin table td {vertical-align:middle}
     
    2424.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
    2525.defaultSkin .mceStatusbar {position:relative; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; padding:2px; color:#000; display:block}
    26 .defaultSkin .mceStatusbar a.resize {display:block; position:absolute; top:0; right:0; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px}
     26.defaultSkin .mceStatusbar a.resize {display:block; position:absolute; top:0; right:0; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
    2727.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
    2828.defaultSkin table.mceToolbar {margin-left:3px}
  • trunk/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css

    r6632 r6694  
    1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
     1body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
    22body {background:#FFF;}
    33.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;}
  • trunk/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css

    r6632 r6694  
    11/* Reset */
    2 .o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline}
     2.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .text {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate}
    33.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
    44.o2k7Skin table td {vertical-align:middle}
     
    2222.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px;}
    2323.o2k7Skin .mceStatusbar div {float:left; padding:2px;}
    24 .o2k7Skin .mceStatusbar a.resize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px}
     24.o2k7Skin .mceStatusbar a.resize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
    2525.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
    2626.o2k7Skin table.mceToolbar {margin-left:3px}
  • trunk/wp-includes/js/tinymce/themes/advanced/source_editor.htm

    r6632 r6694  
    33    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    44    <title>{#advanced_dlg.code_title}</title>
    5     <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
     5    <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script type="text/javascript" src="js/source_editor.js"></script>
    7     <base target="_self" />
     7    <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('htmlSource').focus();},500);});</script>
     8    <base target="_self" />
    89</head>
    910<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
     
    2122        <div class="mceActionPanel">
    2223            <div style="float: left">
    23                 <input type="button" name="insert" value="{#update}" onclick="saveContent();" id="insert" />
     24                <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
    2425            </div>
    2526
    2627            <div style="float: right">
    27                 <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
     28                <input type="submit" name="insert" value="{#update}" onclick="saveContent();" id="insert" />
    2829            </div>
    2930        </div>
  • trunk/wp-includes/js/tinymce/tiny_mce.js

    r6632 r6694  
    1 
    2 /* file:jscripts/tiny_mce/classes/tinymce.js */
    3 
    4 var tinymce = {
    5     majorVersion : '3',
    6     minorVersion : '0rc2',
    7     releaseDate : '2008-01-xx',
    8 
    9     _init : function() {
    10         var t = this, ua = navigator.userAgent, i, nl, n, base;
    11 
    12         // Browser checks
    13         t.isOpera = window.opera && opera.buildNumber;
    14         t.isWebKit = /WebKit/.test(ua);
    15         t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt;
    16         t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName);
    17         t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
    18         t.isGecko = !t.isWebKit && /Gecko/.test(ua);
    19 //      t.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua);
    20         t.isMac = ua.indexOf('Mac') != -1;
    21 
    22         // TinyMCE .NET webcontrol might be setting the values for TinyMCE
    23         if (window.tinyMCEPreInit) {
    24             t.suffix = tinyMCEPreInit.suffix;
    25             t.baseURL = tinyMCEPreInit.base;
    26             return;
    27         }
    28 
    29         // Get suffix and base
    30         t.suffix = '';
    31 
    32         // If base element found, add that infront of baseURL
    33         nl = document.getElementsByTagName('base');
    34         for (i=0; i<nl.length; i++) {
    35             if (nl[i].href)
    36                 base = nl[i].href;
    37         }
    38 
    39         function getBase(n) {
    40             if (n.src && /tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)) {
    41                 if (/_(src|dev)\.js/g.test(n.src))
    42                     t.suffix = '_src';
    43 
    44                 t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
    45 
    46                 // If path to script is relative and a base href was found add that one infront
    47                 if (base && t.baseURL.indexOf('://') == -1)
    48                     t.baseURL = base + t.baseURL;
    49 
    50                 return t.baseURL;
    51             }
    52 
    53             return null;
    54         };
    55 
    56         // Check document
    57         nl = document.getElementsByTagName('script');
    58         for (i=0; i<nl.length; i++) {
    59             if (getBase(nl[i]))
    60                 return;
    61         }
    62 
    63         // Check head
    64         n = document.getElementsByTagName('head')[0];
    65         if (n) {
    66             nl = n.getElementsByTagName('script');
    67             for (i=0; i<nl.length; i++) {
    68                 if (getBase(nl[i]))
    69                     return;
    70             }
    71         }
    72 
    73         return;
    74     },
    75 
    76     is : function(o, t) {
    77         var n = typeof(o);
    78 
    79         if (!t)
    80             return n != 'undefined';
    81 
    82         if (t == 'array' && (o instanceof Array))
    83             return true;
    84 
    85         return n == t;
    86     },
    87 
    88     // #if !jquery
    89 
    90     each : function(o, cb, s) {
    91         var n, l;
    92 
    93         if (!o)
    94             return 0;
    95 
    96         s = s || o;
    97 
    98         if (typeof(o.length) != 'undefined') {
    99             // Indexed arrays, needed for Safari
    100             for (n=0, l = o.length; n<l; n++) {
    101                 if (cb.call(s, o[n], n, o) === false)
    102                     return 0;
    103             }
    104         } else {
    105             // Hashtables
    106             for (n in o) {
    107                 if (o.hasOwnProperty(n)) {
    108                     if (cb.call(s, o[n], n, o) === false)
    109                         return 0;
    110                 }
    111             }
    112         }
    113 
    114         return 1;
    115     },
    116 
    117     map : function(a, f) {
    118         var o = [];
    119 
    120         tinymce.each(a, function(v) {
    121             o.push(f(v));
    122         });
    123 
    124         return o;
    125     },
    126 
    127     grep : function(a, f) {
    128         var o = [];
    129 
    130         tinymce.each(a, function(v) {
    131             if (!f || f(v))
    132                 o.push(v);
    133         });
    134 
    135         return o;
    136     },
    137 
    138     inArray : function(a, v) {
    139         var i, l;
    140 
    141         if (a) {
    142             for (i = 0, l = a.length; i < l; i++) {
    143                 if (a[i] === v)
    144                     return i;
    145             }
    146         }
    147 
    148         return -1;
    149     },
    150 
    151     extend : function(o, e) {
    152         var i, a = arguments;
    153 
    154         for (i=1; i<a.length; i++) {
    155             e = a[i];
    156 
    157             tinymce.each(e, function(v, n) {
    158                 if (typeof(v) !== 'undefined')
    159                     o[n] = v;
    160             });
    161         }
    162 
    163         return o;
    164     },
    165 
    166     trim : function(s) {
    167         return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
    168     },
    169 
    170     // #endif
    171 
    172     create : function(s, p) {
    173         var t = this, sp, ns, cn, scn, c, de = 0;
    174 
    175         // Parse : <prefix> <class>:<super class>
    176         s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
    177         cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
    178 
    179         // Create namespace for new class
    180         ns = t.createNS(s[3].replace(/\.\w+$/, ''));
    181 
    182         // Class already exists
    183         if (ns[cn])
    184             return;
    185 
    186         // Make pure static class
    187         if (s[2] == 'static') {
    188             ns[cn] = p;
    189 
    190             if (this.onCreate)
    191                 this.onCreate(s[2], s[3], ns[cn]);
    192 
    193             return;
    194         }
    195 
    196         // Create default constructor
    197         if (!p[cn]) {
    198             p[cn] = function() {};
    199             de = 1;
    200         }
    201 
    202         // Add constructor and methods
    203         ns[cn] = p[cn];
    204         t.extend(ns[cn].prototype, p);
    205 
    206         // Extend
    207         if (s[5]) {
    208             sp = t.resolve(s[5]).prototype;
    209             scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
    210 
    211             // Extend constructor
    212             c = ns[cn];
    213             if (de) {
    214                 // Add passthrough constructor
    215                 ns[cn] = function() {
    216                     return sp[scn].apply(this, arguments);
    217                 };
    218             } else {
    219                 // Add inherit constructor
    220                 ns[cn] = function() {
    221                     this.parent = sp[scn];
    222                     return c.apply(this, arguments);
    223                 };
    224             }
    225             ns[cn].prototype[cn] = ns[cn];
    226 
    227             // Add super methods
    228             t.each(sp, function(f, n) {
    229                 if (n != scn)
    230                     ns[cn].prototype[n] = sp[n];
    231             });
    232 
    233             // Add overridden methods
    234             t.each(p, function(f, n) {
    235                 // Extend methods if needed
    236                 if (sp[n]) {
    237                     ns[cn].prototype[n] = function() {
    238                         this.parent = sp[n];
    239                         return f.apply(this, arguments);
    240                     };
    241                 } else {
    242                     if (n != cn)
    243                         ns[cn].prototype[n] = f;
    244                 }
    245             });
    246         }
    247 
    248         // Add static methods
    249         t.each(p['static'], function(f, n) {
    250             ns[cn][n] = f;
    251         });
    252 
    253         if (this.onCreate)
    254             this.onCreate(s[2], s[3], ns[cn].prototype);
    255     },
    256 
    257     walk : function(o, f, n, s) {
    258         s = s || this;
    259 
    260         if (o) {
    261             if (n)
    262                 o = o[n];
    263 
    264             tinymce.each(o, function(o, i) {
    265                 if (f.call(s, o, i, n) === false)
    266                     return false;
    267 
    268                 tinymce.walk(o, f, n, s);
    269             });
    270         }
    271     },
    272 
    273     createNS : function(n, o) {
    274         var i, v;
    275 
    276         o = o || window;
    277 
    278         n = n.split('.');
    279         for (i=0; i<n.length; i++) {
    280             v = n[i];
    281 
    282             if (!o[v])
    283                 o[v] = {};
    284 
    285             o = o[v];
    286         }
    287 
    288         return o;
    289     },
    290 
    291     resolve : function(n, o) {
    292         var i, l;
    293 
    294         o = o || window;
    295 
    296         n = n.split('.');
    297         for (i=0, l = n.length; i<l; i++) {
    298             o = o[n[i]];
    299 
    300             if (!o)
    301                 break;
    302         }
    303 
    304         return o;
    305     },
    306 
    307     addUnload : function(f, s) {
    308         var t = this, w = window, unload;
    309 
    310         f = {func : f, scope : s || this};
    311 
    312         if (!t.unloads) {
    313             unload = function() {
    314                 var li = t.unloads, o, n;
    315 
    316                 // Call unload handlers
    317                 for (n in li) {
    318                     o = li[n];
    319 
    320                     if (o && o.func)
    321                         o.func.call(o.scope);
    322                 }
    323 
    324                 // Detach unload function
    325                 if (w.detachEvent)
    326                     w.detachEvent('onunload', unload);
    327                 else if (w.removeEventListener)
    328                     w.removeEventListener('unload', unload, false);
    329 
    330                 // Destroy references
    331                 o = li = w = unload = null;
    332 
    333                 // Run garbarge collector on IE
    334                 if (window.CollectGarbage)
    335                     window.CollectGarbage();
    336             };
    337 
    338             // Attach unload handler
    339             if (w.attachEvent)
    340                 w.attachEvent('onunload', unload);
    341             else if (w.addEventListener)
    342                 w.addEventListener('unload', unload, false);
    343 
    344             // Setup initial unload handler array
    345             t.unloads = [f];
    346         } else
    347             t.unloads.push(f);
    348 
    349         return f;
    350     },
    351 
    352     removeUnload : function(f) {
    353         var u = this.unloads, r = null;
    354 
    355         tinymce.each(u, function(o, i) {
    356             if (o && o.func == f) {
    357                 u.splice(i, 1);
    358                 r = f;
    359                 return false;
    360             }
    361         });
    362 
    363         return r;
    364     }
    365 
    366     };
    367 
    368 // Required for GZip AJAX loading
    369 window.tinymce = tinymce;
    370 
    371 // Initialize the API
    372 tinymce._init();
    373 
    374 /* file:jscripts/tiny_mce/classes/adapter/jquery/adapter.js */
    375 
    376 
    377 /* file:jscripts/tiny_mce/classes/adapter/prototype/adapter.js */
    378 
    379 
    380 /* file:jscripts/tiny_mce/classes/util/Dispatcher.js */
    381 
    382 tinymce.create('tinymce.util.Dispatcher', {
    383     scope : null,
    384     listeners : null,
    385 
    386     Dispatcher : function(s) {
    387         this.scope = s || this;
    388         this.listeners = [];
    389     },
    390 
    391     add : function(cb, s) {
    392         this.listeners.push({cb : cb, scope : s || this.scope});
    393 
    394         return cb;
    395     },
    396 
    397     addToTop : function(cb, s) {
    398         this.listeners.unshift({cb : cb, scope : s || this.scope});
    399 
    400         return cb;
    401     },
    402 
    403     remove : function(cb) {
    404         var l = this.listeners, o = null;
    405 
    406         tinymce.each(l, function(c, i) {
    407             if (cb == c.cb) {
    408                 o = cb;
    409                 l.splice(i, 1);
    410                 return false;
    411             }
    412         });
    413 
    414         return o;
    415     },
    416 
    417     dispatch : function() {
    418         var s, a = arguments;
    419 
    420         tinymce.each(this.listeners, function(c) {
    421             return s = c.cb.apply(c.scope, a);
    422         });
    423 
    424         return s;
    425     }
    426 
    427     });
    428 
    429 /* file:jscripts/tiny_mce/classes/util/URI.js */
    430 
    431 (function() {
    432     var each = tinymce.each;
    433 
    434     tinymce.create('tinymce.util.URI', {
    435         URI : function(u, s) {
    436             var t = this, o, a, b;
    437 
    438             // Default settings
    439             s = t.settings = s || {};
    440 
    441             // Strange app protocol or local anchor
    442             if (/^(mailto|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) {
    443                 t.source = u;
    444                 return;
    445             }
    446 
    447             // Absolute path with no host, fake host and protocol
    448             if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
    449                 u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
    450 
    451             // Relative path
    452             if (u.indexOf('://') === -1 && u.indexOf('//') !== 0)
    453                 u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
    454 
    455             // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
    456             u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
    457             u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);
    458             each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) {
    459                 var s = u[i];
    460 
    461                 // Zope 3 workaround, they use @@something
    462                 if (s)
    463                     s = s.replace(/\(mce_at\)/g, '@@');
    464 
    465                 t[v] = s;
    466             });
    467 
    468             if (b = s.base_uri) {
    469                 if (!t.protocol)
    470                     t.protocol = b.protocol;
    471 
    472                 if (!t.userInfo)
    473                     t.userInfo = b.userInfo;
    474 
    475                 if (!t.port && t.host == 'mce_host')
    476                     t.port = b.port;
    477 
    478                 if (!t.host || t.host == 'mce_host')
    479                     t.host = b.host;
    480 
    481                 t.source = '';
    482             }
    483 
    484             //t.path = t.path || '/';
    485         },
    486 
    487         setPath : function(p) {
    488             var t = this;
    489 
    490             p = /^(.*?)\/?(\w+)?$/.exec(p);
    491 
    492             // Update path parts
    493             t.path = p[0];
    494             t.directory = p[1];
    495             t.file = p[2];
    496 
    497             // Rebuild source
    498             t.source = '';
    499             t.getURI();
    500         },
    501 
    502         toRelative : function(u) {
    503             var t = this, o;
    504 
    505             u = new tinymce.util.URI(u, {base_uri : t});
    506 
    507             // Not on same domain/port or protocol
    508             if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)
    509                 return u.getURI();
    510 
    511             o = t.toRelPath(t.path, u.path);
    512 
    513             // Add query
    514             if (u.query)
    515                 o += '?' + u.query;
    516 
    517             // Add anchor
    518             if (u.anchor)
    519                 o += '#' + u.anchor;
    520 
    521             return o;
    522         },
    523    
    524         toAbsolute : function(u, nh) {
    525             var u = new tinymce.util.URI(u, {base_uri : this});
    526 
    527             return u.getURI(this.host == u.host ? nh : 0);
    528         },
    529 
    530         toRelPath : function(base, path) {
    531             var items, bp = 0, out = '', i;
    532 
    533             // Split the paths
    534             base = base.substring(0, base.lastIndexOf('/'));
    535             base = base.split('/');
    536             items = path.split('/');
    537 
    538             if (base.length >= items.length) {
    539                 for (i = 0; i < base.length; i++) {
    540                     if (i >= items.length || base[i] != items[i]) {
    541                         bp = i + 1;
    542                         break;
    543                     }
    544                 }
    545             }
    546 
    547             if (base.length < items.length) {
    548                 for (i = 0; i < items.length; i++) {
    549                     if (i >= base.length || base[i] != items[i]) {
    550                         bp = i + 1;
    551                         break;
    552                     }
    553                 }
    554             }
    555 
    556             if (bp == 1)
    557                 return path;
    558 
    559             for (i = 0; i < base.length - (bp - 1); i++)
    560                 out += "../";
    561 
    562             for (i = bp - 1; i < items.length; i++) {
    563                 if (i != bp - 1)
    564                     out += "/" + items[i];
    565                 else
    566                     out += items[i];
    567             }
    568 
    569             return out;
    570         },
    571 
    572         toAbsPath : function(base, path) {
    573             var i, nb = 0, o = [];
    574 
    575             // Split paths
    576             base = base.split('/');
    577             path = path.split('/');
    578 
    579             // Remove empty chunks
    580             each(base, function(k) {
    581                 if (k)
    582                     o.push(k);
    583             });
    584 
    585             base = o;
    586 
    587             // Merge relURLParts chunks
    588             for (i = path.length - 1, o = []; i >= 0; i--) {
    589                 // Ignore empty or .
    590                 if (path[i].length == 0 || path[i] == ".")
    591                     continue;
    592 
    593                 // Is parent
    594                 if (path[i] == '..') {
    595                     nb++;
    596                     continue;
    597                 }
    598 
    599                 // Move up
    600                 if (nb > 0) {
    601                     nb--;
    602                     continue;
    603                 }
    604 
    605                 o.push(path[i]);
    606             }
    607 
    608             i = base.length - nb;
    609 
    610             // If /a/b/c or /
    611             if (i <= 0)
    612                 return '/' + o.reverse().join('/');
    613 
    614             return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/');
    615         },
    616 
    617         getURI : function(nh) {
    618             var s, t = this;
    619 
    620             // Rebuild source
    621             if (!t.source || nh) {
    622                 s = '';
    623 
    624                 if (!nh) {
    625                     if (t.protocol)
    626                         s += t.protocol + '://';
    627 
    628                     if (t.userInfo)
    629                         s += t.userInfo + '@';
    630 
    631                     if (t.host)
    632                         s += t.host;
    633 
    634                     if (t.port)
    635                         s += ':' + t.port;
    636                 }
    637 
    638                 if (t.path)
    639                     s += t.path;
    640 
    641                 if (t.query)
    642                     s += '?' + t.query;
    643 
    644                 if (t.anchor)
    645                     s += '#' + t.anchor;
    646 
    647                 t.source = s;
    648             }
    649 
    650             return t.source;
    651         }
    652 
    653         });
    654 })();
    655 
    656 /* file:jscripts/tiny_mce/classes/util/Cookie.js */
    657 
    658 (function() {
    659     var each = tinymce.each;
    660 
    661     tinymce.create('static tinymce.util.Cookie', {
    662         getHash : function(n) {
    663             var v = this.get(n), h;
    664 
    665             if (v) {
    666                 each(v.split('&'), function(v) {
    667                     v = v.split('=');
    668                     h = h || {};
    669                     h[unescape(v[0])] = unescape(v[1]);
    670                 });
    671             }
    672 
    673             return h;
    674         },
    675 
    676         setHash : function(n, v, e, p, d, s) {
    677             var o = '';
    678 
    679             each(v, function(v, k) {
    680                 o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
    681             });
    682 
    683             this.set(n, o, e, p, d, s);
    684         },
    685 
    686         get : function(n) {
    687             var c = document.cookie, e, p = n + "=", b;
    688 
    689             // Strict mode
    690             if (!c)
    691                 return;
    692 
    693             b = c.indexOf("; " + p);
    694 
    695             if (b == -1) {
    696                 b = c.indexOf(p);
    697 
    698                 if (b != 0)
    699                     return null;
    700             } else
    701                 b += 2;
    702 
    703             e = c.indexOf(";", b);
    704 
    705             if (e == -1)
    706                 e = c.length;
    707 
    708             return unescape(c.substring(b + p.length, e));
    709         },
    710 
    711         set : function(n, v, e, p, d, s) {
    712             document.cookie = n + "=" + escape(v) +
    713                 ((e) ? "; expires=" + e.toGMTString() : "") +
    714                 ((p) ? "; path=" + escape(p) : "") +
    715                 ((d) ? "; domain=" + d : "") +
    716                 ((s) ? "; secure" : "");
    717         },
    718 
    719         remove : function(n, p) {
    720             var d = new Date();
    721 
    722             d.setTime(d.getTime() - 1000);
    723 
    724             this.set(n, '', d, p, d);
    725         }
    726 
    727         });
    728 })();
    729 
    730 /* file:jscripts/tiny_mce/classes/util/JSON.js */
    731 
    732 tinymce.create('static tinymce.util.JSON', {
    733     serialize : function(o) {
    734         var i, v, s = tinymce.util.JSON.serialize, t;
    735 
    736         if (o == null)
    737             return 'null';
    738 
    739         t = typeof o;
    740 
    741         if (t == 'string') {
    742             v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
    743 
    744             return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) {
    745                 i = v.indexOf(b);
    746 
    747                 if (i + 1)
    748                     return '\\' + v.charAt(i + 1);
    749 
    750                 a = b.charCodeAt().toString(16);
    751 
    752                 return '\\u' + '0000'.substring(a.length) + a;
    753             }) + '"';
    754         }
    755 
    756         if (t == 'object') {
    757             if (o instanceof Array) {
    758                     for (i=0, v = '['; i<o.length; i++)
    759                         v += (i > 0 ? ',' : '') + s(o[i]);
    760 
    761                     return v + ']';
    762                 }
    763 
    764                 v = '{';
    765 
    766                 for (i in o)
    767                     v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
    768 
    769                 return v + '}';
    770         }
    771 
    772         return '' + o;
    773     },
    774 
    775     parse : function(s) {
    776         try {
    777             return eval('(' + s + ')');
    778         } catch (ex) {
    779             // Ignore
    780         }
    781     }
    782 
    783     });
    784 
    785 /* file:jscripts/tiny_mce/classes/util/XHR.js */
    786 
    787 tinymce.create('static tinymce.util.XHR', {
    788     send : function(o) {
    789         var x, t, w = window, c = 0;
    790 
    791         // Default settings
    792         o.scope = o.scope || this;
    793         o.success_scope = o.success_scope || o.scope;
    794         o.error_scope = o.error_scope || o.scope;
    795         o.async = o.async === false ? false : true;
    796         o.data = o.data || '';
    797 
    798         function get(s) {
    799             x = 0;
    800 
    801             try {
    802                 x = new ActiveXObject(s);
    803             } catch (ex) {
    804             }
    805 
    806             return x;
    807         };
    808 
    809         x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');
    810 
    811         if (x) {
    812             if (x.overrideMimeType)
    813                 x.overrideMimeType(o.content_type);
    814 
    815             x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);
    816 
    817             if (o.content_type)
    818                 x.setRequestHeader('Content-Type', o.content_type);
    819 
    820             x.send(o.data);
    821 
    822             // Wait for response, onReadyStateChange can not be used since it leaks memory in IE
    823             t = w.setInterval(function() {
    824                 if (x.readyState == 4 || c++ > 10000) {
    825                     w.clearInterval(t);
    826 
    827                     if (o.success && c < 10000 && x.status == 200)
    828                         o.success.call(o.success_scope, '' + x.responseText, x, o);
    829                     else if (o.error)
    830                         o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o);
    831 
    832                     x = null;
    833                 }
    834             }, 10);
    835         }
    836 
    837         }
    838 });
    839 
    840 /* file:jscripts/tiny_mce/classes/util/JSONRequest.js */
    841 
    842 (function() {
    843     var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
    844 
    845     tinymce.create('tinymce.util.JSONRequest', {
    846         JSONRequest : function(s) {
    847             this.settings = extend({
    848             }, s);
    849             this.count = 0;
    850         },
    851 
    852         send : function(o) {
    853             var ecb = o.error, scb = o.success;
    854 
    855             o = extend(this.settings, o);
    856 
    857             o.success = function(c, x) {
    858                 c = JSON.parse(c);
    859 
    860                 if (typeof(c) == 'undefined') {
    861                     c = {
    862                         error : 'JSON Parse error.'
    863                     };
    864                 }
    865 
    866                 if (c.error)
    867                     ecb.call(o.error_scope || o.scope, c.error, x);
    868                 else
    869                     scb.call(o.success_scope || o.scope, c.result);
    870             };
    871 
    872             o.error = function(ty, x) {
    873                 ecb.call(o.error_scope || o.scope, ty, x);
    874             };
    875 
    876             o.data = JSON.serialize({
    877                 id : o.id || 'c' + (this.count++),
    878                 method : o.method,
    879                 params : o.params
    880             });
    881 
    882             XHR.send(o);
    883         },
    884 
    885         'static' : {
    886             sendRPC : function(o) {
    887                 return new tinymce.util.JSONRequest().send(o);
    888             }
    889         }
    890 
    891         });
    892 }());
    893 /* file:jscripts/tiny_mce/classes/dom/DOMUtils.js */
    894 
    895 (function() {
    896     // Shorten names
    897     var each = tinymce.each, is = tinymce.is;
    898     var isWebKit = tinymce.isWebKit, isIE = tinymce.isIE;
    899 
    900     tinymce.create('tinymce.dom.DOMUtils', {
    901         doc : null,
    902         root : null,
    903         files : null,
    904         listeners : {},
    905         pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
    906         cache : {},
    907         idPattern : /^#[\w]+$/,
    908         elmPattern : /^[\w_*]+$/,
    909         elmClassPattern : /^([\w_]*)\.([\w_]+)$/,
    910 
    911         DOMUtils : function(d, s) {
    912             var t = this;
    913 
    914             t.doc = d;
    915             t.files = {};
    916             t.cssFlicker = false;
    917             t.counter = 0;
    918             t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat";
    919 
    920             this.settings = s = tinymce.extend({
    921                 keep_values : false,
    922                 hex_colors : 1
    923             }, s);
    924 
    925             // Fix IE6SP2 flicker and check it failed for pre SP2
    926             if (tinymce.isIE6) {
    927                 try {
    928                     d.execCommand('BackgroundImageCache', false, true);
    929                 } catch (e) {
    930                     t.cssFlicker = true;
    931                 }
    932             }
    933 
    934             tinymce.addUnload(function() {
    935                 t.doc = t.root = null;
    936             });
    937         },
    938 
    939         getRoot : function() {
    940             var t = this, s = t.settings;
    941 
    942             return (s && t.get(s.root_element)) || t.doc.body;
    943         },
    944 
    945         getViewPort : function(w) {
    946             var d, b;
    947 
    948             w = !w ? window : w;
    949             d = w.document;
    950             b = this.boxModel ? d.documentElement : d.body;
    951 
    952             // Returns viewport size excluding scrollbars
    953             return {
    954                 x : w.pageXOffset || b.scrollLeft,
    955                 y : w.pageYOffset || b.scrollTop,
    956                 w : w.innerWidth || b.clientWidth,
    957                 h : w.innerHeight || b.clientHeight
    958             };
    959         },
    960 
    961         getRect : function(e) {
    962             var p, t = this, w, h;
    963 
    964             e = t.get(e);
    965             p = t.getPos(e);
    966             w = t.getStyle(e, 'width');
    967             h = t.getStyle(e, 'height');
    968 
    969             // Non pixel value, then force offset/clientWidth
    970             if (w.indexOf('px') === -1)
    971                 w = 0;
    972 
    973             // Non pixel value, then force offset/clientWidth
    974             if (h.indexOf('px') === -1)
    975                 h = 0;
    976 
    977             return {
    978                 x : p.x,
    979                 y : p.y,
    980                 w : parseInt(w) || e.offsetWidth || e.clientWidth,
    981                 h : parseInt(h) || e.offsetHeight || e.clientHeight
    982             };
    983         },
    984 
    985         getParent : function(n, f, r) {
    986             var na, se = this.settings;
    987 
    988             n = this.get(n);
    989 
    990             if (se.strict_root)
    991                 r = r || this.getRoot();
    992 
    993             // Wrap node name as func
    994             if (is(f, 'string')) {
    995                 na = f.toUpperCase();
    996 
    997                 f = function(n) {
    998                     var s = false;
    999 
    1000                     // Any element
    1001                     if (n.nodeType == 1 && na === '*') {
    1002                         s = true;
    1003                         return false;
    1004                     }
    1005 
    1006                     each(na.split(','), function(v) {
    1007                         if (n.nodeType == 1 && ((se.strict && n.nodeName.toUpperCase() == v) || n.nodeName == v)) {
    1008                             s = true;
    1009                             return false; // Break loop
    1010                         }
    1011                     });
    1012 
    1013                     return s;
    1014                 };
    1015             }
    1016 
    1017             while (n) {
    1018                 if (n == r)
    1019                     return null;
    1020 
    1021                 if (f(n))
    1022                     return n;
    1023 
    1024                 n = n.parentNode;
    1025             }
    1026 
    1027             return null;
    1028         },
    1029 
    1030         get : function(e) {
    1031             if (typeof(e) == 'string')
    1032                 return this.doc.getElementById(e);
    1033 
    1034             return e;
    1035         },
    1036 
    1037         // #if !jquery
    1038 
    1039         select : function(pa, s) {
    1040             var t = this, cs, c, pl, o = [], x, i, l, n;
    1041 
    1042             s = t.get(s) || t.doc;
    1043 
    1044             if (t.settings.strict) {
    1045                 function get(s, n) {
    1046                     return s.getElementsByTagName(n.toLowerCase());
    1047                 };
    1048             } else {
    1049                 function get(s, n) {
    1050                     return s.getElementsByTagName(n);
    1051                 };
    1052             }
    1053 
    1054             // Simple element pattern. For example: "p" or "*"
    1055             if (t.elmPattern.test(pa)) {
    1056                 x = get(s, pa);
    1057 
    1058                 for (i = 0, l = x.length; i<l; i++)
    1059                     o.push(x[i]);
    1060 
    1061                 return o;
    1062             }
    1063 
    1064             // Simple class pattern. For example: "p.class" or ".class"
    1065             if (t.elmClassPattern.test(pa)) {
    1066                 pl = t.elmClassPattern.exec(pa);
    1067                 x = get(s, pl[1] || '*');
    1068                 c = ' ' + pl[2] + ' ';
    1069 
    1070                 for (i = 0, l = x.length; i<l; i++) {
    1071                     n = x[i];
    1072 
    1073                     if (n.className && (' ' + n.className + ' ').indexOf(c) !== -1)
    1074                         o.push(n);
    1075                 }
    1076 
    1077                 return o;
    1078             }
    1079 
    1080             function collect(n) {
    1081                 if (!n.mce_save) {
    1082                     n.mce_save = 1;
    1083                     o.push(n);
    1084                 }
    1085             };
    1086 
    1087             function collectIE(n) {
    1088                 if (!n.getAttribute('mce_save')) {
    1089                     n.setAttribute('mce_save', '1');
    1090                     o.push(n);
    1091                 }
    1092             };
    1093 
    1094             function find(n, f, r) {
    1095                 var i, l, nl = get(r, n);
    1096 
    1097                 for (i = 0, l = nl.length; i < l; i++)
    1098                     f(nl[i]);
    1099             };
    1100 
    1101             each(pa.split(','), function(v, i) {
    1102                 v = tinymce.trim(v);
    1103 
    1104                 // Simple element pattern, most common in TinyMCE
    1105                 if (t.elmPattern.test(v)) {
    1106                     each(get(s, v), function(n) {
    1107                         collect(n);
    1108                     });
    1109 
    1110                     return;
    1111                 }
    1112 
    1113                 // Simple element pattern with class, fairly common in TinyMCE
    1114                 if (t.elmClassPattern.test(v)) {
    1115                     x = t.elmClassPattern.exec(v);
    1116 
    1117                     each(get(s, x[1]), function(n) {
    1118                         if (t.hasClass(n, x[2]))
    1119                             collect(n);
    1120                     });
    1121 
    1122                     return;
    1123                 }
    1124 
    1125                 if (!(cs = t.cache[pa])) {
    1126                     cs = 'x=(function(cf, s) {';
    1127                     pl = v.split(' ');
    1128 
    1129                     each(pl, function(v) {
    1130                         var p = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v);
    1131 
    1132                         // Find elements
    1133                         p[1] = p[1] || '*';
    1134                         cs += 'find("' + p[1] + '", function(n) {';
    1135 
    1136                         // Check id
    1137                         if (p[2])
    1138                             cs += 'if (n.id !== "' + p[2] + '") return;';
    1139 
    1140                         // Check classes
    1141                         if (p[3]) {
    1142                             cs += 'var c = " " + n.className + " ";';
    1143                             cs += 'if (';
    1144                             c = '';
    1145                             each(p[3].split('.'), function(v) {
    1146                                 if (v)
    1147                                     c += (c ? '||' : '') + 'c.indexOf(" ' + v + ' ") === -1';
    1148                             });
    1149                             cs += c + ') return;';
    1150                         }
    1151                     });
    1152 
    1153                     cs += 'cf(n);';
    1154 
    1155                     for (i = pl.length - 1; i >= 0; i--)
    1156                         cs += '}, ' + (i ? 'n' : 's') + ');';
    1157 
    1158                     cs += '})';
    1159 
    1160                     // Compile CSS pattern function
    1161                     t.cache[pa] = cs = eval(cs);
    1162                 }
    1163 
    1164                 // Run selector function
    1165                 cs(isIE ? collectIE : collect, s);
    1166             });
    1167 
    1168             // Cleanup
    1169             each(o, function(n) {
    1170                 if (isIE)
    1171                     n.removeAttribute('mce_save');
    1172                 else
    1173                     delete n.mce_save;
    1174             });
    1175 
    1176             return o;
    1177         },
    1178 
    1179         // #endif
    1180 
    1181         add : function(p, n, a, h, c) {
    1182             var t = this;
    1183 
    1184             return this.run(p, function(p) {
    1185                 var e, k;
    1186 
    1187                 e = is(n, 'string') ? t.doc.createElement(n) : n;
    1188 
    1189                 if (a) {
    1190                     for (k in a) {
    1191                         if (a.hasOwnProperty(k) && !is(a[k], 'object'))
    1192                             t.setAttrib(e, k, '' + a[k]);
    1193                     }
    1194 
    1195                     if (a.style && !is(a.style, 'string')) {
    1196                         each(a.style, function(v, n) {
    1197                             t.setStyle(e, n, v);
    1198                         });
    1199                     }
    1200                 }
    1201 
    1202                 if (h) {
    1203                     if (h.nodeType)
    1204                         e.appendChild(h);
    1205                     else
    1206                         e.innerHTML = h;
    1207                 }
    1208 
    1209                 return !c ? p.appendChild(e) : e;
    1210             });
    1211         },
    1212 
    1213         create : function(n, a, h) {
    1214             return this.add(this.doc.createElement(n), n, a, h, 1);
    1215         },
    1216 
    1217         createHTML : function(n, a, h) {
    1218             var o = '', t = this, k;
    1219 
    1220             o += '<' + n;
    1221 
    1222             for (k in a) {
    1223                 if (a.hasOwnProperty(k))
    1224                     o += ' ' + k + '="' + t.encode(a[k]) + '"';
    1225             }
    1226 
    1227             if (tinymce.is(h))
    1228                 return o + '>' + h + '</' + n + '>';
    1229 
    1230             return o + ' />';
    1231         },
    1232 
    1233         remove : function(n, k) {
    1234             return this.run(n, function(n) {
    1235                 var p;
    1236 
    1237                 p = n.parentNode;
    1238 
    1239                 if (!p)
    1240                     return null;
    1241 
    1242                 if (k) {
    1243                     each (n.childNodes, function(c) {
    1244                         p.insertBefore(c.cloneNode(true), n);
    1245                     });
    1246                 }
    1247 
    1248                 return p.removeChild(n);
    1249             });
    1250         },
    1251 
    1252         // #if !jquery
    1253 
    1254         setStyle : function(n, na, v) {
    1255             var t = this;
    1256 
    1257             return t.run(n, function(e) {
    1258                 var s, i;
    1259 
    1260                 s = e.style;
    1261 
    1262                 // Camelcase it, if needed
    1263                 na = na.replace(/-(\D)/g, function(a, b){
    1264                     return b.toUpperCase();
    1265                 });
    1266 
    1267                 // Default px suffix on these
    1268                 if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))
    1269                     v += 'px';
    1270 
    1271                 switch (na) {
    1272                     case 'opacity':
    1273                         // IE specific opacity
    1274                         if (isIE) {
    1275                             s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";
    1276 
    1277                             if (!n.currentStyle || !n.currentStyle.hasLayout)
    1278                                 s.display = 'inline-block';
    1279                         }
    1280 
    1281                         // Fix for older browsers
    1282                         s['-moz-opacity'] = s['-khtml-opacity'] = v;
    1283                         break;
    1284 
    1285                     case 'float':
    1286                         isIE ? s.styleFloat = v : s.cssFloat = v;
    1287                         break;
    1288                 }
    1289 
    1290                 s[na] = v || '';
    1291 
    1292                 // Force update of the style data
    1293                 if (t.settings.update_styles)
    1294                     t.setAttrib(e, 'mce_style');
    1295             });
    1296         },
    1297 
    1298         getStyle : function(n, na, c) {
    1299             n = this.get(n);
    1300 
    1301             if (!n)
    1302                 return false;
    1303 
    1304             // Gecko
    1305             if (this.doc.defaultView && c) {
    1306                 // Remove camelcase
    1307                 na = na.replace(/[A-Z]/g, function(a){
    1308                     return '-' + a;
    1309                 });
    1310 
    1311                 try {
    1312                     return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);
    1313                 } catch (ex) {
    1314                     // Old safari might fail
    1315                     return null;
    1316                 }
    1317             }
    1318 
    1319             // Camelcase it, if needed
    1320             na = na.replace(/-(\D)/g, function(a, b){
    1321                 return b.toUpperCase();
    1322             });
    1323 
    1324             if (na == 'float')
    1325                 na = isIE ? 'styleFloat' : 'cssFloat';
    1326 
    1327             // IE & Opera
    1328             if (n.currentStyle && c)
    1329                 return n.currentStyle[na];
    1330 
    1331             return n.style[na];
    1332         },
    1333 
    1334         setStyles : function(e, o) {
    1335             var t = this, s = t.settings, ol;
    1336 
    1337             ol = s.update_styles;
    1338             s.update_styles = 0;
    1339 
    1340             each(o, function(v, n) {
    1341                 t.setStyle(e, n, v);
    1342             });
    1343 
    1344             // Update style info
    1345             s.update_styles = ol;
    1346             if (s.update_styles)
    1347                 t.setAttrib(e, s.cssText);
    1348         },
    1349 
    1350         setAttrib : function(e, n, v) {
    1351             var t = this;
    1352 
    1353             // Strict XML mode
    1354             if (t.settings.strict)
    1355                 n = n.toLowerCase();
    1356 
    1357             return this.run(e, function(e) {
    1358                 var s = t.settings;
    1359 
    1360                 switch (n) {
    1361                     case "style":
    1362                         if (s.keep_values) {
    1363                             if (v)
    1364                                 e.setAttribute('mce_style', v, 2);
    1365                             else
    1366                                 e.removeAttribute('mce_style', 2);
    1367                         }
    1368 
    1369                         e.style.cssText = v;
    1370                         break;
    1371 
    1372                     case "class":
    1373                         e.className = v;
    1374                         break;
    1375 
    1376                     case "src":
    1377                     case "href":
    1378                         if (s.keep_values) {
    1379                             if (s.url_converter)
    1380                                 v = s.url_converter.call(s.url_converter_scope || t, v, n, e);
    1381 
    1382                             t.setAttrib(e, 'mce_' + n, v, 2);
    1383                         }
    1384 
    1385                         break;
    1386                 }
    1387 
    1388                 if (is(v) && v !== null && v.length !== 0)
    1389                     e.setAttribute(n, '' + v, 2);
    1390                 else
    1391                     e.removeAttribute(n, 2);
    1392             });
    1393         },
    1394 
    1395         setAttribs : function(e, o) {
    1396             var t = this;
    1397 
    1398             return this.run(e, function(e) {
    1399                 each(o, function(v, n) {
    1400                     t.setAttrib(e, n, v);
    1401                 });
    1402             });
    1403         },
    1404 
    1405         // #endif
    1406 
    1407         getAttrib : function(e, n, dv) {
    1408             var v, t = this;
    1409 
    1410             e = t.get(e);
    1411 
    1412             if (!e)
    1413                 return false;
    1414 
    1415             if (!is(dv))
    1416                 dv = "";
    1417 
    1418             // Try the mce variant for these
    1419             if (/^(src|href|style)$/.test(n)) {
    1420                 v = e.getAttribute("mce_" + n);
    1421 
    1422                 if (v)
    1423                     return v;
    1424             }
    1425 
    1426             v = e.getAttribute(n, 2);
    1427 
    1428             if (!v) {
    1429                 switch (n) {
    1430                     case 'class':
    1431                         v = e.className;
    1432                         break;
    1433 
    1434                     default:
    1435                         v = e.attributes[n];
    1436                         v = v && is(v.nodeValue) ? v.nodeValue : v;
    1437                 }
    1438             }
    1439 
    1440             switch (n) {
    1441                 case 'style':
    1442                     v = v || e.style.cssText;
    1443 
    1444                     if (v) {
    1445                         v = t.serializeStyle(t.parseStyle(v));
    1446 
    1447                         if (t.settings.keep_values)
    1448                             e.setAttribute('mce_style', v);
    1449                     }
    1450 
    1451                     break;
    1452             }
    1453 
    1454             // Remove Apple and WebKit stuff
    1455             if (isWebKit && n === "class" && v)
    1456                 v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
    1457 
    1458             // Handle IE issues
    1459             if (isIE) {
    1460                 switch (n) {
    1461                     case 'rowspan':
    1462                     case 'colspan':
    1463                         // IE returns 1 as default value
    1464                         if (v === 1)
    1465                             v = '';
    1466 
    1467                         break;
    1468 
    1469                     case 'size':
    1470                         // IE returns +0 as default value for size
    1471                         if (v === '+0')
    1472                             v = '';
    1473 
    1474                         break;
    1475 
    1476                     case 'hspace':
    1477                         // IE returns -1 as default value
    1478                         if (v === -1)
    1479                             v = '';
    1480 
    1481                         break;
    1482 
    1483                     case 'tabindex':
    1484                         // IE returns 32768 as default value
    1485                         if (v === 32768)
    1486                             v = '';
    1487 
    1488                         break;
    1489 
    1490                     default:
    1491                         // IE has odd anonymous function for event attributes
    1492                         if (n.indexOf('on') === 0 && v)
    1493                             v = ('' + v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/, '$1');
    1494                 }
    1495             }
    1496 
    1497             return (v && v != '') ? '' + v : dv;
    1498         },
    1499 
    1500         getPos : function(n) {
    1501             var t = this, x = 0, y = 0, e, d = t.doc;
    1502 
    1503             n = t.get(n);
    1504 
    1505             // Use getBoundingClientRect on IE, Opera has it but it's not perfect
    1506             if (n && isIE) {
    1507                 n = n.getBoundingClientRect();
    1508                 e = t.boxModel ? d.documentElement : d.body;
    1509                 x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border
    1510                 x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x;
    1511                 n.top += window.self != window.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset
    1512 
    1513                 return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
    1514             }
    1515 
    1516             while (n) {
    1517                 x += n.offsetLeft || 0;
    1518                 y += n.offsetTop || 0;
    1519                 x -= n.scrollLeft || 0;
    1520                 y -= n.scrollTop || 0;
    1521                 n = n.offsetParent;
    1522             }
    1523 
    1524             return {x : x, y : y};
    1525         },
    1526 
    1527         parseStyle : function(st) {
    1528             var t = this, s = t.settings, o = {};
    1529 
    1530             if (!st)
    1531                 return o;
    1532 
    1533             function compress(p, s, ot) {
    1534                 var t, r, b, l;
    1535 
    1536                 // Get values and check it it needs compressing
    1537                 t = o[p + '-top' + s];
    1538                 if (!t)
    1539                     return;
    1540 
    1541                 r = o[p + '-right' + s];
    1542                 if (t != r)
    1543                     return;
    1544 
    1545                 b = o[p + '-bottom' + s];
    1546                 if (r != b)
    1547                     return;
    1548 
    1549                 l = o[p + '-left' + s];
    1550                 if (b != l)
    1551                     return;
    1552 
    1553                 // Compress
    1554                 o[ot] = l;
    1555                 delete o[p + '-top' + s];
    1556                 delete o[p + '-right' + s];
    1557                 delete o[p + '-bottom' + s];
    1558                 delete o[p + '-left' + s];
    1559             };
    1560 
    1561             function compress2(ta, a, b, c) {
    1562                 var t;
    1563 
    1564                 t = o[a];
    1565                 if (!t)
    1566                     return;
    1567 
    1568                 t = o[b];
    1569                 if (!t)
    1570                     return;
    1571 
    1572                 t = o[c];
    1573                 if (!t)
    1574                     return;
    1575 
    1576                 // Compress
    1577                 o[ta] = o[a] + ' ' + o[b] + ' ' + o[c];
    1578                 delete o[a];
    1579                 delete o[b];
    1580                 delete o[c];
    1581             };
    1582 
    1583             each(st.split(';'), function(v) {
    1584                 var sv, ur = [];
    1585 
    1586                 if (v) {
    1587                     v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';});
    1588                     v = v.split(':');
    1589                     sv = tinymce.trim(v[1]);
    1590                     sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];});
    1591 
    1592                     sv = sv.replace(/rgb\([^\)]+\)/g, function(v) {
    1593                         return t.toHex(v);
    1594                     });
    1595 
    1596                     if (s.url_converter) {
    1597                         sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) {
    1598                             return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null)) + ')';
    1599                         });
    1600                     }
    1601 
    1602                     o[tinymce.trim(v[0]).toLowerCase()] = sv;
    1603                 }
    1604             });
    1605 
    1606             compress("border", "", "border");
    1607             compress("border", "-width", "border-width");
    1608             compress("border", "-color", "border-color");
    1609             compress("border", "-style", "border-style");
    1610             compress("padding", "", "padding");
    1611             compress("margin", "", "margin");
    1612             compress2('border', 'border-width', 'border-style', 'border-color');
    1613 
    1614             return o;
    1615         },
    1616 
    1617         serializeStyle : function(o) {
    1618             var s = '';
    1619 
    1620             each(o, function(v, k) {
    1621                 if (k && v) {
    1622                     switch (k) {
    1623                         case 'color':
    1624                         case 'background-color':
    1625                             v = v.toLowerCase();
    1626                             break;
    1627                     }
    1628 
    1629                     s += (s ? ' ' : '') + k + ': ' + v + ';';
    1630                 }
    1631             });
    1632 
    1633             return s;
    1634         },
    1635 
    1636         loadCSS : function(u) {
    1637             var t = this, d = this.doc;
    1638 
    1639             if (!u)
    1640                 u = '';
    1641 
    1642             each(u.split(','), function(u) {
    1643                 if (t.files[u])
    1644                     return;
    1645 
    1646                 t.files[u] = true;
    1647 
    1648                 if (!d.createStyleSheet)
    1649                     t.add(t.select('head')[0], 'link', {rel : 'stylesheet', href : u});
    1650                 else
    1651                     d.createStyleSheet(u);
    1652             });
    1653         },
    1654 
    1655         // #if !jquery
    1656 
    1657         addClass : function(e, c) {
    1658             return this.run(e, function(e) {
    1659                 var o;
    1660 
    1661                 if (!c)
    1662                     return 0;
    1663 
    1664                 if (this.hasClass(e, c))
    1665                     return e.className;
    1666 
    1667                 o = this.removeClass(e, c);
    1668 
    1669                 return e.className = (o != '' ? (o + ' ') : '') + c;
    1670             });
    1671         },
    1672 
    1673         removeClass : function(e, c) {
    1674             var t = this, re;
    1675 
    1676             return t.run(e, function(e) {
    1677                 var v;
    1678 
    1679                 if (t.hasClass(e, c)) {
    1680                     if (!re)
    1681                         re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
    1682 
    1683                     v = e.className.replace(re, ' ');
    1684 
    1685                     return e.className = tinymce.trim(v != ' ' ? v : '');
    1686                 }
    1687 
    1688                 return e.className;
    1689             });
    1690         },
    1691 
    1692         hasClass : function(n, c) {
    1693             n = this.get(n);
    1694 
    1695             if (!n || !c)
    1696                 return false;
    1697 
    1698             return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;
    1699         },
    1700 
    1701         show : function(e) {
    1702             return this.setStyle(e, 'display', 'block');
    1703         },
    1704 
    1705         hide : function(e) {
    1706             return this.setStyle(e, 'display', 'none');
    1707         },
    1708 
    1709         isHidden : function(e) {
    1710             e = this.get(e);
    1711 
    1712             return e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
    1713         },
    1714 
    1715         // #endif
    1716 
    1717         uniqueId : function(p) {
    1718             return (!p ? 'mce_' : p) + (this.counter++);
    1719         },
    1720 
    1721         setHTML : function(e, h) {
    1722             var t = this;
    1723 
    1724             return this.run(e, function(e) {
    1725                 var r;
    1726 
    1727                 h = t.processHTML(h);
    1728 
    1729                 if (isIE) {
    1730                     e.innerHTML = '<br />' + h;
    1731                     e.removeChild(e.firstChild);
    1732                 } else
    1733                     e.innerHTML = h;
    1734 
    1735                 return h;
    1736             });
    1737         },
    1738 
    1739         processHTML : function(h) {
    1740             var t = this, s = t.settings;
    1741 
    1742             // Convert strong and em to b and i in FF since it can't handle them
    1743             if (tinymce.isGecko) {
    1744                 h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>');
    1745                 h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>');
    1746             }
    1747 
    1748             // Fix some issues
    1749             h = h.replace(/<(a)([^>]*)\/>/gi, '<$1$2></$1>'); // Force open
    1750 
    1751             // Store away src and href in mce_src and mce_href since browsers mess them up
    1752             if (s.keep_values) {
    1753                 // Wrap scripts in comments for serialization purposes
    1754                 if (h.indexOf('<script') !== -1) {
    1755                     h = h.replace(/<script>/g, '<script type="text/javascript">');
    1756                     h = h.replace(/<script(|[^>]+)>(\s*<!--|\/\/\s*<\[CDATA\[)?[\r\n]*/g, '<mce:script$1><!--\n');
    1757                     h = h.replace(/\s*(\/\/\s*-->|\/\/\s*]]>)?<\/script>/g, '\n// --></mce:script>');
    1758                     h = h.replace(/<mce:script(|[^>]+)><!--\n\/\/ --><\/mce:script>/g, '<mce:script$1></mce:script>');
    1759                 }
    1760 
    1761                 // Process all tags with src, href or style
    1762                 h = h.replace(/<([\w:]+) [^>]*(src|href|style)[^>]*>/gi, function(a, n) {
    1763                     function handle(m, b, c) {
    1764                         var u = c;
    1765 
    1766                         // Tag already got a mce_ version
    1767                         if (a.indexOf('mce_' + b) != -1)
    1768                             return m;
    1769 
    1770                         if (b == 'style') {
    1771                             // Why did I need this one?
    1772                             //if (isIE)
    1773                             //  u = t.serializeStyle(t.parseStyle(u));
    1774 
    1775                             if (s.hex_colors) {
    1776                                 u = u.replace(/rgb\([^\)]+\)/g, function(v) {
    1777                                     return t.toHex(v);
    1778                                 });
    1779                             }
    1780 
    1781                             if (s.url_converter) {
    1782                                 u = u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g, function(x, c) {
    1783                                     return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)) + ')';
    1784                                 });
    1785                             }
    1786                         } else {
    1787                             if (s.url_converter)
    1788                                 u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n));
    1789                         }
    1790 
    1791                         return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"';
    1792                     };
    1793 
    1794                     a = a.replace(/ (src|href|style)=[\"]([^\"]+)[\"]/gi, handle); // W3C
    1795                     a = a.replace(/ (src|href|style)=[\']([^\']+)[\']/gi, handle); // W3C
    1796 
    1797                     return a.replace(/ (src|href|style)=([^\s\"\'>]+)/gi, handle); // IE
    1798                 });
    1799             }
    1800 
    1801             return h;
    1802         },
    1803 
    1804         getOuterHTML : function(e) {
    1805             var d;
    1806 
    1807             e = this.get(e);
    1808 
    1809             if (!e)
    1810                 return null;
    1811 
    1812             if (isIE)
    1813                 return e.outerHTML;
    1814 
    1815             d = (e.ownerDocument || this.doc).createElement("body");
    1816             d.appendChild(e.cloneNode(true));
    1817 
    1818             return d.innerHTML;
    1819         },
    1820 
    1821         setOuterHTML : function(e, h, d) {
    1822             var t = this;
    1823 
    1824             return this.run(e, function(e) {
    1825                 var n, tp;
    1826 
    1827                 e = t.get(e);
    1828                 d = d || e.ownerDocument || t.doc;
    1829 
    1830                 if (isIE && e.nodeType == 1)
    1831                     e.outerHTML = h;
    1832                 else {
    1833                     tp = d.createElement("body");
    1834                     tp.innerHTML = h;
    1835 
    1836                     n = tp.lastChild;
    1837                     while (n) {
    1838                         t.insertAfter(n.cloneNode(true), e);
    1839                         n = n.previousSibling;
    1840                     }
    1841 
    1842                     t.remove(e);
    1843                 }
    1844             });
    1845         },
    1846 
    1847         decode : function(s) {
    1848             var e = document.createElement("div");
    1849 
    1850             e.innerHTML = s;
    1851 
    1852             return !e.firstChild ? s : e.firstChild.nodeValue;
    1853         },
    1854 
    1855         encode : function(s) {
    1856             return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
    1857                 switch (c) {
    1858                     case '&':
    1859                         return '&amp;';
    1860 
    1861                     case '"':
    1862                         return '&quot;';
    1863 
    1864                     case '<':
    1865                         return '&lt;';
    1866 
    1867                     case '>':
    1868                         return '&gt;';
    1869                 }
    1870 
    1871                 return c;
    1872             }) : s;
    1873         },
    1874 
    1875         // #if !jquery
    1876 
    1877         insertAfter : function(n, r) {
    1878             var t = this;
    1879 
    1880             r = t.get(r);
    1881 
    1882             return this.run(n, function(n) {
    1883                 var p, ns;
    1884 
    1885                 p = r.parentNode;
    1886                 ns = r.nextSibling;
    1887 
    1888                 if (ns)
    1889                     p.insertBefore(n, ns);
    1890                 else
    1891                     p.appendChild(n);
    1892 
    1893                 return n;
    1894             });
    1895         },
    1896 
    1897         // #endif
    1898 
    1899         isBlock : function(n) {
    1900             if (n.nodeType && n.nodeType !== 1)
    1901                 return false;
    1902 
    1903             n = n.nodeName || n;
    1904 
    1905             return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);
    1906         },
    1907 
    1908         // #if !jquery
    1909 
    1910         replace : function(n, o, k) {
    1911             if (is(o, 'array'))
    1912                 n = n.cloneNode(true);
    1913 
    1914             return this.run(o, function(o) {
    1915                 if (k) {
    1916                     each(o.childNodes, function(c) {
    1917                         n.appendChild(c.cloneNode(true));
    1918                     });
    1919                 }
    1920 
    1921                 return o.parentNode.replaceChild(n, o);
    1922             });
    1923         },
    1924 
    1925         // #endif
    1926 
    1927         toHex : function(s) {
    1928             var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);
    1929 
    1930             function hex(s) {
    1931                 s = parseInt(s).toString(16);
    1932 
    1933                 return s.length > 1 ? s : '0' + s; // 0 -> 00
    1934             };
    1935 
    1936             if (c) {
    1937                 s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);
    1938 
    1939                 return s;
    1940             }
    1941 
    1942             return s;
    1943         },
    1944 
    1945         getClasses : function() {
    1946             var t = this, cl = [], i, lo = {}, f = t.settings.class_filter;
    1947 
    1948             if (t.classes)
    1949                 return t.classes;
    1950 
    1951             function addClasses(s) {
    1952                 // IE style imports
    1953                 each(s.imports, function(r) {
    1954                     addClasses(r);
    1955                 });
    1956 
    1957                 each(s.cssRules || s.rules, function(r) {
    1958                     // Real type or fake it on IE
    1959                     switch (r.type || 1) {
    1960                         // Rule
    1961                         case 1:
    1962                             if (r.selectorText) {
    1963                                 each(r.selectorText.split(','), function(v) {
    1964                                     v = v.replace(/^\s*|\s*$|^\s\./g, "");
    1965 
    1966                                     if (f && !(v = f(v)))
    1967                                         return;
    1968 
    1969                                     if (/^\.mce/.test(v) || !/^\.[\w\-]+$/.test(v))
    1970                                         return;
    1971 
    1972                                     v = v.substring(1);
    1973                                     if (!lo[v]) {
    1974                                         cl.push({'class' : v});
    1975                                         lo[v] = 1;
    1976                                     }
    1977                                 });
    1978                             }
    1979                             break;
    1980 
    1981                         // Import
    1982                         case 3:
    1983                             addClasses(r.styleSheet);
    1984                             break;
    1985                     }
    1986                 });
    1987             };
    1988 
    1989             try {
    1990                 each(t.doc.styleSheets, addClasses);
    1991             } catch (ex) {
    1992                 // Ignore
    1993             }
    1994 
    1995             if (cl.length > 0)
    1996                 t.classes = cl;
    1997 
    1998             return cl;
    1999         },
    2000 
    2001         run : function(e, f, s) {
    2002             var t = this, o;
    2003 
    2004             if (typeof(e) === 'string')
    2005                 e = t.doc.getElementById(e);
    2006 
    2007             if (!e)
    2008                 return false;
    2009 
    2010             s = s || this;
    2011             if (!e.nodeType && (e.length || e.length === 0)) {
    2012                 o = [];
    2013 
    2014                 each(e, function(e, i) {
    2015                     if (e) {
    2016                         if (typeof(e) == 'string')
    2017                             e = t.doc.getElementById(e);
    2018 
    2019                         o.push(f.call(s, e, i));
    2020                     }
    2021                 });
    2022 
    2023                 return o;
    2024             }
    2025 
    2026             return f.call(s, e);
    2027         }
    2028 
    2029         /*
    2030         walk : function(n, f, s) {
    2031             var d = this.doc, w;
    2032 
    2033             if (d.createTreeWalker) {
    2034                 w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
    2035 
    2036                 while ((n = w.nextNode()) != null)
    2037                     f.call(s || this, n);
    2038             } else
    2039                 tinymce.walk(n, f, 'childNodes', s);
    2040         }
    2041         */
    2042 
    2043         /*
    2044         toRGB : function(s) {
    2045             var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
    2046 
    2047             if (c) {
    2048                 // #FFF -> #FFFFFF
    2049                 if (!is(c[3]))
    2050                     c[3] = c[2] = c[1];
    2051 
    2052                 return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
    2053             }
    2054 
    2055             return s;
    2056         }
    2057         */
    2058 
    2059         });
    2060 
    2061     // Setup page DOM
    2062     tinymce.DOM = new tinymce.dom.DOMUtils(document);
    2063 })();
    2064 
    2065 /* file:jscripts/tiny_mce/classes/dom/Event.js */
    2066 
    2067 (function() {
    2068     // Shorten names
    2069     var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
    2070 
    2071     tinymce.create('static tinymce.dom.Event', {
    2072         inits : [],
    2073         events : [],
    2074 
    2075         // #if !jquery
    2076 
    2077         add : function(o, n, f, s) {
    2078             var cb, t = this, el = t.events, r;
    2079 
    2080             // Handle array
    2081             if (o && o instanceof Array) {
    2082                 r = [];
    2083 
    2084                 each(o, function(o) {
    2085                     o = DOM.get(o);
    2086                     r.push(t.add(o, n, f, s));
    2087                 });
    2088 
    2089                 return r;
    2090             }
    2091 
    2092             o = DOM.get(o);
    2093 
    2094             if (!o)
    2095                 return;
    2096 
    2097             // Setup event callback
    2098             cb = function(e) {
    2099                 e = e || window.event;
    2100 
    2101                 // Patch in target in IE it's W3C valid
    2102                 if (e && !e.target && isIE)
    2103                     e.target = e.srcElement;
    2104 
    2105                 if (!s)
    2106                     return f(e);
    2107 
    2108                 return f.call(s, e);
    2109             };
    2110 
    2111             if (n == 'unload') {
    2112                 tinymce.unloads.unshift({func : cb});
    2113                 return cb;
    2114             }
    2115 
    2116             if (n == 'init') {
    2117                 if (t.domLoaded)
    2118                     cb();
    2119                 else
    2120                     t.inits.push(cb);
    2121 
    2122                 return cb;
    2123             }
    2124 
    2125             // Store away listener reference
    2126             el.push({
    2127                 obj : o,
    2128                 name : n,
    2129                 func : f,
    2130                 cfunc : cb,
    2131                 scope : s
    2132             });
    2133 
    2134             t._add(o, n, cb);
    2135 
    2136             return f;
    2137         },
    2138 
    2139         remove : function(o, n, f) {
    2140             var t = this, a = t.events, s = false, r;
    2141 
    2142             // Handle array
    2143             if (o && o instanceof Array) {
    2144                 r = [];
    2145 
    2146                 each(o, function(o) {
    2147                     o = DOM.get(o);
    2148                     r.push(t.remove(o, n, f));
    2149                 });
    2150 
    2151                 return r;
    2152             }
    2153 
    2154             o = DOM.get(o);
    2155 
    2156             each(a, function(e, i) {
    2157                 if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) {
    2158                     a.splice(i, 1);
    2159                     t._remove(o, n, e.cfunc);
    2160                     s = true;
    2161                     return false;
    2162                 }
    2163             });
    2164 
    2165             return s;
    2166         },
    2167 
    2168         // #endif
    2169 
    2170         cancel : function(e) {
    2171             if (!e)
    2172                 return false;
    2173 
    2174             this.stop(e);
    2175             return this.prevent(e);
    2176         },
    2177 
    2178         stop : function(e) {
    2179             if (e.stopPropagation)
    2180                 e.stopPropagation();
    2181             else
    2182                 e.cancelBubble = true;
    2183 
    2184             return false;
    2185         },
    2186 
    2187         prevent : function(e) {
    2188             if (e.preventDefault)
    2189                 e.preventDefault();
    2190             else
    2191                 e.returnValue = false;
    2192 
    2193             return false;
    2194         },
    2195 
    2196         _unload : function() {
    2197             var t = Event;
    2198 
    2199             each(t.events, function(e, i) {
    2200                 t._remove(e.obj, e.name, e.cfunc);
    2201                 e.obj = e.cfunc = null;
    2202             });
    2203 
    2204             t.events = [];
    2205             t = null;
    2206         },
    2207 
    2208         _add : function(o, n, f) {
    2209             if (o.attachEvent)
    2210                 o.attachEvent('on' + n, f);
    2211             else if (o.addEventListener)
    2212                 o.addEventListener(n, f, false);
    2213             else
    2214                 o['on' + n] = f;
    2215         },
    2216 
    2217         _remove : function(o, n, f) {
    2218             if (o.detachEvent)
    2219                 o.detachEvent('on' + n, f);
    2220             else if (o.removeEventListener)
    2221                 o.removeEventListener(n, f, false);
    2222             else
    2223                 o['on' + n] = null;
    2224         },
    2225 
    2226         _pageInit : function() {
    2227             var e = Event;
    2228 
    2229             e._remove(window, 'DOMContentLoaded', e._pageInit);
    2230             e.domLoaded = true;
    2231 
    2232             each(e.inits, function(c) {
    2233                 c();
    2234             });
    2235 
    2236             e.inits = [];
    2237         },
    2238 
    2239         _wait : function() {
    2240             var t;
    2241 
    2242             // No need since the document is already loaded
    2243             if (window.tinyMCE_GZ && tinyMCE_GZ.loaded)
    2244                 return;
    2245 
    2246             if (isIE && document.location.protocol != 'https:') {
    2247                 // Fake DOMContentLoaded on IE
    2248                 document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
    2249                 DOM.get("__ie_onload").onreadystatechange = function() {
    2250                     if (this.readyState == "complete") {
    2251                         Event._pageInit();
    2252                         DOM.get("__ie_onload").onreadystatechange = null; // Prevent leak
    2253                     }
    2254                 };
    2255             } else {
    2256                 Event._add(window, 'DOMContentLoaded', Event._pageInit, Event);
    2257 
    2258                 if (isIE || isWebKit) {
    2259                     t = setInterval(function() {
    2260                         if (/loaded|complete/.test(document.readyState)) {
    2261                             clearInterval(t);
    2262                             Event._pageInit();
    2263                         }
    2264                     }, 10);
    2265                 }
    2266             }
    2267         }
    2268 
    2269         });
    2270 
    2271     // Shorten name
    2272     Event = tinymce.dom.Event;
    2273 
    2274     // Dispatch DOM content loaded event for IE and Safari
    2275     Event._wait();
    2276     tinymce.addUnload(Event._unload);
    2277 })();
    2278 
    2279 /* file:jscripts/tiny_mce/classes/dom/Element.js */
    2280 
    2281 (function() {
    2282     var each = tinymce.each;
    2283 
    2284     tinymce.create('tinymce.dom.Element', {
    2285         Element : function(id, s) {
    2286             var t = this, dom, el;
    2287 
    2288             s = s || {};
    2289             t.id = id;
    2290             t.dom = dom = s.dom || tinymce.DOM;
    2291             t.settings = s;
    2292 
    2293             // Only IE leaks DOM references, this is a lot faster
    2294             if (!tinymce.isIE)
    2295                 el = t.dom.get(t.id);
    2296 
    2297             each([
    2298                 'getPos',
    2299                 'getRect',
    2300                 'getParent',
    2301                 'add',
    2302                 'setStyle',
    2303                 'getStyle',
    2304                 'setStyles',
    2305                 'setAttrib',
    2306                 'setAttribs',
    2307                 'getAttrib',
    2308                 'addClass',
    2309                 'removeClass',
    2310                 'hasClass',
    2311                 'getOuterHTML',
    2312                 'setOuterHTML',
    2313                 'remove',
    2314                 'show',
    2315                 'hide',
    2316                 'isHidden',
    2317                 'setHTML',
    2318                 'get'
    2319             ], function(k) {
    2320                 t[k] = function() {
    2321                     var a = arguments, o;
    2322 
    2323                     // Opera fails
    2324                     if (tinymce.isOpera) {
    2325                         a = [id];
    2326 
    2327                         each(arguments, function(v) {
    2328                             a.push(v);
    2329                         });
    2330                     } else
    2331                         Array.prototype.unshift.call(a, el || id);
    2332 
    2333                     o = dom[k].apply(dom, a);
    2334                     t.update(k);
    2335 
    2336                     return o;
    2337                 };
    2338             });
    2339         },
    2340 
    2341         on : function(n, f, s) {
    2342             return tinymce.dom.Event.add(this.id, n, f, s);
    2343         },
    2344 
    2345         getXY : function() {
    2346             return {
    2347                 x : parseInt(this.getStyle('left')),
    2348                 y : parseInt(this.getStyle('top'))
    2349             };
    2350         },
    2351 
    2352         getSize : function() {
    2353             var n = this.dom.get(this.id);
    2354 
    2355             return {
    2356                 w : parseInt(this.getStyle('width') || n.clientWidth),
    2357                 h : parseInt(this.getStyle('height') || n.clientHeight)
    2358             };
    2359         },
    2360 
    2361         moveTo : function(x, y) {
    2362             this.setStyles({left : x, top : y});
    2363         },
    2364 
    2365         moveBy : function(x, y) {
    2366             var p = this.getXY();
    2367 
    2368             this.moveTo(p.x + x, p.y + y);
    2369         },
    2370 
    2371         resizeTo : function(w, h) {
    2372             this.setStyles({width : w, height : h});
    2373         },
    2374 
    2375         resizeBy : function(w, h) {
    2376             var s = this.getSize();
    2377 
    2378             this.resizeTo(s.w + w, s.h + h);
    2379         },
    2380 
    2381         update : function(k) {
    2382             var t = this, b, dom = t.dom;
    2383 
    2384             if (tinymce.isIE6 && t.settings.blocker) {
    2385                 k = k || '';
    2386 
    2387                 // Ignore getters
    2388                 if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
    2389                     return;
    2390 
    2391                 // Remove blocker on remove
    2392                 if (k == 'remove') {
    2393                     dom.remove(t.blocker);
    2394                     return;
    2395                 }
    2396 
    2397                 if (!t.blocker) {
    2398                     t.blocker = dom.uniqueId();
    2399                     b = dom.add(t.settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});
    2400                     dom.setStyle(b, 'opacity', 0);
    2401                 } else
    2402                     b = dom.get(t.blocker);
    2403 
    2404                 dom.setStyle(b, 'left', t.getStyle('left', 1));
    2405                 dom.setStyle(b, 'top', t.getStyle('top', 1));
    2406                 dom.setStyle(b, 'width', t.getStyle('width', 1));
    2407                 dom.setStyle(b, 'height', t.getStyle('height', 1));
    2408                 dom.setStyle(b, 'display', t.getStyle('display', 1));
    2409                 dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1);
    2410             }
    2411         }
    2412 
    2413         });
    2414 })();
    2415 
    2416 /* file:jscripts/tiny_mce/classes/dom/Selection.js */
    2417 
    2418 (function() {
    2419     // Shorten names
    2420     var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;
    2421 
    2422     tinymce.create('tinymce.dom.Selection', {
    2423         Selection : function(dom, win, serializer) {
    2424             var t = this;
    2425 
    2426             t.dom = dom;
    2427             t.win = win;
    2428             t.serializer = serializer;
    2429 
    2430             // Prevent leaks
    2431             tinymce.addUnload(function() {
    2432                 t.win = null;
    2433             });
    2434         },
    2435 
    2436         getContent : function(s) {
    2437             var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;
    2438 
    2439             s = s || {};
    2440             wb = wa = '';
    2441             s.get = true;
    2442             s.format = s.format || 'html';
    2443 
    2444             if (s.format == 'text')
    2445                 return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));
    2446 
    2447             if (r.cloneContents) {
    2448                 n = r.cloneContents();
    2449 
    2450                 if (n)
    2451                     e.appendChild(n);
    2452             } else if (is(r.item) || is(r.htmlText))
    2453                 e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
    2454             else
    2455                 e.innerHTML = r.toString();
    2456 
    2457             // Keep whitespace before and after
    2458             if (/^\s/.test(e.innerHTML))
    2459                 wb = ' ';
    2460 
    2461             if (/\s+$/.test(e.innerHTML))
    2462                 wa = ' ';
    2463 
    2464             return t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
    2465         },
    2466 
    2467         setContent : function(h, s) {
    2468             var t = this, r = t.getRng(), d;
    2469 
    2470             s = s || {format : 'html'};
    2471             s.set = true;
    2472             h = t.dom.processHTML(h);
    2473 
    2474             if (r.insertNode) {
    2475                 d = t.win.document;
    2476 
    2477                 // Use insert HTML if it exists (places cursor after content)
    2478                 if (d.queryCommandEnabled('InsertHTML'))
    2479                     return d.execCommand('InsertHTML', false, h);
    2480 
    2481                 r.deleteContents();
    2482                 r.insertNode(t.getRng().createContextualFragment(h));
    2483             } else {
    2484                 if (r.item)
    2485                     r.item(0).outerHTML = h;
    2486                 else
    2487                     r.pasteHTML(h);
    2488             }
    2489         },
    2490 
    2491         getStart : function() {
    2492             var t = this, r = t.getRng(), e;
    2493 
    2494             if (isIE) {
    2495                 if (r.item)
    2496                     return r.item(0);
    2497 
    2498                 r = r.duplicate();
    2499                 r.collapse(1);
    2500                 e = r.parentElement();
    2501 
    2502                 if (e.nodeName == 'BODY')
    2503                     return e.firstChild;
    2504 
    2505                 return e;
    2506             } else {
    2507                 e = r.startContainer;
    2508 
    2509                 if (e.nodeName == 'BODY')
    2510                     return e.firstChild;
    2511 
    2512                 return t.dom.getParent(e, function(n) {return n.nodeType == 1;});
    2513             }
    2514         },
    2515 
    2516         getEnd : function() {
    2517             var t = this, r = t.getRng(), e;
    2518 
    2519             if (isIE) {
    2520                 if (r.item)
    2521                     return r.item(0);
    2522 
    2523                 r = r.duplicate();
    2524                 r.collapse(0);
    2525                 e = r.parentElement();
    2526 
    2527                 if (e.nodeName == 'BODY')
    2528                     return e.lastChild;
    2529 
    2530                 return e;
    2531             } else {
    2532                 e = r.endContainer;
    2533 
    2534                 if (e.nodeName == 'BODY')
    2535                     return e.lastChild;
    2536 
    2537                 return t.dom.getParent(e, function(n) {return n.nodeType == 1;});
    2538             }
    2539         },
    2540 
    2541         getBookmark : function(si) {
    2542             var t = this, r = t.getRng(), tr, sx, sy, vp = t.dom.getViewPort(t.win), e, sp, bp, le, c = -0xFFFFFF, s, ro = t.dom.getRoot();
    2543 
    2544             sx = vp.x;
    2545             sy = vp.y;
    2546 
    2547             // Simple bookmark fast but not as persistent
    2548             if (si == 'simple')
    2549                 return {rng : r, scrollX : sx, scrollY : sy};
    2550 
    2551             // Handle IE
    2552             if (isIE) {
    2553                 // Control selection
    2554                 if (r.item) {
    2555                     e = r.item(0);
    2556 
    2557                     each(t.dom.select(e.nodeName), function(n, i) {
    2558                         if (e == n) {
    2559                             sp = i;
    2560                             return false;
    2561                         }
    2562                     });
    2563 
    2564                     return {
    2565                         tag : e.nodeName,
    2566                         index : sp,
    2567                         scrollX : sx,
    2568                         scrollY : sy
    2569                     };
    2570                 }
    2571 
    2572                 // Text selection
    2573                 tr = t.dom.doc.body.createTextRange();
    2574                 tr.moveToElementText(ro);
    2575                 tr.collapse(true);
    2576                 bp = Math.abs(tr.move('character', c));
    2577 
    2578                 tr = r.duplicate();
    2579                 tr.collapse(true);
    2580                 sp = Math.abs(tr.move('character', c));
    2581 
    2582                 tr = r.duplicate();
    2583                 tr.collapse(false);
    2584                 le = Math.abs(tr.move('character', c)) - sp;
    2585 
    2586                 return {
    2587                     start : sp - bp,
    2588                     length : le,
    2589                     scrollX : sx,
    2590                     scrollY : sy
    2591                 };
    2592             }
    2593 
    2594             // Handle W3C
    2595             e = t.getNode();
    2596             s = t.getSel();
    2597 
    2598             if (!s)
    2599                 return null;
    2600 
    2601             // Image selection
    2602             if (e && e.nodeName == 'IMG') {
    2603                 return {
    2604                     scrollX : sx,
    2605                     scrollY : sy
    2606                 };
    2607             }
    2608 
    2609             // Text selection
    2610 
    2611             function getPos(r, sn, en) {
    2612                 var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
    2613 
    2614                 while ((n = w.nextNode()) != null) {
    2615                     if (n == sn)
    2616                         d.start = p;
    2617 
    2618                     if (n == en) {
    2619                         d.end = p;
    2620                         return d;
    2621                     }
    2622 
    2623                     p += n.nodeValue ? n.nodeValue.length : 0;
    2624                 }
    2625 
    2626                 return null;
    2627             };
    2628 
    2629             // Caret or selection
    2630             if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
    2631                 e = getPos(ro, s.anchorNode, s.focusNode);
    2632 
    2633                 if (!e)
    2634                     return {scrollX : sx, scrollY : sy};
    2635 
    2636                 return {
    2637                     start : e.start + s.anchorOffset,
    2638                     end : e.end + s.focusOffset,
    2639                     scrollX : sx,
    2640                     scrollY : sy
    2641                 };
    2642             } else {
    2643                 e = getPos(ro, r.startContainer, r.endContainer);
    2644 
    2645                 if (!e)
    2646                     return {scrollX : sx, scrollY : sy};
    2647 
    2648                 return {
    2649                     start : e.start + r.startOffset,
    2650                     end : e.end + r.endOffset,
    2651                     scrollX : sx,
    2652                     scrollY : sy
    2653                 };
    2654             }
    2655         },
    2656 
    2657         moveToBookmark : function(b) {
    2658             var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd;
    2659 
    2660             function getPos(r, sp, ep) {
    2661                 var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
    2662 
    2663                 while ((n = w.nextNode()) != null) {
    2664                     p += n.nodeValue ? n.nodeValue.length : 0;
    2665 
    2666                     if (p >= sp && !d.startNode) {
    2667                         d.startNode = n;
    2668                         d.startOffset = sp - (p - n.nodeValue.length);
    2669                     }
    2670 
    2671                     if (p >= ep) {
    2672                         d.endNode = n;
    2673                         d.endOffset = ep - (p - n.nodeValue.length);
    2674 
    2675                         return d;
    2676                     }
    2677                 }
    2678 
    2679                 return null;
    2680             };
    2681 
    2682             if (!b)
    2683                 return false;
    2684 
    2685             t.win.scrollTo(b.scrollX, b.scrollY);
    2686 
    2687             // Handle explorer
    2688             if (isIE) {
    2689                 // Handle simple
    2690                 if (r = b.rng) {
    2691                     try {
    2692                         r.select();
    2693                     } catch (ex) {
    2694                         // Ignore
    2695                     }
    2696 
    2697                     return true;
    2698                 }
    2699 
    2700                 t.win.focus();
    2701 
    2702                 // Handle control bookmark
    2703                 if (b.tag) {
    2704                     r = ro.createControlRange();
    2705 
    2706                     each(t.dom.select(b.tag), function(n, i) {
    2707                         if (i == b.index)
    2708                             r.addElement(n);
    2709                     });
    2710                 } else {
    2711                     // Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
    2712                     try {
    2713                         // Incorrect bookmark
    2714                         if (b.start < 0)
    2715                             return true;
    2716 
    2717                         r = s.createRange();
    2718                         r.moveToElementText(ro);
    2719                         r.collapse(true);
    2720                         r.moveStart('character', b.start);
    2721                         r.moveEnd('character', b.length);
    2722                     } catch (ex2) {
    2723                         return true;
    2724                     }
    2725                 }
    2726 
    2727                 r.select();
    2728 
    2729                 return true;
    2730             }
    2731 
    2732             // Handle W3C
    2733             if (!s)
    2734                 return false;
    2735 
    2736             // Handle simple
    2737             if (b.rng) {
    2738                 s.removeAllRanges();
    2739                 s.addRange(b.rng);
    2740             } else {
    2741                 if (is(b.start) && is(b.end)) {
    2742                     try {
    2743                         sd = getPos(ro, b.start, b.end);
    2744                         if (sd) {
    2745                             r = t.dom.doc.createRange();
    2746                             r.setStart(sd.startNode, sd.startOffset);
    2747                             r.setEnd(sd.endNode, sd.endOffset);
    2748                             s.removeAllRanges();
    2749                             s.addRange(r);
    2750                         }
    2751 
    2752                         if (!tinymce.isOpera)
    2753                             t.win.focus();
    2754                     } catch (ex) {
    2755                         // Ignore
    2756                     }
    2757                 }
    2758             }
    2759         },
    2760 
    2761         select : function(n, c) {
    2762             var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document;
    2763 
    2764             function first(n) {
    2765                 return n ? d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() : null;
    2766             };
    2767 
    2768             function last(n) {
    2769                 var c, o, w;
    2770 
    2771                 if (!n)
    2772                     return null;
    2773 
    2774                 w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
    2775                 while (c = w.nextNode())
    2776                     o = c;
    2777 
    2778                 return o;
    2779             };
    2780 
    2781             if (isIE) {
    2782                 try {
    2783                     b = d.body;
    2784 
    2785                     if (/^(IMG|TABLE)$/.test(n.nodeName)) {
    2786                         r = b.createControlRange();
    2787                         r.addElement(n);
    2788                     } else {
    2789                         r = b.createTextRange();
    2790                         r.moveToElementText(n);
    2791                     }
    2792 
    2793                     r.select();
    2794                 } catch (ex) {
    2795                     // Throws illigal agrument in IE some times
    2796                 }
    2797             } else {
    2798                 if (c) {
    2799                     fn = first(n);
    2800                     ln = last(n);
    2801 
    2802                     if (fn && ln) {
    2803                         //console.debug(fn, ln);
    2804                         r = d.createRange();
    2805                         r.setStart(fn, 0);
    2806                         r.setEnd(ln, ln.nodeValue.length);
    2807                     } else
    2808                         r.selectNode(n);
    2809                 } else
    2810                     r.selectNode(n);
    2811 
    2812                 t.setRng(r);
    2813             }
    2814 
    2815             return n;
    2816         },
    2817 
    2818         isCollapsed : function() {
    2819             var t = this, r = t.getRng(), s = t.getSel();
    2820 
    2821             if (!r || r.item)
    2822                 return false;
    2823 
    2824             return !s || r.boundingWidth == 0 || s.isCollapsed;
    2825         },
    2826 
    2827         collapse : function(b) {
    2828             var t = this, r = t.getRng(), n;
    2829 
    2830             // Control range on IE
    2831             if (r.item) {
    2832                 n = r.item(0);
    2833                 r = this.win.document.body.createTextRange();
    2834                 r.moveToElementText(n);
    2835             }
    2836 
    2837             r.collapse(!!b);
    2838             t.setRng(r);
    2839         },
    2840 
    2841         getSel : function() {
    2842             var t = this, w = this.win;
    2843 
    2844             return w.getSelection ? w.getSelection() : w.document.selection;
    2845         },
    2846 
    2847         getRng : function() {
    2848             var t = this, s = t.getSel(), r;
    2849 
    2850             try {
    2851                 if (s)
    2852                     r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange());
    2853             } catch (ex) {
    2854                 // IE throws unspecified error here if TinyMCE is placed in a frame/iframe
    2855             }
    2856 
    2857             // No range found then create an empty one
    2858             // This can occur when the editor is placed in a hidden container element on Gecko
    2859             // Or on IE when there was an exception
    2860             if (!r)
    2861                 r = isIE ? t.win.document.body.createTextRange() : t.win.document.createRange();
    2862 
    2863             return r;
    2864         },
    2865 
    2866         setRng : function(r) {
    2867             var s;
    2868 
    2869             if (!isIE) {
    2870                 s = this.getSel();
    2871 
    2872                 if (s) {
    2873                     s.removeAllRanges();
    2874                     s.addRange(r);
    2875                 }
    2876             } else
    2877                 r.select();
    2878         },
    2879 
    2880         setNode : function(n) {
    2881             var t = this;
    2882 
    2883             t.setContent(t.dom.getOuterHTML(n));
    2884 
    2885             return n;
    2886         },
    2887 
    2888         getNode : function() {
    2889             var t = this, r = t.getRng(), s = t.getSel(), e;
    2890 
    2891             if (!isIE) {
    2892                 // Range maybe lost after the editor is made visible again
    2893                 if (!r)
    2894                     return t.dom.getRoot();
    2895 
    2896                 e = r.commonAncestorContainer;
    2897 
    2898                 // Handle selection a image or other control like element such as anchors
    2899                 if (!r.collapsed) {
    2900                     if (r.startContainer == r.endContainer || (tinymce.isWebKit && r.startContainer == r.endContainer.parentNode)) {
    2901                         if (r.startOffset - r.endOffset < 2 || tinymce.isWebKit) {
    2902                             if (r.startContainer.hasChildNodes())
    2903                                 e = r.startContainer.childNodes[r.startOffset];
    2904                         }
    2905                     }
    2906                 }
    2907 
    2908                 return t.dom.getParent(e, function(n) {
    2909                     return n.nodeType == 1;
    2910                 });
    2911             }
    2912 
    2913             return r.item ? r.item(0) : r.parentElement();
    2914         }
    2915 
    2916         });
    2917 })();
    2918 
    2919 /* file:jscripts/tiny_mce/classes/dom/XMLWriter.js */
    2920 
    2921 (function() {
    2922     tinymce.create('tinymce.dom.XMLWriter', {
    2923         node : null,
    2924 
    2925         XMLWriter : function(s) {
    2926             // Get XML document
    2927             function getXML() {
    2928                 var i = document.implementation;
    2929 
    2930                 if (!i || !i.createDocument) {
    2931                     // Try IE objects
    2932                     try {return new ActiveXObject('MSXML2.DOMDocument');} catch (ex) {}
    2933                     try {return new ActiveXObject('Microsoft.XmlDom');} catch (ex) {}
    2934                 } else
    2935                     return i.createDocument('', '', null);
    2936             };
    2937 
    2938             this.doc = getXML();
    2939             this.reset();
    2940         },
    2941 
    2942         reset : function() {
    2943             var t = this, d = t.doc;
    2944 
    2945             if (d.firstChild)
    2946                 d.removeChild(d.firstChild);
    2947 
    2948             t.node = d.appendChild(d.createElement("html"));
    2949         },
    2950 
    2951         writeStartElement : function(n) {
    2952             var t = this;
    2953 
    2954             t.node = t.node.appendChild(t.doc.createElement(n));
    2955         },
    2956 
    2957         writeAttribute : function(n, v) {
    2958             // Since Opera doesn't escape > into &gt; we need to do it our self
    2959             if (tinymce.isOpera)
    2960                 v = v.replace(/>/g, '|>');
    2961 
    2962             this.node.setAttribute(n, v);
    2963         },
    2964 
    2965         writeEndElement : function() {
    2966             this.node = this.node.parentNode;
    2967         },
    2968 
    2969         writeFullEndElement : function() {
    2970             var t = this, n = t.node;
    2971 
    2972             n.appendChild(t.doc.createTextNode(""));
    2973             t.node = n.parentNode;
    2974         },
    2975 
    2976         writeText : function(v) {
    2977             // Since Opera doesn't escape > into &gt; we need to do it our self
    2978             if (tinymce.isOpera)
    2979                 v = v.replace(/>/g, '|>');
    2980 
    2981             this.node.appendChild(this.doc.createTextNode(v));
    2982         },
    2983 
    2984         writeCDATA : function(v) {
    2985             this.node.appendChild(this.doc.createCDATA(v));
    2986         },
    2987 
    2988         writeComment : function(v) {
    2989             this.node.appendChild(this.doc.createComment(v));
    2990         },
    2991 
    2992         getContent : function() {
    2993             var h;
    2994 
    2995             h = this.doc.xml || new XMLSerializer().serializeToString(this.doc);
    2996             h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, '');
    2997             h = h.replace(/ ?\/>/g, ' />');
    2998 
    2999             // Since Opera doesn't escape > into &gt; we need to do it our self to normalize the output for all browsers
    3000             if (tinymce.isOpera)
    3001                 h = h.replace(/\|>/g, '&gt;');
    3002 
    3003             return h;
    3004         }
    3005 
    3006         });
    3007 })();
    3008 
    3009 /* file:jscripts/tiny_mce/classes/dom/Serializer.js */
    3010 
    3011 (function() {
    3012     // Shorten names
    3013     var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE;
    3014 
    3015     // Returns only attribites that have values not all attributes in IE
    3016     function getIEAtts(n) {
    3017         var o = [];
    3018 
    3019         // Object will throw exception in IE
    3020         if (n.nodeName == 'OBJECT')
    3021             return n.attributes;
    3022 
    3023         n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {
    3024             o.push({specified : 1, nodeName : b});
    3025         });
    3026 
    3027         return o;
    3028     };
    3029 
    3030     function wildcardToRE(s) {
    3031         return s.replace(/([?+*])/g, '.$1');
    3032     };
    3033 
    3034     tinymce.create('tinymce.dom.Serializer', {
    3035         Serializer : function(s) {
    3036             var t = this;
    3037 
    3038             t.key = 0;
    3039             t.onPreProcess = new Dispatcher(t);
    3040             t.onPostProcess = new Dispatcher(t);
    3041             t.writer = new tinymce.dom.XMLWriter();
    3042 
    3043             // Default settings
    3044             t.settings = s = extend({
    3045                 dom : tinymce.DOM,
    3046                 valid_nodes : 0,
    3047                 node_filter : 0,
    3048                 attr_filter : 0,
    3049                 invalid_attrs : /^(mce_|_moz_$)/,
    3050                 closed : /(br|hr|input|meta|img|link|param)/,
    3051                 entity_encoding : 'named',
    3052                 entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',
    3053                 valid_elements : '*[*]',
    3054                 extended_valid_elements : 0,
    3055                 valid_child_elements : 0,
    3056                 invalid_elements : 0,
    3057                 fix_table_elements : 0,
    3058                 fix_list_elements : true,
    3059                 fix_content_duplication : true,
    3060                 convert_fonts_to_spans : false,
    3061                 font_size_classes : 0,
    3062                 font_size_style_values : 0,
    3063                 apply_source_formatting : 0,
    3064                 indent_mode : 'simple',
    3065                 indent_char : '\t',
    3066                 indent_levels : 1,
    3067                 remove_linebreaks : 1
    3068             }, s);
    3069 
    3070             t.dom = s.dom;
    3071 
    3072             if (s.fix_list_elements) {
    3073                 t.onPreProcess.add(function(se, o) {
    3074                     var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
    3075 
    3076                     function prevNode(e, n) {
    3077                         var a = n.split(','), i;
    3078 
    3079                         while ((e = e.previousSibling) != null) {
    3080                             for (i=0; i<a.length; i++) {
    3081                                 if (e.nodeName == a[i])
    3082                                     return e;
    3083                             }
    3084                         }
    3085 
    3086                         return null;
    3087                     };
    3088 
    3089                     for (x=0; x<a.length; x++) {
    3090                         nl = t.dom.select(a[x], o.node);
    3091 
    3092                         for (i=0; i<nl.length; i++) {
    3093                             n = nl[i];
    3094                             p = n.parentNode;
    3095 
    3096                             if (r.test(p.nodeName)) {
    3097                                 np = prevNode(n, 'LI');
    3098 
    3099                                 if (!np) {
    3100                                     np = t.dom.create('li');
    3101                                     np.innerHTML = '&nbsp;';
    3102                                     np.appendChild(n);
    3103                                     p.insertBefore(np, p.firstChild);
    3104                                 } else
    3105                                     np.appendChild(n);
    3106                             }
    3107                         }
    3108                     }
    3109                 });
    3110             }
    3111 
    3112             if (s.fix_table_elements) {
    3113                 t.onPreProcess.add(function(se, o) {
    3114                     var ta = [], d = t.dom.doc;
    3115 
    3116                     // Build list of HTML chunks and replace tables with comment placeholders
    3117                     each(t.dom.select('table', o.node), function(e) {
    3118                         var pa = t.dom.getParent(e, 'H1,H2,H3,H4,H5,H6,P'), p = [], i, h;
    3119 
    3120                         if (pa) {
    3121                             t.dom.getParent(e, function(n) {
    3122                                 if (n != e)
    3123                                     p.push(n.nodeName);
    3124                             });
    3125 
    3126                             h = '';
    3127 
    3128                             for (i = 0; i < p.length; i++)
    3129                                 h += '</' + p[i]+ '>';
    3130 
    3131                             h += t.dom.getOuterHTML(e);
    3132 
    3133                             for (i = p.length - 1; i >= 0; i--)
    3134                                 h += '<' + p[i]+ '>';
    3135 
    3136                             ta.push(h);
    3137                             e.parentNode.replaceChild(d.createComment('mcetable:' + (ta.length - 1)), e);
    3138                         }
    3139                     });
    3140 
    3141                     // Replace table placeholders with end parents + table + start parents HTML code
    3142                     t.dom.setHTML(o.node, o.node.innerHTML.replace(/<!--mcetable:([0-9]+)-->/g, function(a, b) {
    3143                         return ta[parseInt(b)];
    3144                     }));
    3145                 });
    3146             }
    3147         },
    3148 
    3149         setEntities : function(s) {
    3150             var a, i, l = {}, re = '', v;
    3151 
    3152             // No need to setup more than once
    3153             if (this.entityLookup)
    3154                 return;
    3155 
    3156             // Build regex and lookup array
    3157             a = s.split(',');
    3158             for (i = 0; i < a.length; i += 2) {
    3159                 v = a[i];
    3160 
    3161                 // Don't add default &amp; &quot; etc.
    3162                 if (v == 34 || v == 38 || v == 60 || v == 62)
    3163                     continue;
    3164 
    3165                 l[String.fromCharCode(a[i])] = a[i + 1];
    3166 
    3167                 v = parseInt(a[i]).toString(16);
    3168                 re += '\\u' + '0000'.substring(v.length) + v;
    3169             }
    3170 
    3171             this.entitiesRE = new RegExp('[' + re + ']', 'g');
    3172             this.entityLookup = l;
    3173         },
    3174 
    3175         setValidChildRules : function(s) {
    3176             this.childRules = null;
    3177             this.addValidChildRules(s);
    3178         },
    3179 
    3180         addValidChildRules : function(s) {
    3181             var t = this, inst, intr, bloc;
    3182 
    3183             if (!s)
    3184                 return;
    3185 
    3186             inst = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
    3187             intr = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
    3188             bloc = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
    3189 
    3190             each(s.split(','), function(s) {
    3191                 var p = s.split(/\[|\]/), re;
    3192 
    3193                 s = '';
    3194                 each(p[1].split('|'), function(v) {
    3195                     if (s)
    3196                         s += '|';
    3197 
    3198                     switch (v) {
    3199                         case '%itrans':
    3200                             v = intr;
    3201                             break;
    3202 
    3203                         case '%itrans_na':
    3204                             v = intr.substring(2);
    3205                             break;
    3206 
    3207                         case '%istrict':
    3208                             v = inst;
    3209                             break;
    3210 
    3211                         case '%istrict_na':
    3212                             v = inst.substring(2);
    3213                             break;
    3214 
    3215                         case '%btrans':
    3216                             v = bloc;
    3217                             break;
    3218 
    3219                         case '%bstrict':
    3220                             v = bloc;
    3221                             break;
    3222                     }
    3223 
    3224                     s += v;
    3225                 });
    3226                 re = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
    3227 
    3228                 each(p[0].split('/'), function(s) {
    3229                     t.childRules = t.childRules || {};
    3230                     t.childRules[s] = re;
    3231                 });
    3232             });
    3233 
    3234             // Build regex
    3235             s = '';
    3236             each(t.childRules, function(v, k) {
    3237                 if (s)
    3238                     s += '|';
    3239 
    3240                 s += k;
    3241             });
    3242 
    3243             t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
    3244 
    3245             /*console.debug(t.parentElementsRE.toString());
    3246             each(t.childRules, function(v) {
    3247                 console.debug(v.toString());
    3248             });*/
    3249         },
    3250 
    3251         setRules : function(s) {
    3252             var t = this;
    3253 
    3254             t._setup();
    3255             t.rules = {};
    3256             t.wildRules = [];
    3257             t.validElements = {};
    3258 
    3259             return t.addRules(s);
    3260         },
    3261 
    3262         addRules : function(s) {
    3263             var t = this, dr;
    3264 
    3265             if (!s)
    3266                 return;
    3267 
    3268             t._setup();
    3269 
    3270             each(s.split(','), function(s) {
    3271                 var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];
    3272 
    3273                 // Extend with default rules
    3274                 if (dr)
    3275                     at = tinymce.extend([], dr.attribs);
    3276 
    3277                 // Parse attributes
    3278                 if (p.length > 1) {
    3279                     each(p[1].split('|'), function(s) {
    3280                         var ar = {}, i;
    3281 
    3282                         at = at || [];
    3283 
    3284                         // Parse attribute rule
    3285                         s = s.replace(/::/g, '~');
    3286                         s = /^([!\-])?([\w*.?~]+|)([=:<])?(.+)?$/.exec(s);
    3287                         s[2] = s[2].replace(/~/g, ':');
    3288 
    3289                         // Add required attributes
    3290                         if (s[1] == '!') {
    3291                             ra = ra || [];
    3292                             ra.push(s[2]);
    3293                         }
    3294 
    3295                         // Remove inherited attributes
    3296                         if (s[1] == '-') {
    3297                             for (i = 0; i <at.length; i++) {
    3298                                 if (at[i].name == s[2]) {
    3299                                     at.splice(i, 1);
    3300                                     return;
    3301                                 }
    3302                             }
    3303                         }
    3304 
    3305                         switch (s[3]) {
    3306                             // Add default attrib values
    3307                             case '=':
    3308                                 ar.defaultVal = s[4] || '';
    3309                                 break;
    3310 
    3311                             // Add forced attrib values
    3312                             case ':':
    3313                                 ar.forcedVal = s[4];
    3314                                 break;
    3315 
    3316                             // Add validation values
    3317                             case '<':
    3318                                 ar.validVals = s[4].split('?');
    3319                                 break;
    3320                         }
    3321 
    3322                         if (/[*.?]/.test(s[2])) {
    3323                             wat = wat || [];
    3324                             ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$');
    3325                             wat.push(ar);
    3326                         } else {
    3327                             ar.name = s[2];
    3328                             at.push(ar);
    3329                         }
    3330 
    3331                         va.push(s[2]);
    3332                     });
    3333                 }
    3334 
    3335                 // Handle element names
    3336                 each(tn, function(s, i) {
    3337                     var pr = s.charAt(0), x = 1, ru = {};
    3338 
    3339                     // Extend with default rule data
    3340                     if (dr) {
    3341                         if (dr.noEmpty)
    3342                             ru.noEmpty = dr.noEmpty;
    3343 
    3344                         if (dr.fullEnd)
    3345                             ru.fullEnd = dr.fullEnd;
    3346 
    3347                         if (dr.padd)
    3348                             ru.padd = dr.padd;
    3349                     }
    3350 
    3351                     // Handle prefixes
    3352                     switch (pr) {
    3353                         case '-':
    3354                             ru.noEmpty = true;
    3355                             break;
    3356 
    3357                         case '+':
    3358                             ru.fullEnd = true;
    3359                             break;
    3360 
    3361                         case '#':
    3362                             ru.padd = true;
    3363                             break;
    3364 
    3365                         default:
    3366                             x = 0;
    3367                     }
    3368 
    3369                     tn[i] = s = s.substring(x);
    3370                     t.validElements[s] = 1;
    3371 
    3372                     // Add element name or element regex
    3373                     if (/[*.?]/.test(tn[0])) {
    3374                         ru.nameRE = new RegExp('^' + wildcardToRE(tn[0]) + '$');
    3375                         t.wildRules = t.wildRules || {};
    3376                         t.wildRules.push(ru);
    3377                     } else {
    3378                         ru.name = tn[0];
    3379 
    3380                         // Store away default rule
    3381                         if (tn[0] == '@')
    3382                             dr = ru;
    3383 
    3384                         t.rules[s] = ru;
    3385                     }
    3386 
    3387                     ru.attribs = at;
    3388 
    3389                     if (ra)
    3390                         ru.requiredAttribs = ra;
    3391 
    3392                     if (wat) {
    3393                         // Build valid attributes regexp
    3394                         s = '';
    3395                         each(va, function(v) {
    3396                             if (s)
    3397                                 s += '|';
    3398 
    3399                             s += '(' + wildcardToRE(v) + ')';
    3400                         });
    3401                         ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$');
    3402                         ru.wildAttribs = wat;
    3403                     }
    3404                 });
    3405             });
    3406 
    3407             // Build valid elements regexp
    3408             s = '';
    3409             each(t.validElements, function(v, k) {
    3410                 if (s)
    3411                     s += '|';
    3412 
    3413                 if (k != '@')
    3414                 s += k;
    3415             });
    3416             t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$');
    3417 
    3418             //console.debug(t.validElementsRE.toString());
    3419             //console.dir(t.rules);
    3420             //console.dir(t.wildRules);
    3421         },
    3422 
    3423         findRule : function(n) {
    3424             var t = this, rl = t.rules, i, r;
    3425 
    3426             t._setup();
    3427 
    3428             // Exact match
    3429             r = rl[n];
    3430             if (r)
    3431                 return r;
    3432 
    3433             // Try wildcards
    3434             rl = t.wildRules;
    3435             for (i = 0; i < rl.length; i++) {
    3436                 if (rl[i].nameRE.test(n))
    3437                     return rl[i];
    3438             }
    3439 
    3440             return null;
    3441         },
    3442 
    3443         findAttribRule : function(ru, n) {
    3444             var i, wa = ru.wildAttribs;
    3445 
    3446             for (i = 0; i < wa.length; i++) {
    3447                 if (wa[i].nameRE.test(n))
    3448                     return wa[i];
    3449             }
    3450 
    3451             return null;
    3452         },
    3453 
    3454         serialize : function(n, o) {
    3455             var h, t = this;
    3456 
    3457             t._setup();
    3458             o = o || {};
    3459             o.format = o.format || 'html';
    3460             t.processObj = o;
    3461             n = n.cloneNode(true);
    3462             t.key = '' + (parseInt(t.key) + 1);
    3463 
    3464             // Pre process
    3465             if (!o.no_events) {
    3466                 o.node = n;
    3467                 t.onPreProcess.dispatch(t, o);
    3468             }
    3469 
    3470             // Serialize HTML DOM into a string
    3471             t.writer.reset();
    3472             t._serializeNode(n, o.getInner);
    3473 
    3474             // Post process
    3475             o.content = t.writer.getContent();
    3476 
    3477             if (!o.no_events)
    3478                 t.onPostProcess.dispatch(t, o);
    3479 
    3480             t._postProcess(o);
    3481             o.node = null;
    3482 
    3483             return tinymce.trim(o.content);
    3484         },
    3485 
    3486         // Internal functions
    3487 
    3488         _postProcess : function(o) {
    3489             var t = this, s = t.settings, h = o.content, sc = [], p, l;
    3490 
    3491             if (o.format == 'html') {
    3492                 // Protect some elements
    3493                 p = t._protect({
    3494                     content : h,
    3495                     patterns : [
    3496                         /(<script[^>]*>)(.*?)(<\/script>)/g,
    3497                         /(<style[^>]*>)(.*?)(<\/style>)/g,
    3498                         /(<pre[^>]*>)(.*?)(<\/pre>)/g
    3499                     ]
    3500                 });
    3501 
    3502                 h = p.content;
    3503 
    3504                 // Entity encode
    3505                 if (s.entity_encoding !== 'raw') {
    3506                     if (s.entity_encoding.indexOf('named') != -1) {
    3507                         t.setEntities(s.entities);
    3508                         l = t.entityLookup;
    3509 
    3510                         h = h.replace(t.entitiesRE, function(a) {
    3511                             var v;
    3512 
    3513                             if (v = l[a])
    3514                                 a = '&' + v + ';';
    3515 
    3516                             return a;
    3517                         });
    3518                     }
    3519 
    3520                     if (s.entity_encoding.indexOf('numeric') != -1) {
    3521                         h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
    3522                             return '&#' + a.charCodeAt(0) + ';';
    3523                         });
    3524                     }
    3525                 }
    3526 
    3527                 // Use BR instead of &nbsp; padded P elements inside editor and use <p>&nbsp;</p> outside editor
    3528                 if (o.set)
    3529                     h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>');
    3530                 else
    3531                     h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');
    3532 
    3533                 // Since Gecko and Safari keeps whitespace in the DOM we need to
    3534                 // remove it inorder to match other browsers. But I think Gecko and Safari is right.
    3535                 // This process is only done when getting contents out from the editor.
    3536                 if (!o.set) {
    3537                     if (s.remove_linebreaks) {
    3538                         h = h.replace(/(<[^>]+>)\s+/g, '$1 ');
    3539                         h = h.replace(/\s+(<\/[^>]+>)/g, ' $1');
    3540                         h = h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start
    3541                         h = h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start
    3542                         h = h.replace(/\s+<\/(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '</$1>'); // Trim block end
    3543                     }
    3544 
    3545                     // Simple indentation
    3546                     if (s.apply_source_formatting && s.indent_mode == 'simple') {
    3547                         // Add line breaks before and after block elements
    3548                         h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html)(|[^>]+)>\s*/g, '\n<$1$2$3>\n');
    3549                         h = h.replace(/\s*<(p|h[1-6]|div|title|style|pre|script|td|li)(|[^>]+)>/g, '\n<$1$2>');
    3550                         h = h.replace(/<\/(p|h[1-6]|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n');
    3551                         h = h.replace(/\n\n/g, '\n');
    3552                     }
    3553                 }
    3554 
    3555                 h = t._unprotect(h, p);
    3556             }
    3557 
    3558             o.content = h;
    3559         },
    3560 
    3561         _serializeNode : function(n, inn) {
    3562             var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv;
    3563 
    3564             if (!s.node_filter || s.node_filter(n)) {
    3565                 switch (n.nodeType) {
    3566                     case 1: // Element
    3567                         if (n.hasAttribute ? n.hasAttribute('mce_bogus') : n.getAttribute('mce_bogus'))
    3568                             return;
    3569 
    3570                         iv = false;
    3571                         hc = n.hasChildNodes();
    3572                         nn = n.getAttribute('mce_name') || n.nodeName.toLowerCase();
    3573 
    3574                         // Add correct prefix on IE
    3575                         if (isIE) {
    3576                             if (n.scopeName !== 'HTML' && n.scopeName !== 'html')
    3577                                 nn = n.scopeName + ':' + nn;
    3578                         }
    3579 
    3580                         // Remove mce prefix on IE needed for the abbr element
    3581                         if (nn.indexOf('mce:') === 0)
    3582                             nn = nn.substring(4);
    3583 
    3584                         // Check if valid
    3585                         if (!t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inn) {
    3586                             iv = true;
    3587                             break;
    3588                         }
    3589 
    3590                         if (isIE) {
    3591                             // Fix IE content duplication (DOM can have multiple copies of the same node)
    3592                             if (s.fix_content_duplication) {
    3593                                 if (n.mce_serialized == t.key)
    3594                                     return;
    3595 
    3596                                 n.mce_serialized = t.key;
    3597                             }
    3598 
    3599                             // IE sometimes adds a / infront of the node name
    3600                             if (nn.charAt(0) == '/')
    3601                                 nn = nn.substring(1);
    3602                         }
    3603 
    3604                         // Check if valid child
    3605                         if (t.childRules) {
    3606                             if (t.parentElementsRE.test(t.elementName)) {
    3607                                 if (!t.childRules[t.elementName].test(nn)) {
    3608                                     iv = true;
    3609                                     break;
    3610                                 }
    3611                             }
    3612 
    3613                             t.elementName = nn;
    3614                         }
    3615 
    3616                         ru = t.findRule(nn);
    3617                         nn = ru.name || nn;
    3618 
    3619                         // Skip empty nodes or empty node name in IE
    3620                         if ((!hc && ru.noEmpty) || (isIE && !nn)) {
    3621                             iv = true;
    3622                             break;
    3623                         }
    3624 
    3625                         // Check required
    3626                         if (ru.requiredAttribs) {
    3627                             a = ru.requiredAttribs;
    3628 
    3629                             for (i = a.length - 1; i >= 0; i--) {
    3630                                 if (this.dom.getAttrib(n, a[i]) !== '')
    3631                                     break;
    3632                             }
    3633 
    3634                             // None of the required was there
    3635                             if (i == -1) {
    3636                                 iv = true;
    3637                                 break;
    3638                             }
    3639                         }
    3640 
    3641                         w.writeStartElement(nn);
    3642 
    3643                         // Add ordered attributes
    3644                         if (ru.attribs) {
    3645                             for (i=0, at = ru.attribs, l = at.length; i<l; i++) {
    3646                                 a = at[i];
    3647                                 v = t._getAttrib(n, a);
    3648 
    3649                                 if (v !== null)
    3650                                     w.writeAttribute(a.name, v);
    3651                             }
    3652                         }
    3653 
    3654                         // Add wild attributes
    3655                         if (ru.validAttribsRE) {
    3656                             at = isIE ? getIEAtts(n) : n.attributes;
    3657                             for (i=at.length-1; i>-1; i--) {
    3658                                 no = at[i];
    3659 
    3660                                 if (no.specified) {
    3661                                     a = no.nodeName.toLowerCase();
    3662 
    3663                                     if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))
    3664                                         continue;
    3665 
    3666                                     ar = t.findAttribRule(ru, a);
    3667                                     v = t._getAttrib(n, ar, a);
    3668 
    3669                                     if (v !== null)
    3670                                         w.writeAttribute(a, v);
    3671                                 }
    3672                             }
    3673                         }
    3674 
    3675                         // Padd empty nodes with a &nbsp;
    3676                         if (!hc && ru.padd)
    3677                             w.writeText('\u00a0');
    3678 
    3679                         break;
    3680 
    3681                     case 3: // Text
    3682                         // Check if valid child
    3683                         if (t.childRules && t.parentElementsRE.test(t.elementName)) {
    3684                             if (!t.childRules[t.elementName].test(n.nodeName))
    3685                                 return;
    3686                         }
    3687 
    3688                         return w.writeText(n.nodeValue);
    3689 
    3690                     case 4: // CDATA
    3691                         return w.writeCDATA(n.nodeValue);
    3692 
    3693                     case 8: // Comment
    3694                         return w.writeComment(n.nodeValue);
    3695                 }
    3696             } else if (n.nodeType == 1)
    3697                 hc = n.hasChildNodes();
    3698 
    3699             if (hc) {
    3700                 cn = n.firstChild;
    3701 
    3702                 while (cn) {
    3703                     t._serializeNode(cn);
    3704                     t.elementName = nn;
    3705                     cn = cn.nextSibling;
    3706                 }
    3707             }
    3708 
    3709             // Write element end
    3710             if (!iv) {
    3711                 if (hc || !s.closed.test(nn))
    3712                     w.writeFullEndElement();
    3713                 else
    3714                     w.writeEndElement();
    3715             }
    3716         },
    3717 
    3718         _protect : function(o) {
    3719             o.items = o.items || [];
    3720 
    3721             function enc(s) {
    3722                 return s.replace(/[\r\n]/g, function(c) {
    3723                     if (c === '\n')
    3724                         return '\\n';
    3725 
    3726                     return '\\r';
    3727                 });
    3728             };
    3729 
    3730             function dec(s) {
    3731                 return s.replace(/\\[rn]/g, function(c) {
    3732                     if (c === '\\n')
    3733                         return '\n';
    3734 
    3735                     return '\r';
    3736                 });
    3737             };
    3738 
    3739             each(o.patterns, function(p) {
    3740                 o.content = dec(enc(o.content).replace(p, function(x, a, b, c) {
    3741                     o.items.push(dec(b));
    3742                     return a + '<!--mce:' + (o.items.length - 1) + '-->' + c;
    3743                 }));
    3744             });
    3745 
    3746             return o;
    3747         },
    3748 
    3749         _unprotect : function(h, o) {
    3750             h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {
    3751                 return o.items[parseInt(b)];
    3752             });
    3753 
    3754             o.items = [];
    3755 
    3756             return h;
    3757         },
    3758 
    3759         _setup : function() {
    3760             var t = this, s = this.settings;
    3761 
    3762             if (t.done)
    3763                 return;
    3764 
    3765             t.done = 1;
    3766 
    3767             t.setRules(s.valid_elements);
    3768             t.addRules(s.extended_valid_elements);
    3769             t.addValidChildRules(s.valid_child_elements);
    3770 
    3771             if (s.invalid_elements)
    3772                 t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(',', '|').toLowerCase()) + ')$');
    3773 
    3774             if (s.attrib_value_filter)
    3775                 t.attribValueFilter = s.attribValueFilter;
    3776         },
    3777 
    3778         _getAttrib : function(n, a, na) {
    3779             var i, v;
    3780 
    3781             na = na || a.name;
    3782 
    3783             if (a.forcedVal && (v = a.forcedVal)) {
    3784                 if (v === '{$uid}')
    3785                     return this.dom.uniqueId();
    3786 
    3787                 return v;
    3788             }
    3789 
    3790             v = this.dom.getAttrib(n, na);
    3791 
    3792             switch (na) {
    3793                 case 'rowspan':
    3794                 case 'colspan':
    3795                     // Whats the point? Remove usless attribute value
    3796                     if (v == '1')
    3797                         v = '';
    3798 
    3799                     break;
    3800             }
    3801 
    3802             if (this.attribValueFilter)
    3803                 v = this.attribValueFilter(na, v, n);
    3804 
    3805             if (a.validVals) {
    3806                 for (i = a.validVals.length - 1; i >= 0; i--) {
    3807                     if (v == a.validVals[i])
    3808                         break;
    3809                 }
    3810 
    3811                 if (i == -1)
    3812                     return null;
    3813             }
    3814 
    3815             if (v === '' && typeof(a.defaultVal) != 'undefined') {
    3816                 v = a.defaultVal;
    3817 
    3818                 if (v === '{$uid}')
    3819                     return this.dom.uniqueId();
    3820 
    3821                 return v;
    3822             } else {
    3823                 // Remove internal mceItemXX classes when content is extracted from editor
    3824                 if (na == 'class' && this.processObj.get)
    3825                     v = v.replace(/\bmceItem\w+\b/g, '');
    3826             }
    3827 
    3828             if (v === '')
    3829                 return null;
    3830 
    3831 
    3832             return v;
    3833         }
    3834 
    3835         });
    3836 })();
    3837 
    3838 /* file:jscripts/tiny_mce/classes/dom/ScriptLoader.js */
    3839 
    3840 (function() {
    3841     var each = tinymce.each;
    3842 
    3843     tinymce.create('tinymce.dom.ScriptLoader', {
    3844         ScriptLoader : function(s) {
    3845             this.settings = s || {};
    3846             this.queue = [];
    3847             this.lookup = {};
    3848         },
    3849 
    3850         markDone : function(u) {
    3851             this.lookup[u] = {state : 2, url : u};
    3852         },
    3853 
    3854         add : function(u, cb, s, pr) {
    3855             var t = this, lo = t.lookup, o;
    3856 
    3857             if (o = lo[u]) {
    3858                 // Is loaded fire callback
    3859                 if (cb && o.state == 2)
    3860                     cb.call(s || this);
    3861 
    3862                 return o;
    3863             }
    3864 
    3865             o = {state : 0, url : u, func : cb, scope : s || this};
    3866 
    3867             if (pr)
    3868                 t.queue.unshift(o);
    3869             else
    3870                 t.queue.push(o);
    3871 
    3872             lo[u] = o;
    3873 
    3874             return o;
    3875         },
    3876 
    3877         load : function(u, cb, s) {
    3878             var o;
    3879 
    3880             if (!tinymce.is(u, 'string')) {
    3881                 o = [];
    3882 
    3883                 each(u, function(u) {
    3884                     o.push({state : 0, url : u});
    3885                 });
    3886 
    3887                 this.loadScripts(o, cb, s);
    3888             } else
    3889                 this.loadScripts([{state : 0, url : u}], cb, s);
    3890         },
    3891 
    3892         loadQueue : function(cb, s) {
    3893             var t = this;
    3894 
    3895             if (!t.queueLoading) {
    3896                 t.queueLoading = 1;
    3897                 t.queueCallbacks = [];
    3898 
    3899                 t.loadScripts(t.queue, function() {
    3900                     t.queueLoading = 0;
    3901 
    3902                     if (cb)
    3903                         cb.call(s || t);
    3904 
    3905                     each(t.queueCallbacks, function(o) {
    3906                         o.func.call(o.scope);
    3907                     });
    3908                 });
    3909             } else if (cb)
    3910                 t.queueCallbacks.push({func : cb, scope : s || t});
    3911         },
    3912 
    3913         eval : function(co) {
    3914             var w = window;
    3915 
    3916             // Evaluate script
    3917             if (!w.execScript) {
    3918                 try {
    3919                     eval.call(w, co);
    3920                 } catch (ex) {
    3921                     eval(co, w); // Firefox 3.0a8
    3922                 }
    3923             } else
    3924                 w.execScript(co); // IE
    3925         },
    3926 
    3927         loadScripts : function(sc, cb, s) {
    3928             var t = this, lo = t.lookup;
    3929 
    3930             function done(o) {
    3931                 o.state = 2; // Has been loaded
    3932 
    3933                 // Run callback
    3934                 if (o.func)
    3935                     o.func.call(o.scope || t);
    3936             };
    3937 
    3938             function allDone() {
    3939                 var l;
    3940 
    3941                 // Check if all files are loaded
    3942                 l = sc.length;
    3943                 each(sc, function(o) {
    3944                     o = lo[o.url];
    3945 
    3946                     if (o.state === 2) {// It has finished loading
    3947                         done(o);
    3948                         l--;
    3949                     } else
    3950                         load(o);
    3951                 });
    3952 
    3953                 // They are all loaded
    3954                 if (l === 0 && cb) {
    3955                     cb.call(s || t);
    3956                     cb = 0;
    3957                 }
    3958             };
    3959 
    3960             function load(o) {
    3961                 if (o.state > 0)
    3962                     return;
    3963 
    3964                 o.state = 1; // Is loading
    3965 
    3966                 tinymce.util.XHR.send({
    3967                     url : o.url,
    3968                     error : t.settings.error,
    3969                     success : function(co) {
    3970                         t.eval(co);
    3971                         done(o);
    3972                         allDone();
    3973                     }
    3974                 });
    3975             };
    3976 
    3977             each(sc, function(o) {
    3978                 var u = o.url;
    3979 
    3980                 // Add to queue if needed
    3981                 if (!lo[u]) {
    3982                     lo[u] = o;
    3983                     t.queue.push(o);
    3984                 } else
    3985                     o = lo[u];
    3986 
    3987                 // Is already loading or has been loaded
    3988                 if (o.state > 0)
    3989                     return;
    3990 
    3991                 if (!tinymce.dom.Event.domLoaded && !t.settings.strict_mode) {
    3992                     var ix, ol = '';
    3993 
    3994                     // Add onload events
    3995                     if (cb || o.func) {
    3996                         o.state = 1; // Is loading
    3997 
    3998                         ix = tinymce.dom.ScriptLoader._addOnLoad(function() {
    3999                             done(o);
    4000                             allDone();
    4001                         });
    4002 
    4003                         if (tinymce.isIE)
    4004                             ol = ' onreadystatechange="';
    4005                         else
    4006                             ol = ' onload="';
    4007 
    4008                         ol += 'tinymce.dom.ScriptLoader._onLoad(this,\'' + u + '\',' + ix + ');"';
    4009                     }
    4010 
    4011                     document.write('<script type="text/javascript" src="' + u + '"' + ol + '></script>');
    4012 
    4013                     if (!o.func)
    4014                         done(o);
    4015                 } else
    4016                     load(o);
    4017             });
    4018 
    4019             allDone();
    4020         },
    4021 
    4022         // Static methods
    4023         'static' : {
    4024             _addOnLoad : function(f) {
    4025                 var t = this;
    4026 
    4027                 t._funcs = t._funcs || [];
    4028                 t._funcs.push(f);
    4029 
    4030                 return t._funcs.length - 1;
    4031             },
    4032 
    4033             _onLoad : function(e, u, ix) {
    4034                 if (!tinymce.isIE || e.readyState == 'complete')
    4035                     this._funcs[ix].call(this);
    4036             }
    4037         }
    4038 
    4039         });
    4040 
    4041     // Global script loader
    4042     tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
    4043 })();
    4044 
    4045 /* file:jscripts/tiny_mce/classes/ui/Control.js */
    4046 
    4047 (function() {
    4048     // Shorten class names
    4049     var DOM = tinymce.DOM, is = tinymce.is;
    4050 
    4051     tinymce.create('tinymce.ui.Control', {
    4052         Control : function(id, s) {
    4053             this.id = id;
    4054             this.settings = s = s || {};
    4055             this.rendered = false;
    4056             this.onRender = new tinymce.util.Dispatcher(this);
    4057             this.classPrefix = '';
    4058             this.scope = s.scope || this;
    4059             this.disabled = 0;
    4060             this.active = 0;
    4061         },
    4062 
    4063         setDisabled : function(s) {
    4064             var e;
    4065 
    4066             if (s != this.disabled) {
    4067                 e = DOM.get(this.id);
    4068 
    4069                 // Add accessibility title for unavailable actions
    4070                 if (e && this.settings.unavailable_prefix) {
    4071                     if (s) {
    4072                         this.prevTitle = e.title;
    4073                         e.title = this.settings.unavailable_prefix + ": " + e.title;
    4074                     } else
    4075                         e.title = this.prevTitle;
    4076                 }
    4077 
    4078                 this.setState('Disabled', s);
    4079                 this.setState('Enabled', !s);
    4080                 this.disabled = s;
    4081             }
    4082         },
    4083 
    4084         isDisabled : function() {
    4085             return this.disabled;
    4086         },
    4087 
    4088         setActive : function(s) {
    4089             if (s != this.active) {
    4090                 this.setState('Active', s);
    4091                 this.active = s;
    4092             }
    4093         },
    4094 
    4095         isActive : function() {
    4096             return this.active;
    4097         },
    4098 
    4099         setState : function(c, s) {
    4100             var n = DOM.get(this.id);
    4101 
    4102             c = this.classPrefix + c;
    4103 
    4104             if (s)
    4105                 DOM.addClass(n, c);
    4106             else
    4107                 DOM.removeClass(n, c);
    4108         },
    4109 
    4110         isRendered : function() {
    4111             return this.rendered;
    4112         },
    4113 
    4114         renderHTML : function() {
    4115         },
    4116 
    4117         renderTo : function(n) {
    4118             n.innerHTML = this.renderHTML();
    4119         },
    4120 
    4121         postRender : function() {
    4122             var t = this, b;
    4123 
    4124             // Set pending states
    4125             if (is(t.disabled)) {
    4126                 b = t.disabled;
    4127                 t.disabled = -1;
    4128                 t.setDisabled(b);
    4129             }
    4130 
    4131             if (is(t.active)) {
    4132                 b = t.active;
    4133                 t.active = -1;
    4134                 t.setActive(b);
    4135             }
    4136         },
    4137 
    4138         destroy : function() {
    4139             DOM.remove(this.id);
    4140         }
    4141 
    4142         });
    4143 })();
    4144 /* file:jscripts/tiny_mce/classes/ui/Container.js */
    4145 
    4146 tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
    4147     Container : function(id, s) {
    4148         this.parent(id, s);
    4149         this.controls = [];
    4150         this.lookup = {};
    4151     },
    4152 
    4153     add : function(c) {
    4154         this.lookup[c.id] = c;
    4155         this.controls.push(c);
    4156 
    4157         return c;
    4158     },
    4159 
    4160     get : function(n) {
    4161         return this.lookup[n];
    4162     }
    4163 
    4164     });
    4165 
    4166 
    4167 /* file:jscripts/tiny_mce/classes/ui/Separator.js */
    4168 
    4169 tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
    4170     renderHTML : function() {
    4171         return tinymce.DOM.createHTML('span', {'class' : 'mceSeparator'});
    4172     }
    4173 
    4174     });
    4175 
    4176 /* file:jscripts/tiny_mce/classes/ui/MenuItem.js */
    4177 
    4178 (function() {
    4179     var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
    4180 
    4181     tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', {
    4182         MenuItem : function(id, s) {
    4183             this.parent(id, s);
    4184             this.classPrefix = 'mceMenuItem';
    4185         },
    4186 
    4187         setSelected : function(s) {
    4188             this.setState('Selected', s);
    4189             this.selected = s;
    4190         },
    4191 
    4192         isSelected : function() {
    4193             return this.selected;
    4194         },
    4195 
    4196         postRender : function() {
    4197             var t = this;
    4198            
    4199             t.parent();
    4200 
    4201             // Set pending state
    4202             if (is(t.selected))
    4203                 t.setSelected(t.selected);
    4204         }
    4205 
    4206         });
    4207 })();
    4208 
    4209 /* file:jscripts/tiny_mce/classes/ui/Menu.js */
    4210 
    4211 (function() {
    4212     var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
    4213 
    4214     tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', {
    4215         Menu : function(id, s) {
    4216             var t = this;
    4217 
    4218             t.parent(id, s);
    4219             t.items = {};
    4220             t.collapsed = false;
    4221             t.menuCount = 0;
    4222             t.onAddItem = new tinymce.util.Dispatcher(this);
    4223         },
    4224 
    4225         expand : function(d) {
    4226             var t = this;
    4227 
    4228             if (d) {
    4229                 walk(t, function(o) {
    4230                     if (o.expand)
    4231                         o.expand();
    4232                 }, 'items', t);
    4233             }
    4234 
    4235             t.collapsed = false;
    4236         },
    4237 
    4238         collapse : function(d) {
    4239             var t = this;
    4240 
    4241             if (d) {
    4242                 walk(t, function(o) {
    4243                     if (o.collapse)
    4244                         o.collapse();
    4245                 }, 'items', t);
    4246             }
    4247 
    4248             t.collapsed = true;
    4249         },
    4250 
    4251         isCollapsed : function() {
    4252             return this.collapsed;
    4253         },
    4254 
    4255         add : function(o) {
    4256             if (!o.settings)
    4257                 o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), o);
    4258 
    4259             this.onAddItem.dispatch(this, o);
    4260 
    4261             return this.items[o.id] = o;
    4262         },
    4263 
    4264         addSeparator : function() {
    4265             return this.add({separator : true});
    4266         },
    4267 
    4268         addMenu : function(o) {
    4269             if (!o.collapse)
    4270                 o = this.createMenu(o);
    4271 
    4272             this.menuCount++;
    4273 
    4274             return this.add(o);
    4275         },
    4276 
    4277         hasMenus : function() {
    4278             return this.menuCount !== 0;
    4279         },
    4280 
    4281         remove : function(o) {
    4282             delete this.items[o.id];
    4283         },
    4284 
    4285         removeAll : function() {
    4286             var t = this;
    4287 
    4288             walk(t, function(o) {
    4289                 if (o.removeAll)
    4290                     o.removeAll();
    4291 
    4292                 o.destroy();
    4293             }, 'items', t);
    4294 
    4295             t.items = {};
    4296         },
    4297 
    4298         createMenu : function(o) {
    4299             var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), o);
    4300 
    4301             m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem);
    4302 
    4303             return m;
    4304         }
    4305 
    4306         });
    4307 })();
    4308 /* file:jscripts/tiny_mce/classes/ui/DropMenu.js */
    4309 
    4310 (function() {
    4311     var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
    4312 
    4313     tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', {
    4314         DropMenu : function(id, s) {
    4315             s = s || {};
    4316             s.container = s.container || document.body;
    4317             s.offset_x = s.offset_x || 0;
    4318             s.offset_y = s.offset_y || 0;
    4319             s.vp_offset_x = s.vp_offset_x || 0;
    4320             s.vp_offset_y = s.vp_offset_y || 0;
    4321             this.parent(id, s);
    4322             this.onHideMenu = new tinymce.util.Dispatcher(this);
    4323             this.classPrefix = 'mceMenu';
    4324         },
    4325 
    4326         createMenu : function(s) {
    4327             var t = this, cs = t.settings, m;
    4328 
    4329             s.container = s.container || cs.container;
    4330             s.parent = t;
    4331             s.constrain = s.constrain || cs.constrain;
    4332             s['class'] = s['class'] || cs['class'];
    4333             s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x;
    4334             s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y;
    4335             m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);
    4336 
    4337             m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);
    4338 
    4339             return m;
    4340         },
    4341 
    4342         update : function() {
    4343             var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th;
    4344 
    4345             tw = s.max_width ? Math.min(tb.clientWidth, s.max_width) : tb.clientWidth;
    4346             th = s.max_height ? Math.min(tb.clientHeight, s.max_height) : tb.clientHeight;
    4347 
    4348             if (!DOM.boxModel)
    4349                 t.element.setStyles({width : tw + 2, height : th + 2});
    4350             else
    4351                 t.element.setStyles({width : tw, height : th});
    4352 
    4353             if (s.max_width)
    4354                 DOM.setStyle(co, 'width', tw);
    4355 
    4356             if (s.max_height) {
    4357                 DOM.setStyle(co, 'height', th);
    4358 
    4359                 if (tb.clientHeight < s.max_height)
    4360                     DOM.setStyle(co, 'overflow', 'hidden');
    4361             }
    4362         },
    4363 
    4364         showMenu : function(x, y, px) {
    4365             var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb;
    4366 
    4367             t.collapse(1);
    4368 
    4369             if (t.isMenuVisible)
    4370                 return;
    4371 
    4372             if (!t.rendered) {
    4373                 co = DOM.add(t.settings.container, t.renderNode());
    4374 
    4375                 each(t.items, function(o) {
    4376                     o.postRender();
    4377                 });
    4378 
    4379                 t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
    4380             } else
    4381                 co = DOM.get('menu_' + t.id);
    4382 
    4383             DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF});
    4384             DOM.show(co);
    4385             t.update();
    4386 
    4387             x += s.offset_x || 0;
    4388             y += s.offset_y || 0;
    4389             vp.w -= 4;
    4390             vp.h -= 4;
    4391 
    4392             // Move inside viewport if not submenu
    4393             if (s.constrain) {
    4394                 w = co.clientWidth - ot;
    4395                 h = co.clientHeight - ot;
    4396                 mx = vp.x + vp.w;
    4397                 my = vp.y + vp.h;
    4398 
    4399                 if ((x + s.vp_offset_x + w) > mx)
    4400                     x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w);
    4401 
    4402                 if ((y + s.vp_offset_y + h) > my)
    4403                     y = Math.max(0, (my - s.vp_offset_y) - h);
    4404             }
    4405 
    4406             DOM.setStyles(co, {left : x , top : y});
    4407             t.element.update();
    4408 
    4409             t.isMenuVisible = 1;
    4410             t.mouseClickFunc = Event.add(co, 'click', function(e) {
    4411                 var m;
    4412 
    4413                 e = e.target;
    4414 
    4415                 if (e && (e = DOM.getParent(e, 'TR')) && !DOM.hasClass(e, 'mceMenuItemSub')) {
    4416                     m = t.items[e.id];
    4417 
    4418                     if (m.isDisabled())
    4419                         return;
    4420 
    4421                     if (m.settings.onclick)
    4422                         m.settings.onclick(e);
    4423 
    4424                     dm = t;
    4425 
    4426                     while (dm) {
    4427                         if (dm.hideMenu)
    4428                             dm.hideMenu();
    4429 
    4430                         dm = dm.settings.parent;
    4431                     }
    4432 
    4433                     return Event.cancel(e); // Cancel to fix onbeforeunload problem
    4434                 }
    4435             });
    4436 
    4437             if (t.hasMenus()) {
    4438                 t.mouseOverFunc = Event.add(co, 'mouseover', function(e) {
    4439                     var m, r, mi;
    4440 
    4441                     e = e.target;
    4442                     if (e && (e = DOM.getParent(e, 'TR'))) {
    4443                         m = t.items[e.id];
    4444 
    4445                         if (t.lastMenu)
    4446                             t.lastMenu.collapse(1);
    4447 
    4448                         if (m.isDisabled())
    4449                             return;
    4450 
    4451                         if (e && DOM.hasClass(e, 'mceMenuItemSub')) {
    4452                             //p = DOM.getPos(s.container);
    4453                             r = DOM.getRect(e);
    4454                             m.showMenu((r.x + r.w - ot), r.y - ot, r.x);
    4455                             t.lastMenu = m;
    4456                             DOM.addClass(DOM.get(m.id).firstChild, 'mceMenuItemActive');
    4457                         }
    4458                     }
    4459                 });
    4460             }
    4461         },
    4462 
    4463         hideMenu : function() {
    4464             var t = this, co = DOM.get('menu_' + t.id), e;
    4465 
    4466             if (!t.isMenuVisible)
    4467                 return;
    4468 
    4469             Event.remove(co, 'mouseover', t.mouseOverFunc);
    4470             Event.remove(co, 'click', t.mouseClickFunc);
    4471             DOM.hide(co);
    4472             t.isMenuVisible = 0;
    4473 
    4474             if (t.element)
    4475                 t.element.hide();
    4476 
    4477             if (e = DOM.get(t.id))
    4478                 DOM.removeClass(e.firstChild, 'mceMenuItemActive');
    4479 
    4480             t.onHideMenu.dispatch(t);
    4481         },
    4482 
    4483         add : function(o) {
    4484             var t = this, co;
    4485 
    4486             o = t.parent(o);
    4487 
    4488             if (t.isRendered && (co = DOM.get('menu_' + t.id)))
    4489                 t._add(DOM.select('tbody', co)[0], o);
    4490 
    4491             return o;
    4492         },
    4493 
    4494         collapse : function(d) {
    4495             this.parent(d);
    4496             this.hideMenu();
    4497         },
    4498 
    4499         remove : function(o) {
    4500             DOM.remove(o.id);
    4501 
    4502             return this.parent(o);
    4503         },
    4504 
    4505         destroy : function() {
    4506             var t = this, co = DOM.get('menu_' + t.id);
    4507 
    4508             Event.remove(co, 'mouseover', t.mouseOverFunc);
    4509             Event.remove(co, 'click', t.mouseClickFunc);
    4510 
    4511             if (t.element)
    4512                 t.element.remove();
    4513 
    4514             DOM.remove(co);
    4515         },
    4516 
    4517         renderNode : function() {
    4518             var t = this, s = t.settings, n, tb, co, w;
    4519 
    4520             w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:150'});
    4521             co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenu' + (s['class'] ? ' ' + s['class'] : '')});
    4522             t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
    4523 
    4524             if (s.menu_line)
    4525                 DOM.add(co, 'span', {'class' : 'mceMenuLine'});
    4526 
    4527 //          n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});
    4528             n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});
    4529             tb = DOM.add(n, 'tbody');
    4530 
    4531             each(t.items, function(o) {
    4532                 t._add(tb, o);
    4533             });
    4534 
    4535             t.rendered = true;
    4536 
    4537             return w;
    4538         },
    4539 
    4540         // Internal functions
    4541 
    4542         _add : function(tb, o) {
    4543             var n, s = o.settings, a, ro, it;
    4544 
    4545             if (s.separator) {
    4546                 ro = DOM.add(tb, 'tr', {id : o.id, 'class' : 'mceMenuItemSeparator'});
    4547                 DOM.add(ro, 'td', {'class' : 'mceMenuItemSeparator'});
    4548 
    4549                 if (n = ro.previousSibling)
    4550                     DOM.addClass(n, 'last');
    4551 
    4552                 return;
    4553             }
    4554 
    4555             n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : 'mceMenuItem mceMenuItemEnabled'});
    4556             n = it = DOM.add(n, 'td');
    4557             n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
    4558 
    4559             DOM.addClass(it, s['class']);
    4560 //          n = DOM.add(n, 'span', {'class' : 'item'});
    4561             DOM.add(n, 'span', {'class' : 'icon' + (s.icon ? ' ' + s.icon : '')});
    4562             n = DOM.add(n, s.element || 'span', {'class' : 'text', title : o.settings.title}, o.settings.title);
    4563 
    4564             if (o.settings.style)
    4565                 DOM.setAttrib(n, 'style', o.settings.style);
    4566 
    4567             if (tb.childNodes.length == 1)
    4568                 DOM.addClass(ro, 'first');
    4569 
    4570             if ((n = ro.previousSibling) && DOM.hasClass(n, 'mceMenuItemSeparator'))
    4571                 DOM.addClass(ro, 'first');
    4572 
    4573             if (o.collapse)
    4574                 DOM.addClass(ro, 'mceMenuItemSub');
    4575 
    4576             if (n = ro.previousSibling)
    4577                 DOM.removeClass(n, 'last');
    4578 
    4579             DOM.addClass(ro, 'last');
    4580         }
    4581 
    4582         });
    4583 })();
    4584 /* file:jscripts/tiny_mce/classes/ui/Button.js */
    4585 
    4586 (function() {
    4587     var DOM = tinymce.DOM;
    4588 
    4589     tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {
    4590         Button : function(id, s) {
    4591             this.parent(id, s);
    4592             this.classPrefix = 'mceButton';
    4593         },
    4594 
    4595         renderHTML : function() {
    4596             var s = this.settings, h = '<a id="' + this.id + '" href="javascript:;" class="mceButton mceButtonEnabled ' + s['class'] + '" onmousedown="return false;" onclick="return false;" title="' + DOM.encode(s.title) + '">';
    4597 
    4598             if (s.image)
    4599                 h += '<img class="icon" src="' + s.image + '" /></a>';
    4600             else
    4601                 h += '<span class="icon ' + s['class'] + '"></span></a>';
    4602 
    4603             return h;
    4604         },
    4605 
    4606         postRender : function() {
    4607             var t = this, s = t.settings;
    4608 
    4609             tinymce.dom.Event.add(t.id, 'click', function(e) {
    4610                 if (!t.isDisabled())
    4611                     return s.onclick.call(s.scope, e);
    4612             });
    4613         }
    4614 
    4615         });
    4616 })();
    4617 
    4618 /* file:jscripts/tiny_mce/classes/ui/ListBox.js */
    4619 
    4620 (function() {
    4621     var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
    4622 
    4623     tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {
    4624         ListBox : function(id, s) {
    4625             var t = this;
    4626 
    4627             t.parent(id, s);
    4628             t.items = [];
    4629             t.onChange = new Dispatcher(t);
    4630             t.onPostRender = new Dispatcher(t);
    4631             t.onAdd = new Dispatcher(t);
    4632             t.onRenderMenu = new tinymce.util.Dispatcher(this);
    4633             t.classPrefix = 'mceListBox';
    4634         },
    4635 
    4636         select : function(v) {
    4637             var t = this, e, fv;
    4638 
    4639             // Do we need to do something?
    4640             if (v != t.selectedValue) {
    4641                 e = DOM.get(t.id + '_text');
    4642                 t.selectedValue = v;
    4643 
    4644                 // Find item
    4645                 each(t.items, function(o) {
    4646                     if (o.value == v) {
    4647                         DOM.setHTML(e, DOM.encode(o.title));
    4648                         fv = 1;
    4649                         return false;
    4650                     }
    4651                 });
    4652 
    4653                 // If no item was found then present title
    4654                 if (!fv) {
    4655                     DOM.setHTML(e, DOM.encode(t.settings.title));
    4656                     DOM.addClass(e, 'title');
    4657                     e = 0;
    4658                     return;
    4659                 } else
    4660                     DOM.removeClass(e, 'title');
    4661             }
    4662 
    4663             e = 0;
    4664         },
    4665 
    4666         add : function(n, v, o) {
    4667             var t = this;
    4668 
    4669             o = o || {};
    4670             o = tinymce.extend(o, {
    4671                 title : n,
    4672                 value : v
    4673             });
    4674 
    4675             t.items.push(o);
    4676             t.onAdd.dispatch(t, o);
    4677         },
    4678 
    4679         getLength : function() {
    4680             return this.items.length;
    4681         },
    4682 
    4683         renderHTML : function() {
    4684             var h = '', t = this, s = t.settings;
    4685 
    4686             h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="mceListBox mceListBoxEnabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';
    4687             h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'text', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';
    4688             h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'open', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>';
    4689             h += '</tr></tbody></table>';
    4690 
    4691             return h;
    4692         },
    4693 
    4694         showMenu : function() {
    4695             var t = this, p1, p2, e = DOM.get(this.id), m;
    4696 
    4697             if (t.isDisabled() || t.items.length == 0)
    4698                 return;
    4699 
    4700             if (!t.isMenuRendered) {
    4701                 t.renderMenu();
    4702                 t.isMenuRendered = true;
    4703             }
    4704 
    4705             p1 = DOM.getPos(this.settings.menu_container);
    4706             p2 = DOM.getPos(e);
    4707 
    4708             m = t.menu;
    4709             m.settings.offset_x = p2.x;
    4710             m.settings.offset_y = p2.y;
    4711 
    4712             // Select in menu
    4713             if (t.oldID)
    4714                 m.items[t.oldID].setSelected(0);
    4715 
    4716             each(t.items, function(o) {
    4717                 if (o.value === t.selectedValue) {
    4718                     m.items[o.id].setSelected(1);
    4719                     t.oldID = o.id;
    4720                 }
    4721             });
    4722 
    4723             m.showMenu(0, e.clientHeight);
    4724 
    4725             Event.add(document, 'mousedown', t.hideMenu, t);
    4726             DOM.addClass(t.id, 'mceListBoxSelected');
    4727         },
    4728 
    4729         hideMenu : function(e) {
    4730             var t = this;
    4731 
    4732             if (!e || !DOM.getParent(e.target, function(n) {return DOM.hasClass(n, 'mceMenu');})) {
    4733                 DOM.removeClass(t.id, 'mceListBoxSelected');
    4734                 Event.remove(document, 'mousedown', t.hideMenu, t);
    4735 
    4736                 if (t.menu)
    4737                     t.menu.hideMenu();
    4738             }
    4739         },
    4740 
    4741         renderMenu : function() {
    4742             var t = this, m;
    4743 
    4744             m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
    4745                 menu_line : 1,
    4746                 'class' : 'mceListBoxMenu noIcons',
    4747                 max_width : 150,
    4748                 max_height : 150
    4749             });
    4750 
    4751             m.onHideMenu.add(t.hideMenu, t);
    4752 
    4753             m.add({
    4754                 title : t.settings.title,
    4755                 'class' : 'mceMenuItemTitle'
    4756             }).setDisabled(1);
    4757 
    4758             each(t.items, function(o) {
    4759                 o.id = DOM.uniqueId();
    4760                 o.onclick = function() {
    4761                     if (t.settings.onselect(o.value) !== false)
    4762                         t.select(o.value); // Must be runned after
    4763                 };
    4764 
    4765                 m.add(o);
    4766             });
    4767 
    4768             t.onRenderMenu.dispatch(t, m);
    4769             t.menu = m;
    4770         },
    4771 
    4772         postRender : function() {
    4773             var t = this;
    4774 
    4775             Event.add(t.id, 'click', t.showMenu, t);
    4776 
    4777             // Old IE doesn't have hover on all elements
    4778             if (tinymce.isIE6 || !DOM.boxModel) {
    4779                 Event.add(t.id, 'mouseover', function() {
    4780                     if (!DOM.hasClass(t.id, 'mceListBoxDisabled'))
    4781                         DOM.addClass(t.id, 'mceListBoxHover');
    4782                 });
    4783 
    4784                 Event.add(t.id, 'mouseout', function() {
    4785                     if (!DOM.hasClass(t.id, 'mceListBoxDisabled'))
    4786                         DOM.removeClass(t.id, 'mceListBoxHover');
    4787                 });
    4788             }
    4789 
    4790             t.onPostRender.dispatch(t, DOM.get(t.id));
    4791         }
    4792 
    4793         });
    4794 })();
    4795 /* file:jscripts/tiny_mce/classes/ui/NativeListBox.js */
    4796 
    4797 (function() {
    4798     var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
    4799 
    4800     tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
    4801         NativeListBox : function(id, s) {
    4802             this.parent(id, s);
    4803             this.classPrefix = 'mceNativeListBox';
    4804         },
    4805 
    4806         setDisabled : function(s) {
    4807             DOM.get(this.id).disabled = s;
    4808         },
    4809 
    4810         isDisabled : function() {
    4811             return DOM.get(this.id).disabled;
    4812         },
    4813 
    4814         select : function(v) {
    4815             var e = DOM.get(this.id), ol = e.options;
    4816 
    4817             v = '' + (v || '');
    4818 
    4819             e.selectedIndex = 0;
    4820             each(ol, function(o, i) {
    4821                 if (o.value == v) {
    4822                     e.selectedIndex = i;
    4823                     return false;
    4824                 }
    4825             });
    4826         },
    4827 
    4828         add : function(n, v, a) {
    4829             var o, t = this;
    4830 
    4831             a = a || {};
    4832             a.value = v;
    4833 
    4834             if (t.isRendered())
    4835                 DOM.add(DOM.get(this.id), 'option', a, n);
    4836 
    4837             o = {
    4838                 title : n,
    4839                 value : v,
    4840                 attribs : a
    4841             };
    4842 
    4843             t.items.push(o);
    4844             t.onAdd.dispatch(t, o);
    4845         },
    4846 
    4847         getLength : function() {
    4848             return DOM.get(this.id).options.length - 1;
    4849         },
    4850 
    4851         renderHTML : function() {
    4852             var h, t = this;
    4853 
    4854             h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');
    4855 
    4856             each(t.items, function(it) {
    4857                 h += DOM.createHTML('option', {value : it.value}, it.title);
    4858             });
    4859 
    4860             h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h);
    4861 
    4862             return h;
    4863         },
    4864 
    4865         postRender : function() {
    4866             var t = this, ch;
    4867 
    4868             t.rendered = true;
    4869 
    4870             function onChange(e) {
    4871                 var v = e.target.options[e.target.selectedIndex].value;
    4872 
    4873                 t.onChange.dispatch(t, v);
    4874 
    4875                 if (t.settings.onselect)
    4876                     t.settings.onselect(v);
    4877             };
    4878 
    4879             Event.add(t.id, 'change', onChange);
    4880 
    4881             // Accessibility keyhandler
    4882             Event.add(t.id, 'keydown', function(e) {
    4883                 var bf;
    4884 
    4885                 Event.remove(t.id, 'change', ch);
    4886 
    4887                 bf = Event.add(t.id, 'blur', function() {
    4888                     Event.add(t.id, 'change', onChange);
    4889                     Event.remove(t.id, 'blur', bf);
    4890                 });
    4891 
    4892                 if (e.keyCode == 13 || e.keyCode == 32) {
    4893                     onChange(e);
    4894                     return Event.cancel(e);
    4895                 }
    4896             });
    4897 
    4898             t.onPostRender.dispatch(t, DOM.get(t.id));
    4899         }
    4900 
    4901         });
    4902 })();
    4903 /* file:jscripts/tiny_mce/classes/ui/MenuButton.js */
    4904 
    4905 (function() {
    4906     var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
    4907 
    4908     tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {
    4909         MenuButton : function(id, s) {
    4910             this.parent(id, s);
    4911             this.onRenderMenu = new tinymce.util.Dispatcher(this);
    4912             s.menu_container = s.menu_container || document.body;
    4913         },
    4914 
    4915         showMenu : function() {
    4916             var t = this, p1, p2, e = DOM.get(t.id), m;
    4917 
    4918             if (t.isDisabled())
    4919                 return;
    4920 
    4921             if (!t.isMenuRendered) {
    4922                 t.renderMenu();
    4923                 t.isMenuRendered = true;
    4924             }
    4925 
    4926             p1 = DOM.getPos(t.settings.menu_container);
    4927             p2 = DOM.getPos(e);
    4928 
    4929             m = t.menu;
    4930             m.settings.offset_x = p2.x;
    4931             m.settings.offset_y = p2.y;
    4932             m.settings.vp_offset_x = p2.x;
    4933             m.settings.vp_offset_y = p2.y;
    4934             m.showMenu(0, e.clientHeight);
    4935 
    4936             Event.add(document, 'mousedown', t.hideMenu, t);
    4937             t.setState('Selected', 1);
    4938         },
    4939 
    4940         renderMenu : function() {
    4941             var t = this, m;
    4942 
    4943             m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
    4944                 menu_line : 1,
    4945                 'class' : this.classPrefix + 'Menu'
    4946             });
    4947 
    4948             m.onHideMenu.add(t.hideMenu, t);
    4949 
    4950             t.onRenderMenu.dispatch(t, m);
    4951             t.menu = m;
    4952         },
    4953 
    4954         hideMenu : function(e) {
    4955             var t = this;
    4956 
    4957             if (!e || !DOM.getParent(e.target, function(n) {return DOM.hasClass(n, 'mceMenu');})) {
    4958                 t.setState('Selected', 0);
    4959                 Event.remove(document, 'mousedown', t.hideMenu, t);
    4960                 if (t.menu)
    4961                     t.menu.hideMenu();
    4962             }
    4963         },
    4964 
    4965         postRender : function() {
    4966             var t = this, s = t.settings;
    4967 
    4968             Event.add(t.id, 'click', function() {
    4969                 if (!t.isDisabled()) {
    4970                     if (s.onclick)
    4971                         s.onclick(t.value);
    4972 
    4973                     t.showMenu();
    4974                 }
    4975             });
    4976         }
    4977 
    4978         });
    4979 })();
    4980 
    4981 /* file:jscripts/tiny_mce/classes/ui/SplitButton.js */
    4982 
    4983 (function() {
    4984     var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
    4985 
    4986     tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {
    4987         SplitButton : function(id, s) {
    4988             this.parent(id, s);
    4989             this.classPrefix = 'mceSplitButton';
    4990         },
    4991 
    4992         renderHTML : function() {
    4993             var h, t = this, s = t.settings, h1;
    4994 
    4995             h = '<tbody><tr>';
    4996 
    4997             if (s.image)
    4998                 h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'action ' + s['class']});
    4999             else
    5000                 h1 = DOM.createHTML('span', {'class' : 'action ' + s['class']});
    5001 
    5002             h += '<td>' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'action ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';
    5003    
    5004             h1 = DOM.createHTML('span', {'class' : 'open ' + s['class']});
    5005             h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'open ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';
    5006 
    5007             h += '</tr></tbody>';
    5008 
    5009             return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, h);
    5010         },
    5011 
    5012         postRender : function() {
    5013             var t = this, s = t.settings;
    5014 
    5015             if (s.onclick) {
    5016                 Event.add(t.id + '_action', 'click', function() {
    5017                     if (!t.isDisabled())
    5018                         s.onclick(t.value);
    5019                 });
    5020             }
    5021 
    5022             Event.add(t.id + '_open', 'click', t.showMenu, t);
    5023 
    5024             // Old IE doesn't have hover on all elements
    5025             if (tinymce.isIE6 || !DOM.boxModel) {
    5026                 Event.add(t.id, 'mouseover', function() {
    5027                     if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
    5028                         DOM.addClass(t.id, 'mceSplitButtonHover');
    5029                 });
    5030 
    5031                 Event.add(t.id, 'mouseout', function() {
    5032                     if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
    5033                         DOM.removeClass(t.id, 'mceSplitButtonHover');
    5034                 });
    5035             }
    5036         }
    5037 
    5038         });
    5039 })();
    5040 
    5041 /* file:jscripts/tiny_mce/classes/ui/ColorSplitButton.js */
    5042 
    5043 (function() {
    5044     var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;
    5045 
    5046     tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {
    5047         ColorSplitButton : function(id, s) {
    5048             var t = this;
    5049 
    5050             t.parent(id, s);
    5051 
    5052             t.settings = s = tinymce.extend({
    5053                 colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',
    5054                 grid_width : 8,
    5055                 default_color : '#888888'
    5056             }, t.settings);
    5057 
    5058             t.value = s.default_color;
    5059         },
    5060 
    5061         showMenu : function() {
    5062             var t = this, r, p, e;
    5063 
    5064             if (t.isDisabled())
    5065                 return;
    5066 
    5067             if (!t.isMenuRendered) {
    5068                 t.renderMenu();
    5069                 t.isMenuRendered = true;
    5070             }
    5071 
    5072             e = DOM.get(t.id);
    5073             DOM.show(t.id + '_menu');
    5074             DOM.addClass(e, 'mceSplitButtonSelected');
    5075             p2 = DOM.getPos(e);
    5076             DOM.setStyles(t.id + '_menu', {
    5077                 left : p2.x,
    5078                 top : p2.y + e.clientHeight,
    5079                 zIndex : 150
    5080             });
    5081             e = 0;
    5082 
    5083             Event.add(document, 'mousedown', t.hideMenu, t);
    5084         },
    5085 
    5086         hideMenu : function(e) {
    5087             var t = this;
    5088 
    5089             if (!e || !DOM.getParent(e.target, function(n) {return DOM.hasClass(n, 'mceSplitButtonMenu');})) {
    5090                 DOM.removeClass(t.id, 'mceSplitButtonSelected');
    5091                 Event.remove(document, 'mousedown', t.hideMenu, t);
    5092                 DOM.hide(t.id + '_menu');
    5093             }
    5094         },
    5095 
    5096         renderMenu : function() {
    5097             var t = this, m, i = 0, s = t.settings, n, tb, tr, w;
    5098 
    5099             w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});
    5100             m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});
    5101             DOM.add(m, 'span', {'class' : 'mceMenuLine'});
    5102 
    5103             n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'});
    5104             tb = DOM.add(n, 'tbody');
    5105 
    5106             // Generate color grid
    5107             i = 0;
    5108             each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {
    5109                 c = c.replace(/^#/, '');
    5110 
    5111                 if (!i--) {
    5112                     tr = DOM.add(tb, 'tr');
    5113                     i = s.grid_width - 1;
    5114                 }
    5115 
    5116                 n = DOM.add(tr, 'td');
    5117 
    5118                 n = DOM.add(n, 'a', {
    5119                     href : 'javascript:;',
    5120                     style : {
    5121                         backgroundColor : '#' + c
    5122                     }
    5123                 });
    5124 
    5125                 Event.add(n, 'mousedown', function() {
    5126                     t.setColor('#' + c);
    5127                 });
    5128             });
    5129 
    5130             if (s.more_colors_func) {
    5131                 n = DOM.add(tb, 'tr');
    5132                 n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'morecolors'});
    5133                 n = DOM.add(n, 'a', {href : 'javascript:;', onclick : 'return false;', 'class' : 'morecolors'}, s.more_colors_title);
    5134 
    5135                 Event.add(n, 'click', function(e) {
    5136                     s.more_colors_func.call(s.more_colors_scope || this);
    5137                     return Event.cancel(e); // Cancel to fix onbeforeunload problem
    5138                 });
    5139             }
    5140 
    5141             DOM.addClass(m, 'mceColorSplitMenu');
    5142 
    5143             return w;
    5144         },
    5145 
    5146         setColor : function(c) {
    5147             var t = this, p, s = this.settings, co = s.menu_container, po, cp, id = t.id + '_preview';
    5148 
    5149             if (!(p = DOM.get(id))) {
    5150                 DOM.setStyle(t.id + '_action', 'position', 'relative');
    5151                 p = DOM.add(t.id + '_action', 'div', {id : id, 'class' : 'mceColorPreview'});
    5152             }
    5153 
    5154             p.style.backgroundColor = c;
    5155 
    5156             t.value = c;
    5157             t.hideMenu();
    5158             s.onselect(c);
    5159         }
    5160 
    5161         });
    5162 })();
    5163 
    5164 /* file:jscripts/tiny_mce/classes/ui/Toolbar.js */
    5165 
    5166 tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
    5167     renderHTML : function() {
    5168         var t = this, h = '', c = 'mceToolbarEnd', co, dom = tinymce.DOM, s = t.settings;
    5169 
    5170         h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));
    5171 
    5172         tinymce.each(t.controls, function(c) {
    5173             h += '<td>' + c.renderHTML() + '</td>';
    5174         });
    5175 
    5176         co = t.controls[t.controls.length - 1].constructor;
    5177 
    5178         if (co === tinymce.ui.Button)
    5179             c += ' mceToolbarEndButton';
    5180         else if (co === tinymce.ui.SplitButton)
    5181             c += ' mceToolbarEndSplitButton';
    5182         else if (co === tinymce.ui.ListBox)
    5183             c += ' mceToolbarEndListBox';
    5184 
    5185         h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
    5186 
    5187         return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>');
    5188     }
    5189 
    5190     });
    5191 
    5192 /* file:jscripts/tiny_mce/classes/AddOnManager.js */
    5193 
    5194 (function() {
    5195     var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;
    5196 
    5197     tinymce.create('tinymce.AddOnManager', {
    5198         items : [],
    5199         urls : {},
    5200         lookup : {},
    5201         onAdd : new Dispatcher(this),
    5202 
    5203         get : function(n) {
    5204             return this.lookup[n];
    5205         },
    5206 
    5207         requireLangPack : function(n) {
    5208             var u, s;
    5209 
    5210             if (tinymce.EditorManager.settings) {
    5211                 u = this.urls[n] + '/langs/' + tinymce.EditorManager.settings.language + '.js';
    5212                 s = tinymce.EditorManager.settings;
    5213 
    5214                 if (s) {
    5215                     if (!tinymce.dom.Event.domLoaded && !s.strict_mode)
    5216                         tinymce.ScriptLoader.load(u);
    5217                     else
    5218                         tinymce.ScriptLoader.add(u);
    5219                 }
    5220             }
    5221         },
    5222 
    5223         add : function(id, o) {
    5224             this.items.push(o);
    5225             this.lookup[id] = o;
    5226             this.onAdd.dispatch(this, id, o);
    5227 
    5228             return o;
    5229         },
    5230 
    5231         load : function(n, u, cb, s) {
    5232             if (u.indexOf('/') != 0 && u.indexOf('://') == -1)
    5233                 u = tinymce.baseURL + '/' +  u;
    5234 
    5235             this.urls[n] = u.substring(0, u.lastIndexOf('/'));
    5236             tinymce.ScriptLoader.add(u, cb, s);
    5237         }
    5238 
    5239         });
    5240 
    5241     // Create plugin and theme managers
    5242     tinymce.PluginManager = new tinymce.AddOnManager();
    5243     tinymce.ThemeManager = new tinymce.AddOnManager();
    5244 }());
    5245 /* file:jscripts/tiny_mce/classes/EditorManager.js */
    5246 
    5247 (function() {
    5248     // Shorten names
    5249     var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager;
    5250 
    5251     tinymce.create('static tinymce.EditorManager', {
    5252         editors : {},
    5253         i18n : {},
    5254         activeEditor : null,
    5255 
    5256         init : function(s) {
    5257             var t = this, pl, sl = tinymce.ScriptLoader;
    5258 
    5259             function execCallback(se, n, s) {
    5260                 var f = se[n];
    5261 
    5262                 if (!f)
    5263                     return;
    5264 
    5265                 if (tinymce.is(f, 'string')) {
    5266                     s = f.replace(/\.\w+$/, '');
    5267                     s = s ? tinymce.resolve(s) : 0;
    5268                     f = tinymce.resolve(f);
    5269                 }
    5270 
    5271                 return f.apply(s || this, Array.prototype.slice.call(arguments, 2));
    5272             };
    5273 
    5274             s = extend({
    5275                 theme : "simple",
    5276                 language : "en",
    5277                 strict_loading_mode : document.contentType == 'application/xhtml+xml'
    5278             }, s);
    5279 
    5280             t.settings = s;
    5281 
    5282             // If page not loaded and strict mode isn't enabled then load them
    5283             if (!Event.domLoaded && !s.strict_loading_mode) {
    5284                 // Load language
    5285                 if (s.language)
    5286                     sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
    5287 
    5288                 // Load theme
    5289                 if (s.theme && s.theme.charAt(0) != '-')
    5290                     ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
    5291 
    5292                 // Load plugins
    5293                 if (s.plugins) {
    5294                     pl = s.plugins.split(',');
    5295 
    5296                     // Load compat2x first
    5297                     if (tinymce.inArray(pl, 'compat2x') != -1)
    5298                         PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
    5299 
    5300                     // Load rest if plugins
    5301                     each(pl, function(v) {
    5302                         if (v && v.charAt(0) != '-') {
    5303                             // Skip safari plugin for other browsers
    5304                             if (!tinymce.isWebKit && v == 'safari')
    5305                                 return;
    5306 
    5307                             PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js');
    5308                         }
    5309                     });
    5310                 }
    5311 
    5312                 sl.loadQueue();
    5313             }
    5314 
    5315             // Legacy call
    5316             Event.add(document, 'init', function() {
    5317                 var l, co;
    5318 
    5319                 execCallback(s, 'onpageload');
    5320 
    5321                 // Verify that it's a valid browser
    5322                 if (s.browsers) {
    5323                     l = false;
    5324 
    5325                     each(s.browsers.split(','), function(v) {
    5326                         switch (v) {
    5327                             case 'ie':
    5328                             case 'msie':
    5329                                 if (tinymce.isIE)
    5330                                     l = true;
    5331                                 break;
    5332 
    5333                             case 'gecko':
    5334                                 if (tinymce.isGecko)
    5335                                     l = true;
    5336                                 break;
    5337 
    5338                             case 'safari':
    5339                             case 'webkit':
    5340                                 if (tinymce.isWebKit)
    5341                                     l = true;
    5342                                 break;
    5343 
    5344                             case 'opera':
    5345                                 if (tinymce.isOpera)
    5346                                     l = true;
    5347 
    5348                                 break;
    5349                         }
    5350                     });
    5351 
    5352                     // Not a valid one
    5353                     if (!l)
    5354                         return;
    5355                 }
    5356 
    5357                 switch (s.mode) {
    5358                     case "exact":
    5359                         l = s.elements || '';
    5360                         each(l.split(','), function(v) {
    5361                             new tinymce.Editor(v, s).render();
    5362                         });
    5363                         break;
    5364 
    5365                     case "textareas":
    5366                         function hasClass(n, c) {
    5367                             return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
    5368                         };
    5369 
    5370                         each(DOM.select('textarea'), function(v) {
    5371                             if (s.editor_deselector && hasClass(v, s.editor_deselector))
    5372                                 return;
    5373 
    5374                             if (!s.editor_selector || hasClass(v, s.editor_selector))
    5375                                 new tinymce.Editor(v.id = (v.id || v.name || (v.id = DOM.uniqueId())), s).render();
    5376                         });
    5377                         break;
    5378                 }
    5379 
    5380                 // Call onInit when all editors are initialized
    5381                 if (s.oninit) {
    5382                     l = co = 0;
    5383 
    5384                     each (t.editors, function(ed) {
    5385                         co++;
    5386 
    5387                         if (!ed.initialized) {
    5388                             // Wait for it
    5389                             ed.onInit.add(function() {
    5390                                 l++;
    5391 
    5392                                 // All done
    5393                                 if (l == co)
    5394                                     execCallback(s, 'oninit');
    5395                             });
    5396                         } else
    5397                             l++;
    5398 
    5399                         // All done
    5400                         if (l == co)
    5401                             execCallback(s, 'oninit');                 
    5402                     });
    5403                 }
    5404             });
    5405         },
    5406 
    5407         get : function(id) {
    5408             return this.editors[id];
    5409         },
    5410 
    5411         getInstanceById : function(id) {
    5412             return this.get(id);
    5413         },
    5414 
    5415         add : function(e) {
    5416             this.editors[e.id] = e;
    5417             this._setActive(e);
    5418 
    5419             return e;
    5420         },
    5421 
    5422         remove : function(e) {
    5423             var t = this;
    5424 
    5425             // Not in the collection
    5426             if (!t.editors[e.id])
    5427                 return null;
    5428 
    5429             delete t.editors[e.id];
    5430 
    5431             // Select another editor since the active one was removed
    5432             if (t.activeEditor == e) {
    5433                 each(t.editors, function(e) {
    5434                     t._setActive(e);
    5435                     return false; // Break
    5436                 });
    5437             }
    5438 
    5439             e._destroy();
    5440 
    5441             return e;
    5442         },
    5443 
    5444         execCommand : function(c, u, v) {
    5445             var t = this, ed = t.get(v);
    5446 
    5447             // Manager commands
    5448             switch (c) {
    5449                 case "mceFocus":
    5450                     ed.focus();
    5451                     return true;
    5452 
    5453                 case "mceAddEditor":
    5454                 case "mceAddControl":
    5455                     new tinymce.Editor(v, t.settings).render();
    5456                     return true;
    5457 
    5458                 case "mceAddFrameControl":
    5459                     // TODO: Implement this
    5460                     return true;
    5461 
    5462                 case "mceRemoveEditor":
    5463                 case "mceRemoveControl":
    5464                     ed.remove();
    5465                     return true;
    5466 
    5467                 case 'mceToggleEditor':
    5468                     if (!ed) {
    5469                         t.execCommand('mceAddControl', 0, v);
    5470                         return true;
    5471                     }
    5472 
    5473                     if (ed.isHidden())
    5474                         ed.show();
    5475                     else
    5476                         ed.hide();
    5477 
    5478                     return true;
    5479             }
    5480 
    5481             // Run command on active editor
    5482             if (t.activeEditor)
    5483                 return t.activeEditor.execCommand(c, u, v);
    5484 
    5485             return false;
    5486         },
    5487 
    5488         execInstanceCommand : function(id, c, u, v) {
    5489             var ed = this.get(id);
    5490 
    5491             if (ed)
    5492                 return ed.execCommand(c, u, v);
    5493 
    5494             return false;
    5495         },
    5496 
    5497         triggerSave : function() {
    5498             each(this.editors, function(e) {
    5499                 e.save();
    5500             });
    5501         },
    5502 
    5503         addI18n : function(p, o) {
    5504             var lo, i18n = this.i18n;
    5505 
    5506             if (!tinymce.is(p, 'string')) {
    5507                 each(p, function(o, lc) {
    5508                     each(o, function(o, g) {
    5509                         each(o, function(o, k) {
    5510                             if (g === 'common')
    5511                                 i18n[lc + '.' + k] = o;
    5512                             else
    5513                                 i18n[lc + '.' + g + '.' + k] = o;
    5514                         });
    5515                     });
    5516                 });
    5517             } else {
    5518                 each(o, function(o, k) {
    5519                     i18n[p + '.' + k] = o;
    5520                 });
    5521             }
    5522         },
    5523 
    5524         // Private methods
    5525 
    5526         _setActive : function(e) {
    5527             this.selectedInstance = this.activeEditor = e;
    5528         }
    5529 
    5530         });
    5531 
    5532     // Setup some URLs where the editor API is located and where the document is
    5533     tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
    5534     if (!/[\/\\]$/.test(tinymce.documentBaseURL))
    5535         tinymce.documentBaseURL += '/';
    5536 
    5537     tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
    5538     tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
    5539 })();
    5540 
    5541 // Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call
    5542 var tinyMCE = window.tinyMCE = tinymce.EditorManager;
    5543 
    5544 /* file:jscripts/tiny_mce/classes/Editor.js */
    5545 
    5546 (function() {
    5547     var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher;
    5548     var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit;
    5549     var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager;
    5550     var inArray = tinymce.inArray, grep = tinymce.grep;
    5551 
    5552     tinymce.create('tinymce.Editor', {
    5553         Editor : function(id, s) {
    5554             var t = this;
    5555 
    5556             t.id = t.editorId = id;
    5557             t.execCommands = {};
    5558             t.queryStateCommands = {};
    5559             t.queryValueCommands = {};
    5560             t.plugins = {};
    5561 
    5562             // Add events to the editor
    5563             each([
    5564                 'onPreInit',
    5565                 'onBeforeRenderUI',
    5566                 'onPostRender',
    5567                 'onInit',
    5568                 'onRemove',
    5569                 'onActivate',
    5570                 'onDeactivate',
    5571                 'onClick',
    5572                 'onEvent',
    5573                 'onMouseUp',
    5574                 'onMouseDown',
    5575                 'onDblClick',
    5576                 'onKeyDown',
    5577                 'onKeyUp',
    5578                 'onKeyPress',
    5579                 'onContextMenu',
    5580                 'onSubmit',
    5581                 'onReset',
    5582                 'onPaste',
    5583                 'onPreProcess',
    5584                 'onPostProcess',
    5585                 'onBeforeSetContent',
    5586                 'onBeforeGetContent',
    5587                 'onSetContent',
    5588                 'onGetContent',
    5589                 'onLoadContent',
    5590                 'onSaveContent',
    5591                 'onNodeChange',
    5592                 'onChange',
    5593                 'onBeforeExecCommand',
    5594                 'onExecCommand',
    5595                 'onUndo',
    5596                 'onRedo',
    5597                 'onVisualAid',
    5598                 'onSetProgressState'
    5599             ], function(e) {
    5600                 t[e] = new Dispatcher(t);
    5601             });
    5602 
    5603             // Default editor config
    5604             t.settings = s = extend({
    5605                 id : id,
    5606                 language : 'en',
    5607                 docs_language : 'en',
    5608                 theme : 'simple',
    5609                 skin : 'default',
    5610                 delta_width : 0,
    5611                 delta_height : 0,
    5612                 popup_css : '',
    5613                 plugins : '',
    5614                 document_base_url : tinymce.documentBaseURL,
    5615                 add_form_submit_trigger : 1,
    5616                 submit_patch : 1,
    5617                 add_unload_trigger : 1,
    5618                 convert_urls : 1,
    5619                 relative_urls : 1,
    5620                 remove_script_host : 1,
    5621                 table_inline_editing : 0,
    5622                 object_resizing : 1,
    5623                 cleanup : 1,
    5624                 accessibility_focus : 1,
    5625                 custom_shortcuts : 1,
    5626                 custom_undo_redo_keyboard_shortcuts : 1,
    5627                 custom_undo_redo_restore_selection : 1,
    5628                 custom_undo_redo : 1,
    5629                 doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
    5630                 visual_table_class : 'mceItemTable',
    5631                 visual : 1,
    5632                 inline_styles : true,
    5633                 convert_fonts_to_spans : true,
    5634                 font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
    5635                 apply_source_formatting : 1,
    5636                 directionality : 'ltr',
    5637                 forced_root_block : 'p',
    5638                 valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width|height|src|*],script[type]',
    5639                 hidden_input : 1,
    5640                 padd_empty_editor : 1,
    5641                 render_ui : 1,
    5642                 init_theme : 1,
    5643                 indentation : '30px'
    5644             }, s);
    5645 
    5646             // Setup URIs
    5647             t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
    5648                 base_uri : tinyMCE.baseURI
    5649             });
    5650             t.baseURI = EditorManager.baseURI;
    5651 
    5652             // Call setup
    5653             t.execCallback('setup', t);
    5654         },
    5655 
    5656         render : function() {
    5657             var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;
    5658 
    5659             // Element not found, then skip initialization
    5660             if (!t.getElement())
    5661                 return;
    5662 
    5663             if (s.strict_loading_mode) {
    5664                 sl.settings.strict_mode = s.strict_loading_mode;
    5665                 tinymce.DOM.settings.strict = 1;
    5666             }
    5667 
    5668             // Add hidden input for non input elements inside form elements
    5669             if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
    5670                 DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
    5671 
    5672             t.windowManager = new tinymce.WindowManager(t);
    5673 
    5674             if (s.encoding == 'xml') {
    5675                 t.onGetContent.add(function(ed, o) {
    5676                     if (o.get)
    5677                         o.content = DOM.encode(o.content);
    5678                 });
    5679             }
    5680 
    5681             if (s.add_form_submit_trigger) {
    5682                 t.onSubmit.addToTop(function() {
    5683                     if (t.initialized) {
    5684                         t.save();
    5685                         t.isNotDirty = 1;
    5686                     }
    5687                 });
    5688             }
    5689 
    5690             Event.add(document, 'unload', function() {
    5691                 if (t.initialized && !t.destroyed && s.add_unload_trigger)
    5692                     t.save({format : 'raw', no_events : true});
    5693             });
    5694 
    5695             tinymce.addUnload(t._destroy, t);
    5696 
    5697             if (s.submit_patch) {
    5698                 t.onBeforeRenderUI.add(function() {
    5699                     var n = t.getElement().form;
    5700 
    5701                     if (!n)
    5702                         return;
    5703 
    5704                     // Already patched
    5705                     if (n._mceOldSubmit)
    5706                         return;
    5707 
    5708                     // Check page uses id="submit" or name="submit" for it's submit button
    5709                     if (!n.submit.nodeType) {
    5710                         t.formElement = n;
    5711                         n._mceOldSubmit = n.submit;
    5712                         n.submit = function() {
    5713                             // Save all instances
    5714                             EditorManager.triggerSave();
    5715                             t.isNotDirty = 1;
    5716 
    5717                             return this._mceOldSubmit(this);
    5718                         };
    5719                     }
    5720 
    5721                     n = null;
    5722                 });
    5723             }
    5724 
    5725             // Load scripts
    5726             function loadScripts() {
    5727                 sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
    5728 
    5729                 if (s.theme.charAt(0) != '-')
    5730                     ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
    5731 
    5732                 each(s.plugins.split(','), function(p) {
    5733                     if (p && p.charAt(0) != '-') {
    5734                         // Skip safari plugin for other browsers
    5735                         if (!isWebKit && p == 'safari')
    5736                             return;
    5737 
    5738                         PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
    5739                     }
    5740                 });
    5741 
    5742                 // Init when que is loaded
    5743                 sl.loadQueue(function() {
    5744                     if (s.ask) {
    5745                         function ask() {
    5746                             t.windowManager.confirm(t.getLang('edit_confirm'), function(s) {
    5747                                 if (s)
    5748                                     t.init();
    5749                                 else
    5750                                     Event.remove(t.id, 'focus', ask);
    5751                             });
    5752                         };
    5753 
    5754                         Event.add(t.id, 'focus', ask);
    5755                         return;
    5756                     }
    5757 
    5758                     if (!t.removed)
    5759                         t.init();
    5760                 });
    5761             };
    5762 
    5763             // Load compat2x first
    5764             if (s.plugins.indexOf('compat2x') != -1) {
    5765                 PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
    5766                 sl.loadQueue(loadScripts);
    5767             } else
    5768                 loadScripts();
    5769         },
    5770 
    5771         init : function() {
    5772             var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti;
    5773 
    5774             EditorManager.add(t);
    5775 
    5776             // Create theme
    5777             s.theme = s.theme.replace(/-/, '');
    5778             o = ThemeManager.get(s.theme);
    5779             t.theme = new o();
    5780 
    5781             if (t.theme.init && s.init_theme)
    5782                 t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));
    5783 
    5784             // Create all plugins
    5785             each(s.plugins.replace(/\-/g, '').split(','), function(p) {
    5786                 var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;
    5787 
    5788                 if (c) {
    5789                     po = new c(t, u);
    5790 
    5791                     t.plugins[p] = po;
    5792 
    5793                     if (po.init)
    5794                         po.init(t, u);
    5795                 }
    5796             });
    5797 
    5798             // Setup popup CSS path(s)
    5799             s.popup_css = t.baseURI.toAbsolute(s.popup_css || "themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
    5800 
    5801             if (s.popup_css_add)
    5802                 s.popup_css += ',' + s.popup_css_add;
    5803 
    5804             // Setup control factory
    5805             t.controlManager = new tinymce.ControlManager(t);
    5806             t.undoManager = new tinymce.UndoManager(t);
    5807 
    5808             // Pass through
    5809             t.undoManager.onAdd.add(function(um, l) {
    5810                 return t.onChange.dispatch(t, l, um);
    5811             });
    5812 
    5813             t.undoManager.onUndo.add(function(um, l) {
    5814                 return t.onUndo.dispatch(t, l, um);
    5815             });
    5816 
    5817             t.undoManager.onRedo.add(function(um, l) {
    5818                 return t.onRedo.dispatch(t, l, um);
    5819             });
    5820 
    5821             if (s.custom_undo_redo) {
    5822                 t.onExecCommand.add(function(ed, cmd) {
    5823                     if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint')
    5824                         t.undoManager.add();
    5825                 });
    5826             }
    5827 
    5828             t.onExecCommand.add(function(ed, c) {
    5829                 // Don't refresh the select lists until caret move
    5830                 if (!/^(FontName|FontSize)$/.test(c))
    5831                     t.nodeChanged();
    5832             });
    5833 
    5834             // Remove ghost selections on images and tables in Gecko
    5835             if (isGecko) {
    5836                 function repaint() {
    5837                     t.execCommand('mceRepaint');
    5838                 };
    5839 
    5840                 t.onUndo.add(repaint);
    5841                 t.onRedo.add(repaint);
    5842                 t.onSetContent.add(repaint);
    5843             }
    5844 
    5845             // Enables users to override the control factory
    5846             t.onBeforeRenderUI.dispatch(t, t.controlManager);
    5847 
    5848             // Measure box
    5849             if (s.render_ui) {
    5850                 w = s.width || e.style.width || e.clientWidth;
    5851                 h = s.height || e.style.height || e.clientHeight;
    5852                 t.orgDisplay = e.style.display;
    5853 
    5854                 if (('' + w).indexOf('%') == -1)
    5855                     w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);
    5856 
    5857                 if (('' + h).indexOf('%') == -1)
    5858                     h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);
    5859 
    5860                 // Render UI
    5861                 o = t.theme.renderUI({
    5862                     targetNode : e,
    5863                     width : w,
    5864                     height : h,
    5865                     deltaWidth : s.delta_width,
    5866                     deltaHeight : s.delta_height
    5867                 });
    5868 
    5869                 t.editorContainer = o.editorContainer;
    5870             }
    5871 
    5872            
    5873             // Resize editor
    5874             DOM.setStyles(o.sizeContainer || o.editorContainer, {
    5875                 width : w,
    5876                 height : h
    5877             });
    5878 
    5879             h = (o.iframeHeight || h) + ((h + '').indexOf('%') == -1 ? (o.deltaHeight || 0) : '');
    5880             if (h < 100)
    5881                 h = 100;
    5882 
    5883             // Create iframe
    5884             n = DOM.add(o.iframeContainer, 'iframe', {
    5885                 id : s.id + "_ifr",
    5886                 src : 'javascript:""', // Workaround for HTTPS warning in IE6/7
    5887                 frameBorder : '0',
    5888                 style : {
    5889                     width : '100%',
    5890                     height : h
    5891                 }
    5892             });
    5893 
    5894             t.contentAreaContainer = o.iframeContainer;
    5895             DOM.get(o.editorContainer).style.display = t.orgDisplay;
    5896             DOM.get(s.id).style.display = 'none';
    5897 
    5898             // Safari 2.x requires us to wait for the load event and load a real HTML doc
    5899             if (tinymce.isOldWebKit) {
    5900                 Event.add(n, 'load', t.setupIframe, t);
    5901                 n.src = tinymce.baseURL + '/plugins/safari/blank.htm';
    5902             } else {
    5903                 t.setupIframe();
    5904                 e = n = o = null; // Cleanup
    5905             }
    5906 
    5907 /*          function createIfr() {
    5908                 h = (o.iframeHeight || h) + ((h + '').indexOf('%') == -1 ? (o.deltaHeight || 0) : '');
    5909                 if (h < 100)
    5910                     h = 100;
    5911 
    5912                 // Create iframe
    5913                 n = DOM.add(o.iframeContainer, 'iframe', {
    5914                     id : s.id + "_ifr",
    5915                     src : 'javascript:""', // Workaround for HTTPS warning in IE6/7
    5916                     frameBorder : '0',
    5917                     style : {
    5918                         width : '100%',
    5919                         height : h
    5920                     }
    5921                 });
    5922 
    5923                 t.contentAreaContainer = o.iframeContainer;
    5924                 DOM.get(o.editorContainer).style.display = t.orgDisplay;
    5925                 DOM.get(s.id).style.display = 'none';
    5926 
    5927                 // Safari 2.x requires us to wait for the load event and load a real HTML doc
    5928                 if (tinymce.isOldWebKit) {
    5929                     Event.add(n, 'load', t.setupIframe, t);
    5930                     n.src = tinymce.baseURL + '/plugins/safari/blank.htm';
    5931                 } else {
    5932                     t.setupIframe();
    5933                     e = n = o = null; // Cleanup
    5934                 }
    5935             };
    5936 */
    5937             // Waits for the editor to become visible, then it will run the init
    5938             // This method is somewhat ugly but this is the best way to deal with it without
    5939             // forcing the user to add some logic to their application.
    5940 /*          if (isGecko) {
    5941                 function check() {
    5942                     var hi;
    5943 
    5944                     DOM.getParent(t.id, function(e) {
    5945                         if (DOM.getStyle(e, 'display', true) == 'none') {
    5946                             hi = 1;
    5947                             return true;
    5948                         }
    5949                     });
    5950 
    5951                     return hi;
    5952                 };
    5953 
    5954                 if (check()) {
    5955                     ti = window.setInterval(function() {
    5956                         if (!check()) {
    5957                             createIfr();
    5958                             window.clearInterval(ti);
    5959                         }
    5960                     }, 300);
    5961 
    5962                     return;
    5963                 }
    5964             }
    5965 
    5966             createIfr();
    5967 */
    5968         },
    5969 
    5970         setupIframe : function() {
    5971             var t = this, s = t.settings, e = DOM.get(s.id), d = t.getDoc();
    5972 
    5973             // Setup body
    5974             d.open();
    5975             d.write(s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body id="tinymce" class="mceContentBody"></body></html>');
    5976             d.close();
    5977 
    5978             // Design mode needs to be added here Ctrl+A will fail otherwise
    5979             if (!isIE) {
    5980                 try {
    5981                     d.designMode = 'On';
    5982                 } catch (ex) {
    5983                     // Will fail on Gecko if the editor is placed in an hidden container element
    5984                     // The design mode will be set ones the editor is focused
    5985                 }
    5986             }
    5987 
    5988             // IE needs to use contentEditable or it will display non secure items for HTTPS
    5989             if (isIE)
    5990                 t.getBody().contentEditable = true;
    5991 
    5992             // Setup objects
    5993             t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
    5994                 keep_values : true,
    5995                 url_converter : t.convertURL,
    5996                 url_converter_scope : t,
    5997                 hex_colors : s.force_hex_style_colors,
    5998                 class_filter : s.class_filter,
    5999                 update_styles : 1
    6000             });
    6001 
    6002             t.serializer = new tinymce.dom.Serializer({
    6003                 entity_encoding : s.entity_encoding,
    6004                 entities : s.entities,
    6005                 valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
    6006                 extended_valid_elements : s.extended_valid_elements,
    6007                 valid_child_elements : s.valid_child_elements,
    6008                 invalid_elements : s.invalid_elements,
    6009                 fix_table_elements : s.fix_table_elements,
    6010                 fix_list_elements : s.fix_list_elements,
    6011                 fix_content_duplication : s.fix_content_duplication,
    6012                 convert_fonts_to_spans : s.convert_fonts_to_spans,
    6013                 font_size_classes  : s.font_size_classes,
    6014                 font_size_style_values : s.font_size_style_values,
    6015                 apply_source_formatting : s.apply_source_formatting,
    6016                 remove_linebreaks : s.remove_linebreaks,
    6017                 dom : t.dom
    6018             });
    6019 
    6020             t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
    6021             t.forceBlocks = new tinymce.ForceBlocks(t, {
    6022                 forced_root_block : s.forced_root_block
    6023             });
    6024             t.editorCommands = new tinymce.EditorCommands(t);
    6025 
    6026             // Pass through
    6027             t.serializer.onPreProcess.add(function(se, o) {
    6028                 return t.onPreProcess.dispatch(t, o, se);
    6029             });
    6030 
    6031             t.serializer.onPostProcess.add(function(se, o) {
    6032                 return t.onPostProcess.dispatch(t, o, se);
    6033             });
    6034 
    6035             t.onPreInit.dispatch(t);
    6036 
    6037             if (!s.gecko_spellcheck)
    6038                 t.getBody().spellcheck = 0;
    6039 
    6040             t._addEvents();
    6041 
    6042             t.controlManager.onPostRender.dispatch(t, t.controlManager);
    6043             t.onPostRender.dispatch(t);
    6044 
    6045             if (s.directionality)
    6046                 t.getBody().dir = s.directionality;
    6047 
    6048             if (s.nowrap)
    6049                 t.getBody().style.whiteSpace = "nowrap";
    6050 
    6051             if (s.auto_resize)
    6052                 t.onNodeChange.add(t.resizeToContent, t);
    6053 
    6054             if (s.handle_node_change_callback) {
    6055                 t.onNodeChange.add(function(ed, cm, n) {
    6056                     t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());
    6057                 });
    6058             }
    6059 
    6060             if (s.save_callback) {
    6061                 t.onSaveContent.add(function(ed, o) {
    6062                     var h = t.execCallback('save_callback', t.id, o.content, t.getBody());
    6063 
    6064                     if (h)
    6065                         o.content = h;
    6066                 });
    6067             }
    6068 
    6069             if (s.onchange_callback) {
    6070                 t.onChange.add(function(ed, l) {
    6071                     t.execCallback('onchange_callback', t, l);
    6072                 });
    6073             }
    6074 
    6075             if (s.convert_newlines_to_brs) {
    6076                 t.onBeforeSetContent.add(function(ed, o) {
    6077                     if (o.initial)
    6078                         o.content = o.content.replace(/\r?\n/g, '<br />');
    6079                 });
    6080             }
    6081 
    6082             if (s.fix_nesting && isIE) {
    6083                 t.onBeforeSetContent.add(function(ed, o) {
    6084                     o.content = t._fixNesting(o.content);
    6085                 });
    6086             }
    6087 
    6088             if (s.preformatted) {
    6089                 t.onPostProcess.add(function(ed, o) {
    6090                     o.content = o.content.replace(/^\s*<pre.*?>/, '');
    6091                     o.content = o.content.replace(/<\/pre>\s*$/, '');
    6092 
    6093                     if (o.set)
    6094                         o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';
    6095                 });
    6096             }
    6097 
    6098             if (s.verify_css_classes) {
    6099                 t.serializer.attribValueFilter = function(n, v) {
    6100                     var s, cl;
    6101 
    6102                     if (n == 'class') {
    6103                         // Build regexp for classes
    6104                         if (!t.classesRE) {
    6105                             cl = t.dom.getClasses();
    6106 
    6107                             if (cl.length > 0) {
    6108                                 s = '';
    6109 
    6110                                 each (cl, function(o) {
    6111                                     s += (s ? '|' : '') + o['class'];
    6112                                 });
    6113 
    6114                                 t.classesRE = new RegExp('(' + s + ')', 'gi');
    6115                             }
    6116                         }
    6117 
    6118                         return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';
    6119                     }
    6120 
    6121                     return v;
    6122                 };
    6123             }
    6124 
    6125             if (s.convert_fonts_to_spans)
    6126                 t._convertFonts();
    6127 
    6128             if (s.inline_styles)
    6129                 t._convertInlineElements();
    6130 
    6131             if (s.cleanup_callback) {
    6132                 t.onSetContent.add(function(ed, o) {
    6133                     if (o.initial) {
    6134                         t.setContent(t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o), {format : 'raw', no_events : true});
    6135                         t.execCallback('cleanup_callback', 'insert_to_editor_dom', t.getDoc(), o);
    6136                     }
    6137                 });
    6138 
    6139                 t.onPreProcess.add(function(ed, o) {
    6140                     if (o.set)
    6141                         t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);
    6142 
    6143                     if (o.get)
    6144                         t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);
    6145                 });
    6146 
    6147                 t.onPostProcess.add(function(ed, o) {
    6148                     if (o.set)
    6149                         o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
    6150 
    6151                     if (o.get)                     
    6152                         o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);
    6153                 });
    6154             }
    6155 
    6156             if (s.save_callback) {
    6157                 t.onGetContent.add(function(ed, o) {
    6158                     if (o.save)
    6159                         o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());
    6160                 });
    6161             }
    6162 
    6163             if (s.handle_event_callback) {
    6164                 t.onEvent.add(function(ed, e, o) {
    6165                     if (t.execCallback('handle_event_callback', e, ed, o) === false)
    6166                         Event.cancel(e);
    6167                 });
    6168             }
    6169 
    6170             t.onSetContent.add(function() {
    6171                 // Safari needs some time, it will crash the browser when a link is created otherwise
    6172                 // I think this crash issue is resolved in the latest 3.0.4
    6173                 //window.setTimeout(function() {
    6174                     t.addVisual(t.getBody());
    6175                 //}, 1);
    6176             });
    6177 
    6178             // Remove empty contents
    6179             if (s.padd_empty_editor) {
    6180                 t.onPostProcess.add(function(ed, o) {
    6181                     o.content = o.content.replace(/^<p>(&nbsp;|#160;|\s)<\/p>$/, '');
    6182                 });
    6183             }
    6184 
    6185             // A small timeout was needed since firefox will remove. Bug: #1838304
    6186             setTimeout(function () {
    6187                 if (t.removed)
    6188                     return;
    6189 
    6190                 t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
    6191                 t.startContent = t.getContent({format : 'raw'});
    6192                 t.undoManager.add({initial : true});
    6193                 t.initialized = true;
    6194 
    6195                 t.onInit.dispatch(t);
    6196                 t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());
    6197                 t.execCallback('init_instance_callback', t);
    6198                 t.focus(true);
    6199                 t.nodeChanged({initial : 1});
    6200 
    6201                 // Load specified content CSS last
    6202                 if (s.content_css) {
    6203                     tinymce.each(s.content_css.split(','), function(u) {
    6204                         t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
    6205                     });
    6206                 }
    6207 
    6208                 // Handle auto focus
    6209                 if (s.auto_focus) {
    6210                     setTimeout(function () {
    6211                         var ed = EditorManager.get(s.auto_focus);
    6212 
    6213                         ed.selection.select(ed.getBody(), 1);
    6214                         ed.selection.collapse(1);
    6215                         ed.getWin().focus();
    6216                     }, 100);
    6217                 }
    6218             }, 1);
    6219 
    6220             e = null;
    6221         },
    6222 
    6223        
    6224         focus : function(sf) {
    6225             var oed, t = this;
    6226 
    6227             if (!sf) {
    6228                 t.getWin().focus();
    6229 
    6230                             }
    6231 
    6232             if (EditorManager.activeEditor != t) {
    6233                 if ((oed = EditorManager.activeEditor) != null)
    6234                     oed.onDeactivate.dispatch(oed, t);
    6235 
    6236                 t.onActivate.dispatch(t, oed);
    6237             }
    6238 
    6239             EditorManager._setActive(t);
    6240         },
    6241 
    6242         execCallback : function(n) {
    6243             var t = this, f = t.settings[n], s;
    6244 
    6245             if (!f)
    6246                 return;
    6247 
    6248             // Look through lookup
    6249             if (t.callbackLookup && (s = t.callbackLookup[n])) {
    6250                 f = s.func;
    6251                 s = s.scope;
    6252             }
    6253 
    6254             if (is(f, 'string')) {
    6255                 s = f.replace(/\.\w+$/, '');
    6256                 s = s ? tinymce.resolve(s) : 0;
    6257                 f = tinymce.resolve(f);
    6258                 t.callbackLookup = t.callbackLookup || {};
    6259                 t.callbackLookup[n] = {func : f, scope : s};
    6260             }
    6261 
    6262             return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
    6263         },
    6264 
    6265         translate : function(s) {
    6266             var c = this.settings.language, i18n = EditorManager.i18n;
    6267 
    6268             if (!s)
    6269                 return '';
    6270 
    6271             return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
    6272                 return i18n[c + '.' + b] || '{#' + b + '}';
    6273             });
    6274         },
    6275 
    6276         getLang : function(n, dv) {
    6277             return EditorManager.i18n[this.settings.language + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
    6278         },
    6279 
    6280         getParam : function(n, dv) {
    6281             return is(this.settings[n]) ? this.settings[n] : dv;
    6282         },
    6283 
    6284         nodeChanged : function(o) {
    6285             var t = this, s = t.selection, n = s.getNode() || this.getBody();
    6286 
    6287             this.onNodeChange.dispatch(
    6288                 t,
    6289                 o ? o.controlManager || t.controlManager : t.controlManager,
    6290                 isIE && n.ownerDocument != t.getDoc() ? this.getBody() : n, // Fix for IE initial state
    6291                 s.isCollapsed(),
    6292                 o
    6293             );
    6294         },
    6295 
    6296         addButton : function(n, s) {
    6297             var t = this;
    6298 
    6299             t.buttons = t.buttons || {};
    6300             t.buttons[n] = s;
    6301         },
    6302 
    6303         addCommand : function(n, f, s) {
    6304             this.execCommands[n] = {func : f, scope : s || this};
    6305         },
    6306 
    6307         addQueryStateHandler : function(n, f, s) {
    6308             this.queryStateCommands[n] = {func : f, scope : s || this};
    6309         },
    6310 
    6311         addQueryValueHandler : function(n, f, s) {
    6312             this.queryValueCommands[n] = {func : f, scope : s || this};
    6313         },
    6314 
    6315         addShortcut : function(pa, desc, cmd_func, sc) {
    6316             var t = this, c;
    6317 
    6318             if (!t.settings.custom_shortcuts)
    6319                 return false;
    6320 
    6321             t.shortcuts = t.shortcuts || {};
    6322 
    6323             if (is(cmd_func, 'string')) {
    6324                 c = cmd_func;
    6325 
    6326                 cmd_func = function() {
    6327                     t.execCommand(c, false, null);
    6328                 };
    6329             }
    6330 
    6331             if (is(cmd_func, 'object')) {
    6332                 c = cmd_func;
    6333 
    6334                 cmd_func = function() {
    6335                     t.execCommand(c[0], c[1], c[2]);
    6336                 };
    6337             }
    6338 
    6339             each(pa.split(','), function(pa) {
    6340                 var o = {
    6341                     func : cmd_func,
    6342                     scope : sc || this,
    6343                     desc : desc,
    6344                     alt : false,
    6345                     ctrl : false,
    6346                     shift : false
    6347                 };
    6348 
    6349                 each(pa.split('+'), function(v) {
    6350                     switch (v) {
    6351                         case 'alt':
    6352                         case 'ctrl':
    6353                         case 'shift':
    6354                             o[v] = true;
    6355                             break;
    6356 
    6357                         default:
    6358                             o.charCode = v.charCodeAt(0);
    6359                             o.keyCode = v.toUpperCase().charCodeAt(0);
    6360                     }
    6361                 });
    6362 
    6363                 t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;
    6364             });
    6365 
    6366             return true;
    6367         },
    6368 
    6369         execCommand : function(cmd, ui, val, a) {
    6370             var t = this, s = 0, o;
    6371 
    6372             if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))
    6373                 t.focus();
    6374 
    6375             o = {};
    6376             t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);
    6377             if (o.terminate)
    6378                 return false;
    6379 
    6380             // Comamnd callback
    6381             if (t.execCallback('execcommand_callback', null, t.id, t.selection.getNode(), cmd, ui, val)) {
    6382                 t.onExecCommand.dispatch(t, cmd, ui, val);
    6383                 return true;
    6384             }
    6385 
    6386             // Registred commands
    6387             if (o = t.execCommands[cmd]) {
    6388                 s = o.func.call(o.scope, ui, val);
    6389                 t.onExecCommand.dispatch(t, cmd, ui, val);
    6390                 return s;
    6391             }
    6392 
    6393             // Plugin commands
    6394             each(t.plugins, function(p) {
    6395                 if (p.execCommand && p.execCommand(cmd, ui, val)) {
    6396                     t.onExecCommand.dispatch(t, cmd, ui, val);
    6397                     s = 1;
    6398                     return false;
    6399                 }
    6400             });
    6401 
    6402             if (s)
    6403                 return true;
    6404 
    6405             // Theme commands
    6406             if (t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {
    6407                 t.onExecCommand.dispatch(t, cmd, ui, val);
    6408                 return true;
    6409             }
    6410 
    6411             // Editor commands
    6412             if (t.editorCommands.execCommand(cmd, ui, val)) {
    6413                 t.onExecCommand.dispatch(t, cmd, ui, val);
    6414                 return true;
    6415             }
    6416 
    6417             // Browser commands
    6418             t.getDoc().execCommand(cmd, ui, val);
    6419             t.onExecCommand.dispatch(t, cmd, ui, val);
    6420         },
    6421 
    6422         queryCommandState : function(c) {
    6423             var t = this, o;
    6424 
    6425             // Is hidden then return undefined
    6426             if (t._isHidden())
    6427                 return;
    6428 
    6429             // Registred commands
    6430             if (o = t.queryStateCommands[c])
    6431                 return o.func.call(o.scope);
    6432 
    6433             // Registred commands
    6434             o = t.editorCommands.queryCommandState(c);
    6435             if (o !== -1)
    6436                 return o;
    6437 
    6438             // Browser commands
    6439             return this.getDoc().queryCommandState(c);
    6440         },
    6441 
    6442         queryCommandValue : function(c) {
    6443             var t = this, o;
    6444 
    6445             // Is hidden then return undefined
    6446             if (t._isHidden())
    6447                 return;
    6448 
    6449             // Registred commands
    6450             if (o = t.queryValueCommands[c])
    6451                 return o.func.call(o.scope);
    6452 
    6453             // Registred commands
    6454             o = t.editorCommands.queryCommandValue(c);
    6455             if (is(o))
    6456                 return o;
    6457 
    6458             // Browser commands
    6459             return this.getDoc().queryCommandValue(c);
    6460         },
    6461 
    6462         show : function() {
    6463             var t = this;
    6464 
    6465             DOM.show(t.getContainer());
    6466             DOM.hide(t.id);
    6467             t.load();
    6468         },
    6469 
    6470         hide : function() {
    6471             var t = this, s = t.settings, d = t.getDoc();
    6472 
    6473             // Fixed bug where IE has a blinking cursor left from the editor
    6474             if (isIE && d)
    6475                 d.execCommand('SelectAll');
    6476 
    6477             DOM.hide(t.getContainer());
    6478             DOM.setStyle(s.id, 'display', t.orgDisplay);
    6479             t.save();
    6480         },
    6481 
    6482         isHidden : function() {
    6483             return !DOM.isHidden(this.id);
    6484         },
    6485 
    6486         setProgressState : function(b, ti, o) {
    6487             this.onSetProgressState.dispatch(this, b, ti, o);
    6488 
    6489             return b;
    6490         },
    6491 
    6492         remove : function() {
    6493             var t = this;
    6494 
    6495             t.removed = 1; // Cancels post remove event execution
    6496             t.hide();
    6497             DOM.remove(t.getContainer());
    6498 
    6499             t.execCallback('remove_instance_callback', t);
    6500             t.onRemove.dispatch(t);
    6501 
    6502             EditorManager.remove(t);
    6503         },
    6504 
    6505         resizeToContent : function() {
    6506             var t = this;
    6507 
    6508             DOM.setStyle(t.id + "_ifr", 'height', t.getBody().scrollHeight);
    6509         },
    6510 
    6511         load : function(o) {
    6512             var t = this, e = t.getElement(), h;
    6513 
    6514             o = o || {};
    6515             o.load = true;
    6516 
    6517             h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
    6518             o.element = e;
    6519 
    6520             if (!o.no_events)
    6521                 t.onLoadContent.dispatch(t, o);
    6522 
    6523             o.element = e = null;
    6524 
    6525             return h;
    6526         },
    6527 
    6528         save : function(o) {
    6529             var t = this, e = t.getElement(), h, f;
    6530 
    6531             if (!t.initialized)
    6532                 return;
    6533 
    6534             o = o || {};
    6535             o.save = true;
    6536 
    6537             o.element = e;
    6538             h = o.content = t.getContent(o);
    6539 
    6540             if (!o.no_events)
    6541                 t.onSaveContent.dispatch(t, o);
    6542 
    6543             h = o.content;
    6544 
    6545             if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {
    6546                 e.innerHTML = h;
    6547 
    6548                 // Update hidden form element
    6549                 if (f = DOM.getParent(t.id, 'form')) {
    6550                     each(f.elements, function(e) {
    6551                         if (e.name == t.id) {
    6552                             e.value = h;
    6553                             return false;
    6554                         }
    6555                     });
    6556                 }
    6557             } else
    6558                 e.value = h;
    6559 
    6560             o.element = e = null;
    6561 
    6562             return h;
    6563         },
    6564 
    6565         setContent : function(h, o) {
    6566             var t = this;
    6567 
    6568             o = o || {};
    6569             o.format = o.format || 'html';
    6570             o.set = true;
    6571             o.content = h;
    6572 
    6573             if (!o.no_events)
    6574                 t.onBeforeSetContent.dispatch(t, o);
    6575 
    6576             // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
    6577             // It will also be impossible to place the caret in the editor unless there is a BR element present
    6578             if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
    6579                 o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />', 1);
    6580                 o.format = 'raw';
    6581             }
    6582 
    6583             o.content = t.dom.setHTML(t.getBody(), o.content);
    6584 
    6585             if (o.format != 'raw' && t.settings.cleanup) {
    6586                 o.getInner = true;
    6587                 o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));
    6588             }
    6589 
    6590             if (!o.no_events)
    6591                 t.onSetContent.dispatch(t, o);
    6592 
    6593             return o.content;
    6594         },
    6595 
    6596         getContent : function(o) {
    6597             var t = this, h;
    6598 
    6599             o = o || {};
    6600             o.format = o.format || 'html';
    6601             o.get = true;
    6602 
    6603             if (!o.no_events)
    6604                 t.onBeforeGetContent.dispatch(t, o);
    6605 
    6606             if (o.format != 'raw' && t.settings.cleanup) {
    6607                 o.getInner = true;
    6608                 h = t.serializer.serialize(t.getBody(), o);
    6609             } else
    6610                 h = t.getBody().innerHTML;
    6611 
    6612             h = h.replace(/^\s*|\s*$/g, '');
    6613             o = {content : h};
    6614             t.onGetContent.dispatch(t, o);
    6615 
    6616             return o.content;
    6617         },
    6618 
    6619         isDirty : function() {
    6620             var t = this;
    6621 
    6622             return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;
    6623         },
    6624 
    6625         getContainer : function() {
    6626             var t = this;
    6627 
    6628             if (!t.container)
    6629                 t.container = DOM.get(t.editorContainer || t.id + '_parent');
    6630 
    6631             return t.container;
    6632         },
    6633 
    6634         getContentAreaContainer : function() {
    6635             return this.contentAreaContainer;
    6636         },
    6637 
    6638         getElement : function() {
    6639             return DOM.get(this.settings.content_element || this.id);
    6640         },
    6641 
    6642         getWin : function() {
    6643             var t = this, e;
    6644 
    6645             if (!t.contentWindow) {
    6646                 e = DOM.get(t.id + "_ifr");
    6647 
    6648                 if (e)
    6649                     t.contentWindow = e.contentWindow;
    6650             }
    6651 
    6652             return t.contentWindow;
    6653         },
    6654 
    6655         getDoc : function() {
    6656             var t = this, w;
    6657 
    6658             if (!t.contentDocument) {
    6659                 w = this.getWin();
    6660 
    6661                 if (w)
    6662                     t.contentDocument = w.document;
    6663             }
    6664 
    6665             return t.contentDocument;
    6666         },
    6667 
    6668         getBody : function() {
    6669             return this.bodyElement || this.getDoc().body;
    6670         },
    6671 
    6672         convertURL : function(u, n, e) {
    6673             var t = this, s = t.settings;
    6674 
    6675             // Use callback instead
    6676             if (s.urlconverter_callback)
    6677                 return t.execCallback('urlconverter_callback', u, e, true, n);
    6678 
    6679             // Don't convert link href since thats the CSS files that gets loaded into the editor
    6680             if (!s.convert_urls || (e && e.nodeName == 'LINK'))
    6681                 return u;
    6682 
    6683             // Convert to relative
    6684             if (s.relative_urls)
    6685                 return t.documentBaseURI.toRelative(u);
    6686 
    6687             // Convert to absolute
    6688             u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);
    6689 
    6690             return u;
    6691         },
    6692 
    6693         addVisual : function(e) {
    6694             var t = this, s = t.settings;
    6695 
    6696             e = e || t.getBody();
    6697 
    6698             if (!is(t.hasVisual))
    6699                 t.hasVisual = s.visual;
    6700 
    6701             each(t.dom.select('table,a', e), function(e) {
    6702                 var v;
    6703 
    6704                 switch (e.nodeName) {
    6705                     case 'TABLE':
    6706                         v = t.dom.getAttrib(e, 'border');
    6707 
    6708                         if (!v || v == '0') {
    6709                             if (t.hasVisual)
    6710                                 t.dom.addClass(e, s.visual_table_class);
    6711                             else
    6712                                 t.dom.removeClass(e, s.visual_table_class);
    6713                         }
    6714 
    6715                         return;
    6716 
    6717                     case 'A':
    6718                         v = t.dom.getAttrib(e, 'name');
    6719 
    6720                         if (v) {
    6721                             if (t.hasVisual)
    6722                                 t.dom.addClass(e, 'mceItemAnchor');
    6723                             else
    6724                                 t.dom.removeClass(e, 'mceItemAnchor');
    6725                         }
    6726 
    6727                         return;
    6728                 }
    6729             });
    6730 
    6731             t.onVisualAid.dispatch(t, e, t.hasVisual);
    6732         },
    6733 
    6734         // Internal functions
    6735 
    6736         _addEvents : function() {
    6737             // 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
    6738             var t = this, i, s = t.settings, lo = {
    6739                 mouseup : 'onMouseUp',
    6740                 mousedown : 'onMouseDown',
    6741                 click : 'onClick',
    6742                 keyup : 'onKeyUp',
    6743                 keydown : 'onKeyDown',
    6744                 keypress : 'onKeyPress',
    6745                 submit : 'onSubmit',
    6746                 reset : 'onReset',
    6747                 contextmenu : 'onContextMenu',
    6748                 dblclick : 'onDblClick',
    6749                 paste : 'onPaste' // Doesn't work in all browsers yet
    6750             };
    6751 
    6752             function eventHandler(e, o) {
    6753                 var ty = e.type;
    6754 
    6755                 // Don't fire events when it's removed
    6756                 if (t.removed)
    6757                     return;
    6758 
    6759                 // Generic event handler
    6760                 if (t.onEvent.dispatch(t, e, o) !== false) {
    6761                     // Specific event handler
    6762                     t[lo[e.fakeType || e.type]].dispatch(t, e, o);
    6763                 }
    6764             };
    6765 
    6766             // Add DOM events
    6767             each(lo, function(v, k) {
    6768                 switch (k) {
    6769                     case 'contextmenu':
    6770                         if (tinymce.isOpera) {
    6771                             // Fake contextmenu on Opera
    6772                             Event.add(t.getDoc(), 'mousedown', function(e) {
    6773                                 if (e.ctrlKey) {
    6774                                     e.fakeType = 'contextmenu';
    6775                                     eventHandler(e);
    6776                                 }
    6777                             });
    6778                         } else
    6779                             Event.add(t.getDoc(), k, eventHandler);
    6780                         break;
    6781 
    6782                     case 'paste':
    6783                         Event.add(t.getBody(), k, function(e) {
    6784                             var tx, h, el, r;
    6785 
    6786                             // Get plain text data
    6787                             if (e.clipboardData)
    6788                                 tx = e.clipboardData.getData('text/plain');
    6789                             else if (tinymce.isIE)
    6790                                 tx = t.getWin().clipboardData.getData('Text');
    6791 
    6792                             // Get HTML data
    6793                             /*if (tinymce.isIE) {
    6794                                 el = DOM.add(document.body, 'div', {style : 'visibility:hidden;overflow:hidden;position:absolute;width:1px;height:1px'});
    6795                                 r = document.body.createTextRange();
    6796                                 r.moveToElementText(el);
    6797                                 r.execCommand('Paste');
    6798                                 h = el.innerHTML;
    6799                                 DOM.remove(el);
    6800                             }*/
    6801 
    6802                             eventHandler(e, {text : tx, html : h});
    6803                         });
    6804                         break;
    6805 
    6806                     case 'submit':
    6807                     case 'reset':
    6808                         Event.add(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
    6809                         break;
    6810 
    6811                     default:
    6812                         Event.add(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
    6813                 }
    6814             });
    6815 
    6816             Event.add(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
    6817                 t.focus(true);
    6818             });
    6819 
    6820             // Fixes bug where a specified document_base_uri could result in broken images
    6821             // This will also fix drag drop of images in Gecko
    6822             if (tinymce.isGecko) {
    6823                 // Convert all images to absolute URLs
    6824 /*              t.onSetContent.add(function(ed, o) {
    6825                     each(ed.dom.select('img'), function(e) {
    6826                         var v;
    6827 
    6828                         if (v = e.getAttribute('mce_src'))
    6829                             e.src = t.documentBaseURI.toAbsolute(v);
    6830                     })
    6831                 });*/
    6832 
    6833                 Event.add(t.getDoc(), 'DOMNodeInserted', function(e) {
    6834                     var v;
    6835 
    6836                     e = e.target;
    6837 
    6838                     if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src')))
    6839                         e.src = t.documentBaseURI.toAbsolute(v);
    6840                 });
    6841             }
    6842 
    6843             // Set various midas options in Gecko
    6844             if (isGecko) {
    6845                 function setOpts() {
    6846                     var t = this, d = t.getDoc(), s = t.settings;
    6847 
    6848                     if (isGecko) {
    6849                         if (t._isHidden()) {
    6850                             try {
    6851                                 d.designMode = 'On';
    6852                             } catch (ex) {
    6853                                 // Fails if it's hidden
    6854                             }
    6855                         }
    6856 
    6857                         try {
    6858                             // Try new Gecko method
    6859                             d.execCommand("styleWithCSS", 0, false);
    6860                         } catch (ex) {
    6861                             // Use old method
    6862                             if (!t._isHidden())
    6863                                 d.execCommand("useCSS", 0, true);
    6864                         }
    6865 
    6866                         if (!s.table_inline_editing)
    6867                             try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
    6868 
    6869                         if (!s.object_resizing)
    6870                             try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
    6871                     }
    6872                 };
    6873 
    6874                 t.onBeforeExecCommand.add(setOpts);
    6875                 t.onMouseDown.add(setOpts);
    6876             }
    6877 
    6878             // Add node change handlers
    6879             t.onMouseUp.add(t.nodeChanged);
    6880             t.onClick.add(t.nodeChanged);
    6881             t.onKeyUp.add(function(ed, e) {
    6882                 if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.keyCode == 46 || e.keyCode == 8 || e.ctrlKey)
    6883                     t.nodeChanged();
    6884             });
    6885 
    6886             // Add reset handler
    6887             t.onReset.add(function() {
    6888                 t.setContent(t.startContent, {format : 'raw'});
    6889             });
    6890 
    6891             if (t.getParam('tab_focus')) {
    6892                 function tabCancel(ed, e) {
    6893                     if (e.keyCode === 9)
    6894                         return Event.cancel(e);
    6895                 };
    6896 
    6897                 function tabHandler(ed, e) {
    6898                     var v, f, el;
    6899 
    6900                     if (e.keyCode === 9) {
    6901                         v = ed.getParam('tab_focus');
    6902 
    6903                         if (v == ':next') {
    6904                             f = DOM.getParent(ed.id, 'form');
    6905 
    6906                             if (f) {
    6907                                 each(f.elements, function(e, i) {
    6908                                     if (e.id == ed.id)
    6909                                         el = f.elements[i + 1];
    6910                                 });
    6911                             }
    6912                         } else
    6913                             el = DOM.get(v);
    6914 
    6915                         if (el) {
    6916                             window.setTimeout(function() {window.focus();el.focus();}, 10);
    6917                             return Event.cancel(e);
    6918                         }
    6919                     }
    6920                 };
    6921 
    6922                 t.onKeyUp.add(tabCancel);
    6923 
    6924                 if (isGecko) {
    6925                     t.onKeyPress.add(tabHandler);
    6926                     t.onKeyDown.add(tabCancel);
    6927                 } else
    6928                     t.onKeyDown.add(tabHandler);
    6929             }
    6930 
    6931             // Add shortcuts
    6932             if (s.custom_shortcuts) {
    6933                 if (s.custom_undo_redo_keyboard_shortcuts) {
    6934                     t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');
    6935                     t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');
    6936                 }
    6937 
    6938                 // Add default shortcuts for gecko
    6939                 if (isGecko) {
    6940                     t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');
    6941                     t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');
    6942                     t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');
    6943                 }
    6944 
    6945                 // BlockFormat shortcuts keys
    6946                 for (i=1; i<=6; i++)
    6947                     t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']);
    6948 
    6949                 t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
    6950                 t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
    6951                 t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);
    6952 
    6953                 function find(e) {
    6954                     var v = null;
    6955 
    6956                     if (!e.altKey && !e.ctrlKey && !e.metaKey)
    6957                         return v;
    6958 
    6959                     each(t.shortcuts, function(o) {
    6960                         if (o.ctrl != e.ctrlKey && (!tinymce.isMac || o.ctrl == e.metaKey))
    6961                             return;
    6962 
    6963                         if (o.alt != e.altKey)
    6964                             return;
    6965 
    6966                         if (o.shift != e.shiftKey)
    6967                             return;
    6968 
    6969                         if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
    6970                             v = o;
    6971                             return false;
    6972                         }
    6973                     });
    6974 
    6975                     return v;
    6976                 };
    6977 
    6978                 t.onKeyUp.add(function(ed, e) {
    6979                     var o = find(e);
    6980 
    6981                     if (o)
    6982                         return Event.cancel(e);
    6983                 });
    6984 
    6985                 t.onKeyPress.add(function(ed, e) {
    6986                     var o = find(e);
    6987 
    6988                     if (o)
    6989                         return Event.cancel(e);
    6990                 });
    6991 
    6992                 t.onKeyDown.add(function(ed, e) {
    6993                     var o = find(e);
    6994 
    6995                     if (o) {
    6996                         o.func.call(o.scope);
    6997                         return Event.cancel(e);
    6998                     }
    6999                 });
    7000             }
    7001 
    7002             if (tinymce.isIE) {
    7003                 // Fix so resize will only update the width and height attributes not the styles of an image
    7004                 // It will also block mceItemNoResize items
    7005                 Event.add(t.getDoc(), 'controlselect', function(e) {
    7006                     var re = t.resizeInfo, cb;
    7007 
    7008                     e = e.target;
    7009 
    7010                     if (re)
    7011                         Event.remove(re.node, re.ev, re.cb);
    7012 
    7013                     if (!t.dom.hasClass(e, 'mceItemNoResize')) {
    7014                         ev = 'resizeend';
    7015                         cb = Event.add(e, ev, function(e) {
    7016                             var v;
    7017 
    7018                             e = e.target;
    7019 
    7020                             if (v = t.dom.getStyle(e, 'width')) {
    7021                                 t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
    7022                                 t.dom.setStyle(e, 'width', '');
    7023                             }
    7024 
    7025                             if (v = t.dom.getStyle(e, 'height')) {
    7026                                 t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
    7027                                 t.dom.setStyle(e, 'height', '');
    7028                             }
    7029                         });
    7030                     } else {
    7031                         ev = 'resizestart';
    7032                         cb = Event.add(e, 'resizestart', Event.cancel, Event);
    7033                     }
    7034 
    7035                     re = t.resizeInfo = {
    7036                         node : e,
    7037                         ev : ev,
    7038                         cb : cb
    7039                     };
    7040                 });
    7041 
    7042                 t.onKeyDown.add(function(ed, e) {
    7043                     switch (e.keyCode) {
    7044                         case 8:
    7045                             // Fix IE control + backspace browser bug
    7046                             if (t.selection.getRng().item) {
    7047                                 t.selection.getRng().item(0).removeNode();
    7048                                 return Event.cancel(e);
    7049                             }
    7050                     }
    7051                 });
    7052             }
    7053 
    7054             if (tinymce.isOpera) {
    7055                 t.onClick.add(function(ed, e) {
    7056                     Event.prevent(e);
    7057                 });
    7058             }
    7059 
    7060             // Add custom undo/redo handlers
    7061             if (s.custom_undo_redo) {
    7062                 function addUndo() {
    7063                     t.undoManager.typing = 0;
    7064                     t.undoManager.add();
    7065                 };
    7066 
    7067                 // Add undo level on editor blur
    7068                 if (tinymce.isIE) {
    7069                     Event.add(t.getWin(), 'blur', function(e) {
    7070                         var n;
    7071 
    7072                         // Check added for fullscreen bug
    7073                         if (t.selection) {
    7074                             n = t.selection.getNode();
    7075 
    7076                             // Add undo level is selection was lost to another document
    7077                             if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc())
    7078                                 addUndo();
    7079                         }
    7080                     });
    7081                 } else {
    7082                     Event.add(t.getDoc(), 'blur', function() {
    7083                         if (t.selection && !t.removed)
    7084                             addUndo();
    7085                     });
    7086                 }
    7087 
    7088                 t.onMouseDown.add(addUndo);
    7089 
    7090                 t.onKeyUp.add(function(ed, e) {
    7091                     if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) {
    7092                         t.undoManager.typing = 0;
    7093                         t.undoManager.add();
    7094                     }
    7095                 });
    7096 
    7097                 t.onKeyDown.add(function(ed, e) {
    7098                     // Is caracter positon keys
    7099                     if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
    7100                         if (t.undoManager.typing) {
    7101                             t.undoManager.add();
    7102                             t.undoManager.typing = 0;
    7103                         }
    7104 
    7105                         return;
    7106                     }
    7107 
    7108                     if (!t.undoManager.typing) {
    7109                         t.undoManager.add();
    7110                         t.undoManager.typing = 1;
    7111                     }
    7112                 });
    7113             }
    7114         },
    7115 
    7116         _destroy : function() {
    7117             var t = this;
    7118 
    7119             if (t.formElement) {
    7120                 t.formElement.submit = t.formElement._mceOldSubmit;
    7121                 t.formElement._mceOldSubmit = null;
    7122             }
    7123 
    7124             t.contentAreaContainer = t.formElement = t.container = t.contentDocument = t.contentWindow = null;
    7125 
    7126             if (t.selection)
    7127                 t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
    7128 
    7129             t.destroyed = 1;
    7130         },
    7131 
    7132         _convertInlineElements : function() {
    7133             var t = this, s = t.settings, dom = t.dom;
    7134 
    7135             function convert(ed, o) {
    7136                 if (!s.inline_styles)
    7137                     return;
    7138 
    7139                 if (o.get) {
    7140                     each(t.dom.select('table,u,strike', o.node), function(n) {
    7141                         switch (n.nodeName) {
    7142                             case 'TABLE':
    7143                                 if (v = dom.getAttrib(n, 'height')) {
    7144                                     dom.setStyle(n, 'height', v);
    7145                                     dom.setAttrib(n, 'height', '');
    7146                                 }
    7147                                 break;
    7148 
    7149                             case 'U':
    7150                                 dom.replace(dom.create('span', {style : 'text-decoration: underline;'}), n, 1);
    7151                                 break;
    7152 
    7153                             case 'STRIKE':
    7154                                 dom.replace(dom.create('span', {style : 'text-decoration: line-through;'}), n, 1);
    7155                                 break;
    7156                         }
    7157                     });
    7158                 } else if (o.set) {
    7159                     each(t.dom.select('table,span', o.node), function(n) {
    7160                         if (n.nodeName == 'TABLE') {
    7161                             if (v = dom.getStyle(n, 'height'))
    7162                                 dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, ''));
    7163                         } else {
    7164                             // Convert spans to elements
    7165                             if (n.style.textDecoration == 'underline')
    7166                                 dom.replace(dom.create('u'), n, 1);
    7167                             else if (n.style.textDecoration == 'line-through')
    7168                                 dom.replace(dom.create('strike'), n, 1);
    7169                         }
    7170                     });
    7171                 }
    7172             };
    7173 
    7174             t.onPreProcess.add(convert);
    7175 
    7176             if (!s.cleanup_on_startup) {
    7177                 t.onInit.add(function() {
    7178                     convert(t, {node : t.getBody(), set : 1});
    7179                 });
    7180             }
    7181         },
    7182 
    7183         _convertFonts : function() {
    7184             var t = this, s = t.settings, dom = t.dom, sl, cl, fz, fzn, v, i;
    7185 
    7186             // Font pt values and font size names
    7187             fz = [8, 10, 12, 14, 18, 24, 36];
    7188             fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
    7189 
    7190             if (sl = s.font_size_style_values)
    7191                 sl = sl.split(',');
    7192 
    7193             if (cl = s.font_size_classes)
    7194                 cl = cl.split(',');
    7195 
    7196             t.onPreProcess.add(function(ed, o) {
    7197                 if (!s.inline_styles)
    7198                     return;
    7199 
    7200                 if (o.set) {
    7201                     // Convert spans to fonts on non WebKit browsers
    7202                     if (tinymce.isWebKit)
    7203                         return;
    7204 
    7205                     each(t.dom.select('span', o.node), function(n) {
    7206                         var f = dom.create('font', {
    7207                             color : dom.toHex(dom.getStyle(n, 'color')),
    7208                             face : dom.getStyle(n, 'fontFamily')
    7209                         });
    7210 
    7211                         if (sl) {
    7212                             i = inArray(sl, dom.getStyle(n, 'fontSize'));
    7213 
    7214                             if (i != -1)
    7215                                 dom.setAttrib(f, 'size', '' + (i + 1 || 1));
    7216                         } else if (cl) {
    7217                             i = inArray(cl, dom.getAttrib(n, 'class'));
    7218 
    7219                             v = dom.getStyle(n, 'fontSize');
    7220 
    7221                             if (i == -1 && v.indexOf('pt') > 0)
    7222                                 i = inArray(fz, parseInt(v));
    7223 
    7224                             if (i == -1)
    7225                                 i = inArray(fzn, v);
    7226 
    7227                             if (i != -1)
    7228                                 dom.setAttrib(f, 'size', '' + (i + 1 || 1));
    7229                         }
    7230 
    7231                         if (f.color || f.face || f.size)
    7232                             dom.replace(f, n, 1);
    7233                     });
    7234                 } else if (o.get) {
    7235                     each(t.dom.select('font', o.node), function(n) {
    7236                         var sp = dom.create('span', {
    7237                             style : {
    7238                                 fontFamily : dom.getAttrib(n, 'face'),
    7239                                 color : dom.getAttrib(n, 'color'),
    7240                                 backgroundColor : n.style.backgroundColor
    7241                             }
    7242                         });
    7243 
    7244                         if (n.size) {
    7245                             if (sl)
    7246                                 dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
    7247                             else
    7248                                 dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
    7249                         }
    7250 
    7251                         dom.replace(sp, n, 1);
    7252                     });
    7253                 }
    7254             });
    7255         },
    7256 
    7257         _isHidden : function() {
    7258             var s;
    7259 
    7260             if (!isGecko)
    7261                 return 0;
    7262 
    7263             // Weird, wheres that cursor selection?
    7264             s = this.selection.getSel();
    7265             return (!s || !s.rangeCount || s.rangeCount == 0);
    7266         },
    7267 
    7268         _fixNesting : function(s) {
    7269             var d = [], i;
    7270 
    7271             s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {
    7272                 var e;
    7273 
    7274                 // Handle end element
    7275                 if (b === '/') {
    7276                     if (!d.length)
    7277                         return '';
    7278 
    7279                     if (c !== d[d.length - 1].tag) {
    7280                         for (i=d.length - 1; i>=0; i--) {
    7281                             if (d[i].tag === c) {
    7282                                 d[i].close = 1;
    7283                                 break;
    7284                             }
    7285                         }
    7286 
    7287                         return '';
    7288                     } else {
    7289                         d.pop();
    7290 
    7291                         if (d.length && d[d.length - 1].close) {
    7292                             a = a + '</' + d[d.length - 1].tag + '>';
    7293                             d.pop();
    7294                         }
    7295                     }
    7296                 } else {
    7297                     // Ignore these
    7298                     if (/^(br|hr|input|meta|img|link|param)$/i.test(c))
    7299                         return a;
    7300 
    7301                     // Ignore closed ones
    7302                     if (/\/>$/.test(a))
    7303                         return a;
    7304 
    7305                     d.push({tag : c}); // Push start element
    7306                 }
    7307 
    7308                 return a;
    7309             });
    7310 
    7311             // End all open tags
    7312             for (i=d.length - 1; i>=0; i--)
    7313                 s += '</' + d[i].tag + '>';
    7314 
    7315             return s;
    7316         }
    7317 
    7318         });
    7319 })();
    7320 
    7321 /* file:jscripts/tiny_mce/classes/EditorCommands.js */
    7322 
    7323 (function() {
    7324     var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
    7325 
    7326     tinymce.create('tinymce.EditorCommands', {
    7327         EditorCommands : function(ed) {
    7328             this.editor = ed;
    7329         },
    7330 
    7331         execCommand : function(cmd, ui, val) {
    7332             var t = this, ed = t.editor, f;
    7333 
    7334             switch (cmd) {
    7335                 case 'Cut':
    7336                 case 'Copy':
    7337                 case 'Paste':
    7338                     try {
    7339                         ed.getDoc().execCommand(cmd, ui, val);
    7340                     } catch (ex) {
    7341                         if (isGecko) {
    7342                             ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) {
    7343                                 if (s)
    7344                                     window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', 'mceExternal');
    7345                             });
    7346                         } else
    7347                             ed.windowManager.alert(ed.getLang('clipboard_no_support'));
    7348                     }
    7349 
    7350                     return true;
    7351 
    7352                 // Ignore these
    7353                 case 'mceResetDesignMode':
    7354                 case 'mceBeginUndoLevel':
    7355                     return true;
    7356 
    7357                 // Ignore these
    7358                 case 'unlink':
    7359                     t.UnLink();
    7360                     return true;
    7361 
    7362                 // Bundle these together
    7363                 case 'JustifyLeft':
    7364                 case 'JustifyCenter':
    7365                 case 'JustifyRight':
    7366                 case 'JustifyFull':
    7367                     t.mceJustify(cmd, cmd.substring(7).toLowerCase());
    7368                     return true;
    7369 
    7370                 case 'mceEndUndoLevel':
    7371                 case 'mceAddUndoLevel':
    7372                     ed.undoManager.add();
    7373                     return true;
    7374 
    7375                 default:
    7376                     f = this[cmd];
    7377 
    7378                     if (f) {
    7379                         f.call(this, ui, val);
    7380                         return true;
    7381                     }
    7382             }
    7383 
    7384             return false;
    7385         },
    7386 
    7387         Indent : function() {
    7388             var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu;
    7389 
    7390             // Setup indent level
    7391             iv = ed.settings.indentation;
    7392             iu = /[a-z%]+$/i.exec(iv);
    7393             iv = parseInt(iv);
    7394 
    7395             if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
    7396                 each(this._getSelectedBlocks(), function(e) {
    7397                     d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu);
    7398                 });
    7399 
    7400                 return;
    7401             }
    7402 
    7403             ed.getDoc().execCommand('Indent', false, null);
    7404 
    7405             if (isIE) {
    7406                 d.getParent(s.getNode(), function(n) {
    7407                     if (n.nodeName == 'BLOCKQUOTE') {
    7408                         n.dir = n.style.cssText = '';
    7409                     }
    7410                 });
    7411             }
    7412         },
    7413 
    7414         Outdent : function() {
    7415             var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu;
    7416 
    7417             // Setup indent level
    7418             iv = ed.settings.indentation;
    7419             iu = /[a-z%]+$/i.exec(iv);
    7420             iv = parseInt(iv);
    7421 
    7422             if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
    7423                 each(this._getSelectedBlocks(), function(e) {
    7424                     v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv);
    7425                     d.setStyle(e, 'paddingLeft', v ? v + iu : '');
    7426                 });
    7427 
    7428                 return;
    7429             }
    7430 
    7431             ed.getDoc().execCommand('Outdent', false, null);
    7432         },
    7433 
    7434         mceSetAttribute : function(u, v) {
    7435             var ed = this.editor, d = ed.dom, e;
    7436 
    7437             if (e = d.getParent(ed.selection.getNode(), d.isBlock))
    7438                 d.setAttrib(e, v.name, v.value);
    7439         },
    7440 
    7441         mceSetContent : function(u, v) {
    7442             this.editor.setContent(v);
    7443         },
    7444 
    7445         mceToggleVisualAid : function() {
    7446             var ed = this.editor;
    7447 
    7448             ed.hasVisual = !ed.hasVisual;
    7449             ed.addVisual();
    7450         },
    7451 
    7452         mceReplaceContent : function(u, v) {
    7453             var s = this.editor.selection;
    7454 
    7455             s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'})));
    7456         },
    7457 
    7458         mceInsertLink : function(u, v) {
    7459             var ed = this.editor, e = ed.dom.getParent(ed.selection.getNode(), 'A');
    7460 
    7461             if (tinymce.is(v, 'string'))
    7462                 v = {href : v};
    7463 
    7464             function set(e) {
    7465                 each(v, function(v, k) {
    7466                     ed.dom.setAttrib(e, k, v);
    7467                 });
    7468             };
    7469 
    7470             if (!e) {
    7471                 ed.execCommand('CreateLink', false, 'javascript:mctmp(0);');
    7472                 each(ed.dom.select('a'), function(e) {
    7473                     if (e.href == 'javascript:mctmp(0);')
    7474                         set(e);
    7475                 });
    7476             } else {
    7477                 if (v.href)
    7478                     set(e);
    7479                 else
    7480                     ed.dom.remove(e, 1);
    7481             }
    7482         },
    7483 
    7484         UnLink : function() {
    7485             var ed = this.editor, s = ed.selection;
    7486 
    7487             if (s.isCollapsed())
    7488                 s.select(s.getNode());
    7489 
    7490             ed.getDoc().execCommand('unlink', false, null);
    7491             s.collapse(0);
    7492         },
    7493 
    7494         FontName : function(u, v) {
    7495             var t = this, ed = t.editor, s = ed.selection, e;
    7496 
    7497             if (!v) {
    7498                 if (s.isCollapsed())
    7499                     s.select(s.getNode());
    7500 
    7501                 t.RemoveFormat();
    7502             } else
    7503                 ed.getDoc().execCommand('FontName', false, v);
    7504         },
    7505 
    7506         queryCommandValue : function(c) {
    7507             var f = this['queryValue' + c];
    7508 
    7509             if (f)
    7510                 return f.call(this, c);
    7511 
    7512             return false;
    7513         },
    7514 
    7515         queryCommandState : function(cmd) {
    7516             var f;
    7517 
    7518             switch (cmd) {
    7519                 // Bundle these together
    7520                 case 'JustifyLeft':
    7521                 case 'JustifyCenter':
    7522                 case 'JustifyRight':
    7523                 case 'JustifyFull':
    7524                     return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase());
    7525 
    7526                 default:
    7527                     if (f = this['queryState' + cmd])
    7528                         return f.call(this, cmd);
    7529             }
    7530 
    7531             return -1;
    7532         },
    7533 
    7534         queryValueFontSize : function() {
    7535             var ed = this.editor, v = 0, p;
    7536 
    7537             if (isOpera || isWebKit) {
    7538                 if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
    7539                     v = p.size;
    7540 
    7541                 return v;
    7542             }
    7543 
    7544             return ed.getDoc().queryCommandValue('FontSize');
    7545         },
    7546 
    7547         queryValueFontName : function() {
    7548             var ed = this.editor, v = 0, p;
    7549 
    7550             if (p = ed.dom.getParent(ed.selection.getNode(), 'FONT'))
    7551                 v = p.face;
    7552 
    7553             if (!v)
    7554                 v = ed.getDoc().queryCommandValue('FontName');
    7555 
    7556             return v;
    7557         },
    7558 
    7559         mceJustify : function(c, v) {
    7560             var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm;
    7561 
    7562             if (ed.settings.inline_styles && this.queryStateJustify(c, v))
    7563                 rm = 1;
    7564 
    7565             bl = dom.getParent(n, ed.dom.isBlock);
    7566 
    7567             if (nn == 'IMG') {
    7568                 if (v == 'full')
    7569                     return;
    7570 
    7571                 if (rm) {
    7572                     dom.setStyle(n, 'float', '');
    7573                     this.mceRepaint();
    7574                     return;
    7575                 }
    7576 
    7577                 if (v == 'center') {
    7578                     if (!bl || bl.childNodes.length > 1) {
    7579                         nb = dom.create('p');
    7580                         nb.appendChild(n.cloneNode(false));
    7581 
    7582                         if (bl)
    7583                             dom.insertAfter(nb, bl);
    7584                         else
    7585                             dom.insertAfter(nb, n);
    7586 
    7587                         dom.remove(n);
    7588                         n = nb.firstChild;
    7589                         bl = nb;
    7590                     }
    7591 
    7592                     dom.setStyle(bl, 'textAlign', v);
    7593                     dom.setStyle(n, 'float', '');
    7594                 } else
    7595                     dom.setStyle(n, 'float', v);
    7596 
    7597                 this.mceRepaint();
    7598                 return;
    7599             }
    7600 
    7601             // Handle the alignment outselfs, less quirks in all browsers
    7602             if (ed.settings.inline_styles && ed.settings.forced_root_block) {
    7603                 if (rm)
    7604                     v = '';
    7605 
    7606                 each(this._getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) {
    7607                     dom.setAttrib(e, 'align', '');
    7608                     dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v);
    7609                 });
    7610 
    7611                 return;
    7612             } else if (!rm)
    7613                 ed.getDoc().execCommand(c, false, null);
    7614 
    7615             if (ed.settings.inline_styles) {
    7616                 if (rm) {
    7617                     dom.getParent(ed.selection.getNode(), function(n) {
    7618                         if (n.style && n.style.textAlign)
    7619                             dom.setStyle(n, 'textAlign', '');
    7620                     });
    7621 
    7622                     return;
    7623                 }
    7624 
    7625                 each(dom.select('*'), function(n) {
    7626                     var v = n.align;
    7627 
    7628                     if (v) {
    7629                         if (v == 'full')
    7630                             v = 'justify';
    7631 
    7632                         dom.setStyle(n, 'textAlign', v);
    7633                         dom.setAttrib(n, 'align', '');
    7634                     }
    7635                 });
    7636             }
    7637         },
    7638 
    7639         mceSetCSSClass : function(u, v) {
    7640             this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v});
    7641         },
    7642 
    7643         getSelectedElement : function() {
    7644             var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re;
    7645 
    7646             if (se.isCollapsed() || r.item)
    7647                 return se.getNode();
    7648 
    7649             // Setup regexp
    7650             re = ed.settings.merge_styles_invalid_parents;
    7651             if (tinymce.is(re, 'string'))
    7652                 re = new RegExp(re, 'i');
    7653 
    7654             if (isIE) {
    7655                 r1 = r.duplicate();
    7656                 r1.collapse(true);
    7657                 sc = r1.parentElement();
    7658 
    7659                 r2 = r.duplicate();
    7660                 r2.collapse(false);
    7661                 ec = r2.parentElement();
    7662 
    7663                 if (sc != ec) {
    7664                     r1.move('character', 1);
    7665                     sc = r1.parentElement();
    7666                 }
    7667 
    7668                 if (sc == ec) {
    7669                     r1 = r.duplicate();
    7670                     r1.moveToElementText(sc);
    7671 
    7672                     if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0)
    7673                         return re && re.test(sc.nodeName) ? null : sc;
    7674                 }
    7675             } else {
    7676                 function getParent(n) {
    7677                     return dom.getParent(n, function(n) {return n.nodeType == 1;});
    7678                 };
    7679 
    7680                 sc = r.startContainer;
    7681                 ec = r.endContainer;
    7682                 so = r.startOffset;
    7683                 eo = r.endOffset;
    7684 
    7685                 if (!r.collapsed) {
    7686                     if (sc == ec) {
    7687                         if (so - eo < 2) {
    7688                             if (sc.hasChildNodes()) {
    7689                                 sp = sc.childNodes[so];
    7690                                 return re && re.test(sp.nodeName) ? null : sp;
    7691                             }
    7692                         }
    7693                     }
    7694                 }
    7695 
    7696                 if (sc.nodeType != 3 || ec.nodeType != 3)
    7697                     return null;
    7698 
    7699                 if (so == 0) {
    7700                     sp = getParent(sc);
    7701 
    7702                     if (sp && sp.firstChild != sc)
    7703                         sp = null;
    7704                 }
    7705 
    7706                 if (so == sc.nodeValue.length) {
    7707                     e = sc.nextSibling;
    7708 
    7709                     if (e && e.nodeType == 1)
    7710                         sp = sc.nextSibling;
    7711                 }
    7712 
    7713                 if (eo == 0) {
    7714                     e = ec.previousSibling;
    7715 
    7716                     if (e && e.nodeType == 1)
    7717                         ep = e;
    7718                 }
    7719 
    7720                 if (eo == ec.nodeValue.length) {
    7721                     ep = getParent(ec);
    7722 
    7723                     if (ep && ep.lastChild != ec)
    7724                         ep = null;
    7725                 }
    7726 
    7727                 // Same element
    7728                 if (sp == ep)
    7729                     return re && sp && re.test(sp.nodeName) ? null : sp;
    7730             }
    7731 
    7732             return null;
    7733         },
    7734 
    7735         InsertHorizontalRule : function() {
    7736             // Fix for Gecko <hr size="1" /> issue and IE bug rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
    7737             if (isGecko || isIE)
    7738                 this.editor.selection.setContent('<hr />');
    7739             else
    7740                 this.editor.getDoc().execCommand('InsertHorizontalRule', false, '');
    7741         },
    7742 
    7743         RemoveFormat : function() {
    7744             var t = this, ed = t.editor, s = ed.selection, b;
    7745 
    7746             // Safari breaks tables
    7747             if (isWebKit)
    7748                 s.setContent(s.getContent({format : 'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g, ''), {format : 'raw'});
    7749             else
    7750                 ed.getDoc().execCommand('RemoveFormat', false, null);
    7751 
    7752             t.mceSetStyleInfo(0, {command : 'removeformat'});
    7753             ed.addVisual();
    7754         },
    7755 
    7756         mceSetStyleInfo : function(u, v) {
    7757             var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re;
    7758 
    7759             function set(n, e) {
    7760                 if (n.nodeType == 1) {
    7761                     switch (v.command) {
    7762                         case 'setattrib':
    7763                             return dom.setAttrib(n, v.name, v.value);
    7764 
    7765                         case 'setstyle':
    7766                             return dom.setStyle(n, v.name, v.value);
    7767 
    7768                         case 'removeformat':
    7769                             return dom.setAttrib(n, 'class', '');
    7770                     }
    7771                 }
    7772             };
    7773 
    7774             // Setup regexp
    7775             re = ed.settings.merge_styles_invalid_parents;
    7776             if (tinymce.is(re, 'string'))
    7777                 re = new RegExp(re, 'i');
    7778 
    7779             // Set style info on selected element
    7780             if (e = t.getSelectedElement())
    7781                 set(e, 1);
    7782             else {
    7783                 // Generate wrappers and set styles on them
    7784                 d.execCommand('FontName', false, '__');
    7785                 each(isWebKit ? dom.select('span') : dom.select('font'), function(n) {
    7786                     var sp, e;
    7787 
    7788                     if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') {
    7789                         sp = dom.create(nn, {mce_new : '1'});
    7790 
    7791                         set(sp);
    7792 
    7793                         each (n.childNodes, function(n) {
    7794                             sp.appendChild(n.cloneNode(true));
    7795                         });
    7796 
    7797                         dom.replace(sp, n);
    7798                     }
    7799                 });
    7800             }
    7801 
    7802             // Remove wrappers inside new ones
    7803             each(dom.select(nn).reverse(), function(n) {
    7804                 var p = n.parentNode;
    7805 
    7806                 dom.setAttrib(n, 'mce_new', '');
    7807 
    7808                 // Check if it's an old span in a new wrapper
    7809                 if (!dom.getAttrib(n, 'mce_new')) {
    7810                     // Find new wrapper
    7811                     p = dom.getParent(n, function(n) {
    7812                         return n.nodeType == 1 && dom.getAttrib(n, 'mce_new');
    7813                     });
    7814 
    7815                     if (p)
    7816                         dom.remove(n, 1);
    7817                 }
    7818             });
    7819 
    7820             // Merge wrappers with parent wrappers
    7821             each(dom.select(nn).reverse(), function(n) {
    7822                 var p = n.parentNode;
    7823 
    7824                 if (!p)
    7825                     return;
    7826 
    7827                 // Has parent of the same type and only child
    7828                 if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
    7829                     return dom.remove(p, 1);
    7830 
    7831                 // Has parent that is more suitable to have the class and only child
    7832                 if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) {
    7833                     set(p); // Set style info on parent instead
    7834                     dom.setAttrib(n, 'class', '');
    7835                 }
    7836             });
    7837 
    7838             // Remove empty wrappers
    7839             each(dom.select(nn).reverse(), function(n) {
    7840                 if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style'))
    7841                     return dom.remove(n, 1);
    7842             });
    7843 
    7844             s.moveToBookmark(b);
    7845         },
    7846 
    7847         queryStateJustify : function(c, v) {
    7848             var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom;
    7849 
    7850             if (n && n.nodeName == 'IMG')
    7851                 return dom.getStyle(n, 'float') == v;
    7852 
    7853             n = dom.getParent(ed.selection.getStart(), function(n) {
    7854                 return n.nodeType == 1 && n.style.textAlign;
    7855             });
    7856 
    7857             if (v == 'full')
    7858                 v = 'justify';
    7859 
    7860             if (ed.settings.inline_styles)
    7861                 return (n && n.style.textAlign == v);
    7862 
    7863             return ed.getDoc().queryCommandState(c);
    7864         },
    7865 
    7866         HiliteColor : function(ui, val) {
    7867             var t = this, ed = t.editor, d = ed.getDoc();
    7868 
    7869             function set(s) {
    7870                 if (!isGecko)
    7871                     return;
    7872 
    7873                 try {
    7874                     // Try new Gecko method
    7875                     d.execCommand("styleWithCSS", 0, s);
    7876                 } catch (ex) {
    7877                     // Use old
    7878                     d.execCommand("useCSS", 0, !s);
    7879                 }
    7880             };
    7881 
    7882             if (isGecko || isOpera) {
    7883                 set(true);
    7884                 d.execCommand('hilitecolor', false, val);
    7885                 set(false);
    7886             } else
    7887                 d.execCommand('BackColor', false, val);
    7888         },
    7889 
    7890         Undo : function() {
    7891             var ed = this.editor;
    7892 
    7893             if (ed.settings.custom_undo_redo) {
    7894                 ed.undoManager.undo();
    7895                 ed.nodeChanged();
    7896             } else
    7897                 ed.getDoc().execCommand('Undo', false, null);
    7898         },
    7899 
    7900         Redo : function() {
    7901             var ed = this.editor;
    7902 
    7903             if (ed.settings.custom_undo_redo) {
    7904                 ed.undoManager.redo();
    7905                 ed.nodeChanged();
    7906             } else
    7907                 ed.getDoc().execCommand('Redo', false, null);
    7908         },
    7909 
    7910         FormatBlock : function(ui, val) {
    7911             var t = this, ed = t.editor;
    7912 
    7913             val = ed.settings.forced_root_block ? (val || '<p>') : val;
    7914             t.mceRemoveNode();
    7915 
    7916             if (val.indexOf('<') == -1)
    7917                 val = '<' + val + '>';
    7918 
    7919             if (tinymce.isGecko)
    7920                 val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1');
    7921 
    7922             ed.getDoc().execCommand('FormatBlock', false, val);
    7923         },
    7924 
    7925         mceCleanup : function() {
    7926             var ed = this.editor, s = ed.selection, b = s.getBookmark();
    7927             ed.setContent(ed.getContent());
    7928             s.moveToBookmark(b);
    7929         },
    7930 
    7931         mceRemoveNode : function(ui, val) {
    7932             var ed = this.editor, s = ed.selection, b, n = val || s.getNode();
    7933 
    7934             // Make sure that the body node isn't removed
    7935             if (n == ed.getBody())
    7936                 return;
    7937 
    7938             b = s.getBookmark();
    7939             ed.dom.remove(n, 1);
    7940             s.moveToBookmark(b);
    7941             ed.nodeChanged();
    7942         },
    7943 
    7944         mceSelectNodeDepth : function(ui, val) {
    7945             var ed = this.editor, s = ed.selection, c = 0;
    7946 
    7947             ed.dom.getParent(s.getNode(), function(n) {
    7948                 if (n.nodeType == 1 && c++ == val) {
    7949                     s.select(n);
    7950                     ed.nodeChanged();
    7951                     return false;
    7952                 }
    7953             }, ed.getBody());
    7954         },
    7955 
    7956         mceSelectNode : function(u, v) {
    7957             this.editor.selection.select(v);
    7958         },
    7959 
    7960         mceInsertContent : function(ui, val) {
    7961             this.editor.selection.setContent(val);
    7962         },
    7963 
    7964         mceInsertRawHTML : function(ui, val) {
    7965             var ed = this.editor;
    7966 
    7967             ed.execCommand('mceInsertContent', false, 'tiny_mce_marker');
    7968             ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val));
    7969         },
    7970 
    7971         mceRepaint : function() {
    7972             var s, b, e = this.editor;
    7973 
    7974             if (tinymce.isGecko) {
    7975                 try {
    7976                     s = e.selection;
    7977                     b = s.getBookmark(true);
    7978 
    7979                     if (s.getSel())
    7980                         s.getSel().selectAllChildren(e.getBody());
    7981 
    7982                     s.collapse(true);
    7983                     s.moveToBookmark(b);
    7984                 } catch (ex) {
    7985                     // Ignore
    7986                 }
    7987             }
    7988         },
    7989 
    7990         queryStateUnderline : function() {
    7991             var ed = this.editor, n;
    7992 
    7993             if (n && n.nodeName == 'A')
    7994                 return false;
    7995 
    7996             return ed.getDoc().queryCommandState('Underline');
    7997         },
    7998 
    7999         queryStateOutdent : function() {
    8000             var ed = this.editor, n;
    8001 
    8002             if (ed.settings.inline_styles) {
    8003                 if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
    8004                     return true;
    8005 
    8006                 if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
    8007                     return true;
    8008             } else
    8009                 return !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE');
    8010 
    8011             return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList();
    8012         },
    8013 
    8014         queryStateInsertUnorderedList : function() {
    8015             return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
    8016         },
    8017 
    8018         queryStateInsertOrderedList : function() {
    8019             return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL');
    8020         },
    8021 
    8022         queryStatemceBlockQuote : function() {
    8023             return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';});
    8024         },
    8025 
    8026         mceBlockQuote : function() {
    8027             var t = this, s = t.editor.selection, b = s.getBookmark(), bq, dom = t.editor.dom;
    8028 
    8029             function findBQ(e) {
    8030                 return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
    8031             };
    8032 
    8033             // Remove blockquote(s)
    8034             if (findBQ(s.getStart())) {
    8035                 each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) {
    8036                     // Found BQ lets remove it
    8037                     if (e.nodeName == 'BLOCKQUOTE')
    8038                         dom.remove(e, 1);
    8039                 });
    8040 
    8041                 t.editor.selection.moveToBookmark(b);
    8042                 return;
    8043             }
    8044 
    8045             each(t._getSelectedBlocks(findBQ(s.getStart()), findBQ(s.getEnd())), function(e) {
    8046                 var n;
    8047 
    8048                 // Found existing BQ add to this one
    8049                 if (e.nodeName == 'BLOCKQUOTE' && !bq) {
    8050                     bq = e;
    8051                     return;
    8052                 }
    8053 
    8054                 // No BQ found, create one
    8055                 if (!bq) {
    8056                     bq = dom.create('blockquote');
    8057                     e.parentNode.insertBefore(bq, e);
    8058                 }
    8059 
    8060                 // Add children from existing BQ
    8061                 if (e.nodeName == 'BLOCKQUOTE' && bq) {
    8062                     n = e.firstChild;
    8063 
    8064                     while (n) {
    8065                         bq.appendChild(n.cloneNode(true));
    8066                         n = n.nextSibling;
    8067                     }
    8068 
    8069                     dom.remove(e);
    8070 
    8071                     return;
    8072                 }
    8073 
    8074                 // Add non BQ element to BQ
    8075                 bq.appendChild(dom.remove(e));
    8076             });
    8077 
    8078             t.editor.selection.moveToBookmark(b);
    8079         },
    8080 
    8081         _getSelectedBlocks : function(st, en) {
    8082             var ed = this.editor, dom = ed.dom, s = ed.selection, sb, eb, n, bl = [];
    8083 
    8084             sb = dom.getParent(st || s.getStart(), dom.isBlock);
    8085             eb = dom.getParent(en || s.getEnd(), dom.isBlock);
    8086 
    8087             if (sb)
    8088                 bl.push(sb);
    8089 
    8090             if (sb && eb && sb != eb) {
    8091                 n = sb;
    8092 
    8093                 while ((n = n.nextSibling) && n != eb) {
    8094                     if (dom.isBlock(n))
    8095                         bl.push(n);
    8096                 }
    8097             }
    8098 
    8099             if (eb && sb != eb)
    8100                 bl.push(eb);
    8101 
    8102             return bl;
    8103         }
    8104     });
    8105 })();
    8106 
    8107 
    8108 /* file:jscripts/tiny_mce/classes/UndoManager.js */
    8109 
    8110 tinymce.create('tinymce.UndoManager', {
    8111     index : 0,
    8112     data : null,
    8113     typing : 0,
    8114 
    8115     UndoManager : function(ed) {
    8116         var t = this, Dispatcher = tinymce.util.Dispatcher;
    8117 
    8118         t.editor = ed;
    8119         t.data = [];
    8120         t.onAdd = new Dispatcher(this);
    8121         t.onUndo = new Dispatcher(this);
    8122         t.onRedo = new Dispatcher(this);
    8123     },
    8124 
    8125     add : function(l) {
    8126         var t = this, i, ed = t.editor, b, s = ed.settings, la;
    8127 
    8128         l = l || {};
    8129         l.content = l.content || ed.getContent({format : 'raw', no_events : 1});
    8130 
    8131         // Add undo level if needed
    8132         l.content = l.content.replace(/^\s*|\s*$/g, '');
    8133         la = t.data[t.index > 0 ? t.index - 1 : 0];
    8134         if (!l.initial && la && l.content == la.content)
    8135             return null;
    8136 
    8137         // Time to compress
    8138         if (s.custom_undo_redo_levels) {
    8139             if (t.data.length > s.custom_undo_redo_levels) {
    8140                 for (i = 0; i < t.data.length - 1; i++)
    8141                     t.data[i] = t.data[i + 1];
    8142 
    8143                 t.data.length--;
    8144                 t.index = t.data.length;
    8145             }
    8146         }
    8147 
    8148         if (s.custom_undo_redo_restore_selection)
    8149             l.bookmark = b = l.bookmark || ed.selection.getBookmark();
    8150 
    8151         if (t.index < t.data.length && t.data[t.index].initial)
    8152             t.index++;
    8153 
    8154         // Add level
    8155         t.data.length = t.index + 1;
    8156         t.data[t.index++] = l;
    8157 
    8158         if (l.initial)
    8159             t.index = 0;
    8160 
    8161         // Set initial bookmark use first real undo level
    8162         if (t.data.length == 2 && t.data[0].initial)
    8163             t.data[0].bookmark = b;
    8164 
    8165         t.onAdd.dispatch(t, l);
    8166 
    8167         //console.dir(t.data);
    8168 
    8169         return l;
    8170     },
    8171 
    8172     undo : function() {
    8173         var t = this, ed = t.editor, l = l, i;
    8174 
    8175         if (t.typing) {
    8176             t.add();
    8177             t.typing = 0;
    8178         }
    8179 
    8180         if (t.index > 0) {
    8181             // If undo on last index then take snapshot
    8182             if (t.index == t.data.length && t.index > 1) {
    8183                 i = t.index;
    8184                 t.typing = 0;
    8185 
    8186                 if (!t.add())
    8187                     t.index = i;
    8188 
    8189                 --t.index;
    8190             }
    8191 
    8192             l = t.data[--t.index];
    8193             ed.setContent(l.content, {format : 'raw'});
    8194             ed.selection.moveToBookmark(l.bookmark);
    8195 
    8196             t.onUndo.dispatch(t, l);
    8197         }
    8198 
    8199         return l;
    8200     },
    8201 
    8202     redo : function() {
    8203         var t = this, ed = t.editor, l = null;
    8204 
    8205         if (t.index < t.data.length - 1) {
    8206             l = t.data[++t.index];
    8207             ed.setContent(l.content, {format : 'raw'});
    8208             ed.selection.moveToBookmark(l.bookmark);
    8209 
    8210             t.onRedo.dispatch(t, l);
    8211         }
    8212 
    8213         return l;
    8214     },
    8215 
    8216     clear : function() {
    8217         var t = this;
    8218 
    8219         t.data = [];
    8220         t.index = 0;
    8221         t.typing = 0;
    8222         t.add({initial : true});
    8223     },
    8224 
    8225     hasUndo : function() {
    8226         return this.index != 0 || this.typing;
    8227     },
    8228 
    8229     hasRedo : function() {
    8230         return this.index < this.data.length - 1;
    8231     }
    8232 
    8233     });
    8234 /* file:jscripts/tiny_mce/classes/ForceBlocks.js */
    8235 
    8236 (function() {
    8237     // Shorten names
    8238     var Event, isIE, isGecko, isOpera, each, extend;
    8239 
    8240     Event = tinymce.dom.Event;
    8241     isIE = tinymce.isIE;
    8242     isGecko = tinymce.isGecko;
    8243     isOpera = tinymce.isOpera;
    8244     each = tinymce.each;
    8245     extend = tinymce.extend;
    8246 
    8247     tinymce.create('tinymce.ForceBlocks', {
    8248         ForceBlocks : function(ed) {
    8249             var t = this, s;
    8250 
    8251             t.editor = ed;
    8252             t.dom = ed.dom;
    8253 
    8254             // Default settings
    8255             t.settings = s = extend({
    8256                 element : 'P',
    8257                 forced_root_block : 'p',
    8258                 force_p_newlines : true
    8259             }, ed.settings);
    8260 
    8261             ed.onPreInit.add(t.setup, t);
    8262 
    8263             if (!isIE) {
    8264                 ed.onSetContent.add(function(ed, o) {
    8265                     o.content = o.content.replace(/<p>[\s\u00a0]+<\/p>/g, '<p><br /></p>');
    8266                 });
    8267             }
    8268 
    8269             ed.onPostProcess.add(function(ed, o) {
    8270                 if (isOpera)
    8271                     o.content = o.content.replace(/(\u00a0|&#160;|&nbsp;)<\/p>/g, '</p>');
    8272 
    8273                 o.content = o.content.replace(/<p><\/p>/g, '<p>\u00a0</p>');
    8274 
    8275                 // Use BR instead of &nbsp; padded paragraphs
    8276                 o.content = o.content.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>\u00a0</p>');
    8277                 o.content = o.content.replace(/\s*<br \/>\s*<\/p>/g, '</p>');
    8278             });
    8279 
    8280             if (s.forced_root_block) {
    8281                 ed.onInit.add(t.forceRoots, t);
    8282                 ed.onSetContent.add(t.forceRoots, t);
    8283                 ed.onBeforeGetContent.add(t.forceRoots, t);
    8284             }
    8285         },
    8286 
    8287         setup : function() {
    8288             var t = this, ed = t.editor, s = t.settings;
    8289 
    8290             // Force root blocks when typing and when getting output
    8291             if (s.forced_root_block) {
    8292                 ed.onKeyUp.add(t.forceRoots, t);
    8293                 ed.onPreProcess.add(t.forceRoots, t);
    8294             }
    8295 
    8296             if (s.force_br_newlines) {
    8297                 // Force IE to produce BRs on enter
    8298                 if (isIE) {
    8299                     ed.onKeyPress.add(function(ed, e) {
    8300                         var n, s = ed.selection;
    8301 
    8302                         if (e.keyCode == 13) {
    8303                             s.setContent('<br id="__" /> ', {format : 'raw'});
    8304                             n = ed.dom.get('__');
    8305                             n.removeAttribute('id');
    8306                             s.select(n);
    8307                             s.collapse();
    8308                             return Event.cancel(e);
    8309                         }
    8310                     });
    8311                 }
    8312 
    8313                 return;
    8314             }
    8315 
    8316             if (!isIE && s.force_p_newlines) {
    8317                 ed.onPreProcess.add(function(ed, o) {
    8318                     each(ed.dom.select('br', o.node), function(n) {
    8319                         var p = n.parentNode;
    8320 
    8321                         // Replace <p><br /></p> with <p>&nbsp;</p>
    8322                         if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n))
    8323                             p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n);
    8324                     });
    8325                 });
    8326 
    8327                 ed.onKeyPress.add(function(ed, e) {
    8328                     if (e.keyCode == 13 && !e.shiftKey) {
    8329                         if (!t.insertPara(e))
    8330                             Event.cancel(e);
    8331                     }
    8332                 });
    8333 
    8334                 if (isGecko) {
    8335                     ed.onKeyDown.add(function(ed, e) {
    8336                         if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
    8337                             t.backspaceDelete(e, e.keyCode == 8);
    8338                     });
    8339                 }
    8340             }
    8341         },
    8342 
    8343         find : function(n, t, s) {
    8344             var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1;
    8345 
    8346             while (n = w.nextNode()) {
    8347                 c++;
    8348 
    8349                 // Index by node
    8350                 if (t == 0 && n == s)
    8351                     return c;
    8352 
    8353                 // Node by index
    8354                 if (t == 1 && c == s)
    8355                     return n;
    8356             }
    8357 
    8358             return -1;
    8359         },
    8360 
    8361         forceRoots : function(ed, e) {
    8362             var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
    8363             var nx, bl, bp, sp, le, nl = b.childNodes, i;
    8364 
    8365             // Fix for bug #1863847
    8366             if (e && e.keyCode == 13)
    8367                 return true;
    8368 
    8369             // Wrap non blocks into blocks
    8370             for (i = nl.length - 1; i >= 0; i--) {
    8371                 nx = nl[i];
    8372 
    8373                 // Is text or non block element
    8374                 if (nx.nodeType == 3 || !t.dom.isBlock(nx)) {
    8375                     if (!bl) {
    8376                         // Create new block but ignore whitespace
    8377                         if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
    8378                             // Store selection
    8379                             if (si == -2 && r) {
    8380                                 if (!isIE) {
    8381                                     so = r.startOffset;
    8382                                     eo = r.endOffset;
    8383                                     si = t.find(b, 0, r.startContainer);
    8384                                     ei = t.find(b, 0, r.endContainer);
    8385                                 } else {
    8386                                     tr = d.body.createTextRange();
    8387                                     tr.moveToElementText(b);
    8388                                     tr.collapse(1);
    8389                                     bp = tr.move('character', c) * -1;
    8390 
    8391                                     tr = r.duplicate();
    8392                                     tr.collapse(1);
    8393                                     sp = tr.move('character', c) * -1;
    8394 
    8395                                     tr = r.duplicate();
    8396                                     tr.collapse(0);
    8397                                     le = (tr.move('character', c) * -1) - sp;
    8398 
    8399                                     si = sp - bp;
    8400                                     ei = le;
    8401                                 }
    8402                             }
    8403 
    8404                             bl = ed.dom.create(t.settings.forced_root_block);
    8405                             bl.appendChild(nx.cloneNode(1));
    8406                             b.replaceChild(bl, nx);
    8407                         }
    8408                     } else {
    8409                         if (bl.hasChildNodes())
    8410                             bl.insertBefore(nx, bl.firstChild);
    8411                         else
    8412                             bl.appendChild(nx);
    8413                     }
    8414                 } else
    8415                     bl = null; // Time to create new block
    8416             }
    8417 
    8418             // Restore selection
    8419             if (si != -2) {
    8420                 if (!isIE) {
    8421                     bl = d.getElementsByTagName(t.settings.element)[0];
    8422                     r = d.createRange();
    8423 
    8424                     // Select last location or generated block
    8425                     if (si != -1)
    8426                         r.setStart(t.find(b, 1, si), so);
    8427                     else
    8428                         r.setStart(bl, 0);
    8429 
    8430                     // Select last location or generated block
    8431                     if (ei != -1)
    8432                         r.setEnd(t.find(b, 1, ei), eo);
    8433                     else
    8434                         r.setEnd(bl, 0);
    8435 
    8436                     if (s) {
    8437                         s.removeAllRanges();
    8438                         s.addRange(r);
    8439                     }
    8440                 } else {
    8441                     try {
    8442                         r = s.createRange();
    8443                         r.moveToElementText(b);
    8444                         r.collapse(1);
    8445                         r.moveStart('character', si);
    8446                         r.moveEnd('character', ei);
    8447                         r.select();
    8448                     } catch (ex) {
    8449                         // Ignore
    8450                     }
    8451                 }
    8452             }
    8453         },
    8454 
    8455         getParentBlock : function(n) {
    8456             var d = this.dom;
    8457 
    8458             return d.getParent(n, d.isBlock);
    8459         },
    8460 
    8461         insertPara : function(e) {
    8462             var t = this, ed = t.editor, d = ed.getDoc(), se = t.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;
    8463             var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n;
    8464 
    8465             function isEmpty(n) {
    8466                 n = n.innerHTML;
    8467                 n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
    8468                 n = n.replace(/<[^>]+>/g, ''); // Remove all tags
    8469 
    8470                 return n.replace(/[ \t\r\n]+/g, '') == '';
    8471             };
    8472 
    8473             // If root blocks are forced then use Operas default behavior since it's really good
    8474 // Removed due to bug: #1853816
    8475 //          if (se.forced_root_block && isOpera)
    8476 //              return true;
    8477 
    8478             // Setup before range
    8479             rb = d.createRange();
    8480 
    8481             // If is before the first block element and in body, then move it into first block element
    8482             rb.setStart(s.anchorNode, s.anchorOffset);
    8483             rb.collapse(true);
    8484 
    8485             // Setup after range
    8486             ra = d.createRange();
    8487 
    8488             // If is before the first block element and in body, then move it into first block element
    8489             ra.setStart(s.focusNode, s.focusOffset);
    8490             ra.collapse(true);
    8491 
    8492             // Setup start/end points
    8493             dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
    8494             sn = dir ? s.anchorNode : s.focusNode;
    8495             so = dir ? s.anchorOffset : s.focusOffset;
    8496             en = dir ? s.focusNode : s.anchorNode;
    8497             eo = dir ? s.focusOffset : s.anchorOffset;
    8498 
    8499             // If the caret is in an invalid location in FF we need to move it into the first block
    8500             if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) {
    8501                 sn = en = sn.firstChild;
    8502                 so = eo = 0;
    8503                 rb = d.createRange();
    8504                 rb.setStart(sn, 0);
    8505                 ra = d.createRange();
    8506                 ra.setStart(en, 0);
    8507             }
    8508 
    8509             // Never use body as start or end node
    8510             sn = sn.nodeName == "BODY" ? sn.firstChild : sn;
    8511             en = en.nodeName == "BODY" ? en.firstChild : en;
    8512 
    8513             // Get start and end blocks
    8514             sb = t.getParentBlock(sn);
    8515             eb = t.getParentBlock(en);
    8516             bn = sb ? sb.nodeName : se.element; // Get block name to create
    8517 
    8518             // Return inside list use default browser behavior
    8519             if (t.dom.getParent(sb, function(n) { return /OL|UL|PRE/.test(n.nodeName); }))
    8520                 return true;
    8521 
    8522             // If caption or absolute layers then always generate new blocks within
    8523             if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(sb.style.position))) {
    8524                 bn = se.element;
    8525                 sb = null;
    8526             }
    8527 
    8528             // If caption or absolute layers then always generate new blocks within
    8529             if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(eb.style.position))) {
    8530                 bn = se.element;
    8531                 eb = null;
    8532             }
    8533 
    8534             // Use P instead
    8535             if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(sb.style.cssFloat))) {
    8536                 bn = se.element;
    8537                 sb = eb = null;
    8538             }
    8539 
    8540             // Setup new before and after blocks
    8541             bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn);
    8542             aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn);
    8543 
    8544             // Remove id from after clone
    8545             aft.removeAttribute('id');
    8546 
    8547             // Is header and cursor is at the end, then force paragraph under
    8548             if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length)
    8549                 aft = ed.dom.create(se.element);
    8550 
    8551             // Find start chop node
    8552             n = sc = sn;
    8553             do {
    8554                 if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
    8555                     break;
    8556 
    8557                 sc = n;
    8558             } while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
    8559 
    8560             // Find end chop node
    8561             n = ec = en;
    8562             do {
    8563                 if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
    8564                     break;
    8565 
    8566                 ec = n;
    8567             } while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
    8568 
    8569             // Place first chop part into before block element
    8570             if (sc.nodeName == bn)
    8571                 rb.setStart(sc, 0);
    8572             else
    8573                 rb.setStartBefore(sc);
    8574 
    8575             rb.setEnd(sn, so);
    8576             bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
    8577 
    8578             // Place secnd chop part within new block element
    8579             try {
    8580                 ra.setEndAfter(ec);
    8581             } catch(ex) {
    8582                 //console.debug(s.focusNode, s.focusOffset);
    8583             }
    8584 
    8585             ra.setStart(en, eo);
    8586             aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
    8587 
    8588             // Create range around everything
    8589             r = d.createRange();
    8590             if (!sc.previousSibling && sc.parentNode.nodeName == bn) {
    8591                 r.setStartBefore(sc.parentNode);
    8592             } else {
    8593                 if (rb.startContainer.nodeName == bn && rb.startOffset == 0)
    8594                     r.setStartBefore(rb.startContainer);
    8595                 else
    8596                     r.setStart(rb.startContainer, rb.startOffset);
    8597             }
    8598 
    8599             if (!ec.nextSibling && ec.parentNode.nodeName == bn)
    8600                 r.setEndAfter(ec.parentNode);
    8601             else
    8602                 r.setEnd(ra.endContainer, ra.endOffset);
    8603 
    8604             // Delete and replace it with new block elements
    8605             r.deleteContents();
    8606 
    8607             // Never wrap blocks in blocks
    8608             if (bef.firstChild && bef.firstChild.nodeName == bn)
    8609                 bef.innerHTML = bef.firstChild.innerHTML;
    8610 
    8611             if (aft.firstChild && aft.firstChild.nodeName == bn)
    8612                 aft.innerHTML = aft.firstChild.innerHTML;
    8613 
    8614             // Padd empty blocks
    8615             if (isEmpty(bef))
    8616                 bef.innerHTML = '<br />';
    8617 
    8618             if (isEmpty(aft))
    8619                 aft.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
    8620 
    8621             // Opera needs this one backwards
    8622             if (isOpera) {
    8623                 r.insertNode(bef);
    8624                 r.insertNode(aft);
    8625             } else {
    8626                 r.insertNode(aft);
    8627                 r.insertNode(bef);
    8628             }
    8629 
    8630             // Normalize
    8631             aft.normalize();
    8632             bef.normalize();
    8633 
    8634             // Move cursor and scroll into view
    8635             r = d.createRange();
    8636             r.selectNodeContents(aft);
    8637             r.collapse(1);
    8638             s.removeAllRanges();
    8639             s.addRange(r);
    8640             aft.scrollIntoView(0);
    8641 
    8642             return false;
    8643         },
    8644 
    8645         backspaceDelete : function(e, bs) {
    8646             var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n;
    8647 
    8648             // The caret sometimes gets stuck in Gecko if you delete empty paragraphs
    8649             // This workaround removes the element by hand and moves the caret to the previous element
    8650             if (sc && ed.dom.isBlock(sc) && bs) {
    8651                 if (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR') {
    8652                     n = sc.previousSibling;
    8653                     if (n) {
    8654                         ed.dom.remove(sc);
    8655                         se.select(n, 1);
    8656                         se.collapse(0);
    8657                         return Event.cancel(e);
    8658                     }
    8659                 }
    8660             }
    8661 
    8662             // Gecko generates BR elements here and there, we don't like those so lets remove them
    8663             function handler(e) {
    8664                 e = e.target;
    8665 
    8666                 // A new BR was created in a block element, remove it
    8667                 if (e && e.parentNode && e.nodeName == 'BR' && t.getParentBlock(e)) {
    8668                     ed.dom.remove(e);
    8669                     Event.remove(b, 'DOMNodeInserted', handler);
    8670                 }
    8671             };
    8672 
    8673             // Listen for new nodes
    8674             Event._add(b, 'DOMNodeInserted', handler);
    8675 
    8676             // Remove listener
    8677             window.setTimeout(function() {
    8678                 Event._remove(b, 'DOMNodeInserted', handler);
    8679             }, 1);
    8680         }
    8681     });
    8682 })();
    8683 
    8684 /* file:jscripts/tiny_mce/classes/ControlManager.js */
    8685 
    8686 (function() {
    8687     // Shorten names
    8688     var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;
    8689 
    8690     tinymce.create('tinymce.ControlManager', {
    8691         ControlManager : function(ed, s) {
    8692             var t = this, i;
    8693 
    8694             s = s || {};
    8695             t.editor = ed;
    8696             t.controls = {};
    8697             t.onAdd = new tinymce.util.Dispatcher(t);
    8698             t.onPostRender = new tinymce.util.Dispatcher(t);
    8699             t.prefix = s.prefix || ed.id + '_';
    8700 
    8701             t.onPostRender.add(function() {
    8702                 each(t.controls, function(c) {
    8703                     c.postRender();
    8704                 });
    8705             });
    8706         },
    8707 
    8708         get : function(id) {
    8709             return this.controls[this.prefix + id] || this.controls[id];
    8710         },
    8711 
    8712         setActive : function(id, s) {
    8713             var c = null;
    8714 
    8715             if (c = this.get(id))
    8716                 c.setActive(s);
    8717 
    8718             return c;
    8719         },
    8720 
    8721         setDisabled : function(id, s) {
    8722             var c = null;
    8723 
    8724             if (c = this.get(id))
    8725                 c.setDisabled(s);
    8726 
    8727             return c;
    8728         },
    8729 
    8730         add : function(c) {
    8731             var t = this;
    8732 
    8733             if (c) {
    8734                 t.controls[c.id] = c;
    8735                 t.onAdd.dispatch(c, t);
    8736             }
    8737 
    8738             return c;
    8739         },
    8740 
    8741         createControl : function(n) {
    8742             var c, t = this, ed = t.editor;
    8743 
    8744             each(ed.plugins, function(p) {
    8745                 if (p.createControl) {
    8746                     c = p.createControl(n, t);
    8747 
    8748                     if (c)
    8749                         return false;
    8750                 }
    8751             });
    8752 
    8753             switch (n) {
    8754                 case "|":
    8755                 case "separator":
    8756                     return t.createSeparator();
    8757             }
    8758 
    8759             if (!c && ed.buttons && (c = ed.buttons[n]))
    8760                 return t.createButton(n, c);
    8761 
    8762             return t.add(c);
    8763         },
    8764 
    8765         createDropMenu : function(id, s) {
    8766             var t = this, ed = t.editor, c;
    8767 
    8768             s = extend({
    8769                 'class' : 'mceDropDown'
    8770             }, s);
    8771 
    8772             s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin';
    8773 
    8774             id = t.prefix + id;
    8775             c = t.controls[id] = new tinymce.ui.DropMenu(id, s);
    8776             c.onAddItem.add(function(c, o) {
    8777                 var s = o.settings;
    8778 
    8779                 s.title = ed.getLang(s.title, s.title);
    8780 
    8781                 if (!s.onclick) {
    8782                     s.onclick = function(v) {
    8783                         ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8784                     };
    8785                 }
    8786             });
    8787 
    8788             ed.onRemove.add(function() {
    8789                 c.destroy();
    8790             });
    8791 
    8792             return t.add(c);
    8793         },
    8794 
    8795         createListBox : function(id, s) {
    8796             var t = this, ed = t.editor, cmd, c;
    8797 
    8798             if (t.get(id))
    8799                 return null;
    8800 
    8801             s.title = ed.translate(s.title);
    8802             s.scope = s.scope || ed;
    8803 
    8804             if (!s.onselect) {
    8805                 s.onselect = function(v) {
    8806                     ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8807                 };
    8808             }
    8809 
    8810             s = extend({
    8811                 title : s.title,
    8812                 'class' : id,
    8813                 scope : s.scope,
    8814                 control_manager : t
    8815             }, s);
    8816 
    8817             id = t.prefix + id;
    8818 
    8819             if (ed.settings.use_native_selects)
    8820                 c = new tinymce.ui.NativeListBox(id, s);
    8821             else
    8822                 c = new tinymce.ui.ListBox(id, s);
    8823 
    8824             t.controls[id] = c;
    8825 
    8826             // Fix focus problem in Safari
    8827             if (tinymce.isWebKit) {
    8828                 c.onPostRender.add(function(c, n) {
    8829                     // Store bookmark on mousedown
    8830                     Event.add(n, 'mousedown', function() {
    8831                         ed.bookmark = ed.selection.getBookmark('simple');
    8832                     });
    8833 
    8834                     // Restore on focus, since it might be lost
    8835                     Event.add(n, 'focus', function() {
    8836                         ed.selection.moveToBookmark(ed.bookmark);
    8837                         ed.bookmark = null;
    8838                     });
    8839                 });
    8840             }
    8841 
    8842             if (c.hideMenu)
    8843                 ed.onMouseDown.add(c.hideMenu, c);
    8844 
    8845             return t.add(c);
    8846         },
    8847 
    8848         createButton : function(id, s) {
    8849             var t = this, ed = t.editor, o, c;
    8850 
    8851             if (t.get(id))
    8852                 return null;
    8853 
    8854             s.title = ed.translate(s.title);
    8855             s.scope = s.scope || ed;
    8856 
    8857             if (!s.onclick && !s.menu_button) {
    8858                 s.onclick = function() {
    8859                     ed.execCommand(s.cmd, s.ui || false, s.value);
    8860                 };
    8861             }
    8862 
    8863             s = extend({
    8864                 title : s.title,
    8865                 'class' : id,
    8866                 unavailable_prefix : ed.getLang('unavailable', ''),
    8867                 scope : s.scope,
    8868                 control_manager : t
    8869             }, s);
    8870 
    8871             id = t.prefix + id;
    8872 
    8873             if (s.menu_button) {
    8874                 c = new tinymce.ui.MenuButton(id, s);
    8875                 ed.onMouseDown.add(c.hideMenu, c);
    8876             } else
    8877                 c = new tinymce.ui.Button(id, s);
    8878 
    8879             return t.add(c);
    8880         },
    8881 
    8882         createMenuButton : function(id, s) {
    8883             s = s || {};
    8884             s.menu_button = 1;
    8885 
    8886             return this.createButton(id, s);
    8887         },
    8888 
    8889         createSplitButton : function(id, s) {
    8890             var t = this, ed = t.editor, cmd, c;
    8891 
    8892             if (t.get(id))
    8893                 return null;
    8894 
    8895             s.title = ed.translate(s.title);
    8896             s.scope = s.scope || ed;
    8897 
    8898             if (!s.onclick) {
    8899                 s.onclick = function(v) {
    8900                     ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8901                 };
    8902             }
    8903 
    8904             if (!s.onselect) {
    8905                 s.onselect = function(v) {
    8906                     ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8907                 };
    8908             }
    8909 
    8910             s = extend({
    8911                 title : s.title,
    8912                 'class' : id,
    8913                 scope : s.scope,
    8914                 control_manager : t
    8915             }, s);
    8916 
    8917             id = t.prefix + id;
    8918             c = t.add(new tinymce.ui.SplitButton(id, s));
    8919             ed.onMouseDown.add(c.hideMenu, c);
    8920 
    8921             return c;
    8922         },
    8923 
    8924         createColorSplitButton : function(id, s) {
    8925             var t = this, ed = t.editor, cmd, c;
    8926 
    8927             if (t.get(id))
    8928                 return null;
    8929 
    8930             s.title = ed.translate(s.title);
    8931             s.scope = s.scope || ed;
    8932 
    8933             if (!s.onclick) {
    8934                 s.onclick = function(v) {
    8935                     ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8936                 };
    8937             }
    8938 
    8939             if (!s.onselect) {
    8940                 s.onselect = function(v) {
    8941                     ed.execCommand(s.cmd, s.ui || false, v || s.value);
    8942                 };
    8943             }
    8944 
    8945             s = extend({
    8946                 title : s.title,
    8947                 'class' : id,
    8948                 'menu_class' : ed.getParam('skin') + 'Skin',
    8949                 scope : s.scope,
    8950                 more_colors_title : ed.getLang('more_colors')
    8951             }, s);
    8952 
    8953             id = t.prefix + id;
    8954             c = new tinymce.ui.ColorSplitButton(id, s);
    8955             ed.onMouseDown.add(c.hideMenu, c);
    8956 
    8957             return t.add(c);
    8958         },
    8959 
    8960         createToolbar : function(id, s) {
    8961             var c, t = this;
    8962 
    8963             id = t.prefix + id;
    8964             c = new tinymce.ui.Toolbar(id, s);
    8965 
    8966             if (t.get(id))
    8967                 return null;
    8968 
    8969             return t.add(c);
    8970         },
    8971 
    8972         createSeparator : function() {
    8973             return new tinymce.ui.Separator();
    8974         }
    8975 
    8976         });
    8977 })();
    8978 
    8979 /* file:jscripts/tiny_mce/classes/WindowManager.js */
    8980 
    8981 (function() {
    8982     var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
    8983 
    8984     tinymce.create('tinymce.WindowManager', {
    8985         WindowManager : function(ed) {
    8986             var t = this;
    8987 
    8988             t.editor = ed;
    8989             t.onOpen = new Dispatcher(t);
    8990             t.onClose = new Dispatcher(t);
    8991             t.params = {};
    8992             t.features = {};
    8993         },
    8994 
    8995         open : function(s, p) {
    8996             var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort();
    8997 
    8998             // Default some options
    8999             s = s || {};
    9000             p = p || {};
    9001             sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window
    9002             sh = isOpera ? vp.h : screen.height;
    9003             s.name = s.name || 'mc_' + new Date().getTime();
    9004             s.width = parseInt(s.width || 320);
    9005             s.height = parseInt(s.height || 240);
    9006             s.resizable = true;
    9007             s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0);
    9008             s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0);
    9009             p.inline = false;
    9010             p.mce_width = s.width;
    9011             p.mce_height = s.height;
    9012 
    9013             if (mo) {
    9014                 if (isIE) {
    9015                     s.center = true;
    9016                     s.help = false;
    9017                     s.dialogWidth = s.width + 'px';
    9018                     s.dialogHeight = s.height + 'px';
    9019                     s.scroll = s.scrollbars || false;
    9020                 } else
    9021                     s.modal = s.alwaysRaised = s.dialog = s.centerscreen = s.dependent = true;
    9022             }
    9023 
    9024             // Build features string
    9025             each(s, function(v, k) {
    9026                 if (tinymce.is(v, 'boolean'))
    9027                     v = v ? 'yes' : 'no';
    9028 
    9029                 if (!/^(name|url)$/.test(k)) {
    9030                     if (isIE && mo)
    9031                         f += (f ? ';' : '') + k + ':' + v;
    9032                     else
    9033                         f += (f ? ',' : '') + k + '=' + v;
    9034                 }
    9035             });
    9036 
    9037             t.features = s;
    9038             t.params = p;
    9039             t.onOpen.dispatch(t, s, p);
    9040 
    9041             try {
    9042                 if (isIE && mo) {
    9043                     w = 1;
    9044                     window.showModalDialog(s.url || s.file, window, f);
    9045                 } else
    9046                     w = window.open(s.url || s.file, s.name, f);
    9047             } catch (ex) {
    9048                 // Ignore
    9049             }
    9050 
    9051             if (!w)
    9052                 alert(t.editor.getLang('popup_blocked'));
    9053         },
    9054 
    9055         close : function(w) {
    9056             w.close();
    9057             this.onClose.dispatch(this);
    9058         },
    9059 
    9060         createInstance : function(cl) {
    9061             var a = arguments, i, f = tinymce.resolve(cl), s = '';
    9062 
    9063             // Is there a better way to dynamically create
    9064             // a class with a dynamic number of arguments
    9065             for (i=1; i<a.length; i++)
    9066                 s += (i > 1 ? ',' : '') + 'a[' + i + ']';
    9067 
    9068             return eval('(new f(' + s + '))');
    9069         },
    9070 
    9071         confirm : function(t, cb, s) {
    9072             cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t))));
    9073         },
    9074 
    9075         alert : function(t, cb, s) {
    9076             alert(this._decode(t));
    9077 
    9078             if (cb)
    9079                 cb.call(s || this);
    9080         },
    9081 
    9082         // Internal functions
    9083 
    9084         _decode : function(s) {
    9085             return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
    9086         }
    9087 
    9088         });
    9089 }());
     1var tinymce={majorVersion:'3',minorVersion:'0',releaseDate:'2008-01-30',_init:function(){var t=this,ua=navigator.userAgent,i,nl,n,base;t.isOpera=window.opera&&opera.buildNumber;t.isWebKit=/WebKit/.test(ua);t.isOldWebKit=t.isWebKit&&!window.getSelection().getRangeAt;t.isIE=!t.isWebKit&&!t.isOpera&&(/MSIE/gi).test(ua)&&(/Explorer/gi).test(navigator.appName);t.isIE6=t.isIE&&/MSIE [56]/.test(ua);t.isGecko=!t.isWebKit&&/Gecko/.test(ua);t.isMac=ua.indexOf('Mac')!=-1;if(window.tinyMCEPreInit){t.suffix=tinyMCEPreInit.suffix;t.baseURL=tinyMCEPreInit.base;return;}t.suffix='';nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)base=nl[i].href;}function getBase(n){if(n.src&&/tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)){if(/_(src|dev)\.js/g.test(n.src))t.suffix='_src';t.baseURL=n.src.substring(0,n.src.lastIndexOf('/'));if(base&&t.baseURL.indexOf('://')==-1)t.baseURL=base+t.baseURL;return t.baseURL;}return null;};nl=document.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}n=document.getElementsByTagName('head')[0];if(n){nl=n.getElementsByTagName('script');for(i=0;i<nl.length;i++){if(getBase(nl[i]))return;}}return;},is:function(o,t){var n=typeof(o);if(!t)return n!='undefined';if(t=='array'&&(o instanceof Array))return true;return n==t;},each:function(o,cb,s){var n,l;if(!o)return 0;s=s||o;if(typeof(o.length)!='undefined'){for(n=0,l=o.length;n<l;n++){if(cb.call(s,o[n],n,o)===false)return 0;}}else{for(n in o){if(o.hasOwnProperty(n)){if(cb.call(s,o[n],n,o)===false)return 0;}}}return 1;},map:function(a,f){var o=[];tinymce.each(a,function(v){o.push(f(v));});return o;},grep:function(a,f){var o=[];tinymce.each(a,function(v){if(!f||f(v))o.push(v);});return o;},inArray:function(a,v){var i,l;if(a){for(i=0,l=a.length;i<l;i++){if(a[i]===v)return i;}}return-1;},extend:function(o,e){var i,a=arguments;for(i=1;i<a.length;i++){e=a[i];tinymce.each(e,function(v,n){if(typeof(v)!=='undefined')o[n]=v;});}return o;},trim:function(s){return(s?''+s:'').replace(/^\s*|\s*$/g,'');},create:function(s,p){var t=this,sp,ns,cn,scn,c,de=0;s=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);cn=s[3].match(/(^|\.)(\w+)$/i)[2];ns=t.createNS(s[3].replace(/\.\w+$/,''));if(ns[cn])return;if(s[2]=='static'){ns[cn]=p;if(this.onCreate)this.onCreate(s[2],s[3],ns[cn]);return;}if(!p[cn]){p[cn]=function(){};de=1;}ns[cn]=p[cn];t.extend(ns[cn].prototype,p);if(s[5]){sp=t.resolve(s[5]).prototype;scn=s[5].match(/\.(\w+)$/i)[1];c=ns[cn];if(de){ns[cn]=function(){return sp[scn].apply(this,arguments);};}else{ns[cn]=function(){this.parent=sp[scn];return c.apply(this,arguments);};}ns[cn].prototype[cn]=ns[cn];t.each(sp,function(f,n){if(n!=scn)ns[cn].prototype[n]=sp[n];});t.each(p,function(f,n){if(sp[n]){ns[cn].prototype[n]=function(){this.parent=sp[n];return f.apply(this,arguments);};}else{if(n!=cn)ns[cn].prototype[n]=f;}});}t.each(p['static'],function(f,n){ns[cn][n]=f;});if(this.onCreate)this.onCreate(s[2],s[3],ns[cn].prototype);},walk:function(o,f,n,s){s=s||this;if(o){if(n)o=o[n];tinymce.each(o,function(o,i){if(f.call(s,o,i,n)===false)return false;tinymce.walk(o,f,n,s);});}},createNS:function(n,o){var i,v;o=o||window;n=n.split('.');for(i=0;i<n.length;i++){v=n[i];if(!o[v])o[v]={};o=o[v];}return o;},resolve:function(n,o){var i,l;o=o||window;n=n.split('.');for(i=0,l=n.length;i<l;i++){o=o[n[i]];if(!o)break;}return o;},addUnload:function(f,s){var t=this,w=window,unload;f={func:f,scope:s||this};if(!t.unloads){unload=function(){var li=t.unloads,o,n;for(n in li){o=li[n];if(o&&o.func)o.func.call(o.scope);}if(w.detachEvent)w.detachEvent('onunload',unload);else if(w.removeEventListener)w.removeEventListener('unload',unload,false);o=li=w=unload=null;if(window.CollectGarbage)window.CollectGarbage();};if(w.attachEvent)w.attachEvent('onunload',unload);else if(w.addEventListener)w.addEventListener('unload',unload,false);t.unloads=[f];}else t.unloads.push(f);return f;},removeUnload:function(f){var u=this.unloads,r=null;tinymce.each(u,function(o,i){if(o&&o.func==f){u.splice(i,1);r=f;return false;}});return r;}};window.tinymce=tinymce;tinymce._init();tinymce.create('tinymce.util.Dispatcher',{scope:null,listeners:null,Dispatcher:function(s){this.scope=s||this;this.listeners=[];},add:function(cb,s){this.listeners.push({cb:cb,scope:s||this.scope});return cb;},addToTop:function(cb,s){this.listeners.unshift({cb:cb,scope:s||this.scope});return cb;},remove:function(cb){var l=this.listeners,o=null;tinymce.each(l,function(c,i){if(cb==c.cb){o=cb;l.splice(i,1);return false;}});return o;},dispatch:function(){var s,a=arguments;tinymce.each(this.listeners,function(c){return s=c.cb.apply(c.scope,a);});return s;}});(function(){var each=tinymce.each;tinymce.create('tinymce.util.URI',{URI:function(u,s){var t=this,o,a,b;s=t.settings=s||{};if(/^(mailto|news|javascript|about):/i.test(u)||/^\s*#/.test(u)){t.source=u;return;}if(u.indexOf('/')===0&&u.indexOf('//')!==0)u=(s.base_uri?s.base_uri.protocol||'http':'http')+'://mce_host'+u;if(u.indexOf('://')===-1&&u.indexOf('//')!==0)u=(s.base_uri.protocol||'http')+'://mce_host'+t.toAbsPath(s.base_uri.path,u);u=u.replace(/@@/g,'(mce_at)');u=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(v,i){var s=u[i];if(s)s=s.replace(/\(mce_at\)/g,'@@');t[v]=s;});if(b=s.base_uri){if(!t.protocol)t.protocol=b.protocol;if(!t.userInfo)t.userInfo=b.userInfo;if(!t.port&&t.host=='mce_host')t.port=b.port;if(!t.host||t.host=='mce_host')t.host=b.host;t.source='';}},setPath:function(p){var t=this;p=/^(.*?)\/?(\w+)?$/.exec(p);t.path=p[0];t.directory=p[1];t.file=p[2];t.source='';t.getURI();},toRelative:function(u){var t=this,o;u=new tinymce.util.URI(u,{base_uri:t});if((u.host!='mce_host'&&t.host!=u.host&&u.host)||t.port!=u.port||t.protocol!=u.protocol)return u.getURI();o=t.toRelPath(t.path,u.path);if(u.query)o+='?'+u.query;if(u.anchor)o+='#'+u.anchor;return o;},toAbsolute:function(u,nh){var u=new tinymce.util.URI(u,{base_uri:this});return u.getURI(this.host==u.host?nh:0);},toRelPath:function(base,path){var items,bp=0,out='',i;base=base.substring(0,base.lastIndexOf('/'));base=base.split('/');items=path.split('/');if(base.length>=items.length){for(i=0;i<base.length;i++){if(i>=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length<items.length){for(i=0;i<items.length;i++){if(i>=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i<base.length-(bp-1);i++)out+="../";for(i=bp-1;i<items.length;i++){if(i!=bp-1)out+="/"+items[i];else out+=items[i];}return out;},toAbsPath:function(base,path){var i,nb=0,o=[];base=base.split('/');path=path.split('/');each(base,function(k){if(k)o.push(k);});base=o;for(i=path.length-1,o=[];i>=0;i--){if(path[i].length==0||path[i]==".")continue;if(path[i]=='..'){nb++;continue;}if(nb>0){nb--;continue;}o.push(path[i]);}i=base.length-nb;if(i<=0)return'/'+o.reverse().join('/');return'/'+base.slice(0,i).join('/')+'/'+o.reverse().join('/');},getURI:function(nh){var s,t=this;if(!t.source||nh){s='';if(!nh){if(t.protocol)s+=t.protocol+'://';if(t.userInfo)s+=t.userInfo+'@';if(t.host)s+=t.host;if(t.port)s+=':'+t.port;}if(t.path)s+=t.path;if(t.query)s+='?'+t.query;if(t.anchor)s+='#'+t.anchor;t.source=s;}return t.source;}});})();(function(){var each=tinymce.each;tinymce.create('static tinymce.util.Cookie',{getHash:function(n){var v=this.get(n),h;if(v){each(v.split('&'),function(v){v=v.split('=');h=h||{};h[unescape(v[0])]=unescape(v[1]);});}return h;},setHash:function(n,v,e,p,d,s){var o='';each(v,function(v,k){o+=(!o?'':'&')+escape(k)+'='+escape(v);});this.set(n,o,e,p,d,s);},get:function(n){var c=document.cookie,e,p=n+"=",b;if(!c)return;b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0)return null;}else b+=2;e=c.indexOf(";",b);if(e==-1)e=c.length;return unescape(c.substring(b+p.length,e));},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+((e)?"; expires="+e.toGMTString():"")+((p)?"; path="+escape(p):"")+((d)?"; domain="+d:"")+((s)?"; secure":"");},remove:function(n,p){var d=new Date();d.setTime(d.getTime()-1000);this.set(n,'',d,p,d);}});})();tinymce.create('static tinymce.util.JSON',{serialize:function(o){var i,v,s=tinymce.util.JSON.serialize,t;if(o==null)return'null';t=typeof o;if(t=='string'){v='\bb\tt\nn\ff\rr\""\'\'\\\\';return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g,function(a,b){i=v.indexOf(b);if(i+1)return'\\'+v.charAt(i+1);a=b.charCodeAt().toString(16);return'\\u'+'0000'.substring(a.length)+a;})+'"';}if(t=='object'){if(o instanceof Array){for(i=0,v='[';i<o.length;i++)v+=(i>0?',':'')+s(o[i]);return v+']';}v='{';for(i in o)v+=typeof o[i]!='function'?(v.length>1?',"':'"')+i+'":'+s(o[i]):'';return v+'}';}return''+o;},parse:function(s){try{return eval('('+s+')');}catch(ex){}}});tinymce.create('static tinymce.util.XHR',{send:function(o){var x,t,w=window,c=0;o.scope=o.scope||this;o.success_scope=o.success_scope||o.scope;o.error_scope=o.error_scope||o.scope;o.async=o.async===false?false:true;o.data=o.data||'';function get(s){x=0;try{x=new ActiveXObject(s);}catch(ex){}return x;};x=w.XMLHttpRequest?new XMLHttpRequest():get('Microsoft.XMLHTTP')||get('Msxml2.XMLHTTP');if(x){if(x.overrideMimeType)x.overrideMimeType(o.content_type);x.open(o.type||(o.data?'POST':'GET'),o.url,o.async);if(o.content_type)x.setRequestHeader('Content-Type',o.content_type);x.send(o.data);t=w.setInterval(function(){if(x.readyState==4||c++>10000){w.clearInterval(t);if(o.success&&c<10000&&x.status==200)o.success.call(o.success_scope,''+x.responseText,x,o);else if(o.error)o.error.call(o.error_scope,c>10000?'TIMED_OUT':'GENERAL',x,o);x=null;}},10);}}});(function(){var extend=tinymce.extend,JSON=tinymce.util.JSON,XHR=tinymce.util.XHR;tinymce.create('tinymce.util.JSONRequest',{JSONRequest:function(s){this.settings=extend({},s);this.count=0;},send:function(o){var ecb=o.error,scb=o.success;o=extend(this.settings,o);o.success=function(c,x){c=JSON.parse(c);if(typeof(c)=='undefined'){c={error:'JSON Parse error.'};}if(c.error)ecb.call(o.error_scope||o.scope,c.error,x);else scb.call(o.success_scope||o.scope,c.result);};o.error=function(ty,x){ecb.call(o.error_scope||o.scope,ty,x);};o.data=JSON.serialize({id:o.id||'c'+(this.count++),method:o.method,params:o.params});XHR.send(o);},'static':{sendRPC:function(o){return new tinymce.util.JSONRequest().send(o);}}});}());(function(){var each=tinymce.each,is=tinymce.is;var isWebKit=tinymce.isWebKit,isIE=tinymce.isIE;tinymce.create('tinymce.dom.DOMUtils',{doc:null,root:null,files:null,listeners:{},pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,cache:{},idPattern:/^#[\w]+$/,elmPattern:/^[\w_*]+$/,elmClassPattern:/^([\w_]*)\.([\w_]+)$/,DOMUtils:function(d,s){var t=this;t.doc=d;t.files={};t.cssFlicker=false;t.counter=0;t.boxModel=!tinymce.isIE||d.compatMode=="CSS1Compat";this.settings=s=tinymce.extend({keep_values:false,hex_colors:1,process_html:1},s);if(tinymce.isIE6){try{d.execCommand('BackgroundImageCache',false,true);}catch(e){t.cssFlicker=true;}}tinymce.addUnload(function(){t.doc=t.root=null;});},getRoot:function(){var t=this,s=t.settings;return(s&&t.get(s.root_element))||t.doc.body;},getViewPort:function(w){var d,b;w=!w?window:w;d=w.document;b=this.boxModel?d.documentElement:d.body;return{x:w.pageXOffset||b.scrollLeft,y:w.pageYOffset||b.scrollTop,w:w.innerWidth||b.clientWidth,h:w.innerHeight||b.clientHeight};},getRect:function(e){var p,t=this,w,h;e=t.get(e);p=t.getPos(e);w=t.getStyle(e,'width');h=t.getStyle(e,'height');if(w.indexOf('px')===-1)w=0;if(h.indexOf('px')===-1)h=0;return{x:p.x,y:p.y,w:parseInt(w)||e.offsetWidth||e.clientWidth,h:parseInt(h)||e.offsetHeight||e.clientHeight};},getParent:function(n,f,r){var na,se=this.settings;n=this.get(n);if(se.strict_root)r=r||this.getRoot();if(is(f,'string')){na=f.toUpperCase();f=function(n){var s=false;if(n.nodeType==1&&na==='*'){s=true;return false;}each(na.split(','),function(v){if(n.nodeType==1&&((se.strict&&n.nodeName.toUpperCase()==v)||n.nodeName==v)){s=true;return false;}});return s;};}while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode;}return null;},get:function(e){if(typeof(e)=='string')return this.doc.getElementById(e);return e;},select:function(pa,s){var t=this,cs,c,pl,o=[],x,i,l,n;s=t.get(s)||t.doc;if(t.settings.strict){function get(s,n){return s.getElementsByTagName(n.toLowerCase());};}else{function get(s,n){return s.getElementsByTagName(n);};}if(t.elmPattern.test(pa)){x=get(s,pa);for(i=0,l=x.length;i<l;i++)o.push(x[i]);return o;}if(t.elmClassPattern.test(pa)){pl=t.elmClassPattern.exec(pa);x=get(s,pl[1]||'*');c=' '+pl[2]+' ';for(i=0,l=x.length;i<l;i++){n=x[i];if(n.className&&(' '+n.className+' ').indexOf(c)!==-1)o.push(n);}return o;}function collect(n){if(!n.mce_save){n.mce_save=1;o.push(n);}};function collectIE(n){if(!n.getAttribute('mce_save')){n.setAttribute('mce_save','1');o.push(n);}};function find(n,f,r){var i,l,nl=get(r,n);for(i=0,l=nl.length;i<l;i++)f(nl[i]);};each(pa.split(','),function(v,i){v=tinymce.trim(v);if(t.elmPattern.test(v)){each(get(s,v),function(n){collect(n);});return;}if(t.elmClassPattern.test(v)){x=t.elmClassPattern.exec(v);each(get(s,x[1]),function(n){if(t.hasClass(n,x[2]))collect(n);});return;}if(!(cs=t.cache[pa])){cs='x=(function(cf, s) {';pl=v.split(' ');each(pl,function(v){var p=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v);p[1]=p[1]||'*';cs+='find("'+p[1]+'", function(n) {';if(p[2])cs+='if (n.id !== "'+p[2]+'") return;';if(p[3]){cs+='var c = " " + n.className + " ";';cs+='if (';c='';each(p[3].split('.'),function(v){if(v)c+=(c?'||':'')+'c.indexOf(" '+v+' ") === -1';});cs+=c+') return;';}});cs+='cf(n);';for(i=pl.length-1;i>=0;i--)cs+='}, '+(i?'n':'s')+');';cs+='})';t.cache[pa]=cs=eval(cs);}cs(isIE?collectIE:collect,s);});each(o,function(n){if(isIE)n.removeAttribute('mce_save');else delete n.mce_save;});return o;},add:function(p,n,a,h,c){var t=this;return this.run(p,function(p){var e,k;e=is(n,'string')?t.doc.createElement(n):n;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}if(h){if(h.nodeType)e.appendChild(h);else t.setHTML(e,h);}return!c?p.appendChild(e):e;});},create:function(n,a,h){return this.add(this.doc.createElement(n),n,a,h,1);},createHTML:function(n,a,h){var o='',t=this,k;o+='<'+n;for(k in a){if(a.hasOwnProperty(k))o+=' '+k+'="'+t.encode(a[k])+'"';}if(tinymce.is(h))return o+'>'+h+'</'+n+'>';return o+' />';},remove:function(n,k){return this.run(n,function(n){var p;p=n.parentNode;if(!p)return null;if(k){each(n.childNodes,function(c){p.insertBefore(c.cloneNode(true),n);});}return p.removeChild(n);});},setStyle:function(n,na,v){var t=this;return t.run(n,function(e){var s,i;s=e.style;na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(t.pixelStyles.test(na)&&(tinymce.is(v,'number')||/^[\-0-9\.]+$/.test(v)))v+='px';switch(na){case'opacity':if(isIE){s.filter=v===''?'':"alpha(opacity="+(v*100)+")";if(!n.currentStyle||!n.currentStyle.hasLayout)s.display='inline-block';}s['-moz-opacity']=s['-khtml-opacity']=v;break;case'float':isIE?s.styleFloat=v:s.cssFloat=v;break;}s[na]=v||'';if(t.settings.update_styles)t.setAttrib(e,'mce_style');});},getStyle:function(n,na,c){n=this.get(n);if(!n)return false;if(this.doc.defaultView&&c){na=na.replace(/[A-Z]/g,function(a){return'-'+a;});try{return this.doc.defaultView.getComputedStyle(n,null).getPropertyValue(na);}catch(ex){return null;}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase();});if(na=='float')na=isIE?'styleFloat':'cssFloat';if(n.currentStyle&&c)return n.currentStyle[na];return n.style[na];},setStyles:function(e,o){var t=this,s=t.settings,ol;ol=s.update_styles;s.update_styles=0;each(o,function(v,n){t.setStyle(e,n,v);});s.update_styles=ol;if(s.update_styles)t.setAttrib(e,s.cssText);},setAttrib:function(e,n,v){var t=this;if(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":if(s.keep_values){if(v)e.setAttribute('mce_style',v,2);else e.removeAttribute('mce_style',2);}e.style.cssText=v;break;case"class":e.className=v;break;case"src":case"href":if(s.keep_values){if(s.url_converter)v=s.url_converter.call(s.url_converter_scope||t,v,n,e);t.setAttrib(e,'mce_'+n,v,2);}break;}if(is(v)&&v!==null&&v.length!==0)e.setAttribute(n,''+v,2);else e.removeAttribute(n,2);});},setAttribs:function(e,o){var t=this;return this.run(e,function(e){each(o,function(v,n){t.setAttrib(e,n,v);});});},getAttrib:function(e,n,dv){var v,t=this;e=t.get(e);if(!e)return false;if(!is(dv))dv="";if(/^(src|href|style|coords)$/.test(n)){v=e.getAttribute("mce_"+n);if(v)return v;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'style':v=v||e.style.cssText;if(v){v=t.serializeStyle(t.parseStyle(v));if(t.settings.keep_values)e.setAttribute('mce_style',v);}break;}if(isWebKit&&n==="class"&&v)v=v.replace(/(apple|webkit)\-[a-z\-]+/gi,'');if(isIE){switch(n){case'rowspan':case'colspan':if(v===1)v='';break;case'size':if(v==='+0')v='';break;case'hspace':if(v===-1)v='';break;case'tabindex':if(v===32768)v='';break;case'shape':v=v.toLowerCase();break;default:if(n.indexOf('on')===0&&v)v=(''+v).replace(/^function\s+anonymous\(\)\s+\{\s+(.*)\s+\}$/,'$1');}}return(v&&v!='')?''+v:dv;},getPos:function(n){var t=this,x=0,y=0,e,d=t.doc,r;n=t.get(n);if(n&&isIE){n=n.getBoundingClientRect();e=t.boxModel?d.documentElement:d.body;x=t.getStyle(t.select('html')[0],'borderWidth');x=(x=='medium'||t.boxModel&&!t.isIE6)&&2||x;n.top+=window.self!=window.top?2:0;return{x:n.left+e.scrollLeft-x,y:n.top+e.scrollTop-x};}r=n;while(r){x+=r.offsetLeft||0;y+=r.offsetTop||0;r=r.offsetParent;}r=n;while(r){x-=r.scrollLeft||0;y-=r.scrollTop||0;r=r.parentNode;if(r==d.body)break;}return{x:x,y:y};},parseStyle:function(st){var t=this,s=t.settings,o={};if(!st)return o;function compress(p,s,ot){var t,r,b,l;t=o[p+'-top'+s];if(!t)return;r=o[p+'-right'+s];if(t!=r)return;b=o[p+'-bottom'+s];if(r!=b)return;l=o[p+'-left'+s];if(b!=l)return;o[ot]=l;delete o[p+'-top'+s];delete o[p+'-right'+s];delete o[p+'-bottom'+s];delete o[p+'-left'+s];};function compress2(ta,a,b,c){var t;t=o[a];if(!t)return;t=o[b];if(!t)return;t=o[c];if(!t)return;o[ta]=o[a]+' '+o[b]+' '+o[c];delete o[a];delete o[b];delete o[c];};each(st.split(';'),function(v){var sv,ur=[];if(v){v=v.replace(/url\([^\)]+\)/g,function(v){ur.push(v);return'url('+ur.length+')';});v=v.split(':');sv=tinymce.trim(v[1]);sv=sv.replace(/url\(([^\)]+)\)/g,function(a,b){return ur[parseInt(b)-1];});sv=sv.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});if(s.url_converter){sv=sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),'style',null))+')';});}o[tinymce.trim(v[0]).toLowerCase()]=sv;}});compress("border","","border");compress("border","-width","border-width");compress("border","-color","border-color");compress("border","-style","border-style");compress("padding","","padding");compress("margin","","margin");compress2('border','border-width','border-style','border-color');if(isIE){if(o.border=='medium none')o.border='';}return o;},serializeStyle:function(o){var s='';each(o,function(v,k){if(k&&v){switch(k){case'color':case'background-color':v=v.toLowerCase();break;}s+=(s?' ':'')+k+': '+v+';';}});return s;},loadCSS:function(u){var t=this,d=this.doc;if(!u)u='';each(u.split(','),function(u){if(t.files[u])return;t.files[u]=true;if(!d.createStyleSheet)t.add(t.select('head')[0],'link',{rel:'stylesheet',href:u});else d.createStyleSheet(u);});},addClass:function(e,c){return this.run(e,function(e){var o;if(!c)return 0;if(this.hasClass(e,c))return e.className;o=this.removeClass(e,c);return e.className=(o!=''?(o+' '):'')+c;});},removeClass:function(e,c){var t=this,re;return t.run(e,function(e){var v;if(t.hasClass(e,c)){if(!re)re=new RegExp("(^|\\s+)"+c+"(\\s+|$)","g");v=e.className.replace(re,' ');return e.className=tinymce.trim(v!=' '?v:'');}return e.className;});},hasClass:function(n,c){n=this.get(n);if(!n||!c)return false;return(' '+n.className+' ').indexOf(' '+c+' ')!==-1;},show:function(e){return this.setStyle(e,'display','block');},hide:function(e){return this.setStyle(e,'display','none');},isHidden:function(e){e=this.get(e);return e.style.display=='none'||this.getStyle(e,'display')=='none';},uniqueId:function(p){return(!p?'mce_':p)+(this.counter++);},setHTML:function(e,h){var t=this;return this.run(e,function(e){var x;h=t.processHTML(h);if(isIE){try{e.innerHTML='<br />'+h;e.removeChild(e.firstChild);}catch(ex){x=t.create('div');x.innerHTML='<br />'+h;each(x.childNodes,function(n,i){if(i>1)e.appendChild(n);});}}else e.innerHTML=h;return h;});},processHTML:function(h){var t=this,s=t.settings;if(!s.process_html)return h;if(tinymce.isGecko){h=h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,'<$1b$2>');h=h.replace(/<(\/?)em>|<em( [^>]+)>/gi,'<$1i$2>');}h=h.replace(/<a( )([^>]+)\/>|<a\/>/gi,'<a$1$2></a>');if(s.keep_values){if(h.indexOf('<script')!==-1){h=h.replace(/<script>/g,'<script type="text/javascript">');h=h.replace(/<script(|[^>]+)>(\s*<!--|\/\/\s*<\[CDATA\[)?[\r\n]*/g,'<mce:script$1><!--\n');h=h.replace(/\s*(\/\/\s*-->|\/\/\s*]]>)?<\/script>/g,'\n// --></mce:script>');h=h.replace(/<mce:script(|[^>]+)><!--\n\/\/ --><\/mce:script>/g,'<mce:script$1></mce:script>');}h=h.replace(/<([\w:]+) [^>]*(src|href|style|coords)[^>]*>/gi,function(a,n){function handle(m,b,c){var u=c;if(a.indexOf('mce_'+b)!=-1)return m;if(b=='style'){if(s.hex_colors){u=u.replace(/rgb\([^\)]+\)/g,function(v){return t.toHex(v);});}if(s.url_converter){u=u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(x,c){return'url('+t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n))+')';});}}else if(b!='coords'){if(s.url_converter)u=t.encode(s.url_converter.call(s.url_converter_scope||t,t.decode(c),b,n));}return' '+b+'="'+c+'" mce_'+b+'="'+u+'"';};a=a.replace(/ (src|href|style|coords)=[\"]([^\"]+)[\"]/gi,handle);a=a.replace(/ (src|href|style|coords)=[\']([^\']+)[\']/gi,handle);return a.replace(/ (src|href|style|coords)=([^\s\"\'>]+)/gi,handle);});}return h;},getOuterHTML:function(e){var d;e=this.get(e);if(!e)return null;if(isIE)return e.outerHTML;d=(e.ownerDocument||this.doc).createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML;},setOuterHTML:function(e,h,d){var t=this;return this.run(e,function(e){var n,tp;e=t.get(e);d=d||e.ownerDocument||t.doc;if(isIE&&e.nodeType==1)e.outerHTML=h;else{tp=d.createElement("body");tp.innerHTML=h;n=tp.lastChild;while(n){t.insertAfter(n.cloneNode(true),e);n=n.previousSibling;}t.remove(e);}});},decode:function(s){var e=document.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;},encode:function(s){return s?(''+s).replace(/[<>&\"]/g,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;';}return c;}):s;},insertAfter:function(n,r){var t=this;r=t.get(r);return this.run(n,function(n){var p,ns;p=r.parentNode;ns=r.nextSibling;if(ns)p.insertBefore(n,ns);else p.appendChild(n);return n;});},isBlock:function(n){if(n.nodeType&&n.nodeType!==1)return false;n=n.nodeName||n;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);},replace:function(n,o,k){if(is(o,'array'))n=n.cloneNode(true);return this.run(o,function(o){if(k){each(o.childNodes,function(c){n.appendChild(c.cloneNode(true));});}return o.parentNode.replaceChild(n,o);});},toHex:function(s){var c=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);function hex(s){s=parseInt(s).toString(16);return s.length>1?s:'0'+s;};if(c){s='#'+hex(c[1])+hex(c[2])+hex(c[3]);return s;}return s;},getClasses:function(){var t=this,cl=[],i,lo={},f=t.settings.class_filter;if(t.classes)return t.classes;function addClasses(s){each(s.imports,function(r){addClasses(r);});each(s.cssRules||s.rules,function(r){switch(r.type||1){case 1:if(r.selectorText){each(r.selectorText.split(','),function(v){v=v.replace(/^\s*|\s*$|^\s\./g,"");if(f&&!(v=f(v)))return;if(/^\.mce/.test(v)||!/^\.[\w\-]+$/.test(v))return;v=v.substring(1);if(!lo[v]){cl.push({'class':v});lo[v]=1;}});}break;case 3:addClasses(r.styleSheet);break;}});};try{each(t.doc.styleSheets,addClasses);}catch(ex){}if(cl.length>0)t.classes=cl;return cl;},run:function(e,f,s){var t=this,o;if(typeof(e)==='string')e=t.doc.getElementById(e);if(!e)return false;s=s||this;if(!e.nodeType&&(e.length||e.length===0)){o=[];each(e,function(e,i){if(e){if(typeof(e)=='string')e=t.doc.getElementById(e);o.push(f.call(s,e,i));}});return o;}return f.call(s,e);}});tinymce.DOM=new tinymce.dom.DOMUtils(document,{process_html:0});})();(function(){var each=tinymce.each,DOM=tinymce.DOM,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit,Event;tinymce.create('static tinymce.dom.Event',{inits:[],events:[],add:function(o,n,f,s){var cb,t=this,el=t.events,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.add(o,n,f,s));});return r;}o=DOM.get(o);if(!o)return;cb=function(e){e=e||window.event;if(e&&!e.target&&isIE)e.target=e.srcElement;if(!s)return f(e);return f.call(s,e);};if(n=='unload'){tinymce.unloads.unshift({func:cb});return cb;}if(n=='init'){if(t.domLoaded)cb();else t.inits.push(cb);return cb;}el.push({obj:o,name:n,func:f,cfunc:cb,scope:s});t._add(o,n,cb);return f;},remove:function(o,n,f){var t=this,a=t.events,s=false,r;if(o&&o instanceof Array){r=[];each(o,function(o){o=DOM.get(o);r.push(t.remove(o,n,f));});return r;}o=DOM.get(o);each(a,function(e,i){if(e.obj==o&&e.name==n&&(!f||(e.func==f||e.cfunc==f))){a.splice(i,1);t._remove(o,n,e.cfunc);s=true;return false;}});return s;},cancel:function(e){if(!e)return false;this.stop(e);return this.prevent(e);},stop:function(e){if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;},prevent:function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;},_unload:function(){var t=Event;each(t.events,function(e,i){t._remove(e.obj,e.name,e.cfunc);e.obj=e.cfunc=null;});t.events=[];t=null;},_add:function(o,n,f){if(o.attachEvent)o.attachEvent('on'+n,f);else if(o.addEventListener)o.addEventListener(n,f,false);else o['on'+n]=f;},_remove:function(o,n,f){if(o.detachEvent)o.detachEvent('on'+n,f);else if(o.removeEventListener)o.removeEventListener(n,f,false);else o['on'+n]=null;},_pageInit:function(){var e=Event;e._remove(window,'DOMContentLoaded',e._pageInit);e.domLoaded=true;each(e.inits,function(c){c();});e.inits=[];},_wait:function(){var t;if(window.tinyMCE_GZ&&tinyMCE_GZ.loaded)return;if(isIE&&document.location.protocol!='https:'){document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');DOM.get("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){Event._pageInit();DOM.get("__ie_onload").onreadystatechange=null;}};}else{Event._add(window,'DOMContentLoaded',Event._pageInit,Event);if(isIE||isWebKit){t=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(t);Event._pageInit();}},10);}}}});Event=tinymce.dom.Event;Event._wait();tinymce.addUnload(Event._unload);})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.Element',{Element:function(id,s){var t=this,dom,el;s=s||{};t.id=id;t.dom=dom=s.dom||tinymce.DOM;t.settings=s;if(!tinymce.isIE)el=t.dom.get(t.id);each(['getPos','getRect','getParent','add','setStyle','getStyle','setStyles','setAttrib','setAttribs','getAttrib','addClass','removeClass','hasClass','getOuterHTML','setOuterHTML','remove','show','hide','isHidden','setHTML','get'],function(k){t[k]=function(){var a=arguments,o;if(tinymce.isOpera){a=[id];each(arguments,function(v){a.push(v);});}else Array.prototype.unshift.call(a,el||id);o=dom[k].apply(dom,a);t.update(k);return o;};});},on:function(n,f,s){return tinymce.dom.Event.add(this.id,n,f,s);},getXY:function(){return{x:parseInt(this.getStyle('left')),y:parseInt(this.getStyle('top'))};},getSize:function(){var n=this.dom.get(this.id);return{w:parseInt(this.getStyle('width')||n.clientWidth),h:parseInt(this.getStyle('height')||n.clientHeight)};},moveTo:function(x,y){this.setStyles({left:x,top:y});},moveBy:function(x,y){var p=this.getXY();this.moveTo(p.x+x,p.y+y);},resizeTo:function(w,h){this.setStyles({width:w,height:h});},resizeBy:function(w,h){var s=this.getSize();this.resizeTo(s.w+w,s.h+h);},update:function(k){var t=this,b,dom=t.dom;if(tinymce.isIE6&&t.settings.blocker){k=k||'';if(k.indexOf('get')===0||k.indexOf('has')===0||k.indexOf('is')===0)return;if(k=='remove'){dom.remove(t.blocker);return;}if(!t.blocker){t.blocker=dom.uniqueId();b=dom.add(t.settings.container||dom.getRoot(),'iframe',{id:t.blocker,style:'position:absolute;',frameBorder:0,src:'javascript:""'});dom.setStyle(b,'opacity',0);}else b=dom.get(t.blocker);dom.setStyle(b,'left',t.getStyle('left',1));dom.setStyle(b,'top',t.getStyle('top',1));dom.setStyle(b,'width',t.getStyle('width',1));dom.setStyle(b,'height',t.getStyle('height',1));dom.setStyle(b,'display',t.getStyle('display',1));dom.setStyle(b,'zIndex',parseInt(t.getStyle('zIndex',1)||0)-1);}}});})();(function(){var is=tinymce.is,isIE=tinymce.isIE,each=tinymce.each;tinymce.create('tinymce.dom.Selection',{Selection:function(dom,win,serializer){var t=this;t.dom=dom;t.win=win;t.serializer=serializer;tinymce.addUnload(function(){t.win=null;});},getContent:function(s){var t=this,r=t.getRng(),e=t.dom.create("body"),se=t.getSel(),wb,wa,n;s=s||{};wb=wa='';s.get=true;s.format=s.format||'html';if(s.format=='text')return t.isCollapsed()?'':(r.text||(se.toString?se.toString():''));if(r.cloneContents){n=r.cloneContents();if(n)e.appendChild(n);}else if(is(r.item)||is(r.htmlText))e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();if(/^\s/.test(e.innerHTML))wb=' ';if(/\s+$/.test(e.innerHTML))wa=' ';s.getInner=true;return t.isCollapsed()?'':wb+t.serializer.serialize(e,s)+wa;},setContent:function(h,s){var t=this,r=t.getRng(),d;s=s||{format:'html'};s.set=true;h=t.dom.processHTML(h);if(r.insertNode){d=t.win.document;if(tinymce.isGecko&&h.indexOf('<')==-1){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h+'<span id="__caret">_</span>'));t.select(t.dom.get('__caret'));t.getRng().deleteContents();return;}if(d.queryCommandEnabled('InsertHTML'))return d.execCommand('InsertHTML',false,h);r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h));}else{if(r.item)r.item(0).outerHTML=h;else r.pasteHTML(h);}},getStart:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(1);e=r.parentElement();if(e.nodeName=='BODY')return e.firstChild;return e;}else{e=r.startContainer;if(e.nodeName=='BODY')return e.firstChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getEnd:function(){var t=this,r=t.getRng(),e;if(isIE){if(r.item)return r.item(0);r=r.duplicate();r.collapse(0);e=r.parentElement();if(e.nodeName=='BODY')return e.lastChild;return e;}else{e=r.endContainer;if(e.nodeName=='BODY')return e.lastChild;return t.dom.getParent(e,function(n){return n.nodeType==1;});}},getBookmark:function(si){var t=this,r=t.getRng(),tr,sx,sy,vp=t.dom.getViewPort(t.win),e,sp,bp,le,c=-0xFFFFFF,s,ro=t.dom.getRoot();sx=vp.x;sy=vp.y;if(si=='simple')return{rng:r,scrollX:sx,scrollY:sy};if(isIE){if(r.item){e=r.item(0);each(t.dom.select(e.nodeName),function(n,i){if(e==n){sp=i;return false;}});return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy};}tr=t.dom.doc.body.createTextRange();tr.moveToElementText(ro);tr.collapse(true);bp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(true);sp=Math.abs(tr.move('character',c));tr=r.duplicate();tr.collapse(false);le=Math.abs(tr.move('character',c))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy};}e=t.getNode();s=t.getSel();if(!s)return null;if(e&&e.nodeName=='IMG'){return{scrollX:sx,scrollY:sy};}function getPos(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d;}p+=n.nodeValue?n.nodeValue.length:0;}return null;};if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=getPos(ro,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy};}else{e=getPos(ro,r.startContainer,r.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+r.startOffset,end:e.end+r.endOffset,scrollX:sx,scrollY:sy};}},moveToBookmark:function(b){var t=this,r=t.getRng(),s=t.getSel(),ro=t.dom.getRoot(),sd;function getPos(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length);}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d;}}return null;};if(!b)return false;t.win.scrollTo(b.scrollX,b.scrollY);if(isIE){if(r=b.rng){try{r.select();}catch(ex){}return true;}t.win.focus();if(b.tag){r=ro.createControlRange();each(t.dom.select(b.tag),function(n,i){if(i==b.index)r.addElement(n);});}else{try{if(b.start<0)return true;r=s.createRange();r.moveToElementText(ro);r.collapse(true);r.moveStart('character',b.start);r.moveEnd('character',b.length);}catch(ex2){return true;}}try{r.select();}catch(ex){}return true;}if(!s)return false;if(b.rng){s.removeAllRanges();s.addRange(b.rng);}else{if(is(b.start)&&is(b.end)){try{sd=getPos(ro,b.start,b.end);if(sd){r=t.dom.doc.createRange();r.setStart(sd.startNode,sd.startOffset);r.setEnd(sd.endNode,sd.endOffset);s.removeAllRanges();s.addRange(r);}if(!tinymce.isOpera)t.win.focus();}catch(ex){}}}},select:function(n,c){var t=this,r=t.getRng(),s=t.getSel(),b,fn,ln,d=t.win.document;function first(n){return n?d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false).nextNode():null;};function last(n){var c,o,w;if(!n)return null;w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while(c=w.nextNode())o=c;return o;};if(isIE){try{b=d.body;if(/^(IMG|TABLE)$/.test(n.nodeName)){r=b.createControlRange();r.addElement(n);}else{r=b.createTextRange();r.moveToElementText(n);}r.select();}catch(ex){}}else{if(c){fn=first(n);ln=last(n);if(fn&&ln){r=d.createRange();r.setStart(fn,0);r.setEnd(ln,ln.nodeValue.length);}else r.selectNode(n);}else r.selectNode(n);t.setRng(r);}return n;},isCollapsed:function(){var t=this,r=t.getRng(),s=t.getSel();if(!r||r.item)return false;return!s||r.boundingWidth==0||s.isCollapsed;},collapse:function(b){var t=this,r=t.getRng(),n;if(r.item){n=r.item(0);r=this.win.document.body.createTextRange();r.moveToElementText(n);}r.collapse(!!b);t.setRng(r);},getSel:function(){var t=this,w=this.win;return w.getSelection?w.getSelection():w.document.selection;},getRng:function(){var t=this,s=t.getSel(),r;try{if(s)r=s.rangeCount>0?s.getRangeAt(0):(s.createRange?s.createRange():t.win.document.createRange());}catch(ex){}if(!r)r=isIE?t.win.document.body.createTextRange():t.win.document.createRange();return r;},setRng:function(r){var s;if(!isIE){s=this.getSel();if(s){s.removeAllRanges();s.addRange(r);}}else{try{r.select();}catch(ex){}}},setNode:function(n){var t=this;t.setContent(t.dom.getOuterHTML(n));return n;},getNode:function(){var t=this,r=t.getRng(),s=t.getSel(),e;if(!isIE){if(!r)return t.dom.getRoot();e=r.commonAncestorContainer;if(!r.collapsed){if(r.startContainer==r.endContainer||(tinymce.isWebKit&&r.startContainer==r.endContainer.parentNode)){if(r.startOffset-r.endOffset<2||tinymce.isWebKit){if(r.startContainer.hasChildNodes())e=r.startContainer.childNodes[r.startOffset];}}}return t.dom.getParent(e,function(n){return n.nodeType==1;});}return r.item?r.item(0):r.parentElement();}});})();(function(){tinymce.create('tinymce.dom.XMLWriter',{node:null,XMLWriter:function(s){function getXML(){var i=document.implementation;if(!i||!i.createDocument){try{return new ActiveXObject('MSXML2.DOMDocument');}catch(ex){}try{return new ActiveXObject('Microsoft.XmlDom');}catch(ex){}}else return i.createDocument('','',null);};this.doc=getXML();this.reset();},reset:function(){var t=this,d=t.doc;if(d.firstChild)d.removeChild(d.firstChild);t.node=d.appendChild(d.createElement("html"));},writeStartElement:function(n){var t=this;t.node=t.node.appendChild(t.doc.createElement(n));},writeAttribute:function(n,v){if(tinymce.isOpera)v=v.replace(/>/g,'|>');this.node.setAttribute(n,v);},writeEndElement:function(){this.node=this.node.parentNode;},writeFullEndElement:function(){var t=this,n=t.node;n.appendChild(t.doc.createTextNode(""));t.node=n.parentNode;},writeText:function(v){if(tinymce.isOpera)v=v.replace(/>/g,'|>');this.node.appendChild(this.doc.createTextNode(v));},writeCDATA:function(v){this.node.appendChild(this.doc.createCDATA(v));},writeComment:function(v){this.node.appendChild(this.doc.createComment(v));},getContent:function(){var h;h=this.doc.xml||new XMLSerializer().serializeToString(this.doc);h=h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,'');h=h.replace(/ ?\/>/g,' />');if(tinymce.isOpera)h=h.replace(/\|>/g,'&gt;');return h;}});})();(function(){var extend=tinymce.extend,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher,isIE=tinymce.isIE;function getIEAtts(n){var o=[];if(n.nodeName=='OBJECT')return n.attributes;n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(a,b){o.push({specified:1,nodeName:b});});return o;};function wildcardToRE(s){return s.replace(/([?+*])/g,'.$1');};tinymce.create('tinymce.dom.Serializer',{Serializer:function(s){var t=this;t.key=0;t.onPreProcess=new Dispatcher(t);t.onPostProcess=new Dispatcher(t);t.writer=new tinymce.dom.XMLWriter();t.settings=s=extend({dom:tinymce.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_$)/,closed:/(br|hr|input|meta|img|link|param)/,entity_encoding:'named',entities:'160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',valid_elements:'*[*]',extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:0,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:'simple',indent_char:'\t',indent_levels:1,remove_linebreaks:1},s);t.dom=s.dom;if(s.fix_list_elements){t.onPreProcess.add(function(se,o){var nl,x,a=['ol','ul'],i,n,p,r=/^(OL|UL)$/,np;function prevNode(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e;}}return null;};for(x=0;x<a.length;x++){nl=t.dom.select(a[x],o.node);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=prevNode(n,'LI');if(!np){np=t.dom.create('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild);}else np.appendChild(n);}}}});}if(s.fix_table_elements){t.onPreProcess.add(function(se,o){var ta=[],d=t.dom.doc;each(t.dom.select('table',o.node),function(e){var pa=t.dom.getParent(e,'H1,H2,H3,H4,H5,H6,P'),p=[],i,h;if(pa){t.dom.getParent(e,function(n){if(n!=e)p.push(n.nodeName);});h='';for(i=0;i<p.length;i++)h+='</'+p[i]+'>';h+=t.dom.getOuterHTML(e);for(i=p.length-1;i>=0;i--)h+='<'+p[i]+'>';ta.push(h);e.parentNode.replaceChild(d.createComment('mcetable:'+(ta.length-1)),e);}});t.dom.setHTML(o.node,o.node.innerHTML.replace(/<!--mcetable:([0-9]+)-->/g,function(a,b){return ta[parseInt(b)];}));});}},setEntities:function(s){var t=this,a,i,l={},re='',v;if(t.entityLookup)return;a=s.split(',');for(i=0;i<a.length;i+=2){v=a[i];if(v==34||v==38||v==60||v==62)continue;l[String.fromCharCode(a[i])]=a[i+1];v=parseInt(a[i]).toString(16);re+='\\u'+'0000'.substring(v.length)+v;}if(!re){t.settings.entity_encoding='raw';return;}t.entitiesRE=new RegExp('['+re+']','g');t.entityLookup=l;},setValidChildRules:function(s){this.childRules=null;this.addValidChildRules(s);},addValidChildRules:function(s){var t=this,inst,intr,bloc;if(!s)return;inst='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';intr='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';bloc='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';each(s.split(','),function(s){var p=s.split(/\[|\]/),re;s='';each(p[1].split('|'),function(v){if(s)s+='|';switch(v){case'%itrans':v=intr;break;case'%itrans_na':v=intr.substring(2);break;case'%istrict':v=inst;break;case'%istrict_na':v=inst.substring(2);break;case'%btrans':v=bloc;break;case'%bstrict':v=bloc;break;}s+=v;});re=new RegExp('^('+s.toLowerCase()+')$','i');each(p[0].split('/'),function(s){t.childRules=t.childRules||{};t.childRules[s]=re;});});s='';each(t.childRules,function(v,k){if(s)s+='|';s+=k;});t.parentElementsRE=new RegExp('^('+s.toLowerCase()+')$','i');},setRules:function(s){var t=this;t._setup();t.rules={};t.wildRules=[];t.validElements={};return t.addRules(s);},addRules:function(s){var t=this,dr;if(!s)return;t._setup();each(s.split(','),function(s){var p=s.split(/\[|\]/),tn=p[0].split('/'),ra,at,wat,va=[];if(dr)at=tinymce.extend([],dr.attribs);if(p.length>1){each(p[1].split('|'),function(s){var ar={},i;at=at||[];s=s.replace(/::/g,'~');s=/^([!\-])?([\w*.?~]+|)([=:<])?(.+)?$/.exec(s);s[2]=s[2].replace(/~/g,':');if(s[1]=='!'){ra=ra||[];ra.push(s[2]);}if(s[1]=='-'){for(i=0;i<at.length;i++){if(at[i].name==s[2]){at.splice(i,1);return;}}}switch(s[3]){case'=':ar.defaultVal=s[4]||'';break;case':':ar.forcedVal=s[4];break;case'<':ar.validVals=s[4].split('?');break;}if(/[*.?]/.test(s[2])){wat=wat||[];ar.nameRE=new RegExp('^'+wildcardToRE(s[2])+'$');wat.push(ar);}else{ar.name=s[2];at.push(ar);}va.push(s[2]);});}each(tn,function(s,i){var pr=s.charAt(0),x=1,ru={};if(dr){if(dr.noEmpty)ru.noEmpty=dr.noEmpty;if(dr.fullEnd)ru.fullEnd=dr.fullEnd;if(dr.padd)ru.padd=dr.padd;}switch(pr){case'-':ru.noEmpty=true;break;case'+':ru.fullEnd=true;break;case'#':ru.padd=true;break;default:x=0;}tn[i]=s=s.substring(x);t.validElements[s]=1;if(/[*.?]/.test(tn[0])){ru.nameRE=new RegExp('^'+wildcardToRE(tn[0])+'$');t.wildRules=t.wildRules||{};t.wildRules.push(ru);}else{ru.name=tn[0];if(tn[0]=='@')dr=ru;t.rules[s]=ru;}ru.attribs=at;if(ra)ru.requiredAttribs=ra;if(wat){s='';each(va,function(v){if(s)s+='|';s+='('+wildcardToRE(v)+')';});ru.validAttribsRE=new RegExp('^'+s.toLowerCase()+'$');ru.wildAttribs=wat;}});});s='';each(t.validElements,function(v,k){if(s)s+='|';if(k!='@')s+=k;});t.validElementsRE=new RegExp('^('+wildcardToRE(s.toLowerCase())+')$');},findRule:function(n){var t=this,rl=t.rules,i,r;t._setup();r=rl[n];if(r)return r;rl=t.wildRules;for(i=0;i<rl.length;i++){if(rl[i].nameRE.test(n))return rl[i];}return null;},findAttribRule:function(ru,n){var i,wa=ru.wildAttribs;for(i=0;i<wa.length;i++){if(wa[i].nameRE.test(n))return wa[i];}return null;},serialize:function(n,o){var h,t=this;t._setup();o=o||{};o.format=o.format||'html';t.processObj=o;n=n.cloneNode(true);t.key=''+(parseInt(t.key)+1);if(!o.no_events){o.node=n;t.onPreProcess.dispatch(t,o);}t.writer.reset();t._serializeNode(n,o.getInner);o.content=t.writer.getContent();if(!o.no_events)t.onPostProcess.dispatch(t,o);t._postProcess(o);o.node=null;return tinymce.trim(o.content);},_postProcess:function(o){var t=this,s=t.settings,h=o.content,sc=[],p,l;if(o.format=='html'){p=t._protect({content:h,patterns:[/(<script[^>]*>)(.*?)(<\/script>)/g,/(<style[^>]*>)(.*?)(<\/style>)/g,/(<pre[^>]*>)(.*?)(<\/pre>)/g]});h=p.content;if(s.entity_encoding!=='raw'){if(s.entity_encoding.indexOf('named')!=-1){t.setEntities(s.entities);l=t.entityLookup;h=h.replace(t.entitiesRE,function(a){var v;if(v=l[a])a='&'+v+';';return a;});}if(s.entity_encoding.indexOf('numeric')!=-1){h=h.replace(/[\u007E-\uFFFF]/g,function(a){return'&#'+a.charCodeAt(0)+';';});}}if(o.set)h=h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g,'<p><br /></p>');else h=h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g,'<p>$1</p>');if(!o.set){if(s.remove_linebreaks){h=h.replace(/(<[^>]+>)\s+/g,'$1 ');h=h.replace(/\s+(<\/[^>]+>)/g,' $1');h=h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,'<$1 $2>');h=h.replace(/<(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,'<$1>');h=h.replace(/\s+<\/(p|h[1-6]|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,'</$1>');}if(s.apply_source_formatting&&s.indent_mode=='simple'){h=h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,'\n<$1$2$3>\n');h=h.replace(/\s*<(p|h[1-6]|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,'\n<$1$2>');h=h.replace(/<\/(p|h[1-6]|div|title|style|pre|script|td|li)>\s*/g,'</$1>\n');h=h.replace(/\n\n/g,'\n');}}h=t._unprotect(h,p);}o.content=h;},_serializeNode:function(n,inn){var t=this,s=t.settings,w=t.writer,hc,el,cn,i,l,a,at,no,v,nn,ru,ar,iv;if(!s.node_filter||s.node_filter(n)){switch(n.nodeType){case 1:if(n.hasAttribute?n.hasAttribute('mce_bogus'):n.getAttribute('mce_bogus'))return;iv=false;hc=n.hasChildNodes();nn=n.getAttribute('mce_name')||n.nodeName.toLowerCase();if(isIE){if(n.scopeName!=='HTML'&&n.scopeName!=='html')nn=n.scopeName+':'+nn;}if(nn.indexOf('mce:')===0)nn=nn.substring(4);if(!t.validElementsRE.test(nn)||(t.invalidElementsRE&&t.invalidElementsRE.test(nn))||inn){iv=true;break;}if(isIE){if(s.fix_content_duplication){if(n.mce_serialized==t.key)return;n.mce_serialized=t.key;}if(nn.charAt(0)=='/')nn=nn.substring(1);}if(t.childRules){if(t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(nn)){iv=true;break;}}t.elementName=nn;}ru=t.findRule(nn);nn=ru.name||nn;if((!hc&&ru.noEmpty)||(isIE&&!nn)){iv=true;break;}if(ru.requiredAttribs){a=ru.requiredAttribs;for(i=a.length-1;i>=0;i--){if(this.dom.getAttrib(n,a[i])!=='')break;}if(i==-1){iv=true;break;}}w.writeStartElement(nn);if(ru.attribs){for(i=0,at=ru.attribs,l=at.length;i<l;i++){a=at[i];v=t._getAttrib(n,a);if(v!==null)w.writeAttribute(a.name,v);}}if(ru.validAttribsRE){at=isIE?getIEAtts(n):n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified){a=no.nodeName.toLowerCase();if(s.invalid_attrs.test(a)||!ru.validAttribsRE.test(a))continue;ar=t.findAttribRule(ru,a);v=t._getAttrib(n,ar,a);if(v!==null)w.writeAttribute(a,v);}}}if(!hc&&ru.padd)w.writeText('\u00a0');break;case 3:if(t.childRules&&t.parentElementsRE.test(t.elementName)){if(!t.childRules[t.elementName].test(n.nodeName))return;}return w.writeText(n.nodeValue);case 4:return w.writeCDATA(n.nodeValue);case 8:return w.writeComment(n.nodeValue);}}else if(n.nodeType==1)hc=n.hasChildNodes();if(hc){cn=n.firstChild;while(cn){t._serializeNode(cn);t.elementName=nn;cn=cn.nextSibling;}}if(!iv){if(hc||!s.closed.test(nn))w.writeFullEndElement();else w.writeEndElement();}},_protect:function(o){o.items=o.items||[];function enc(s){return s.replace(/[\r\n]/g,function(c){if(c==='\n')return'\\n';return'\\r';});};function dec(s){return s.replace(/\\[rn]/g,function(c){if(c==='\\n')return'\n';return'\r';});};each(o.patterns,function(p){o.content=dec(enc(o.content).replace(p,function(x,a,b,c){o.items.push(dec(b));return a+'<!--mce:'+(o.items.length-1)+'-->'+c;}));});return o;},_unprotect:function(h,o){h=h.replace(/\<!--mce:([0-9]+)--\>/g,function(a,b){return o.items[parseInt(b)];});o.items=[];return h;},_setup:function(){var t=this,s=this.settings;if(t.done)return;t.done=1;t.setRules(s.valid_elements);t.addRules(s.extended_valid_elements);t.addValidChildRules(s.valid_child_elements);if(s.invalid_elements)t.invalidElementsRE=new RegExp('^('+wildcardToRE(s.invalid_elements.replace(',','|').toLowerCase())+')$');if(s.attrib_value_filter)t.attribValueFilter=s.attribValueFilter;},_getAttrib:function(n,a,na){var i,v;na=na||a.name;if(a.forcedVal&&(v=a.forcedVal)){if(v==='{$uid}')return this.dom.uniqueId();return v;}v=this.dom.getAttrib(n,na);switch(na){case'rowspan':case'colspan':if(v=='1')v='';break;}if(this.attribValueFilter)v=this.attribValueFilter(na,v,n);if(a.validVals){for(i=a.validVals.length-1;i>=0;i--){if(v==a.validVals[i])break;}if(i==-1)return null;}if(v===''&&typeof(a.defaultVal)!='undefined'){v=a.defaultVal;if(v==='{$uid}')return this.dom.uniqueId();return v;}else{if(na=='class'&&this.processObj.get)v=v.replace(/\bmceItem\w+\b/g,'');}if(v==='')return null;return v;}});})();(function(){var each=tinymce.each;tinymce.create('tinymce.dom.ScriptLoader',{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={};},markDone:function(u){this.lookup[u]={state:2,url:u};},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2)cb.call(s||this);return o;}o={state:0,url:u,func:cb,scope:s||this};if(pr)t.queue.unshift(o);else t.queue.push(o);lo[u]=o;return o;},load:function(u,cb,s){var t=this,o;function loadScript(u){if(tinymce.dom.Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:u,error:t.settings.error,async:false,success:function(co){t.eval(co);}});}else document.write('<script type="text/javascript" src="'+u+'"></script>');};if(!tinymce.is(u,'string')){each(u,function(u){loadScript(u);});if(cb)cb.call(s||t);}else{loadScript(u);if(cb)cb.call(s||t);}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb)cb.call(s||t);each(t.queueCallbacks,function(o){o.func.call(o.scope);});});}else if(cb)t.queueCallbacks.push({func:cb,scope:s||t});},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co);}catch(ex){eval(co,w);}}else w.execScript(co);},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func)o.func.call(o.scope||t);};function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--;}else load(o);});if(l===0&&cb){cb.call(s||t);cb=0;}};function load(o){if(o.state>0)return;o.state=1;tinymce.util.XHR.send({url:o.url,error:t.settings.error,success:function(co){t.eval(co);done(o);allDone();}});};each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o);}else o=lo[u];if(o.state>0)return;if(!tinymce.dom.Event.domLoaded&&!t.settings.strict_mode){var ix,ol='';if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone();});if(tinymce.isIE)ol=' onreadystatechange="';else ol=' onload="';ol+='tinymce.dom.ScriptLoader._onLoad(this,\''+u+'\','+ix+');"';}document.write('<script type="text/javascript" src="'+u+'"'+ol+'></script>');if(!o.func)done(o);}else load(o);});allDone();},'static':{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1;},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=='complete')this._funcs[ix].call(this);}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader();})();(function(){var DOM=tinymce.DOM,is=tinymce.is;tinymce.create('tinymce.ui.Control',{Control:function(id,s){this.id=id;this.settings=s=s||{};this.rendered=false;this.onRender=new tinymce.util.Dispatcher(this);this.classPrefix='';this.scope=s.scope||this;this.disabled=0;this.active=0;},setDisabled:function(s){var e;if(s!=this.disabled){e=DOM.get(this.id);if(e&&this.settings.unavailable_prefix){if(s){this.prevTitle=e.title;e.title=this.settings.unavailable_prefix+": "+e.title;}else e.title=this.prevTitle;}this.setState('Disabled',s);this.setState('Enabled',!s);this.disabled=s;}},isDisabled:function(){return this.disabled;},setActive:function(s){if(s!=this.active){this.setState('Active',s);this.active=s;}},isActive:function(){return this.active;},setState:function(c,s){var n=DOM.get(this.id);c=this.classPrefix+c;if(s)DOM.addClass(n,c);else DOM.removeClass(n,c);},isRendered:function(){return this.rendered;},renderHTML:function(){},renderTo:function(n){DOM.setHTML(n,this.renderHTML());},postRender:function(){var t=this,b;if(is(t.disabled)){b=t.disabled;t.disabled=-1;t.setDisabled(b);}if(is(t.active)){b=t.active;t.active=-1;t.setActive(b);}},destroy:function(){DOM.remove(this.id);}});})();tinymce.create('tinymce.ui.Container:tinymce.ui.Control',{Container:function(id,s){this.parent(id,s);this.controls=[];this.lookup={};},add:function(c){this.lookup[c.id]=c;this.controls.push(c);return c;},get:function(n){return this.lookup[n];}});tinymce.create('tinymce.ui.Separator:tinymce.ui.Control',{renderHTML:function(){return tinymce.DOM.createHTML('span',{'class':'mceSeparator'});}});(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control',{MenuItem:function(id,s){this.parent(id,s);this.classPrefix='mceMenuItem';},setSelected:function(s){this.setState('Selected',s);this.selected=s;},isSelected:function(){return this.selected;},postRender:function(){var t=this;t.parent();if(is(t.selected))t.setSelected(t.selected);}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,walk=tinymce.walk;tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem',{Menu:function(id,s){var t=this;t.parent(id,s);t.items={};t.collapsed=false;t.menuCount=0;t.onAddItem=new tinymce.util.Dispatcher(this);},expand:function(d){var t=this;if(d){walk(t,function(o){if(o.expand)o.expand();},'items',t);}t.collapsed=false;},collapse:function(d){var t=this;if(d){walk(t,function(o){if(o.collapse)o.collapse();},'items',t);}t.collapsed=true;},isCollapsed:function(){return this.collapsed;},add:function(o){if(!o.settings)o=new tinymce.ui.MenuItem(o.id||DOM.uniqueId(),o);this.onAddItem.dispatch(this,o);return this.items[o.id]=o;},addSeparator:function(){return this.add({separator:true});},addMenu:function(o){if(!o.collapse)o=this.createMenu(o);this.menuCount++;return this.add(o);},hasMenus:function(){return this.menuCount!==0;},remove:function(o){delete this.items[o.id];},removeAll:function(){var t=this;walk(t,function(o){if(o.removeAll)o.removeAll();o.destroy();},'items',t);t.items={};},createMenu:function(o){var m=new tinymce.ui.Menu(o.id||DOM.uniqueId(),o);m.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return m;}});})();(function(){var is=tinymce.is,DOM=tinymce.DOM,each=tinymce.each,Event=tinymce.dom.Event,Element=tinymce.dom.Element;tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu',{DropMenu:function(id,s){s=s||{};s.container=s.container||document.body;s.offset_x=s.offset_x||0;s.offset_y=s.offset_y||0;s.vp_offset_x=s.vp_offset_x||0;s.vp_offset_y=s.vp_offset_y||0;if(is(s.icons)&&!s.icons)s['class']+=' noIcons';this.parent(id,s);this.onHideMenu=new tinymce.util.Dispatcher(this);this.classPrefix='mceMenu';},createMenu:function(s){var t=this,cs=t.settings,m;s.container=s.container||cs.container;s.parent=t;s.constrain=s.constrain||cs.constrain;s['class']=s['class']||cs['class'];s.vp_offset_x=s.vp_offset_x||cs.vp_offset_x;s.vp_offset_y=s.vp_offset_y||cs.vp_offset_y;m=new tinymce.ui.DropMenu(s.id||DOM.uniqueId(),s);m.onAddItem.add(t.onAddItem.dispatch,t.onAddItem);return m;},update:function(){var t=this,s=t.settings,tb=DOM.get('menu_'+t.id+'_tbl'),co=DOM.get('menu_'+t.id+'_co'),tw,th;tw=s.max_width?Math.min(tb.clientWidth,s.max_width):tb.clientWidth;th=s.max_height?Math.min(tb.clientHeight,s.max_height):tb.clientHeight;if(!DOM.boxModel)t.element.setStyles({width:tw+2,height:th+2});else t.element.setStyles({width:tw,height:th});if(s.max_width)DOM.setStyle(co,'width',tw);if(s.max_height){DOM.setStyle(co,'height',th);if(tb.clientHeight<s.max_height)DOM.setStyle(co,'overflow','hidden');}},showMenu:function(x,y,px){var t=this,s=t.settings,co,vp=DOM.getViewPort(),w,h,mx,my,ot=2,dm,tb;t.collapse(1);if(t.isMenuVisible)return;if(!t.rendered){co=DOM.add(t.settings.container,t.renderNode());each(t.items,function(o){o.postRender();});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});}else co=DOM.get('menu_'+t.id);DOM.setStyles(co,{left:-0xFFFF,top:-0xFFFF});DOM.show(co);t.update();x+=s.offset_x||0;y+=s.offset_y||0;vp.w-=4;vp.h-=4;if(s.constrain){w=co.clientWidth-ot;h=co.clientHeight-ot;mx=vp.x+vp.w;my=vp.y+vp.h;if((x+s.vp_offset_x+w)>mx)x=px?px-w:Math.max(0,(mx-s.vp_offset_x)-w);if((y+s.vp_offset_y+h)>my)y=Math.max(0,(my-s.vp_offset_y)-h);}DOM.setStyles(co,{left:x,top:y});t.element.update();t.isMenuVisible=1;t.mouseClickFunc=Event.add(co,'click',function(e){var m;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))&&!DOM.hasClass(e,'mceMenuItemSub')){m=t.items[e.id];if(m.isDisabled())return;if(m.settings.onclick)m.settings.onclick(e);dm=t;while(dm){if(dm.hideMenu)dm.hideMenu();dm=dm.settings.parent;}return Event.cancel(e);}});if(t.hasMenus()){t.mouseOverFunc=Event.add(co,'mouseover',function(e){var m,r,mi;e=e.target;if(e&&(e=DOM.getParent(e,'TR'))){m=t.items[e.id];if(t.lastMenu)t.lastMenu.collapse(1);if(m.isDisabled())return;if(e&&DOM.hasClass(e,'mceMenuItemSub')){r=DOM.getRect(e);m.showMenu((r.x+r.w-ot),r.y-ot,r.x);t.lastMenu=m;DOM.addClass(DOM.get(m.id).firstChild,'mceMenuItemActive');}}});}},hideMenu:function(c){var t=this,co=DOM.get('menu_'+t.id),e;if(!t.isMenuVisible)return;Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);DOM.hide(co);t.isMenuVisible=0;if(!c)t.collapse(1);if(t.element)t.element.hide();if(e=DOM.get(t.id))DOM.removeClass(e.firstChild,'mceMenuItemActive');t.onHideMenu.dispatch(t);},add:function(o){var t=this,co;o=t.parent(o);if(t.isRendered&&(co=DOM.get('menu_'+t.id)))t._add(DOM.select('tbody',co)[0],o);return o;},collapse:function(d){this.parent(d);this.hideMenu(1);},remove:function(o){DOM.remove(o.id);return this.parent(o);},destroy:function(){var t=this,co=DOM.get('menu_'+t.id);Event.remove(co,'mouseover',t.mouseOverFunc);Event.remove(co,'click',t.mouseClickFunc);if(t.element)t.element.remove();DOM.remove(co);},renderNode:function(){var t=this,s=t.settings,n,tb,co,w;w=DOM.create('div',{id:'menu_'+t.id,'class':s['class'],'style':'position:absolute;left:0;top:0;z-index:150'});co=DOM.add(w,'div',{id:'menu_'+t.id+'_co','class':'mceMenu'+(s['class']?' '+s['class']:'')});t.element=new Element('menu_'+t.id,{blocker:1,container:s.container});if(s.menu_line)DOM.add(co,'span',{'class':'mceMenuLine'});n=DOM.add(co,'table',{id:'menu_'+t.id+'_tbl',border:0,cellPadding:0,cellSpacing:0});tb=DOM.add(n,'tbody');each(t.items,function(o){t._add(tb,o);});t.rendered=true;return w;},_add:function(tb,o){var n,s=o.settings,a,ro,it;if(s.separator){ro=DOM.add(tb,'tr',{id:o.id,'class':'mceMenuItemSeparator'});DOM.add(ro,'td',{'class':'mceMenuItemSeparator'});if(n=ro.previousSibling)DOM.addClass(n,'last');return;}n=ro=DOM.add(tb,'tr',{id:o.id,'class':'mceMenuItem mceMenuItemEnabled'});n=it=DOM.add(n,'td');n=a=DOM.add(n,'a',{href:'javascript:;',onclick:"return false;",onmousedown:'return false;'});DOM.addClass(it,s['class']);DOM.add(n,'span',{'class':'icon'+(s.icon?' '+s.icon:'')});n=DOM.add(n,s.element||'span',{'class':'text',title:o.settings.title},o.settings.title);if(o.settings.style)DOM.setAttrib(n,'style',o.settings.style);if(tb.childNodes.length==1)DOM.addClass(ro,'first');if((n=ro.previousSibling)&&DOM.hasClass(n,'mceMenuItemSeparator'))DOM.addClass(ro,'first');if(o.collapse)DOM.addClass(ro,'mceMenuItemSub');if(n=ro.previousSibling)DOM.removeClass(n,'last');DOM.addClass(ro,'last');}});})();(function(){var DOM=tinymce.DOM;tinymce.create('tinymce.ui.Button:tinymce.ui.Control',{Button:function(id,s){this.parent(id,s);this.classPrefix='mceButton';},renderHTML:function(){var s=this.settings,h='<a id="'+this.id+'" href="javascript:;" class="mceButton mceButtonEnabled '+s['class']+'" onmousedown="return false;" onclick="return false;" title="'+DOM.encode(s.title)+'">';if(s.image)h+='<img class="icon" src="'+s.image+'" /></a>';else h+='<span class="icon '+s['class']+'"></span></a>';return h;},postRender:function(){var t=this,s=t.settings;tinymce.dom.Event.add(t.id,'click',function(e){if(!t.isDisabled())return s.onclick.call(s.scope,e);});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control',{ListBox:function(id,s){var t=this;t.parent(id,s);t.items=[];t.onChange=new Dispatcher(t);t.onPostRender=new Dispatcher(t);t.onAdd=new Dispatcher(t);t.onRenderMenu=new tinymce.util.Dispatcher(this);t.classPrefix='mceListBox';},select:function(v){var t=this,e,fv;if(v!=t.selectedValue){e=DOM.get(t.id+'_text');t.selectedValue=v;each(t.items,function(o){if(o.value==v){DOM.setHTML(e,DOM.encode(o.title));fv=1;return false;}});if(!fv){DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'title');e=0;return;}else DOM.removeClass(e,'title');}e=0;},add:function(n,v,o){var t=this;o=o||{};o=tinymce.extend(o,{title:n,value:v});t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return this.items.length;},renderHTML:function(){var h='',t=this,s=t.settings;h='<table id="'+t.id+'" cellpadding="0" cellspacing="0" class="mceListBox mceListBoxEnabled'+(s['class']?(' '+s['class']):'')+'"><tbody><tr>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_text',href:'javascript:;','class':'text',onclick:"return false;",onmousedown:'return false;'},DOM.encode(t.settings.title))+'</td>';h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'open',onclick:"return false;",onmousedown:'return false;'},'<span></span>')+'</td>';h+='</tr></tbody></table>';return h;},showMenu:function(){var t=this,p1,p2,e=DOM.get(this.id),m;if(t.isDisabled()||t.items.length==0)return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(this.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;if(t.oldID)m.items[t.oldID].setSelected(0);each(t.items,function(o){if(o.value===t.selectedValue){m.items[o.id].setSelected(1);t.oldID=o.id;}});m.showMenu(0,e.clientHeight);Event.add(document,'mousedown',t.hideMenu,t);DOM.addClass(t.id,'mceListBoxSelected');},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){DOM.removeClass(t.id,'mceListBoxSelected');Event.remove(document,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':'mceListBoxMenu noIcons',max_width:150,max_height:150});m.onHideMenu.add(t.hideMenu,t);m.add({title:t.settings.title,'class':'mceMenuItemTitle'}).setDisabled(1);each(t.items,function(o){o.id=DOM.uniqueId();o.onclick=function(){if(t.settings.onselect(o.value)!==false)t.select(o.value);};m.add(o);});t.onRenderMenu.dispatch(t,m);t.menu=m;},postRender:function(){var t=this;Event.add(t.id,'click',t.showMenu,t);if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceListBoxDisabled'))DOM.addClass(t.id,'mceListBoxHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceListBoxDisabled'))DOM.removeClass(t.id,'mceListBoxHover');});}t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,Dispatcher=tinymce.util.Dispatcher;tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox',{NativeListBox:function(id,s){this.parent(id,s);this.classPrefix='mceNativeListBox';},setDisabled:function(s){DOM.get(this.id).disabled=s;},isDisabled:function(){return DOM.get(this.id).disabled;},select:function(v){var e=DOM.get(this.id),ol=e.options;v=''+(v||'');e.selectedIndex=0;each(ol,function(o,i){if(o.value==v){e.selectedIndex=i;return false;}});},add:function(n,v,a){var o,t=this;a=a||{};a.value=v;if(t.isRendered())DOM.add(DOM.get(this.id),'option',a,n);o={title:n,value:v,attribs:a};t.items.push(o);t.onAdd.dispatch(t,o);},getLength:function(){return DOM.get(this.id).options.length-1;},renderHTML:function(){var h,t=this;h=DOM.createHTML('option',{value:''},'-- '+t.settings.title+' --');each(t.items,function(it){h+=DOM.createHTML('option',{value:it.value},it.title);});h=DOM.createHTML('select',{id:t.id,'class':'mceNativeListBox'},h);return h;},postRender:function(){var t=this,ch;t.rendered=true;function onChange(e){var v=e.target.options[e.target.selectedIndex].value;t.onChange.dispatch(t,v);if(t.settings.onselect)t.settings.onselect(v);};Event.add(t.id,'change',onChange);Event.add(t.id,'keydown',function(e){var bf;Event.remove(t.id,'change',ch);bf=Event.add(t.id,'blur',function(){Event.add(t.id,'change',onChange);Event.remove(t.id,'blur',bf);});if(e.keyCode==13||e.keyCode==32){onChange(e);return Event.cancel(e);}});t.onPostRender.dispatch(t,DOM.get(t.id));}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button',{MenuButton:function(id,s){this.parent(id,s);this.onRenderMenu=new tinymce.util.Dispatcher(this);s.menu_container=s.menu_container||document.body;},showMenu:function(){var t=this,p1,p2,e=DOM.get(t.id),m;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}p1=DOM.getPos(t.settings.menu_container);p2=DOM.getPos(e);m=t.menu;m.settings.offset_x=p2.x;m.settings.offset_y=p2.y;m.settings.vp_offset_x=p2.x;m.settings.vp_offset_y=p2.y;m.showMenu(0,e.clientHeight);Event.add(document,'mousedown',t.hideMenu,t);t.setState('Selected',1);},renderMenu:function(){var t=this,m;m=t.settings.control_manager.createDropMenu(t.id+'_menu',{menu_line:1,'class':this.classPrefix+'Menu',icons:t.settings.icons});m.onHideMenu.add(t.hideMenu,t);t.onRenderMenu.dispatch(t,m);t.menu=m;},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceMenu');})){t.setState('Selected',0);Event.remove(document,'mousedown',t.hideMenu,t);if(t.menu)t.menu.hideMenu();}},postRender:function(){var t=this,s=t.settings;Event.add(t.id,'click',function(){if(!t.isDisabled()){if(s.onclick)s.onclick(t.value);t.showMenu();}});}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each;tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton',{SplitButton:function(id,s){this.parent(id,s);this.classPrefix='mceSplitButton';},renderHTML:function(){var h,t=this,s=t.settings,h1;h='<tbody><tr>';if(s.image)h1=DOM.createHTML('img ',{src:s.image,'class':'action '+s['class']});else h1=DOM.createHTML('span',{'class':'action '+s['class']});h+='<td>'+DOM.createHTML('a',{id:t.id+'_action',href:'javascript:;','class':'action '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h1=DOM.createHTML('span',{'class':'open '+s['class']});h+='<td>'+DOM.createHTML('a',{id:t.id+'_open',href:'javascript:;','class':'open '+s['class'],onclick:"return false;",onmousedown:'return false;',title:s.title},h1)+'</td>';h+='</tr></tbody>';return DOM.createHTML('table',{id:t.id,'class':'mceSplitButton mceSplitButtonEnabled '+s['class'],cellpadding:'0',cellspacing:'0',onmousedown:'return false;',title:s.title},h);},postRender:function(){var t=this,s=t.settings;if(s.onclick){Event.add(t.id+'_action','click',function(){if(!t.isDisabled())s.onclick(t.value);});}Event.add(t.id+'_open','click',t.showMenu,t);if(tinymce.isIE6||!DOM.boxModel){Event.add(t.id,'mouseover',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.addClass(t.id,'mceSplitButtonHover');});Event.add(t.id,'mouseout',function(){if(!DOM.hasClass(t.id,'mceSplitButtonDisabled'))DOM.removeClass(t.id,'mceSplitButtonHover');});}}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,is=tinymce.is,each=tinymce.each;tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton',{ColorSplitButton:function(id,s){var t=this;t.parent(id,s);t.settings=s=tinymce.extend({colors:'000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',grid_width:8,default_color:'#888888'},t.settings);t.value=s.default_color;},showMenu:function(){var t=this,r,p,e;if(t.isDisabled())return;if(!t.isMenuRendered){t.renderMenu();t.isMenuRendered=true;}e=DOM.get(t.id);DOM.show(t.id+'_menu');DOM.addClass(e,'mceSplitButtonSelected');p2=DOM.getPos(e);DOM.setStyles(t.id+'_menu',{left:p2.x,top:p2.y+e.clientHeight,zIndex:150});e=0;Event.add(document,'mousedown',t.hideMenu,t);},hideMenu:function(e){var t=this;if(!e||!DOM.getParent(e.target,function(n){return DOM.hasClass(n,'mceSplitButtonMenu');})){DOM.removeClass(t.id,'mceSplitButtonSelected');Event.remove(document,'mousedown',t.hideMenu,t);DOM.hide(t.id+'_menu');}},renderMenu:function(){var t=this,m,i=0,s=t.settings,n,tb,tr,w;w=DOM.add(s.menu_container,'div',{id:t.id+'_menu','class':s['menu_class']+' '+s['class'],style:'position:absolute;left:0;top:-1000px;'});m=DOM.add(w,'div',{'class':s['class']+' mceSplitButtonMenu'});DOM.add(m,'span',{'class':'mceMenuLine'});n=DOM.add(m,'table',{'class':'mceColorSplitMenu'});tb=DOM.add(n,'tbody');i=0;each(is(s.colors,'array')?s.colors:s.colors.split(','),function(c){c=c.replace(/^#/,'');if(!i--){tr=DOM.add(tb,'tr');i=s.grid_width-1;}n=DOM.add(tr,'td');n=DOM.add(n,'a',{href:'javascript:;',style:{backgroundColor:'#'+c}});Event.add(n,'mousedown',function(){t.setColor('#'+c);});});if(s.more_colors_func){n=DOM.add(tb,'tr');n=DOM.add(n,'td',{colspan:s.grid_width,'class':'morecolors'});n=DOM.add(n,'a',{href:'javascript:;',onclick:'return false;','class':'morecolors'},s.more_colors_title);Event.add(n,'click',function(e){s.more_colors_func.call(s.more_colors_scope||this);return Event.cancel(e);});}DOM.addClass(m,'mceColorSplitMenu');return w;},setColor:function(c){var t=this,p,s=this.settings,co=s.menu_container,po,cp,id=t.id+'_preview';if(!(p=DOM.get(id))){DOM.setStyle(t.id+'_action','position','relative');p=DOM.add(t.id+'_action','div',{id:id,'class':'mceColorPreview'});}p.style.backgroundColor=c;t.value=c;t.hideMenu();s.onselect(c);}});})();tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container',{renderHTML:function(){var t=this,h='',c='mceToolbarEnd',co,dom=tinymce.DOM,s=t.settings;h+=dom.createHTML('td',{'class':'mceToolbarStart'},dom.createHTML('span',null,'<!-- IE -->'));tinymce.each(t.controls,function(c){h+='<td>'+c.renderHTML()+'</td>';});co=t.controls[t.controls.length-1].constructor;if(co===tinymce.ui.Button)c+=' mceToolbarEndButton';else if(co===tinymce.ui.SplitButton)c+=' mceToolbarEndSplitButton';else if(co===tinymce.ui.ListBox)c+=' mceToolbarEndListBox';h+=dom.createHTML('td',{'class':c},dom.createHTML('span',null,'<!-- IE -->'));return dom.createHTML('table',{id:t.id,'class':'mceToolbar'+(s['class']?' '+s['class']:''),cellpadding:'0',cellspacing:'0',align:t.settings.align||''},'<tbody><tr>'+h+'</tr></tbody>');}});(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each;tinymce.create('tinymce.AddOnManager',{items:[],urls:{},lookup:{},onAdd:new Dispatcher(this),get:function(n){return this.lookup[n];},requireLangPack:function(n){var u,s;if(tinymce.EditorManager.settings){u=this.urls[n]+'/langs/'+tinymce.EditorManager.settings.language+'.js';s=tinymce.EditorManager.settings;if(s){if(!tinymce.dom.Event.domLoaded&&!s.strict_mode)tinymce.ScriptLoader.load(u);else tinymce.ScriptLoader.add(u);}}},add:function(id,o){this.items.push(o);this.lookup[id]=o;this.onAdd.dispatch(this,id,o);return o;},load:function(n,u,cb,s){if(u.indexOf('/')!=0&&u.indexOf('://')==-1)u=tinymce.baseURL+'/'+u;this.urls[n]=u.substring(0,u.lastIndexOf('/'));tinymce.ScriptLoader.add(u,cb,s);}});tinymce.PluginManager=new tinymce.AddOnManager();tinymce.ThemeManager=new tinymce.AddOnManager();}());(function(){var each=tinymce.each,extend=tinymce.extend,DOM=tinymce.DOM,Event=tinymce.dom.Event,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager;tinymce.create('static tinymce.EditorManager',{editors:{},i18n:{},activeEditor:null,init:function(s){var t=this,pl,sl=tinymce.ScriptLoader;function execCallback(se,n,s){var f=se[n];if(!f)return;if(tinymce.is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);}return f.apply(s||this,Array.prototype.slice.call(arguments,2));};s=extend({theme:"simple",language:"en",strict_loading_mode:document.contentType=='application/xhtml+xml'},s);t.settings=s;if(!Event.domLoaded&&!s.strict_loading_mode){if(s.language)sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme&&s.theme.charAt(0)!='-')ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');if(s.plugins){pl=s.plugins.split(',');if(tinymce.inArray(pl,'compat2x')!=-1)PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');each(pl,function(v){if(v&&v.charAt(0)!='-'){if(!tinymce.isWebKit&&v=='safari')return;PluginManager.load(v,'plugins/'+v+'/editor_plugin'+tinymce.suffix+'.js');}});}sl.loadQueue();}Event.add(document,'init',function(){var l,co;execCallback(s,'onpageload');if(s.browsers){l=false;each(s.browsers.split(','),function(v){switch(v){case'ie':case'msie':if(tinymce.isIE)l=true;break;case'gecko':if(tinymce.isGecko)l=true;break;case'safari':case'webkit':if(tinymce.isWebKit)l=true;break;case'opera':if(tinymce.isOpera)l=true;break;}});if(!l)return;}switch(s.mode){case"exact":l=s.elements||'';each(l.split(','),function(v){new tinymce.Editor(v,s).render();});break;case"textareas":function hasClass(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className);};each(DOM.select('textarea'),function(v){if(s.editor_deselector&&hasClass(v,s.editor_deselector))return;if(!s.editor_selector||hasClass(v,s.editor_selector))new tinymce.Editor(v.id=(v.id||v.name||(v.id=DOM.uniqueId())),s).render();});break;}if(s.oninit){l=co=0;each(t.editors,function(ed){co++;if(!ed.initialized){ed.onInit.add(function(){l++;if(l==co)execCallback(s,'oninit');});}else l++;if(l==co)execCallback(s,'oninit');});}});},get:function(id){return this.editors[id];},getInstanceById:function(id){return this.get(id);},add:function(e){this.editors[e.id]=e;this._setActive(e);return e;},remove:function(e){var t=this;if(!t.editors[e.id])return null;delete t.editors[e.id];if(t.activeEditor==e){each(t.editors,function(e){t._setActive(e);return false;});}e._destroy();return e;},execCommand:function(c,u,v){var t=this,ed=t.get(v);switch(c){case"mceFocus":ed.focus();return true;case"mceAddEditor":case"mceAddControl":new tinymce.Editor(v,t.settings).render();return true;case"mceAddFrameControl":return true;case"mceRemoveEditor":case"mceRemoveControl":ed.remove();return true;case'mceToggleEditor':if(!ed){t.execCommand('mceAddControl',0,v);return true;}if(ed.isHidden())ed.show();else ed.hide();return true;}if(t.activeEditor)return t.activeEditor.execCommand(c,u,v);return false;},execInstanceCommand:function(id,c,u,v){var ed=this.get(id);if(ed)return ed.execCommand(c,u,v);return false;},triggerSave:function(){each(this.editors,function(e){e.save();});},addI18n:function(p,o){var lo,i18n=this.i18n;if(!tinymce.is(p,'string')){each(p,function(o,lc){each(o,function(o,g){each(o,function(o,k){if(g==='common')i18n[lc+'.'+k]=o;else i18n[lc+'.'+g+'.'+k]=o;});});});}else{each(o,function(o,k){i18n[p+'.'+k]=o;});}},_setActive:function(e){this.selectedInstance=this.activeEditor=e;}});tinymce.documentBaseURL=window.location.href.replace(/[\?#].*$/,'').replace(/[\/\\][^\/]+$/,'');if(!/[\/\\]$/.test(tinymce.documentBaseURL))tinymce.documentBaseURL+='/';tinymce.baseURL=new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);tinymce.EditorManager.baseURI=new tinymce.util.URI(tinymce.baseURL);})();var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,Dispatcher=tinymce.util.Dispatcher;var each=tinymce.each,isGecko=tinymce.isGecko,isIE=tinymce.isIE,isWebKit=tinymce.isWebKit;var is=tinymce.is,ThemeManager=tinymce.ThemeManager,PluginManager=tinymce.PluginManager,EditorManager=tinymce.EditorManager;var inArray=tinymce.inArray,grep=tinymce.grep;tinymce.create('tinymce.Editor',{Editor:function(id,s){var t=this;t.id=t.editorId=id;t.execCommands={};t.queryStateCommands={};t.queryValueCommands={};t.plugins={};each(['onPreInit','onBeforeRenderUI','onPostRender','onInit','onRemove','onActivate','onDeactivate','onClick','onEvent','onMouseUp','onMouseDown','onDblClick','onKeyDown','onKeyUp','onKeyPress','onContextMenu','onSubmit','onReset','onPaste','onPreProcess','onPostProcess','onBeforeSetContent','onBeforeGetContent','onSetContent','onGetContent','onLoadContent','onSaveContent','onNodeChange','onChange','onBeforeExecCommand','onExecCommand','onUndo','onRedo','onVisualAid','onSetProgressState'],function(e){t[e]=new Dispatcher(t);});t.settings=s=extend({id:id,language:'en',docs_language:'en',theme:'simple',skin:'default',delta_width:0,delta_height:0,popup_css:'',plugins:'',document_base_url:tinymce.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:'mceItemTable',visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:'xx-small,x-small,small,medium,large,x-large,xx-large',apply_source_formatting:1,directionality:'ltr',forced_root_block:'p',valid_elements:'@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width|height|src|*],script[type],map[name],area[shape|coords|href|alt|target]',hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,indentation:'30px'},s);t.documentBaseURI=new tinymce.util.URI(s.document_base_url||tinymce.documentBaseURL,{base_uri:tinyMCE.baseURI});t.baseURI=EditorManager.baseURI;t.execCallback('setup',t);},render:function(){var t=this,s=t.settings,id=t.id,sl=tinymce.ScriptLoader;if(!t.getElement())return;if(s.strict_loading_mode){sl.settings.strict_mode=s.strict_loading_mode;tinymce.DOM.settings.strict=1;}if(!/TEXTAREA|INPUT/i.test(t.getElement().nodeName)&&s.hidden_input&&DOM.getParent(id,'form'))DOM.insertAfter(DOM.create('input',{type:'hidden',name:id}),id);t.windowManager=new tinymce.WindowManager(t);if(s.encoding=='xml'){t.onGetContent.add(function(ed,o){if(o.get)o.content=DOM.encode(o.content);});}if(s.add_form_submit_trigger){t.onSubmit.addToTop(function(){if(t.initialized){t.save();t.isNotDirty=1;}});}Event.add(document,'unload',function(){if(t.initialized&&!t.destroyed&&s.add_unload_trigger)t.save({format:'raw',no_events:true});});tinymce.addUnload(t._destroy,t);if(s.submit_patch){t.onBeforeRenderUI.add(function(){var n=t.getElement().form;if(!n)return;if(n._mceOldSubmit)return;if(!n.submit.nodeType){t.formElement=n;n._mceOldSubmit=n.submit;n.submit=function(){EditorManager.triggerSave();t.isNotDirty=1;return this._mceOldSubmit(this);};}n=null;});}function loadScripts(){sl.add(tinymce.baseURL+'/langs/'+s.language+'.js');if(s.theme.charAt(0)!='-')ThemeManager.load(s.theme,'themes/'+s.theme+'/editor_template'+tinymce.suffix+'.js');each(s.plugins.split(','),function(p){if(p&&p.charAt(0)!='-'){if(!isWebKit&&p=='safari')return;PluginManager.load(p,'plugins/'+p+'/editor_plugin'+tinymce.suffix+'.js');}});sl.loadQueue(function(){if(s.ask){function ask(){t.windowManager.confirm(t.getLang('edit_confirm'),function(s){if(s)t.init();else Event.remove(t.id,'focus',ask);});};Event.add(t.id,'focus',ask);return;}if(!t.removed)t.init();});};if(s.plugins.indexOf('compat2x')!=-1){PluginManager.load('compat2x','plugins/compat2x/editor_plugin'+tinymce.suffix+'.js');sl.loadQueue(loadScripts);}else loadScripts();},init:function(){var n,t=this,s=t.settings,w,h,e=t.getElement(),o,ti;EditorManager.add(t);s.theme=s.theme.replace(/-/,'');o=ThemeManager.get(s.theme);t.theme=new o();if(t.theme.init&&s.init_theme)t.theme.init(t,ThemeManager.urls[s.theme]||tinymce.documentBaseURL.replace(/\/$/,''));each(s.plugins.replace(/\-/g,'').split(','),function(p){var c=PluginManager.get(p),u=PluginManager.urls[p]||tinymce.documentBaseURL.replace(/\/$/,''),po;if(c){po=new c(t,u);t.plugins[p]=po;if(po.init)po.init(t,u);}});s.popup_css=t.baseURI.toAbsolute(s.popup_css||"themes/"+s.theme+"/skins/"+s.skin+"/dialog.css");if(s.popup_css_add)s.popup_css+=','+s.popup_css_add;t.controlManager=new tinymce.ControlManager(t);t.undoManager=new tinymce.UndoManager(t);t.undoManager.onAdd.add(function(um,l){return t.onChange.dispatch(t,l,um);});t.undoManager.onUndo.add(function(um,l){return t.onUndo.dispatch(t,l,um);});t.undoManager.onRedo.add(function(um,l){return t.onRedo.dispatch(t,l,um);});if(s.custom_undo_redo){t.onExecCommand.add(function(ed,cmd){if(cmd!='Undo'&&cmd!='Redo'&&cmd!='mceRepaint')t.undoManager.add();});}t.onExecCommand.add(function(ed,c){if(!/^(FontName|FontSize)$/.test(c))t.nodeChanged();});if(isGecko){function repaint(){t.execCommand('mceRepaint');};t.onUndo.add(repaint);t.onRedo.add(repaint);t.onSetContent.add(repaint);}t.onBeforeRenderUI.dispatch(t,t.controlManager);if(s.render_ui){w=s.width||e.style.width||e.clientWidth;h=s.height||e.style.height||e.clientHeight;t.orgDisplay=e.style.display;if((''+w).indexOf('%')==-1)w=Math.max(parseInt(w)+(o.deltaWidth||0),100);if((''+h).indexOf('%')==-1)h=Math.max(parseInt(h)+(o.deltaHeight||0),100);o=t.theme.renderUI({targetNode:e,width:w,height:h,deltaWidth:s.delta_width,deltaHeight:s.delta_height});t.editorContainer=o.editorContainer;}DOM.setStyles(o.sizeContainer||o.editorContainer,{width:w,height:h});h=(o.iframeHeight||h)+((h+'').indexOf('%')==-1?(o.deltaHeight||0):'');if(h<100)h=100;n=DOM.add(o.iframeContainer,'iframe',{id:s.id+"_ifr",src:'javascript:""',frameBorder:'0',style:{width:'100%',height:h}});t.contentAreaContainer=o.iframeContainer;DOM.get(o.editorContainer).style.display=t.orgDisplay;DOM.get(s.id).style.display='none';if(tinymce.isOldWebKit){Event.add(n,'load',t.setupIframe,t);n.src=tinymce.baseURL+'/plugins/safari/blank.htm';}else{t.setupIframe();e=n=o=null;}},setupIframe:function(){var t=this,s=t.settings,e=DOM.get(s.id),d=t.getDoc();d.open();d.write(s.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+t.documentBaseURI.getURI()+'" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body id="tinymce" class="mceContentBody"></body></html>');d.close();if(!isIE){try{d.designMode='On';}catch(ex){}}if(isIE)t.getBody().contentEditable=true;t.dom=new tinymce.DOM.DOMUtils(t.getDoc(),{keep_values:true,url_converter:t.convertURL,url_converter_scope:t,hex_colors:s.force_hex_style_colors,class_filter:s.class_filter,update_styles:1});t.serializer=new tinymce.dom.Serializer({entity_encoding:s.entity_encoding,entities:s.entities,valid_elements:s.verify_html===false?'*[*]':s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,invalid_elements:s.invalid_elements,fix_table_elements:s.fix_table_elements,fix_list_elements:s.fix_list_elements,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans,font_size_classes:s.font_size_classes,font_size_style_values:s.font_size_style_values,apply_source_formatting:s.apply_source_formatting,remove_linebreaks:s.remove_linebreaks,dom:t.dom});t.selection=new tinymce.dom.Selection(t.dom,t.getWin(),t.serializer);t.forceBlocks=new tinymce.ForceBlocks(t,{forced_root_block:s.forced_root_block});t.editorCommands=new tinymce.EditorCommands(t);t.serializer.onPreProcess.add(function(se,o){return t.onPreProcess.dispatch(t,o,se);});t.serializer.onPostProcess.add(function(se,o){return t.onPostProcess.dispatch(t,o,se);});t.onPreInit.dispatch(t);if(!s.gecko_spellcheck)t.getBody().spellcheck=0;t._addEvents();t.controlManager.onPostRender.dispatch(t,t.controlManager);t.onPostRender.dispatch(t);if(s.directionality)t.getBody().dir=s.directionality;if(s.nowrap)t.getBody().style.whiteSpace="nowrap";if(s.auto_resize)t.onNodeChange.add(t.resizeToContent,t);if(s.handle_node_change_callback){t.onNodeChange.add(function(ed,cm,n){t.execCallback('handle_node_change_callback',t.id,n,-1,-1,true,t.selection.isCollapsed());});}if(s.save_callback){t.onSaveContent.add(function(ed,o){var h=t.execCallback('save_callback',t.id,o.content,t.getBody());if(h)o.content=h;});}if(s.onchange_callback){t.onChange.add(function(ed,l){t.execCallback('onchange_callback',t,l);});}if(s.convert_newlines_to_brs){t.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/\r?\n/g,'<br />');});}if(s.fix_nesting&&isIE){t.onBeforeSetContent.add(function(ed,o){o.content=t._fixNesting(o.content);});}if(s.preformatted){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^\s*<pre.*?>/,'');o.content=o.content.replace(/<\/pre>\s*$/,'');if(o.set)o.content='<pre class="mceItemHidden">'+o.content+'</pre>';});}if(s.verify_css_classes){t.serializer.attribValueFilter=function(n,v){var s,cl;if(n=='class'){if(!t.classesRE){cl=t.dom.getClasses();if(cl.length>0){s='';each(cl,function(o){s+=(s?'|':'')+o['class'];});t.classesRE=new RegExp('('+s+')','gi');}}return!t.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v)||t.classesRE.test(v)?v:'';}return v;};}if(s.convert_fonts_to_spans)t._convertFonts();if(s.inline_styles)t._convertInlineElements();if(s.cleanup_callback){t.onBeforeSetContent.add(function(ed,o){o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);});t.onPreProcess.add(function(ed,o){if(o.set)t.execCallback('cleanup_callback','insert_to_editor_dom',o.node,o);if(o.get)t.execCallback('cleanup_callback','get_from_editor_dom',o.node,o);});t.onPostProcess.add(function(ed,o){if(o.set)o.content=t.execCallback('cleanup_callback','insert_to_editor',o.content,o);if(o.get)o.content=t.execCallback('cleanup_callback','get_from_editor',o.content,o);});}if(s.save_callback){t.onGetContent.add(function(ed,o){if(o.save)o.content=t.execCallback('save_callback',t.id,o.content,t.getBody());});}if(s.handle_event_callback){t.onEvent.add(function(ed,e,o){if(t.execCallback('handle_event_callback',e,ed,o)===false)Event.cancel(e);});}t.onSetContent.add(function(){t.addVisual(t.getBody());});if(s.padd_empty_editor){t.onPostProcess.add(function(ed,o){o.content=o.content.replace(/^<p>(&nbsp;|#160;|\s)<\/p>$/,'');});}if(isGecko){try{d.designMode='Off';d.designMode='On';}catch(ex){}}setTimeout(function(){if(t.removed)return;t.load({initial:true,format:(s.cleanup_on_startup?'html':'raw')});t.startContent=t.getContent({format:'raw'});t.undoManager.add({initial:true});t.initialized=true;t.onInit.dispatch(t);t.execCallback('setupcontent_callback',t.id,t.getBody(),t.getDoc());t.execCallback('init_instance_callback',t);t.focus(true);t.nodeChanged({initial:1});if(s.content_css){tinymce.each(s.content_css.split(','),function(u){t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));});}if(s.auto_focus){setTimeout(function(){var ed=EditorManager.get(s.auto_focus);ed.selection.select(ed.getBody(),1);ed.selection.collapse(1);ed.getWin().focus();},100);}},1);e=null;},focus:function(sf){var oed,t=this;if(!sf){t.getWin().focus();}if(EditorManager.activeEditor!=t){if((oed=EditorManager.activeEditor)!=null)oed.onDeactivate.dispatch(oed,t);t.onActivate.dispatch(t,oed);}EditorManager._setActive(t);},execCallback:function(n){var t=this,f=t.settings[n],s;if(!f)return;if(t.callbackLookup&&(s=t.callbackLookup[n])){f=s.func;s=s.scope;}if(is(f,'string')){s=f.replace(/\.\w+$/,'');s=s?tinymce.resolve(s):0;f=tinymce.resolve(f);t.callbackLookup=t.callbackLookup||{};t.callbackLookup[n]={func:f,scope:s};}return f.apply(s||t,Array.prototype.slice.call(arguments,1));},translate:function(s){var c=this.settings.language,i18n=EditorManager.i18n;if(!s)return'';return i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return i18n[c+'.'+b]||'{#'+b+'}';});},getLang:function(n,dv){return EditorManager.i18n[this.settings.language+'.'+n]||(is(dv)?dv:'{#'+n+'}');},getParam:function(n,dv){return is(this.settings[n])?this.settings[n]:dv;},nodeChanged:function(o){var t=this,s=t.selection,n=s.getNode()||this.getBody();this.onNodeChange.dispatch(t,o?o.controlManager||t.controlManager:t.controlManager,isIE&&n.ownerDocument!=t.getDoc()?this.getBody():n,s.isCollapsed(),o);},addButton:function(n,s){var t=this;t.buttons=t.buttons||{};t.buttons[n]=s;},addCommand:function(n,f,s){this.execCommands[n]={func:f,scope:s||this};},addQueryStateHandler:function(n,f,s){this.queryStateCommands[n]={func:f,scope:s||this};},addQueryValueHandler:function(n,f,s){this.queryValueCommands[n]={func:f,scope:s||this};},addShortcut:function(pa,desc,cmd_func,sc){var t=this,c;if(!t.settings.custom_shortcuts)return false;t.shortcuts=t.shortcuts||{};if(is(cmd_func,'string')){c=cmd_func;cmd_func=function(){t.execCommand(c,false,null);};}if(is(cmd_func,'object')){c=cmd_func;cmd_func=function(){t.execCommand(c[0],c[1],c[2]);};}each(pa.split(','),function(pa){var o={func:cmd_func,scope:sc||this,desc:desc,alt:false,ctrl:false,shift:false};each(pa.split('+'),function(v){switch(v){case'alt':case'ctrl':case'shift':o[v]=true;break;default:o.charCode=v.charCodeAt(0);o.keyCode=v.toUpperCase().charCodeAt(0);}});t.shortcuts[(o.ctrl?'ctrl':'')+','+(o.alt?'alt':'')+','+(o.shift?'shift':'')+','+o.keyCode]=o;});return true;},execCommand:function(cmd,ui,val,a){var t=this,s=0,o;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd)&&(!a||!a.skip_focus))t.focus();o={};t.onBeforeExecCommand.dispatch(t,cmd,ui,val,o);if(o.terminate)return false;if(t.execCallback('execcommand_callback',t.id,t.selection.getNode(),cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}if(o=t.execCommands[cmd]){s=o.func.call(o.scope,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val);return s;}each(t.plugins,function(p){if(p.execCommand&&p.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);s=1;return false;}});if(s)return true;if(t.theme.execCommand&&t.theme.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}if(t.editorCommands.execCommand(cmd,ui,val)){t.onExecCommand.dispatch(t,cmd,ui,val);return true;}t.getDoc().execCommand(cmd,ui,val);t.onExecCommand.dispatch(t,cmd,ui,val);},queryCommandState:function(c){var t=this,o;if(t._isHidden())return;if(o=t.queryStateCommands[c])return o.func.call(o.scope);o=t.editorCommands.queryCommandState(c);if(o!==-1)return o;return this.getDoc().queryCommandState(c);},queryCommandValue:function(c){var t=this,o;if(t._isHidden())return;if(o=t.queryValueCommands[c])return o.func.call(o.scope);o=t.editorCommands.queryCommandValue(c);if(is(o))return o;return this.getDoc().queryCommandValue(c);},show:function(){var t=this;DOM.show(t.getContainer());DOM.hide(t.id);t.load();},hide:function(){var t=this,s=t.settings,d=t.getDoc();if(isIE&&d)d.execCommand('SelectAll');DOM.hide(t.getContainer());DOM.setStyle(s.id,'display',t.orgDisplay);t.save();},isHidden:function(){return!DOM.isHidden(this.id);},setProgressState:function(b,ti,o){this.onSetProgressState.dispatch(this,b,ti,o);return b;},remove:function(){var t=this;t.removed=1;t.hide();DOM.remove(t.getContainer());t.execCallback('remove_instance_callback',t);t.onRemove.dispatch(t);EditorManager.remove(t);},resizeToContent:function(){var t=this;DOM.setStyle(t.id+"_ifr",'height',t.getBody().scrollHeight);},load:function(o){var t=this,e=t.getElement(),h;o=o||{};o.load=true;h=t.setContent(is(e.value)?e.value:e.innerHTML,o);o.element=e;if(!o.no_events)t.onLoadContent.dispatch(t,o);o.element=e=null;return h;},save:function(o){var t=this,e=t.getElement(),h,f;if(!t.initialized)return;o=o||{};o.save=true;o.element=e;h=o.content=t.getContent(o);if(!o.no_events)t.onSaveContent.dispatch(t,o);h=o.content;if(!/TEXTAREA|INPUT/i.test(e.nodeName)){e.innerHTML=h;if(f=DOM.getParent(t.id,'form')){each(f.elements,function(e){if(e.name==t.id){e.value=h;return false;}});}}else e.value=h;o.element=e=null;return h;},setContent:function(h,o){var t=this;o=o||{};o.format=o.format||'html';o.set=true;o.content=h;if(!o.no_events)t.onBeforeSetContent.dispatch(t,o);if(!tinymce.isIE&&(h.length===0||/^\s+$/.test(h))){o.content=t.dom.setHTML(t.getBody(),'<br mce_bogus="1" />',1);o.format='raw';}o.content=t.dom.setHTML(t.getBody(),tinymce.trim(o.content));if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;o.content=t.dom.setHTML(t.getBody(),t.serializer.serialize(t.getBody(),o));}if(!o.no_events)t.onSetContent.dispatch(t,o);return o.content;},getContent:function(o){var t=this,h;o=o||{};o.format=o.format||'html';o.get=true;if(!o.no_events)t.onBeforeGetContent.dispatch(t,o);if(o.format!='raw'&&t.settings.cleanup){o.getInner=true;h=t.serializer.serialize(t.getBody(),o);}else h=t.getBody().innerHTML;h=h.replace(/^\s*|\s*$/g,'');o={content:h};t.onGetContent.dispatch(t,o);return o.content;},isDirty:function(){var t=this;return tinymce.trim(t.startContent)!=tinymce.trim(t.getContent({format:'raw',no_events:1}))&&!t.isNotDirty;},getContainer:function(){var t=this;if(!t.container)t.container=DOM.get(t.editorContainer||t.id+'_parent');return t.container;},getContentAreaContainer:function(){return this.contentAreaContainer;},getElement:function(){return DOM.get(this.settings.content_element||this.id);},getWin:function(){var t=this,e;if(!t.contentWindow){e=DOM.get(t.id+"_ifr");if(e)t.contentWindow=e.contentWindow;}return t.contentWindow;},getDoc:function(){var t=this,w;if(!t.contentDocument){w=this.getWin();if(w)t.contentDocument=w.document;}return t.contentDocument;},getBody:function(){return this.bodyElement||this.getDoc().body;},convertURL:function(u,n,e){var t=this,s=t.settings;if(s.urlconverter_callback)return t.execCallback('urlconverter_callback',u,e,true,n);if(!s.convert_urls||(e&&e.nodeName=='LINK'))return u;if(s.relative_urls)return t.documentBaseURI.toRelative(u);u=t.documentBaseURI.toAbsolute(u,s.remove_script_host);return u;},addVisual:function(e){var t=this,s=t.settings;e=e||t.getBody();if(!is(t.hasVisual))t.hasVisual=s.visual;each(t.dom.select('table,a',e),function(e){var v;switch(e.nodeName){case'TABLE':v=t.dom.getAttrib(e,'border');if(!v||v=='0'){if(t.hasVisual)t.dom.addClass(e,s.visual_table_class);else t.dom.removeClass(e,s.visual_table_class);}return;case'A':v=t.dom.getAttrib(e,'name');if(v){if(t.hasVisual)t.dom.addClass(e,'mceItemAnchor');else t.dom.removeClass(e,'mceItemAnchor');}return;}});t.onVisualAid.dispatch(t,e,t.hasVisual);},_addEvents:function(){var t=this,i,s=t.settings,lo={mouseup:'onMouseUp',mousedown:'onMouseDown',click:'onClick',keyup:'onKeyUp',keydown:'onKeyDown',keypress:'onKeyPress',submit:'onSubmit',reset:'onReset',contextmenu:'onContextMenu',dblclick:'onDblClick',paste:'onPaste'};function eventHandler(e,o){var ty=e.type;if(t.removed)return;if(t.onEvent.dispatch(t,e,o)!==false){t[lo[e.fakeType||e.type]].dispatch(t,e,o);}};each(lo,function(v,k){switch(k){case'contextmenu':if(tinymce.isOpera){Event.add(t.getDoc(),'mousedown',function(e){if(e.ctrlKey){e.fakeType='contextmenu';eventHandler(e);}});}else Event.add(t.getDoc(),k,eventHandler);break;case'paste':Event.add(t.getBody(),k,function(e){var tx,h,el,r;if(e.clipboardData)tx=e.clipboardData.getData('text/plain');else if(tinymce.isIE)tx=t.getWin().clipboardData.getData('Text');eventHandler(e,{text:tx,html:h});});break;case'submit':case'reset':Event.add(t.getElement().form||DOM.getParent(t.id,'form'),k,eventHandler);break;default:Event.add(s.content_editable?t.getBody():t.getDoc(),k,eventHandler);}});Event.add(s.content_editable?t.getBody():(isGecko?t.getDoc():t.getWin()),'focus',function(e){t.focus(true);});if(tinymce.isGecko){Event.add(t.getDoc(),'DOMNodeInserted',function(e){var v;e=e.target;if(e.nodeType===1&&e.nodeName==='IMG'&&(v=e.getAttribute('mce_src')))e.src=t.documentBaseURI.toAbsolute(v);});}if(isGecko){function setOpts(){var t=this,d=t.getDoc(),s=t.settings;if(isGecko){if(t._isHidden()){try{d.designMode='On';}catch(ex){}}try{d.execCommand("styleWithCSS",0,false);}catch(ex){if(!t._isHidden())d.execCommand("useCSS",0,true);}if(!s.table_inline_editing)try{d.execCommand('enableInlineTableEditing',false,false);}catch(ex){}if(!s.object_resizing)try{d.execCommand('enableObjectResizing',false,false);}catch(ex){}}};t.onBeforeExecCommand.add(setOpts);t.onMouseDown.add(setOpts);}t.onMouseUp.add(t.nodeChanged);t.onClick.add(t.nodeChanged);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||e.ctrlKey)t.nodeChanged();});t.onReset.add(function(){t.setContent(t.startContent,{format:'raw'});});if(t.getParam('tab_focus')){function tabCancel(ed,e){if(e.keyCode===9)return Event.cancel(e);};function tabHandler(ed,e){var v,f,el;function find(d){f=DOM.getParent(ed.id,'form'),el=f.elements;if(f){each(f.elements,function(e,i){if(e.id==ed.id){i=i+d;if(i<0||i>el.length)return;el=el[i];}});}return el;};if(e.keyCode===9){v=ed.getParam('tab_focus').split(',');if(v.length==1){v[1]=v[0];v[0]=':prev';}if(e.shiftKey){if(v[0]==':prev')el=find(-1);else el=DOM.get(v[0]);}else{if(v[1]==':next')el=find(1);else el=DOM.get(v[1]);}if(el){if(ed=EditorManager.get(el.id||el.name))ed.focus();else window.setTimeout(function(){window.focus();el.focus();},10);return Event.cancel(e);}}};t.onKeyUp.add(tabCancel);if(isGecko){t.onKeyPress.add(tabHandler);t.onKeyDown.add(tabCancel);}else t.onKeyDown.add(tabHandler);}if(s.custom_shortcuts){if(s.custom_undo_redo_keyboard_shortcuts){t.addShortcut('ctrl+z',t.getLang('undo_desc'),'Undo');t.addShortcut('ctrl+y',t.getLang('redo_desc'),'Redo');}if(isGecko){t.addShortcut('ctrl+b',t.getLang('bold_desc'),'Bold');t.addShortcut('ctrl+i',t.getLang('italic_desc'),'Italic');t.addShortcut('ctrl+u',t.getLang('underline_desc'),'Underline');}for(i=1;i<=6;i++)t.addShortcut('ctrl+'+i,'',['FormatBlock',false,'<h'+i+'>']);t.addShortcut('ctrl+7','',['FormatBlock',false,'<p>']);t.addShortcut('ctrl+8','',['FormatBlock',false,'<div>']);t.addShortcut('ctrl+9','',['FormatBlock',false,'<address>']);function find(e){var v=null;if(!e.altKey&&!e.ctrlKey&&!e.metaKey)return v;each(t.shortcuts,function(o){if(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))return;if(o.alt!=e.altKey)return;if(o.shift!=e.shiftKey)return;if(e.keyCode==o.keyCode||(e.charCode&&e.charCode==o.charCode)){v=o;return false;}});return v;};t.onKeyUp.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyPress.add(function(ed,e){var o=find(e);if(o)return Event.cancel(e);});t.onKeyDown.add(function(ed,e){var o=find(e);if(o){o.func.call(o.scope);return Event.cancel(e);}});}if(tinymce.isIE){Event.add(t.getDoc(),'controlselect',function(e){var re=t.resizeInfo,cb;e=e.target;if(re)Event.remove(re.node,re.ev,re.cb);if(!t.dom.hasClass(e,'mceItemNoResize')){ev='resizeend';cb=Event.add(e,ev,function(e){var v;e=e.target;if(v=t.dom.getStyle(e,'width')){t.dom.setAttrib(e,'width',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'width','');}if(v=t.dom.getStyle(e,'height')){t.dom.setAttrib(e,'height',v.replace(/[^0-9%]+/g,''));t.dom.setStyle(e,'height','');}});}else{ev='resizestart';cb=Event.add(e,'resizestart',Event.cancel,Event);}re=t.resizeInfo={node:e,ev:ev,cb:cb};});t.onKeyDown.add(function(ed,e){switch(e.keyCode){case 8:if(t.selection.getRng().item){t.selection.getRng().item(0).removeNode();return Event.cancel(e);}}});}if(tinymce.isOpera){t.onClick.add(function(ed,e){Event.prevent(e);});}if(s.custom_undo_redo){function addUndo(){t.undoManager.typing=0;t.undoManager.add();};if(tinymce.isIE){Event.add(t.getWin(),'blur',function(e){var n;if(t.selection){n=t.selection.getNode();if(!t.removed&&n.ownerDocument&&n.ownerDocument!=t.getDoc())addUndo();}});}else{Event.add(t.getDoc(),'blur',function(){if(t.selection&&!t.removed)addUndo();});}t.onMouseDown.add(addUndo);t.onKeyUp.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.ctrlKey){t.undoManager.typing=0;t.undoManager.add();}});t.onKeyDown.add(function(ed,e){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45){if(t.undoManager.typing){t.undoManager.add();t.undoManager.typing=0;}return;}if(!t.undoManager.typing){t.undoManager.add();t.undoManager.typing=1;}});}},_destroy:function(){var t=this;if(t.formElement){t.formElement.submit=t.formElement._mceOldSubmit;t.formElement._mceOldSubmit=null;}t.contentAreaContainer=t.formElement=t.container=t.contentDocument=t.contentWindow=null;if(t.selection)t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null;t.destroyed=1;},_convertInlineElements:function(){var t=this,s=t.settings,dom=t.dom;function convert(ed,o){if(!s.inline_styles)return;if(o.get){each(t.dom.select('table,u,strike',o.node),function(n){switch(n.nodeName){case'TABLE':if(v=dom.getAttrib(n,'height')){dom.setStyle(n,'height',v);dom.setAttrib(n,'height','');}break;case'U':dom.replace(dom.create('span',{style:'text-decoration: underline;'}),n,1);break;case'STRIKE':dom.replace(dom.create('span',{style:'text-decoration: line-through;'}),n,1);break;}});}else if(o.set){each(t.dom.select('table,span',o.node),function(n){if(n.nodeName=='TABLE'){if(v=dom.getStyle(n,'height'))dom.setAttrib(n,'height',v.replace(/[^0-9%]+/g,''));}else{if(n.style.textDecoration=='underline')dom.replace(dom.create('u'),n,1);else if(n.style.textDecoration=='line-through')dom.replace(dom.create('strike'),n,1);}});}};t.onPreProcess.add(convert);if(!s.cleanup_on_startup){t.onInit.add(function(){convert(t,{node:t.getBody(),set:1});});}},_convertFonts:function(){var t=this,s=t.settings,dom=t.dom,sl,cl,fz,fzn,v,i;fz=[8,10,12,14,18,24,36];fzn=['xx-small','x-small','small','medium','large','x-large','xx-large'];if(sl=s.font_size_style_values)sl=sl.split(',');if(cl=s.font_size_classes)cl=cl.split(',');t.onPreProcess.add(function(ed,o){if(!s.inline_styles)return;if(o.set){if(tinymce.isWebKit)return;each(t.dom.select('span',o.node),function(n){var f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily')});if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1)dom.setAttrib(f,'size',''+(i+1||1));}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1)dom.setAttrib(f,'size',''+(i+1||1));}if(f.color||f.face||f.size)dom.replace(f,n,1);});}else if(o.get){each(t.dom.select('font',o.node),function(n){var sp=dom.create('span',{style:{fontFamily:dom.getAttrib(n,'face'),color:dom.getAttrib(n,'color'),backgroundColor:n.style.backgroundColor}});if(n.size){if(sl)dom.setStyle(sp,'fontSize',sl[parseInt(n.size)-1]);else dom.setAttrib(sp,'class',cl[parseInt(n.size)-1]);}dom.replace(sp,n,1);});}});},_isHidden:function(){var s;if(!isGecko)return 0;s=this.selection.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},_fixNesting:function(s){var d=[],i;s=s.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(a,b,c){var e;if(b==='/'){if(!d.length)return'';if(c!==d[d.length-1].tag){for(i=d.length-1;i>=0;i--){if(d[i].tag===c){d[i].close=1;break;}}return'';}else{d.pop();if(d.length&&d[d.length-1].close){a=a+'</'+d[d.length-1].tag+'>';d.pop();}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(c))return a;if(/\/>$/.test(a))return a;d.push({tag:c});}return a;});for(i=d.length-1;i>=0;i--)s+='</'+d[i].tag+'>';return s;}});})();(function(){var each=tinymce.each,isIE=tinymce.isIE,isGecko=tinymce.isGecko,isOpera=tinymce.isOpera,isWebKit=tinymce.isWebKit;tinymce.create('tinymce.EditorCommands',{EditorCommands:function(ed){this.editor=ed;},execCommand:function(cmd,ui,val){var t=this,ed=t.editor,f;switch(cmd){case'Cut':case'Copy':case'Paste':try{ed.getDoc().execCommand(cmd,ui,val);}catch(ex){if(isGecko){ed.windowManager.confirm(ed.getLang('clipboard_msg'),function(s){if(s)window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');});}else ed.windowManager.alert(ed.getLang('clipboard_no_support'));}return true;case'mceResetDesignMode':case'mceBeginUndoLevel':return true;case'unlink':t.UnLink();return true;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':t.mceJustify(cmd,cmd.substring(7).toLowerCase());return true;case'mceEndUndoLevel':case'mceAddUndoLevel':ed.undoManager.add();return true;default:f=this[cmd];if(f){f.call(this,ui,val);return true;}}return false;},Indent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){d.setStyle(e,'paddingLeft',(parseInt(e.style.paddingLeft||0)+iv)+iu);});return;}ed.getDoc().execCommand('Indent',false,null);if(isIE){d.getParent(s.getNode(),function(n){if(n.nodeName=='BLOCKQUOTE'){n.dir=n.style.cssText='';}});}},Outdent:function(){var ed=this.editor,d=ed.dom,s=ed.selection,e,v,iv,iu;iv=ed.settings.indentation;iu=/[a-z%]+$/i.exec(iv);iv=parseInt(iv);if(ed.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){each(this._getSelectedBlocks(),function(e){v=Math.max(0,parseInt(e.style.paddingLeft||0)-iv);d.setStyle(e,'paddingLeft',v?v+iu:'');});return;}ed.getDoc().execCommand('Outdent',false,null);},mceSetAttribute:function(u,v){var ed=this.editor,d=ed.dom,e;if(e=d.getParent(ed.selection.getNode(),d.isBlock))d.setAttrib(e,v.name,v.value);},mceSetContent:function(u,v){this.editor.setContent(v);},mceToggleVisualAid:function(){var ed=this.editor;ed.hasVisual=!ed.hasVisual;ed.addVisual();},mceReplaceContent:function(u,v){var s=this.editor.selection;s.setContent(v.replace(/\{\$selection\}/g,s.getContent({format:'text'})));},mceInsertLink:function(u,v){var ed=this.editor,e=ed.dom.getParent(ed.selection.getNode(),'A');if(tinymce.is(v,'string'))v={href:v};function set(e){each(v,function(v,k){ed.dom.setAttrib(e,k,v);});};if(!e){ed.execCommand('CreateLink',false,'javascript:mctmp(0);');each(ed.dom.select('a'),function(e){if(e.href=='javascript:mctmp(0);')set(e);});}else{if(v.href)set(e);else ed.dom.remove(e,1);}},UnLink:function(){var ed=this.editor,s=ed.selection;if(s.isCollapsed())s.select(s.getNode());ed.getDoc().execCommand('unlink',false,null);s.collapse(0);},FontName:function(u,v){var t=this,ed=t.editor,s=ed.selection,e;if(!v){if(s.isCollapsed())s.select(s.getNode());t.RemoveFormat();}else ed.getDoc().execCommand('FontName',false,v);},queryCommandValue:function(c){var f=this['queryValue'+c];if(f)return f.call(this,c);return false;},queryCommandState:function(cmd){var f;switch(cmd){case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':return this.queryStateJustify(cmd,cmd.substring(7).toLowerCase());default:if(f=this['queryState'+cmd])return f.call(this,cmd);}return-1;},queryValueFontSize:function(){var ed=this.editor,v=0,p;if(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return ed.getDoc().queryCommandValue('FontSize');},queryValueFontName:function(){var ed=this.editor,v=0,p;if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.face;if(!v)v=ed.getDoc().queryCommandValue('FontName');return v;},mceJustify:function(c,v){var ed=this.editor,se=ed.selection,n=se.getNode(),nn=n.nodeName,bl,nb,dom=ed.dom,rm;if(ed.settings.inline_styles&&this.queryStateJustify(c,v))rm=1;bl=dom.getParent(n,ed.dom.isBlock);if(nn=='IMG'){if(v=='full')return;if(rm){dom.setStyle(n,'float','');this.mceRepaint();return;}if(v=='center'){if(!bl||bl.childNodes.length>1){nb=dom.create('p');nb.appendChild(n.cloneNode(false));if(bl)dom.insertAfter(nb,bl);else dom.insertAfter(nb,n);dom.remove(n);n=nb.firstChild;bl=nb;}dom.setStyle(bl,'textAlign',v);dom.setStyle(n,'float','');}else dom.setStyle(n,'float',v);this.mceRepaint();return;}if(ed.settings.inline_styles&&ed.settings.forced_root_block){if(rm)v='';each(this._getSelectedBlocks(dom.getParent(se.getStart(),dom.isBlock),dom.getParent(se.getEnd(),dom.isBlock)),function(e){dom.setAttrib(e,'align','');dom.setStyle(e,'textAlign',v=='full'?'justify':v);});return;}else if(!rm)ed.getDoc().execCommand(c,false,null);if(ed.settings.inline_styles){if(rm){dom.getParent(ed.selection.getNode(),function(n){if(n.style&&n.style.textAlign)dom.setStyle(n,'textAlign','');});return;}each(dom.select('*'),function(n){var v=n.align;if(v){if(v=='full')v='justify';dom.setStyle(n,'textAlign',v);dom.setAttrib(n,'align','');}});}},mceSetCSSClass:function(u,v){this.mceSetStyleInfo(0,{command:'setattrib',name:'class',value:v});},getSelectedElement:function(){var t=this,ed=t.editor,dom=ed.dom,se=ed.selection,r=se.getRng(),r1,r2,sc,ec,so,eo,e,sp,ep,re;if(se.isCollapsed()||r.item)return se.getNode();re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(isIE){r1=r.duplicate();r1.collapse(true);sc=r1.parentElement();r2=r.duplicate();r2.collapse(false);ec=r2.parentElement();if(sc!=ec){r1.move('character',1);sc=r1.parentElement();}if(sc==ec){r1=r.duplicate();r1.moveToElementText(sc);if(r1.compareEndPoints('StartToStart',r)==0&&r1.compareEndPoints('EndToEnd',r)==0)return re&&re.test(sc.nodeName)?null:sc;}}else{function getParent(n){return dom.getParent(n,function(n){return n.nodeType==1;});};sc=r.startContainer;ec=r.endContainer;so=r.startOffset;eo=r.endOffset;if(!r.collapsed){if(sc==ec){if(so-eo<2){if(sc.hasChildNodes()){sp=sc.childNodes[so];return re&&re.test(sp.nodeName)?null:sp;}}}}if(sc.nodeType!=3||ec.nodeType!=3)return null;if(so==0){sp=getParent(sc);if(sp&&sp.firstChild!=sc)sp=null;}if(so==sc.nodeValue.length){e=sc.nextSibling;if(e&&e.nodeType==1)sp=sc.nextSibling;}if(eo==0){e=ec.previousSibling;if(e&&e.nodeType==1)ep=e;}if(eo==ec.nodeValue.length){ep=getParent(ec);if(ep&&ep.lastChild!=ec)ep=null;}if(sp==ep)return re&&sp&&re.test(sp.nodeName)?null:sp;}return null;},InsertHorizontalRule:function(){if(isGecko||isIE)this.editor.selection.setContent('<hr />');else this.editor.getDoc().execCommand('InsertHorizontalRule',false,'');},RemoveFormat:function(){var t=this,ed=t.editor,s=ed.selection,b;if(isWebKit)s.setContent(s.getContent({format:'raw'}).replace(/(<(span|b|i|strong|em|strike) [^>]+>|<(span|b|i|strong|em|strike)>|<\/(span|b|i|strong|em|strike)>|)/g,''),{format:'raw'});else ed.getDoc().execCommand('RemoveFormat',false,null);t.mceSetStyleInfo(0,{command:'removeformat'});ed.addVisual();},mceSetStyleInfo:function(u,v){var t=this,ed=t.editor,d=ed.getDoc(),dom=ed.dom,e,b,s=ed.selection,nn=v.wrapper||'span',b=s.getBookmark(),re;function set(n,e){if(n.nodeType==1){switch(v.command){case'setattrib':return dom.setAttrib(n,v.name,v.value);case'setstyle':return dom.setStyle(n,v.name,v.value);case'removeformat':return dom.setAttrib(n,'class','');}}};re=ed.settings.merge_styles_invalid_parents;if(tinymce.is(re,'string'))re=new RegExp(re,'i');if(e=t.getSelectedElement())set(e,1);else{d.execCommand('FontName',false,'__');each(isWebKit?dom.select('span'):dom.select('font'),function(n){var sp,e;if(dom.getAttrib(n,'face')=='__'||n.style.fontFamily==='__'){sp=dom.create(nn,{mce_new:'1'});set(sp);each(n.childNodes,function(n){sp.appendChild(n.cloneNode(true));});dom.replace(sp,n);}});}each(dom.select(nn).reverse(),function(n){var p=n.parentNode;dom.setAttrib(n,'mce_new','');if(!dom.getAttrib(n,'mce_new')){p=dom.getParent(n,function(n){return n.nodeType==1&&dom.getAttrib(n,'mce_new');});if(p)dom.remove(n,1);}});each(dom.select(nn).reverse(),function(n){var p=n.parentNode;if(!p)return;if(p.nodeName==nn.toUpperCase()&&p.childNodes.length==1)return dom.remove(p,1);if(n.nodeType==1&&(!re||!re.test(p.nodeName))&&p.childNodes.length==1){set(p);dom.setAttrib(n,'class','');}});each(dom.select(nn).reverse(),function(n){if(!dom.getAttrib(n,'class')&&!dom.getAttrib(n,'style'))return dom.remove(n,1);});s.moveToBookmark(b);},queryStateJustify:function(c,v){var ed=this.editor,n=ed.selection.getNode(),dom=ed.dom;if(n&&n.nodeName=='IMG')return dom.getStyle(n,'float')==v;n=dom.getParent(ed.selection.getStart(),function(n){return n.nodeType==1&&n.style.textAlign;});if(v=='full')v='justify';if(ed.settings.inline_styles)return(n&&n.style.textAlign==v);return ed.getDoc().queryCommandState(c);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();function set(s){if(!isGecko)return;try{d.execCommand("styleWithCSS",0,s);}catch(ex){d.execCommand("useCSS",0,!s);}};if(isGecko||isOpera){set(true);d.execCommand('hilitecolor',false,val);set(false);}else d.execCommand('BackColor',false,val);},Undo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.undo();ed.nodeChanged();}else ed.getDoc().execCommand('Undo',false,null);},Redo:function(){var ed=this.editor;if(ed.settings.custom_undo_redo){ed.undoManager.redo();ed.nodeChanged();}else ed.getDoc().execCommand('Redo',false,null);},FormatBlock:function(ui,val){var t=this,ed=t.editor;val=ed.settings.forced_root_block?(val||'<p>'):val;t.mceRemoveNode();if(val.indexOf('<')==-1)val='<'+val+'>';if(tinymce.isGecko)val=val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,'$1');ed.getDoc().execCommand('FormatBlock',false,val);},mceCleanup:function(){var ed=this.editor,s=ed.selection,b=s.getBookmark();ed.setContent(ed.getContent());s.moveToBookmark(b);},mceRemoveNode:function(ui,val){var ed=this.editor,s=ed.selection,b,n=val||s.getNode();if(n==ed.getBody())return;b=s.getBookmark();ed.dom.remove(n,1);s.moveToBookmark(b);ed.nodeChanged();},mceSelectNodeDepth:function(ui,val){var ed=this.editor,s=ed.selection,c=0;ed.dom.getParent(s.getNode(),function(n){if(n.nodeType==1&&c++==val){s.select(n);ed.nodeChanged();return false;}},ed.getBody());},mceSelectNode:function(u,v){this.editor.selection.select(v);},mceInsertContent:function(ui,val){this.editor.selection.setContent(val);},mceInsertRawHTML:function(ui,val){var ed=this.editor;ed.execCommand('mceInsertContent',false,'tiny_mce_marker');ed.setContent(ed.getContent().replace(/tiny_mce_marker/g,val));},mceRepaint:function(){var s,b,e=this.editor;if(tinymce.isGecko){try{s=e.selection;b=s.getBookmark(true);if(s.getSel())s.getSel().selectAllChildren(e.getBody());s.collapse(true);s.moveToBookmark(b);}catch(ex){}}},queryStateUnderline:function(){var ed=this.editor,n;if(n&&n.nodeName=='A')return false;return ed.getDoc().queryCommandState('Underline');},queryStateOutdent:function(){var ed=this.editor,n;if(ed.settings.inline_styles){if((n=ed.dom.getParent(ed.selection.getStart(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;if((n=ed.dom.getParent(ed.selection.getEnd(),ed.dom.isBlock))&&parseInt(n.style.paddingLeft)>0)return true;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'UL');},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),'OL');},queryStatemceBlockQuote:function(){return!!this.editor.dom.getParent(this.editor.selection.getStart(),function(n){return n.nodeName==='BLOCKQUOTE';});},mceBlockQuote:function(){var t=this,s=t.editor.selection,b=s.getBookmark(),bq,dom=t.editor.dom;function findBQ(e){return dom.getParent(e,function(n){return n.nodeName==='BLOCKQUOTE';});};if(findBQ(s.getStart())){each(t._getSelectedBlocks(findBQ(s.getStart()),findBQ(s.getEnd())),function(e){if(e.nodeName=='BLOCKQUOTE')dom.remove(e,1);});t.editor.selection.moveToBookmark(b);return;}each(t._getSelectedBlocks(findBQ(s.getStart()),findBQ(s.getEnd())),function(e){var n;if(e.nodeName=='BLOCKQUOTE'&&!bq){bq=e;return;}if(!bq){bq=dom.create('blockquote');e.parentNode.insertBefore(bq,e);}if(e.nodeName=='BLOCKQUOTE'&&bq){n=e.firstChild;while(n){bq.appendChild(n.cloneNode(true));n=n.nextSibling;}dom.remove(e);return;}bq.appendChild(dom.remove(e));});t.editor.selection.moveToBookmark(b);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.isBlock(n))bl.push(n);}}if(eb&&sb!=eb)bl.push(eb);return bl;}});})();tinymce.create('tinymce.UndoManager',{index:0,data:null,typing:0,UndoManager:function(ed){var t=this,Dispatcher=tinymce.util.Dispatcher;t.editor=ed;t.data=[];t.onAdd=new Dispatcher(this);t.onUndo=new Dispatcher(this);t.onRedo=new Dispatcher(this);},add:function(l){var t=this,i,ed=t.editor,b,s=ed.settings,la;l=l||{};l.content=l.content||ed.getContent({format:'raw',no_events:1});l.content=l.content.replace(/^\s*|\s*$/g,'');la=t.data[t.index>0?t.index-1:0];if(!l.initial&&la&&l.content==la.content)return null;if(s.custom_undo_redo_levels){if(t.data.length>s.custom_undo_redo_levels){for(i=0;i<t.data.length-1;i++)t.data[i]=t.data[i+1];t.data.length--;t.index=t.data.length;}}if(s.custom_undo_redo_restore_selection)l.bookmark=b=l.bookmark||ed.selection.getBookmark();if(t.index<t.data.length&&t.data[t.index].initial)t.index++;t.data.length=t.index+1;t.data[t.index++]=l;if(l.initial)t.index=0;if(t.data.length==2&&t.data[0].initial)t.data[0].bookmark=b;t.onAdd.dispatch(t,l);ed.isNotDirty=0;return l;},undo:function(){var t=this,ed=t.editor,l=l,i;if(t.typing){t.add();t.typing=0;}if(t.index>0){if(t.index==t.data.length&&t.index>1){i=t.index;t.typing=0;if(!t.add())t.index=i;--t.index;}l=t.data[--t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onUndo.dispatch(t,l);}return l;},redo:function(){var t=this,ed=t.editor,l=null;if(t.index<t.data.length-1){l=t.data[++t.index];ed.setContent(l.content,{format:'raw'});ed.selection.moveToBookmark(l.bookmark);t.onRedo.dispatch(t,l);}return l;},clear:function(){var t=this;t.data=[];t.index=0;t.typing=0;t.add({initial:true});},hasUndo:function(){return this.index!=0||this.typing;},hasRedo:function(){return this.index<this.data.length-1;}});(function(){var Event,isIE,isGecko,isOpera,each,extend;Event=tinymce.dom.Event;isIE=tinymce.isIE;isGecko=tinymce.isGecko;isOpera=tinymce.isOpera;each=tinymce.each;extend=tinymce.extend;tinymce.create('tinymce.ForceBlocks',{ForceBlocks:function(ed){var t=this,s;t.editor=ed;t.dom=ed.dom;t.settings=s=extend({element:'P',forced_root_block:'p',force_p_newlines:true},ed.settings);ed.onPreInit.add(t.setup,t);function padd(ed,o){if(isOpera)o.content=o.content.replace(/(\u00a0|&#160;|&nbsp;)<\/p>/gi,'</p>');o.content=o.content.replace(/<p( )([^>]+)><\/p>|<p( )([^>]+)\/>|<p( )([^>]+)>\s+<\/p>|<p><\/p>|<p\/>|<p>\s+<\/p>/gi,'<p$1$2$3$4$5$6>\u00a0</p>');if(!isIE&&o.set){o.content=o.content.replace(/<p( )([^>]+)>[\s\u00a0]+<\/p>|<p>[\s\u00a0]+<\/p>/gi,'<p$1$2><br /></p>');}else{o.content=o.content.replace(/<p( )([^>]+)>\s*<br \/>\s*<\/p>|<p>\s*<br \/>\s*<\/p>/gi,'<p$1$2>\u00a0</p>');o.content=o.content.replace(/\s*<br \/>\s*<\/p>/gi,'</p>');}};ed.onBeforeSetContent.add(padd);ed.onPostProcess.add(padd);if(s.forced_root_block){ed.onInit.add(t.forceRoots,t);ed.onSetContent.add(t.forceRoots,t);ed.onBeforeGetContent.add(t.forceRoots,t);}},setup:function(){var t=this,ed=t.editor,s=t.settings;if(s.forced_root_block){ed.onKeyUp.add(t.forceRoots,t);ed.onPreProcess.add(t.forceRoots,t);}if(s.force_br_newlines){if(isIE){ed.onKeyPress.add(function(ed,e){var n,s=ed.selection;if(e.keyCode==13){s.setContent('<br id="__" /> ',{format:'raw'});n=ed.dom.get('__');n.removeAttribute('id');s.select(n);s.collapse();return Event.cancel(e);}});}return;}if(!isIE&&s.force_p_newlines){ed.onPreProcess.add(function(ed,o){each(ed.dom.select('br',o.node),function(n){var p=n.parentNode;if(p&&p.nodeName=='p'&&(p.childNodes.length==1||p.lastChild==n))p.replaceChild(ed.getDoc().createTextNode('\u00a0'),n);});});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&!e.shiftKey){if(!t.insertPara(e))Event.cancel(e);}});if(isGecko){ed.onKeyDown.add(function(ed,e){if((e.keyCode==8||e.keyCode==46)&&!e.shiftKey)t.backspaceDelete(e,e.keyCode==8);});}}},find:function(n,t,s){var ed=this.editor,w=ed.getDoc().createTreeWalker(n,4,null,false),c=-1;while(n=w.nextNode()){c++;if(t==0&&n==s)return c;if(t==1&&c==s)return n;}return-1;},forceRoots:function(ed,e){var t=this,ed=t.editor,b=ed.getBody(),d=ed.getDoc(),se=ed.selection,s=se.getSel(),r=se.getRng(),si=-2,ei,so,eo,tr,c=-0xFFFFFF;var nx,bl,bp,sp,le,nl=b.childNodes,i;if(e&&e.keyCode==13)return true;for(i=nl.length-1;i>=0;i--){nx=nl[i];if(nx.nodeType==3||!t.dom.isBlock(nx)){if(!bl){if(nx.nodeType!=3||/[^\s]/g.test(nx.nodeValue)){if(si==-2&&r){if(!isIE){so=r.startOffset;eo=r.endOffset;si=t.find(b,0,r.startContainer);ei=t.find(b,0,r.endContainer);}else{tr=d.body.createTextRange();tr.moveToElementText(b);tr.collapse(1);bp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(1);sp=tr.move('character',c)*-1;tr=r.duplicate();tr.collapse(0);le=(tr.move('character',c)*-1)-sp;si=sp-bp;ei=le;}}bl=ed.dom.create(t.settings.forced_root_block);bl.appendChild(nx.cloneNode(1));nx.parentNode.replaceChild(bl,nx);}}else{if(bl.hasChildNodes())bl.insertBefore(nx,bl.firstChild);else bl.appendChild(nx);}}else bl=null;}if(si!=-2){if(!isIE){bl=d.getElementsByTagName(t.settings.element)[0];r=d.createRange();if(si!=-1)r.setStart(t.find(b,1,si),so);else r.setStart(bl,0);if(ei!=-1)r.setEnd(t.find(b,1,ei),eo);else r.setEnd(bl,0);if(s){s.removeAllRanges();s.addRange(r);}}else{try{r=s.createRange();r.moveToElementText(b);r.collapse(1);r.moveStart('character',si);r.moveEnd('character',ei);r.select();}catch(ex){}}}},getParentBlock:function(n){var d=this.dom;return d.getParent(n,d.isBlock);},insertPara:function(e){var t=this,ed=t.editor,d=ed.getDoc(),se=t.settings,s=ed.selection.getSel(),r=s.getRangeAt(0),b=d.body;var rb,ra,dir,sn,so,en,eo,sb,eb,bn,bef,aft,sc,ec,n;function isEmpty(n){n=n.innerHTML;n=n.replace(/<(img|hr|table)/gi,'-');n=n.replace(/<[^>]+>/g,'');return n.replace(/[ \t\r\n]+/g,'')=='';};rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(true);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(true);dir=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;sn=dir?s.anchorNode:s.focusNode;so=dir?s.anchorOffset:s.focusOffset;en=dir?s.focusNode:s.anchorNode;eo=dir?s.focusOffset:s.anchorOffset;if(sn==b&&en==b&&b.firstChild&&ed.dom.isBlock(b.firstChild)){sn=en=sn.firstChild;so=eo=0;rb=d.createRange();rb.setStart(sn,0);ra=d.createRange();ra.setStart(en,0);}sn=sn.nodeName=="BODY"?sn.firstChild:sn;en=en.nodeName=="BODY"?en.firstChild:en;sb=t.getParentBlock(sn);eb=t.getParentBlock(en);bn=sb?sb.nodeName:se.element;if(t.dom.getParent(sb,function(n){return/OL|UL|PRE/.test(n.nodeName);}))return true;if(sb&&(sb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(sb.style.position))){bn=se.element;sb=null;}if(eb&&(eb.nodeName=='CAPTION'||/absolute|relative|static/gi.test(eb.style.position))){bn=se.element;eb=null;}if(/(TD|TABLE|TH|CAPTION)/.test(bn)||(sb&&bn=="DIV"&&/left|right/gi.test(sb.style.cssFloat))){bn=se.element;sb=eb=null;}bef=(sb&&sb.nodeName==bn)?sb.cloneNode(0):ed.dom.create(bn);aft=(eb&&eb.nodeName==bn)?eb.cloneNode(0):ed.dom.create(bn);aft.removeAttribute('id');if(/^(H[1-6])$/.test(bn)&&sn.nodeValue&&so==sn.nodeValue.length)aft=ed.dom.create(se.element);n=sc=sn;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;sc=n;}while((n=n.previousSibling?n.previousSibling:n.parentNode));n=ec=en;do{if(n==b||n.nodeType==9||t.dom.isBlock(n)||/(TD|TABLE|TH|CAPTION)/.test(n.nodeName))break;ec=n;}while((n=n.nextSibling?n.nextSibling:n.parentNode));if(sc.nodeName==bn)rb.setStart(sc,0);else rb.setStartBefore(sc);rb.setEnd(sn,so);bef.appendChild(rb.cloneContents()||d.createTextNode(''));try{ra.setEndAfter(ec);}catch(ex){}ra.setStart(en,eo);aft.appendChild(ra.cloneContents()||d.createTextNode(''));r=d.createRange();if(!sc.previousSibling&&sc.parentNode.nodeName==bn){r.setStartBefore(sc.parentNode);}else{if(rb.startContainer.nodeName==bn&&rb.startOffset==0)r.setStartBefore(rb.startContainer);else r.setStart(rb.startContainer,rb.startOffset);}if(!ec.nextSibling&&ec.parentNode.nodeName==bn)r.setEndAfter(ec.parentNode);else r.setEnd(ra.endContainer,ra.endOffset);r.deleteContents();if(bef.firstChild&&bef.firstChild.nodeName==bn)bef.innerHTML=bef.firstChild.innerHTML;if(aft.firstChild&&aft.firstChild.nodeName==bn)aft.innerHTML=aft.firstChild.innerHTML;if(isEmpty(bef))bef.innerHTML='<br />';if(isEmpty(aft))aft.innerHTML=isOpera?'&nbsp;':'<br />';if(isOpera){r.insertNode(bef);r.insertNode(aft);}else{r.insertNode(aft);r.insertNode(bef);}aft.normalize();bef.normalize();r=d.createRange();r.selectNodeContents(aft);r.collapse(1);s.removeAllRanges();s.addRange(r);if(tinymce.isWebKit)ed.getWin().scrollTo(0,ed.dom.getPos(aft).y);else aft.scrollIntoView(0);return false;},backspaceDelete:function(e,bs){var t=this,ed=t.editor,b=ed.getBody(),n,se=ed.selection,r=se.getRng(),sc=r.startContainer,n;if(sc&&ed.dom.isBlock(sc)&&bs){if(sc.childNodes.length==1&&sc.firstChild.nodeName=='BR'){n=sc.previousSibling;if(n){ed.dom.remove(sc);se.select(n,1);se.collapse(0);return Event.cancel(e);}}}function handler(e){e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&t.getParentBlock(e)){ed.dom.remove(e);Event.remove(b,'DOMNodeInserted',handler);}};Event._add(b,'DOMNodeInserted',handler);window.setTimeout(function(){Event._remove(b,'DOMNodeInserted',handler);},1);}});})();(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,extend=tinymce.extend;tinymce.create('tinymce.ControlManager',{ControlManager:function(ed,s){var t=this,i;s=s||{};t.editor=ed;t.controls={};t.onAdd=new tinymce.util.Dispatcher(t);t.onPostRender=new tinymce.util.Dispatcher(t);t.prefix=s.prefix||ed.id+'_';t.onPostRender.add(function(){each(t.controls,function(c){c.postRender();});});},get:function(id){return this.controls[this.prefix+id]||this.controls[id];},setActive:function(id,s){var c=null;if(c=this.get(id))c.setActive(s);return c;},setDisabled:function(id,s){var c=null;if(c=this.get(id))c.setDisabled(s);return c;},add:function(c){var t=this;if(c){t.controls[c.id]=c;t.onAdd.dispatch(c,t);}return c;},createControl:function(n){var c,t=this,ed=t.editor;each(ed.plugins,function(p){if(p.createControl){c=p.createControl(n,t);if(c)return false;}});switch(n){case"|":case"separator":return t.createSeparator();}if(!c&&ed.buttons&&(c=ed.buttons[n]))return t.createButton(n,c);return t.add(c);},createDropMenu:function(id,s){var t=this,ed=t.editor,c;s=extend({'class':'mceDropDown'},s);s['class']=s['class']+' '+ed.getParam('skin')+'Skin';id=t.prefix+id;c=t.controls[id]=new tinymce.ui.DropMenu(id,s);c.onAddItem.add(function(c,o){var s=o.settings;s.title=ed.getLang(s.title,s.title);if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}});ed.onRemove.add(function(){c.destroy();});return t.add(c);},createListBox:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,scope:s.scope,control_manager:t},s);id=t.prefix+id;if(ed.settings.use_native_selects)c=new tinymce.ui.NativeListBox(id,s);else c=new tinymce.ui.ListBox(id,s);t.controls[id]=c;if(tinymce.isWebKit){c.onPostRender.add(function(c,n){Event.add(n,'mousedown',function(){ed.bookmark=ed.selection.getBookmark('simple');});Event.add(n,'focus',function(){ed.selection.moveToBookmark(ed.bookmark);ed.bookmark=null;});});}if(c.hideMenu)ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createButton:function(id,s){var t=this,ed=t.editor,o,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick&&!s.menu_button){s.onclick=function(){ed.execCommand(s.cmd,s.ui||false,s.value);};}s=extend({title:s.title,'class':id,unavailable_prefix:ed.getLang('unavailable',''),scope:s.scope,control_manager:t},s);id=t.prefix+id;if(s.menu_button){c=new tinymce.ui.MenuButton(id,s);ed.onMouseDown.add(c.hideMenu,c);}else c=new tinymce.ui.Button(id,s);return t.add(c);},createMenuButton:function(id,s){s=s||{};s.menu_button=1;return this.createButton(id,s);},createSplitButton:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,scope:s.scope,control_manager:t},s);id=t.prefix+id;c=t.add(new tinymce.ui.SplitButton(id,s));ed.onMouseDown.add(c.hideMenu,c);return c;},createColorSplitButton:function(id,s){var t=this,ed=t.editor,cmd,c;if(t.get(id))return null;s.title=ed.translate(s.title);s.scope=s.scope||ed;if(!s.onclick){s.onclick=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}if(!s.onselect){s.onselect=function(v){ed.execCommand(s.cmd,s.ui||false,v||s.value);};}s=extend({title:s.title,'class':id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope,more_colors_title:ed.getLang('more_colors')},s);id=t.prefix+id;c=new tinymce.ui.ColorSplitButton(id,s);ed.onMouseDown.add(c.hideMenu,c);return t.add(c);},createToolbar:function(id,s){var c,t=this;id=t.prefix+id;c=new tinymce.ui.Toolbar(id,s);if(t.get(id))return null;return t.add(c);},createSeparator:function(){return new tinymce.ui.Separator();}});})();(function(){var Dispatcher=tinymce.util.Dispatcher,each=tinymce.each,isIE=tinymce.isIE,isOpera=tinymce.isOpera;tinymce.create('tinymce.WindowManager',{WindowManager:function(ed){var t=this;t.editor=ed;t.onOpen=new Dispatcher(t);t.onClose=new Dispatcher(t);t.params={};t.features={};},open:function(s,p){var t=this,f='',x,y,mo=t.editor.settings.dialog_type=='modal',w,sw,sh,vp=tinymce.DOM.getViewPort();s=s||{};p=p||{};sw=isOpera?vp.w:screen.width;sh=isOpera?vp.h:screen.height;s.name=s.name||'mc_'+new Date().getTime();s.width=parseInt(s.width||320);s.height=parseInt(s.height||240);s.resizable=true;s.left=s.left||parseInt(sw/ 2.0) - (s.width /2.0);s.top=s.top||parseInt(sh/ 2.0) - (s.height /2.0);p.inline=false;p.mce_width=s.width;p.mce_height=s.height;if(mo){if(isIE){s.center=true;s.help=false;s.dialogWidth=s.width+'px';s.dialogHeight=s.height+'px';s.scroll=s.scrollbars||false;}else s.modal=s.alwaysRaised=s.dialog=s.centerscreen=s.dependent=true;}each(s,function(v,k){if(tinymce.is(v,'boolean'))v=v?'yes':'no';if(!/^(name|url)$/.test(k)){if(isIE&&mo)f+=(f?';':'')+k+':'+v;else f+=(f?',':'')+k+'='+v;}});t.features=s;t.params=p;t.onOpen.dispatch(t,s,p);try{if(isIE&&mo){w=1;window.showModalDialog(s.url||s.file,window,f);}else w=window.open(s.url||s.file,s.name,f);}catch(ex){}if(!w)alert(t.editor.getLang('popup_blocked'));},close:function(w){w.close();this.onClose.dispatch(this);},createInstance:function(cl){var a=arguments,i,f=tinymce.resolve(cl),s='';for(i=1;i<a.length;i++)s+=(i>1?',':'')+'a['+i+']';return eval('(new f('+s+'))');},confirm:function(t,cb,s){cb.call(s||this,confirm(this._decode(this.editor.getLang(t,t))));},alert:function(t,cb,s){alert(this._decode(t));if(cb)cb.call(s||this);},_decode:function(s){return tinymce.DOM.decode(s).replace(/\\n/g,'\n');}});}());
  • trunk/wp-includes/js/tinymce/tiny_mce_config.php

    r6689 r6694  
    2626    $valid_elements = apply_filters('mce_valid_elements', $valid_elements);
    2727   
    28     $invalid_elements = apply_filters('mce_invalid_elements', '');
     28    $invalid_elements = apply_filters('mce_invalid_elements', '');
    2929
    30     $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'wphelp', 'media', 'fullscreen' );
     30    $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' );
    3131    $plugins = apply_filters('mce_plugins', $plugins);
    3232    $plugins = implode($plugins, ',');
    3333
    34     $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv', 'wp_adv_start', 'wp_adv_end'));
     34    $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'outdent', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'image', 'wp_more', '|', 'spellchecker', '|', 'wp_help', 'wp_adv' ));
    3535    $mce_buttons = implode($mce_buttons, ',');
    3636
    37     $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', 'media', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'fullscreen'));
     37
     38    $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', '|', 'removeformat', 'cleanup', '|', 'media', 'charmap', 'blockquote', '|', 'undo', 'redo', 'fullscreen' ));
    3839    $mce_buttons_2 = implode($mce_buttons_2, ',');
    3940
    4041    $mce_buttons_3 = apply_filters('mce_buttons_3', array());
    4142    $mce_buttons_3 = implode($mce_buttons_3, ',');
     43   
     44    $mce_buttons_4 = apply_filters('mce_buttons_4', array());
     45    $mce_buttons_4 = implode($mce_buttons_4, ',');
    4246
    4347    $mce_browsers = apply_filters('mce_browsers', array('msie', 'gecko', 'opera', 'safari'));
    4448    $mce_browsers = implode($mce_browsers, ',');
    4549
    46     $mce_popups_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/popups.css';
    47     $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css';
     50    $mce_css = get_option('siteurl') . '/wp-includes/js/tinymce/wordpress.css';
    4851    $mce_css = apply_filters('mce_css', $mce_css);
    49     if ( $_SERVER['HTTPS'] == 'on' ) {
     52    if ( $_SERVER['HTTPS'] == 'on' )
    5053        $mce_css = str_replace('http://', 'https://', $mce_css);
    51         $mce_popups_css = str_replace('http://', 'https://', $mce_popups_css);
    52     }
    5354
    5455    $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower(get_locale());
    5556?>
    5657
    57 /*
    58 wpEditorInit = function() {
    59     // Activate tinyMCE if it's the user's default editor
    60     if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor )
    61         tinyMCE.execCommand('mceAddControl', false, 'content');
    62 };
    63 */
    64 
    65 wpEditorInit = function() {
    66     if ( ( 'undefined' != typeof wpTinyMCEConfig ) && 'tinymce' != wpTinyMCEConfig.defaultEditor )
    67         tinyMCE.get('content').hide();
    68 }
    69 
    7058initArray = {
    71     mode : "exact",
    72     elements : "content",
    73 //  editor_selector : "mceEditor",
    74     oninit : "wpEditorInit",
    75     width : "100%",
     59    mode : "none",
     60    onpageload : "wpEditorInit",
     61    width : "100%",
    7662    theme : "advanced",
    77     skin : "o2k7",
     63    skin : "wp_theme",
    7864    theme_advanced_buttons1 : "<?php echo $mce_buttons; ?>",
    7965    theme_advanced_buttons2 : "<?php echo $mce_buttons_2; ?>",
    8066    theme_advanced_buttons3 : "<?php echo $mce_buttons_3; ?>",
     67    theme_advanced_buttons4 : "<?php echo $mce_buttons_4; ?>",
    8168    language : "<?php echo $mce_locale; ?>",
    8269    theme_advanced_toolbar_location : "top",
     
    9582    remove_linebreaks : false,
    9683    fix_list_elements : true,
     84    fix_table_elements : true,
    9785    gecko_spellcheck : true,
    9886    entities : "38,amp,60,lt,62,gt",
    99     button_tile_map : false,
     87    accessibility_focus : false,
     88    tab_focus : ":next",
    10089    content_css : "<?php echo $mce_css; ?>",
    101     valid_elements : "<?php echo $valid_elements; ?>",
    102     invalid_elements : "<?php echo $invalid_elements; ?>",
    103     save_callback : 'TinyMCE_wordpressPlugin.saveCallback',
    104     imp_version : "<?php echo intval($_GET['ver']); ?>",
     90    <?php if ( $valid_elements ) echo 'valid_elements : "' . $valid_elements . '",' . "\n"; ?>
     91    <?php if ( $invalid_elements ) echo 'invalid_elements : "' . $invalid_elements . '",' . "\n"; ?>
     92    save_callback : "switchEditors.saveCallback",
    10593<?php do_action('mce_options'); ?>
    10694    plugins : "<?php echo $plugins; ?>"
     
    113101?>
    114102
    115 tinyMCE.init(initArray);
     103tinyMCE_GZ.init(initArray);
  • trunk/wp-includes/js/tinymce/tiny_mce_gzip.php

    r6632 r6694  
    11<?php
    22/**
    3  * $Id: tiny_mce_gzip.php 158 2006-12-21 14:32:19Z spocke $
     3 * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
    44 *
    55 * @author Moxiecode
    6  * @copyright Copyright 2005-2006, Moxiecode Systems AB, All rights reserved.
     6 * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
    77 *
    88 * This file compresses the TinyMCE JavaScript using GZip and
     
    1010 * Notice: This script defaults the button_tile_map option to true for extra performance.
    1111 */
     12
     13//error_reporting(E_ALL);
     14    @require_once('../../../wp-config.php');  // For get_bloginfo().
    1215   
    13     @require_once('../../../wp-config.php');  // For get_bloginfo().
    14 ?>
    15     var scriptURL = '<?php echo get_bloginfo('wpurl') . '/' . WPINC; ?>/js/tinymce/tiny_mce.js';
    16     document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
    17 <?php     
    18     exit; // tiny_mce_gzip.php needs changes, but also it's much easier to test the js when it's not in one big file
    19    
     16    // Headers
     17    $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
     18    header("Content-type: text/javascript");
     19    header("Vary: Accept-Encoding");  // Handle proxies
     20    header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
     21
     22if ( isset($_GET['load']) ) {
     23
     24    function getParam( $name, $def = false ) {
     25        if ( ! isset($_GET[$name]) )
     26            return $def;
     27
     28        return preg_replace( "/[^0-9a-z\-_,]+/i", "", $_GET[$name] ); // Remove anything but 0-9,a-z,-_
     29    }
     30
     31    function getFileContents($path) {
     32        $path = realpath($path);
     33
     34        if ( !$path || !@is_file($path) )
     35            return '';
     36
     37        if ( function_exists('file_get_contents') )
     38            return @file_get_contents($path);
     39
     40        $content = '';
     41        $fp = @fopen( $path, 'r' );
     42        if (!$fp)
     43            return '';
     44
     45        while ( ! feof($fp) )
     46            $content .= fgets($fp);
     47
     48        fclose($fp);
     49
     50        return $content;
     51    }
     52
     53    function putFileContents( $path, $content ) {
     54        if ( function_exists('file_put_contents') )
     55            return @file_put_contents($path, $content);
     56
     57        $fp = @fopen($path, 'wb');
     58        if ($fp) {
     59            fwrite($fp, $content);
     60            fclose($fp);
     61        }
     62    }
     63
     64
    2065    // Get input
    21     $plugins = explode(',', getParam("plugins", ""));
    22     $languages = explode(',', getParam("languages", ""));
    23     $themes = explode(',', getParam("themes", ""));
    24     $diskCache = getParam("diskcache", "") == "true";
    25     $isJS = getParam("js", "") == "true";
    26     $compress = getParam("compress", "true") == "true";
    27     $suffix = getParam("suffix", "_src") == "_src" ? "_src" : "";
    28     $cachePath = realpath("."); // Cache path, this is where the .gz files will be stored
    29     $expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
    30     $content = "";
     66    $plugins = explode( ',', getParam('plugins', '') );
     67    $languages = explode( ',', getParam('languages', '') );
     68    $themes = explode( ',', getParam('themes', '') );
     69    $diskCache = getParam( 'diskcache', '' ) == 'true';
     70    $isJS = getParam( 'js', '' ) == 'true';
     71    $compress = getParam( 'compress', 'true' ) == 'true';
     72    $core = getParam( 'core', 'true' ) == 'true';
     73    $suffix = getParam( 'suffix', '_src' ) == '_src' ? '_src' : '';
     74    $cachePath = realpath('.'); // Cache path, this is where the .gz files will be stored
     75   
     76    $content = '';
    3177    $encodings = array();
    3278    $supportsGzip = false;
    33     $enc = "";
    34     $cacheKey = "";
    35 
    36     // Custom extra javascripts to pack
    37     $custom = array(/*
    38         "some custom .js file",
    39         "some custom .js file"
    40     */);
    41 
    42     // WP
    43     $index = getParam("index", -1);
    44     $theme = getParam("theme", "");
     79    $enc = '';
     80    $cacheKey = '';
     81   
     82    // WP. Language handling could be improved... Concat all translated langs files and store in /wp-content/languages as .mo?
     83    $theme = getParam( 'theme', 'advanced' );
    4584    $themes = array($theme);
    46     $language = getParam("language", "en");
    47     if ( empty($language) )
    48         $language = 'en';
    49     $languages = array($language);
    50     if ( $language != strtolower($language) )
     85   
     86    $language = getParam( 'language', 'en' );
     87    $languages = array($language);
     88   
     89    if ( $language != strtolower($language) )
    5190        $languages[] = strtolower($language);
    52     if ( $language != substr($language, 0, 2) )
     91   
     92    if ( $language != substr($language, 0, 2) )
    5393        $languages[] = substr($language, 0, 2);
    54     $diskCache = false;
     94   
     95    $diskCache = false;
    5596    $isJS = true;
    5697    $suffix = '';
    5798
    58     // Headers
    59     header("Content-Type: text/javascript; charset=" . get_bloginfo('charset'));
    60     header("Vary: Accept-Encoding");  // Handle proxies
    61     header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
     99    // Custom extra javascripts to pack
     100    // WP - add a hook for external plugins to be compressed too?
     101    $custom = array(/*
     102        'some custom .js file',
     103        'some custom .js file'
     104    */);
    62105
    63106    // Is called directly then auto init with default settings
    64     if (!$isJS) {
    65         echo getFileContents("tiny_mce_gzip.js");
    66         echo "tinyMCE_GZ.init({});";
     107    if ( ! $isJS ) {
     108        echo getFileContents('tiny_mce_gzip.js');
     109        echo 'tinyMCE_GZ.init({});';
    67110        die();
    68111    }
    69112
    70     // Setup cache info
    71     if ($diskCache) {
    72         if (!$cachePath)
    73             die("alert('Real path failed.');");
    74 
    75         $cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "");
    76 
    77         foreach ($custom as $file)
     113    // Setup cache info
     114    if ( $diskCache ) {
     115        if ( ! $cachePath )
     116            die('Real path failed.');
     117
     118        $cacheKey = getParam( 'plugins', '' ) . getParam( 'languages', '' ) . getParam( 'themes', '' ) . $suffix;
     119
     120        foreach ( $custom as $file )
    78121            $cacheKey .= $file;
    79122
    80123        $cacheKey = md5($cacheKey);
    81124
    82         if ($compress)
    83             $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";
     125        if ( $compress )
     126            $cacheFile = $cachePath . '/tiny_mce_' . $cacheKey . '.gz';
    84127        else
    85             $cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";
     128            $cacheFile = $cachePath . '/tiny_mce_' . $cacheKey . '.js';
    86129    }
    87130
    88131    // Check if it supports gzip
    89     if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
    90         $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
    91 
    92     if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && ini_get('output_handler') != 'ob_gzhandler') {
    93         $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
     132    if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
     133        $encodings = explode( ',', strtolower( preg_replace('/\s+/', '', $_SERVER['HTTP_ACCEPT_ENCODING']) ) );
     134
     135    if ( ( in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------']) ) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') ) {
     136        $enc = in_array( 'x-gzip', $encodings ) ? 'x-gzip' : 'gzip';
    94137        $supportsGzip = true;
    95138    }
    96139
    97140    // Use cached file disk cache
    98     if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
    99         if ($compress)
    100             header("Content-Encoding: " . $enc);
     141    if ( $diskCache && $supportsGzip && file_exists($cacheFile) ) {
     142        if ( $compress )
     143            header('Content-Encoding: ' . $enc);
    101144
    102145        echo getFileContents($cacheFile);
     
    104147    }
    105148
    106 if ($index > -1) {
    107     // Write main script and patch some things
    108     if ( $index == 0 ) {
    109         // Add core
    110         $content .= wp_compact_tinymce_js(getFileContents("tiny_mce" . $suffix . ".js"));
    111         $content .= 'TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;';
    112         $content .= 'TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;';
    113     } else
    114         $content .= 'tinyMCE = realTinyMCE;';
    115 
    116     // Patch loading functions
    117     //$content .= "tinyMCE_GZ.start();";
    118 
    119     // Do init based on index
    120     $content .= "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);";
    121 
    122     // Load external plugins
    123     if ( $index == 0 )
    124         $content .= "tinyMCECompressed.loadPlugins();";
     149    // Add core
     150    if ( $core == 'true' ) {
     151        $content .= getFileContents('tiny_mce' . $suffix . '.js');
     152
     153        // Patch loading functions
     154        $content .= 'tinyMCE_GZ.start();';
     155    }
    125156
    126157    // Add core languages
    127158    $lang_content = '';
    128     foreach ($languages as $lang)
    129         $lang_content .= getFileContents("langs/" . $lang . ".js");
    130     if ( empty($lang_content) )
    131         $lang_content .= getFileContents("langs/en.js");
    132     $content .= $lang_content;
     159    foreach ( $languages as $lang )
     160        $lang_content .= getFileContents('langs/' . $lang . '.js');
     161   
     162    if ( empty($lang_content) && file_exists('langs/en.js') )
     163        $lang_content .= getFileContents('langs/en.js');
     164   
     165    $content .= $lang_content;
    133166
    134167    // Add themes
    135     foreach ($themes as $theme) {
    136         $content .= wp_compact_tinymce_js(getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js"));
     168    foreach ( $themes as $theme ) {
     169        $content .= getFileContents( 'themes/' . $theme . '/editor_template' . $suffix . '.js');
    137170
    138171        $lang_content = '';
    139         foreach ($languages as $lang)
    140             $lang_content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
    141         if ( empty($lang_content) )
    142             $lang_content .= getFileContents("themes/" . $theme . "/langs/en.js");
    143         $content .= $lang_content;
     172        foreach ( $languages as $lang )
     173            $lang_content .= getFileContents( 'themes/' . $theme . '/langs/' . $lang . '.js' );
     174       
     175        if ( empty($lang_content) && file_exists( 'themes/' . $theme . '/langs/en.js' ) )
     176            $lang_content .= getFileContents( 'themes/' . $theme . '/langs/en.js' );
     177       
     178        $content .= $lang_content;
    144179    }
    145180
    146181    // Add plugins
    147     foreach ($plugins as $plugin) {
    148         $content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
     182    foreach ( $plugins as $plugin ) {
     183        $content .= getFileContents('plugins/' . $plugin . '/editor_plugin' . $suffix . '.js');
    149184
    150185        $lang_content = '';
    151         foreach ($languages as $lang)
    152             $lang_content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
    153         if ( empty($lang_content) )
    154             $lang_content .= getFileContents("plugins/" . $plugin . "/langs/en.js");
    155         $content .= $lang_content;
     186        foreach ( $languages as $lang )
     187            $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/' . $lang . '.js' );
     188       
     189        if ( empty($lang_content) && file_exists( 'plugins/' . $plugin . '/langs/en.js' ) )
     190            $lang_content .= getFileContents( 'plugins/' . $plugin . '/langs/en.js' );
     191       
     192        $content .= $lang_content;
    156193    }
    157194
    158195    // Add custom files
    159     foreach ($custom as $file)
     196    foreach ( $custom as $file )
    160197        $content .= getFileContents($file);
    161198
    162     // Reset tinyMCE compressor engine
    163     $content .= "tinyMCE = tinyMCECompressed;";
    164 
    165199    // Restore loading functions
    166     //$content .= "tinyMCE_GZ.end();";
     200    if ( $core == 'true' )
     201        $content .= 'tinyMCE_GZ.end();';
    167202
    168203    // Generate GZIP'd content
    169     if ($supportsGzip) {
    170         if ($compress) {
    171             header("Content-Encoding: " . $enc);
    172             $cacheData = gzencode($content, 9, FORCE_GZIP);
     204    if ( $supportsGzip ) {
     205        if ( $compress ) {
     206            header('Content-Encoding: ' . $enc);
     207            $cacheData = gzencode( $content, 9, FORCE_GZIP );
    173208        } else
    174209            $cacheData = $content;
    175210
    176211        // Write gz file
    177         if ($diskCache && $cacheKey != "")
    178             putFileContents($cacheFile, $cacheData);
     212        if ( $diskCache && $cacheKey != '' )
     213            putFileContents( $cacheFile, $cacheData );
    179214
    180215        // Stream to client
     
    185220    }
    186221
    187     die;
     222    exit;
    188223}
    189 
    190     /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    191 
    192     function getParam($name, $def = false) {
    193         if (!isset($_GET[$name]))
    194             return $def;
    195 
    196         return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
    197     }
    198 
    199     function getFileContents($path) {
    200         $path = realpath($path);
    201 
    202         if (!$path || !@is_file($path))
    203             return "";
    204 
    205         if (function_exists("file_get_contents"))
    206             return @file_get_contents($path);
    207 
    208         $content = "";
    209         $fp = @fopen($path, "r");
    210         if (!$fp)
    211             return "";
    212 
    213         while (!feof($fp))
    214             $content .= fgets($fp);
    215 
    216         fclose($fp);
    217 
    218         return $content;
    219     }
    220 
    221     function putFileContents($path, $content) {
    222         if (function_exists("file_put_contents"))
    223             return @file_put_contents($path, $content);
    224 
    225         $fp = @fopen($path, "wb");
    226         if ($fp) {
    227             fwrite($fp, $content);
    228             fclose($fp);
     224?>
     225
     226var tinyMCEPreInit = {suffix : ''};
     227
     228var tinyMCE_GZ = {
     229    settings : {
     230        themes : '',
     231        plugins : '',
     232        languages : '',
     233        disk_cache : false,
     234        page_name : 'tiny_mce_gzip.php',
     235        debug : false,
     236        suffix : ''
     237    },
     238   
     239    opt : {},
     240   
     241    init : function(arr, cb) {
     242        var t = this, n, s, nl = document.getElementsByTagName('script');
     243       
     244        t.opt = arr;
     245
     246        t.settings.themes = arr.theme;
     247        t.settings.plugins = arr.plugins;
     248        t.settings.languages = arr.language;
     249        s = t.settings;
     250        t.cb = cb || '';
     251
     252        for (i=0; i<nl.length; i++) {
     253            n = nl[i];
     254
     255            if (n.src && n.src.indexOf('tiny_mce') != -1)
     256                t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
    229257        }
    230     }
    231 
    232     // WP specific
    233     function wp_compact_tinymce_js($text) {
    234         // This function was custom-made for TinyMCE 2.0, not expected to work with any other JS.
    235 
    236         // Strip comments
    237         $text = preg_replace("!(^|\s+)//.*$!m", '', $text);
    238         $text = preg_replace("!/\*.*?\*/!s", '', $text);
    239 
    240         // Strip leading tabs, carriage returns and unnecessary line breaks.
    241         $text = preg_replace("!^\t+!m", '', $text);
    242         $text = str_replace("\r", '', $text);
    243         $text = preg_replace("!(^|{|}|;|:|\))\n!m", '\\1', $text);
    244 
    245         return "$text\n";
    246     }
    247 ?>
    248 
    249 function TinyMCECompressed() {
    250     this.configs = new Array();
    251     this.loadedFiles = new Array();
    252     this.externalPlugins = new Array();
    253     this.loadAdded = false;
    254     this.isLoaded = false;
    255 }
    256 
    257 TinyMCECompressed.prototype.init = function(settings) {
    258     var elements = document.getElementsByTagName('script');
    259     var scriptURL = "";
    260 
    261     for (var i=0; i<elements.length; i++) {
    262         if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
    263             scriptURL = elements[i].src;
    264             break;
    265         }
    266     }
    267 
    268     settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
    269     settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
    270     settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
    271     settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
    272     this.configs[this.configs.length] = settings;
    273     this.settings = settings;
    274 
    275     scriptURL += (scriptURL.indexOf('?') == -1) ? '?' : '&';
    276     scriptURL += "theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
    277     document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
    278 
    279     if (!this.loadAdded) {
    280         tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
    281         tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
    282         this.loadAdded = true;
    283     }
    284 }
    285 
    286 TinyMCECompressed.prototype.onLoad = function() {
    287     if (tinyMCE.isLoaded)
    288         return true;
    289 
    290     tinyMCE = realTinyMCE;
    291     TinyMCE_Engine.prototype.onLoad();
    292     tinyMCE._addUnloadEvents();
    293 
    294     tinyMCE.isLoaded = true;
    295 }
    296 
    297 TinyMCECompressed.prototype.addEvent = function(o, n, h) {
    298     if (o.attachEvent)
    299         o.attachEvent("on" + n, h);
    300     else
    301         o.addEventListener(n, h, false);
    302 }
    303 
    304 TinyMCECompressed.prototype.getOnce = function(str) {
    305     var ar = str.replace(/\s+/g, '').split(',');
    306 
    307     for (var i=0; i<ar.length; i++) {
    308         if (ar[i] == '' || ar[i].charAt(0) == '-') {
    309             ar[i] = null;
    310             continue;
    311         }
    312 
    313         // Skip load
    314         for (var x=0; x<this.loadedFiles.length; x++) {
    315             if (this.loadedFiles[x] == ar[i])
    316                 ar[i] = null;
    317         }
    318 
    319         this.loadedFiles[this.loadedFiles.length] = ar[i];
    320     }
    321 
    322     // Glue
    323     str = "";
    324     for (var i=0; i<ar.length; i++) {
    325         if (ar[i] == null)
    326             continue;
    327 
    328         str += ar[i];
    329 
    330         if (i != ar.length-1)
    331             str += ",";
    332     }
    333 
    334     return str;
     258        tinyMCEPreInit.base = t.baseURL;
     259       
     260        if (!t.coreLoaded)
     261            t.loadScripts(1, s.themes, s.plugins, s.languages);
     262    },
     263
     264    loadScripts : function(co, th, pl, la, cb, sc) {
     265        var t = this, x, w = window, q, c = 0, ti, s = t.settings;
     266
     267        function get(s) {
     268            x = 0;
     269
     270            try {
     271                x = new ActiveXObject(s);
     272            } catch (s) {
     273            }
     274
     275            return x;
     276        };
     277       
     278        // Build query string
     279        q = 'load=true&js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la);
     280
     281        if (co)
     282            t.coreLoaded = 1;
     283   
     284    // Easier to debug with this...
     285    //  document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + t.baseURL + '/' + s.page_name + '?' + q + '"></script>');
     286
     287        // Send request
     288        x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
     289        x.overrideMimeType && x.overrideMimeType('text/javascript');
     290        x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
     291//      x.setRequestHeader('Content-Type', 'text/javascript');
     292        x.send('');
     293
     294        // Handle asyncronous loading
     295        if (cb) {
     296            // Wait for response
     297            ti = w.setInterval(function() {
     298                if (x.readyState == 4 || c++ > 10000) {
     299                    w.clearInterval(ti);
     300
     301                    if (c < 10000 && x.status == 200) {
     302                        t.loaded = 1;
     303                        t.eval(x.responseText);
     304                        tinymce.dom.Event.domLoaded = true;
     305                    //  cb.call(sc || t, x);
     306                    }
     307
     308                    ti = x = null;
     309                }
     310            }, 10);
     311        } else
     312            t.eval(x.responseText);
     313    },
     314
     315    start : function() {
     316        var t = this, each = tinymce.each, s = t.settings, sl, ln = s.languages.split(',');
     317
     318        tinymce.suffix = s.suffix;
     319
     320        // Extend script loader
     321        tinymce.create('tinymce.compressor.ScriptLoader:tinymce.dom.ScriptLoader', {
     322            loadScripts : function(sc, cb, s) {
     323                var ti = this, th = [], pl = [], la = [];
     324
     325                each(sc, function(o) {
     326                    var u = o.url;
     327
     328                    if ((!ti.lookup[u] || ti.lookup[u].state != 2) && u.indexOf(t.baseURL) === 0) {
     329                        // Collect theme
     330                        if (u.indexOf('editor_template') != -1) {
     331                            th.push(/\/themes\/([^\/]+)/.exec(u)[1]);
     332                            load(u, 1);
     333                        }
     334
     335                        // Collect plugin
     336                        if (u.indexOf('editor_plugin') != -1) {
     337                            pl.push(/\/plugins\/([^\/]+)/.exec(u)[1]);
     338                            load(u, 1);
     339                        }
     340
     341                        // Collect language
     342                        if (u.indexOf('/langs/') != -1) {
     343                            la.push(/\/langs\/([^.]+)/.exec(u)[1]);
     344                            load(u, 1);
     345                        }
     346                    }
     347                });
     348
     349                if (th.length + pl.length + la.length > 0) {
     350                    if (sl.settings.strict_mode) {
     351                        // Async
     352                        t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
     353                        return;
     354                    } else
     355                        t.loadScripts(0, th.join(','), pl.join(','), la.join(','), cb, s);
     356                }
     357
     358                return ti.parent(sc, cb, s);
     359            }
     360        });
     361
     362        sl = tinymce.ScriptLoader = new tinymce.compressor.ScriptLoader();
     363
     364        function load(u, sp) {
     365            var o;
     366
     367            if (!sp)
     368                u = t.baseURL + u;
     369
     370            o = {url : u, state : 2};
     371            sl.queue.push(o);
     372            sl.lookup[o.url] = o;
     373        };
     374
     375        // Add core languages
     376        each (ln, function(c) {
     377            if (c)
     378                load('/langs/' + c + '.js');
     379        });
     380
     381        // Add themes with languages
     382        each(s.themes.split(','), function(n) {
     383            if (n) {
     384                load('/themes/' + n + '/editor_template' + s.suffix + '.js');
     385
     386                each (ln, function(c) {
     387                    if (c)
     388                        load('/themes/' + n + '/langs/' + c + '.js');
     389                });
     390            }
     391        });
     392
     393        // Add plugins with languages
     394        each(s.plugins.split(','), function(n) {
     395            if (n) {
     396                load('/plugins/' + n + '/editor_plugin' + s.suffix + '.js');
     397
     398                each (ln, function(c) {
     399                    if (c)
     400                        load('/plugins/' + n + '/langs/' + c + '.js');
     401                });
     402            }
     403        });
     404    },
     405
     406    end : function() {
     407       tinyMCE.init(this.opt);
     408    },
     409
     410    eval : function(co) {
     411        var w = window;
     412
     413        // Evaluate script
     414        if (!w.execScript) {
     415            try {
     416                eval.call(w, co);
     417            } catch (ex) {
     418                eval(co, w); // Firefox 3.0a8
     419            }
     420        } else
     421            w.execScript(co); // IE
     422    }
    335423};
    336 
    337 TinyMCECompressed.prototype.loadPlugins = function() {
    338     var i, ar;
    339 
    340     TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
    341     tinyMCE = realTinyMCE;
    342 
    343     ar = tinyMCECompressed.externalPlugins;
    344     for (i=0; i<ar.length; i++)
    345         tinyMCE.loadPlugin(ar[i].name, ar[i].url);
    346 
    347     TinyMCE.prototype.loadScript = function() {};
    348 };
    349 
    350 TinyMCECompressed.prototype.loadPlugin = function(n, u) {
    351     this.externalPlugins[this.externalPlugins.length] = {name : n, url : u};
    352 };
    353 
    354 TinyMCECompressed.prototype.importPluginLanguagePack = function(n, v) {
    355     tinyMCE = realTinyMCE;
    356     TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
    357     tinyMCE.importPluginLanguagePack(n, v);
    358 };
    359 
    360 TinyMCECompressed.prototype.addPlugin = function(n, p) {
    361     tinyMCE = realTinyMCE;
    362     tinyMCE.addPlugin(n, p);
    363 };
    364 
    365 var tinyMCE = new TinyMCECompressed();
    366 var tinyMCECompressed = tinyMCE;
  • trunk/wp-includes/js/tinymce/tiny_mce_popup.js

    r6632 r6694  
    4747    },
    4848
    49     execCommand : function(cmd, ui, val) {
     49    execCommand : function(cmd, ui, val, a) {
    5050        this.restoreSelection();
    51         return this.editor.execCommand(cmd, ui, val);
     51        return this.editor.execCommand(cmd, ui, val, a || {skip_focus : 1});
    5252    },
    5353
     
    9494                document.getElementById(element_id).value = c;
    9595
    96                 if (tinymce.is(document.getElementById(element_id).onchange, 'function'))
     96                try {
    9797                    document.getElementById(element_id).onchange();
     98                } catch (ex) {
     99                    // Try fire event, ignore errors
     100                }
    98101            }
    99102        });
  • trunk/wp-includes/js/tinymce/wp-mce-help.php

    r6641 r6694  
    1010<?php wp_admin_css(); ?>
    1111<style type="text/css">
    12     #wphead {
    13         padding-top: 5px;
     12    body {
     13        background-color: #eaf3ea;
     14    }
     15    #wphead {
     16        padding-top: 2px;
    1417        padding-left: 15px;
    1518        font-size: 80%;
     19        border-top: 0;
     20        background-color: #eaf3ea;
    1621    }
    1722    #adminmenu {
     
    1924        padding-left: 15px;
    2025        font-size: 80%;
     26        background-color: #eaf3ea;
    2127    }
    2228    #user_info {
     
    3945        padding: 5px 20px 10px;
    4046        background-color: #fff;
     47        border-left: 1px solid #c6d9e9;
     48        border-bottom: 1px solid #c6d9e9;
    4149    }
    4250    * html {
     
    114122            t = d('tab'+i.toString());
    115123            if ( n == i ) {
    116                 c.className = 'vizible';
     124                c.className = '';
    117125                t.className = 'current';
    118126            } else {
     
    137145<div class="zerosize"></div>
    138146<div id="wphead"><h1><?php echo get_bloginfo('blogtitle'); ?></h1></div>
    139 <div id="user_info"><p><strong><?php _e('Rich Editor Help') ?></strong></p></div>
     147
    140148<ul id="adminmenu">
    141149    <li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Basics of Rich Editing') ?>" accesskey="1" class="current"><?php _e('Basics') ?></a></li>
     
    190198
    191199    <div id="buttoncontainer">
    192         <a href="http://www.moxiecode.com" target="_new"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="<?php _e('Got Moxie?') ?>" border="0" /></a>
    193         <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="<?php _e('Hosted By Sourceforge') ?>" border="0" /></a>
    194         <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="<?php _e('Also on freshmeat') ?>" border="0" /></a>
     200        <a href="http://www.moxiecode.com" target="_new"><img src="themes/advanced/img/gotmoxie.png" alt="<?php _e('Got Moxie?') ?>" border="0" /></a>
     201        <a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="themes/advanced/img/sflogo.png" alt="<?php _e('Hosted By Sourceforge') ?>" border="0" /></a>
     202        <a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="themes/advanced/img/fm.gif" alt="<?php _e('Also on freshmeat') ?>" border="0" /></a>
    195203    </div>
    196204
    197205</div>
    198 
     206</div>
     207
     208<div class="mceActionPanel">
     209    <div style="margin: 8px auto; text-align: center;padding-bottom: 10px;">
     210        <input type="button" id="cancel" name="cancel" value="<?php _e('Close'); ?>" title="<?php _e('Close'); ?>" onclick="tinyMCEPopup.close();" />
     211    </div>
    199212</div>
    200213
  • trunk/wp-includes/script-loader.php

    r6692 r6694  
    3131
    3232        // Modify this version when tinyMCE plugins are changed
    33         $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20080105' );
     33        $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20080129' );
    3434
    3535        $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
    36         $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20080105' );
     36        $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20080129' );
    3737
    3838        $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
Note: See TracChangeset for help on using the changeset viewer.