Ticket #3788: 3788.3.diff
File 3788.3.diff, 53.9 KB (added by , 18 years ago) |
---|
-
wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
1 1 /** 2 * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 3 3 * 4 4 * @author Moxiecode 5 5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. … … 14 14 longname : 'Directionality', 15 15 author : 'Moxiecode Systems AB', 16 16 authorurl : 'http://tinymce.moxiecode.com', 17 infourl : 'http:// tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',17 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', 18 18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 19 19 }; 20 20 }, -
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
1 1 /** 2 * $Id: editor_plugin_src.js 172 2007-01-09 11:37:11Z spocke $2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 3 3 * 4 4 * Moxiecode DHTML Windows script. 5 5 * … … 15 15 longname : 'Inline Popups', 16 16 author : 'Moxiecode Systems AB', 17 17 authorurl : 'http://tinymce.moxiecode.com', 18 infourl : 'http:// tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',18 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', 19 19 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 20 20 }; 21 21 } … … 26 26 // Patch openWindow, closeWindow TinyMCE functions 27 27 28 28 TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow; 29 TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; 29 30 30 31 TinyMCE_Engine.prototype.openWindow = function(template, args) { 31 32 // Does the caller support inline … … 52 53 if (!(height = parseInt(template['height']))) 53 54 height = 200; 54 55 56 if (!(minWidth = parseInt(template['minWidth']))) 57 minWidth = 100; 58 59 if (!(minHeight = parseInt(template['minHeight']))) 60 minHeight = 100; 61 55 62 resizable = (args && args['resizable']) ? args['resizable'] : "no"; 56 63 scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; 57 64 … … 76 83 pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2)); 77 84 pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2)); 78 85 79 url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; // WordPress cache buster 80 81 mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop); 86 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 ); 82 87 }; 83 88 84 TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;85 86 89 TinyMCE_Engine.prototype.closeWindow = function(win) { 87 if (mcWindows.selectedWindow != null) 88 mcWindows.selectedWindow.close(); 89 else 90 var gotit = false, n, w; 91 for (n in mcWindows.windows) { 92 w = mcWindows.windows[n]; 93 if (typeof(w) == 'function') continue; 94 if (win.name == w.id + '_iframe') { 95 w.close(); 96 gotit = true; 97 } 98 } 99 if (!gotit) 90 100 this.orgCloseWindow(win); 101 102 tinyMCE.selectedInstance.getWin().focus(); 91 103 }; 92 104 93 105 TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) { … … 135 147 136 148 this.addEvent(document, "mouseup", mcWindows.eventDispatcher); 137 149 150 this.addEvent(window, "resize", mcWindows.eventDispatcher); 151 this.addEvent(document, "scroll", mcWindows.eventDispatcher); 152 138 153 this.doc = document; 139 154 }; 140 155 156 TinyMCE_Windows.prototype.getBounds = function() { 157 if (!this.bounds) { 158 var vp = tinyMCE.getViewPort(window); 159 var top, left, bottom, right, docEl = this.doc.documentElement; 160 161 top = vp.top; 162 left = vp.left; 163 bottom = vp.height + top - 2; 164 right = vp.width + left - 22; // TODO this number is platform dependant 165 // x1, y1, x2, y2 166 this.bounds = [left, top, right, bottom]; 167 } 168 return this.bounds; 169 }; 170 171 TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) { 172 var bounds = this.getBounds(); 173 174 x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w); 175 y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h); 176 177 return this.clampBoxSize(x, y, w, h, minW, minH); 178 }; 179 180 TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) { 181 var bounds = this.getBounds(); 182 183 return [ 184 x, y, 185 Math.max(minW, Math.min(bounds[2], x + w) - x), 186 Math.max(minH, Math.min(bounds[3], y + h) - y) 187 ]; 188 }; 189 141 190 TinyMCE_Windows.prototype.getParam = function(name, default_value) { 142 191 var value = null; 143 192 … … 186 235 case "focus": 187 236 mcWindows.selectedWindow.onFocus(e); 188 237 break; 238 case "scroll": 239 case "resize": 240 if (mcWindows.clampUpdateTimeout) 241 clearTimeout(mcWindows.clampUpdateTimeout); 242 mcWindows.clampEventType = e.type; 243 mcWindows.clampUpdateTimeout = 244 setTimeout(function () {mcWindows.updateClamping()}, 100); 245 break; 189 246 } 190 247 }; 191 248 249 TinyMCE_Windows.prototype.updateClamping = function () { 250 var clamp, oversize, etype = mcWindows.clampEventType; 251 252 this.bounds = null; // Recalc window bounds on resize/scroll 253 this.clampUpdateTimeout = null; 254 255 for (var n in this.windows) { 256 win = this.windows[n]; 257 if (typeof(win) == 'function' || ! win.winElement) continue; 258 259 clamp = mcWindows.clampBoxPosition( 260 win.left, win.top, 261 win.winElement.scrollWidth, 262 win.winElement.scrollHeight, 263 win.features.minWidth, 264 win.features.minHeight 265 ); 266 oversize = ( 267 clamp[2] != win.winElement.scrollWidth || 268 clamp[3] != win.winElement.scrollHeight 269 ) ? true : false; 270 271 if (!oversize || win.features.resizable == "yes" || etype != "scroll") 272 win.moveTo(clamp[0], clamp[1]); 273 if (oversize && win.features.resizable == "yes") 274 win.resizeTo(clamp[2], clamp[3]); 275 } 276 }; 277 192 278 TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) { 193 279 if (this.isMSIE) 194 280 obj.attachEvent("on" + name, handler); 195 281 else 196 obj.addEventListener(name, handler, true);282 obj.addEventListener(name, handler, false); 197 283 }; 198 284 199 285 TinyMCE_Windows.prototype.cancelEvent = function(e) { … … 217 303 options['top'] = "10"; 218 304 options['width'] = "300"; 219 305 options['height'] = "300"; 306 options['minwidth'] = "100"; 307 options['minheight'] = "100"; 220 308 options['resizable'] = "yes"; 221 309 options['minimizable'] = "yes"; 222 310 options['maximizable'] = "yes"; … … 240 328 options['top'] = parseInt(options['top']); 241 329 options['width'] = parseInt(options['width']); 242 330 options['height'] = parseInt(options['height']); 331 options['minWidth'] = parseInt(options['minwidth']); 332 options['minHeight'] = parseInt(options['minheight']); 243 333 244 334 return options; 245 335 }; … … 253 343 254 344 features = this.parseFeatures(features); 255 345 346 // Clamp specified dimensions 347 var clamp = mcWindows.clampBoxPosition( 348 features['left'], features['top'], 349 features['width'], features['height'], 350 features['minWidth'], features['minHeight'] 351 ); 352 353 features['left'] = clamp[0]; 354 features['top'] = clamp[1]; 355 356 if (features['resizable'] == "yes") { 357 features['width'] = clamp[2]; 358 features['height'] = clamp[3]; 359 } 360 256 361 // Create div 257 362 id = "mcWindow_" + name; 258 363 win.deltaHeight = 18; … … 285 390 html += '<html>'; 286 391 html += '<head>'; 287 392 html += '<title>Wrapper iframe</title>'; 393 if (this.isMac) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>'; 288 394 html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'; 289 395 html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />'; 290 if ( this.isMac ) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';291 396 html += '</head>'; 292 397 html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">'; 293 398 … … 297 402 html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>'; 298 403 html += ' <div class="mceWindowHeadTools">'; 299 404 html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>'; 300 // html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>'; 301 // html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>'; 405 if (features['resizable'] == "yes" && features['maximizable'] == "yes") 406 html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"><img border="0" src="' + imgPath + '/window_maximize.gif" /></a>'; 407 // html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>'; 302 408 html += ' </div>'; 303 409 html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">'; 304 410 html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>'; … … 447 553 div.setAttribute("width", width); 448 554 div.setAttribute("height", (height)); 449 555 div.style.position = "absolute"; 556 450 557 div.style.left = left + "px"; 451 558 div.style.top = top + "px"; 452 559 div.style.width = width + "px"; … … 473 580 iframe.setAttribute("topMargin", "0"); 474 581 iframe.setAttribute("width", iframeWidth); 475 582 iframe.setAttribute("height", iframeHeight); 476 //iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");583 // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm"); 477 584 // iframe.setAttribute("allowtransparency", "false"); 478 585 iframe.setAttribute("scrolling", "no"); 479 586 iframe.style.width = iframeWidth + "px"; … … 522 629 }; 523 630 524 631 TinyMCE_Window.prototype.maximize = function() { 525 632 if (this.restoreSize) { 633 this.moveTo(this.restoreSize[0], this.restoreSize[1]); 634 this.resizeTo(this.restoreSize[2], this.restoreSize[3]); 635 this.updateClamping(); 636 this.restoreSize = null; 637 } else { 638 var bounds = mcWindows.getBounds(); 639 this.restoreSize = [ 640 this.left, this.top, 641 this.winElement.scrollWidth, 642 this.winElement.scrollHeight 643 ]; 644 this.moveTo(bounds[0], bounds[1]); 645 this.resizeTo( 646 bounds[2] - bounds[0], 647 bounds[3] - bounds[1] 648 ); 649 } 526 650 }; 527 651 528 652 TinyMCE_Window.prototype.startResize = function() { … … 552 676 553 677 mcWindows.windows = mcWindowsNew; 554 678 555 //alert(mcWindows.doc.getElementById(this.id + "_iframe"));679 // alert(mcWindows.doc.getElementById(this.id + "_iframe")); 556 680 557 681 var e = mcWindows.doc.getElementById(this.id + "_iframe"); 558 682 e.parentNode.removeChild(e); … … 561 685 e.parentNode.removeChild(e); 562 686 563 687 mcWindows.setDocumentLock(false); 564 688 565 689 tinyMCE.selectedInstance.getWin().focus(); // WordPress: focus on the editor after closing a popup 566 690 }; 567 691 568 692 TinyMCE_Window.prototype.onMouseMove = function(e) { 569 var scrollX = 0;//this.doc.body.scrollLeft; 570 var scrollY = 0;//this.doc.body.scrollTop; 571 693 var clamp; 572 694 // Calculate real X, Y 573 695 var dx = e.screenX - mcWindows.mouseDownScreenX; 574 696 var dy = e.screenY - mcWindows.mouseDownScreenY; 575 697 576 698 switch (mcWindows.action) { 577 699 case "resize": 578 width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX); 579 height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY); 700 clamp = mcWindows.clampBoxSize( 701 this.left, this.top, 702 mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX), 703 mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY), 704 this.features.minWidth, this.features.minHeight 705 ); 580 706 581 width = width < 100 ? 100 : width; 582 height = height < 100 ? 100 : height; 707 this.resizeTo(clamp[2], clamp[3]); 583 708 584 this.wrapperIFrameElement.style.width = (width+2) + 'px';585 this.wrapperIFrameElement.style.height = (height+2) + 'px';586 this.wrapperIFrameElement.width = width+2;587 this.wrapperIFrameElement.height = height+2;588 this.winElement.style.width = width + 'px';589 this.winElement.style.height = height + 'px';590 591 height = height - this.deltaHeight;592 593 this.containerElement.style.width = width + 'px';594 this.iframeElement.style.width = width + 'px';595 this.iframeElement.style.height = height + 'px';596 this.bodyElement.style.width = width + 'px';597 this.bodyElement.style.height = height + 'px';598 this.headElement.style.width = width + 'px';599 //this.statusElement.style.width = width + 'px';600 601 709 mcWindows.cancelEvent(e); 602 710 break; 603 711 604 712 case "move": 605 713 this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX); 606 714 this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY); 607 this.winElement.style.left = this.left + "px"; 608 this.winElement.style.top = this.top + "px"; 715 this.updateClamping(); 609 716 610 717 mcWindows.cancelEvent(e); 611 718 break; 612 719 } 613 720 }; 614 721 722 TinyMCE_Window.prototype.moveTo = function (x, y) { 723 this.left = x; 724 this.top = y; 725 726 this.winElement.style.left = this.left + "px"; 727 this.winElement.style.top = this.top + "px"; 728 }; 729 730 TinyMCE_Window.prototype.resizeTo = function (width, height) { 731 this.wrapperIFrameElement.style.width = (width+2) + 'px'; 732 this.wrapperIFrameElement.style.height = (height+2) + 'px'; 733 this.wrapperIFrameElement.width = width+2; 734 this.wrapperIFrameElement.height = height+2; 735 this.winElement.style.width = width + 'px'; 736 this.winElement.style.height = height + 'px'; 737 738 height = height - this.deltaHeight; 739 740 this.containerElement.style.width = width + 'px'; 741 this.iframeElement.style.width = width + 'px'; 742 this.iframeElement.style.height = height + 'px'; 743 this.bodyElement.style.width = width + 'px'; 744 this.bodyElement.style.height = height + 'px'; 745 this.headElement.style.width = width + 'px'; 746 //this.statusElement.style.width = width + 'px'; 747 }; 748 749 TinyMCE_Window.prototype.updateClamping = function () { 750 var clamp, oversize; 751 752 clamp = mcWindows.clampBoxPosition( 753 this.left, this.top, 754 this.winElement.scrollWidth, 755 this.winElement.scrollHeight, 756 this.features.minWidth, this.features.minHeight 757 ); 758 oversize = ( 759 clamp[2] != this.winElement.scrollWidth || 760 clamp[3] != this.winElement.scrollHeight 761 ) ? true : false; 762 763 this.moveTo(clamp[0], clamp[1]); 764 if (this.features.resizable == "yes" && oversize) 765 this.resizeTo(clamp[2], clamp[3]); 766 }; 767 615 768 function debug(msg) { 616 769 document.getElementById('debug').value += msg + "\n"; 617 770 } … … 639 792 TinyMCE_Window.prototype.onMouseDown = function(e) { 640 793 var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target; 641 794 642 var scrollX = 0;//this.doc.body.scrollLeft;643 var scrollY = 0;//this.doc.body.scrollTop;644 645 795 mcWindows.mouseDownScreenX = e.screenX; 646 796 mcWindows.mouseDownScreenY = e.screenY; 647 797 mcWindows.mouseDownLayerX = this.left; -
wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
1 1 /** 2 * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 3 3 * 4 4 * @author Moxiecode 5 5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. … … 14 14 longname : 'Auto save', 15 15 author : 'Moxiecode Systems AB', 16 16 authorurl : 'http://tinymce.moxiecode.com', 17 infourl : 'http:// tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',17 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', 18 18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 19 19 }; 20 20 }, -
wp-includes/js/tinymce/plugins/paste/editor_plugin.js
1 1 /** 2 * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 3 3 * 4 4 * @author Moxiecode 5 5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. … … 14 14 longname : 'Paste text/word', 15 15 author : 'Moxiecode Systems AB', 16 16 authorurl : 'http://tinymce.moxiecode.com', 17 infourl : 'http:// tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',17 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', 18 18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 19 19 }; 20 20 }, … … 24 24 tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); 25 25 }, 26 26 27 handleEvent : function(e) { 28 // Force paste dialog if non IE browser 29 if (!tinyMCE.isRealIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false) && e.ctrlKey && e.keyCode == 86 && e.type == "keydown") { 30 window.setTimeout('tinyMCE.selectedInstance.execCommand("mcePasteText",true)', 1); 31 return tinyMCE.cancelEvent(e); 32 } 33 34 return true; 35 }, 36 27 37 getControlHTML : function(cn) { 28 38 switch (cn) { 29 39 case "pastetext": -
wp-includes/js/tinymce/tiny_mce.js
5 5 var ua; 6 6 7 7 this.majorVersion = "2"; 8 this.minorVersion = " 0.9";9 this.releaseDate = "2007-0 1-09";8 this.minorVersion = "1.0"; 9 this.releaseDate = "2007-02-13"; 10 10 11 11 this.instances = new Array(); 12 12 this.switchClassCache = new Array(); … … 186 186 this._def("custom_shortcuts", true); 187 187 this._def("convert_on_click", false); 188 188 this._def("content_css", ''); 189 this._def("fix_list_elements", false);189 this._def("fix_list_elements", true); 190 190 this._def("fix_table_elements", false); 191 191 this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml'); 192 192 this._def("hidden_tab_class", ''); … … 241 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'; 242 242 this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); 243 243 this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); 244 this.uniqueURL = 'javascript: TINYMCE_UNIQUEURL();'; // Make unique URL non real URL244 this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL 245 245 this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>'; 246 246 this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'); 247 247 … … 740 740 tinyMCE.removeMCEControl(value); 741 741 return; 742 742 743 case "mceToggleEditor": 744 var inst = tinyMCE.getInstanceById(value), pe, te; 745 746 if (inst) { 747 pe = document.getElementById(inst.editorId + '_parent'); 748 te = inst.oldTargetElement; 749 750 if (typeof(inst.enabled) == 'undefined') 751 inst.enabled = true; 752 753 inst.enabled = !inst.enabled; 754 755 if (!inst.enabled) { 756 pe.style.display = 'none'; 757 te.value = inst.getHTML(); 758 te.style.display = inst.oldTargetDisplay; 759 tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst); 760 } else { 761 pe.style.display = 'block'; 762 te.style.display = 'none'; 763 inst.setHTML(te.value); 764 inst.useCSS = false; 765 tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst); 766 } 767 } else 768 tinyMCE.addMCEControl(tinyMCE._getElementById(value), value); 769 770 return; 771 743 772 case "mceResetDesignMode": 744 773 // Resets the designmode state of the editors in Gecko 745 774 if (!tinyMCE.isIE) { … … 961 990 // Fix for bug #957681 962 991 //inst.getDoc().designMode = inst.getDoc().designMode; 963 992 964 // Setup element references965 var parentElm = inst.targetDoc.getElementById(inst.editorId + '_parent');966 inst.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;967 968 993 tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst); 969 994 tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc()); 970 995 … … 1445 1470 h += '</a></span>'; 1446 1471 } else { 1447 1472 if (tinyMCE.isRealIE) 1448 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';1473 h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">'; 1449 1474 else 1450 h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';1475 h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton">'; 1451 1476 1452 1477 h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">'; 1453 1478 h += '<img src="' + img + '" title="{$' + lang + '}" /></a>'; … … 1693 1718 }, 1694 1719 1695 1720 triggerNodeChange : function(focus, setup_content) { 1696 var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false ;1721 var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false, st; 1697 1722 1698 1723 if (tinyMCE.selectedInstance) { 1699 1724 inst = tinyMCE.selectedInstance; … … 1705 1730 inst.lastTriggerEl = elm;*/ 1706 1731 1707 1732 editorId = inst.editorId; 1708 s electedText = inst.selection.getSelectedText();1733 st = inst.selection.getSelectedText(); 1709 1734 1710 1735 if (tinyMCE.settings.auto_resize) 1711 1736 inst.resizeToContent(); … … 1716 1741 inst.switchSettings(); 1717 1742 1718 1743 if (tinyMCE.selectedElement) 1719 anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (s electedText && selectedText.length > 0);1744 anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0); 1720 1745 1721 1746 if (tinyMCE.settings['custom_undo_redo']) { 1722 1747 undoIndex = inst.undoRedo.undoIndex; … … 2180 2205 }, 2181 2206 2182 2207 getCSSClasses : function(editor_id, doc) { 2183 var output = new Array();2208 var inst = tinyMCE.getInstanceById(editor_id); 2184 2209 2185 2210 // Is cached, use that 2186 if ( typeof(tinyMCE.cssClasses) != "undefined")2187 return tinyMCE.cssClasses;2211 if (inst && inst.cssClasses.length > 0) 2212 return inst.cssClasses; 2188 2213 2189 2214 if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") { 2190 2215 var instance; … … 2242 2267 var cssClass = rule.substring(rule.indexOf('.') + 1); 2243 2268 var addClass = true; 2244 2269 2245 for (var p=0; p< output.length && addClass; p++) {2246 if ( output[p] == cssClass)2270 for (var p=0; p<inst.cssClasses.length && addClass; p++) { 2271 if (inst.cssClasses[p] == cssClass) 2247 2272 addClass = false; 2248 2273 } 2249 2274 2250 2275 if (addClass) 2251 output[output.length] = cssClass;2276 inst.cssClasses[inst.cssClasses.length] = cssClass; 2252 2277 } 2253 2278 } 2254 2279 } … … 2257 2282 } 2258 2283 } 2259 2284 2260 // Cache em 2261 if (output.length > 0) 2262 tinyMCE.cssClasses = output; 2263 2264 return output; 2285 return inst.cssClasses; 2265 2286 }, 2266 2287 2267 2288 regexpReplace : function(in_str, reg_exp, replace_str, opts) { … … 2289 2310 }, 2290 2311 2291 2312 getControlHTML : function(c) { 2292 var i, l, n, o, v ;2313 var i, l, n, o, v, rtl = tinyMCE.getLang('lang_dir') == 'rtl'; 2293 2314 2294 2315 l = tinyMCE.plugins; 2295 2316 for (n in l) { 2296 2317 o = l[n]; 2297 2318 2298 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') 2319 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { 2320 if (rtl) 2321 return '<span dir="rtl">' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '</span>'; 2322 2299 2323 return tinyMCE.replaceVar(v, "pluginurl", o.baseURL); 2324 } 2300 2325 } 2301 2326 2302 2327 o = tinyMCE.themes[tinyMCE.settings['theme']]; 2303 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') 2328 if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { 2329 if (rtl) 2330 return '<span dir="rtl">' + v + '</span>'; 2331 2304 2332 return v; 2333 } 2305 2334 2306 2335 return ''; 2307 2336 }, … … 2433 2462 this.hasMouseMoved = false; 2434 2463 this.foreColor = this.backColor = "#999999"; 2435 2464 this.data = {}; 2465 this.cssClasses = []; 2436 2466 2437 2467 this.cleanup.init({ 2438 2468 valid_elements : s.valid_elements, … … 2865 2895 if (tinyMCE.isGecko && this.getSel().isCollapsed) { 2866 2896 focusElm = tinyMCE.getParentElement(focusElm, 'A'); 2867 2897 2868 if (focusElm && this.getRng(0).endOffset > 0 && this.getRng(0).endOffset != focusElm.innerHTML.length) // WordPress mod to prevent unlinking if caret at start/end of link2898 if (focusElm) 2869 2899 this.selection.selectNode(focusElm, false); 2870 2900 } 2871 2901 … … 3690 3720 hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>'; 3691 3721 } else { 3692 3722 hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; 3723 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3693 3724 this.oldTargetElement.style.display = "none"; 3694 3725 } 3695 3726 … … 3715 3746 // Just hide the textarea element 3716 3747 this.oldTargetElement = replace_element; 3717 3748 3718 if (!tinyMCE.settings['debug']) 3749 if (!tinyMCE.settings['debug']) { 3750 this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); 3719 3751 this.oldTargetElement.style.display = "none"; 3752 } 3720 3753 3721 3754 // Output HTML and set editable 3722 3755 if (tinyMCE.isGecko) { … … 3790 3823 if (tinyMCE.isIE) 3791 3824 window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); 3792 3825 3826 // Setup element references 3827 var parentElm = this.targetDoc.getElementById(this.editorId + '_parent'); 3828 this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling; 3829 3793 3830 tinyMCE.setupContent(this.editorId, true); 3794 3831 3795 3832 return true; … … 4865 4902 if (r.forceAttribs && (t = r.forceAttribs[an])) 4866 4903 av = t; 4867 4904 4868 if (os && av.length != 0 && this.settings.url_converter.length != 0 &&/^(src|href|longdesc)$/.test(an))4905 if (os && av.length != 0 && /^(src|href|longdesc)$/.test(an)) 4869 4906 av = this._urlConverter(this, n, av); 4870 4907 4871 4908 if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) … … 5186 5223 5187 5224 // Convert all strong/em to b/i in Gecko 5188 5225 if (tinyMCE.isGecko) { 5189 h = h.replace(/<strong/gi, '<b'); 5190 h = h.replace(/<em(\/?)/gi, '<i'); 5191 h = h.replace(/<em /gi, '<i'); 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>'); 5192 5230 h = h.replace(/<\/strong>/gi, '</b>'); 5193 5231 h = h.replace(/<\/em>/gi, '</i>'); 5194 5232 } … … 5503 5541 }; 5504 5542 }; 5505 5543 5544 TinyMCE_Engine.prototype.getStyle = function(n, na, d) { 5545 if (!n) 5546 return false; 5547 5548 // Gecko 5549 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 fail 5554 return null; 5555 } 5556 } 5557 5558 // Camelcase it, if needed 5559 na = na.replace(/-(\D)/g, function(a, b){ 5560 return b.toUpperCase(); 5561 }); 5562 5563 // IE & Opera 5564 if (n.currentStyle) 5565 return n.currentStyle[na]; 5566 5567 return false; 5568 }; 5569 5506 5570 /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */ 5507 5571 5508 5572 TinyMCE_Engine.prototype.parseURL = function(url_str) { … … 7132 7196 }, 7133 7197 7134 7198 show : function() { 7135 this.getElement().style.display = 'block'; 7136 this.updateBlocker(); 7199 var el = this.getElement(); 7200 7201 if (el) { 7202 el.style.display = 'block'; 7203 this.updateBlocker(); 7204 } 7137 7205 }, 7138 7206 7139 7207 hide : function() { 7140 this.getElement().style.display = 'none'; 7141 this.updateBlocker(); 7208 var el = this.getElement(); 7209 7210 if (el) { 7211 el.style.display = 'none'; 7212 this.updateBlocker(); 7213 } 7142 7214 }, 7143 7215 7144 7216 isVisible : function() { -
wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js
1 function init() { 2 if (tinyMCE.isMSIE) 3 tinyMCEPopup.resizeToInnerSize(); 4 } 1 var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; 5 2 6 function selectColor() {7 var color = document.getElementById("selectedColorBox").value;8 9 tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);10 tinyMCEPopup.close();11 }12 13 function showColor(color) {14 document.getElementById("selectedColor").style.backgroundColor = color;15 document.getElementById("selectedColorBox").value = color;16 }17 18 3 var colors = new Array( 19 4 "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", 20 5 "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", … … 45 30 "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" 46 31 ); 47 32 33 var named = { 34 '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', 35 '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', 36 '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', 37 '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', 38 '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', 39 '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', 40 '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', 41 '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', 42 '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', 43 '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', 44 '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', 45 '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', 46 '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', 47 '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', 48 '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', 49 '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', 50 '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', 51 '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', 52 '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', 53 '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', 54 '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', 55 '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', 56 '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' 57 }; 58 59 function init() { 60 var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); 61 62 if (tinyMCE.isMSIE) 63 tinyMCEPopup.resizeToInnerSize(); 64 65 generatePicker(); 66 67 if (inputColor) { 68 changeFinalColor(inputColor); 69 70 col = convertHexToRGB(inputColor); 71 72 if (col) 73 updateLight(col.r, col.g, col.b); 74 } 75 } 76 77 function insertAction() { 78 var color = document.getElementById("color").value; 79 80 tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); 81 tinyMCEPopup.close(); 82 } 83 84 function showColor(color, name) { 85 if (name) 86 document.getElementById("colorname").innerHTML = name; 87 88 document.getElementById("preview").style.backgroundColor = color; 89 document.getElementById("color").value = color; 90 } 91 48 92 function convertRGBToHex(col) { 49 93 var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); 50 94 95 if (!col) 96 return col; 97 51 98 var rgb = col.replace(re, "$1,$2,$3").split(','); 52 99 if (rgb.length == 3) { 53 100 r = parseInt(rgb[0]).toString(16); … … 72 119 g = parseInt(col.substring(2, 4), 16); 73 120 b = parseInt(col.substring(4, 6), 16); 74 121 75 return "rgb(" + r + "," + g + "," + b + ")";122 return {r : r, g : g, b : b}; 76 123 } 77 124 78 return col;125 return null; 79 126 } 80 127 81 function renderColorMap() { 82 var html = ""; 83 var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); 128 function generatePicker() { 129 var el = document.getElementById('light'), h = '', i; 84 130 85 html += '<table border="0" cellspacing="1" cellpadding="0">' 131 for (i = 0; i < detail; i++){ 132 h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"' 133 + ' onclick="changeFinalColor(this.style.backgroundColor)"' 134 + ' onmousedown="isMouseDown = true; return false;"' 135 + ' onmouseup="isMouseDown = false;"' 136 + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"' 137 + ' onmouseover="isMouseOver = true;"' 138 + ' onmouseout="isMouseOver = false;"' 139 + '></div>'; 140 } 141 142 el.innerHTML = h; 143 } 144 145 function generateWebColors() { 146 var el = document.getElementById('webcolors'), h = '', i; 147 148 if (el.className == 'generated') 149 return; 150 151 h += '<table border="0" cellspacing="1" cellpadding="0">' 86 152 + '<tr>'; 87 for (var i=0; i<colors.length; i++) { 88 html += '<td bgcolor="' + colors[i] + '">' 153 154 for (i=0; i<colors.length; i++) { 155 h += '<td bgcolor="' + colors[i] + '">' 89 156 + '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">' 90 157 + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>'; 91 158 if ((i+1) % 18 == 0) 92 h tml+= '</tr><tr>';159 h += '</tr><tr>'; 93 160 } 94 html += '<tr><td colspan="18">'95 + '<table width="100%" border="0" cellspacing="0" cellpadding="0">'96 + '<tr><td>'97 + '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />'98 + '</td><td align="right">'99 + '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'100 + '</td></tr>'101 + '</table>'102 + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'103 + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'104 + '</td></tr>'105 + '</table>';106 161 107 document.write(html); 108 } 109 No newline at end of file 162 h += '</table>'; 163 164 el.innerHTML = h; 165 el.className = 'generated'; 166 } 167 168 function generateNamedColors() { 169 var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; 170 171 if (el.className == 'generated') 172 return; 173 174 for (n in named) { 175 v = named[n]; 176 h += '<a href="javascript:selectColor();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>' 177 } 178 179 el.innerHTML = h; 180 el.className = 'generated'; 181 } 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 function dechex(n) { 193 return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); 194 } 195 196 function computeColor(e) { 197 var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; 198 199 x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); 200 y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); 201 202 partWidth = document.getElementById('colorpicker').width / 6; 203 partDetail = detail / 2; 204 imHeight = document.getElementById('colorpicker').height; 205 206 r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; 207 g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); 208 b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); 209 210 coef = (imHeight - y) / imHeight; 211 r = 128 + (r - 128) * coef; 212 g = 128 + (g - 128) * coef; 213 b = 128 + (b - 128) * coef; 214 215 changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); 216 updateLight(r, g, b); 217 } 218 219 function updateLight(r, g, b) { 220 var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; 221 222 for (i=0; i<detail; i++) { 223 if ((i>=0) && (i<partDetail)) { 224 finalCoef = i / partDetail; 225 finalR = dechex(255 - (255 - r) * finalCoef); 226 finalG = dechex(255 - (255 - g) * finalCoef); 227 finalB = dechex(255 - (255 - b) * finalCoef); 228 } else { 229 finalCoef = 2 - i / partDetail; 230 finalR = dechex(r * finalCoef); 231 finalG = dechex(g * finalCoef); 232 finalB = dechex(b * finalCoef); 233 } 234 235 color = finalR + finalG + finalB; 236 237 document.getElementById('gs' + i).style.backgroundColor = '#'+color; 238 } 239 } 240 241 function changeFinalColor(color) { 242 if (color.indexOf('#') == -1) 243 color = convertRGBToHex(color); 244 245 document.getElementById('preview').style.backgroundColor = color; 246 document.getElementById('color').value = color; 247 } 248 249 window.focus(); 250 No newline at end of file -
wp-includes/js/tinymce/themes/advanced/jscripts/link.js
57 57 var title = document.forms[0].linktitle.value; 58 58 var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : ""; 59 59 var dummy; 60 61 // Make anchors absolute60 61 // WordPress: Make anchors absolute; 62 62 if (href.charAt(0) == '#') 63 63 href = tinyMCE.settings['document_base_url'] + href; 64 64 -
wp-includes/js/tinymce/themes/advanced/color_picker.htm
2 2 <head> 3 3 <title>{$lang_theme_colorpicker_title}</title> 4 4 <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script> 5 <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script> 5 6 <script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script> 7 <link href="css/colorpicker.css" rel="stylesheet" type="text/css" /> 6 8 <base target="_self" /> 7 9 </head> 8 <body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; display: none"> 9 <div align="center"> 10 <script language="javascript" type="text/javascript">renderColorMap();</script> 10 <body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none"> 11 <div class="tabs"> 12 <ul> 13 <li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{$lang_color_picker_tab}</a></span></li> 14 <li id="rgb_tab"><span><a href="#" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{$lang_web_colors_tab}</a></span></li> 15 <li id="named_tab"><span><a href="#" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{$lang_named_colors_tab}</a></span></li> 16 </ul> 11 17 </div> 18 19 <div class="panel_wrapper"> 20 <div id="picker_panel" class="panel current"> 21 <fieldset> 22 <legend>{$lang_color_picker}</legend> 23 <div id="picker"> 24 <img id="colorpicker" src="images/colors.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" /> 25 26 <div id="light"> 27 <!-- Will be filled with divs --> 28 </div> 29 30 <br style="clear: both" /> 31 </div> 32 </fieldset> 33 </div> 34 35 <div id="rgb_panel" class="panel"> 36 <fieldset> 37 <legend>{$lang_web_colors}</legend> 38 <div id="webcolors"> 39 <!-- Gets filled with web safe colors--> 40 </div> 41 42 <br style="clear: both" /> 43 </fieldset> 44 </div> 45 46 <div id="named_panel" class="panel"> 47 <fieldset> 48 <legend>{$lang_named_colors}</legend> 49 <div id="namedcolors"> 50 <!-- Gets filled with named colors--> 51 </div> 52 53 <br style="clear: both" /> 54 55 <div id="colornamecontainer"> 56 {$lang_color_name} <span id="colorname"></span> 57 </div> 58 </fieldset> 59 </div> 60 </div> 61 62 <div class="mceActionPanel"> 63 <div style="float: left"> 64 <input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" onclick="insertAction();" /> 65 </div> 66 67 <div id="preview"></div> 68 69 <div id="previewblock"> 70 <label for="color">{$lang_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text" /> 71 </div> 72 </div> 12 73 </body> 13 74 </html> -
wp-includes/js/tinymce/themes/advanced/langs/en.js
78 78 not_set : '-- Not set --', 79 79 close : 'Close', 80 80 toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X', 81 invalid_data : 'Error: Invalid values entered, these are marked in red.' 81 invalid_data : 'Error: Invalid values entered, these are marked in red.', 82 more_colors : 'More colors', 83 color_picker_tab : 'Picker', 84 color_picker : 'Color picker', 85 web_colors_tab : 'Web safe', 86 web_colors : 'Web safe colors', 87 named_colors_tab : 'Named', 88 named_colors : 'Named colors', 89 color : 'Color:', 90 color_name : 'Name:' 82 91 }); -
wp-includes/js/tinymce/themes/advanced/css/editor_ui.css
11 11 .mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;} 12 12 .mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;} 13 13 .mceToolbarBottom {border-top: 1px solid #cccccc;} 14 .mceToolbarContainer { position: relative; left: 0; top: 0; display: block;}14 .mceToolbarContainer {display: block; position: relative; left: 0; top: 0; width: 100%;} 15 15 .mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;} 16 16 .mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;} 17 17 .mceStatusbarTop {border-bottom: 1px solid #cccccc;} … … 49 49 50 50 /* Menu */ 51 51 52 .mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100 ; background-color: white; border: 1px solid gray; font-weight: normal;}52 .mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 1000; background-color: white; border: 1px solid gray; font-weight: normal;} 53 53 .mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;} 54 54 .mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;} 55 55 .mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;} … … 61 61 span.mceMenuCheckItem {padding-left: 20px;} 62 62 span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;} 63 63 .mceColors table, .mceColors td {margin: 0; padding: 2px;} 64 a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;}64 a.mceMoreColors {width: auto; padding: 0; margin: 0 3px 3px 3px; text-align: center; border: 1px solid white; text-decoration: none !important;} 65 65 .mceColorPreview {position: absolute; overflow:hidden; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;} 66 66 a.mceMoreColors:hover {border: 1px solid #0A246A;} 67 67 .mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;} … … 77 77 * html .mceSelectList {margin-top: 2px;} 78 78 * html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 79 79 * html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;} 80 * html a.mceMoreColors {width: 132px;}80 * html a.mceMoreColors {width: auto;} 81 81 * html .mceColors td a {width: 10px; height: 10px;} 82 82 * html .mceColorPreview {margin-left: 2px; margin-top: 14px;} 83 83 … … 92 92 *:first-child+html .mceSelectList {margin-top: 2px;} 93 93 *:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 94 94 *:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;} 95 *:first-child+html a.mceMoreColors {width: 13 2px;}95 *:first-child+html a.mceMoreColors {width: 137px;} 96 96 *:first-child+html .mceColors td a {width: 10px; height: 10px;} 97 97 *:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;} -
wp-includes/js/tinymce/themes/advanced/editor_template.js
1 1 /** 2 * $Id: editor_template_src.js 166 2007-01-05 10:31:50Z spocke $2 * $Id: editor_template_src.js 218 2007-02-13 11:08:01Z spocke $ 3 3 * 4 4 * @author Moxiecode 5 5 * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. … … 43 43 ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'], 44 44 ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], 45 45 ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], 46 ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true], 46 47 ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], 48 ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true], 47 49 ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], 48 50 ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], 49 51 ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'], … … 356 358 357 359 return false; 358 360 361 case "forecolorpicker": 362 this._pickColor(editor_id, 'forecolor'); 363 return true; 364 359 365 case "forecolorMenu": 360 366 TinyMCE_AdvancedTheme._hideMenus(editor_id); 361 367 … … 420 426 421 427 ml.show(); 422 428 return true; 429 430 case "backcolorpicker": 431 this._pickColor(editor_id, 'HiliteColor'); 432 return true; 423 433 424 434 case "mceColorPicker": 425 435 if (user_interface) { 426 var template = new Array(); 427 var inputColor = value['document'].getElementById(value['element_id']).value; 436 var template = []; 437 438 if (!value['callback'] && !value['color']) 439 value['color'] = value['document'].getElementById(value['element_id']).value; 428 440 429 441 template['file'] = 'color_picker.htm'; 430 template['width'] = 220;431 template['height'] = 190;442 template['width'] = 380; 443 template['height'] = 250; 432 444 template['close_previous'] = "no"; 433 445 434 446 template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0); … … 438 450 value['store_selection'] = true; 439 451 440 452 tinyMCE.lastColorPickerValue = value; 441 tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor});453 tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']}); 442 454 } else { 443 var savedVal = tinyMCE.lastColorPickerValue; 444 var elm = savedVal['document'].getElementById(savedVal['element_id']); 455 var savedVal = tinyMCE.lastColorPickerValue, elm; 456 457 if (savedVal['callback']) { 458 savedVal['callback'](value); 459 return true; 460 } 461 462 elm = savedVal['document'].getElementById(savedVal['element_id']); 445 463 elm.value = value; 446 464 447 465 if (elm.onchange != null && elm.onchange != '') … … 599 617 // Setup template html 600 618 template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>'; 601 619 602 if (toolbarLocation == "top") { 603 template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 604 } 620 if (toolbarLocation == "top") 621 template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 605 622 606 623 if (statusbarLocation == "top") { 607 624 template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>'; … … 610 627 611 628 template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>'; 612 629 613 if (toolbarLocation == "bottom") { 614 template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 615 } 630 if (toolbarLocation == "bottom") 631 template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 616 632 617 633 // External toolbar changes 618 634 if (toolbarLocation == "external") { … … 738 754 }, 739 755 740 756 removeInstance : function(inst) { 741 var fcm = new TinyMCE_Layer(inst.editorId + '_fcMenu'); 757 new TinyMCE_Layer(inst.editorId + '_fcMenu').remove(); 758 new TinyMCE_Layer(inst.editorId + '_bcMenu').remove(); 759 }, 742 760 743 fcm.remove(); 761 hideInstance : function(inst) { 762 TinyMCE_AdvancedTheme._hideMenus(inst.editorId); 744 763 }, 745 764 746 765 _handleMenuEvent : function(e) { … … 1378 1397 } 1379 1398 1380 1399 h += '</tr></table>'; 1381 /*1382 h += '<a href="" class="mceMoreColors">More colors</a>';1383 */1384 1400 1401 if (tinyMCE.getParam("theme_advanced_more_colors", true)) 1402 h += '<a href="#" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>'; 1403 1385 1404 return h; 1386 1405 }, 1387 1406 1407 _pickColor : function(id, cm) { 1408 var inputColor, inst = tinyMCE.selectedInstance; 1409 1410 if (cm == 'forecolor' && inst) 1411 inputColor = inst.foreColor; 1412 1413 if ((cm == 'backcolor' || cm == 'HiliteColor') && inst) 1414 inputColor = inst.backColor; 1415 1416 tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) { 1417 tinyMCE.execInstanceCommand(id, cm, false, c); 1418 }}); 1419 }, 1420 1388 1421 _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { 1389 1422 tinyMCE.execCommand('mceBeginUndoLevel'); 1390 1423