-
+ F871B4E371810FEE28F85B51B66AC03B1E42056D06E98D0B57C1D2EAD504CCAD8A3BC9D57C7D0F948F6B4D3DB0388CCB6990684D81B58FB31139C063E9FE3725
mp-wp/wp-includes/js/tinymce/tiny_mce_popup.js
(0 . 0)(1 . 294)
131331 // Some global instances
131332 var tinymce = null, tinyMCEPopup, tinyMCE;
131333
131334 tinyMCEPopup = {
131335 init : function() {
131336 var t = this, w, ti, li, q, i, it;
131337
131338 li = ('' + document.location.search).replace(/^\?/, '').split('&');
131339 q = {};
131340 for (i=0; i<li.length; i++) {
131341 it = li[i].split('=');
131342 q[unescape(it[0])] = unescape(it[1]);
131343 }
131344
131345 if (q.mce_rdomain)
131346 document.domain = q.mce_rdomain;
131347
131348 // Find window & API
131349 w = t.getWin();
131350 tinymce = w.tinymce;
131351 tinyMCE = w.tinyMCE;
131352 t.editor = tinymce.EditorManager.activeEditor;
131353 t.params = t.editor.windowManager.params;
131354 t.features = t.editor.windowManager.features;
131355
131356 // Setup local DOM
131357 t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
131358
131359 // Enables you to skip loading the default css
131360 if (t.features.popup_css !== false)
131361 t.dom.loadCSS(t.features.popup_css || t.editor.settings.popup_css);
131362
131363 // Setup on init listeners
131364 t.listeners = [];
131365 t.onInit = {
131366 add : function(f, s) {
131367 t.listeners.push({func : f, scope : s});
131368 }
131369 };
131370
131371 t.isWindow = !t.getWindowArg('mce_inline');
131372 t.id = t.getWindowArg('mce_window_id');
131373 t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
131374 },
131375
131376 getWin : function() {
131377 return window.dialogArguments || opener || parent || top;
131378 },
131379
131380 getWindowArg : function(n, dv) {
131381 var v = this.params[n];
131382
131383 return tinymce.is(v) ? v : dv;
131384 },
131385
131386 getParam : function(n, dv) {
131387 return this.editor.getParam(n, dv);
131388 },
131389
131390 getLang : function(n, dv) {
131391 return this.editor.getLang(n, dv);
131392 },
131393
131394 execCommand : function(cmd, ui, val, a) {
131395 a = a || {};
131396 a.skip_focus = 1;
131397
131398 this.restoreSelection();
131399 return this.editor.execCommand(cmd, ui, val, a);
131400 },
131401
131402 resizeToInnerSize : function() {
131403 var t = this, n, b = document.body, vp = t.dom.getViewPort(window), dw, dh;
131404
131405 dw = t.getWindowArg('mce_width') - vp.w;
131406 dh = t.getWindowArg('mce_height') - vp.h;
131407
131408 if (t.isWindow)
131409 window.resizeBy(dw, dh);
131410 else
131411 t.editor.windowManager.resizeBy(dw, dh, t.id);
131412 },
131413
131414 executeOnLoad : function(s) {
131415 this.onInit.add(function() {
131416 eval(s);
131417 });
131418 },
131419
131420 storeSelection : function() {
131421 this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
131422 },
131423
131424 restoreSelection : function() {
131425 var t = tinyMCEPopup;
131426
131427 if (!t.isWindow && tinymce.isIE)
131428 t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
131429 },
131430
131431 requireLangPack : function() {
131432 var u = this.getWindowArg('plugin_url') || this.getWindowArg('theme_url');
131433
131434 if (u && this.editor.settings.language) {
131435 u += '/langs/' + this.editor.settings.language + '_dlg.js';
131436
131437 if (!tinymce.ScriptLoader.isDone(u)) {
131438 document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
131439 tinymce.ScriptLoader.markDone(u);
131440 }
131441 }
131442 },
131443
131444 pickColor : function(e, element_id) {
131445 this.execCommand('mceColorPicker', true, {
131446 color : document.getElementById(element_id).value,
131447 func : function(c) {
131448 document.getElementById(element_id).value = c;
131449
131450 try {
131451 document.getElementById(element_id).onchange();
131452 } catch (ex) {
131453 // Try fire event, ignore errors
131454 }
131455 }
131456 });
131457 },
131458
131459 openBrowser : function(element_id, type, option) {
131460 tinyMCEPopup.restoreSelection();
131461 this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
131462 },
131463
131464 confirm : function(t, cb, s) {
131465 this.editor.windowManager.confirm(t, cb, s, window);
131466 },
131467
131468 alert : function(tx, cb, s) {
131469 this.editor.windowManager.alert(tx, cb, s, window);
131470 },
131471
131472 close : function() {
131473 var t = this;
131474
131475 // To avoid domain relaxing issue in Opera
131476 function close() {
131477 t.editor.windowManager.close(window);
131478 tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
131479 };
131480
131481 if (tinymce.isOpera)
131482 t.getWin().setTimeout(close, 0);
131483 else
131484 close();
131485 },
131486
131487 // Internal functions
131488
131489 _restoreSelection : function() {
131490 var e = window.event.srcElement;
131491
131492 if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
131493 tinyMCEPopup.restoreSelection();
131494 },
131495
131496 /* _restoreSelection : function() {
131497 var e = window.event.srcElement;
131498
131499 // If user focus a non text input or textarea
131500 if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
131501 tinyMCEPopup.restoreSelection();
131502 },*/
131503
131504 _onDOMLoaded : function() {
131505 var t = this, ti = document.title, bm, h, nv;
131506
131507 // Translate page
131508 if (t.features.translate_i18n !== false) {
131509 h = document.body.innerHTML;
131510
131511 // Replace a=x with a="x" in IE
131512 if (tinymce.isIE)
131513 h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
131514
131515 document.dir = t.editor.getParam('directionality','');
131516
131517 if ((nv = t.editor.translate(h)) && nv != h)
131518 document.body.innerHTML = nv;
131519
131520 if ((nv = t.editor.translate(ti)) && nv != ti)
131521 document.title = ti = nv;
131522 }
131523
131524 document.body.style.display = '';
131525
131526 // Restore selection in IE when focus is placed on a non textarea or input element of the type text
131527 if (tinymce.isIE)
131528 document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
131529
131530 t.restoreSelection();
131531 t.resizeToInnerSize();
131532
131533 // Set inline title
131534 if (!t.isWindow)
131535 t.editor.windowManager.setTitle(window, ti);
131536 else
131537 window.focus();
131538
131539 if (!tinymce.isIE && !t.isWindow) {
131540 tinymce.dom.Event._add(document, 'focus', function() {
131541 t.editor.windowManager.focus(t.id)
131542 });
131543 }
131544
131545 // Patch for accessibility
131546 tinymce.each(t.dom.select('select'), function(e) {
131547 e.onkeydown = tinyMCEPopup._accessHandler;
131548 });
131549
131550 // Call onInit
131551 // Init must be called before focus so the selection won't get lost by the focus call
131552 tinymce.each(t.listeners, function(o) {
131553 o.func.call(o.scope, t.editor);
131554 });
131555
131556 // Move focus to window
131557 if (t.getWindowArg('mce_auto_focus', true)) {
131558 window.focus();
131559
131560 // Focus element with mceFocus class
131561 tinymce.each(document.forms, function(f) {
131562 tinymce.each(f.elements, function(e) {
131563 if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
131564 e.focus();
131565 return false; // Break loop
131566 }
131567 });
131568 });
131569 }
131570
131571 document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
131572 },
131573
131574 _accessHandler : function(e) {
131575 e = e || window.event;
131576
131577 if (e.keyCode == 13 || e.keyCode == 32) {
131578 e = e.target || e.srcElement;
131579
131580 if (e.onchange)
131581 e.onchange();
131582
131583 return tinymce.dom.Event.cancel(e);
131584 }
131585 },
131586
131587 _closeWinKeyHandler : function(e) {
131588 e = e || window.event;
131589
131590 if (e.keyCode == 27)
131591 tinyMCEPopup.close();
131592 },
131593
131594 _wait : function() {
131595 var t = this, ti;
131596
131597 if (tinymce.isIE && document.location.protocol != 'https:') {
131598 // Fake DOMContentLoaded on IE
131599 document.write('<script id=__ie_onload defer src=\'javascript:""\';><\/script>');
131600 document.getElementById("__ie_onload").onreadystatechange = function() {
131601 if (this.readyState == "complete") {
131602 t._onDOMLoaded();
131603 document.getElementById("__ie_onload").onreadystatechange = null; // Prevent leak
131604 }
131605 };
131606 } else {
131607 if (tinymce.isIE || tinymce.isWebKit) {
131608 ti = setInterval(function() {
131609 if (/loaded|complete/.test(document.readyState)) {
131610 clearInterval(ti);
131611 t._onDOMLoaded();
131612 }
131613 }, 10);
131614 } else {
131615 window.addEventListener('DOMContentLoaded', function() {
131616 t._onDOMLoaded();
131617 }, false);
131618 }
131619 }
131620 }
131621 };
131622
131623 tinyMCEPopup.init();
131624 tinyMCEPopup._wait(); // Wait for DOM Content Loaded