Ticket #4262: 4262.diff
| File 4262.diff, 220.3 KB (added by rob1n, 5 years ago) |
|---|
-
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
1 1 /** 2 * $Id: editor_plugin_src.js 2 01 2007-02-12 15:56:56Z spocke $2 * $Id: editor_plugin_src.js 268 2007-04-28 15:52:59Z spocke $ 3 3 * 4 4 * Moxiecode DHTML Windows script. 5 5 * … … 82 82 // Center div in editor area 83 83 pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2)); 84 84 pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2)); 85 86 // WordPress cache buster 87 url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; 85 88 86 url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; // WordPress cache buster87 88 89 mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop + ",minWidth=" + minWidth + ",minHeight=" + minHeight ); 89 90 }; 90 91 91 92 TinyMCE_Engine.prototype.closeWindow = function(win) { 92 93 var gotit = false, n, w; 94 93 95 for (n in mcWindows.windows) { 94 96 w = mcWindows.windows[n]; 95 if (typeof(w) == 'function') continue; 97 98 if (typeof(w) == 'function') 99 continue; 100 96 101 if (win.name == w.id + '_iframe') { 97 102 w.close(); 98 103 gotit = true; 99 104 } 100 105 } 106 101 107 if (!gotit) 102 108 this.orgCloseWindow(win); 103 109 … … 392 398 html += '<html>'; 393 399 html += '<head>'; 394 400 html += '<title>Wrapper iframe</title>'; 401 402 // WordPress: put the window buttons on the left as in Macs 395 403 if (this.isMac) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;width:100%;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>'; 404 396 405 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'; 397 406 html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />'; 398 407 html += '</head>'; -
wp-includes/js/tinymce/tiny_mce.js
5 5 var ua; 6 6 7 7 this.majorVersion = "2"; 8 this.minorVersion = "1. 0";9 this.releaseDate = "2007-0 2-13";8 this.minorVersion = "1.1.1"; 9 this.releaseDate = "2007-05-14"; 10 10 11 this.instances = new Array();12 this.switchClassCache = new Array();13 this.windowArgs = new Array();14 this.loadedFiles = new Array();15 this.pendingFiles = new Array();11 this.instances = []; 12 this.switchClassCache = []; 13 this.windowArgs = []; 14 this.loadedFiles = []; 15 this.pendingFiles = []; 16 16 this.loadingIndex = 0; 17 this.configs = new Array();17 this.configs = []; 18 18 this.currentConfig = 0; 19 this.eventHandlers = new Array();20 this.log = new Array();19 this.eventHandlers = []; 20 this.log = []; 21 21 this.undoLevels = []; 22 22 this.undoIndex = 0; 23 23 this.typingUndoIndex = -1; 24 this.settings = []; 24 25 25 26 // Browser check 26 27 ua = navigator.userAgent; … … 28 29 this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1); 29 30 this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1); 30 31 this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1); 31 this.isGecko = ua.indexOf('Gecko') != -1; 32 this.isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari 32 33 this.isSafari = ua.indexOf('Safari') != -1; 33 this.isOpera = ua.indexOf('Opera') != -1;34 this.isOpera = window['opera'] && opera.buildNumber ? true : false; 34 35 this.isMac = ua.indexOf('Mac') != -1; 35 36 this.isNS7 = ua.indexOf('Netscape/7') != -1; 36 37 this.isNS71 = ua.indexOf('Netscape/7.1') != -1; 37 38 this.dialogCounter = 0; 38 this.plugins = new Array();39 this.themes = new Array();40 this.menus = new Array();41 this.loadedPlugins = new Array();42 this.buttonMap = new Array();39 this.plugins = []; 40 this.themes = []; 41 this.menus = []; 42 this.loadedPlugins = []; 43 this.buttonMap = []; 43 44 this.isLoaded = false; 44 45 45 46 // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those … … 58 59 59 60 TinyMCE_Engine.prototype = { 60 61 init : function(settings) { 61 var theme, nl, baseHREF = "", i ;62 var theme, nl, baseHREF = "", i, cssPath, entities, h, p, src, elements = [], head; 62 63 63 64 // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry. 64 65 if (this.isMSIE5_0) … … 72 73 73 74 // Get script base path 74 75 if (!tinyMCE.baseURL) { 75 var elements = document.getElementsByTagName('script'); 76 // Search through head 77 head = document.getElementsByTagName('head')[0]; 76 78 79 if (head) { 80 for (i=0, nl = head.getElementsByTagName('script'); i<nl.length; i++) 81 elements.push(nl[i]); 82 } 83 84 // Search through rest of document 85 for (i=0, nl = document.getElementsByTagName('script'); i<nl.length; i++) 86 elements.push(nl[i]); 87 77 88 // If base element found, add that infront of baseURL 78 89 nl = document.getElementsByTagName('base'); 79 90 for (i=0; i<nl.length; i++) { … … 81 92 baseHREF = nl[i].href; 82 93 } 83 94 84 for ( vari=0; i<elements.length; i++) {95 for (i=0; i<elements.length; i++) { 85 96 if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) { 86 varsrc = elements[i].src;97 src = elements[i].src; 87 98 88 99 tinyMCE.srcMode = (src.indexOf('_src') != -1 || src.indexOf('_dev') != -1) ? '_src' : ''; 89 100 tinyMCE.gzipMode = src.indexOf('_gzip') != -1; … … 93 104 tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : ''; 94 105 95 106 // Force it absolute if page has a base href 96 if (baseHREF != ""&& src.indexOf('://') == -1)107 if (baseHREF !== '' && src.indexOf('://') == -1) 97 108 tinyMCE.baseURL = baseHREF + src; 98 109 else 99 110 tinyMCE.baseURL = src; … … 121 132 this._def("theme", "advanced"); 122 133 this._def("plugins", "", true); 123 134 this._def("language", "en"); 124 this._def("docs_language", this.settings ['language']);135 this._def("docs_language", this.settings.language); 125 136 this._def("elements", ""); 126 137 this._def("textarea_trigger", "mce_editable"); 127 138 this._def("editor_selector", ""); … … 132 143 this._def("encoding", ""); 133 144 this._def("urlconverter_callback", tinyMCE.getParam("urlconvertor_callback", "TinyMCE_Engine.prototype.convertURL")); 134 145 this._def("save_callback", ""); 135 this._def("debug", false);136 146 this._def("force_br_newlines", false); 137 147 this._def("force_p_newlines", true); 138 148 this._def("add_form_submit_trigger", true); … … 193 203 this._def("display_tab_class", ''); 194 204 this._def("gecko_spellcheck", false); 195 205 this._def("hide_selects_on_submit", true); 206 this._def("forced_root_block", false); 207 this._def("remove_trailing_nbsp", false); 196 208 197 209 // Force strict loading mode to false on non Gecko browsers 198 210 if (this.isMSIE && !this.isOpera) 199 211 this.settings.strict_loading_mode = false; 200 212 201 213 // Browser check IE 202 if (this.isMSIE && this.settings ['browsers'].indexOf('msie') == -1)214 if (this.isMSIE && this.settings.browsers.indexOf('msie') == -1) 203 215 return; 204 216 205 217 // Browser check Gecko 206 if (this.isGecko && this.settings ['browsers'].indexOf('gecko') == -1)218 if (this.isGecko && this.settings.browsers.indexOf('gecko') == -1) 207 219 return; 208 220 209 221 // Browser check Safari 210 if (this.isSafari && this.settings ['browsers'].indexOf('safari') == -1)222 if (this.isSafari && this.settings.browsers.indexOf('safari') == -1) 211 223 return; 212 224 213 225 // Browser check Opera 214 if (this.isOpera && this.settings ['browsers'].indexOf('opera') == -1)226 if (this.isOpera && this.settings.browsers.indexOf('opera') == -1) 215 227 return; 216 228 217 229 // If not super absolute make it so 218 baseHREF = tinyMCE.settings ['document_base_url'];219 varh = document.location.href;220 varp = h.indexOf('://');230 baseHREF = tinyMCE.settings.document_base_url; 231 h = document.location.href; 232 p = h.indexOf('://'); 221 233 if (p > 0 && document.location.protocol != "file:") { 222 234 p = h.indexOf('/', p + 3); 223 235 h = h.substring(0, p); … … 225 237 if (baseHREF.indexOf('://') == -1) 226 238 baseHREF = h + baseHREF; 227 239 228 tinyMCE.settings ['document_base_url']= baseHREF;229 tinyMCE.settings ['document_base_prefix']= h;240 tinyMCE.settings.document_base_url = baseHREF; 241 tinyMCE.settings.document_base_prefix = h; 230 242 } 231 243 232 244 // Trim away query part 233 245 if (baseHREF.indexOf('?') != -1) 234 246 baseHREF = baseHREF.substring(0, baseHREF.indexOf('?')); 235 247 236 this.settings ['base_href']= baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";248 this.settings.base_href = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; 237 249 238 theme = this.settings ['theme'];250 theme = this.settings.theme; 239 251 this.inlineStrict = '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'; 240 252 this.inlineTransitional = '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'; 241 this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD| BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';253 this.blockElms = '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'; 242 254 this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); 243 this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);255 this.posKeyCodes = [13,45,36,35,33,34,37,38,39,40]; 244 256 this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL 245 257 this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>'; 246 this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance');258 this.callbacks = ['onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance']; 247 259 248 260 // Theme url 249 this.settings ['theme_href']= tinyMCE.baseURL + "/themes/" + theme;261 this.settings.theme_href = tinyMCE.baseURL + "/themes/" + theme; 250 262 251 263 if (!tinyMCE.isIE || tinyMCE.isOpera) 252 this.settings ['force_br_newlines']= false;264 this.settings.force_br_newlines = false; 253 265 254 266 if (tinyMCE.getParam("popups_css", false)) { 255 varcssPath = tinyMCE.getParam("popups_css", "");267 cssPath = tinyMCE.getParam("popups_css", ""); 256 268 257 269 // Is relative 258 270 if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') 259 this.settings ['popups_css']= this.documentBasePath + "/" + cssPath;271 this.settings.popups_css = this.documentBasePath + "/" + cssPath; 260 272 else 261 this.settings ['popups_css']= cssPath;273 this.settings.popups_css = cssPath; 262 274 } else 263 this.settings ['popups_css']= tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";275 this.settings.popups_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css"; 264 276 265 277 if (tinyMCE.getParam("editor_css", false)) { 266 varcssPath = tinyMCE.getParam("editor_css", "");278 cssPath = tinyMCE.getParam("editor_css", ""); 267 279 268 280 // Is relative 269 281 if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') 270 this.settings ['editor_css']= this.documentBasePath + "/" + cssPath;282 this.settings.editor_css = this.documentBasePath + "/" + cssPath; 271 283 else 272 this.settings ['editor_css']= cssPath;284 this.settings.editor_css = cssPath; 273 285 } else { 274 if (this.settings.editor_css != '')275 this.settings ['editor_css']= tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";286 if (this.settings.editor_css !== '') 287 this.settings.editor_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; 276 288 } 277 289 278 if (tinyMCE.settings['debug']) {279 var msg = "Debug: \n";280 281 msg += "baseURL: " + this.baseURL + "\n";282 msg += "documentBasePath: " + this.documentBasePath + "\n";283 msg += "content_css: " + this.settings['content_css'] + "\n";284 msg += "popups_css: " + this.settings['popups_css'] + "\n";285 msg += "editor_css: " + this.settings['editor_css'] + "\n";286 287 alert(msg);288 }289 290 290 // Only do this once 291 291 if (this.configs.length == 0) { 292 292 if (typeof(TinyMCECompressed) == "undefined") { … … 304 304 } 305 305 } 306 306 307 this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings ['theme']+ '/editor_template' + tinyMCE.srcMode + '.js');308 this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings ['language']+ '.js');309 this.loadCSS(this.settings ['editor_css']);307 this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings.theme + '/editor_template' + tinyMCE.srcMode + '.js'); 308 this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings.language + '.js'); 309 this.loadCSS(this.settings.editor_css); 310 310 311 311 // Add plugins 312 varp = tinyMCE.getParam('plugins', '', true, ',');312 p = tinyMCE.getParam('plugins', '', true, ','); 313 313 if (p.length > 0) { 314 for ( vari=0; i<p.length; i++) {314 for (i=0; i<p.length; i++) { 315 315 if (p[i].charAt(0) != '-') 316 316 this.loadScript(tinyMCE.baseURL + '/plugins/' + p[i] + '/editor_plugin' + tinyMCE.srcMode + '.js'); 317 317 } … … 319 319 320 320 // Setup entities 321 321 if (tinyMCE.getParam('entity_encoding') == 'named') { 322 settings ['cleanup_entities'] = new Array();323 varentities = tinyMCE.getParam('entities', '', true, ',');324 for ( vari=0; i<entities.length; i+=2)325 settings ['cleanup_entities']['c' + entities[i]] = entities[i+1];322 settings.cleanup_entities = []; 323 entities = tinyMCE.getParam('entities', '', true, ','); 324 for (i=0; i<entities.length; i+=2) 325 settings.cleanup_entities['c' + entities[i]] = entities[i+1]; 326 326 } 327 327 328 328 // Save away this config 329 settings ['index']= this.configs.length;329 settings.index = this.configs.length; 330 330 this.configs[this.configs.length] = settings; 331 331 332 332 // Start loading first one in chain … … 337 337 try { 338 338 document.execCommand('BackgroundImageCache', false, true); 339 339 } catch (e) { 340 // Ignore 340 341 } 341 342 } 342 343 343 344 // Setup XML encoding regexps 344 this.xmlEncodeAposRe = new RegExp('[<>&"\']', 'g');345 345 this.xmlEncodeRe = new RegExp('[<>&"]', 'g'); 346 // this.xmlEncodeEnts = {'&':'&','"':'"',"'":''','<':'<','>':'>'};347 346 }, 348 347 349 348 _addUnloadEvents : function() { 349 var st = tinyMCE.settings.add_unload_trigger; 350 350 351 if (tinyMCE.isIE) { 351 if ( tinyMCE.settings['add_unload_trigger']) {352 if (st) { 352 353 tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler); 353 354 tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler); 354 355 } 355 356 } else { 356 if ( tinyMCE.settings['add_unload_trigger'])357 if (st) 357 358 tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);}); 358 359 } 359 360 }, … … 449 450 450 451 loadCSS : function(url) { 451 452 var ar = url.replace(/\s+/, '').split(','); 452 var lflen = 0, csslen = 0; 453 var skip = false; 453 var lflen = 0, csslen = 0, skip = false; 454 454 var x = 0, i = 0, nl, le; 455 455 456 456 for (x = 0,csslen = ar.length; x<csslen; x++) { … … 514 514 515 515 tinyMCE.settings = settings; 516 516 517 if (tinyMCE.settings ['convert_on_click'] || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang['lang_edit_confirm'])))517 if (tinyMCE.settings.convert_on_click || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang.lang_edit_confirm))) 518 518 tinyMCE.addMCEControl(elm, elementId); 519 519 520 520 elm.setAttribute('mce_noask', 'true'); 521 521 }, 522 522 523 523 updateContent : function(form_element_name) { 524 var formElement, n, inst, doc; 525 524 526 // Find MCE instance linked to given form element and copy it's value 525 var formElement = document.getElementById(form_element_name); 526 for (var n in tinyMCE.instances) { 527 var inst = tinyMCE.instances[n]; 527 formElement = document.getElementById(form_element_name); 528 for (n in tinyMCE.instances) { 529 inst = tinyMCE.instances[n]; 530 528 531 if (!tinyMCE.isInstance(inst)) 529 532 continue; 530 533 531 534 inst.switchSettings(); 532 535 533 536 if (inst.formElement == formElement) { 534 vardoc = inst.getDoc();535 537 doc = inst.getDoc(); 538 536 539 tinyMCE._setHTML(doc, inst.formElement.value); 537 540 538 541 if (!tinyMCE.isIE) … … 681 684 }, 682 685 683 686 execCommand : function(command, user_interface, value) { 684 var inst = tinyMCE.selectedInstance ;687 var inst = tinyMCE.selectedInstance, n, pe, te; 685 688 686 689 // Default input 687 690 user_interface = user_interface ? user_interface : false; … … 721 724 return true; 722 725 723 726 case 'mceFocus': 724 var inst = tinyMCE.getInstanceById(value); 727 inst = tinyMCE.getInstanceById(value); 728 725 729 if (inst) 726 730 inst.getWin().focus(); 727 731 return; … … 732 736 return; 733 737 734 738 case "mceAddFrameControl": 735 tinyMCE.addMCEControl(tinyMCE._getElementById(value ['element'], value['document']), value['element'], value['document']);739 tinyMCE.addMCEControl(tinyMCE._getElementById(value.element, value.document), value.element, value.document); 736 740 return; 737 741 738 742 case "mceRemoveControl": … … 741 745 return; 742 746 743 747 case "mceToggleEditor": 744 var inst = tinyMCE.getInstanceById(value), pe, te;748 inst = tinyMCE.getInstanceById(value); 745 749 746 750 if (inst) { 747 751 pe = document.getElementById(inst.editorId + '_parent'); … … 754 758 755 759 if (!inst.enabled) { 756 760 pe.style.display = 'none'; 757 te.value = inst.getHTML(); 761 762 if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT') 763 te.value = inst.getHTML(); 764 else 765 te.innerHTML = inst.getHTML(); 766 758 767 te.style.display = inst.oldTargetDisplay; 759 768 tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst); 760 769 } else { 761 770 pe.style.display = 'block'; 762 771 te.style.display = 'none'; 763 inst.setHTML(te.value); 772 773 if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT') 774 inst.setHTML(te.value); 775 else 776 inst.setHTML(te.innerHTML); 777 764 778 inst.useCSS = false; 765 779 tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst); 766 780 } … … 771 785 772 786 case "mceResetDesignMode": 773 787 // Resets the designmode state of the editors in Gecko 774 if ( !tinyMCE.isIE) {775 for ( varn in tinyMCE.instances) {788 if (tinyMCE.isGecko) { 789 for (n in tinyMCE.instances) { 776 790 if (!tinyMCE.isInstance(tinyMCE.instances[n])) 777 791 continue; 778 792 779 793 try { 794 tinyMCE.instances[n].getDoc().designMode = "off"; 780 795 tinyMCE.instances[n].getDoc().designMode = "on"; 796 tinyMCE.instances[n].useCSS = false; 781 797 } catch (e) { 782 798 // Ignore any errors 783 799 } … … 789 805 790 806 if (inst) { 791 807 inst.execCommand(command, user_interface, value); 792 } else if (tinyMCE.settings ['focus_alert'])793 alert(tinyMCELang ['lang_focus_alert']);808 } else if (tinyMCE.settings.focus_alert) 809 alert(tinyMCELang.lang_focus_alert); 794 810 }, 795 811 796 812 _createIFrame : function(replace_element, doc, win) { … … 805 821 806 822 iframe = doc.createElement("iframe"); 807 823 808 aw = "" + tinyMCE.settings ['area_width'];809 ah = "" + tinyMCE.settings ['area_height'];824 aw = "" + tinyMCE.settings.area_width; 825 ah = "" + tinyMCE.settings.area_height; 810 826 811 827 if (aw.indexOf('%') == -1) { 812 828 aw = parseInt(aw); … … 834 850 iframe.setAttribute("allowtransparency", "true"); 835 851 iframe.className = 'mceEditorIframe'; 836 852 837 if (tinyMCE.settings ["auto_resize"])853 if (tinyMCE.settings.auto_resize) 838 854 iframe.setAttribute("scrolling", "no"); 839 855 840 856 // Must have a src element in MSIE HTTPs breaks aswell as absoute URLs 841 857 if (tinyMCE.isRealIE) 842 iframe.setAttribute("src", this.settings ['default_document']);858 iframe.setAttribute("src", this.settings.default_document); 843 859 844 860 iframe.style.width = aw; 845 861 iframe.style.height = ah; … … 861 877 }, 862 878 863 879 setupContent : function(editor_id) { 864 var inst = tinyMCE.instances[editor_id], i; 865 var doc = inst.getDoc(); 866 var head = doc.getElementsByTagName('head').item(0); 867 var content = inst.startContent; 880 var inst = tinyMCE.instances[editor_id], i, doc = inst.getDoc(), head = doc.getElementsByTagName('head').item(0); 881 var content = inst.startContent, contentElement, body; 868 882 869 883 // HTML values get XML encoded in strict mode 870 884 if (tinyMCE.settings.strict_loading_mode) { … … 886 900 return; 887 901 } 888 902 889 if (!head) { 903 // Wait for it to load 904 if (!head || !doc.body) { 890 905 window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10); 891 906 return; 892 907 } 893 908 894 909 // Import theme specific content CSS the user specific 895 tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings ['theme']+ "/css/editor_content.css");896 tinyMCE.importCSS(inst.getDoc(), inst.settings ['content_css']);910 tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings.theme + "/css/editor_content.css"); 911 tinyMCE.importCSS(inst.getDoc(), inst.settings.content_css); 897 912 tinyMCE.dispatchCallback(inst, 'init_instance_callback', 'initInstance', inst); 898 913 899 914 // Setup keyboard shortcuts … … 921 936 if (tinyMCE.getParam("convert_fonts_to_spans")) 922 937 inst.getBody().setAttribute('id', 'mceSpanFonts'); 923 938 924 if (tinyMCE.settings ['nowrap'])939 if (tinyMCE.settings.nowrap) 925 940 doc.body.style.whiteSpace = "nowrap"; 926 941 927 doc.body.dir = this.settings ['directionality'];942 doc.body.dir = this.settings.directionality; 928 943 doc.editorId = editor_id; 929 944 930 945 // Add on document element in Mozilla 931 946 if (!tinyMCE.isIE) 932 947 doc.documentElement.editorId = editor_id; 933 948 934 inst.setBaseHREF(tinyMCE.settings ['base_href']);949 inst.setBaseHREF(tinyMCE.settings.base_href); 935 950 936 951 // Replace new line characters to BRs 937 if (tinyMCE.settings ['convert_newlines_to_brs']) {952 if (tinyMCE.settings.convert_newlines_to_brs) { 938 953 content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi"); 939 954 content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi"); 940 955 content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi"); … … 951 966 // Ugly!!! 952 967 window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500); 953 968 954 if (tinyMCE.settings ["force_br_newlines"])969 if (tinyMCE.settings.force_br_newlines) 955 970 doc.styleSheets[0].addRule("p", "margin: 0;"); 956 971 957 varbody = inst.getBody();972 body = inst.getBody(); 958 973 body.editorId = editor_id; 959 974 } 960 975 … … 962 977 963 978 // Fix for bug #958637 964 979 if (!tinyMCE.isIE) { 965 varcontentElement = inst.getDoc().createElement("body");966 vardoc = inst.getDoc();980 contentElement = inst.getDoc().createElement("body"); 981 doc = inst.getDoc(); 967 982 968 983 contentElement.innerHTML = content; 969 984 970 // Remove weridness! 971 if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt']) 972 content = content.replace(new RegExp('<>', 'g'), ""); 973 974 if (tinyMCE.settings['cleanup_on_startup']) 985 if (tinyMCE.settings.cleanup_on_startup) 975 986 tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement)); 976 987 else 977 988 tinyMCE.setInnerHTML(inst.getBody(), content); 978 989 979 990 tinyMCE.convertAllRelativeURLs(inst.getBody()); 980 991 } else { 981 if (tinyMCE.settings ['cleanup_on_startup']) {992 if (tinyMCE.settings.cleanup_on_startup) { 982 993 tinyMCE._setHTML(inst.getDoc(), content); 983 994 984 995 // Produces permission denied error in MSIE 5.5 985 eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}'); 996 try { 997 tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody())); 998 } catch(e) { 999 // Ignore 1000 } 986 1001 } else 987 1002 tinyMCE._setHTML(inst.getDoc(), content); 988 1003 } … … 990 1005 // Fix for bug #957681 991 1006 //inst.getDoc().designMode = inst.getDoc().designMode; 992 1007 993 tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings ['visual'], inst);1008 tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings.visual, inst); 994 1009 tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc()); 995 1010 996 1011 // Re-add design mode on mozilla … … 1106 1121 }, 1107 1122 1108 1123 handleEvent : function(e) { 1109 var inst = tinyMCE.selectedInstance ;1124 var inst = tinyMCE.selectedInstance, i, elm, keys; 1110 1125 1111 1126 // Remove odd, error 1112 1127 if (typeof(tinyMCE) == "undefined") … … 1149 1164 } 1150 1165 } 1151 1166 1152 window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings ['base_href']);tinyMCE._resetIframeHeight();", 1);1167 window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1); 1153 1168 return; 1154 1169 1155 1170 case "submit": 1156 tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target); 1157 tinyMCE.triggerSave(); 1158 tinyMCE.isNotDirty = true; 1171 tinyMCE.formSubmit(tinyMCE.isMSIE ? window.event.srcElement : e.target); 1159 1172 return; 1160 1173 1161 1174 case "reset": 1162 1175 var formObj = tinyMCE.isIE ? window.event.srcElement : e.target; 1163 1176 1164 for ( vari=0; i<document.forms.length; i++) {1177 for (i=0; i<document.forms.length; i++) { 1165 1178 if (document.forms[i] == formObj) 1166 1179 window.setTimeout('tinyMCE.resetForm(' + i + ');', 10); 1167 1180 } … … 1183 1196 tinyMCE.selectedInstance.switchSettings(); 1184 1197 1185 1198 // Insert P element 1186 if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings ['force_p_newlines']&& e.keyCode == 13 && !e.shiftKey) {1199 if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && e.keyCode == 13 && !e.shiftKey) { 1187 1200 // Insert P element instead of BR 1188 1201 if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) { 1189 1202 // Cancel event … … 1193 1206 } 1194 1207 1195 1208 // Handle backspace 1196 if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings ['force_p_newlines']&& (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {1209 if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) { 1197 1210 // Insert P element instead of BR 1198 1211 if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) { 1199 1212 // Cancel event … … 1203 1216 } 1204 1217 1205 1218 // Return key pressed 1206 if (tinyMCE.isIE && tinyMCE.settings ['force_br_newlines']&& e.keyCode == 13) {1219 if (tinyMCE.isIE && tinyMCE.settings.force_br_newlines && e.keyCode == 13) { 1207 1220 if (e.target.editorId) 1208 1221 tinyMCE.instances[e.target.editorId].select(); 1209 1222 … … 1238 1251 } 1239 1252 1240 1253 return false; 1241 break;1242 1254 1243 1255 case "keyup": 1244 1256 case "keydown": … … 1248 1260 if (inst && inst.handleShortcut(e)) 1249 1261 return false; 1250 1262 1263 inst._fixRootBlocks(); 1264 1265 if (inst.settings.remove_trailing_nbsp) 1266 inst._fixTrailingNbsp(); 1267 1251 1268 if (e.target.editorId) 1252 1269 tinyMCE.instances[e.target.editorId].select(); 1253 1270 1254 1271 if (tinyMCE.selectedInstance) 1255 1272 tinyMCE.selectedInstance.switchSettings(); 1256 1273 1257 varinst = tinyMCE.selectedInstance;1274 inst = tinyMCE.selectedInstance; 1258 1275 1259 1276 // Handle backspace 1260 if (tinyMCE.isGecko && tinyMCE.settings ['force_p_newlines']&& (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {1277 if (tinyMCE.isGecko && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) { 1261 1278 // Insert P element instead of BR 1262 1279 if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) { 1263 1280 // Cancel event … … 1269 1286 1270 1287 tinyMCE.selectedElement = null; 1271 1288 tinyMCE.selectedNode = null; 1272 varelm = tinyMCE.selectedInstance.getFocusElement();1289 elm = tinyMCE.selectedInstance.getFocusElement(); 1273 1290 tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a"); 1274 1291 tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img"); 1275 1292 tinyMCE.selectedElement = elm; 1276 1293 1277 1294 // Update visualaids on tabs 1278 1295 if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9) 1279 tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings ['visual'], tinyMCE.selectedInstance);1296 tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings.visual, tinyMCE.selectedInstance); 1280 1297 1281 1298 // Fix empty elements on return/enter, check where enter occured 1282 1299 if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13) … … 1284 1301 1285 1302 // Fix empty elements on return/enter 1286 1303 if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) { 1287 varelm = tinyMCE.enterKeyElement;1304 elm = tinyMCE.enterKeyElement; 1288 1305 if (elm) { 1289 1306 var re = new RegExp('^HR|IMG|BR$','g'); // Skip these 1290 1307 var dre = new RegExp('^H[1-6]$','g'); // Add double on these … … 1299 1316 } 1300 1317 1301 1318 // Check if it's a position key 1302 varkeys = tinyMCE.posKeyCodes;1319 keys = tinyMCE.posKeyCodes; 1303 1320 var posKey = false; 1304 for ( vari=0; i<keys.length; i++) {1321 for (i=0; i<keys.length; i++) { 1305 1322 if (keys[i] == e.keyCode) { 1306 1323 posKey = true; 1307 1324 break; … … 1309 1326 } 1310 1327 1311 1328 // MSIE custom key handling 1312 if (tinyMCE.isIE && tinyMCE.settings ['custom_undo_redo']) {1313 var keys = new Array(8,46); // Backspace,Delete1329 if (tinyMCE.isIE && tinyMCE.settings.custom_undo_redo) { 1330 keys = [8, 46]; // Backspace,Delete 1314 1331 1315 for ( vari=0; i<keys.length; i++) {1332 for (i=0; i<keys.length; i++) { 1316 1333 if (keys[i] == e.keyCode) { 1317 1334 if (e.type == "keyup") 1318 1335 tinyMCE.triggerNodeChange(false); … … 1369 1386 if (!tinyMCE.isInstance(tinyMCE.instances[instanceName])) 1370 1387 continue; 1371 1388 1372 varinst = tinyMCE.instances[instanceName];1389 inst = tinyMCE.instances[instanceName]; 1373 1390 1374 1391 // Reset design mode if lost (on everything just in case) 1375 1392 inst.autoResetDesignMode(); … … 1403 1420 tinyMCE.instances[e.target.editorId].select(); 1404 1421 1405 1422 return false; 1406 break;1407 1423 } 1408 1424 }, 1409 1425 … … 1429 1445 // Tiled button 1430 1446 x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20); 1431 1447 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">'; 1432 h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';1448 h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" alt="{$'+lang+'}" title="{$' + lang + '}" />'; 1433 1449 h += '</a>'; 1434 1450 } else { 1435 1451 // Normal button 1436 1452 h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">'; 1437 h += '<img src="' + img + '" title="{$' + lang + '}" />';1453 h += '<img src="' + img + '" alt="{$'+lang+'}" title="{$' + lang + '}" />'; 1438 1454 h += '</a>'; 1439 1455 } 1440 1456 … … 1500 1516 this.buttonMap[a[i]] = i; 1501 1517 }, 1502 1518 1519 formSubmit : function(f, p) { 1520 var n, inst, found = false; 1521 1522 if (f.form) 1523 f = f.form; 1524 1525 // Is it a form that has a TinyMCE instance 1526 for (n in tinyMCE.instances) { 1527 inst = tinyMCE.instances[n]; 1528 1529 if (!tinyMCE.isInstance(inst)) 1530 continue; 1531 1532 if (inst.formElement) { 1533 if (f == inst.formElement.form) { 1534 found = true; 1535 inst.isNotDirty = true; 1536 } 1537 } 1538 } 1539 1540 // Is valid 1541 if (found) { 1542 tinyMCE.removeTinyMCEFormElements(f); 1543 tinyMCE.triggerSave(); 1544 } 1545 1546 // Is it patched 1547 if (f.mceOldSubmit && p) 1548 f.mceOldSubmit(); 1549 }, 1550 1503 1551 submitPatch : function() { 1504 tinyMCE.removeTinyMCEFormElements(this); 1505 tinyMCE.triggerSave(); 1506 tinyMCE.isNotDirty = true; 1507 this.mceOldSubmit(); 1552 tinyMCE.formSubmit(this, true); 1508 1553 }, 1509 1554 1510 1555 onLoad : function() { 1511 var r; 1556 var r, i, c, mode, trigger, elements, element, settings, elementId, elm; 1557 var selector, deselector, elementRefAr, form; 1512 1558 1513 1559 // Wait for everything to be loaded first 1514 1560 if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) { … … 1527 1573 // IE produces JS error if TinyMCE is placed in a frame 1528 1574 // It seems to have something to do with the selection not beeing 1529 1575 // correctly initialized in IE so this hack solves the problem 1530 if (tinyMCE.isRealIE && document.body ) {1576 if (tinyMCE.isRealIE && document.body && window.location.href != window.top.location.href) { 1531 1577 r = document.body.createTextRange(); 1532 1578 r.collapse(true); 1533 1579 r.select(); … … 1535 1581 1536 1582 tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad'); 1537 1583 1538 for ( varc=0; c<tinyMCE.configs.length; c++) {1584 for (c=0; c<tinyMCE.configs.length; c++) { 1539 1585 tinyMCE.settings = tinyMCE.configs[c]; 1540 1586 1541 varselector = tinyMCE.getParam("editor_selector");1542 vardeselector = tinyMCE.getParam("editor_deselector");1543 var elementRefAr = new Array();1587 selector = tinyMCE.getParam("editor_selector"); 1588 deselector = tinyMCE.getParam("editor_deselector"); 1589 elementRefAr = []; 1544 1590 1545 1591 // Add submit triggers 1546 if (document.forms && tinyMCE.settings ['add_form_submit_trigger']&& !tinyMCE.submitTriggers) {1547 for ( vari=0; i<document.forms.length; i++) {1548 varform = document.forms[i];1592 if (document.forms && tinyMCE.settings.add_form_submit_trigger && !tinyMCE.submitTriggers) { 1593 for (i=0; i<document.forms.length; i++) { 1594 form = document.forms[i]; 1549 1595 1550 1596 tinyMCE.addEvent(form, "submit", TinyMCE_Engine.prototype.handleEvent); 1551 1597 tinyMCE.addEvent(form, "reset", TinyMCE_Engine.prototype.handleEvent); 1552 1598 tinyMCE.submitTriggers = true; // Do it only once 1553 1599 1554 1600 // Patch the form.submit function 1555 if (tinyMCE.settings ['submit_patch']) {1601 if (tinyMCE.settings.submit_patch) { 1556 1602 try { 1557 1603 form.mceOldSubmit = form.submit; 1558 1604 form.submit = TinyMCE_Engine.prototype.submitPatch; … … 1564 1610 } 1565 1611 1566 1612 // Add editor instances based on mode 1567 var mode = tinyMCE.settings['mode'];1613 mode = tinyMCE.settings.mode; 1568 1614 switch (mode) { 1569 1615 case "exact": 1570 varelements = tinyMCE.getParam('elements', '', true, ',');1616 elements = tinyMCE.getParam('elements', '', true, ','); 1571 1617 1572 for ( vari=0; i<elements.length; i++) {1573 varelement = tinyMCE._getElementById(elements[i]);1574 var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : "";1618 for (i=0; i<elements.length; i++) { 1619 element = tinyMCE._getElementById(elements[i]); 1620 trigger = element ? element.getAttribute(tinyMCE.settings.textarea_trigger) : ""; 1575 1621 1576 1622 if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class"))) 1577 1623 continue; … … 1579 1625 if (trigger == "false") 1580 1626 continue; 1581 1627 1582 if ((tinyMCE.settings ['ask'] || tinyMCE.settings['convert_on_click']) && element) {1628 if ((tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) && element) { 1583 1629 elementRefAr[elementRefAr.length] = element; 1584 1630 continue; 1585 1631 } 1586 1632 1587 1633 if (element) 1588 1634 tinyMCE.addMCEControl(element, elements[i]); 1589 else if (tinyMCE.settings['debug'])1590 alert("Error: Could not find element by id or name: " + elements[i]);1591 1635 } 1592 1636 break; 1593 1637 1594 1638 case "specific_textareas": 1595 1639 case "textareas": 1596 var nodeList= document.getElementsByTagName("textarea");1640 elements = document.getElementsByTagName("textarea"); 1597 1641 1598 for ( var i=0; i<nodeList.length; i++) {1599 var elm = nodeList.item(i);1600 var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']);1642 for (i=0; i<elements.length; i++) { 1643 elm = elements.item(i); 1644 trigger = elm.getAttribute(tinyMCE.settings.textarea_trigger); 1601 1645 1602 if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))1646 if (selector !== '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class"))) 1603 1647 continue; 1604 1648 1605 if (selector != '')1606 trigger = selector != ""? "true" : "";1649 if (selector !== '') 1650 trigger = selector !== '' ? "true" : ""; 1607 1651 1608 1652 if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class"))) 1609 1653 continue; … … 1614 1658 break; 1615 1659 } 1616 1660 1617 for ( vari=0; i<elementRefAr.length; i++) {1618 varelement = elementRefAr[i];1619 varelementId = element.name ? element.name : element.id;1661 for (i=0; i<elementRefAr.length; i++) { 1662 element = elementRefAr[i]; 1663 elementId = element.name ? element.name : element.id; 1620 1664 1621 if (tinyMCE.settings ['ask'] || tinyMCE.settings['convert_on_click']) {1665 if (tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) { 1622 1666 // Focus breaks in Mozilla 1623 1667 if (tinyMCE.isGecko) { 1624 varsettings = tinyMCE.settings;1668 settings = tinyMCE.settings; 1625 1669 1626 1670 tinyMCE.addEvent(element, "focus", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);}); 1627 1671 … … 1629 1673 tinyMCE.addEvent(element, "click", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);}); 1630 1674 // tinyMCE.addEvent(element, "mouseover", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);}); 1631 1675 } else { 1632 varsettings = tinyMCE.settings;1676 settings = tinyMCE.settings; 1633 1677 1634 1678 tinyMCE.addEvent(element, "focus", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); }); 1635 1679 tinyMCE.addEvent(element, "click", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); }); … … 1640 1684 } 1641 1685 1642 1686 // Handle auto focus 1643 if (tinyMCE.settings ['auto_focus']) {1687 if (tinyMCE.settings.auto_focus) { 1644 1688 window.setTimeout(function () { 1645 var inst = tinyMCE.getInstanceById(tinyMCE.settings ['auto_focus']);1689 var inst = tinyMCE.getInstanceById(tinyMCE.settings.auto_focus); 1646 1690 inst.selection.selectNode(inst.getBody(), true, true); 1647 1691 inst.contentWindow.focus(); 1648 1692 }, 100); … … 1657 1701 }, 1658 1702 1659 1703 getParam : function(name, default_value, strip_whitespace, split_chr) { 1660 var value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];1704 var i, outArray, value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name]; 1661 1705 1662 1706 // Fix bool values 1663 1707 if (value == "true" || value == "false") … … 1668 1712 1669 1713 if (typeof(split_chr) != "undefined" && split_chr != null) { 1670 1714 value = value.split(split_chr); 1671 var outArray = new Array();1715 outArray = []; 1672 1716 1673 for ( vari=0; i<value.length; i++) {1674 if (value[i] && value[i] != "")1717 for (i=0; i<value.length; i++) { 1718 if (value[i] && value[i] !== '') 1675 1719 outArray[outArray.length] = value[i]; 1676 1720 } 1677 1721 … … 1700 1744 1701 1745 e.innerHTML = s; 1702 1746 1703 return e.firstChild.nodeValue;1747 return !e.firstChild ? s : e.firstChild.nodeValue; 1704 1748 }, 1705 1749 1706 1750 addToLang : function(prefix, ar) { 1707 for (var key in ar) { 1708 if (typeof(ar[key]) == 'function') 1751 var k; 1752 1753 for (k in ar) { 1754 if (typeof(ar[k]) == 'function') 1709 1755 continue; 1710 1756 1711 tinyMCELang[(k ey.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];1757 tinyMCELang[(k.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix !== '' ? (prefix + "_") : '') + k] = ar[k]; 1712 1758 } 1713 1759 1714 1760 this.loadNextScript(); 1715 1716 // for (var key in ar)1717 // tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";1718 1761 }, 1719 1762 1720 1763 triggerNodeChange : function(focus, setup_content) { … … 1743 1786 if (tinyMCE.selectedElement) 1744 1787 anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0); 1745 1788 1746 if (tinyMCE.settings ['custom_undo_redo']) {1789 if (tinyMCE.settings.custom_undo_redo) { 1747 1790 undoIndex = inst.undoRedo.undoIndex; 1748 1791 undoLevels = inst.undoRedo.undoLevels.length; 1749 1792 } … … 1756 1799 }, 1757 1800 1758 1801 _customCleanup : function(inst, type, content) { 1759 var pl, po, i ;1802 var pl, po, i, customCleanup; 1760 1803 1761 1804 // Call custom cleanup 1762 var customCleanup = tinyMCE.settings['cleanup_callback'];1763 if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")1764 content = eval(customCleanup + "(type, content, inst);");1805 customCleanup = tinyMCE.settings.cleanup_callback; 1806 if (customCleanup != '') 1807 content = tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback, window)(type, content, inst); 1765 1808 1766 1809 // Trigger theme cleanup 1767 po = tinyMCE.themes[tinyMCE.settings ['theme']];1810 po = tinyMCE.themes[tinyMCE.settings.theme]; 1768 1811 if (po && po.cleanup) 1769 1812 content = po.cleanup(type, content, inst); 1770 1813 … … 1789 1832 1790 1833 importThemeLanguagePack : function(name) { 1791 1834 if (typeof(name) == "undefined") 1792 name = tinyMCE.settings ['theme'];1835 name = tinyMCE.settings.theme; 1793 1836 1794 tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings ['language']+ '.js');1837 tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings.language + '.js'); 1795 1838 }, 1796 1839 1797 1840 importPluginLanguagePack : function(name) { … … 1800 1843 if (this.plugins[name]) 1801 1844 b = this.plugins[name].baseURL; 1802 1845 1803 tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings ['language']+ '.js');1846 tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings.language + '.js'); 1804 1847 }, 1805 1848 1806 applyTemplate : function(h, a s) {1849 applyTemplate : function(h, ag) { 1807 1850 return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) { 1808 1851 if (s.indexOf('lang_') == 0 && tinyMCELang[s]) 1809 1852 return tinyMCELang[s]; 1810 1853 1811 if (a s && as[s])1812 return a s[s];1854 if (ag && ag[s]) 1855 return ag[s]; 1813 1856 1814 1857 if (tinyMCE.settings[s]) 1815 1858 return tinyMCE.settings[s]; … … 1826 1869 }, 1827 1870 1828 1871 openWindow : function(template, args) { 1829 var html, width, height, x, y, resizable, scrollbars, url ;1872 var html, width, height, x, y, resizable, scrollbars, url, name, win, modal, features; 1830 1873 1831 1874 args = !args ? {} : args; 1832 1875 1833 args ['mce_template_file'] = template['file'];1834 args ['mce_width'] = template['width'];1835 args ['mce_height'] = template['height'];1876 args.mce_template_file = template.file; 1877 args.mce_width = template.width; 1878 args.mce_height = template.height; 1836 1879 tinyMCE.windowArgs = args; 1837 1880 1838 html = template ['html'];1839 if (!(width = parseInt(template ['width'])))1881 html = template.html; 1882 if (!(width = parseInt(template.width))) 1840 1883 width = 320; 1841 1884 1842 if (!(height = parseInt(template ['height'])))1885 if (!(height = parseInt(template.height))) 1843 1886 height = 200; 1844 1887 1845 1888 // Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!! … … 1851 1894 x = parseInt(screen.width / 2.0) - (width / 2.0); 1852 1895 y = parseInt(screen.height / 2.0) - (height / 2.0); 1853 1896 1854 resizable = (args && args ['resizable']) ? args['resizable']: "no";1855 scrollbars = (args && args ['scrollbars']) ? args['scrollbars']: "no";1897 resizable = (args && args.resizable) ? args.resizable : "no"; 1898 scrollbars = (args && args.scrollbars) ? args.scrollbars : "no"; 1856 1899 1857 if (template ['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)1858 url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template ['file'];1900 if (template.file.charAt(0) != '/' && template.file.indexOf('://') == -1) 1901 url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template.file; 1859 1902 else 1860 url = template ['file'];1903 url = template.file; 1861 1904 1862 1905 // Replace all args as variables in URL 1863 for ( varname in args) {1906 for (name in args) { 1864 1907 if (typeof(args[name]) == 'function') 1865 1908 continue; 1866 1909 … … 1868 1911 } 1869 1912 1870 1913 if (html) { 1871 html = tinyMCE.replaceVar(html, "css", this.settings ['popups_css']);1914 html = tinyMCE.replaceVar(html, "css", this.settings.popups_css); 1872 1915 html = tinyMCE.applyTemplate(html, args); 1873 1916 1874 varwin = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable);1917 win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable); 1875 1918 if (win == null) { 1876 alert(tinyMCELang ['lang_popup_blocked']);1919 alert(tinyMCELang.lang_popup_blocked); 1877 1920 return; 1878 1921 } 1879 1922 … … 1882 1925 win.resizeTo(width, height); 1883 1926 win.focus(); 1884 1927 } else { 1885 if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings ["dialog_type"]== "modal") {1928 if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings.dialog_type == "modal") { 1886 1929 height += 10; 1887 1930 1888 var features = "resizable:" + resizable 1889 + ";scroll:" 1890 + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" 1891 + width + "px;dialogHeight:" + height + "px;"; 1931 features = "resizable:" + resizable + ";scroll:" + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" + width + "px;dialogHeight:" + height + "px;"; 1892 1932 1893 1933 window.showModalDialog(url, window, features); 1894 1934 } else { 1895 varmodal = (resizable == "yes") ? "no" : "yes";1935 modal = (resizable == "yes") ? "no" : "yes"; 1896 1936 1897 1937 if (tinyMCE.isGecko && tinyMCE.isMac) 1898 1938 modal = "no"; 1899 1939 1900 if (template ['close_previous']!= "no")1940 if (template.close_previous != "no") 1901 1941 try {tinyMCE.lastWindow.close();} catch (ex) {} 1902 1942 1903 varwin = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);1943 win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable); 1904 1944 if (win == null) { 1905 alert(tinyMCELang ['lang_popup_blocked']);1945 alert(tinyMCELang.lang_popup_blocked); 1906 1946 return; 1907 1947 } 1908 1948 1909 if (template ['close_previous']!= "no")1949 if (template.close_previous != "no") 1910 1950 tinyMCE.lastWindow = win; 1911 1951 1912 eval('try { win.resizeTo(width, height); } catch(e) { }'); 1952 try { 1953 win.resizeTo(width, height); 1954 } catch(e) { 1955 // Ignore 1956 } 1913 1957 1914 1958 // Make it bigger if statusbar is forced 1915 1959 if (tinyMCE.isGecko) { … … 1927 1971 }, 1928 1972 1929 1973 getVisualAidClass : function(class_name, state) { 1930 var aidClass = tinyMCE.settings['visual_table_class'];1974 var i, classNames, ar, className, aidClass = tinyMCE.settings.visual_table_class; 1931 1975 1932 1976 if (typeof(state) == "undefined") 1933 state = tinyMCE.settings ['visual'];1977 state = tinyMCE.settings.visual; 1934 1978 1935 1979 // Split 1936 var classNames = new Array();1937 varar = class_name.split(' ');1938 for ( vari=0; i<ar.length; i++) {1980 classNames = []; 1981 ar = class_name.split(' '); 1982 for (i=0; i<ar.length; i++) { 1939 1983 if (ar[i] == aidClass) 1940 1984 ar[i] = ""; 1941 1985 1942 if (ar[i] != "")1986 if (ar[i] !== '') 1943 1987 classNames[classNames.length] = ar[i]; 1944 1988 } 1945 1989 … … 1947 1991 classNames[classNames.length] = aidClass; 1948 1992 1949 1993 // Glue 1950 varclassName = "";1951 for ( vari=0; i<classNames.length; i++) {1994 className = ""; 1995 for (i=0; i<classNames.length; i++) { 1952 1996 if (i > 0) 1953 1997 className += " "; 1954 1998 … … 1959 2003 }, 1960 2004 1961 2005 handleVisualAid : function(el, deep, state, inst, skip_dispatch) { 2006 var i, x, y, tableElement, anchorName, oldW, oldH, bo, cn; 2007 1962 2008 if (!el) 1963 2009 return; 1964 2010 1965 2011 if (!skip_dispatch) 1966 2012 tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst); 1967 2013 1968 vartableElement = null;2014 tableElement = null; 1969 2015 1970 2016 switch (el.nodeName) { 1971 2017 case "TABLE": 1972 varoldW = el.style.width;1973 varoldH = el.style.height;1974 varbo = tinyMCE.getAttrib(el, "border");2018 oldW = el.style.width; 2019 oldH = el.style.height; 2020 bo = tinyMCE.getAttrib(el, "border"); 1975 2021 1976 bo = bo == ""|| bo == "0" ? true : false;2022 bo = bo == '' || bo == "0" ? true : false; 1977 2023 1978 2024 tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo)); 1979 2025 1980 2026 el.style.width = oldW; 1981 2027 el.style.height = oldH; 1982 2028 1983 for ( vary=0; y<el.rows.length; y++) {1984 for ( varx=0; x<el.rows[y].cells.length; x++) {1985 varcn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);2029 for (y=0; y<el.rows.length; y++) { 2030 for (x=0; x<el.rows[y].cells.length; x++) { 2031 cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo); 1986 2032 tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn); 1987 2033 } 1988 2034 } … … 1990 2036 break; 1991 2037 1992 2038 case "A": 1993 varanchorName = tinyMCE.getAttrib(el, "name");2039 anchorName = tinyMCE.getAttrib(el, "name"); 1994 2040 1995 if (anchorName != '' && state) {2041 if (anchorName !== '' && state) { 1996 2042 el.title = anchorName; 1997 2043 tinyMCE.addCSSClass(el, 'mceItemAnchor'); 1998 } else if (anchorName != '' && !state)2044 } else if (anchorName !== '' && !state) 1999 2045 el.className = ''; 2000 2046 2001 2047 break; 2002 2048 } 2003 2049 2004 2050 if (deep && el.hasChildNodes()) { 2005 for ( vari=0; i<el.childNodes.length; i++)2051 for (i=0; i<el.childNodes.length; i++) 2006 2052 tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true); 2007 2053 } 2008 2054 }, 2009 2055 2010 /*2011 applyClassesToFonts : function(doc, size) {2012 var f = doc.getElementsByTagName("font");2013 for (var i=0; i<f.length; i++) {2014 var s = tinyMCE.getAttrib(f[i], "size");2015 2016 if (s != "")2017 tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);2018 }2019 2020 if (typeof(size) != "undefined") {2021 var css = "";2022 2023 for (var x=0; x<doc.styleSheets.length; x++) {2024 for (var i=0; i<doc.styleSheets[x].rules.length; i++) {2025 if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {2026 css = doc.styleSheets[x].rules[i].style.cssText;2027 break;2028 }2029 }2030 2031 if (css != "")2032 break;2033 }2034 2035 if (doc.styleSheets[0].rules[0].selectorText == "FONT")2036 doc.styleSheets[0].removeRule(0);2037 2038 doc.styleSheets[0].addRule("FONT", css, 0);2039 }2040 },2041 */2042 2043 2056 fixGeckoBaseHREFBug : function(m, e, h) { 2044 2057 var xsrc, xhref; 2045 2058 … … 2059 2072 xsrc = tinyMCE.getAttrib(n, "mce_tsrc"); 2060 2073 xhref = tinyMCE.getAttrib(n, "mce_thref"); 2061 2074 2062 if (xsrc != "") {2075 if (xsrc !== '') { 2063 2076 try { 2064 n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings ['base_href'], xsrc);2077 n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xsrc); 2065 2078 } catch (e) { 2066 2079 // Ignore, Firefox cast exception if local file wasn't found 2067 2080 } … … 2069 2082 n.removeAttribute("mce_tsrc"); 2070 2083 } 2071 2084 2072 if (xhref != "") {2085 if (xhref !== '') { 2073 2086 try { 2074 n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings ['base_href'], xhref);2087 n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xhref); 2075 2088 } catch (e) { 2076 2089 // Ignore, Firefox cast exception if local file wasn't found 2077 2090 } … … 2098 2111 }, 2099 2112 2100 2113 _setHTML : function(doc, html_content) { 2114 var i, html, paras, node; 2115 2101 2116 // Force closed anchors open 2102 2117 //html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>'); 2103 2118 … … 2112 2127 } 2113 2128 2114 2129 // Content duplication bug fix 2115 if (tinyMCE.isIE && tinyMCE.settings ['fix_content_duplication']) {2130 if (tinyMCE.isIE && tinyMCE.settings.fix_content_duplication) { 2116 2131 // Remove P elements in P elements 2117 var paras = doc.getElementsByTagName("P"); 2118 for (var i=0; i<paras.length; i++) { 2119 var node = paras[i]; 2132 paras = doc.getElementsByTagName("P"); 2133 for (i=0; i<paras.length; i++) { 2134 node = paras[i]; 2135 2120 2136 while ((node = node.parentNode) != null) { 2121 2137 if (node.nodeName == "P") 2122 2138 node.outerHTML = node.innerHTML; … … 2124 2140 } 2125 2141 2126 2142 // Content duplication bug fix (Seems to be word crap) 2127 var html = doc.body.innerHTML; 2128 /* 2129 if (html.indexOf('="mso') != -1) { 2130 for (var i=0; i<doc.body.all.length; i++) { 2131 var el = doc.body.all[i]; 2132 el.removeAttribute("className","",0); 2133 el.removeAttribute("style","",0); 2134 } 2143 html = doc.body.innerHTML; 2135 2144 2136 html = doc.body.innerHTML;2137 html = tinyMCE.regexpReplace(html, "<o:p><\/o:p>", "<br />");2138 html = tinyMCE.regexpReplace(html, "<o:p> <\/o:p>", "");2139 html = tinyMCE.regexpReplace(html, "<st1:.*?>", "");2140 html = tinyMCE.regexpReplace(html, "<p><\/p>", "");2141 html = tinyMCE.regexpReplace(html, "<p><\/p>\r\n<p><\/p>", "");2142 html = tinyMCE.regexpReplace(html, "<p> <\/p>", "<br />");2143 html = tinyMCE.regexpReplace(html, "<p>\s*(<p>\s*)?", "<p>");2144 html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "</p>");2145 }*/2146 2147 2145 // Always set the htmlText output 2148 2146 tinyMCE.setInnerHTML(doc.body, html); 2149 2147 } … … 2156 2154 2157 2155 getEditorId : function(form_element) { 2158 2156 var inst = this.getInstanceById(form_element); 2157 2159 2158 if (!inst) 2160 2159 return null; 2161 2160 … … 2163 2162 }, 2164 2163 2165 2164 getInstanceById : function(editor_id) { 2166 var inst = this.instances[editor_id]; 2165 var inst = this.instances[editor_id], n; 2166 2167 2167 if (!inst) { 2168 for (var n in tinyMCE.instances) { 2169 var instance = tinyMCE.instances[n]; 2170 if (!tinyMCE.isInstance(instance)) 2168 for (n in tinyMCE.instances) { 2169 inst = tinyMCE.instances[n]; 2170 2171 if (!tinyMCE.isInstance(inst)) 2171 2172 continue; 2172 2173 2173 if (instance.formTargetElementId == editor_id) { 2174 inst = instance; 2175 break; 2176 } 2174 if (inst.formTargetElementId == editor_id) 2175 return inst; 2177 2176 } 2178 } 2177 } else 2178 return inst; 2179 2179 2180 return inst;2180 return null; 2181 2181 }, 2182 2182 2183 2183 queryInstanceCommandValue : function(editor_id, command) { 2184 2184 var inst = tinyMCE.getInstanceById(editor_id); 2185 2185 2186 if (inst) 2186 2187 return inst.queryCommandValue(command); 2187 2188 … … 2190 2191 2191 2192 queryInstanceCommandState : function(editor_id, command) { 2192 2193 var inst = tinyMCE.getInstanceById(editor_id); 2194 2193 2195 if (inst) 2194 2196 return inst.queryCommandState(command); 2195 2197 … … 2205 2207 }, 2206 2208 2207 2209 getCSSClasses : function(editor_id, doc) { 2208 var inst = tinyMCE.getInstanceById(editor_id); 2210 var i, c, x, rule, styles, rules, csses, selectorText, inst = tinyMCE.getInstanceById(editor_id); 2211 var cssClass, addClass, p; 2209 2212 2213 if (!inst) 2214 inst = tinyMCE.selectedInstance; 2215 2216 if (!inst) 2217 return []; 2218 2219 if (!doc) 2220 doc = inst.getDoc(); 2221 2210 2222 // Is cached, use that 2211 2223 if (inst && inst.cssClasses.length > 0) 2212 2224 return inst.cssClasses; 2213 2225 2214 if ( typeof(editor_id) == "undefined" && typeof(doc) == "undefined") {2215 var instance;2226 if (!doc) 2227 return; 2216 2228 2217 for (var instanceName in tinyMCE.instances) { 2218 instance = tinyMCE.instances[instanceName]; 2219 if (!tinyMCE.isInstance(instance)) 2220 continue; 2229 styles = doc.styleSheets; 2221 2230 2222 break; 2223 } 2231 if (styles && styles.length > 0) { 2232 for (x=0; x<styles.length; x++) { 2233 csses = null; 2224 2234 2225 doc = instance.getDoc(); 2226 } 2235 try { 2236 csses = tinyMCE.isIE ? doc.styleSheets(x).rules : styles[x].cssRules; 2237 } catch(e) { 2238 // Just ignore any errors I know this is ugly!! 2239 } 2240 2241 if (!csses) 2242 return []; 2227 2243 2228 if (typeof(doc) == "undefined") { 2229 var instance = tinyMCE.getInstanceById(editor_id); 2230 doc = instance.getDoc(); 2231 } 2244 for (i=0; i<csses.length; i++) { 2245 selectorText = csses[i].selectorText; 2232 2246 2233 if (doc) { 2234 var styles = doc.styleSheets; 2247 // Can be multiple rules per selector 2248 if (selectorText) { 2249 rules = selectorText.split(','); 2250 for (c=0; c<rules.length; c++) { 2251 rule = rules[c]; 2235 2252 2236 if (styles && styles.length > 0) {2237 for (var x=0; x<styles.length; x++) {2238 var csses = null;2253 // Strip spaces between selectors 2254 while (rule.indexOf(' ') == 0) 2255 rule = rule.substring(1); 2239 2256 2240 // Just ignore any errors 2241 eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}"); 2242 if (!csses) 2243 return new Array(); 2257 // Invalid rule 2258 if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1) 2259 continue; 2244 2260 2245 for (var i=0; i<csses.length; i++) {2246 var selectorText = csses[i].selectorText;2261 if (rule.indexOf(tinyMCE.settings.visual_table_class) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1) 2262 continue; 2247 2263 2248 // Can be multiple rules per selector 2249 if (selectorText) { 2250 var rules = selectorText.split(','); 2251 for (var c=0; c<rules.length; c++) { 2252 var rule = rules[c]; 2264 // Is class rule 2265 if (rule.indexOf('.') != -1) { 2266 cssClass = rule.substring(rule.indexOf('.') + 1); 2267 addClass = true; 2253 2268 2254 // Strip spaces between selectors 2255 while (rule.indexOf(' ') == 0) 2256 rule = rule.substring(1); 2269 for (p=0; p<inst.cssClasses.length && addClass; p++) { 2270 if (inst.cssClasses[p] == cssClass) 2271 addClass = false; 2272 } 2257 2273 2258 // Invalid rule 2259 if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1) 2260 continue; 2261 2262 if (rule.indexOf(tinyMCE.settings['visual_table_class']) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1) 2263 continue; 2264 2265 // Is class rule 2266 if (rule.indexOf('.') != -1) { 2267 var cssClass = rule.substring(rule.indexOf('.') + 1); 2268 var addClass = true; 2269 2270 for (var p=0; p<inst.cssClasses.length && addClass; p++) { 2271 if (inst.cssClasses[p] == cssClass) 2272 addClass = false; 2273 } 2274 2275 if (addClass) 2276 inst.cssClasses[inst.cssClasses.length] = cssClass; 2277 } 2274 if (addClass) 2275 inst.cssClasses[inst.cssClasses.length] = cssClass; 2278 2276 } 2279 2277 } 2280 2278 } … … 2286 2284 }, 2287 2285 2288 2286 regexpReplace : function(in_str, reg_exp, replace_str, opts) { 2287 var re; 2288 2289 2289 if (in_str == null) 2290 2290 return in_str; 2291 2291 2292 2292 if (typeof(opts) == "undefined") 2293 2293 opts = 'g'; 2294 2294 2295 var re = new RegExp(reg_exp, opts); 2295 re = new RegExp(reg_exp, opts); 2296 2296 2297 return in_str.replace(re, replace_str); 2297 2298 }, 2298 2299 … … 2316 2317 for (n in l) { 2317 2318 o = l[n]; 2318 2319 2319 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') {2320 if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') { 2320 2321 if (rtl) 2321 2322 return '<span dir="rtl">' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '</span>'; 2322 2323 … … 2324 2325 } 2325 2326 } 2326 2327 2327 o = tinyMCE.themes[tinyMCE.settings ['theme']];2328 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') {2328 o = tinyMCE.themes[tinyMCE.settings.theme]; 2329 if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') { 2329 2330 if (rtl) 2330 2331 return '<span dir="rtl">' + v + '</span>'; 2331 2332 … … 2361 2362 2362 2363 l = tinyMCE.getParam(p, ''); 2363 2364 2364 if (l != '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0)2365 if (l !== '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0) 2365 2366 return true; 2366 2367 2367 2368 if (ins != null) { … … 2384 2385 return false; 2385 2386 }, 2386 2387 2387 xmlEncode : function(s, skip_apos) { 2388 return s ? ('' + s).replace(!skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe, function (c, b) { 2388 resolveDots : function(s, o) { 2389 var i; 2390 2391 if (typeof(s) == 'string') { 2392 for (i=0, s=s.split('.'); i<s.length; i++) 2393 o = o[s[i]]; 2394 } else 2395 o = s; 2396 2397 return o; 2398 }, 2399 2400 xmlEncode : function(s) { 2401 return s ? ('' + s).replace(this.xmlEncodeRe, function (c, b) { 2389 2402 switch (c) { 2390 2403 case '&': 2391 2404 return '&'; … … 2393 2406 case '"': 2394 2407 return '"'; 2395 2408 2396 case '\'':2397 return '''; // ' is not working in MSIE2398 2399 2409 case '<': 2400 2410 return '<'; 2401 2411 … … 2407 2417 }) : s; 2408 2418 }, 2409 2419 2420 add : function(c, m) { 2421 var n; 2422 2423 for (n in m) 2424 c.prototype[n] = m[n]; 2425 }, 2426 2410 2427 extend : function(p, np) { 2411 var o = {} ;2428 var o = {}, n; 2412 2429 2413 2430 o.parent = p; 2414 2431 … … 2445 2462 /* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */ 2446 2463 2447 2464 function TinyMCE_Control(settings) { 2448 var t, i, to , fu, p, x, fn, fu, pn, s = settings;2465 var t, i, tos, fu, p, x, fn, fu, pn, s = settings; 2449 2466 2450 2467 this.undoRedoLevel = true; 2451 2468 this.isTinyMCE_Control = true; 2452 2469 2453 2470 // Default settings 2471 this.enabled = true; 2454 2472 this.settings = s; 2455 this.settings ['theme']= tinyMCE.getParam("theme", "default");2456 this.settings ['width']= tinyMCE.getParam("width", -1);2457 this.settings ['height']= tinyMCE.getParam("height", -1);2473 this.settings.theme = tinyMCE.getParam("theme", "default"); 2474 this.settings.width = tinyMCE.getParam("width", -1); 2475 this.settings.height = tinyMCE.getParam("height", -1); 2458 2476 this.selection = new TinyMCE_Selection(this); 2459 2477 this.undoRedo = new TinyMCE_UndoRedo(this); 2460 2478 this.cleanup = new TinyMCE_Cleanup(); 2461 this.shortcuts = new Array();2479 this.shortcuts = []; 2462 2480 this.hasMouseMoved = false; 2463 2481 this.foreColor = this.backColor = "#999999"; 2464 2482 this.data = {}; … … 2479 2497 }); 2480 2498 2481 2499 // Wrap old theme 2482 t = this.settings ['theme'];2500 t = this.settings.theme; 2483 2501 if (!tinyMCE.hasTheme(t)) { 2484 2502 fn = tinyMCE.callbacks; 2485 to = {};2503 tos = {}; 2486 2504 2487 2505 for (i=0; i<fn.length; i++) { 2488 2506 if ((fu = window['TinyMCE_' + t + "_" + fn[i]])) 2489 to [fn[i]] = fu;2507 tos[fn[i]] = fu; 2490 2508 } 2491 2509 2492 tinyMCE.addTheme(t, to );2510 tinyMCE.addTheme(t, tos); 2493 2511 } 2494 2512 2495 2513 // Wrap old plugins 2496 this.plugins = new Array();2514 this.plugins = []; 2497 2515 p = tinyMCE.getParam('plugins', '', true, ','); 2498 2516 if (p.length > 0) { 2499 2517 for (i=0; i<p.length; i++) { … … 2504 2522 2505 2523 if (!tinyMCE.hasPlugin(pn)) { 2506 2524 fn = tinyMCE.callbacks; 2507 to = {};2525 tos = {}; 2508 2526 2509 2527 for (x=0; x<fn.length; x++) { 2510 2528 if ((fu = window['TinyMCE_' + pn + "_" + fn[x]])) 2511 to [fn[x]] = fu;2529 tos[fn[x]] = fu; 2512 2530 } 2513 2531 2514 tinyMCE.addPlugin(pn, to );2532 tinyMCE.addPlugin(pn, tos); 2515 2533 } 2516 2534 2517 2535 this.plugins[this.plugins.length] = pn; … … 2573 2591 }, 2574 2592 2575 2593 switchSettings : function() { 2576 if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings ['index']) {2594 if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings.index) { 2577 2595 tinyMCE.settings = this.settings; 2578 tinyMCE.currentConfig = this.settings ['index'];2596 tinyMCE.currentConfig = this.settings.index; 2579 2597 } 2580 2598 }, 2581 2599 … … 2709 2727 2710 2728 isDirty : function() { 2711 2729 // Is content modified and not in a submit procedure 2712 return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !t inyMCE.isNotDirty;2730 return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !this.isNotDirty; 2713 2731 }, 2714 2732 2715 2733 _mergeElements : function(scmd, pa, ch, override) { 2734 var st, stc, className, n; 2735 2716 2736 if (scmd == "removeformat") { 2717 2737 pa.className = ""; 2718 2738 pa.style.cssText = ""; … … 2721 2741 return; 2722 2742 } 2723 2743 2724 varst = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));2725 varstc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));2726 varclassName = tinyMCE.getAttrib(pa, "class");2744 st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style")); 2745 stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style")); 2746 className = tinyMCE.getAttrib(pa, "class"); 2727 2747 2728 2748 // Removed class adding due to bug #1478272 2729 2749 className = tinyMCE.getAttrib(ch, "class"); 2730 2750 2731 2751 if (override) { 2732 for ( varn in st) {2752 for (n in st) { 2733 2753 if (typeof(st[n]) == 'function') 2734 2754 continue; 2735 2755 2736 2756 stc[n] = st[n]; 2737 2757 } 2738 2758 } else { 2739 for ( varn in stc) {2759 for (n in stc) { 2740 2760 if (typeof(stc[n]) == 'function') 2741 2761 continue; 2742 2762 … … 2752 2772 ch.removeAttribute("style"); 2753 2773 }, 2754 2774 2775 _fixRootBlocks : function() { 2776 var rb, b, ne, be, nx, bm; 2777 2778 rb = tinyMCE.getParam('forced_root_block'); 2779 if (!rb) 2780 return; 2781 2782 b = this.getBody(); 2783 ne = b.firstChild; 2784 2785 while (ne) { 2786 nx = ne.nextSibling; 2787 2788 // If text node or inline element wrap it in a block element 2789 if (ne.nodeType == 3 || !tinyMCE.blockRegExp.test(ne.nodeName)) { 2790 if (!bm) 2791 bm = this.selection.getBookmark(); 2792 2793 if (!be) { 2794 be = this.getDoc().createElement(rb); 2795 be.appendChild(ne.cloneNode(true)); 2796 b.replaceChild(be, ne); 2797 } else { 2798 be.appendChild(ne.cloneNode(true)); 2799 b.removeChild(ne); 2800 } 2801 } else 2802 be = null; 2803 2804 ne = nx; 2805 } 2806 2807 if (bm) 2808 this.selection.moveToBookmark(bm); 2809 }, 2810 2811 _fixTrailingNbsp : function() { 2812 var s = this.selection, e = s.getFocusElement(), bm, v; 2813 2814 if (e && tinyMCE.blockRegExp.test(e.nodeName) && e.firstChild) { 2815 v = e.firstChild.nodeValue; 2816 2817 if (v && v.length > 1 && /(^\u00a0|\u00a0$)/.test(v)) { 2818 e.firstChild.nodeValue = v.replace(/(^\u00a0|\u00a0$)/, ''); 2819 s.selectNode(e.firstChild, true, false, false); // Select and collapse 2820 } 2821 } 2822 }, 2823 2755 2824 _setUseCSS : function(b) { 2756 2825 var d = this.getDoc(); 2757 2826 … … 2766 2835 }, 2767 2836 2768 2837 execCommand : function(command, user_interface, value) { 2769 var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();2838 var i, x, z, align, img, div, doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); 2770 2839 2771 2840 // Is not a undo specific command 2772 2841 if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) … … 2789 2858 2790 2859 // Fix align on images 2791 2860 if (focusElm && focusElm.nodeName == "IMG") { 2792 varalign = focusElm.getAttribute('align');2793 varimg = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;2861 align = focusElm.getAttribute('align'); 2862 img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm; 2794 2863 2795 2864 switch (command) { 2796 2865 case "JustifyLeft": … … 2800 2869 img.setAttribute('align', 'left'); 2801 2870 2802 2871 // Remove the div 2803 vardiv = focusElm.parentNode;2872 div = focusElm.parentNode; 2804 2873 if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) 2805 2874 div.parentNode.replaceChild(img, div); 2806 2875 … … 2813 2882 img.removeAttribute('align'); 2814 2883 2815 2884 // Is centered 2816 vardiv = tinyMCE.getParentElement(focusElm, "div");2885 div = tinyMCE.getParentElement(focusElm, "div"); 2817 2886 if (div && div.style.textAlign == "center") { 2818 2887 // Remove div 2819 2888 if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) 2820 2889 div.parentNode.replaceChild(img, div); 2821 2890 } else { 2822 2891 // Add div 2823 vardiv = this.getDoc().createElement("div");2892 div = this.getDoc().createElement("div"); 2824 2893 div.style.textAlign = 'center'; 2825 2894 div.appendChild(img); 2826 2895 focusElm.parentNode.replaceChild(div, focusElm); … … 2838 2907 img.setAttribute('align', 'right'); 2839 2908 2840 2909 // Remove the div 2841 vardiv = focusElm.parentNode;2910 div = focusElm.parentNode; 2842 2911 if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) 2843 2912 div.parentNode.replaceChild(img, div); 2844 2913 … … 2849 2918 } 2850 2919 } 2851 2920 2852 if (tinyMCE.settings ['force_br_newlines']) {2921 if (tinyMCE.settings.force_br_newlines) { 2853 2922 var alignValue = ""; 2854 2923 2855 2924 if (doc.selection.type != "Control") { … … 2871 2940 break; 2872 2941 } 2873 2942 2874 if (alignValue != "") {2943 if (alignValue !== '') { 2875 2944 var rng = doc.selection.createRange(); 2876 2945 2877 2946 if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null) … … 2925 2994 break; 2926 2995 2927 2996 case "FormatBlock": 2928 if (value == null || value == "") {2997 if (value == null || value == '') { 2929 2998 var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"); 2930 2999 2931 3000 if (elm) … … 2970 3039 2971 3040 case "mceSelectNodeDepth": 2972 3041 var parentNode = this.getFocusElement(); 2973 for ( vari=0; parentNode; i++) {3042 for (i=0; parentNode; i++) { 2974 3043 if (parentNode.nodeName.toLowerCase() == "body") 2975 3044 break; 2976 3045 … … 2996 3065 case "SetStyleInfo": 2997 3066 var rng = this.getRng(); 2998 3067 var sel = this.getSel(); 2999 var scmd = value ['command'];3000 var sname = value ['name'];3001 var svalue = value ['value'] == null ? '' : value['value'];3068 var scmd = value.command; 3069 var sname = value.name; 3070 var svalue = value.value == null ? '' : value.value; 3002 3071 //var svalue = value['value'] == null ? '' : value['value']; 3003 var wrapper = value ['wrapper'] ? value['wrapper']: "span";3072 var wrapper = value.wrapper ? value.wrapper : "span"; 3004 3073 var parentElm = null; 3005 3074 var invalidRe = new RegExp("^BODY|HTML$", "g"); 3006 var invalidParentsRe = tinyMCE.settings ['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;3075 var invalidParentsRe = tinyMCE.settings.merge_styles_invalid_parents !== '' ? new RegExp(tinyMCE.settings.merge_styles_invalid_parents, "gi") : null; 3007 3076 3008 3077 // Whole element selected check 3009 3078 if (tinyMCE.isIE) { … … 3022 3091 } 3023 3092 } else { 3024 3093 var felm = this.getFocusElement(); 3025 if (sel.isCollapsed || (new RegExp('td|tr|tbody|table ', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode))3094 if (sel.isCollapsed || (new RegExp('td|tr|tbody|table|img', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode)) 3026 3095 parentElm = felm; 3027 3096 } 3028 3097 … … 3040 3109 } 3041 3110 3042 3111 // Remove style/attribs from all children 3043 var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);3044 for ( varz=0; z<ch.length; z++) {3112 var ch = tinyMCE.getNodeTree(parentElm, [], 1); 3113 for (z=0; z<ch.length; z++) { 3045 3114 if (ch[z] == parentElm) 3046 3115 continue; 3047 3116 … … 3062 3131 var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#"); 3063 3132 3064 3133 // Change them all 3065 for ( varx=0; x<elementArray.length; x++) {3134 for (x=0; x<elementArray.length; x++) { 3066 3135 elm = elementArray[x]; 3067 3136 if (elm) { 3068 3137 var spanElm = doc.createElement(wrapper); … … 3079 3148 } 3080 3149 3081 3150 if (elm.hasChildNodes()) { 3082 for ( vari=0; i<elm.childNodes.length; i++)3151 for (i=0; i<elm.childNodes.length; i++) 3083 3152 spanElm.appendChild(elm.childNodes[i].cloneNode(true)); 3084 3153 } 3085 3154 … … 3087 3156 elm.parentNode.replaceChild(spanElm, elm); 3088 3157 3089 3158 // Remove style/attribs from all children 3090 var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);3091 for ( varz=0; z<ch.length; z++) {3159 var ch = tinyMCE.getNodeTree(spanElm, [], 1); 3160 for (z=0; z<ch.length; z++) { 3092 3161 if (ch[z] == spanElm) 3093 3162 continue; 3094 3163 … … 3109 3178 3110 3179 // Cleaup wrappers 3111 3180 var nodes = doc.getElementsByTagName(wrapper); 3112 for ( vari=nodes.length-1; i>=0; i--) {3181 for (i=nodes.length-1; i>=0; i--) { 3113 3182 var elm = nodes[i]; 3114 3183 var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true"; 3115 3184 … … 3132 3201 3133 3202 // Remove empty wrappers 3134 3203 var nodes = doc.getElementsByTagName(wrapper); 3135 for (var i=nodes.length-1; i>=0; i--) { 3136 var elm = nodes[i]; 3137 var isEmpty = true; 3204 for (i=nodes.length-1; i>=0; i--) { 3205 var elm = nodes[i], isEmpty = true; 3138 3206 3139 3207 // Check if it has any attribs 3140 3208 var tmp = doc.createElement("body"); … … 3144 3212 tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), ''); 3145 3213 //tinyMCE.debug(tmp.innerHTML); 3146 3214 if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) { 3147 for ( varx=0; x<elm.childNodes.length; x++) {3215 for (x=0; x<elm.childNodes.length; x++) { 3148 3216 if (elm.parentNode != null) 3149 3217 elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm); 3150 3218 } … … 3269 3337 3270 3338 tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this); 3271 3339 tinyMCE._setEventsEnabled(this.getBody(), false); 3340 this._addBogusBR(); 3341 3272 3342 return true; 3273 3343 3274 3344 case "mceCleanup": … … 3283 3353 3284 3354 tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this); 3285 3355 tinyMCE._setEventsEnabled(this.getBody(), false); 3356 this._addBogusBR(); 3286 3357 this.repaint(); 3287 3358 this.selection.moveToBookmark(b); 3288 3359 tinyMCE.triggerNodeChange(); … … 3308 3379 tinyMCE.execCommand('mceInsertContent', false, value); 3309 3380 } 3310 3381 3382 this._addBogusBR(); 3311 3383 tinyMCE.triggerNodeChange(); 3312 3384 break; 3313 3385 3314 3386 case "mceSetAttribute": 3315 3387 if (typeof(value) == 'object') { 3316 var targetElms = (typeof(value ['targets']) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value['targets'];3388 var targetElms = (typeof(value.targets) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value.targets; 3317 3389 var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms); 3318 3390 3319 3391 if (targetNode) { 3320 targetNode.setAttribute(value ['name'], value['value']);3392 targetNode.setAttribute(value.name, value.value); 3321 3393 tinyMCE.triggerNodeChange(); 3322 3394 } 3323 3395 } … … 3412 3484 value = rng.createContextualFragment(value); 3413 3485 } else { 3414 3486 // Setup text node 3415 var el = document.createElement("div"); 3416 el.innerHTML = value; 3417 value = el.firstChild.nodeValue; 3418 value = doc.createTextNode(value); 3487 value = doc.createTextNode(tinyMCE.entityDecode(value)); 3419 3488 } 3420 3489 3421 3490 // Insert plain text in Safari … … 3485 3554 break; 3486 3555 3487 3556 case "mceStartTyping": 3488 if (tinyMCE.settings ['custom_undo_redo']&& this.undoRedo.typingUndoIndex == -1) {3557 if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex == -1) { 3489 3558 this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex; 3490 3559 tinyMCE.typingUndoIndex = tinyMCE.undoIndex; 3491 3560 this.execCommand('mceAddUndoLevel'); … … 3493 3562 break; 3494 3563 3495 3564 case "mceEndTyping": 3496 if (tinyMCE.settings ['custom_undo_redo']&& this.undoRedo.typingUndoIndex != -1) {3565 if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex != -1) { 3497 3566 this.execCommand('mceAddUndoLevel'); 3498 3567 this.undoRedo.typingUndoIndex = -1; 3499 3568 } … … 3511 3580 break; 3512 3581 3513 3582 case "mceAddUndoLevel": 3514 if (tinyMCE.settings ['custom_undo_redo']&& this.undoRedoLevel) {3583 if (tinyMCE.settings.custom_undo_redo && this.undoRedoLevel) { 3515 3584 if (this.undoRedo.add()) 3516 3585 tinyMCE.triggerNodeChange(false); 3517 3586 } 3518 3587 break; 3519 3588 3520 3589 case "Undo": 3521 if (tinyMCE.settings ['custom_undo_redo']) {3590 if (tinyMCE.settings.custom_undo_redo) { 3522 3591 tinyMCE.execCommand("mceEndTyping"); 3523 3592 this.undoRedo.undo(); 3524 3593 tinyMCE.triggerNodeChange(); … … 3527 3596 break; 3528 3597 3529 3598 case "Redo": 3530 if (tinyMCE.settings ['custom_undo_redo']) {3599 if (tinyMCE.settings.custom_undo_redo) { 3531 3600 tinyMCE.execCommand("mceEndTyping"); 3532 3601 this.undoRedo.redo(); 3533 3602 tinyMCE.triggerNodeChange(); … … 3613 3682 return this.getDoc().queryCommandState(c); 3614 3683 }, 3615 3684 3685 _addBogusBR : function() { 3686 var b = this.getBody(); 3687 3688 if (tinyMCE.isGecko && !b.hasChildNodes()) 3689 b.innerHTML = '<br _moz_editor_bogus_node="TRUE" />'; 3690 }, 3691 3616 3692 _onAdd : function(replace_element, form_element_name, target_document) { 3617 var hc, th, to, editorTemplate; 3693 var hc, th, tos, editorTemplate, targetDoc, deltaWidth, deltaHeight, html, rng, fragment; 3694 var dynamicIFrame, tElm, doc, parentElm; 3618 3695 3619 th = this.settings ['theme'];3620 to = tinyMCE.themes[th];3696 th = this.settings.theme; 3697 tos = tinyMCE.themes[th]; 3621 3698 3622 vartargetDoc = target_document ? target_document : document;3699 targetDoc = target_document ? target_document : document; 3623 3700 3624 3701 this.targetDoc = targetDoc; 3625 3702 3626 tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings ['theme'];3627 this.settings ['themeurl']= tinyMCE.themeURL;3703 tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings.theme; 3704 this.settings.themeurl = tinyMCE.themeURL; 3628 3705 3629 3706 if (!replace_element) { 3630 3707 alert("Error: Could not find the target element."); 3631 3708 return false; 3632 3709 } 3633 3710 3634 if (to .getEditorTemplate)3635 editorTemplate = to .getEditorTemplate(this.settings, this.editorId);3711 if (tos.getEditorTemplate) 3712 editorTemplate = tos.getEditorTemplate(this.settings, this.editorId); 3636 3713 3637 var deltaWidth = editorTemplate['delta_width'] ? editorTemplate['delta_width']: 0;3638 var deltaHeight = editorTemplate['delta_height'] ? editorTemplate['delta_height']: 0;3639 var html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate['html'];3714 deltaWidth = editorTemplate.delta_width ? editorTemplate.delta_width : 0; 3715 deltaHeight = editorTemplate.delta_height ? editorTemplate.delta_height : 0; 3716 html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate.html; 3640 3717 3641 3718 html = tinyMCE.replaceVar(html, "editor_id", this.editorId); 3642 this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm";3643 3719 3644 this.settings['old_width'] = this.settings['width'];3645 this.settings['old_height'] = this.settings['height'];3720 if (!this.settings.default_document) 3721 this.settings.default_document = tinyMCE.baseURL + "/blank.htm"; 3646 3722 3723 this.settings.old_width = this.settings.width; 3724 this.settings.old_height = this.settings.height; 3725 3647 3726 // Set default width, height 3648 if (this.settings ['width']== -1)3649 this.settings ['width']= replace_element.offsetWidth;3727 if (this.settings.width == -1) 3728 this.settings.width = replace_element.offsetWidth; 3650 3729 3651 if (this.settings ['height']== -1)3652 this.settings ['height']= replace_element.offsetHeight;3730 if (this.settings.height == -1) 3731 this.settings.height = replace_element.offsetHeight; 3653 3732 3654 3733 // Try the style width 3655 if (this.settings ['width']== 0)3656 this.settings ['width']= replace_element.style.width;3734 if (this.settings.width == 0) 3735 this.settings.width = replace_element.style.width; 3657 3736 3658 3737 // Try the style height 3659 if (this.settings ['height']== 0)3660 this.settings ['height']= replace_element.style.height;3738 if (this.settings.height == 0) 3739 this.settings.height = replace_element.style.height; 3661 3740 3662 3741 // If no width/height then default to 320x240, better than nothing 3663 if (this.settings ['width']== 0)3664 this.settings ['width']= 320;3742 if (this.settings.width == 0) 3743 this.settings.width = 320; 3665 3744 3666 if (this.settings ['height']== 0)3667 this.settings ['height']= 240;3745 if (this.settings.height == 0) 3746 this.settings.height = 240; 3668 3747 3669 this.settings['area_width'] = parseInt(this.settings['width']); 3670 this.settings['area_height'] = parseInt(this.settings['height']); 3671 this.settings['area_width'] += deltaWidth; 3672 this.settings['area_height'] += deltaHeight; 3748 this.settings.area_width = parseInt(this.settings.width); 3749 this.settings.area_height = parseInt(this.settings.height); 3750 this.settings.area_width += deltaWidth; 3751 this.settings.area_height += deltaHeight; 3752 this.settings.width_style = "" + this.settings.width; 3753 this.settings.height_style = "" + this.settings.height; 3673 3754 3674 this.settings['width_style'] = "" + this.settings['width'];3675 this.settings['height_style'] = "" + this.settings['height'];3676 3677 3755 // Special % handling 3678 if (("" + this.settings ['width']).indexOf('%') != -1)3679 this.settings ['area_width']= "100%";3756 if (("" + this.settings.width).indexOf('%') != -1) 3757 this.settings.area_width = "100%"; 3680 3758 else 3681 this.settings ['width_style']+= 'px';3759 this.settings.width_style += 'px'; 3682 3760 3683 if (("" + this.settings ['height']).indexOf('%') != -1)3684 this.settings ['area_height']= "100%";3761 if (("" + this.settings.height).indexOf('%') != -1) 3762 this.settings.area_height = "100%"; 3685 3763 else 3686 this.settings ['height_style']+= 'px';3764 this.settings.height_style += 'px'; 3687 3765 3688 3766 if (("" + replace_element.style.width).indexOf('%') != -1) { 3689 this.settings ['width']= replace_element.style.width;3690 this.settings ['area_width']= "100%";3691 this.settings ['width_style']= "100%";3767 this.settings.width = replace_element.style.width; 3768 this.settings.area_width = "100%"; 3769 this.settings.width_style = "100%"; 3692 3770 } 3693 3771 3694 3772 if (("" + replace_element.style.height).indexOf('%') != -1) { 3695 this.settings ['height']= replace_element.style.height;3696 this.settings ['area_height']= "100%";3697 this.settings ['height_style']= "100%";3773 this.settings.height = replace_element.style.height; 3774 this.settings.area_height = "100%"; 3775 this.settings.height_style = "100%"; 3698 3776 } 3699 3777 3700 3778 html = tinyMCE.applyTemplate(html); 3701 3779 3702 this.settings ['width'] = this.settings['old_width'];3703 this.settings ['height'] = this.settings['old_height'];3780 this.settings.width = this.settings.old_width; 3781 this.settings.height = this.settings.old_height; 3704 3782 3705 this.visualAid = this.settings ['visual'];3783 this.visualAid = this.settings.visual; 3706 3784 this.formTargetElementId = form_element_name; 3707 3785 3708 3786 // Get replace_element contents … … 3716 3794 this.oldTargetElement = replace_element; 3717 3795 3718 3796 // Debug mode 3719 if (tinyMCE.settings['debug']) { 3720 hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>'; 3721 } else { 3722 hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; 3723 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3724 this.oldTargetElement.style.display = "none"; 3725 } 3797 hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; 3798 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3799 this.oldTargetElement.style.display = "none"; 3726 3800 3727 3801 html += '</span>'; 3728 3802 … … 3733 3807 3734 3808 // Output HTML and set editable 3735 3809 if (tinyMCE.isGecko) { 3736 varrng = replace_element.ownerDocument.createRange();3810 rng = replace_element.ownerDocument.createRange(); 3737 3811 rng.setStartBefore(replace_element); 3738 3812 3739 varfragment = rng.createContextualFragment(html);3813 fragment = rng.createContextualFragment(html); 3740 3814 tinyMCE.insertAfter(fragment, replace_element); 3741 3815 } else 3742 3816 replace_element.insertAdjacentHTML("beforeBegin", html); … … 3746 3820 // Just hide the textarea element 3747 3821 this.oldTargetElement = replace_element; 3748 3822 3749 if (!tinyMCE.settings['debug']) { 3750 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3751 this.oldTargetElement.style.display = "none"; 3752 } 3823 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3824 this.oldTargetElement.style.display = "none"; 3753 3825 3754 3826 // Output HTML and set editable 3755 3827 if (tinyMCE.isGecko) { 3756 varrng = replace_element.ownerDocument.createRange();3828 rng = replace_element.ownerDocument.createRange(); 3757 3829 rng.setStartBefore(replace_element); 3758 3830 3759 varfragment = rng.createContextualFragment(html);3831 fragment = rng.createContextualFragment(html); 3760 3832 tinyMCE.insertAfter(fragment, replace_element); 3761 3833 } else 3762 3834 replace_element.insertAdjacentHTML("beforeBegin", html); 3763 3835 } 3764 3836 3765 3837 // Setup iframe 3766 vardynamicIFrame = false;3767 vartElm = targetDoc.getElementById(this.editorId);3838 dynamicIFrame = false; 3839 tElm = targetDoc.getElementById(this.editorId); 3768 3840 3769 3841 if (!tinyMCE.isIE) { 3770 3842 // Node case is preserved in XML strict mode … … 3801 3873 } 3802 3874 3803 3875 // Setup base HTML 3804 vardoc = this.contentDocument;3876 doc = this.contentDocument; 3805 3877 if (dynamicIFrame) { 3806 var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href']+ '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';3878 html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings.base_href + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>'; 3807 3879 3808 3880 try { 3809 3881 if (!this.isHidden()) … … 3824 3896 window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); 3825 3897 3826 3898 // Setup element references 3827 varparentElm = this.targetDoc.getElementById(this.editorId + '_parent');3899 parentElm = this.targetDoc.getElementById(this.editorId + '_parent'); 3828 3900 this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling; 3829 3901 3830 3902 tinyMCE.setupContent(this.editorId, true); … … 3847 3919 b.setAttribute('href', u); 3848 3920 h.appendChild(b); 3849 3921 } else { 3850 if (u == ""|| u == null)3922 if (u == '' || u == null) 3851 3923 b.parentNode.removeChild(b); 3852 3924 else 3853 3925 b.setAttribute('href', u); … … 3886 3958 }, 3887 3959 3888 3960 triggerSave : function(skip_cleanup, skip_callback) { 3889 var e, nl = [], i, s ;3961 var e, nl = [], i, s, content, htm; 3890 3962 3963 if (!this.enabled) 3964 return; 3965 3891 3966 this.switchSettings(); 3892 3967 s = tinyMCE.settings; 3893 3968 … … 3908 3983 } while ((e = e.parentNode) != null) 3909 3984 } 3910 3985 3911 tinyMCE.settings ['preformatted']= false;3986 tinyMCE.settings.preformatted = false; 3912 3987 3913 3988 // Default to false 3914 3989 if (typeof(skip_cleanup) == "undefined") … … 3921 3996 tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML); 3922 3997 3923 3998 // Remove visual aids when cleanup is disabled 3924 if (this.settings ['cleanup']== false) {3999 if (this.settings.cleanup == false) { 3925 4000 tinyMCE.handleVisualAid(this.getBody(), true, false, this); 3926 4001 tinyMCE._setEventsEnabled(this.getBody(), true); 3927 4002 } 3928 4003 3929 4004 tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body); 3930 varhtm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);4005 htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true); 3931 4006 htm = tinyMCE._customCleanup(this, "submit_content", htm); 3932 4007 3933 if (!skip_callback && tinyMCE.settings ['save_callback'] != "")3934 var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());");4008 if (!skip_callback && tinyMCE.settings.save_callback !== '') 4009 content = tinyMCE.resolveDots(tinyMCE.settings.save_callback, window)(this.formTargetElementId,htm,this.getBody()); 3935 4010 3936 4011 // Use callback content if available 3937 4012 if ((typeof(content) != "undefined") && content != null) … … 3963 4038 3964 4039 /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */ 3965 4040 3966 TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) { 3967 s = s.replace(new RegExp('<p \\/>', 'gi'), '<p> </p>'); 3968 s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p> </p>'); 4041 tinyMCE.add(TinyMCE_Engine, { 4042 cleanupHTMLCode : function(s) { 4043 s = s.replace(new RegExp('<p \\/>', 'gi'), '<p> </p>'); 4044 s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p> </p>'); 3969 4045 3970 // Fix close BR elements3971 s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />');4046 // Fix close BR elements 4047 s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />'); 3972 4048 3973 // Open closed tags like <b/> to <b></b>3974 s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>');4049 // Open closed tags like <b/> to <b></b> 4050 s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>'); 3975 4051 3976 // Remove trailing space <b > to <b>3977 s = s.replace(new RegExp('\\s+></', 'gi'), '></');4052 // Remove trailing space <b > to <b> 4053 s = s.replace(new RegExp('\\s+></', 'gi'), '></'); 3978 4054 3979 // Close tags <img></img> to <img/>3980 s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');4055 // Close tags <img></img> to <img/> 4056 s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />'); 3981 4057 3982 // Weird MSIE bug, <p><hr /></p> breaks runtime?3983 if (tinyMCE.isIE)3984 s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");4058 // Weird MSIE bug, <p><hr /></p> breaks runtime? 4059 if (tinyMCE.isIE) 4060 s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>"); 3985 4061 3986 // Weird tags will make IE error #bug: 15384953987 if (tinyMCE.isIE)3988 s = s.replace(/<!(\s*)\/>/g, '');4062 // Weird tags will make IE error #bug: 1538495 4063 if (tinyMCE.isIE) 4064 s = s.replace(/<!(\s*)\/>/g, ''); 3989 4065 3990 // Convert relative anchors to absolute URLs ex: #something to file.htm#something3991 // Removed: Since local document anchors should never be forced absolute example edit.php?id=something3992 //if (tinyMCE.getParam('convert_urls'))3993 // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url']+ "#");4066 // Convert relative anchors to absolute URLs ex: #something to file.htm#something 4067 // Removed: Since local document anchors should never be forced absolute example edit.php?id=something 4068 //if (tinyMCE.getParam('convert_urls')) 4069 // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings.document_base_url + "#"); 3994 4070 3995 return s;3996 }; 4071 return s; 4072 }, 3997 4073 3998 TinyMCE_Engine.prototype.parseStyle =function(str) {3999 var ar = new Array();4074 parseStyle : function(str) { 4075 var ar = [], st, i, re, pa; 4000 4076 4001 if (str == null)4002 return ar;4077 if (str == null) 4078 return ar; 4003 4079 4004 varst = str.split(';');4080 st = str.split(';'); 4005 4081 4006 tinyMCE.clearArray(ar);4082 tinyMCE.clearArray(ar); 4007 4083 4008 for (vari=0; i<st.length; i++) {4009 if (st[i] == '')4010 continue;4084 for (i=0; i<st.length; i++) { 4085 if (st[i] == '') 4086 continue; 4011 4087 4012 varre = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');4013 varpa = st[i].replace(re, '$1||$2').split('||');4014 //tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));4015 if (pa.length == 2)4016 ar[pa[0].toLowerCase()] = pa[1];4017 }4088 re = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$'); 4089 pa = st[i].replace(re, '$1||$2').split('||'); 4090 //tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2')); 4091 if (pa.length == 2) 4092 ar[pa[0].toLowerCase()] = pa[1]; 4093 } 4018 4094 4019 return ar;4020 }; 4095 return ar; 4096 }, 4021 4097 4022 TinyMCE_Engine.prototype.compressStyle =function(ar, pr, sf, res) {4023 var box = new Array();4098 compressStyle : function(ar, pr, sf, res) { 4099 var box = [], i, a; 4024 4100 4025 box[0] = ar[pr + '-top' + sf];4026 box[1] = ar[pr + '-left' + sf];4027 box[2] = ar[pr + '-right' + sf];4028 box[3] = ar[pr + '-bottom' + sf];4101 box[0] = ar[pr + '-top' + sf]; 4102 box[1] = ar[pr + '-left' + sf]; 4103 box[2] = ar[pr + '-right' + sf]; 4104 box[3] = ar[pr + '-bottom' + sf]; 4029 4105 4030 for (vari=0; i<box.length; i++) {4031 if (box[i] == null)4032 return;4106 for (i=0; i<box.length; i++) { 4107 if (box[i] == null) 4108 return; 4033 4109 4034 for (var a=0; a<box.length; a++) { 4035 if (box[a] != box[i]) 4036 return; 4110 for (a=0; a<box.length; a++) { 4111 if (box[a] != box[i]) 4112 return; 4113 } 4037 4114 } 4038 }4039 4115 4040 // They are all the same4041 ar[res] = box[0];4042 ar[pr + '-top' + sf] = null;4043 ar[pr + '-left' + sf] = null;4044 ar[pr + '-right' + sf] = null;4045 ar[pr + '-bottom' + sf] = null;4046 }; 4116 // They are all the same 4117 ar[res] = box[0]; 4118 ar[pr + '-top' + sf] = null; 4119 ar[pr + '-left' + sf] = null; 4120 ar[pr + '-right' + sf] = null; 4121 ar[pr + '-bottom' + sf] = null; 4122 }, 4047 4123 4048 TinyMCE_Engine.prototype.serializeStyle =function(ar) {4049 var str = "";4124 serializeStyle : function(ar) { 4125 var str = "", key, val, m; 4050 4126 4051 // Compress box4052 tinyMCE.compressStyle(ar, "border", "", "border");4053 tinyMCE.compressStyle(ar, "border", "-width", "border-width");4054 tinyMCE.compressStyle(ar, "border", "-color", "border-color");4055 tinyMCE.compressStyle(ar, "border", "-style", "border-style");4056 tinyMCE.compressStyle(ar, "padding", "", "padding");4057 tinyMCE.compressStyle(ar, "margin", "", "margin");4127 // Compress box 4128 tinyMCE.compressStyle(ar, "border", "", "border"); 4129 tinyMCE.compressStyle(ar, "border", "-width", "border-width"); 4130 tinyMCE.compressStyle(ar, "border", "-color", "border-color"); 4131 tinyMCE.compressStyle(ar, "border", "-style", "border-style"); 4132 tinyMCE.compressStyle(ar, "padding", "", "padding"); 4133 tinyMCE.compressStyle(ar, "margin", "", "margin"); 4058 4134 4059 for (varkey in ar) {4060 varval = ar[key];4135 for (key in ar) { 4136 val = ar[key]; 4061 4137 4062 if (typeof(val) == 'function')4063 continue;4138 if (typeof(val) == 'function') 4139 continue; 4064 4140 4065 if (key.indexOf('mso-') == 0)4066 continue;4141 if (key.indexOf('mso-') == 0) 4142 continue; 4067 4143 4068 if (val != null && val != '') {4069 val = '' + val; // Force string4144 if (val != null && val !== '') { 4145 val = '' + val; // Force string 4070 4146 4071 // Fix style URL4072 val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");4147 // Fix style URL 4148 val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')"); 4073 4149 4074 // Convert URL4075 if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) {4076 varm = new RegExp("url\\('(.*?)'\\)").exec(val);4150 // Convert URL 4151 if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) { 4152 m = new RegExp("url\\('(.*?)'\\)").exec(val); 4077 4153 4078 if (m.length > 1)4079 val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')";4080 }4154 if (m.length > 1) 4155 val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')"; 4156 } 4081 4157 4082 // Force HEX colors4083 if (tinyMCE.getParam("force_hex_style_colors"))4084 val = tinyMCE.convertRGBToHex(val, true);4158 // Force HEX colors 4159 if (tinyMCE.getParam("force_hex_style_colors")) 4160 val = tinyMCE.convertRGBToHex(val, true); 4085 4161 4086 val = val.replace(/\"/g, '\'');4162 val = val.replace(/\"/g, '\''); 4087 4163 4088 if (val != "url('')") 4089 str += key.toLowerCase() + ": " + val + "; "; 4164 if (val != "url('')") 4165 str += key.toLowerCase() + ": " + val + "; "; 4166 } 4090 4167 } 4091 }4092 4168 4093 if (new RegExp('; $').test(str))4094 str = str.substring(0, str.length - 2);4169 if (new RegExp('; $').test(str)) 4170 str = str.substring(0, str.length - 2); 4095 4171 4096 return str;4097 }; 4172 return str; 4173 }, 4098 4174 4099 TinyMCE_Engine.prototype.convertRGBToHex = function(s, k) { 4100 if (s.toLowerCase().indexOf('rgb') != -1) { 4101 var re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi"); 4102 var rgb = s.replace(re, "$1,$2,$3,$4,$5").split(','); 4103 if (rgb.length == 5) { 4104 r = parseInt(rgb[1]).toString(16); 4105 g = parseInt(rgb[2]).toString(16); 4106 b = parseInt(rgb[3]).toString(16); 4175 convertRGBToHex : function(s, k) { 4176 var re, rgb; 4107 4177 4108 r = r.length == 1 ? '0' + r : r;4109 g = g.length == 1 ? '0' + g : g;4110 b = b.length == 1 ? '0' + b : b;4178 if (s.toLowerCase().indexOf('rgb') != -1) { 4179 re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi"); 4180 rgb = s.replace(re, "$1,$2,$3,$4,$5").split(','); 4111 4181 4112 s = "#" + r + g + b; 4182 if (rgb.length == 5) { 4183 r = parseInt(rgb[1]).toString(16); 4184 g = parseInt(rgb[2]).toString(16); 4185 b = parseInt(rgb[3]).toString(16); 4113 4186 4114 if (k) 4115 s = rgb[0] + s + rgb[4]; 4187 r = r.length == 1 ? '0' + r : r; 4188 g = g.length == 1 ? '0' + g : g; 4189 b = b.length == 1 ? '0' + b : b; 4190 4191 s = "#" + r + g + b; 4192 4193 if (k) 4194 s = rgb[0] + s + rgb[4]; 4195 } 4116 4196 } 4117 }4118 4197 4119 return s;4120 }; 4198 return s; 4199 }, 4121 4200 4122 TinyMCE_Engine.prototype.convertHexToRGB =function(s) {4123 if (s.indexOf('#') != -1) {4124 s = s.replace(new RegExp('[^0-9A-F]', 'gi'), '');4125 return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")";4126 }4201 convertHexToRGB : function(s) { 4202 if (s.indexOf('#') != -1) { 4203 s = s.replace(new RegExp('[^0-9A-F]', 'gi'), ''); 4204 return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")"; 4205 } 4127 4206 4128 return s;4129 }; 4207 return s; 4208 }, 4130 4209 4131 TinyMCE_Engine.prototype.convertSpansToFonts =function(doc) {4132 varsizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');4210 convertSpansToFonts : function(doc) { 4211 var s, i, size, fSize, x, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); 4133 4212 4134 /*var h = doc.body.innerHTML;4135 h = h.replace(/<span/gi, '<font');4136 h = h.replace(/<\/span/gi, '</font');4137 tinyMCE.setInnerHTML(doc.body, h);*/4213 s = tinyMCE.selectElements(doc, 'span,font'); 4214 for (i=0; i<s.length; i++) { 4215 size = tinyMCE.trim(s[i].style.fontSize).toLowerCase(); 4216 fSize = 0; 4138 4217 4139 var s = tinyMCE.selectElements(doc, 'span,font'); 4140 for (var i=0; i<s.length; i++) { 4141 var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase(); 4142 var fSize = 0; 4218 for (x=0; x<sizes.length; x++) { 4219 if (sizes[x] == size) { 4220 fSize = x + 1; 4221 break; 4222 } 4223 } 4143 4224 4144 for (var x=0; x<sizes.length; x++) { 4145 if (sizes[x] == size) { 4146 fSize = x + 1; 4147 break; 4225 if (fSize > 0) { 4226 tinyMCE.setAttrib(s[i], 'size', fSize); 4227 s[i].style.fontSize = ''; 4148 4228 } 4149 }4150 4229 4151 if (fSize > 0) { 4152 tinyMCE.setAttrib(s[i], 'size', fSize); 4153 s[i].style.fontSize = ''; 4154 } 4230 fFace = s[i].style.fontFamily; 4231 if (fFace != null && fFace !== '') { 4232 tinyMCE.setAttrib(s[i], 'face', fFace); 4233 s[i].style.fontFamily = ''; 4234 } 4155 4235 4156 var fFace = s[i].style.fontFamily; 4157 if (fFace != null && fFace != "") { 4158 tinyMCE.setAttrib(s[i], 'face', fFace); 4159 s[i].style.fontFamily = ''; 4236 fColor = s[i].style.color; 4237 if (fColor != null && fColor !== '') { 4238 tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor)); 4239 s[i].style.color = ''; 4240 } 4160 4241 } 4242 }, 4161 4243 4162 var fColor = s[i].style.color; 4163 if (fColor != null && fColor != "") { 4164 tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor)); 4165 s[i].style.color = ''; 4166 } 4167 } 4168 }; 4244 convertFontsToSpans : function(doc) { 4245 var fsClasses, s, i, fSize, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); 4169 4246 4170 TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { 4171 var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); 4247 fsClasses = tinyMCE.getParam('font_size_classes'); 4248 if (fsClasses !== '') 4249 fsClasses = fsClasses.replace(/\s+/, '').split(','); 4250 else 4251 fsClasses = null; 4172 4252 4173 /* var h = doc.body.innerHTML; 4174 h = h.replace(/<font/gi, '<span'); 4175 h = h.replace(/<\/font/gi, '</span'); 4176 tinyMCE.setInnerHTML(doc.body, h);*/ 4253 s = tinyMCE.selectElements(doc, 'span,font'); 4254 for (i=0; i<s.length; i++) { 4255 fSize = tinyMCE.getAttrib(s[i], 'size'); 4256 fFace = tinyMCE.getAttrib(s[i], 'face'); 4257 fColor = tinyMCE.getAttrib(s[i], 'color'); 4177 4258 4178 var fsClasses = tinyMCE.getParam('font_size_classes'); 4179 if (fsClasses != '') 4180 fsClasses = fsClasses.replace(/\s+/, '').split(','); 4181 else 4182 fsClasses = null; 4259 if (fSize !== '') { 4260 fSize = parseInt(fSize); 4183 4261 4184 var s = tinyMCE.selectElements(doc, 'span,font'); 4185 for (var i=0; i<s.length; i++) { 4186 var fSize, fFace, fColor; 4262 if (fSize > 0 && fSize < 8) { 4263 if (fsClasses != null) 4264 tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]); 4265 else 4266 s[i].style.fontSize = sizes[fSize-1]; 4267 } 4187 4268 4188 fSize = tinyMCE.getAttrib(s[i], 'size'); 4189 fFace = tinyMCE.getAttrib(s[i], 'face'); 4190 fColor = tinyMCE.getAttrib(s[i], 'color'); 4269 s[i].removeAttribute('size'); 4270 } 4191 4271 4192 if (fSize != "") { 4193 fSize = parseInt(fSize); 4272 if (fFace !== '') { 4273 s[i].style.fontFamily = fFace; 4274 s[i].removeAttribute('face'); 4275 } 4194 4276 4195 if (fSize > 0 && fSize < 8) { 4196 if (fsClasses != null) 4197 tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]); 4198 else 4199 s[i].style.fontSize = sizes[fSize-1]; 4277 if (fColor !== '') { 4278 s[i].style.color = fColor; 4279 s[i].removeAttribute('color'); 4200 4280 } 4201 4202 s[i].removeAttribute('size');4203 4281 } 4282 }, 4204 4283 4205 if (fFace != "") { 4206 s[i].style.fontFamily = fFace; 4207 s[i].removeAttribute('face'); 4208 } 4284 cleanupAnchors : function(doc) { 4285 var i, cn, x, an = doc.getElementsByTagName("a"); 4209 4286 4210 if (fColor != "") { 4211 s[i].style.color = fColor; 4212 s[i].removeAttribute('color'); 4213 } 4214 } 4215 }; 4287 // Loops backwards due to bug #1467987 4288 for (i=an.length-1; i>=0; i--) { 4289 if (tinyMCE.getAttrib(an[i], "name") !== '' && tinyMCE.getAttrib(an[i], "href") == '') { 4290 cn = an[i].childNodes; 4216 4291 4217 TinyMCE_Engine.prototype.cleanupAnchors = function(doc) { 4218 var i, cn, x, an = doc.getElementsByTagName("a"); 4219 4220 // Loops backwards due to bug #1467987 4221 for (i=an.length-1; i>=0; i--) { 4222 if (tinyMCE.getAttrib(an[i], "name") != "" && tinyMCE.getAttrib(an[i], "href") == "") { 4223 cn = an[i].childNodes; 4224 4225 for (x=cn.length-1; x>=0; x--) 4226 tinyMCE.insertAfter(cn[x], an[i]); 4292 for (x=cn.length-1; x>=0; x--) 4293 tinyMCE.insertAfter(cn[x], an[i]); 4294 } 4227 4295 } 4228 } 4229 }; 4296 }, 4230 4297 4231 TinyMCE_Engine.prototype.getContent =function(editor_id) {4232 if (typeof(editor_id) != "undefined")4233 tinyMCE.getInstanceById(editor_id).select();4298 getContent : function(editor_id) { 4299 if (typeof(editor_id) != "undefined") 4300 tinyMCE.getInstanceById(editor_id).select(); 4234 4301 4235 if (tinyMCE.selectedInstance)4236 return tinyMCE.selectedInstance.getHTML();4302 if (tinyMCE.selectedInstance) 4303 return tinyMCE.selectedInstance.getHTML(); 4237 4304 4238 return null;4239 }; 4305 return null; 4306 }, 4240 4307 4241 TinyMCE_Engine.prototype._fixListElements =function(d) {4242 var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np;4308 _fixListElements : function(d) { 4309 var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np; 4243 4310 4244 for (x=0; x<a.length; x++) {4245 nl = d.getElementsByTagName(a[x]);4311 for (x=0; x<a.length; x++) { 4312 nl = d.getElementsByTagName(a[x]); 4246 4313 4247 for (i=0; i<nl.length; i++) {4248 n = nl[i];4249 p = n.parentNode;4314 for (i=0; i<nl.length; i++) { 4315 n = nl[i]; 4316 p = n.parentNode; 4250 4317 4251 if (r.test(p.nodeName)) {4252 np = tinyMCE.prevNode(n, 'LI');4318 if (r.test(p.nodeName)) { 4319 np = tinyMCE.prevNode(n, 'LI'); 4253 4320 4254 if (!np) { 4255 np = d.createElement('li'); 4256 np.innerHTML = ' '; 4257 np.appendChild(n); 4258 p.insertBefore(np, p.firstChild); 4259 } else 4260 np.appendChild(n); 4321 if (!np) { 4322 np = d.createElement('li'); 4323 np.innerHTML = ' '; 4324 np.appendChild(n); 4325 p.insertBefore(np, p.firstChild); 4326 } else 4327 np.appendChild(n); 4328 } 4261 4329 } 4262 4330 } 4263 } 4264 }; 4331 }, 4265 4332 4266 TinyMCE_Engine.prototype._fixTables =function(d) {4267 var nl, i, n, p, np, x, t;4333 _fixTables : function(d) { 4334 var nl, i, n, p, np, x, t; 4268 4335 4269 nl = d.getElementsByTagName('table');4270 for (i=0; i<nl.length; i++) {4271 n = nl[i];4336 nl = d.getElementsByTagName('table'); 4337 for (i=0; i<nl.length; i++) { 4338 n = nl[i]; 4272 4339 4273 if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) {4274 np = p.cloneNode(false);4275 np.removeAttribute('id');4340 if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) { 4341 np = p.cloneNode(false); 4342 np.removeAttribute('id'); 4276 4343 4277 t = n;4344 t = n; 4278 4345 4279 while ((n = n.nextSibling))4280 np.appendChild(n);4346 while ((n = n.nextSibling)) 4347 np.appendChild(n); 4281 4348 4282 tinyMCE.insertAfter(np, p); 4283 tinyMCE.insertAfter(t, p); 4349 tinyMCE.insertAfter(np, p); 4350 tinyMCE.insertAfter(t, p); 4351 } 4284 4352 } 4285 } 4286 }; 4353 }, 4287 4354 4288 TinyMCE_Engine.prototype._cleanupHTML =function(inst, doc, config, elm, visual, on_save, on_submit, inn) {4289 var h, d, t1, t2, t3, t4, t5, c, s, nb;4355 _cleanupHTML : function(inst, doc, config, elm, visual, on_save, on_submit, inn) { 4356 var h, d, t1, t2, t3, t4, t5, c, s, nb; 4290 4357 4291 if (!tinyMCE.getParam('cleanup'))4292 return elm.innerHTML;4358 if (!tinyMCE.getParam('cleanup')) 4359 return elm.innerHTML; 4293 4360 4294 on_save = typeof(on_save) == 'undefined' ? false : on_save;4361 on_save = typeof(on_save) == 'undefined' ? false : on_save; 4295 4362 4296 c = inst.cleanup;4297 s = inst.settings;4298 d = c.settings.debug;4363 c = inst.cleanup; 4364 s = inst.settings; 4365 d = c.settings.debug; 4299 4366 4300 if (d)4301 t1 = new Date().getTime();4367 if (d) 4368 t1 = new Date().getTime(); 4302 4369 4303 if (tinyMCE.getParam("convert_fonts_to_spans")) 4304 tinyMCE.convertFontsToSpans(doc); 4370 inst._fixRootBlocks(); 4305 4371 4306 if (tinyMCE.getParam("fix_list_elements"))4307 tinyMCE._fixListElements(doc);4372 if (tinyMCE.getParam("convert_fonts_to_spans")) 4373 tinyMCE.convertFontsToSpans(doc); 4308 4374 4309 if (tinyMCE.getParam("fix_table_elements"))4310 tinyMCE._fixTables(doc);4375 if (tinyMCE.getParam("fix_list_elements")) 4376 tinyMCE._fixListElements(doc); 4311 4377 4312 // Call custom cleanup code4313 tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);4378 if (tinyMCE.getParam("fix_table_elements")) 4379 tinyMCE._fixTables(doc); 4314 4380 4315 if (d)4316 t 2 = new Date().getTime();4381 // Call custom cleanup code 4382 tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body); 4317 4383 4318 c.settings.on_save = on_save;4319 //for (var i=0; i<100; i++)4384 if (d) 4385 t2 = new Date().getTime(); 4320 4386 4321 c.idCount = 0; 4322 c.serializationId++; 4323 c.serializedNodes = new Array(); 4324 c.sourceIndex = -1; 4387 c.settings.on_save = on_save; 4325 4388 4326 if (s.cleanup_serializer == "xml")4327 h = c.serializeNodeAsXML(elm, inn);4328 else4329 h = c.serializeNodeAsHTML(elm, inn);4389 c.idCount = 0; 4390 c.serializationId = new Date().getTime().toString(32); // Unique ID needed for the content duplication bug 4391 c.serializedNodes = []; 4392 c.sourceIndex = -1; 4330 4393 4331 if (d) 4332 t3 = new Date().getTime(); 4394 if (s.cleanup_serializer == "xml") 4395 h = c.serializeNodeAsXML(elm, inn); 4396 else 4397 h = c.serializeNodeAsHTML(elm, inn); 4333 4398 4334 // Post processing 4335 nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? ' ' : ' '; 4336 h = h.replace(/<\/?(body|head|html)[^>]*>/gi, ''); 4337 h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); 4338 h = h.replace(/<p><hr \/><\/p>/g, '<hr />'); 4339 h = h.replace(/<p>( | )<\/p><hr \/><p>( | )<\/p>/g, '<hr />'); 4340 h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>'); 4341 h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4342 h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko 4343 h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko 4344 h = h.replace(/<p>\s*( | )\s*<br \/>\s*( | )\s*<\/p>/g, '<p>' + nb + '</p>'); 4345 h = h.replace(/<p>\s*( | )\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4346 h = h.replace(/<p>\s*<br \/>\s* \s*<\/p>/g, '<p>' + nb + '</p>'); 4347 h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1'); 4348 h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>'); 4399 if (d) 4400 t3 = new Date().getTime(); 4349 4401 4350 // Clean body 4351 if (/^\s*(<br \/>|<p> <\/p>|<p> <\/p>|<p><\/p>)\s*$/.test(h)) 4352 h = ''; 4402 // Post processing 4403 nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? ' ' : ' '; 4404 h = h.replace(/<\/?(body|head|html)[^>]*>/gi, ''); 4405 h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); 4406 h = h.replace(/<p><hr \/><\/p>/g, '<hr />'); 4407 h = h.replace(/<p>( | )<\/p><hr \/><p>( | )<\/p>/g, '<hr />'); 4408 h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>'); 4409 h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4410 h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko 4411 h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko 4412 h = h.replace(/<p>\s*( | )\s*<br \/>\s*( | )\s*<\/p>/g, '<p>' + nb + '</p>'); 4413 h = h.replace(/<p>\s*( | )\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>'); 4414 h = h.replace(/<p>\s*<br \/>\s* \s*<\/p>/g, '<p>' + nb + '</p>'); 4415 h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1'); 4416 h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>'); 4353 4417 4354 // If preformatted 4355 if (s.preformatted) { 4356 h = h.replace(/^<pre>/, ''); 4357 h = h.replace(/<\/pre>$/, ''); 4358 h = '<pre>' + h + '</pre>'; 4359 } 4418 // Clean body 4419 if (/^\s*(<br \/>|<p> <\/p>|<p> <\/p>|<p><\/p>)\s*$/.test(h)) 4420 h = ''; 4360 4421 4361 // Gecko specific processing 4362 if (tinyMCE.isGecko) { 4363 h = h.replace(/<o:p _moz-userdefined="" \/>/g, ''); 4364 h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>'); 4365 } 4422 // If preformatted 4423 if (s.preformatted) { 4424 h = h.replace(/^<pre>/, ''); 4425 h = h.replace(/<\/pre>$/, ''); 4426 h = '<pre>' + h + '</pre>'; 4427 } 4366 4428 4367 if (s.force_br_newlines) 4368 h = h.replace(/<p>( | )<\/p>/g, '<br />'); 4429 // Gecko specific processing 4430 if (tinyMCE.isGecko) { 4431 // Makes no sence but FF generates it!! 4432 h = h.replace(/<br \/>\s*<\/li>/g, '</li>'); 4433 h = h.replace(/ \s*<\/(dd|dt)>/g, '</$1>'); 4434 h = h.replace(/<o:p _moz-userdefined="" \/>/g, ''); 4435 h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>'); 4436 } 4369 4437 4370 // Call custom cleanup code4371 h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h);4438 if (s.force_br_newlines) 4439 h = h.replace(/<p>( | )<\/p>/g, '<br />'); 4372 4440 4373 // Remove internal classes 4374 if (on_save) { 4375 h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), ''); 4376 h = h.replace(new RegExp(' ?class=""', 'g'), ''); 4377 } 4441 // Call custom cleanup code 4442 h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h); 4378 4443 4379 if (s.remove_linebreaks && !c.settings.indent) 4380 h = h.replace(/\n|\r/g, ' '); 4444 // Remove internal classes 4445 if (on_save) { 4446 h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), ''); 4447 h = h.replace(new RegExp(' ?class=""', 'g'), ''); 4448 } 4381 4449 4382 if (d)4383 t4 = new Date().getTime();4450 if (s.remove_linebreaks && !c.settings.indent) 4451 h = h.replace(/\n|\r/g, ' '); 4384 4452 4385 if (on_save && c.settings.indent)4386 h = c.formatHTML(h);4453 if (d) 4454 t4 = new Date().getTime(); 4387 4455 4388 // If encoding (not recommended option) 4389 if (on_submit && (s.encoding == "xml" || s.encoding == "html")) 4390 h = c.xmlEncode(h); 4456 if (on_save && c.settings.indent) 4457 h = c.formatHTML(h); 4391 4458 4392 if (d) 4393 t5 = new Date().getTime(); 4459 // If encoding (not recommended option) 4460 if (on_submit && (s.encoding == "xml" || s.encoding == "html")) 4461 h = c.xmlEncode(h); 4394 4462 4395 if (c.settings.debug)4396 tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + ".");4463 if (d) 4464 t5 = new Date().getTime(); 4397 4465 4398 return h;4399 };4466 if (c.settings.debug) 4467 tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + "."); 4400 4468 4469 return h; 4470 } 4471 }); 4472 4401 4473 function TinyMCE_Cleanup() { 4402 4474 this.isIE = (navigator.appName == "Microsoft Internet Explorer"); 4403 this.rules = tinyMCE.clearArray( new Array());4475 this.rules = tinyMCE.clearArray([]); 4404 4476 4405 4477 // Default config 4406 4478 this.settings = { … … 4418 4490 verify_html : false 4419 4491 }; 4420 4492 4421 this.vElements = tinyMCE.clearArray( new Array());4493 this.vElements = tinyMCE.clearArray([]); 4422 4494 this.vElementsRe = ''; 4423 4495 this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/; 4424 4496 this.codeElementsRe = /^(SCRIPT|STYLE)$/; … … 4448 4520 this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>'); 4449 4521 this.serializedNodes = []; 4450 4522 4451 if (s.invalid_elements != '')4523 if (s.invalid_elements !== '') 4452 4524 this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$'); 4453 4525 else 4454 4526 this.iveRe = null; … … 4469 4541 this.fillStr = s.entity_encoding == "named" ? " " : " "; 4470 4542 this.idCount = 0; 4471 4543 this.xmlEncodeRe = new RegExp('[\u007F-\uFFFF<>&"]', 'g'); 4472 this.xmlEncodeAposRe = new RegExp('[\u007F-\uFFFF<>&"\']', 'g');4473 4544 }, 4474 4545 4475 4546 addRuleStr : function(s) { 4476 var r = this.parseRuleStr(s); 4477 var n; 4547 var r = this.parseRuleStr(s), n; 4478 4548 4479 4549 for (n in r) { 4480 4550 if (r[n]) 4481 4551 this.rules[n] = r[n]; 4482 4552 } 4483 4553 4484 this.vElements = tinyMCE.clearArray( new Array());4554 this.vElements = tinyMCE.clearArray([]); 4485 4555 4486 4556 for (n in this.rules) { 4487 4557 if (this.rules[n]) … … 4492 4562 }, 4493 4563 4494 4564 isValid : function(n) { 4495 this._setupRules(); // Will initialize cleanup rules 4565 if (!this.rulesDone) 4566 this._setupRules(); // Will initialize cleanup rules 4496 4567 4497 4568 // Empty is true since it removes formatting 4498 4569 if (!n) … … 4548 4619 } 4549 4620 4550 4621 r += ')$'; 4551 //tinyMCE.debug(t + "=" + r); 4622 4552 4623 if (this.childRules == null) 4553 this.childRules = tinyMCE.clearArray( new Array());4624 this.childRules = tinyMCE.clearArray([]); 4554 4625 4555 4626 this.childRules[tn[y]] = new RegExp(r); 4556 4627 … … 4561 4632 }, 4562 4633 4563 4634 parseRuleStr : function(s) { 4564 var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray( new Array()), dv;4635 var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray([]), dv; 4565 4636 4566 4637 if (s == null || s.length == 0) 4567 4638 return or; … … 4621 4692 if (av && av.length > 0) { 4622 4693 if (av[0].charAt(0) == ':') { 4623 4694 if (!r.forceAttribs) 4624 r.forceAttribs = tinyMCE.clearArray( new Array());4695 r.forceAttribs = tinyMCE.clearArray([]); 4625 4696 4626 4697 r.forceAttribs[t.toLowerCase()] = av[0].substring(1); 4627 4698 } else if (av[0].charAt(0) == '=') { 4628 4699 if (!r.defaultAttribs) 4629 r.defaultAttribs = tinyMCE.clearArray( new Array());4700 r.defaultAttribs = tinyMCE.clearArray([]); 4630 4701 4631 4702 dv = av[0].substring(1); 4632 4703 4633 r.defaultAttribs[t.toLowerCase()] = dv == ""? "mce_empty" : dv;4704 r.defaultAttribs[t.toLowerCase()] = dv == '' ? "mce_empty" : dv; 4634 4705 } else if (av[0].charAt(0) == '<') { 4635 4706 if (!r.validAttribValues) 4636 r.validAttribValues = tinyMCE.clearArray( new Array());4707 r.validAttribValues = tinyMCE.clearArray([]); 4637 4708 4638 4709 r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i'); 4639 4710 } … … 4656 4727 //tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC); 4657 4728 } else { 4658 4729 r.vAttribsRe = ''; 4659 r.vAttribs = tinyMCE.clearArray( new Array());4730 r.vAttribs = tinyMCE.clearArray([]); 4660 4731 r.vAttribsReIsWild = false; 4661 4732 } 4662 4733 … … 4745 4816 serializeNodeAsHTML : function(n, inn) { 4746 4817 var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr, nn; 4747 4818 4748 this._setupRules(); // Will initialize cleanup rules 4819 if (!this.rulesDone) 4820 this._setupRules(); // Will initialize cleanup rules 4749 4821 4750 4822 if (tinyMCE.isRealIE && this._isDuplicate(n)) 4751 4823 return ''; … … 4767 4839 if (st) 4768 4840 break; 4769 4841 4770 // MSIE sometimes produces <//tag>4771 if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1)4772 break;4773 4774 4842 nn = n.nodeName; 4775 4843 4844 if (tinyMCE.isRealIE) { 4845 // MSIE sometimes produces <//tag> 4846 if (n.nodeName.indexOf('/') != -1) 4847 break; 4848 4849 // MSIE has it's NS in a separate attrib 4850 if (n.scopeName && n.scopeName != 'HTML') 4851 nn = n.scopeName.toUpperCase() + ':' + nn.toUpperCase(); 4852 } else if (tinyMCE.isOpera && nn.indexOf(':') > 0) 4853 nn = nn.toUpperCase(); 4854 4776 4855 // Convert fonts to spans 4777 4856 if (this.settings.convert_fonts_to_spans) { 4778 4857 // On get content FONT -> SPAN … … 4959 5038 return o; 4960 5039 }, 4961 5040 4962 xmlEncode : function(s , skip_apos) {4963 var cl = this, re = !skip_apos ? this.xmlEncodeAposRe :this.xmlEncodeRe;5041 xmlEncode : function(s) { 5042 var cl = this, re = this.xmlEncodeRe; 4964 5043 4965 this._setupEntities(); // Will intialize lookup table 5044 if (!this.entitiesDone) 5045 this._setupEntities(); // Will intialize lookup table 4966 5046 4967 5047 switch (this.settings.entity_encoding) { 4968 5048 case "raw": 4969 return tinyMCE.xmlEncode(s , skip_apos);5049 return tinyMCE.xmlEncode(s); 4970 5050 4971 5051 case "named": 4972 return s.replace(re, function (c , b) {4973 b = cl.entities[c.charCodeAt(0)];5052 return s.replace(re, function (c) { 5053 var b = cl.entities[c.charCodeAt(0)]; 4974 5054 4975 5055 return b ? '&' + b + ';' : c; 4976 5056 }); 4977 5057 4978 5058 case "numeric": 4979 return s.replace(re, function (c , b) {4980 return b ? '&#' + c.charCodeAt(0) + ';' : c;5059 return s.replace(re, function (c) { 5060 return '&#' + c.charCodeAt(0) + ';'; 4981 5061 }); 4982 5062 } 4983 5063 … … 4985 5065 }, 4986 5066 4987 5067 split : function(re, s) { 4988 var c = s.split(re); 4989 var i, l, o = new Array(); 5068 var i, l, o = [], c = s.split(re); 4990 5069 4991 5070 for (i=0, l=c.length; i<l; i++) { 4992 if (c[i] != '')5071 if (c[i] !== '') 4993 5072 o[i] = c[i]; 4994 5073 } 4995 5074 … … 5038 5117 5039 5118 if (nn == "INPUT" && n == "maxlength" && v == "2147483647") 5040 5119 v = ""; 5120 5121 // Images 5122 if (n == "width" || n == "height") 5123 v = e.getAttribute(n, 2); 5041 5124 } 5042 5125 5043 5126 if (n == 'style' && v) { … … 5047 5130 v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v)); 5048 5131 } 5049 5132 5050 if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v != "")5133 if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v !== '') 5051 5134 v = tinyMCE.cleanupEventStr(v); 5052 5135 5053 return (v && v != "") ? '' + v : d;5136 return (v && v !== '') ? '' + v : d; 5054 5137 }, 5055 5138 5056 5139 _urlConverter : function(c, n, v) { … … 5095 5178 var n, a, i, s = this.settings; 5096 5179 5097 5180 // Setup entities 5098 if (!this.entitiesDone) { 5099 if (s.entity_encoding == "named") { 5100 n = tinyMCE.clearArray(new Array()); 5101 a = this.split(',', s.entities); 5102 for (i=0; i<a.length; i+=2) 5103 n[a[i]] = a[i+1]; 5181 if (s.entity_encoding == "named") { 5182 n = tinyMCE.clearArray([]); 5183 a = this.split(',', s.entities); 5184 for (i=0; i<a.length; i+=2) 5185 n[a[i]] = a[i+1]; 5104 5186 5105 this.entities = n;5106 }5187 this.entities = n; 5188 } 5107 5189 5108 this.entitiesDone = true; 5109 } 5190 this.entitiesDone = true; 5110 5191 }, 5111 5192 5112 5193 _setupRules : function() { 5113 5194 var s = this.settings; 5114 5195 5115 5196 // Setup default rule 5116 if (!this.rulesDone) { 5117 this.addRuleStr(s.valid_elements); 5118 this.addRuleStr(s.extended_valid_elements); 5119 this.addChildRemoveRuleStr(s.valid_child_elements); 5197 this.addRuleStr(s.valid_elements); 5198 this.addRuleStr(s.extended_valid_elements); 5199 this.addChildRemoveRuleStr(s.valid_child_elements); 5120 5200 5121 this.rulesDone = true; 5122 } 5201 this.rulesDone = true; 5123 5202 }, 5124 5203 5125 5204 _isDuplicate : function(n) { 5126 var i ;5205 var i, l, sn; 5127 5206 5128 5207 if (!this.settings.fix_content_duplication) 5129 5208 return false; … … 5135 5214 5136 5215 n.setAttribute('mce_serialized', this.serializationId); 5137 5216 } else { 5217 sn = this.serializedNodes; 5218 5138 5219 // Search lookup table for text nodes and comments 5139 for (i=0 ; i<this.serializedNodes.length; i++) {5140 if ( this.serializedNodes[i] == n)5220 for (i=0, l = sn.length; i<l; i++) { 5221 if (sn[i] == n) 5141 5222 return true; 5142 5223 } 5143 5224 5144 this.serializedNodes[this.serializedNodes.length] = n;5225 sn.push(n); 5145 5226 } 5146 5227 5147 5228 return false; … … 5151 5232 5152 5233 /* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */ 5153 5234 5154 TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) { 5155 var o = '', f = tinyMCE.xmlEncode; 5235 tinyMCE.add(TinyMCE_Engine, { 5236 createTagHTML : function(tn, a, h) { 5237 var o = '', f = tinyMCE.xmlEncode, n; 5156 5238 5157 o = '<' + tn;5239 o = '<' + tn; 5158 5240 5159 if (a) { 5160 for (n in a) { 5161 if (typeof(a[n]) != 'function' && a[n] != null) 5162 o += ' ' + f(n) + '="' + f('' + a[n]) + '"'; 5241 if (a) { 5242 for (n in a) { 5243 if (typeof(a[n]) != 'function' && a[n] != null) 5244 o += ' ' + f(n) + '="' + f('' + a[n]) + '"'; 5245 } 5163 5246 } 5164 }5165 5247 5166 o += !h ? ' />' : '>' + h + '</' + tn + '>';5248 o += !h ? ' />' : '>' + h + '</' + tn + '>'; 5167 5249 5168 return o;5169 }; 5250 return o; 5251 }, 5170 5252 5171 TinyMCE_Engine.prototype.createTag =function(d, tn, a, h) {5172 var o = d.createElement(tn);5253 createTag : function(d, tn, a, h) { 5254 var o = d.createElement(tn), n; 5173 5255 5174 if (a) { 5175 for (n in a) { 5176 if (typeof(a[n]) != 'function' && a[n] != null) 5177 tinyMCE.setAttrib(o, n, a[n]); 5256 if (a) { 5257 for (n in a) { 5258 if (typeof(a[n]) != 'function' && a[n] != null) 5259 tinyMCE.setAttrib(o, n, a[n]); 5260 } 5178 5261 } 5179 }5180 5262 5181 if (h)5182 o.innerHTML = h;5263 if (h) 5264 o.innerHTML = h; 5183 5265 5184 return o;5185 }; 5266 return o; 5267 }, 5186 5268 5187 TinyMCE_Engine.prototype.getElementByAttributeValue =function(n, e, a, v) {5188 return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];5189 }; 5269 getElementByAttributeValue : function(n, e, a, v) { 5270 return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0]; 5271 }, 5190 5272 5191 TinyMCE_Engine.prototype.getElementsByAttributeValue =function(n, e, a, v) {5192 var i, nl = n.getElementsByTagName(e), o = new Array();5273 getElementsByAttributeValue : function(n, e, a, v) { 5274 var i, nl = n.getElementsByTagName(e), o = []; 5193 5275 5194 for (i=0; i<nl.length; i++) {5195 if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)5196 o[o.length] = nl[i];5197 }5276 for (i=0; i<nl.length; i++) { 5277 if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1) 5278 o[o.length] = nl[i]; 5279 } 5198 5280 5199 return o;5200 }; 5281 return o; 5282 }, 5201 5283 5202 TinyMCE_Engine.prototype.isBlockElement =function(n) {5203 return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);5204 }; 5284 isBlockElement : function(n) { 5285 return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName); 5286 }, 5205 5287 5206 TinyMCE_Engine.prototype.getParentBlockElement =function(n, r) {5207 return this.getParentNode(n, function(n) {5208 return tinyMCE.isBlockElement(n);5209 }, r);5288 getParentBlockElement : function(n, r) { 5289 return this.getParentNode(n, function(n) { 5290 return tinyMCE.isBlockElement(n); 5291 }, r); 5210 5292 5211 return null;5212 }; 5293 return null; 5294 }, 5213 5295 5214 TinyMCE_Engine.prototype.insertAfter =function(n, r){5215 if (r.nextSibling)5216 r.parentNode.insertBefore(n, r.nextSibling);5217 else5218 r.parentNode.appendChild(n);5219 }; 5296 insertAfter : function(n, r){ 5297 if (r.nextSibling) 5298 r.parentNode.insertBefore(n, r.nextSibling); 5299 else 5300 r.parentNode.appendChild(n); 5301 }, 5220 5302 5221 TinyMCE_Engine.prototype.setInnerHTML =function(e, h) {5222 var i, nl, n;5303 setInnerHTML : function(e, h) { 5304 var i, nl, n; 5223 5305 5224 // Convert all strong/em to b/i in Gecko5225 if (tinyMCE.isGecko) {5226 h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>');5227 h = h.replace(/<em([^>]*)>/gi, '<i$1>');5228 h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>');5229 h = h.replace(/<strong([^>]*)>/gi, '<b$1>');5230 h = h.replace(/<\/strong>/gi, '</b>');5231 h = h.replace(/<\/em>/gi, '</i>');5232 }5306 // Convert all strong/em to b/i in Gecko 5307 if (tinyMCE.isGecko) { 5308 h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>'); 5309 h = h.replace(/<em([^>]*)>/gi, '<i$1>'); 5310 h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>'); 5311 h = h.replace(/<strong([^>]*)>/gi, '<b$1>'); 5312 h = h.replace(/<\/strong>/gi, '</b>'); 5313 h = h.replace(/<\/em>/gi, '</i>'); 5314 } 5233 5315 5234 if (tinyMCE.isRealIE) {5235 // Since MSIE handles invalid HTML better that valid XHTML we5236 // need to make some things invalid. <hr /> gets converted to <hr>.5237 h = h.replace(/\s\/>/g, '>');5316 if (tinyMCE.isRealIE) { 5317 // Since MSIE handles invalid HTML better that valid XHTML we 5318 // need to make some things invalid. <hr /> gets converted to <hr>. 5319 h = h.replace(/\s\/>/g, '>'); 5238 5320 5239 // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones5240 h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs5241 h = h.replace(/<p([^>]*)>\s* \s*<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs5242 h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs5321 // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones 5322 h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs 5323 h = h.replace(/<p([^>]*)>\s* \s*<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs 5324 h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true"> </p>'); // Keep empty paragraphs 5243 5325 5244 // Remove first comment5245 e.innerHTML = tinyMCE.uniqueTag + h;5246 e.firstChild.removeNode(true);5326 // Remove first comment 5327 e.innerHTML = tinyMCE.uniqueTag + h; 5328 e.firstChild.removeNode(true); 5247 5329 5248 // Remove weird auto generated empty paragraphs unless it's supposed to be there5249 nl = e.getElementsByTagName("p");5250 for (i=nl.length-1; i>=0; i--) {5251 n = nl[i];5330 // Remove weird auto generated empty paragraphs unless it's supposed to be there 5331 nl = e.getElementsByTagName("p"); 5332 for (i=nl.length-1; i>=0; i--) { 5333 n = nl[i]; 5252 5334 5253 if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) 5254 n.parentNode.removeChild(n); 5335 if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) 5336 n.parentNode.removeChild(n); 5337 } 5338 } else { 5339 h = this.fixGeckoBaseHREFBug(1, e, h); 5340 e.innerHTML = h; 5341 this.fixGeckoBaseHREFBug(2, e, h); 5255 5342 } 5256 } else { 5257 h = this.fixGeckoBaseHREFBug(1, e, h); 5258 e.innerHTML = h; 5259 this.fixGeckoBaseHREFBug(2, e, h); 5260 } 5261 }; 5343 }, 5262 5344 5263 TinyMCE_Engine.prototype.getOuterHTML = function(e) { 5264 if (tinyMCE.isIE) 5265 return e.outerHTML; 5345 getOuterHTML : function(e) { 5346 var d; 5266 5347 5267 var d = e.ownerDocument.createElement("body"); 5268 d.appendChild(e.cloneNode(true)); 5269 return d.innerHTML; 5270 }; 5348 if (tinyMCE.isIE) 5349 return e.outerHTML; 5271 5350 5272 TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) { 5273 var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;5351 d = e.ownerDocument.createElement("body"); 5352 d.appendChild(e.cloneNode(true)); 5274 5353 5275 if (tinyMCE.isIE && e.nodeType == 1) 5276 e.outerHTML = h; 5277 else { 5278 t = d.createElement("body"); 5279 t.innerHTML = h; 5354 return d.innerHTML; 5355 }, 5280 5356 5281 for (i=0, nl=t.childNodes; i<nl.length; i++)5282 e.parentNode.insertBefore(nl[i].cloneNode(true), e);5357 setOuterHTML : function(e, h, d) { 5358 var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; 5283 5359 5284 e.parentNode.removeChild(e); 5285 } 5286 }; 5360 if (tinyMCE.isIE && e.nodeType == 1) 5361 e.outerHTML = h; 5362 else { 5363 t = d.createElement("body"); 5364 t.innerHTML = h; 5287 5365 5288 TinyMCE_Engine.prototype._getElementById = function(id, d) { 5289 var e, i, j, f;5366 for (i=0, nl=t.childNodes; i<nl.length; i++) 5367 e.parentNode.insertBefore(nl[i].cloneNode(true), e); 5290 5368 5291 if (typeof(d) == "undefined") 5292 d = document; 5369 e.parentNode.removeChild(e); 5370 } 5371 }, 5293 5372 5294 e = d.getElementById(id); 5295 if (!e) { 5296 f = d.forms; 5373 _getElementById : function(id, d) { 5374 var e, i, j, f; 5297 5375 5298 for (i=0; i<f.length; i++) { 5299 for (j=0; j<f[i].elements.length; j++) { 5300 if (f[i].elements[j].name == id) { 5301 e = f[i].elements[j]; 5302 break; 5376 if (typeof(d) == "undefined") 5377 d = document; 5378 5379 e = d.getElementById(id); 5380 if (!e) { 5381 f = d.forms; 5382 5383 for (i=0; i<f.length; i++) { 5384 for (j=0; j<f[i].elements.length; j++) { 5385 if (f[i].elements[j].name == id) { 5386 e = f[i].elements[j]; 5387 break; 5388 } 5303 5389 } 5304 5390 } 5305 5391 } 5306 }5307 5392 5308 return e;5309 }; 5393 return e; 5394 }, 5310 5395 5311 TinyMCE_Engine.prototype.getNodeTree =function(n, na, t, nn) {5312 return this.selectNodes(n, function(n) {5313 return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);5314 }, na ? na : new Array());5315 }; 5396 getNodeTree : function(n, na, t, nn) { 5397 return this.selectNodes(n, function(n) { 5398 return (!t || n.nodeType == t) && (!nn || n.nodeName == nn); 5399 }, na ? na : []); 5400 }, 5316 5401 5317 TinyMCE_Engine.prototype.getParentElement =function(n, na, f, r) {5318 var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;5402 getParentElement : function(n, na, f, r) { 5403 var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v; 5319 5404 5320 // Compatiblity with old scripts where f param was a attribute string5321 if (f && typeof(f) == 'string')5322 return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';});5405 // Compatiblity with old scripts where f param was a attribute string 5406 if (f && typeof(f) == 'string') 5407 return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) !== '';}); 5323 5408 5324 return this.getParentNode(n, function(n) {5325 return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));5326 }, r);5327 }; 5409 return this.getParentNode(n, function(n) { 5410 return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n)); 5411 }, r); 5412 }, 5328 5413 5329 TinyMCE_Engine.prototype.getParentNode =function(n, f, r) {5330 while (n) {5331 if (n == r)5332 return null;5414 getParentNode : function(n, f, r) { 5415 while (n) { 5416 if (n == r) 5417 return null; 5333 5418 5334 if (f(n))5335 return n;5419 if (f(n)) 5420 return n; 5336 5421 5337 n = n.parentNode;5338 }5422 n = n.parentNode; 5423 } 5339 5424 5340 return null;5341 }; 5425 return null; 5426 }, 5342 5427 5343 TinyMCE_Engine.prototype.getAttrib =function(elm, name, dv) {5344 var v;5428 getAttrib : function(elm, name, dv) { 5429 var v; 5345 5430 5346 if (typeof(dv) == "undefined")5347 dv = "";5431 if (typeof(dv) == "undefined") 5432 dv = ""; 5348 5433 5349 // Not a element5350 if (!elm || elm.nodeType != 1)5351 return dv;5434 // Not a element 5435 if (!elm || elm.nodeType != 1) 5436 return dv; 5352 5437 5353 try {5354 v = elm.getAttribute(name, 0);5355 } catch (ex) {5356 // IE 7 may cast exception on invalid attributes5357 v = elm.getAttribute(name, 2);5358 }5438 try { 5439 v = elm.getAttribute(name, 0); 5440 } catch (ex) { 5441 // IE 7 may cast exception on invalid attributes 5442 v = elm.getAttribute(name, 2); 5443 } 5359 5444 5360 // Try className for class attrib5361 if (name == "class" && !v)5362 v = elm.className;5445 // Try className for class attrib 5446 if (name == "class" && !v) 5447 v = elm.className; 5363 5448 5364 // Workaround for a issue with Firefox 1.5rc2+ 5365 if (tinyMCE.isGecko && name == "src" && elm.src != null && elm.src != "") 5366 v = elm.src; 5449 // Workaround for a issue with Firefox 1.5rc2+ 5450 if (tinyMCE.isGecko) { 5451 if (name == "src" && elm.src != null && elm.src !== '') 5452 v = elm.src; 5367 5453 5368 // Workaround for a issue with Firefox 1.5rc2+ 5369 if (tinyMCE.isGecko && name == "href" && elm.href != null && elm.href != "") 5370 v = elm.href; 5454 // Workaround for a issue with Firefox 1.5rc2+ 5455 if (name == "href" && elm.href != null && elm.href !== '') 5456 v = elm.href; 5457 } else if (tinyMCE.isIE) { 5458 switch (name) { 5459 case "http-equiv": 5460 v = elm.httpEquiv; 5461 break; 5371 5462 5372 if (name == "http-equiv" && tinyMCE.isIE) 5373 v = elm.httpEquiv; 5463 case "width": 5464 case "height": 5465 v = elm.getAttribute(name, 2); 5466 break; 5467 } 5468 } 5374 5469 5375 if (name == "style" && !tinyMCE.isOpera)5376 v = elm.style.cssText;5470 if (name == "style" && !tinyMCE.isOpera) 5471 v = elm.style.cssText; 5377 5472 5378 return (v && v != "") ? v : dv;5379 }; 5473 return (v && v !== '') ? v : dv; 5474 }, 5380 5475 5381 TinyMCE_Engine.prototype.setAttrib =function(el, name, va, fix) {5382 if (typeof(va) == "number" && va != null)5383 va = "" + va;5476 setAttrib : function(el, name, va, fix) { 5477 if (typeof(va) == "number" && va != null) 5478 va = "" + va; 5384 5479 5385 if (fix) {5386 if (va == null)5387 va = "";5480 if (fix) { 5481 if (va == null) 5482 va = ""; 5388 5483 5389 va = va.replace(/[^0-9%]/g, '');5390 }5484 va = va.replace(/[^0-9%]/g, ''); 5485 } 5391 5486 5392 if (name == "style")5393 el.style.cssText = va;5487 if (name == "style") 5488 el.style.cssText = va; 5394 5489 5395 if (name == "class")5396 el.className = va;5490 if (name == "class") 5491 el.className = va; 5397 5492 5398 if (va != null && va != ""&& va != -1)5399 el.setAttribute(name, va);5400 else5401 el.removeAttribute(name);5402 }; 5493 if (va != null && va !== '' && va != -1) 5494 el.setAttribute(name, va); 5495 else 5496 el.removeAttribute(name); 5497 }, 5403 5498 5404 TinyMCE_Engine.prototype.setStyleAttrib =function(e, n, v) {5405 e.style[n] = v;5499 setStyleAttrib : function(e, n, v) { 5500 e.style[n] = v; 5406 5501 5407 // Style attrib deleted in IE5408 if (tinyMCE.isIE && v == null || v == '') {5409 v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));5410 e.style.cssText = v;5411 e.setAttribute("style", v);5412 }5413 }; 5502 // Style attrib deleted in IE 5503 if (tinyMCE.isIE && v == null || v == '') { 5504 v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText)); 5505 e.style.cssText = v; 5506 e.setAttribute("style", v); 5507 } 5508 }, 5414 5509 5415 TinyMCE_Engine.prototype.switchClass =function(ei, c) {5416 var e;5510 switchClass : function(ei, c) { 5511 var e; 5417 5512 5418 if (tinyMCE.switchClassCache[ei])5419 e = tinyMCE.switchClassCache[ei];5420 else5421 e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);5513 if (tinyMCE.switchClassCache[ei]) 5514 e = tinyMCE.switchClassCache[ei]; 5515 else 5516 e = tinyMCE.switchClassCache[ei] = document.getElementById(ei); 5422 5517 5423 if (e) {5424 // Keep tile mode5425 if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0)5426 c = 'mceTiledButton ' + c;5518 if (e) { 5519 // Keep tile mode 5520 if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0) 5521 c = 'mceTiledButton ' + c; 5427 5522 5428 e.className = c;5429 }5430 }; 5523 e.className = c; 5524 } 5525 }, 5431 5526 5432 TinyMCE_Engine.prototype.getAbsPosition =function(n, cn) {5433 var l = 0, t = 0;5527 getAbsPosition : function(n, cn) { 5528 var l = 0, t = 0; 5434 5529 5435 while (n && n != cn) {5436 l += n.offsetLeft;5437 t += n.offsetTop;5438 n = n.offsetParent;5439 }5530 while (n && n != cn) { 5531 l += n.offsetLeft; 5532 t += n.offsetTop; 5533 n = n.offsetParent; 5534 } 5440 5535 5441 return {absLeft : l, absTop : t};5442 }; 5536 return {absLeft : l, absTop : t}; 5537 }, 5443 5538 5444 TinyMCE_Engine.prototype.prevNode =function(e, n) {5445 var a = n.split(','), i;5539 prevNode : function(e, n) { 5540 var a = n.split(','), i; 5446 5541 5447 while ((e = e.previousSibling) != null) { 5448 for (i=0; i<a.length; i++) { 5449 if (e.nodeName == a[i]) 5450 return e; 5542 while ((e = e.previousSibling) != null) { 5543 for (i=0; i<a.length; i++) { 5544 if (e.nodeName == a[i]) 5545 return e; 5546 } 5451 5547 } 5452 }5453 5548 5454 return null;5455 }; 5549 return null; 5550 }, 5456 5551 5457 TinyMCE_Engine.prototype.nextNode =function(e, n) {5458 var a = n.split(','), i;5552 nextNode : function(e, n) { 5553 var a = n.split(','), i; 5459 5554 5460 while ((e = e.nextSibling) != null) { 5461 for (i=0; i<a.length; i++) { 5462 if (e.nodeName == a[i]) 5463 return e; 5555 while ((e = e.nextSibling) != null) { 5556 for (i=0; i<a.length; i++) { 5557 if (e.nodeName == a[i]) 5558 return e; 5559 } 5464 5560 } 5465 }5466 5561 5467 return null;5468 }; 5562 return null; 5563 }, 5469 5564 5470 TinyMCE_Engine.prototype.selectElements =function(n, na, f) {5471 var i, a = [], nl, x;5565 selectElements : function(n, na, f) { 5566 var i, a = [], nl, x; 5472 5567 5473 for (x=0, na = na.split(','); x<na.length; x++)5474 for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)5475 (!f || f(nl[i])) && a.push(nl[i]);5568 for (x=0, na = na.split(','); x<na.length; x++) 5569 for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++) 5570 (!f || f(nl[i])) && a.push(nl[i]); 5476 5571 5477 return a;5478 }; 5572 return a; 5573 }, 5479 5574 5480 TinyMCE_Engine.prototype.selectNodes =function(n, f, a) {5481 var i;5575 selectNodes : function(n, f, a) { 5576 var i; 5482 5577 5483 if (!a)5484 a = new Array();5578 if (!a) 5579 a = []; 5485 5580 5486 if (f(n))5487 a[a.length] = n;5581 if (f(n)) 5582 a[a.length] = n; 5488 5583 5489 if (n.hasChildNodes()) {5490 for (i=0; i<n.childNodes.length; i++)5491 tinyMCE.selectNodes(n.childNodes[i], f, a);5492 }5584 if (n.hasChildNodes()) { 5585 for (i=0; i<n.childNodes.length; i++) 5586 tinyMCE.selectNodes(n.childNodes[i], f, a); 5587 } 5493 5588 5494 return a;5495 }; 5589 return a; 5590 }, 5496 5591 5497 TinyMCE_Engine.prototype.addCSSClass =function(e, c, b) {5498 var o = this.removeCSSClass(e, c);5499 return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;5500 }; 5592 addCSSClass : function(e, c, b) { 5593 var o = this.removeCSSClass(e, c); 5594 return e.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c; 5595 }, 5501 5596 5502 TinyMCE_Engine.prototype.removeCSSClass =function(e, c) {5503 c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');5504 return e.className = c != ' ' ? c : '';5505 }; 5597 removeCSSClass : function(e, c) { 5598 c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' '); 5599 return e.className = c != ' ' ? c : ''; 5600 }, 5506 5601 5507 TinyMCE_Engine.prototype.hasCSSClass =function(n, c) {5508 return new RegExp('\\b' + c + '\\b', 'g').test(n.className);5509 }; 5602 hasCSSClass : function(n, c) { 5603 return new RegExp('\\b' + c + '\\b', 'g').test(n.className); 5604 }, 5510 5605 5511 TinyMCE_Engine.prototype.renameElement =function(e, n, d) {5512 var ne, i, ar;5606 renameElement : function(e, n, d) { 5607 var ne, i, ar; 5513 5608 5514 d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d;5609 d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d; 5515 5610 5516 if (e) {5517 ne = d.createElement(n);5611 if (e) { 5612 ne = d.createElement(n); 5518 5613 5519 ar = e.attributes; 5520 for (i=ar.length-1; i>-1; i--) { 5521 if (ar[i].specified && ar[i].nodeValue) 5522 ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue); 5614 ar = e.attributes; 5615 for (i=ar.length-1; i>-1; i--) { 5616 if (ar[i].specified && ar[i].nodeValue) 5617 ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue); 5618 } 5619 5620 ar = e.childNodes; 5621 for (i=0; i<ar.length; i++) 5622 ne.appendChild(ar[i].cloneNode(true)); 5623 5624 e.parentNode.replaceChild(ne, e); 5523 5625 } 5626 }, 5524 5627 5525 ar = e.childNodes; 5526 for (i=0; i<ar.length; i++) 5527 ne.appendChild(ar[i].cloneNode(true)); 5628 getViewPort : function(w) { 5629 var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement; 5528 5630 5529 e.parentNode.replaceChild(ne, e); 5530 } 5531 }; 5631 return { 5632 left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft), 5633 top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop), 5634 width : w.innerWidth || (m ? de.clientWidth : b.clientWidth), 5635 height : w.innerHeight || (m ? de.clientHeight : b.clientHeight) 5636 }; 5637 }, 5532 5638 5533 TinyMCE_Engine.prototype.getViewPort = function(w) { 5534 var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement; 5639 getStyle : function(n, na, d) { 5640 if (!n) 5641 return false; 5535 5642 5536 return { 5537 left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft), 5538 top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop), 5539 width : w.innerWidth || (m ? de.clientWidth : b.clientWidth), 5540 height : w.innerHeight || (m ? de.clientHeight : b.clientHeight) 5541 }; 5542 }; 5643 // Gecko 5644 if (tinyMCE.isGecko && n.ownerDocument.defaultView) { 5645 try { 5646 return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na); 5647 } catch (n) { 5648 // Old safari might fail 5649 return null; 5650 } 5651 } 5543 5652 5544 TinyMCE_Engine.prototype.getStyle = function(n, na, d) { 5545 if (!n) 5653 // Camelcase it, if needed 5654 na = na.replace(/-(\D)/g, function(a, b){ 5655 return b.toUpperCase(); 5656 }); 5657 5658 // IE & Opera 5659 if (n.currentStyle) 5660 return n.currentStyle[na]; 5661 5546 5662 return false; 5547 5548 // Gecko5549 if (tinyMCE.isGecko && n.ownerDocument.defaultView) {5550 try {5551 return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na);5552 } catch (n) {5553 // Old safari might fail5554 return null;5555 }5556 5663 } 5557 5664 5558 // Camelcase it, if needed5559 na = na.replace(/-(\D)/g, function(a, b){5560 return b.toUpperCase();5561 5665 }); 5562 5666 5563 // IE & Opera5564 if (n.currentStyle)5565 return n.currentStyle[na];5566 5567 return false;5568 };5569 5570 5667 /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */ 5571 5668 5572 TinyMCE_Engine.prototype.parseURL = function(url_str) { 5573 var urlParts = new Array(); 5669 tinyMCE.add(TinyMCE_Engine, { 5670 parseURL : function(url_str) { 5671 var urlParts = [], i, pos, lastPos, chr; 5574 5672 5575 if (url_str) { 5576 var pos, lastPos; 5673 if (url_str) { 5674 // Parse protocol part 5675 pos = url_str.indexOf('://'); 5676 if (pos != -1) { 5677 urlParts.protocol = url_str.substring(0, pos); 5678 lastPos = pos + 3; 5679 } 5577 5680 5578 // Parse protocol part 5579 pos = url_str.indexOf('://'); 5580 if (pos != -1) { 5581 urlParts['protocol'] = url_str.substring(0, pos); 5582 lastPos = pos + 3; 5583 } 5681 // Find port or path start 5682 for (i=lastPos; i<url_str.length; i++) { 5683 chr = url_str.charAt(i); 5584 5684 5585 // Find port or path start 5586 for (var i=lastPos; i<url_str.length; i++) { 5587 var chr = url_str.charAt(i); 5685 if (chr == ':') 5686 break; 5588 5687 5589 if (chr == ':') 5590 break; 5688 if (chr == '/') 5689 break; 5690 } 5691 pos = i; 5591 5692 5592 if (chr == '/') 5593 break; 5594 } 5595 pos = i; 5693 // Get host 5694 urlParts.host = url_str.substring(lastPos, pos); 5596 5695 5597 // Get host 5598 urlParts['host'] = url_str.substring(lastPos, pos); 5696 // Get port 5697 urlParts.port = ""; 5698 lastPos = pos; 5699 if (url_str.charAt(pos) == ':') { 5700 pos = url_str.indexOf('/', lastPos); 5701 urlParts.port = url_str.substring(lastPos+1, pos); 5702 } 5599 5703 5600 // Get port 5601 urlParts['port'] = ""; 5602 lastPos = pos; 5603 if (url_str.charAt(pos) == ':') { 5604 pos = url_str.indexOf('/', lastPos); 5605 urlParts['port'] = url_str.substring(lastPos+1, pos); 5606 } 5704 // Get path 5705 lastPos = pos; 5706 pos = url_str.indexOf('?', lastPos); 5607 5707 5608 // Get path 5609 lastPos = pos; 5610 pos = url_str.indexOf('?', lastPos); 5708 if (pos == -1) 5709 pos = url_str.indexOf('#', lastPos); 5611 5710 5612 if (pos == -1)5613 pos = url_str.indexOf('#', lastPos);5711 if (pos == -1) 5712 pos = url_str.length; 5614 5713 5615 if (pos == -1) 5616 pos = url_str.length; 5714 urlParts.path = url_str.substring(lastPos, pos); 5617 5715 5618 urlParts['path'] = url_str.substring(lastPos, pos); 5716 // Get query 5717 lastPos = pos; 5718 if (url_str.charAt(pos) == '?') { 5719 pos = url_str.indexOf('#'); 5720 pos = (pos == -1) ? url_str.length : pos; 5721 urlParts.query = url_str.substring(lastPos+1, pos); 5722 } 5619 5723 5620 // Get query5621 lastPos = pos;5622 if (url_str.charAt(pos) == '?') {5623 pos = url_str.indexOf('#');5624 pos = (pos == -1) ? url_str.length : pos;5625 urlParts['query'] = url_str.substring(lastPos+1, pos);5724 // Get anchor 5725 lastPos = pos; 5726 if (url_str.charAt(pos) == '#') { 5727 pos = url_str.length; 5728 urlParts.anchor = url_str.substring(lastPos+1, pos); 5729 } 5626 5730 } 5627 5731 5628 // Get anchor 5629 lastPos = pos; 5630 if (url_str.charAt(pos) == '#') { 5631 pos = url_str.length; 5632 urlParts['anchor'] = url_str.substring(lastPos+1, pos); 5633 } 5634 } 5732 return urlParts; 5733 }, 5635 5734 5636 return urlParts;5637 };5735 serializeURL : function(up) { 5736 var o = ""; 5638 5737 5639 TinyMCE_Engine.prototype.serializeURL = function(up) { 5640 var o = "";5738 if (up.protocol) 5739 o += up.protocol + "://"; 5641 5740 5642 if (up['protocol'])5643 o += up['protocol'] + "://";5741 if (up.host) 5742 o += up.host; 5644 5743 5645 if (up['host'])5646 o += up['host'];5744 if (up.port) 5745 o += ":" + up.port; 5647 5746 5648 if (up['port'])5649 o += ":" + up['port'];5747 if (up.path) 5748 o += up.path; 5650 5749 5651 if (up['path'])5652 o += up['path'];5750 if (up.query) 5751 o += "?" + up.query; 5653 5752 5654 if (up['query'])5655 o += "?" + up['query'];5753 if (up.anchor) 5754 o += "#" + up.anchor; 5656 5755 5657 if (up['anchor'])5658 o += "#" + up['anchor'];5756 return o; 5757 }, 5659 5758 5660 return o; 5661 }; 5759 convertAbsoluteURLToRelativeURL : function(base_url, url_to_relative) { 5760 var baseURL = this.parseURL(base_url), targetURL = this.parseURL(url_to_relative); 5761 var i, strTok1, strTok2, breakPoint = 0, outPath = "", forceSlash = false; 5762 var fileName, pos; 5662 5763 5663 TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_relative) { 5664 var baseURL = this.parseURL(base_url); 5665 var targetURL = this.parseURL(url_to_relative); 5666 var strTok1; 5667 var strTok2; 5668 var breakPoint = 0; 5669 var outPath = ""; 5670 var forceSlash = false; 5764 if (targetURL.path == '') 5765 targetURL.path = "/"; 5766 else 5767 forceSlash = true; 5671 5768 5672 if (targetURL.path == "")5673 targetURL.path = "/";5674 else5675 forceSlash = true;5769 // Crop away last path part 5770 base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/')); 5771 strTok1 = base_url.split('/'); 5772 strTok2 = targetURL.path.split('/'); 5676 5773 5677 // Crop away last path part 5678 base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/')); 5679 strTok1 = base_url.split('/'); 5680 strTok2 = targetURL.path.split('/'); 5681 5682 if (strTok1.length >= strTok2.length) { 5683 for (var i=0; i<strTok1.length; i++) { 5684 if (i >= strTok2.length || strTok1[i] != strTok2[i]) { 5685 breakPoint = i + 1; 5686 break; 5774 if (strTok1.length >= strTok2.length) { 5775 for (i=0; i<strTok1.length; i++) { 5776 if (i >= strTok2.length || strTok1[i] != strTok2[i]) { 5777 breakPoint = i + 1; 5778 break; 5779 } 5687 5780 } 5688 5781 } 5689 }5690 5782 5691 if (strTok1.length < strTok2.length) { 5692 for (var i=0; i<strTok2.length; i++) { 5693 if (i >= strTok1.length || strTok1[i] != strTok2[i]) { 5694 breakPoint = i + 1; 5695 break; 5783 if (strTok1.length < strTok2.length) { 5784 for (i=0; i<strTok2.length; i++) { 5785 if (i >= strTok1.length || strTok1[i] != strTok2[i]) { 5786 breakPoint = i + 1; 5787 break; 5788 } 5696 5789 } 5697 5790 } 5698 }5699 5791 5700 if (breakPoint == 1)5701 return targetURL.path;5792 if (breakPoint == 1) 5793 return targetURL.path; 5702 5794 5703 for (vari=0; i<(strTok1.length-(breakPoint-1)); i++)5704 outPath += "../";5795 for (i=0; i<(strTok1.length-(breakPoint-1)); i++) 5796 outPath += "../"; 5705 5797 5706 for (vari=breakPoint-1; i<strTok2.length; i++) {5707 if (i != (breakPoint-1))5708 outPath += "/" + strTok2[i];5709 else5710 outPath += strTok2[i];5711 }5798 for (i=breakPoint-1; i<strTok2.length; i++) { 5799 if (i != (breakPoint-1)) 5800 outPath += "/" + strTok2[i]; 5801 else 5802 outPath += strTok2[i]; 5803 } 5712 5804 5713 targetURL.protocol = null;5714 targetURL.host = null;5715 targetURL.port = null;5716 targetURL.path = outPath == ""&& forceSlash ? "/" : outPath;5805 targetURL.protocol = null; 5806 targetURL.host = null; 5807 targetURL.port = null; 5808 targetURL.path = outPath == '' && forceSlash ? "/" : outPath; 5717 5809 5718 // Remove document prefix from local anchors 5719 var fileName = baseURL.path; 5720 var pos; 5810 // Remove document prefix from local anchors 5811 fileName = baseURL.path; 5721 5812 5722 if ((pos = fileName.lastIndexOf('/')) != -1)5723 fileName = fileName.substring(pos + 1);5813 if ((pos = fileName.lastIndexOf('/')) != -1) 5814 fileName = fileName.substring(pos + 1); 5724 5815 5725 // Is local anchor5726 if (fileName == targetURL.path && targetURL.anchor != "")5727 targetURL.path = "";5816 // Is local anchor 5817 if (fileName == targetURL.path && targetURL.anchor !== '') 5818 targetURL.path = ""; 5728 5819 5729 // If empty and not local anchor force filename or slash5730 if (targetURL.path == ""&& !targetURL.anchor)5731 targetURL.path = fileName != ""? fileName : "/";5820 // If empty and not local anchor force filename or slash 5821 if (targetURL.path == '' && !targetURL.anchor) 5822 targetURL.path = fileName !== '' ? fileName : "/"; 5732 5823 5733 return this.serializeURL(targetURL);5734 }; 5824 return this.serializeURL(targetURL); 5825 }, 5735 5826 5736 TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL =function(base_url, relative_url) {5737 var baseURL = this.parseURL(base_url), baseURLParts, relURLParts;5738 var relURL = this.parseURL(relative_url);5827 convertRelativeToAbsoluteURL : function(base_url, relative_url) { 5828 var baseURL = this.parseURL(base_url), baseURLParts, relURLParts, newRelURLParts, numBack, relURL = this.parseURL(relative_url), i; 5829 var len, absPath, start, end, newBaseURLParts; 5739 5830 5740 if (relative_url == ""|| relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))5741 return relative_url;5831 if (relative_url == '' || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url)) 5832 return relative_url; 5742 5833 5743 // Split parts5744 baseURLParts = baseURL['path'].split('/');5745 relURLParts = relURL['path'].split('/');5834 // Split parts 5835 baseURLParts = baseURL.path.split('/'); 5836 relURLParts = relURL.path.split('/'); 5746 5837 5747 // Remove empty chunks5748 var newBaseURLParts = new Array();5749 for (vari=baseURLParts.length-1; i>=0; i--) {5750 if (baseURLParts[i].length == 0)5751 continue;5838 // Remove empty chunks 5839 newBaseURLParts = []; 5840 for (i=baseURLParts.length-1; i>=0; i--) { 5841 if (baseURLParts[i].length == 0) 5842 continue; 5752 5843 5753 newBaseURLParts[newBaseURLParts.length] = baseURLParts[i];5754 }5755 baseURLParts = newBaseURLParts.reverse();5844 newBaseURLParts[newBaseURLParts.length] = baseURLParts[i]; 5845 } 5846 baseURLParts = newBaseURLParts.reverse(); 5756 5847 5757 // Merge relURLParts chunks5758 var newRelURLParts = new Array();5759 varnumBack = 0;5760 for (vari=relURLParts.length-1; i>=0; i--) {5761 if (relURLParts[i].length == 0 || relURLParts[i] == ".")5762 continue;5848 // Merge relURLParts chunks 5849 newRelURLParts = []; 5850 numBack = 0; 5851 for (i=relURLParts.length-1; i>=0; i--) { 5852 if (relURLParts[i].length == 0 || relURLParts[i] == ".") 5853 continue; 5763 5854 5764 if (relURLParts[i] == '..') {5765 numBack++;5766 continue;5767 }5855 if (relURLParts[i] == '..') { 5856 numBack++; 5857 continue; 5858 } 5768 5859 5769 if (numBack > 0) { 5770 numBack--; 5771 continue; 5860 if (numBack > 0) { 5861 numBack--; 5862 continue; 5863 } 5864 5865 newRelURLParts[newRelURLParts.length] = relURLParts[i]; 5772 5866 } 5773 5867 5774 newRelURLParts[newRelURLParts.length] = relURLParts[i]; 5775 } 5868 relURLParts = newRelURLParts.reverse(); 5776 5869 5777 relURLParts = newRelURLParts.reverse(); 5870 // Remove end from absolute path 5871 len = baseURLParts.length-numBack; 5872 absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/'); 5873 start = ""; 5874 end = ""; 5778 5875 5779 // Remove end from absolute path5780 var len = baseURLParts.length-numBack;5781 var absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');5782 var start = "", end = "";5876 // Build output URL 5877 relURL.protocol = baseURL.protocol; 5878 relURL.host = baseURL.host; 5879 relURL.port = baseURL.port; 5783 5880 5784 // Build output URL 5785 relURL.protocol = baseURL.protocol; 5786 relURL.host = baseURL.host; 5787 relURL.port = baseURL.port; 5881 // Re-add trailing slash if it's removed 5882 if (relURL.path.charAt(relURL.path.length-1) == "/") 5883 absPath += "/"; 5788 5884 5789 // Re-add trailing slash if it's removed 5790 if (relURL.path.charAt(relURL.path.length-1) == "/") 5791 absPath += "/"; 5885 relURL.path = absPath; 5792 5886 5793 relURL.path = absPath; 5887 return this.serializeURL(relURL); 5888 }, 5794 5889 5795 return this.serializeURL(relURL); 5796 }; 5890 convertURL : function(url, node, on_save) { 5891 var dl = document.location, start, portPart, urlParts, baseUrlParts, tmpUrlParts, curl; 5892 var prot = dl.protocol, host = dl.hostname, port = dl.port; 5797 5893 5798 TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) { 5799 var prot = document.location.protocol; 5800 var host = document.location.hostname; 5801 var port = document.location.port; 5894 // Pass through file protocol 5895 if (prot == "file:") 5896 return url; 5802 5897 5803 // Pass through file protocol 5804 if (prot == "file:") 5805 return url; 5898 // Something is wrong, remove weirdness 5899 url = tinyMCE.regexpReplace(url, '(http|https):///', '/'); 5806 5900 5807 // Something is wrong, remove weirdness 5808 url = tinyMCE.regexpReplace(url, '(http|https):///', '/'); 5901 // Mailto link or anchor (Pass through) 5902 if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || /^[ \t\r\n\+]*[#\?]/.test(url)) 5903 return url; 5809 5904 5810 // Mailto link or anchor (Pass through)5811 if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0) == "#")5812 returnurl;5905 // Fix relative/Mozilla 5906 if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') 5907 return tinyMCE.settings.base_href + url; 5813 5908 5814 // Fix relative/Mozilla 5815 if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') 5816 return tinyMCE.settings['base_href'] + url; 5909 // Handle relative URLs 5910 if (on_save && tinyMCE.getParam('relative_urls')) { 5911 curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); 5912 if (curl.charAt(0) == '/') 5913 curl = tinyMCE.settings.document_base_prefix + curl; 5817 5914 5818 // Handle relative URLs 5819 if (on_save && tinyMCE.getParam('relative_urls')) { 5820 var curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url); 5821 if (curl.charAt(0) == '/') 5822 curl = tinyMCE.settings['document_base_prefix'] + curl; 5915 urlParts = tinyMCE.parseURL(curl); 5916 tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings.document_base_url); 5823 5917 5824 var urlParts = tinyMCE.parseURL(curl); 5825 var tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings['document_base_url']); 5918 // Force relative 5919 if (urlParts.host == tmpUrlParts.host && (urlParts.port == tmpUrlParts.port)) 5920 return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url, curl); 5921 } 5826 5922 5827 // Force relative5828 if ( urlParts['host'] == tmpUrlParts['host'] && (urlParts['port'] == tmpUrlParts['port']))5829 return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'], curl);5830 }5923 // Handle absolute URLs 5924 if (!tinyMCE.getParam('relative_urls')) { 5925 urlParts = tinyMCE.parseURL(url); 5926 baseUrlParts = tinyMCE.parseURL(tinyMCE.settings.base_href); 5831 5927 5832 // Handle absolute URLs 5833 if (!tinyMCE.getParam('relative_urls')) { 5834 var urlParts = tinyMCE.parseURL(url); 5835 var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']); 5928 // Force absolute URLs from relative URLs 5929 url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); 5836 5930 5837 // Force absolute URLs from relative URLs 5838 url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url); 5931 // If anchor and path is the same page 5932 if (urlParts.anchor && urlParts.path == baseUrlParts.path) 5933 return "#" + urlParts.anchor; 5934 } 5839 5935 5840 // If anchor and path is the same page5841 if ( urlParts['anchor'] && urlParts['path'] == baseUrlParts['path'])5842 return "#" + urlParts['anchor'];5843 }5936 // Remove current domain 5937 if (tinyMCE.getParam('remove_script_host')) { 5938 start = ""; 5939 portPart = ""; 5844 5940 5845 // Remove current domain 5846 if (tinyMCE.getParam('remove_script_host')) { 5847 var start = "", portPart = ""; 5941 if (port !== '') 5942 portPart = ":" + port; 5848 5943 5849 if (port != "") 5850 portPart = ":" + port; 5944 start = prot + "//" + host + portPart + "/"; 5851 5945 5852 start = prot + "//" + host + portPart + "/"; 5946 if (url.indexOf(start) == 0) 5947 url = url.substring(start.length-1); 5948 } 5853 5949 5854 if (url.indexOf(start) == 0) 5855 url = url.substring(start.length-1); 5856 } 5950 return url; 5951 }, 5857 5952 5858 return url;5859 };5953 convertAllRelativeURLs : function(body) { 5954 var i, elms, src, href, mhref, msrc; 5860 5955 5861 TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) { 5862 var i, elms, src, href, mhref, msrc; 5956 // Convert all image URL:s to absolute URL 5957 elms = body.getElementsByTagName("img"); 5958 for (i=0; i<elms.length; i++) { 5959 src = tinyMCE.getAttrib(elms[i], 'src'); 5863 5960 5864 // Convert all image URL:s to absolute URL 5865 elms = body.getElementsByTagName("img"); 5866 for (i=0; i<elms.length; i++) { 5867 src = tinyMCE.getAttrib(elms[i], 'src'); 5961 msrc = tinyMCE.getAttrib(elms[i], 'mce_src'); 5962 if (msrc !== '') 5963 src = msrc; 5868 5964 5869 msrc = tinyMCE.getAttrib(elms[i], 'mce_src'); 5870 if (msrc != "") 5871 src = msrc; 5872 5873 if (src != "") { 5874 src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src); 5875 elms[i].setAttribute("src", src); 5965 if (src !== '') { 5966 src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src); 5967 elms[i].setAttribute("src", src); 5968 } 5876 5969 } 5877 }5878 5970 5879 // Convert all link URL:s to absolute URL5880 elms = body.getElementsByTagName("a");5881 for (i=0; i<elms.length; i++) {5882 href = tinyMCE.getAttrib(elms[i], 'href');5971 // Convert all link URL:s to absolute URL 5972 elms = body.getElementsByTagName("a"); 5973 for (i=0; i<elms.length; i++) { 5974 href = tinyMCE.getAttrib(elms[i], 'href'); 5883 5975 5884 mhref = tinyMCE.getAttrib(elms[i], 'mce_href');5885 if (mhref != "")5886 href = mhref;5976 mhref = tinyMCE.getAttrib(elms[i], 'mce_href'); 5977 if (mhref !== '') 5978 href = mhref; 5887 5979 5888 if (href && href != "") { 5889 href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], href); 5890 elms[i].setAttribute("href", href); 5980 if (href && href !== '') { 5981 href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, href); 5982 elms[i].setAttribute("href", href); 5983 } 5891 5984 } 5892 5985 } 5893 };5894 5986 5987 }); 5988 5895 5989 /* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */ 5896 5990 5897 TinyMCE_Engine.prototype.clearArray = function(a) { 5898 var n; 5991 tinyMCE.add(TinyMCE_Engine, { 5992 clearArray : function(a) { 5993 var n; 5899 5994 5900 for (n in a)5901 a[n] = null;5995 for (n in a) 5996 a[n] = null; 5902 5997 5903 return a;5904 }; 5998 return a; 5999 }, 5905 6000 5906 TinyMCE_Engine.prototype.explode =function(d, s) {5907 var ar = s.split(d), oar = new Array(), i;6001 explode : function(d, s) { 6002 var ar = s.split(d), oar = [], i; 5908 6003 5909 for (i = 0; i<ar.length; i++) { 5910 if (ar[i] != "") 5911 oar[oar.length] = ar[i]; 6004 for (i = 0; i<ar.length; i++) { 6005 if (ar[i] !== '') 6006 oar[oar.length] = ar[i]; 6007 } 6008 6009 return oar; 5912 6010 } 6011 }); 5913 6012 5914 return oar;5915 };5916 5917 6013 /* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */ 5918 6014 5919 TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) { 5920 var evs, x, y, elms, i, event; 5921 var events = ['onfocus','onblur','onclick','ondblclick', 5922 'onmousedown','onmouseup','onmouseover','onmousemove', 5923 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup']; 6015 tinyMCE.add(TinyMCE_Engine, { 6016 _setEventsEnabled : function(node, state) { 6017 var evs, x, y, elms, i, event; 6018 var events = ['onfocus','onblur','onclick','ondblclick', 6019 'onmousedown','onmouseup','onmouseover','onmousemove', 6020 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup']; 5924 6021 5925 evs = tinyMCE.settings['event_elements'].split(',');5926 for (y=0; y<evs.length; y++){5927 elms = node.getElementsByTagName(evs[y]);5928 for (i=0; i<elms.length; i++) {5929 event = "";6022 evs = tinyMCE.settings.event_elements.split(','); 6023 for (y=0; y<evs.length; y++){ 6024 elms = node.getElementsByTagName(evs[y]); 6025 for (i=0; i<elms.length; i++) { 6026 event = ""; 5930 6027 5931 for (x=0; x<events.length; x++) {5932 if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {5933 event = tinyMCE.cleanupEventStr("" + event);6028 for (x=0; x<events.length; x++) { 6029 if ((event = tinyMCE.getAttrib(elms[i], events[x])) !== '') { 6030 event = tinyMCE.cleanupEventStr("" + event); 5934 6031 5935 if (!state)5936 event = "return true;" + event;5937 else5938 event = event.replace(/^return true;/gi, '');6032 if (!state) 6033 event = "return true;" + event; 6034 else 6035 event = event.replace(/^return true;/gi, ''); 5939 6036 5940 elms[i].removeAttribute(events[x]); 5941 elms[i].setAttribute(events[x], event); 6037 elms[i].removeAttribute(events[x]); 6038 elms[i].setAttribute(events[x], event); 6039 } 5942 6040 } 5943 6041 } 5944 6042 } 5945 } 5946 }; 6043 }, 5947 6044 5948 TinyMCE_Engine.prototype._eventPatch =function(editor_id) {5949 var n, inst, win, e;6045 _eventPatch : function(editor_id) { 6046 var n, inst, win, e; 5950 6047 5951 // Remove odd, error5952 if (typeof(tinyMCE) == "undefined")5953 return true;6048 // Remove odd, error 6049 if (typeof(tinyMCE) == "undefined") 6050 return true; 5954 6051 5955 try {5956 // Try selected instance first5957 if (tinyMCE.selectedInstance) {5958 win = tinyMCE.selectedInstance.getWin();6052 try { 6053 // Try selected instance first 6054 if (tinyMCE.selectedInstance) { 6055 win = tinyMCE.selectedInstance.getWin(); 5959 6056 5960 if (win && win.event) {5961 e = win.event;6057 if (win && win.event) { 6058 e = win.event; 5962 6059 5963 if (!e.target)5964 e.target = e.srcElement;6060 if (!e.target) 6061 e.target = e.srcElement; 5965 6062 5966 TinyMCE_Engine.prototype.handleEvent(e); 5967 return; 6063 TinyMCE_Engine.prototype.handleEvent(e); 6064 return; 6065 } 5968 6066 } 5969 }5970 6067 5971 // Search for it5972 for (n in tinyMCE.instances) {5973 inst = tinyMCE.instances[n];6068 // Search for it 6069 for (n in tinyMCE.instances) { 6070 inst = tinyMCE.instances[n]; 5974 6071 5975 if (!tinyMCE.isInstance(inst))5976 continue;6072 if (!tinyMCE.isInstance(inst)) 6073 continue; 5977 6074 5978 inst.select();5979 win = inst.getWin();6075 inst.select(); 6076 win = inst.getWin(); 5980 6077 5981 if (win && win.event) {5982 e = win.event;6078 if (win && win.event) { 6079 e = win.event; 5983 6080 5984 if (!e.target)5985 e.target = e.srcElement;6081 if (!e.target) 6082 e.target = e.srcElement; 5986 6083 5987 TinyMCE_Engine.prototype.handleEvent(e); 5988 return; 6084 TinyMCE_Engine.prototype.handleEvent(e); 6085 return; 6086 } 5989 6087 } 6088 } catch (ex) { 6089 // Ignore error if iframe is pointing to external URL 5990 6090 } 5991 } catch (ex) { 5992 // Ignore error if iframe is pointing to external URL 5993 } 5994 }; 6091 }, 5995 6092 5996 TinyMCE_Engine.prototype.findEvent =function(e) {5997 var n, inst;6093 findEvent : function(e) { 6094 var n, inst; 5998 6095 5999 if (e)6000 return e;6096 if (e) 6097 return e; 6001 6098 6002 for (n in tinyMCE.instances) {6003 inst = tinyMCE.instances[n];6099 for (n in tinyMCE.instances) { 6100 inst = tinyMCE.instances[n]; 6004 6101 6005 if (tinyMCE.isInstance(inst) && inst.getWin().event)6006 return inst.getWin().event;6007 }6102 if (tinyMCE.isInstance(inst) && inst.getWin().event) 6103 return inst.getWin().event; 6104 } 6008 6105 6009 return null;6010 }; 6106 return null; 6107 }, 6011 6108 6012 TinyMCE_Engine.prototype.unloadHandler =function() {6013 tinyMCE.triggerSave(true, true);6014 }; 6109 unloadHandler : function() { 6110 tinyMCE.triggerSave(true, true); 6111 }, 6015 6112 6016 TinyMCE_Engine.prototype.addEventHandlers =function(inst) {6017 this.setEventHandlers(inst, 1);6018 }; 6113 addEventHandlers : function(inst) { 6114 this.setEventHandlers(inst, 1); 6115 }, 6019 6116 6020 TinyMCE_Engine.prototype.setEventHandlers =function(inst, s) {6021 var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;6117 setEventHandlers : function(inst, s) { 6118 var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent; 6022 6119 6023 ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];6024 ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];6120 ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick']; 6121 ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop']; 6025 6122 6026 inst.switchSettings();6123 inst.switchSettings(); 6027 6124 6028 if (tinyMCE.isIE) {6029 for (i=0; i<ie.length; i++)6030 f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);6031 } else {6032 for (i=0; i<ot.length; i++)6033 f(doc, ot[i], tinyMCE.handleEvent);6125 if (tinyMCE.isIE) { 6126 for (i=0; i<ie.length; i++) 6127 f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch); 6128 } else { 6129 for (i=0; i<ot.length; i++) 6130 f(doc, ot[i], tinyMCE.handleEvent); 6034 6131 6035 // Force designmode 6036 try { 6037 doc.designMode = "On"; 6038 } catch (e) { 6039 // Ignore 6132 // Force designmode 6133 try { 6134 doc.designMode = "On"; 6135 } catch (e) { 6136 // Ignore 6137 } 6040 6138 } 6041 } 6042 }; 6139 }, 6043 6140 6044 TinyMCE_Engine.prototype.onMouseMove =function() {6045 var inst, lh;6141 onMouseMove : function() { 6142 var inst, lh; 6046 6143 6047 // Fix for IE7 bug where it's not restoring hover on anchors correctly6048 if (tinyMCE.lastHover) {6049 lh = tinyMCE.lastHover;6144 // Fix for IE7 bug where it's not restoring hover on anchors correctly 6145 if (tinyMCE.lastHover) { 6146 lh = tinyMCE.lastHover; 6050 6147 6051 // Call out on menus and refresh class on normal buttons6052 if (lh.className.indexOf('mceMenu') != -1)6053 tinyMCE._menuButtonEvent('out', lh);6054 else6055 lh.className = lh.className;6148 // Call out on menus and refresh class on normal buttons 6149 if (lh.className.indexOf('mceMenu') != -1) 6150 tinyMCE._menuButtonEvent('out', lh); 6151 else 6152 lh.className = lh.className; 6056 6153 6057 tinyMCE.lastHover = null;6058 }6154 tinyMCE.lastHover = null; 6155 } 6059 6156 6060 if (!tinyMCE.hasMouseMoved) {6061 inst = tinyMCE.selectedInstance;6157 if (!tinyMCE.hasMouseMoved) { 6158 inst = tinyMCE.selectedInstance; 6062 6159 6063 // Workaround for bug #1437457 (Odd MSIE bug) 6064 if (inst.isFocused) { 6065 inst.undoBookmark = inst.selection.getBookmark(); 6066 tinyMCE.hasMouseMoved = true; 6160 // Workaround for bug #1437457 (Odd MSIE bug) 6161 if (inst.isFocused) { 6162 inst.undoBookmark = inst.selection.getBookmark(); 6163 tinyMCE.hasMouseMoved = true; 6164 } 6067 6165 } 6068 }6069 6166 6070 // tinyMCE.cancelEvent(inst.getWin().event);6071 // return false;6072 }; 6167 // tinyMCE.cancelEvent(inst.getWin().event); 6168 // return false; 6169 }, 6073 6170 6074 TinyMCE_Engine.prototype.cancelEvent =function(e) {6075 if (!e)6076 return false;6171 cancelEvent : function(e) { 6172 if (!e) 6173 return false; 6077 6174 6078 if (tinyMCE.isIE) {6079 e.returnValue = false;6080 e.cancelBubble = true;6081 } else {6082 e.preventDefault();6083 e.stopPropagation && e.stopPropagation();6084 }6175 if (tinyMCE.isIE) { 6176 e.returnValue = false; 6177 e.cancelBubble = true; 6178 } else { 6179 e.preventDefault(); 6180 e.stopPropagation && e.stopPropagation(); 6181 } 6085 6182 6086 return false;6087 }; 6183 return false; 6184 }, 6088 6185 6089 TinyMCE_Engine.prototype.addEvent =function(o, n, h) {6090 // Add cleanup for all non unload events6091 if (n != 'unload') {6092 function clean() {6093 var ex;6186 addEvent : function(o, n, h) { 6187 // Add cleanup for all non unload events 6188 if (n != 'unload') { 6189 function clean() { 6190 var ex; 6094 6191 6095 try { 6096 tinyMCE.removeEvent(o, n, h); 6097 tinyMCE.removeEvent(window, 'unload', clean); 6098 o = n = h = null; 6099 } catch (ex) { 6100 // IE may produce access denied exception on unload 6192 try { 6193 tinyMCE.removeEvent(o, n, h); 6194 tinyMCE.removeEvent(window, 'unload', clean); 6195 o = n = h = null; 6196 } catch (ex) { 6197 // IE may produce access denied exception on unload 6198 } 6101 6199 } 6200 6201 // Add memory cleaner 6202 tinyMCE.addEvent(window, 'unload', clean); 6102 6203 } 6103 6204 6104 // Add memory cleaner 6105 tinyMCE.addEvent(window, 'unload', clean); 6106 } 6205 if (o.attachEvent) 6206 o.attachEvent("on" + n, h); 6207 else 6208 o.addEventListener(n, h, false); 6209 }, 6107 6210 6108 if (o.attachEvent) 6109 o.attachEvent("on" + n, h); 6110 else 6111 o.addEventListener(n, h, false); 6112 }; 6211 removeEvent : function(o, n, h) { 6212 if (o.detachEvent) 6213 o.detachEvent("on" + n, h); 6214 else 6215 o.removeEventListener(n, h, false); 6216 }, 6113 6217 6114 TinyMCE_Engine.prototype.removeEvent = function(o, n, h) { 6115 if (o.detachEvent) 6116 o.detachEvent("on" + n, h); 6117 else 6118 o.removeEventListener(n, h, false); 6119 }; 6218 addSelectAccessibility : function(e, s, w) { 6219 // Add event handlers 6220 if (!s._isAccessible) { 6221 s.onkeydown = tinyMCE.accessibleEventHandler; 6222 s.onblur = tinyMCE.accessibleEventHandler; 6223 s._isAccessible = true; 6224 s._win = w; 6225 } 6120 6226 6121 TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) { 6122 // Add event handlers 6123 if (!s._isAccessible) { 6124 s.onkeydown = tinyMCE.accessibleEventHandler; 6125 s.onblur = tinyMCE.accessibleEventHandler; 6126 s._isAccessible = true; 6127 s._win = w; 6128 } 6227 return false; 6228 }, 6129 6229 6130 return false;6131 };6230 accessibleEventHandler : function(e) { 6231 var elm, win = this._win; 6132 6232 6133 TinyMCE_Engine.prototype.accessibleEventHandler = function(e) { 6134 var win = this._win; 6135 e = tinyMCE.isIE ? win.event : e; 6136 var elm = tinyMCE.isIE ? e.srcElement : e.target; 6233 e = tinyMCE.isIE ? win.event : e; 6234 elm = tinyMCE.isIE ? e.srcElement : e.target; 6137 6235 6138 // Unpiggyback onchange on blur 6139 if (e.type == "blur") { 6140 if (elm.oldonchange) { 6236 // Unpiggyback onchange on blur 6237 if (e.type == "blur") { 6238 if (elm.oldonchange) { 6239 elm.onchange = elm.oldonchange; 6240 elm.oldonchange = null; 6241 } 6242 6243 return true; 6244 } 6245 6246 // Piggyback onchange 6247 if (elm.nodeName == "SELECT" && !elm.oldonchange) { 6248 elm.oldonchange = elm.onchange; 6249 elm.onchange = null; 6250 } 6251 6252 // Execute onchange and remove piggyback 6253 if (e.keyCode == 13 || e.keyCode == 32) { 6141 6254 elm.onchange = elm.oldonchange; 6255 elm.onchange(); 6142 6256 elm.oldonchange = null; 6257 6258 tinyMCE.cancelEvent(e); 6259 return false; 6143 6260 } 6144 6261 6145 6262 return true; 6146 } 6263 }, 6147 6264 6148 // Piggyback onchange 6149 if (elm.nodeName == "SELECT" && !elm.oldonchange) { 6150 elm.oldonchange = elm.onchange; 6151 elm.onchange = null; 6152 } 6265 _resetIframeHeight : function() { 6266 var ife; 6153 6267 6154 // Execute onchange and remove piggyback 6155 if (e.keyCode == 13 || e.keyCode == 32) { 6156 elm.onchange = elm.oldonchange; 6157 elm.onchange(); 6158 elm.oldonchange = null; 6268 if (tinyMCE.isRealIE) { 6269 ife = tinyMCE.selectedInstance.iframeElement; 6159 6270 6160 tinyMCE.cancelEvent(e); 6161 return false; 6162 } 6271 /* if (ife._oldWidth) { 6272 ife.style.width = ife._oldWidth; 6273 ife.width = ife._oldWidth; 6274 }*/ 6163 6275 6164 return true; 6165 }; 6166 6167 TinyMCE_Engine.prototype._resetIframeHeight = function() { 6168 var ife; 6169 6170 if (tinyMCE.isRealIE) { 6171 ife = tinyMCE.selectedInstance.iframeElement; 6172 6173 /* if (ife._oldWidth) { 6174 ife.style.width = ife._oldWidth; 6175 ife.width = ife._oldWidth; 6176 }*/ 6177 6178 if (ife._oldHeight) { 6179 ife.style.height = ife._oldHeight; 6180 ife.height = ife._oldHeight; 6276 if (ife._oldHeight) { 6277 ife.style.height = ife._oldHeight; 6278 ife.height = ife._oldHeight; 6279 } 6181 6280 } 6182 6281 } 6183 };6184 6282 6283 }); 6284 6185 6285 /* file:jscripts/tiny_mce/classes/TinyMCE_Selection.class.js */ 6186 6286 6187 6287 function TinyMCE_Selection(inst) { … … 6190 6290 6191 6291 TinyMCE_Selection.prototype = { 6192 6292 getSelectedHTML : function() { 6193 var inst = this.instance; 6194 var e, r = this.getRng(), h; 6293 var inst = this.instance, e, r = this.getRng(), h; 6195 6294 6196 6295 if (!r) 6197 6296 return null; … … 6215 6314 }, 6216 6315 6217 6316 getSelectedText : function() { 6218 var inst = this.instance; 6219 var d, r, s, t; 6317 var inst = this.instance, d, r, s, t; 6220 6318 6221 6319 if (tinyMCE.isIE) { 6222 6320 d = inst.getDoc(); … … 6239 6337 }, 6240 6338 6241 6339 getBookmark : function(simple) { 6242 var inst = this.instance; 6243 var rng = this.getRng(); 6244 var doc = inst.getDoc(), b = inst.getBody(); 6340 var inst = this.instance, rng = this.getRng(), doc = inst.getDoc(), b = inst.getBody(); 6341 var trng, sx, sy, xx = -999999999, vp = inst.getViewPort(); 6245 6342 var sp, le, s, e, nl, i, si, ei, w; 6246 var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();6247 6343 6248 6344 sx = vp.left; 6249 6345 sy = vp.top; 6250 6346 6251 if ( tinyMCE.isSafari || tinyMCE.isOpera ||simple)6347 if (simple) 6252 6348 return {rng : rng, scrollX : sx, scrollY : sy}; 6253 6349 6254 if (tinyMCE.is IE) {6350 if (tinyMCE.isRealIE) { 6255 6351 if (rng.item) { 6256 6352 e = rng.item(0); 6257 6353 … … 6290 6386 scrollY : sy 6291 6387 }; 6292 6388 } 6293 } 6294 6295 if (tinyMCE.isGecko) { 6389 } else { 6296 6390 s = this.getSel(); 6297 6391 e = this.getFocusElement(); 6298 6392 … … 6349 6443 }, 6350 6444 6351 6445 moveToBookmark : function(bookmark) { 6352 var inst = this.instance; 6353 var rng, nl, i, ex, b = inst.getBody(), sd; 6354 var doc = inst.getDoc(); 6355 var win = inst.getWin(); 6356 var sel = this.getSel(); 6446 var inst = this.instance, rng, nl, i, ex, b = inst.getBody(), sd; 6447 var doc = inst.getDoc(), win = inst.getWin(), sel = this.getSel(); 6357 6448 6358 6449 if (!bookmark) 6359 6450 return false; 6360 6451 6361 if (tinyMCE.isSafari ) {6452 if (tinyMCE.isSafari && bookmark.rng) { 6362 6453 sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset); 6363 6454 return true; 6364 6455 } … … 6428 6519 rng.setEnd(sd.endNode, sd.endOffset); 6429 6520 sel.removeAllRanges(); 6430 6521 sel.addRange(rng); 6431 win.focus(); 6522 6523 if (!tinyMCE.isOpera) 6524 win.focus(); 6432 6525 } catch (ex) { 6433 6526 // Ignore 6434 6527 } … … 6549 6642 6550 6643 if (select_text_node) { 6551 6644 // Find first textnode in tree 6552 nodes = tinyMCE.getNodeTree(node, new Array(), 3);6645 nodes = tinyMCE.getNodeTree(node, [], 3); 6553 6646 if (nodes.length > 0) 6554 6647 rng.selectNodeContents(nodes[0]); 6555 6648 else … … 6706 6799 6707 6800 function TinyMCE_UndoRedo(inst) { 6708 6801 this.instance = inst; 6709 this.undoLevels = new Array();6802 this.undoLevels = []; 6710 6803 this.undoIndex = 0; 6711 6804 this.typingUndoIndex = -1; 6712 6805 this.undoRedo = true; … … 6732 6825 if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) { 6733 6826 //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content); 6734 6827 6828 // Is dirty again 6829 inst.isNotDirty = false; 6830 6735 6831 tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst); 6736 6832 6737 6833 // Time to compress 6738 customUndoLevels = tinyMCE.settings ['custom_undo_redo_levels'];6834 customUndoLevels = tinyMCE.settings.custom_undo_redo_levels; 6739 6835 if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) { 6740 6836 for (i=0; i<this.undoLevels.length-1; i++) 6741 6837 this.undoLevels[i] = this.undoLevels[i+1]; … … 6822 6918 var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0); 6823 6919 var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock; 6824 6920 var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null; 6825 var paraBefore, paraAfter, startChop, endChop, contents ;6921 var paraBefore, paraAfter, startChop, endChop, contents, i; 6826 6922 6827 6923 function isEmpty(para) { 6924 var nodes; 6925 6828 6926 function isEmptyHTML(html) { 6829 return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == "";6927 return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ''; 6830 6928 } 6831 6929 6832 6930 // Check for images … … 6842 6940 return false; 6843 6941 6844 6942 // Check all textnodes 6845 var nodes = tinyMCE.getNodeTree(para, new Array(), 3);6846 for ( vari=0; i<nodes.length; i++) {6943 nodes = tinyMCE.getNodeTree(para, [], 3); 6944 for (i=0; i<nodes.length; i++) { 6847 6945 if (!isEmptyHTML(nodes[i].nodeValue)) 6848 6946 return false; 6849 6947 } … … 6881 6979 endBlock = inst.getParentBlockElement(endNode); 6882 6980 6883 6981 // If absolute force paragraph generation within 6884 if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position))6982 if (startBlock && (startBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(startBlock.style.position))) 6885 6983 startBlock = null; 6886 6984 6887 if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position))6985 if (endBlock && (endBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(endBlock.style.position))) 6888 6986 endBlock = null; 6889 6987 6890 6988 // Use current block name … … 6892 6990 blockName = startBlock.nodeName; 6893 6991 6894 6992 // Use P instead 6895 if ( blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat)))6993 if (/(TD|TABLE|TH|CAPTION)/.test(blockName) || (blockName == "DIV" && /left|right/gi.test(startBlock.style.cssFloat))) 6896 6994 blockName = "P"; 6897 6995 } 6898 6996 … … 7031 7129 7032 7130 if (contents.firstChild && contents.firstChild.nodeName == blockName) { 7033 7131 /* var nodes = contents.firstChild.childNodes; 7034 for ( vari=0; i<nodes.length; i++) {7132 for (i=0; i<nodes.length; i++) { 7035 7133 //tinyMCE.debug(nodes[i].nodeName); 7036 7134 if (nodes[i].nodeName != "BODY") 7037 7135 paraAfter.appendChild(nodes[i]); … … 7126 7224 7127 7225 TinyMCE_Layer.prototype = { 7128 7226 moveRelativeTo : function(re, p) { 7129 var rep = this.getAbsPosition(re); 7130 var w = parseInt(re.offsetWidth); 7131 var h = parseInt(re.offsetHeight); 7132 var e = this.getElement(); 7133 var ew = parseInt(e.offsetWidth); 7134 var eh = parseInt(e.offsetHeight); 7135 var x, y; 7227 var rep = this.getAbsPosition(re), e = this.getElement(), x, y; 7228 var w = parseInt(re.offsetWidth), h = parseInt(re.offsetHeight); 7229 var ew = parseInt(e.offsetWidth), eh = parseInt(e.offsetHeight); 7136 7230 7137 7231 switch (p) { 7138 7232 case "tl": … … 7342 7436 TinyMCE_Layer.call(this, id, true); 7343 7437 7344 7438 this.id = id; 7345 this.items = new Array();7439 this.items = []; 7346 7440 this.needsUpdate = true; 7347 7441 }; 7348 7442 … … 7366 7460 }, 7367 7461 7368 7462 clear : function() { 7369 this.items = new Array();7463 this.items = []; 7370 7464 }, 7371 7465 7372 7466 addTitle : function(t) { … … 7456 7550 7457 7551 }); 7458 7552 7459 /* file:jscripts/tiny_mce/classes/TinyMCE_ Compatibility.class.js */7553 /* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */ 7460 7554 7461 if (!Function.prototype.call){7462 Function.prototype.call =function() {7463 var a = arguments, s = a[0], i, as = '', r, o;7555 tinyMCE.add(TinyMCE_Engine, { 7556 debug : function() { 7557 var m = "", a, i, l = tinyMCE.log.length; 7464 7558 7465 for (i= 1; i<a.length; i++)7466 as += (i > 1 ? ',' : '') + 'a[' + i + ']';7559 for (i=0, a = this.debug.arguments; i<a.length; i++) { 7560 m += a[i]; 7467 7561 7468 o = s._fu; 7469 s._fu = this; 7470 r = eval('s._fu(' + as + ')'); 7471 s._fu = o; 7562 if (i<a.length-1) 7563 m += ', '; 7564 } 7472 7565 7473 return r; 7474 }; 7475 }; 7476 7477 /* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */ 7478 7479 TinyMCE_Engine.prototype.debug = function() { 7480 var m = "", a, i, l = tinyMCE.log.length; 7481 7482 for (i=0, a = this.debug.arguments; i<a.length; i++) { 7483 m += a[i]; 7484 7485 if (i<a.length-1) 7486 m += ', '; 7566 if (l < 1000) 7567 tinyMCE.log[l] = "[debug] " + m; 7487 7568 } 7488 7569 7489 if (l < 1000) 7490 tinyMCE.log[l] = "[debug] " + m; 7491 }; 7570 }); 7492 7571 -
wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js
153 153 154 154 for (i=0; i<colors.length; i++) { 155 155 h += '<td bgcolor="' + colors[i] + '">' 156 + '<a href="javascript: selectColor();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'156 + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">' 157 157 + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>'; 158 158 if ((i+1) % 18 == 0) 159 159 h += '</tr><tr>'; … … 173 173 174 174 for (n in named) { 175 175 v = named[n]; 176 h += '<a href="javascript: selectColor();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'176 h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>' 177 177 } 178 178 179 179 el.innerHTML = h; 180 180 el.className = 'generated'; 181 181 } 182 182 183 function selectColor() {184 var color = document.getElementById("color").value;185 186 if(window.opener)187 window.opener.tinyMCE.execInstanceCommand(tinyMCE.getWindowArg('editor_id'),tinyMCE.getWindowArg('command'),false,color);188 189 window.close();190 }191 192 183 function dechex(n) { 193 184 return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); 194 185 } -
wp-includes/js/tinymce/themes/advanced/jscripts/link.js
24 24 if (option.value == tinyMCE.getWindowArg('target')) 25 25 option.selected = true; 26 26 } 27 27 28 // WordPress -- next 3 lines 28 29 document.forms[0].href.value = tinyMCE.getWindowArg('href') || 'http://'; 29 30 document.forms[0].href.select(); 30 31 document.forms[0].href.focus(); 32 31 33 document.forms[0].linktitle.value = tinyMCE.getWindowArg('title'); 32 34 document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true); 33 35 … … 52 54 } 53 55 } 54 56 57 function checkPrefix(n) { 58 if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email'))) 59 n.value = 'mailto:' + n.value; 60 61 if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external'))) 62 n.value = 'http://' + n.value; 63 } 64 55 65 function insertLink() { 56 66 var href = document.forms[0].href.value; 57 67 var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value; … … 61 71 62 72 // WordPress: Make anchors absolute; 63 73 if (href.charAt(0) == '#') 64 href = tinyMCE.settings ['document_base_url']+ href;74 href = tinyMCE.settings.document_base_url + href; 65 75 66 76 if (target == '_self') 67 77 target = ''; -
wp-includes/js/tinymce/themes/advanced/langs/en.js
82 82 more_colors : 'More colors', 83 83 color_picker_tab : 'Picker', 84 84 color_picker : 'Color picker', 85 web_colors_tab : ' Web safe',86 web_colors : ' Web safe colors',85 web_colors_tab : 'Palette', 86 web_colors : 'Palette colors', 87 87 named_colors_tab : 'Named', 88 88 named_colors : 'Named colors', 89 89 color : 'Color:', 90 color_name : 'Name:' 90 color_name : 'Name:', 91 is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?', 92 is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?' 91 93 }); -
wp-includes/js/tinymce/themes/advanced/link.htm
4 4 <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> 5 5 <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script> 6 6 <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script> 7 <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script> 7 8 <script language="javascript" type="text/javascript" src="jscripts/link.js"></script> 8 9 <base target="_self" /> 9 10 </head> 11 <!-- WordPress: onload after the init();'); --> 10 12 <body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('href').focus();" style="display: none"> 11 13 <form onsubmit="insertLink();return false;" action="#"> 12 14 <div class="tabs"> … … 23 25 <td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td> 24 26 <td><table border="0" cellspacing="0" cellpadding="0"> 25 27 <tr> 26 <td><input id="href" name="href" type="text" value="" style="width: 200px" /></td>28 <td><input id="href" name="href" type="text" value="" style="width: 200px" onchange="checkPrefix(this);" /></td> 27 29 <td id="hrefbrowsercontainer"> </td> 28 30 </tr> 29 31 </table></td> … … 87 89 </div> 88 90 89 91 <div class="mceActionPanel"> 92 <!-- WordPress: Buttons are reversed! --> 90 93 <div style="float: left"> 91 94 <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" /> 92 95 </div> 93 96 94 97 <div style="float: right"> 95 <input type=" submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" />98 <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" /> 96 99 </div> 97 100 </div> 98 101 </form> -
wp-includes/js/tinymce/themes/advanced/css/editor_popup.css
355 355 356 356 #styleSelectRow { 357 357 display: none; 358 } 358 } 359 No newline at end of file -
wp-includes/js/tinymce/themes/advanced/image.htm
7 7 <script language="javascript" type="text/javascript" src="jscripts/image.js"></script> 8 8 <base target="_self" /> 9 9 </head> 10 <!-- WordPress: extra onload stuff is WP --> 10 11 <body id="image" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('src').focus();" style="display: none"> 11 12 <form onsubmit="insertImage();return false;" action="#"> 12 13 <div class="tabs"> … … 22 23 <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td> 23 24 <td><table border="0" cellspacing="0" cellpadding="0"> 24 25 <tr> 25 <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" ></td>26 <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td> 26 27 <td id="srcbrowsercontainer"> </td> 27 28 </tr> 28 29 </table></td> … … 47 48 <!-- /Image list --> 48 49 <tr> 49 50 <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td> 50 <td><input id="alt" name="alt" type="text" value="" style="width: 200px" ></td>51 <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td> 51 52 </tr> 52 53 <tr> 53 54 <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td> … … 66 67 </tr> 67 68 <tr> 68 69 <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td> 69 <td><input id="width" name="width" type="text" value="" size=" 4" maxlength="4">70 <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" /> 70 71 x 71 <input id="height" name="height" type="text" value="" size=" 4" maxlength="4"></td>72 <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td> 72 73 </tr> 73 74 <tr> 74 75 <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td> 75 <td><input id="border" name="border" type="text" value="" size=" 4" maxlength="4"></td>76 <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td> 76 77 </tr> 77 78 <tr> 78 79 <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td> 79 <td><input id="vspace" name="vspace" type="text" value="" size=" 4" maxlength="4"></td>80 <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td> 80 81 </tr> 81 82 <tr> 82 83 <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td> 83 <td><input id="hspace" name="hspace" type="text" value="" size=" 4" maxlength="4"></td>84 <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td> 84 85 </tr> 85 86 </table> 86 87 </div> 87 88 </div> 88 89 89 90 <div class="mceActionPanel"> 91 <!-- WordPress: buttons reversed! --> 90 92 <div style="float: left"> 91 93 <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" /> 92 94 </div> 93 95 94 96 <div style="float: right"> 95 <input type=" submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />97 <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" /> 96 98 </div> 97 99 </div> 98 100 </form> -
wp-includes/js/tinymce/themes/advanced/editor_template.js
1 1 /** 2 * $Id: editor_template_src.js 2 18 2007-02-13 11:08:01Z spocke $2 * $Id: editor_template_src.js 256 2007-04-24 09:03:20Z spocke $ 3 3 * 4 4 * @author Moxiecode 5 5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. … … 140 140 141 141 case "|": 142 142 case "separator": 143 return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';143 return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />'; 144 144 145 145 case "spacer": 146 return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';146 return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />'; 147 147 148 148 case "rowseparator": 149 149 return '<br />'; … … 1242 1242 1243 1243 if (set_w) 1244 1244 tableElm.style.width = w + "px"; 1245 1245 1246 1246 if ( !tinyMCE.isMSIE || tinyMCE.isMSIE7 || tinyMCE.isOpera ) // WordPress: do this later to avoid creeping toolbar bug in MSIE6 1247 1247 tableElm.style.height = h + "px"; 1248 1248 … … 1251 1251 1252 1252 iw = iw < 1 ? 30 : iw; 1253 1253 ih = ih < 1 ? 30 : ih; 1254 1255 /* WordPress found that this led to a shrinking editor with every resize.(Gray background creeps in 1px at a time.)1254 /* WordPress: found that this led to a shrinking editor with every resize. 1255 (Gray background creeps in 1px at a time.) 1256 1256 if (tinyMCE.isGecko) { 1257 1257 iw -= 2; 1258 1258 ih -= 2; … … 1274 1274 inst.iframeElement.style.width = (iw + dx) + "px"; 1275 1275 } 1276 1276 } 1277 1277 1278 1278 tableElm.style.height = h + "px"; // WordPress: see above 1279 1279 1280 1280 // Remove pesky table controls … … 1404 1404 h += '</tr></table>'; 1405 1405 1406 1406 if (tinyMCE.getParam("theme_advanced_more_colors", true)) 1407 h += '<a href=" #" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>';1407 h += '<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>'; 1408 1408 1409 1409 return h; 1410 1410 }, … … 1424 1424 }, 1425 1425 1426 1426 _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { 1427 tinyMCE.execCommand('mceBeginUndoLevel'); 1428 1429 if (src == "") 1430 return; 1431 1432 if (!tinyMCE.imgElement && tinyMCE.isSafari) { 1433 var html = ""; 1434 1435 html += '<img src="' + src + '" alt="' + alt + '"'; 1436 html += ' border="' + border + '" hspace="' + hspace + '"'; 1437 html += ' vspace="' + vspace + '" width="' + width + '"'; 1438 html += ' height="' + height + '" align="' + align + '" title="' + title + '" onmouseover="' + onmouseover + '" onmouseout="' + onmouseout + '" />'; 1439 1440 tinyMCE.execCommand("mceInsertContent", false, html); 1441 } else { 1442 if (!tinyMCE.imgElement && tinyMCE.selectedInstance) { 1443 if (tinyMCE.isSafari) 1444 tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />'); 1445 else 1446 tinyMCE.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL); 1447 1448 tinyMCE.imgElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL); 1449 } 1450 } 1451 1452 if (tinyMCE.imgElement) { 1453 var needsRepaint = false; 1454 var msrc = src; 1455 1456 src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, tinyMCE.imgElement);"); 1457 1458 if (tinyMCE.getParam('convert_urls')) 1459 msrc = src; 1460 1461 if (onmouseover && onmouseover != "") 1462 onmouseover = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, tinyMCE.imgElement);") + "';"; 1463 1464 if (onmouseout && onmouseout != "") 1465 onmouseout = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, tinyMCE.imgElement);") + "';"; 1466 1467 // Use alt as title if it's undefined 1468 if (typeof(title) == "undefined") 1469 title = alt; 1470 1471 if (width != tinyMCE.imgElement.getAttribute("width") || height != tinyMCE.imgElement.getAttribute("height") || align != tinyMCE.imgElement.getAttribute("align")) 1472 needsRepaint = true; 1473 1474 tinyMCE.setAttrib(tinyMCE.imgElement, 'src', src); 1475 tinyMCE.setAttrib(tinyMCE.imgElement, 'mce_src', msrc); 1476 tinyMCE.setAttrib(tinyMCE.imgElement, 'alt', alt); 1477 tinyMCE.setAttrib(tinyMCE.imgElement, 'title', title); 1478 tinyMCE.setAttrib(tinyMCE.imgElement, 'align', align); 1479 tinyMCE.setAttrib(tinyMCE.imgElement, 'border', border, true); 1480 tinyMCE.setAttrib(tinyMCE.imgElement, 'hspace', hspace, true); 1481 tinyMCE.setAttrib(tinyMCE.imgElement, 'vspace', vspace, true); 1482 tinyMCE.setAttrib(tinyMCE.imgElement, 'width', width, true); 1483 tinyMCE.setAttrib(tinyMCE.imgElement, 'height', height, true); 1484 tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseover', onmouseover); 1485 tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseout', onmouseout); 1486 1487 // Fix for bug #989846 - Image resize bug 1488 if (width && width != "") 1489 tinyMCE.imgElement.style.pixelWidth = width; 1490 1491 if (height && height != "") 1492 tinyMCE.imgElement.style.pixelHeight = height; 1493 1494 if (needsRepaint) 1495 tinyMCE.selectedInstance.repaint(); 1496 } 1497 1498 tinyMCE.execCommand('mceEndUndoLevel'); 1427 tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', { 1428 src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute 1429 mce_src : src, 1430 alt : alt, 1431 border : border, 1432 hspace : hspace, 1433 vspace : vspace, 1434 width : width, 1435 height : height, 1436 align : align, 1437 title : title, 1438 onmouseover : onmouseover, 1439 onmouseout : onmouseout 1440 })); 1499 1441 }, 1500 1442 1501 1443 _insertLink : function(href, target, title, onclick, style_class) { -
wp-includes/js/tinymce/themes/advanced/source_editor.htm
6 6 <script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script> 7 7 <base target="_self" /> 8 8 </head> 9 <!-- WordPress: extra onload stuff is WP! --> 9 10 <body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.body.style.display='';document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none"> 10 11 <form name="source" onsubmit="saveContent();" action="#"> 11 12 <div style="float: left" class="title">{$lang_theme_code_title}</div> … … 16 17 17 18 <br style="clear: both" /> 18 19 19 <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono ; font-size: 12px" dir="ltr" wrap="off"></textarea>20 <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px" dir="ltr" wrap="off"></textarea> 20 21 21 22 <div class="mceActionPanel"> 23 <!-- WordPress: reversed buttons! --> 22 24 <div style="float: left"> 23 25 <input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> 24 26 </div> 25 27 26 28 <div style="float: right"> 27 <input type=" submit" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" />29 <input type="button" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" /> 28 30 </div> 29 31 </div> 30 32 </form> -
wp-includes/js/tinymce/license.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2 <html xmlns="http://www.w3.org/1999/xhtml">3 <head>4 <title>TinyMCE License (LGPL)</title>5 <link href="css/screen.css" rel="stylesheet" type="text/css" />6 </head>7 <body>8 9 <div class="header">10 <h1>TinyMCE License (LGPL)</h1>11 </div>12 13 <div class="content">14 <p>15 Visit the <a href="faq.html">FAQ</a> for general answers surrounding TinyMCE. Or visit <a href="http://www.fsf.org" target="_blank">http://www.fsf.org</a> for more information about Open-Source licenses.16 </p>17 <pre>18 GNU LIBRARY GENERAL PUBLIC LICENSE19 Version 2, June 199120 21 Copyright (C) 1991 Free Software Foundation, Inc.22 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 Everyone is permitted to copy and distribute verbatim copies24 of this license document, but changing it is not allowed.25 26 [This is the first released version of the library GPL. It is27 numbered 2 because it goes with version 2 of the ordinary GPL.]28 29 Preamble30 31 The licenses for most software are designed to take away your32 freedom to share and change it. By contrast, the GNU General Public33 Licenses are intended to guarantee your freedom to share and change34 free software--to make sure the software is free for all its users.35 36 This license, the Library General Public License, applies to some37 specially designated Free Software Foundation software, and to any38 other libraries whose authors decide to use it. You can use it for39 your libraries, too.40 41 When we speak of free software, we are referring to freedom, not42 price. Our General Public Licenses are designed to make sure that you43 have the freedom to distribute copies of free software (and charge for44 this service if you wish), that you receive source code or can get it45 if you want it, that you can change the software or use pieces of it46 in new free programs; and that you know you can do these things.47 48 To protect your rights, we need to make restrictions that forbid49 anyone to deny you these rights or to ask you to surrender the rights.50 These restrictions translate to certain responsibilities for you if51 you distribute copies of the library, or if you modify it.52 53 For example, if you distribute copies of the library, whether gratis54 or for a fee, you must give the recipients all the rights that we gave55 you. You must make sure that they, too, receive or can get the source56 code. If you link a program with the library, you must provide57 complete object files to the recipients so that they can relink them58 with the library, after making changes to the library and recompiling59 it. And you must show them these terms so they know their rights.60 61 Our method of protecting your rights has two steps: (1) copyright62 the library, and (2) offer you this license which gives you legal63 permission to copy, distribute and/or modify the library.64 65 Also, for each distributor's protection, we want to make certain66 that everyone understands that there is no warranty for this free67 library. If the library is modified by someone else and passed on, we68 want its recipients to know that what they have is not the original69 version, so that any problems introduced by others will not reflect on70 the original authors' reputations.71 .72 Finally, any free program is threatened constantly by software73 patents. We wish to avoid the danger that companies distributing free74 software will individually obtain patent licenses, thus in effect75 transforming the program into proprietary software. To prevent this,76 we have made it clear that any patent must be licensed for everyone's77 free use or not licensed at all.78 79 Most GNU software, including some libraries, is covered by the ordinary80 GNU General Public License, which was designed for utility programs. This81 license, the GNU Library General Public License, applies to certain82 designated libraries. This license is quite different from the ordinary83 one; be sure to read it in full, and don't assume that anything in it is84 the same as in the ordinary license.85 86 The reason we have a separate public license for some libraries is that87 they blur the distinction we usually make between modifying or adding to a88 program and simply using it. Linking a program with a library, without89 changing the library, is in some sense simply using the library, and is90 analogous to running a utility program or application program. However, in91 a textual and legal sense, the linked executable is a combined work, a92 derivative of the original library, and the ordinary General Public License93 treats it as such.94 95 Because of this blurred distinction, using the ordinary General96 Public License for libraries did not effectively promote software97 sharing, because most developers did not use the libraries. We98 concluded that weaker conditions might promote sharing better.99 100 However, unrestricted linking of non-free programs would deprive the101 users of those programs of all benefit from the free status of the102 libraries themselves. This Library General Public License is intended to103 permit developers of non-free programs to use free libraries, while104 preserving your freedom as a user of such programs to change the free105 libraries that are incorporated in them. (We have not seen how to achieve106 this as regards changes in header files, but we have achieved it as regards107 changes in the actual functions of the Library.) The hope is that this108 will lead to faster development of free libraries.109 110 The precise terms and conditions for copying, distribution and111 modification follow. Pay close attention to the difference between a112 "work based on the library" and a "work that uses the library". The113 former contains code derived from the library, while the latter only114 works together with the library.115 116 Note that it is possible for a library to be covered by the ordinary117 General Public License rather than by this special one.118 .119 GNU LIBRARY GENERAL PUBLIC LICENSE120 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION121 122 0. This License Agreement applies to any software library which123 contains a notice placed by the copyright holder or other authorized124 party saying it may be distributed under the terms of this Library125 General Public License (also called "this License"). Each licensee is126 addressed as "you".127 128 A "library" means a collection of software functions and/or data129 prepared so as to be conveniently linked with application programs130 (which use some of those functions and data) to form executables.131 132 The "Library", below, refers to any such software library or work133 which has been distributed under these terms. A "work based on the134 Library" means either the Library or any derivative work under135 copyright law: that is to say, a work containing the Library or a136 portion of it, either verbatim or with modifications and/or translated137 straightforwardly into another language. (Hereinafter, translation is138 included without limitation in the term "modification".)139 140 "Source code" for a work means the preferred form of the work for141 making modifications to it. For a library, complete source code means142 all the source code for all modules it contains, plus any associated143 interface definition files, plus the scripts used to control compilation144 and installation of the library.145 146 Activities other than copying, distribution and modification are not147 covered by this License; they are outside its scope. The act of148 running a program using the Library is not restricted, and output from149 such a program is covered only if its contents constitute a work based150 on the Library (independent of the use of the Library in a tool for151 writing it). Whether that is true depends on what the Library does152 and what the program that uses the Library does.153 154 1. You may copy and distribute verbatim copies of the Library's155 complete source code as you receive it, in any medium, provided that156 you conspicuously and appropriately publish on each copy an157 appropriate copyright notice and disclaimer of warranty; keep intact158 all the notices that refer to this License and to the absence of any159 warranty; and distribute a copy of this License along with the160 Library.161 162 You may charge a fee for the physical act of transferring a copy,163 and you may at your option offer warranty protection in exchange for a164 fee.165 .166 2. You may modify your copy or copies of the Library or any portion167 of it, thus forming a work based on the Library, and copy and168 distribute such modifications or work under the terms of Section 1169 above, provided that you also meet all of these conditions:170 171 a) The modified work must itself be a software library.172 173 b) You must cause the files modified to carry prominent notices174 stating that you changed the files and the date of any change.175 176 c) You must cause the whole of the work to be licensed at no177 charge to all third parties under the terms of this License.178 179 d) If a facility in the modified Library refers to a function or a180 table of data to be supplied by an application program that uses181 the facility, other than as an argument passed when the facility182 is invoked, then you must make a good faith effort to ensure that,183 in the event an application does not supply such function or184 table, the facility still operates, and performs whatever part of185 its purpose remains meaningful.186 187 (For example, a function in a library to compute square roots has188 a purpose that is entirely well-defined independent of the189 application. Therefore, Subsection 2d requires that any190 application-supplied function or table used by this function must191 be optional: if the application does not supply it, the square192 root function must still compute square roots.)193 194 These requirements apply to the modified work as a whole. If195 identifiable sections of that work are not derived from the Library,196 and can be reasonably considered independent and separate works in197 themselves, then this License, and its terms, do not apply to those198 sections when you distribute them as separate works. But when you199 distribute the same sections as part of a whole which is a work based200 on the Library, the distribution of the whole must be on the terms of201 this License, whose permissions for other licensees extend to the202 entire whole, and thus to each and every part regardless of who wrote203 it.204 205 Thus, it is not the intent of this section to claim rights or contest206 your rights to work written entirely by you; rather, the intent is to207 exercise the right to control the distribution of derivative or208 collective works based on the Library.209 210 In addition, mere aggregation of another work not based on the Library211 with the Library (or with a work based on the Library) on a volume of212 a storage or distribution medium does not bring the other work under213 the scope of this License.214 215 3. You may opt to apply the terms of the ordinary GNU General Public216 License instead of this License to a given copy of the Library. To do217 this, you must alter all the notices that refer to this License, so218 that they refer to the ordinary GNU General Public License, version 2,219 instead of to this License. (If a newer version than version 2 of the220 ordinary GNU General Public License has appeared, then you can specify221 that version instead if you wish.) Do not make any other change in222 these notices.223 .224 Once this change is made in a given copy, it is irreversible for225 that copy, so the ordinary GNU General Public License applies to all226 subsequent copies and derivative works made from that copy.227 228 This option is useful when you wish to copy part of the code of229 the Library into a program that is not a library.230 231 4. You may copy and distribute the Library (or a portion or232 derivative of it, under Section 2) in object code or executable form233 under the terms of Sections 1 and 2 above provided that you accompany234 it with the complete corresponding machine-readable source code, which235 must be distributed under the terms of Sections 1 and 2 above on a236 medium customarily used for software interchange.237 238 If distribution of object code is made by offering access to copy239 from a designated place, then offering equivalent access to copy the240 source code from the same place satisfies the requirement to241 distribute the source code, even though third parties are not242 compelled to copy the source along with the object code.243 244 5. A program that contains no derivative of any portion of the245 Library, but is designed to work with the Library by being compiled or246 linked with it, is called a "work that uses the Library". Such a247 work, in isolation, is not a derivative work of the Library, and248 therefore falls outside the scope of this License.249 250 However, linking a "work that uses the Library" with the Library251 creates an executable that is a derivative of the Library (because it252 contains portions of the Library), rather than a "work that uses the253 library". The executable is therefore covered by this License.254 Section 6 states terms for distribution of such executables.255 256 When a "work that uses the Library" uses material from a header file257 that is part of the Library, the object code for the work may be a258 derivative work of the Library even though the source code is not.259 Whether this is true is especially significant if the work can be260 linked without the Library, or if the work is itself a library. The261 threshold for this to be true is not precisely defined by law.262 263 If such an object file uses only numerical parameters, data264 structure layouts and accessors, and small macros and small inline265 functions (ten lines or less in length), then the use of the object266 file is unrestricted, regardless of whether it is legally a derivative267 work. (Executables containing this object code plus portions of the268 Library will still fall under Section 6.)269 270 Otherwise, if the work is a derivative of the Library, you may271 distribute the object code for the work under the terms of Section 6.272 Any executables containing that work also fall under Section 6,273 whether or not they are linked directly with the Library itself.274 .275 6. As an exception to the Sections above, you may also compile or276 link a "work that uses the Library" with the Library to produce a277 work containing portions of the Library, and distribute that work278 under terms of your choice, provided that the terms permit279 modification of the work for the customer's own use and reverse280 engineering for debugging such modifications.281 282 You must give prominent notice with each copy of the work that the283 Library is used in it and that the Library and its use are covered by284 this License. You must supply a copy of this License. If the work285 during execution displays copyright notices, you must include the286 copyright notice for the Library among them, as well as a reference287 directing the user to the copy of this License. Also, you must do one288 of these things:289 290 a) Accompany the work with the complete corresponding291 machine-readable source code for the Library including whatever292 changes were used in the work (which must be distributed under293 Sections 1 and 2 above); and, if the work is an executable linked294 with the Library, with the complete machine-readable "work that295 uses the Library", as object code and/or source code, so that the296 user can modify the Library and then relink to produce a modified297 executable containing the modified Library. (It is understood298 that the user who changes the contents of definitions files in the299 Library will not necessarily be able to recompile the application300 to use the modified definitions.)301 302 b) Accompany the work with a written offer, valid for at303 least three years, to give the same user the materials304 specified in Subsection 6a, above, for a charge no more305 than the cost of performing this distribution.306 307 c) If distribution of the work is made by offering access to copy308 from a designated place, offer equivalent access to copy the above309 specified materials from the same place.310 311 d) Verify that the user has already received a copy of these312 materials or that you have already sent this user a copy.313 314 For an executable, the required form of the "work that uses the315 Library" must include any data and utility programs needed for316 reproducing the executable from it. However, as a special exception,317 the source code distributed need not include anything that is normally318 distributed (in either source or binary form) with the major319 components (compiler, kernel, and so on) of the operating system on320 which the executable runs, unless that component itself accompanies321 the executable.322 323 It may happen that this requirement contradicts the license324 restrictions of other proprietary libraries that do not normally325 accompany the operating system. Such a contradiction means you cannot326 use both them and the Library together in an executable that you327 distribute.328 .329 7. You may place library facilities that are a work based on the330 Library side-by-side in a single library together with other library331 facilities not covered by this License, and distribute such a combined332 library, provided that the separate distribution of the work based on333 the Library and of the other library facilities is otherwise334 permitted, and provided that you do these two things:335 336 a) Accompany the combined library with a copy of the same work337 based on the Library, uncombined with any other library338 facilities. This must be distributed under the terms of the339 Sections above.340 341 b) Give prominent notice with the combined library of the fact342 that part of it is a work based on the Library, and explaining343 where to find the accompanying uncombined form of the same work.344 345 8. You may not copy, modify, sublicense, link with, or distribute346 the Library except as expressly provided under this License. Any347 attempt otherwise to copy, modify, sublicense, link with, or348 distribute the Library is void, and will automatically terminate your349 rights under this License. However, parties who have received copies,350 or rights, from you under this License will not have their licenses351 terminated so long as such parties remain in full compliance.352 353 9. You are not required to accept this License, since you have not354 signed it. However, nothing else grants you permission to modify or355 distribute the Library or its derivative works. These actions are356 prohibited by law if you do not accept this License. Therefore, by357 modifying or distributing the Library (or any work based on the358 Library), you indicate your acceptance of this License to do so, and359 all its terms and conditions for copying, distributing or modifying360 the Library or works based on it.361 362 10. Each time you redistribute the Library (or any work based on the363 Library), the recipient automatically receives a license from the364 original licensor to copy, distribute, link with or modify the Library365 subject to these terms and conditions. You may not impose any further366 restrictions on the recipients' exercise of the rights granted herein.367 You are not responsible for enforcing compliance by third parties to368 this License.369 .370 11. If, as a consequence of a court judgment or allegation of patent371 infringement or for any other reason (not limited to patent issues),372 conditions are imposed on you (whether by court order, agreement or373 otherwise) that contradict the conditions of this License, they do not374 excuse you from the conditions of this License. If you cannot375 distribute so as to satisfy simultaneously your obligations under this376 License and any other pertinent obligations, then as a consequence you377 may not distribute the Library at all. For example, if a patent378 license would not permit royalty-free redistribution of the Library by379 all those who receive copies directly or indirectly through you, then380 the only way you could satisfy both it and this License would be to381 refrain entirely from distribution of the Library.382 383 If any portion of this section is held invalid or unenforceable under any384 particular circumstance, the balance of the section is intended to apply,385 and the section as a whole is intended to apply in other circumstances.386 387 It is not the purpose of this section to induce you to infringe any388 patents or other property right claims or to contest validity of any389 such claims; this section has the sole purpose of protecting the390 integrity of the free software distribution system which is391 implemented by public license practices. Many people have made392 generous contributions to the wide range of software distributed393 through that system in reliance on consistent application of that394 system; it is up to the author/donor to decide if he or she is willing395 to distribute software through any other system and a licensee cannot396 impose that choice.397 398 This section is intended to make thoroughly clear what is believed to399 be a consequence of the rest of this License.400 401 12. If the distribution and/or use of the Library is restricted in402 certain countries either by patents or by copyrighted interfaces, the403 original copyright holder who places the Library under this License may add404 an explicit geographical distribution limitation excluding those countries,405 so that distribution is permitted only in or among countries not thus406 excluded. In such case, this License incorporates the limitation as if407 written in the body of this License.408 409 13. The Free Software Foundation may publish revised and/or new410 versions of the Library General Public License from time to time.411 Such new versions will be similar in spirit to the present version,412 but may differ in detail to address new problems or concerns.413 414 Each version is given a distinguishing version number. If the Library415 specifies a version number of this License which applies to it and416 "any later version", you have the option of following the terms and417 conditions either of that version or of any later version published by418 the Free Software Foundation. If the Library does not specify a419 license version number, you may choose any version ever published by420 the Free Software Foundation.421 .422 14. If you wish to incorporate parts of the Library into other free423 programs whose distribution conditions are incompatible with these,424 write to the author to ask for permission. For software which is425 copyrighted by the Free Software Foundation, write to the Free426 Software Foundation; we sometimes make exceptions for this. Our427 decision will be guided by the two goals of preserving the free status428 of all derivatives of our free software and of promoting the sharing429 and reuse of software generally.430 431 NO WARRANTY432 433 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO434 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.435 EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR436 OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY437 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE438 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR439 PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE440 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME441 THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.442 443 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN444 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY445 AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU446 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR447 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE448 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING449 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A450 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF451 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH452 DAMAGES.453 454 END OF TERMS AND CONDITIONS455 </pre>456 </div>457 458 <div class="footer">459 <div class="helpindexlink"><a href="index.html">Index</a></div>460 <div class="copyright">Copyright © 2005 Moxiecode Systems AB</div>461 <br style="clear: both" />462 </div>463 464 </body>465 </html> -
wp-includes/js/tinymce/tiny_mce_popup.js
31 31 32 32 init : function() { 33 33 var win = window.opener ? window.opener : window.dialogArguments, c; 34 var inst ;34 var inst, re, title, divElm; 35 35 36 36 if (!win) 37 37 win = this.findWin(window); … … 61 61 inst.selectionBookmark = inst.selection.getBookmark(true); 62 62 63 63 // Setup dir 64 if (tinyMCELang ['lang_dir'])65 document.dir = tinyMCELang ['lang_dir'];64 if (tinyMCELang.lang_dir) 65 document.dir = tinyMCELang.lang_dir; 66 66 67 67 // Setup title 68 varre = new RegExp('{|\\\$|}', 'g');69 vartitle = document.title.replace(re, "");70 if (typeof tinyMCELang[title]!= "undefined") {71 vardivElm = document.createElement("div");68 re = new RegExp('{|\\\$|}', 'g'); 69 title = document.title.replace(re, ""); 70 if (typeof(tinyMCELang[title]) != "undefined") { 71 divElm = document.createElement("div"); 72 72 divElm.innerHTML = tinyMCELang[title]; 73 73 document.title = divElm.innerHTML; 74 74 75 if (t inyMCE.setWindowTitle != null)75 if (typeof(tinyMCE.setWindowTitle) != 'undefined') 76 76 tinyMCE.setWindowTitle(window, divElm.innerHTML); 77 77 } 78 78 … … 98 98 if (tinyMCE.getWindowArg('mce_replacevariables', true)) 99 99 body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs); 100 100 101 dir = tinyMCE.selectedInstance.settings ['directionality'];101 dir = tinyMCE.selectedInstance.settings.directionality; 102 102 if (dir == "rtl" && document.forms && document.forms.length > 0) { 103 103 elms = document.forms[0].elements; 104 104 for (i=0; i<elms.length; i++) { … … 111 111 body.style.display = 'block'; 112 112 113 113 // Execute real onload (Opera fix) 114 if (tinyMCEPopup.onLoadEval != "")114 if (tinyMCEPopup.onLoadEval !== '') 115 115 eval(tinyMCEPopup.onLoadEval); 116 116 }, 117 117 … … 123 123 }, 124 124 125 125 resizeToInnerSize : function() { 126 var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy; 127 126 128 // Netscape 7.1 workaround 127 129 if (this.isWindow && tinyMCE.isNS71) { 128 130 window.resizeBy(0, 10); … … 130 132 } 131 133 132 134 if (this.isWindow) { 133 var doc = document; 134 var body = doc.body; 135 var oldMargin, wrapper, iframe, nodes, dx, dy; 135 doc = document; 136 body = doc.body; 136 137 137 138 if (body.style.display == 'none') 138 139 body.style.display = 'block'; … … 149 150 150 151 // Wrap body elements 151 152 nodes = doc.body.childNodes; 152 for ( vari=nodes.length-1; i>=0; i--) {153 for (i=nodes.length-1; i>=0; i--) { 153 154 if (wrapper.hasChildNodes()) 154 155 wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); 155 156 else … … 164 165 // Create iframe 165 166 iframe = document.createElement("iframe"); 166 167 iframe.id = "mcWinIframe"; 167 iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings ['default_document'];168 iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document; 168 169 iframe.width = "100%"; 169 170 iframe.height = "100%"; 170 171 iframe.style.margin = '0'; … … 191 192 resizeToContent : function() { 192 193 var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); 193 194 var isOpera = (navigator.userAgent.indexOf("Opera") != -1); 195 var elm, width, height, x, y, dx, dy; 194 196 195 197 if (isOpera) 196 198 return; … … 198 200 if (isMSIE) { 199 201 try { window.resizeTo(10, 10); } catch (e) {} 200 202 201 varelm = document.body;202 varwidth = elm.offsetWidth;203 varheight = elm.offsetHeight;204 vardx = (elm.scrollWidth - width) + 4;205 vardy = elm.scrollHeight - height;203 elm = document.body; 204 width = elm.offsetWidth; 205 height = elm.offsetHeight; 206 dx = (elm.scrollWidth - width) + 4; 207 dy = elm.scrollHeight - height; 206 208 207 209 try { window.resizeBy(dx, dy); } catch (e) {} 208 210 } else { … … 211 213 window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); 212 214 window.sizeToContent(); 213 215 window.scrollTo(0, 0); 214 varx = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);215 vary = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);216 x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); 217 y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); 216 218 window.moveTo(x, y); 217 219 } 218 220 } … … 223 225 }, 224 226 225 227 restoreSelection : function() { 228 var inst; 229 226 230 if (this.storeSelection) { 227 varinst = tinyMCE.selectedInstance;231 inst = tinyMCE.selectedInstance; 228 232 229 233 inst.getWin().focus(); 230 234 … … 272 276 }, 273 277 274 278 importClass : function(c) { 279 var n; 280 275 281 window[c] = function() {}; 276 282 277 for ( varn in window.opener[c].prototype)283 for (n in window.opener[c].prototype) 278 284 window[c].prototype[n] = window.opener[c].prototype[n]; 279 285 280 286 window[c].constructor = window.opener[c].constructor; -
wp-includes/script-loader.php
31 31 32 32 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 33 33 34 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070 326' );34 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070520' ); 35 35 $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'), '20070 225' );36 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070520' ); 37 37 38 38 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1'); 39 39
