Changeset 701

Show
Ignore:
Timestamp:
03/28/08 08:11:42 (8 months ago)
Author:
ma..@jesperkristensen.dk
Message:

make opening the New User Script dialog more flexible

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/manage-ui2/src/chrome/chromeFiles/content/browser.js

    r694 r701  
    541541 
    542542GM_BrowserUI.newUserScript = function() { 
    543   var windowWatcher = Components 
    544     .classes["@mozilla.org/embedcomp/window-watcher;1"] 
    545     .getService(Components.interfaces.nsIWindowWatcher); 
    546   windowWatcher.openWindow( 
    547     window, "chrome://greasemonkey/content/newscript.xul", null, 
    548     "chrome,dependent,centerscreen,resizable,dialog", null 
    549   ); 
     543  GM_openNewUserScriptDialog(window); 
    550544}; 
    551545 
     
    653647 
    654648GM_BrowserUI.manageMenuItemClicked = function() { 
    655    GM_openUserScriptManager(); 
     649   GM_openUserScriptManager(window); 
    656650}; 
    657651 
  • branches/manage-ui2/src/chrome/chromeFiles/content/newscript.js

    r692 r701  
    1111 
    1212  // default the includes with the current page's url 
    13   document.getElementById("includes").value = 
    14       window.opener.document.getElementById("content").selectedBrowser 
    15       .contentWindow.location.href; 
     13  var win = Components.classes["@mozilla.org/appshell/window-mediator;1"] 
     14                      .getService(Components.interfaces.nsIWindowMediator) 
     15                      .getMostRecentWindow("navigator:browser"); 
     16  if (win) { 
     17    document.getElementById("includes").value = win.content.location.href; 
     18  } 
    1619}, false); 
    1720 
  • branches/manage-ui2/src/chrome/chromeFiles/content/utils.js

    r694 r701  
    7777} 
    7878 
    79 function GM_openUserScriptManager() { 
     79function GM_openUserScriptManager(parentWindow) { 
    8080  var win = Components.classes["@mozilla.org/appshell/window-mediator;1"] 
    8181                      .getService(Components.interfaces.nsIWindowMediator) 
     
    8484    win.focus(); 
    8585  } else { 
    86     var parentWindow = (!window.opener || window.opener.closed) ? 
    87       window : window.opener; 
    88     parentWindow.openDialog("chrome://greasemonkey/content/manage.xul", 
    89       "_blank", "resizable,dialog=no,centerscreen"); 
    90   } 
     86    parentWindow.openDialog("chrome://greasemonkey/content/manage.xul", "", 
     87      "chrome,resizable,dialog=no,centerscreen"); 
     88  } 
     89
     90 
     91function GM_openNewUserScriptDialog(parentWindow) { 
     92  parentWindow.openDialog("chrome://greasemonkey/content/newscript.xul", "", 
     93    "chrome,dependent,centerscreen,resizable,dialog"); 
    9194} 
    9295