- Timestamp:
- 03/09/07 17:42:03 (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Xinha.css
r738 r767 1 1 .htmlarea { background: #fff; } 2 .htmlarea td { margin:0;padding:0; } 2 3 3 4 .htmlarea .toolbar { … … 55 56 .htmlarea .toolbar .separator { 56 57 /*position: relative;*/ 57 margin: 3px;58 margin:0 3px; 58 59 border-left: 1px solid ButtonShadow; 59 60 border-right: 1px solid ButtonHighlight; -
trunk/XinhaCore.js
r766 r767 111 111 Xinha.ie_version= parseFloat(Xinha.agt.substring(Xinha.agt.indexOf("msie")+5)); 112 112 Xinha.is_opera = (Xinha.agt.indexOf("opera") != -1); 113 Xinha.is_khtml = (Xinha.agt.indexOf("khtml") != -1); 114 Xinha.is_safari = (Xinha.agt.indexOf("safari") != -1); 113 115 Xinha.opera_version = navigator.appVersion.substring(0, navigator.appVersion.indexOf(" "))*1; 114 116 Xinha.is_mac = (Xinha.agt.indexOf("mac") != -1); 115 117 Xinha.is_mac_ie = (Xinha.is_ie && Xinha.is_mac); 116 118 Xinha.is_win_ie = (Xinha.is_ie && !Xinha.is_mac); 117 Xinha.is_gecko = (navigator.product == "Gecko" );119 Xinha.is_gecko = (navigator.product == "Gecko" && !Xinha.is_safari); // Safari lies! 118 120 Xinha.isRunLocally = document.URL.toLowerCase().search(/^file:/) != -1; 119 121 Xinha.is_designMode = (typeof document.designMode != 'undefined' && !Xinha.is_ie); // IE has designMode, but we're not using it 120 if ( Xinha.isRunLocally ) 122 Xinha.checkSupportedBrowser = function() 123 { 124 if ( Xinha.is_gecko ) 125 { 126 if ( navigator.productSub < 20021201 ) 127 { 128 alert("You need at least Mozilla-1.3 Alpha.\nSorry, your Gecko is not supported."); 129 return false; 130 } 131 if ( navigator.productSub < 20030210 ) 132 { 133 alert("Mozilla < 1.3 Beta is not supported!\nI'll try, though, but it might not work."); 134 } 135 } 136 if ( Xinha.is_opera ) 137 { 138 alert("Sorry, Opera is not yet supported by Xinha."); 139 } 140 return Xinha.is_gecko || (Xinha.is_opera && Xinha.opera_version >= 9.1) || Xinha.ie_version >= 5.5; 141 }; 142 143 Xinha.isSupportedBrowser = Xinha.checkSupportedBrowser(); 144 145 if ( Xinha.isRunLocally && Xinha.isSupportedBrowser) 121 146 { 122 147 alert('Xinha *must* be installed on a web server. Locally opened files (those that use the "file://" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.'); … … 127 152 function Xinha(textarea, config) 128 153 { 154 if ( !Xinha.isSupportedBrowser ) return; 155 129 156 if ( !textarea ) 130 157 { … … 132 159 } 133 160 134 if ( Xinha.checkSupportedBrowser() ) 135 { 136 if ( typeof config == "undefined" ) 137 { 138 this.config = new Xinha.Config(); 139 } 140 else 141 { 142 this.config = config; 143 } 144 this._htmlArea = null; 145 146 if ( typeof textarea != 'object' ) 147 { 148 textarea = Xinha.getElementById('textarea', textarea); 149 } 150 this._textArea = textarea; 151 this._textArea.spellcheck = false; 152 153 // Before we modify anything, get the initial textarea size 154 this._initial_ta_size = 155 { 156 w: textarea.style.width ? textarea.style.width : ( textarea.offsetWidth ? ( textarea.offsetWidth + 'px' ) : ( textarea.cols + 'em') ), 157 h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) 158 }; 159 // Create the loading message elements 160 if ( this.config.showLoading ) 161 { 162 // Create and show the main loading message and the sub loading message for details of loading actions 163 // global element 164 var loading_message = document.createElement("div"); 165 loading_message.id = "loading_" + textarea.name; 166 loading_message.className = "loading"; 167 try 168 { 169 // how can i find the real width in pixels without % or em *and* with no visual errors ? 170 // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading 171 // A few lines above seems to indicate offsetWidth is not always set 172 loading_message.style.width = textarea.offsetWidth + 'px'; 173 } 174 catch (ex) 175 { 176 // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width 177 loading_message.style.width = this._initial_ta_size.w; 178 } 179 loading_message.style.left = Xinha.findPosX(textarea) + 'px'; 180 loading_message.style.top = (Xinha.findPosY(textarea) + parseInt(this._initial_ta_size.h, 10) / 2) + 'px'; 181 // main static message 182 var loading_main = document.createElement("div"); 183 loading_main.className = "loading_main"; 184 loading_main.id = "loading_main_" + textarea.name; 185 loading_main.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait !"))); 186 // sub dynamic message 187 var loading_sub = document.createElement("div"); 188 loading_sub.className = "loading_sub"; 189 loading_sub.id = "loading_sub_" + textarea.name; 190 loading_sub.appendChild(document.createTextNode(Xinha._lc("Constructing main object"))); 191 loading_message.appendChild(loading_main); 192 loading_message.appendChild(loading_sub); 193 document.body.appendChild(loading_message); 194 this.setLoadingMessage("Constructing object"); 195 } 196 197 this._editMode = "wysiwyg"; 198 this.plugins = {}; 199 this._timerToolbar = null; 200 this._timerUndo = null; 201 this._undoQueue = [this.config.undoSteps]; 202 this._undoPos = -1; 203 this._customUndo = true; 204 this._mdoc = document; // cache the document, we need it in plugins 205 this.doctype = ''; 206 this.__htmlarea_id_num = __xinhas.length; 207 __xinhas[this.__htmlarea_id_num] = this; 208 209 this._notifyListeners = {}; 210 211 // Panels 212 var panels = 213 { 214 right: 215 { 216 on: true, 217 container: document.createElement('td'), 218 panels: [] 219 }, 220 left: 221 { 222 on: true, 223 container: document.createElement('td'), 224 panels: [] 225 }, 226 top: 227 { 228 on: true, 229 container: document.createElement('td'), 230 panels: [] 231 }, 232 bottom: 233 { 234 on: true, 235 container: document.createElement('td'), 236 panels: [] 237 } 238 }; 239 240 for ( var i in panels ) 241 { 242 if(!panels[i].container) { continue; } // prevent iterating over wrong type 243 panels[i].div = panels[i].container; // legacy 244 panels[i].container.className = 'panels ' + i; 245 Xinha.freeLater(panels[i], 'container'); 246 Xinha.freeLater(panels[i], 'div'); 247 } 248 // finally store the variable 249 this._panels = panels; 250 251 Xinha.freeLater(this, '_textArea'); 252 } 161 if ( typeof config == "undefined" ) 162 { 163 this.config = new Xinha.Config(); 164 } 165 else 166 { 167 this.config = config; 168 } 169 this._htmlArea = null; 170 171 if ( typeof textarea != 'object' ) 172 { 173 textarea = Xinha.getElementById('textarea', textarea); 174 } 175 this._textArea = textarea; 176 this._textArea.spellcheck = false; 177 178 // Before we modify anything, get the initial textarea size 179 this._initial_ta_size = 180 { 181 w: textarea.style.width ? textarea.style.width : ( textarea.offsetWidth ? ( textarea.offsetWidth + 'px' ) : ( textarea.cols + 'em') ), 182 h: textarea.style.height ? textarea.style.height : ( textarea.offsetHeight ? ( textarea.offsetHeight + 'px' ) : ( textarea.rows + 'em') ) 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"); 220 } 221 222 this._editMode = "wysiwyg"; 223 this.plugins = {}; 224 this._timerToolbar = null; 225 this._timerUndo = null; 226 this._undoQueue = [this.config.undoSteps]; 227 this._undoPos = -1; 228 this._customUndo = true; 229 this._mdoc = document; // cache the document, we need it in plugins 230 this.doctype = ''; 231 this.__htmlarea_id_num = __xinhas.length; 232 __xinhas[this.__htmlarea_id_num] = this; 233 234 this._notifyListeners = {}; 235 236 // Panels 237 var panels = 238 { 239 right: 240 { 241 on: true, 242 container: document.createElement('td'), 243 panels: [] 244 }, 245 left: 246 { 247 on: true, 248 container: document.createElement('td'), 249 panels: [] 250 }, 251 top: 252 { 253 on: true, 254 container: document.createElement('td'), 255 panels: [] 256 }, 257 bottom: 258 { 259 on: true, 260 container: document.createElement('td'), 261 panels: [] 262 } 263 }; 264 265 for ( var i in panels ) 266 { 267 if(!panels[i].container) { continue; } // prevent iterating over wrong type 268 panels[i].div = panels[i].container; // legacy 269 panels[i].container.className = 'panels ' + i; 270 Xinha.freeLater(panels[i], 'container'); 271 Xinha.freeLater(panels[i], 'div'); 272 } 273 // finally store the variable 274 this._panels = panels; 275 276 Xinha.freeLater(this, '_textArea'); 253 277 } 254 278 … … 1499 1523 Xinha.prototype.generate = function () 1500 1524 { 1525 if ( !Xinha.isSupportedBrowser ) return; 1526 1501 1527 var i; 1502 1528 var editor = this; // we'll need "this" in some nested functions … … 2612 2638 Xinha.prototype.registerPlugin = function() 2613 2639 { 2640 if ( !Xinha.isSupportedBrowser ) return; 2641 2614 2642 var plugin = arguments[0]; 2615 2643 … … 2675 2703 Xinha.loadPlugin = function(pluginName, callback, plugin_file) 2676 2704 { 2705 if ( !Xinha.isSupportedBrowser ) return; 2706 2677 2707 // @todo : try to avoid the use of eval() 2678 2708 // Might already be loaded … … 2701 2731 Xinha.loadPlugins = function(plugins, callbackIfNotReady) 2702 2732 { 2733 if ( !Xinha.isSupportedBrowser ) return; 2734 2703 2735 // Rip the ones that are loaded and look for ones that have failed 2704 2736 var retVal = true; … … 4376 4408 }; 4377 4409 4378 Xinha.checkSupportedBrowser = function()4379 {4380 if ( Xinha.is_gecko )4381 {4382 if ( navigator.productSub < 20021201 )4383 {4384 alert("You need at least Mozilla-1.3 Alpha.\nSorry, your Gecko is not supported.");4385 return false;4386 }4387 if ( navigator.productSub < 20030210 )4388 {4389 alert("Mozilla < 1.3 Beta is not supported!\nI'll try, though, but it might not work.");4390 }4391 }4392 if ( Xinha.is_opera )4393 {4394 alert("Sorry, Opera is not yet supported by Xinha.");4395 }4396 return Xinha.is_gecko || (Xinha.is_opera && Xinha.opera_version >= 9.1) || Xinha.ie_version >= 5.5;4397 };4398 4399 4410 // selection & ranges 4400 4411 … … 5379 5390 Xinha.makeEditors = function(editor_names, default_config, plugin_names) 5380 5391 { 5392 if ( !Xinha.isSupportedBrowser ) return; 5393 5381 5394 if ( typeof default_config == 'function' ) 5382 5395 { … … 5401 5414 Xinha.startEditors = function(editors) 5402 5415 { 5416 if ( !Xinha.isSupportedBrowser ) return; 5417 5403 5418 for ( var i in editors ) 5404 5419 { … … 5412 5427 Xinha.prototype.registerPlugins = function(plugin_names) 5413 5428 { 5429 if ( !Xinha.isSupportedBrowser ) return; 5430 5414 5431 if ( plugin_names ) 5415 5432 { -
trunk/plugins/Equation/example.html
r677 r767 23 23 <pre> 24 24 25 <!-- This block is optional configuration --& lt;25 <!-- This block is optional configuration --> 26 26 <script type="text/javascript"> 27 27 var mathcolor = "black"; // You may change the color of the formulae (default: red) … … 29 29 var mathfontfamily = "Arial"; //and the font (default: serif, which is good I think) 30 30 </script> 31 <!-- THIS LOADS THE ACTUAL SCRIPT --<32 <script type="text/javascript" src=" ASCIIMathML.js"></script>31 <!-- THIS LOADS THE ACTUAL SCRIPT, PLEASE ADJUST THE URL --< 32 <script type="text/javascript" src="/xinha/plugins/Equation/ASCIIMathML.js"></script> 33 33 34 34 -
trunk/plugins/SuperClean/tidy.php
r744 r767 116 116 ob_end_clean(); 117 117 118 if( !strlen($content))118 if(strlen($content) < 4) 119 119 { 120 120 // Tidy on the local machine failed, try a post
Note: See TracChangeset
for help on using the changeset viewer.