Skip to content

Commit

Permalink
Closes #129 Open the add-on details page when clicking Open Manager i…
Browse files Browse the repository at this point in the history
…n the install door hanger notification
  • Loading branch information
erikvold committed Jul 20, 2013
1 parent e900de6 commit 0658cda
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
12 changes: 3 additions & 9 deletions extension/modules/addonprovider.js
Expand Up @@ -25,15 +25,14 @@ const Scriptish_ScriptProvider = {
var msg = "'" + script.name;
if (script.version) msg += " " + script.version;
msg += "' " + Scriptish_stringBundle("statusbar.installed");
var callback = Scriptish_openManager;

var showedMsg = Scriptish_popupNotification({
id: "scriptish-install-popup-notification",
message: msg,
mainAction: {
label: Scriptish_stringBundle("openUserScriptsManager"),
accessKey: Scriptish_stringBundle("openUserScriptsManager.ak"),
callback: callback
callback: Scriptish_openManager.bind(null, null, script.id)
},
options: {
removeOnDismissal: true,
Expand Down Expand Up @@ -68,26 +67,21 @@ const Scriptish_ScriptProvider = {
msg += "' " + (("scriptish-script-updated" == aTopic)
? Scriptish_stringBundle("statusbar.updated")
: Scriptish_stringBundle("statusbar.modified"));
var callback = Scriptish_openManager;

var showedMsg = Scriptish_popupNotification({
Scriptish_popupNotification({
id: "scriptish-install-popup-notification",
message: msg,
mainAction: {
label: Scriptish_stringBundle("openUserScriptsManager"),
accessKey: Scriptish_stringBundle("openUserScriptsManager.ak"),
callback: callback
callback: Scriptish_openManager.bind(null, null, script.id)
},
options: {
removeOnDismissal: true,
persistWhileVisible: true
}
});

if (!showedMsg) {
Scriptish_notification(msg, null, null, callback);
}

break;
case "scriptish-script-uninstalling":
AddonManagerPrivate.callAddonListeners("onUninstalling", script, false);
Expand Down
21 changes: 15 additions & 6 deletions extension/modules/utils/Scriptish_openManager.js
@@ -1,10 +1,19 @@
var EXPORTED_SYMBOLS = ["Scriptish_openManager"];
Components.utils.import("resource://scriptish/constants.js");

function Scriptish_openManager() {
var browserWin = Services.wm.getMostRecentWindow("navigator:browser");
if (browserWin.BrowserOpenAddonsMgr) // ff
browserWin.BrowserOpenAddonsMgr("addons://list/userscript");
else if (browserWin.toEM) // sm
browserWin.toEM("addons://list/userscript");
function Scriptish_openManager(aURL, aID) {
aURL = aURL || "addons://list/userscript";
if (aID) {
aURL = 'addons://detail/' + encodeURIComponent(aID) + '/preferences';
}

let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
// Fx
if (browserWin.BrowserOpenAddonsMgr) {
browserWin.BrowserOpenAddonsMgr(aURL);
}
// Sm
else if (browserWin.toEM) {
browserWin.toEM(aURL);
}
}

0 comments on commit 0658cda

Please sign in to comment.