Show
Ignore:
Timestamp:
06/07/08 09:08:53 (4 years ago)
Author:
ray
Message:

update to new dialog plugins: separation of code into several files to reduce loading time

Location:
branches/new-dialogs-merge/modules/CreateLink
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/new-dialogs-merge/modules/CreateLink/link.js

    r1009 r1011  
    5050CreateLink.prototype.onGenerateOnce = function() 
    5151{ 
    52         this.prepareDialog(); 
    53         this.loadScripts(); 
     52  CreateLink.loadAssets(); 
    5453}; 
    5554 
    56 CreateLink.prototype.loadScripts = function() 
     55CreateLink.loadAssets = function() 
    5756{ 
    58   var self = this; 
    59   if(!this.methodsReady) 
    60         { 
    61                 Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
    62                 return; 
    63         } 
    64 }; 
     57        var self = CreateLink; 
     58        if (self.loading) return; 
     59        self.loading = true; 
     60        Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.dialogReady = true; }); 
     61        Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 
     62} 
    6563 
    6664CreateLink.prototype.onUpdateToolbar = function() 
    6765{  
    68   if (!(this.dialogReady && this.methodsReady)) 
     66        if (!(CreateLink.dialogReady && CreateLink.methodsReady)) 
    6967        { 
    70           this.editor._toolbarObjects.createlink.state("enabled", false); 
     68                this.editor._toolbarObjects.createlink.state("enabled", false); 
    7169        } 
     70        else this.onUpdateToolbar = null; 
    7271}; 
    7372 
     
    7776        var editor = this.editor; 
    7877 
    79         if(!this.html) // retrieve the raw dialog contents 
    80         { 
    81                 Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 
    82                 return; 
    83         } 
    84  
    85         // Now we have everything we need, so we can build the dialog. 
    86                  
    87         var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 
     78        var dialog = this.dialog = new Xinha.Dialog(editor, CreateLink.html, 'Xinha',{width:400}) 
    8879        // Connect the OK and Cancel buttons 
    8980        dialog.getElementById('ok').onclick = function() {self.apply();} 
  • branches/new-dialogs-merge/modules/CreateLink/pluginMethods.js

    r1008 r1011  
    22CreateLink.prototype.show = function(a) 
    33{ 
     4  if (!this.dialog) 
     5  { 
     6    this.prepareDialog(); 
     7  }  
    48        var editor = this.editor; 
    59        this.a = a;