Ticket #139 (closed enhancement: fixed)
replace HTMLArea.loadScript with HTMLArea._loadback
| Reported by: | niko | Owned by: | niko |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Xinha Core | Version: | 0.1 |
| Severity: | normal | Keywords: | loadScript loadback |
| Cc: |
Description (last modified by niko) (diff)
Currently there are two methods for loading additional JavaScript?-Files:
- HTMLArea.loadScript
- HTMLArea._loadback
this patch tries to get rid of loadScript in favor of _loadback
Index: htmlarea.js
===================================================================
--- htmlarea.js (Revision 71)
+++ htmlarea.js (Arbeitskopie)
@@ -119,45 +119,17 @@
}
};
HTMLArea.onload = function(){};
-HTMLArea._scripts = [];
-HTMLArea.loadScript = function(url, plugin) {
- if (plugin)
- url = HTMLArea.getPluginDir(plugin) + '/' + url;
- this._scripts.push(url);
-};
-
-
HTMLArea.init = function() {
-
- var head = document.getElementsByTagName("head")[0];
- var current = 0;
- var savetitle = document.title;
- var evt = HTMLArea.is_ie ? "onreadystatechange" : "onload";
- function loadNextScript() {
- if (current > 0 && HTMLArea.is_ie &&
- !/loaded|complete/.test(window.event.srcElement.readyState))
- return;
- if (current < HTMLArea._scripts.length) {
- var url = HTMLArea._scripts[current++];
- document.title = "[HTMLArea: loading script " + current + "/" + HTMLArea._scripts.length + "]";
- var script = document.createElement("script");
- script.type = "text/javascript";
- script.src = url;
- script[evt] = loadNextScript;
- head.appendChild(script);
- } else {
- document.title = savetitle;
HTMLArea.onload();
- }
- };
- loadNextScript();
};
-HTMLArea.loadScript(_editor_url + "dialog.js");
-HTMLArea.loadScript(_editor_url + "inline-dialog.js");
-HTMLArea.loadScript(_editor_url + "popupwin.js");
// cache some regexps
HTMLArea.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig;
@@ -958,6 +930,27 @@
{
var editor = this; // we'll need "this" in some nested functions
+ if(typeof Dialog == 'undefined')
+ {
+ HTMLArea._loadback
+ (_editor_url + 'dialog.js', function() { editor.generate(); } );
+ return false;
+ }
+
+ if(typeof HTMLArea.Dialog == 'undefined')
+ {
+ HTMLArea._loadback
+ (_editor_url + 'inline-dialog.js', function() { editor.generate(); } );
+ return false;
+ }
+
+ if(typeof PopupWin == 'undefined')
+ {
+ HTMLArea._loadback
+ (_editor_url + 'popupwin.js', function() { editor.generate(); } );
+ return false;
+ }
+
// If this is gecko, set up the paragraph handling now
if(HTMLArea.is_gecko)
{
Please comment on this patch if i should commit it...
problems with the patch: - fullscreen doesn't work anymore (the built-in-fullscreen-mode) but bevore fixing these problems: can't we just remove the whole build-in-fullscreen-mode - as there is the great working and better fullscreen-plugin?
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
