Opened 13 years ago

Closed 13 years ago

#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)

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 (1)

Bill To.doc (53.0 KB) - added by anonymous 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by niko

  • Description modified (diff)

comment:2 Changed 13 years ago by guillaumed

Sorry but I don't see why there is an effect on full screen??

comment:3 Changed 13 years ago by niko

source:trunk/popups/fullscreen.html uses HTMLArea.loadScript (line 24)
(i was not talking about the fullscreen-plugin)

comment:4 Changed 13 years ago by gogo

Niko, I would say lets get rid of the built in fullscreen, it's pretty useless anyway. If you want to do that and apply your patch above, I say, go for it.

comment:5 Changed 13 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

changeset:140

  1. replace HTMLArea.loadScript with HTMLArea._loadback
  2. remove the old fullscreen
  3. auto-load the fullscreen-plugin when there is a popupeditor-button in the toolbar

Changed 13 years ago by anonymous

Note: See TracTickets for help on using tickets.