Changeset 797
- Timestamp:
- 03/27/07 23:14:46 (6 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
XinhaCore.js (modified) (20 diffs)
-
popups/popup.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/XinhaCore.js
r793 r797 182 182 h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) 183 183 }; 184 // Create the loading message elements 185 if ( this.config.showLoading ) 186 { 187 // Create and show the main loading message and the sub loading message for details of loading actions 188 // global element 189 var loading_message = document.createElement("div"); 190 loading_message.id = "loading_" + textarea.name; 191 loading_message.className = "loading"; 192 try 193 { 194 // how can i find the real width in pixels without % or em *and* with no visual errors ? 195 // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading 196 // A few lines above seems to indicate offsetWidth is not always set 197 loading_message.style.width = textarea.offsetWidth + 'px'; 198 } 199 catch (ex) 200 { 201 // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width 202 loading_message.style.width = this._initial_ta_size.w; 203 } 204 loading_message.style.left = Xinha.findPosX(textarea) + 'px'; 205 loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) + 'px'; 206 // main static message 207 var loading_main = document.createElement("div"); 208 loading_main.className = "loading_main"; 209 loading_main.id = "loading_main_" + textarea.name; 210 loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); 211 // sub dynamic message 212 var loading_sub = document.createElement("div"); 213 loading_sub.className = "loading_sub"; 214 loading_sub.id = "loading_sub_" + textarea.name; 215 loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); 216 loading_message.appendChild(loading_main); 217 loading_message.appendChild(loading_sub); 218 document.body.appendChild(loading_message); 219 this.setLoadingMessage("Constructing object"); 184 185 if ( document.getElementById("loading_" + textarea.id) || this.config.showLoading ) 186 { 187 if (!document.getElementById("loading_" + textarea.id)) 188 { 189 Xinha.createLoadingMessage(textarea); 190 } 191 this.setLoadingMessage(Xinha._lc("Constructing object")); 220 192 } 221 193 … … 731 703 side = 'right'; 732 704 } 733 this.setLoadingMessage('Register panel ' + side);705 this.setLoadingMessage('Register ' + side + ' panel '); 734 706 var panel = this.addPanel(side); 735 707 if ( object ) … … 981 953 Xinha.prototype._createToolbar = function () 982 954 { 983 this.setLoadingMessage( 'Create Toolbar');955 this.setLoadingMessage(Xinha._lc('Create Toolbar')); 984 956 var editor = this; // to access this in nested functions 985 957 … … 1314 1286 function(ev) 1315 1287 { 1288 ev = Xinha.is_ie ? window.event : ev; 1289 editor.btnClickEvent = ev; 1316 1290 if ( obj.enabled ) 1317 1291 { … … 1323 1297 } 1324 1298 obj.cmd(editor, obj.name, obj); 1325 Xinha._stopEvent( Xinha.is_ie ? window.event :ev);1299 Xinha._stopEvent(ev); 1326 1300 } 1327 1301 } … … 1502 1476 Xinha.prototype._createStatusBar = function() 1503 1477 { 1504 this.setLoadingMessage( 'Create StatusBar');1478 this.setLoadingMessage(Xinha._lc('Create Statusbar')); 1505 1479 var statusbar = document.createElement("div"); 1506 1480 statusbar.className = "statusBar"; … … 1542 1516 var i; 1543 1517 var editor = this; // we'll need "this" in some nested functions 1544 1545 this.setLoadingMessage("Generate Xinha object");1546 1547 1518 var url; 1519 1520 if (!document.getElementById("XinhaCoreDesign")) 1521 { 1522 Xinha.loadStyle(typeof _editor_css == "string" ? _editor_css : "Xinha.css",null,"XinhaCoreDesign"); 1523 } 1548 1524 1549 1525 // Now load a specific browser plugin which will implement the above for us. … … 1697 1673 // create the editor framework, yah, table layout I know, but much easier 1698 1674 // to get it working correctly this way, sorry about that, patches welcome. 1699 1675 1676 this.setLoadingMessage(Xinha._lc('Generate Xinha framework')); 1677 1700 1678 this._framework = 1701 1679 { … … 1875 1853 // Initalize size 1876 1854 editor.initSize(); 1877 1855 this.setLoadingMessage(Xinha._lc('Finishing')); 1878 1856 // Add an event to initialize the iframe once loaded. 1879 1857 editor._iframeLoadDone = false; … … 1931 1909 Xinha.prototype.initSize = function() 1932 1910 { 1933 this.setLoadingMessage( 'Init editor size');1911 this.setLoadingMessage(Xinha._lc('Init editor size')); 1934 1912 var editor = this; 1935 1913 var width = null; … … 2374 2352 Xinha.prototype.initIframe = function() 2375 2353 { 2376 this.setLoadingMessage('Init IFrame');2377 2354 this.disableToolbar(); 2378 2355 var doc = null; … … 2734 2711 { 2735 2712 if ( !Xinha.isSupportedBrowser ) return; 2736 2713 2714 Xinha.setLoadingMessage (Xinha._lc("Loading plugin $plugin="+pluginName+"$")); 2737 2715 // @todo : try to avoid the use of eval() 2738 2716 // Might already be loaded … … 2897 2875 } 2898 2876 2899 Xinha.loadStyle = function(style, plugin )2877 Xinha.loadStyle = function(style, plugin, id) 2900 2878 { 2901 2879 var url = _editor_url || ''; 2902 if ( typeof plugin != "undefined")2880 if ( plugin ) 2903 2881 { 2904 2882 url += "plugins/" + plugin + "/"; … … 2918 2896 link.rel = "stylesheet"; 2919 2897 link.href = url; 2898 if (id) link.id = id; 2920 2899 head.appendChild(link); 2921 //document.write("<style type='text/css'>@import url(" + url + ");</style>"); 2922 }; 2923 Xinha.loadStyle(typeof _editor_css == "string" ? _editor_css : "Xinha.css"); 2900 }; 2901 2924 2902 2925 2903 /*************************************************** … … 5090 5068 else 5091 5069 { 5092 alert('An error has occurred: ' + req.statusText );5070 alert('An error has occurred: ' + req.statusText + '\nURL: ' + url); 5093 5071 } 5094 5072 } … … 5118 5096 else 5119 5097 { 5120 alert('An error has occurred: ' + req.statusText );5098 alert('An error has occurred: ' + req.statusText + '\nURL: ' + url); 5121 5099 } 5122 5100 } … … 5233 5211 else 5234 5212 { 5213 Xinha.setLoadingMessage("Loading language"); 5235 5214 url = _editor_url+"lang/"+_editor_lang+".js"; 5236 5215 } … … 5494 5473 for ( var i = 0; i < plugin_names.length; i++ ) 5495 5474 { 5496 this.setLoadingMessage( 'Register plugin $plugin', 'Xinha', {'plugin': plugin_names[i]});5475 this.setLoadingMessage(Xinha._lc('Register plugin $plugin', 'Xinha', {'plugin': plugin_names[i]})); 5497 5476 this.registerPlugin(plugin_names[i]); 5498 5477 } … … 5626 5605 y = scope.document.body.clientHeight; 5627 5606 } 5607 return {'x':x,'y':y}; 5608 }; 5609 5610 Xinha.pageSize = function(scope) 5611 { 5612 scope = (scope) ? scope : window; 5613 var x,y; 5614 5615 var test1 = scope.document.body.scrollHeight; //IE Quirks 5616 var test2 = scope.document.documentElement.scrollHeight; // IE Standard + Moz Here quirksmode.org errs! 5617 5618 if (test1 > test2) 5619 { 5620 x = scope.document.body.scrollWidth; 5621 y = scope.document.body.scrollHeight; 5622 } 5623 else 5624 { 5625 x = scope.document.documentElement.scrollWidth; 5626 y = scope.document.documentElement.scrollHeight; 5627 } 5628 5628 return {'x':x,'y':y}; 5629 5629 }; … … 5705 5705 }; 5706 5706 5707 Xinha. prototype.setLoadingMessage = function(string, context, replace)5708 { 5709 if ( !this.config.showLoading || !document.getElementById("loading_sub_" + this._textArea.name) )5707 Xinha.createLoadingMessages = function(xinha_editors) 5708 { 5709 if ( Xinha.loadingMessages || !Xinha.isSupportedBrowser ) 5710 5710 { 5711 5711 return; 5712 5712 } 5713 var elt = document.getElementById("loading_sub_" + this._textArea.name); 5714 elt.innerHTML = Xinha._lc(string, context, replace); 5713 Xinha.loadingMessages = []; 5714 5715 for (var i=0;i<xinha_editors.length;i++) 5716 { 5717 Xinha.loadingMessages.push(Xinha.createLoadingMessage(Xinha.getElementById('textarea', xinha_editors[i]))); 5718 } 5719 }; 5720 5721 Xinha.createLoadingMessage = function(textarea,text) 5722 { 5723 if ( document.getElementById("loading_" + textarea.id) || !Xinha.isSupportedBrowser) 5724 { 5725 return; 5726 } 5727 // Create and show the main loading message and the sub loading message for details of loading actions 5728 // global element 5729 var loading_message = document.createElement("div"); 5730 loading_message.id = "loading_" + textarea.id; 5731 loading_message.className = "loading"; 5732 5733 loading_message.style.left = Xinha.findPosX(textarea) + 'px'; 5734 loading_message.style.top = (Xinha.findPosY(textarea) + textarea.offsetHeight / 2) - 50 + 'px'; 5735 loading_message.style.width = textarea.offsetWidth + 'px'; 5736 5737 // main static message 5738 var loading_main = document.createElement("div"); 5739 loading_main.className = "loading_main"; 5740 loading_main.id = "loading_main_" + textarea.id; 5741 loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!"))); 5742 // sub dynamic message 5743 var loading_sub = document.createElement("div"); 5744 loading_sub.className = "loading_sub"; 5745 loading_sub.id = "loading_sub_" + textarea.id; 5746 text = text ? text : Xinha._lc("Constructing object"); 5747 loading_sub.appendChild(document.createTextNode(text)); 5748 loading_message.appendChild(loading_main); 5749 loading_message.appendChild(loading_sub); 5750 document.body.appendChild(loading_message); 5751 5752 Xinha.freeLater(loading_message); 5753 Xinha.freeLater(loading_main); 5754 Xinha.freeLater(loading_sub); 5755 5756 return loading_sub; 5757 }; 5758 5759 Xinha.prototype.setLoadingMessage = function(subMessage, mainMessage) 5760 { 5761 if ( !document.getElementById("loading_sub_" + this._textArea.id) ) 5762 { 5763 return; 5764 } 5765 document.getElementById("loading_main_" + this._textArea.id).innerHTML = mainMessage ? mainMessage : Xinha._lc("Loading in progress. Please wait!"); 5766 document.getElementById("loading_sub_" + this._textArea.id).innerHTML = subMessage; 5767 }; 5768 5769 Xinha.setLoadingMessage = function(string) 5770 { 5771 if (!Xinha.loadingMessages) return; 5772 for ( var i = 0; i < Xinha.loadingMessages.length; i++ ) 5773 { 5774 Xinha.loadingMessages[i].innerHTML = string; 5775 } 5715 5776 }; 5716 5777 5717 5778 Xinha.prototype.removeLoadingMessage = function() 5718 5779 { 5719 if ( !this.config.showLoading || !document.getElementById("loading_" + this._textArea.name) ) 5720 { 5721 return ; 5722 } 5723 document.body.removeChild(document.getElementById("loading_" + this._textArea.name)); 5780 if (document.getElementById("loading_" + this._textArea.id) ) 5781 { 5782 document.body.removeChild(document.getElementById("loading_" + this._textArea.id)); 5783 } 5784 }; 5785 5786 Xinha.removeLoadingMessages = function(xinha_editors) 5787 { 5788 for (var i=0;i< xinha_editors.length;i++) 5789 { 5790 var main = document.getElementById("loading_" + document.getElementById(xinha_editors[i]).id); 5791 main.parentNode.removeChild(main); 5792 } 5793 Xinha.loadingMessages = null; 5724 5794 }; 5725 5795 -
trunk/popups/popup.js
r740 r797 45 45 if(window.__dlg_init_done) return true; 46 46 47 if(window.opener._editor_skin != "") {47 if(window.opener._editor_skin) { 48 48 var head = document.getElementsByTagName("head")[0]; 49 49 var link = document.createElement("link"); … … 55 55 window.dialogArguments = opener.Dialog._arguments; 56 56 57 var body = document.body;57 var page = Xinha.pageSize(window); 58 58 if ( !win_dim ) 59 59 { 60 var dim = Xinha.viewportSize(window); 61 win_dim = {width:dim.x, height: body.scrollHeight}; 60 win_dim = {width:page.x, height: page.y}; 62 61 } 63 62 window.resizeTo(win_dim.width, win_dim.height); 64 63 65 64 var dim = Xinha.viewportSize(window); 66 window.resizeBy(0, body.scrollHeight - dim.y); 65 66 window.resizeBy(0, page.y - dim.y); 67 67 68 68 if(win_dim.top && win_dim.left)
