| | |
| | |
|
| | |
|
| | | // Some global instances, this will be filled later
|
| | | var tinyMCE = null, tinyMCELang = null;
|
| | |
|
| | |
|
| | | function TinyMCE_Popup() {
|
| | | };
|
| | |
|
| | | TinyMCE_Popup.prototype = {
|
| | | findWin : function(w) {
|
| | | var c;
|
| | |
|
| | | TinyMCE_Popup.prototype.init = function() {
|
| | | var win = window.opener ? window.opener : window.dialogArguments;
|
| | | var inst;
|
| | | // Check parents
|
| | | c = w;
|
| | | while (c && (c = c.parent) != null) {
|
| | | if (typeof(c.tinyMCE) != "undefined")
|
| | | return c;
|
| | | }
|
| | |
|
| | | if (!win) {
|
| | | // Try parent
|
| | | win = parent.parent;
|
| | | // Check openers
|
| | | c = w;
|
| | | while (c && (c = c.opener) != null) {
|
| | | if (typeof(c.tinyMCE) != "undefined")
|
| | | return c;
|
| | | }
|
| | |
|
| | | // Try top
|
| | | if (typeof(win.tinyMCE) == "undefined")
|
| | | win = top;
|
| | | if (typeof(top.tinyMCE) != "undefined")
|
| | | return top;
|
| | |
|
| | | return null;
|
| | | },
|
| | |
|
| | | init : function() {
|
| | | var win = window.opener ? window.opener : window.dialogArguments, c;
|
| | | var inst;
|
| | |
|
| | | if (!win)
|
| | | win = this.findWin(window);
|
| | |
|
| | | if (!win) {
|
| | | alert("tinyMCE object reference not found from popup.");
|
| | | return;
|
| | | }
|
| | |
|
| | | window.opener = win;
|
| | |
| | | tinyMCE = win.tinyMCE;
|
| | | tinyMCELang = win.tinyMCELang;
|
| | |
|
| | | if (!tinyMCE) {
|
| | | alert("tinyMCE object reference not found from popup.");
|
| | | return;
|
| | | }
|
| | |
|
| | | inst = tinyMCE.selectedInstance;
|
| | | this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
|
| | | this.storeSelection = (tinyMCE.isMSIE && !tinyMCE.isOpera) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
|
| | | this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
|
| | |
|
| | | if (this.isWindow)
|
| | | window.focus();
|
| | |
| | | // Output Popup CSS class
|
| | | document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
|
| | |
|
| | | if (tinyMCE.getParam("popups_css_add")) {
|
| | | c = tinyMCE.getParam("popups_css_add");
|
| | |
|
| | | // Is relative
|
| | | if (c.indexOf('://') == -1 && c.charAt(0) != '/')
|
| | | c = tinyMCE.documentBasePath + "/" + c;
|
| | |
|
| | | document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
|
| | | }
|
| | |
|
| | | tinyMCE.addEvent(window, "load", this.onLoad);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.onLoad = function() {
|
| | | onLoad : function() {
|
| | | var dir, i, elms, body = document.body;
|
| | |
|
| | | if (tinyMCE.getWindowArg('mce_replacevariables', true))
|
| | |
| | | // Execute real onload (Opera fix)
|
| | | if (tinyMCEPopup.onLoadEval != "")
|
| | | eval(tinyMCEPopup.onLoadEval);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.executeOnLoad = function(str) {
|
| | | executeOnLoad : function(str) {
|
| | | if (tinyMCE.isOpera)
|
| | | this.onLoadEval = str;
|
| | | else
|
| | | eval(str);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.resizeToInnerSize = function() {
|
| | | resizeToInnerSize : function() {
|
| | | // Netscape 7.1 workaround
|
| | | if (this.isWindow && tinyMCE.isNS71) {
|
| | | window.resizeBy(0, 10);
|
| | |
| | | iframe.style.display = 'none';
|
| | | wrapper.style.display = 'block';
|
| | | }
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.resizeToContent = function() {
|
| | | resizeToContent : function() {
|
| | | var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
| | | var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
| | |
|
| | |
| | | window.moveTo(x, y);
|
| | | }
|
| | | }
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.getWindowArg = function(name, default_value) {
|
| | | getWindowArg : function(name, default_value) {
|
| | | return tinyMCE.getWindowArg(name, default_value);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.restoreSelection = function() {
|
| | | restoreSelection : function() {
|
| | | if (this.storeSelection) {
|
| | | var inst = tinyMCE.selectedInstance;
|
| | |
|
| | |
| | | if (inst.selectionBookmark)
|
| | | inst.selection.moveToBookmark(inst.selectionBookmark);
|
| | | }
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.execCommand = function(command, user_interface, value) {
|
| | | execCommand : function(command, user_interface, value) {
|
| | | var inst = tinyMCE.selectedInstance;
|
| | |
|
| | | this.restoreSelection();
|
| | |
| | | // Store selection
|
| | | if (this.storeSelection)
|
| | | inst.selectionBookmark = inst.selection.getBookmark(true);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.close = function() {
|
| | | close : function() {
|
| | | tinyMCE.closeWindow(window);
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.pickColor = function(e, element_id) {
|
| | | pickColor : function(e, element_id) {
|
| | | tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
|
| | | element_id : element_id,
|
| | | document : document,
|
| | | window : window,
|
| | | store_selection : false
|
| | | });
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.openBrowser = function(element_id, type, option) {
|
| | | openBrowser : function(element_id, type, option) {
|
| | | var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
| | | var url = document.getElementById(element_id).value;
|
| | |
|
| | |
| | | alert("Callback function: " + cb + " could not be found.");
|
| | | else
|
| | | eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
|
| | | };
|
| | | },
|
| | |
|
| | |
|
| | | TinyMCE_Popup.prototype.importClass = function(c) {
|
| | | importClass : function(c) {
|
| | | window[c] = function() {};
|
| | |
|
| | | for (var n in window.opener[c].prototype)
|
| | | window[c].prototype[n] = window.opener[c].prototype[n];
|
| | |
|
| | | window[c].constructor = window.opener[c].constructor;
|
| | | }
|
| | |
|
| | | };
|
| | |
|
| | | // Setup global instance
|