[Pkg-mozext-commits] [greasemonkey] 09/26: Make `GM_BrowserUI.checkDisabledScriptNavigation()` active only in disabled state.
David Prévot
taffit at moszumanska.debian.org
Thu Feb 25 02:27:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 5808f275563230c792dba35e7ed3c6f6d6dd8f23
Author: Anthony Lieuallen <arantius at gmail.com>
Date: Wed Jan 20 15:51:26 2016 -0500
Make `GM_BrowserUI.checkDisabledScriptNavigation()` active only in disabled state.
Prevents duplicate notification bars in case of "show script source".
Fixes #2348
---
content/browser.js | 50 +++++++++++++++++++++-----------------------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/content/browser.js b/content/browser.js
index 44bc506..c2671d2 100644
--- a/content/browser.js
+++ b/content/browser.js
@@ -202,45 +202,37 @@ GM_BrowserUI.openOptions = function() {
};
GM_BrowserUI.checkDisabledScriptNavigation = function(aContentType, aHref) {
+ if (GM_util.getEnabled()) return;
if (!aHref.match(/\.user\.js$/)) return;
if (aContentType.match(/^text\/(x|ht)ml/)) return;
- // Handle enabled (i.e. show script source button) navigation by default.
- var msg = GM_BrowserUI.bundle.GetStringFromName('greeting.msg');
- var buttons = [];
-
- if (!GM_util.getEnabled()) {
- // Add options for disabled state.
- msg = GM_BrowserUI.bundle.GetStringFromName('disabledWarning');
- buttons.push({
- 'label': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enable'),
- 'accessKey': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enable.accessKey'),
- 'popup': null,
- 'callback': function() { GM_util.setEnabled(true); }
- });
- buttons.push({
- 'label': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enableAndInstall'),
- 'accessKey': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enableAndInstall.accessKey'),
- 'popup': null,
- 'callback': function() {
- GM_util.setEnabled(true);
- GM_util.showInstallDialog(aHref, gBrowser);
- }
- });
- }
-
- buttons.push({
+ var buttons = [{
+ 'label': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enable'),
+ 'accessKey': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enable.accessKey'),
+ 'popup': null,
+ 'callback': function() {
+ GM_util.setEnabled(true);
+ }
+ },{
+ 'label': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enableAndInstall'),
+ 'accessKey': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.enableAndInstall.accessKey'),
+ 'popup': null,
+ 'callback': function() {
+ GM_util.setEnabled(true);
+ GM_util.showInstallDialog(aHref, gBrowser);
+ }
+ },{
'label': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.install'),
'accessKey': GM_BrowserUI.bundle.GetStringFromName('disabledWarning.install.accessKey'),
'popup': null,
- 'callback': GM_util.hitch(this, function() {
+ 'callback': function() {
GM_util.showInstallDialog(aHref, gBrowser);
- })
- });
+ }
+ }];
var notificationBox = gBrowser.getNotificationBox();
notificationBox.appendNotification(
- msg,
+ GM_BrowserUI.bundle.GetStringFromName('greeting.msg'),
"install-userscript",
"chrome://greasemonkey/skin/icon16.png",
notificationBox.PRIORITY_WARNING_MEDIUM,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list