diff --git a/components/greasemonkey.js b/components/greasemonkey.js index 2d935644f..fcd2fafb0 100644 --- a/components/greasemonkey.js +++ b/components/greasemonkey.js @@ -279,7 +279,7 @@ service.prototype.shouldLoad = function(ct, cl, org, ctx, mt, ext) { var ret = Ci.nsIContentPolicy.ACCEPT; // Don't intercept anything when GM is not enabled. - if (!GM_getEnabled()) { + if (!GM_util.getEnabled()) { return ret; } @@ -363,7 +363,7 @@ service.prototype.runScripts = function( aRunWhen, aWrappedContentWin, aChromeWin ) { var url = aWrappedContentWin.document.location.href; - if (!GM_getEnabled() || !GM_util.isGreasemonkeyable(url)) return; + if (!GM_util.getEnabled() || !GM_util.isGreasemonkeyable(url)) return; if (GM_prefRoot.getValue('enableScriptRefreshing')) { this._config.updateModifiedScripts(aWrappedContentWin, aChromeWin); diff --git a/content/browser.js b/content/browser.js index 149ad5d9b..59b5e842a 100644 --- a/content/browser.js +++ b/content/browser.js @@ -101,7 +101,7 @@ GM_BrowserUI.chromeLoad = function(e) { }; GM_BrowserUI.contentLoad = function(event) { - if (!GM_getEnabled()) return; + if (!GM_util.getEnabled()) return; var safeWin = event.target.defaultView; var href = safeWin.location.href; @@ -287,7 +287,7 @@ GM_BrowserUI.refreshStatus = function() { var enabledEl = document.getElementById("gm_toggle_enabled"); var checkedEl = document.getElementById("gm_toggle_checked"); - if (GM_getEnabled()) { + if (GM_util.getEnabled()) { checkedEl.setAttribute('checked', true); enabledEl.removeAttribute('disabled'); } else { diff --git a/content/browser.xul b/content/browser.xul index 518f3a5c2..397f1e3f5 100644 --- a/content/browser.xul +++ b/content/browser.xul @@ -16,9 +16,9 @@ - + - + diff --git a/content/statusbar.js b/content/statusbar.js index cfa501bdf..7ab74572f 100644 --- a/content/statusbar.js +++ b/content/statusbar.js @@ -21,7 +21,7 @@ window.addEventListener('load', function window_load() { function GM_statusClicked(aEvent) { switch (aEvent.button) { case 0: - GM_setEnabled(!GM_getEnabled()); + GM_setEnabled(!GM_util.getEnabled()); break; case 1: GM_OpenScriptsMgr(); @@ -41,7 +41,7 @@ window.GM_statusClicked = GM_statusClicked; * the mozilla preference that backs it directly. */ function refreshStatus() { - if (GM_getEnabled()) { + if (GM_util.getEnabled()) { statusImageEl.src = "chrome://greasemonkey/skin/icon16.png"; statusImageEl.tooltipText = stringBundle.getString("tooltip.enabled"); } else { diff --git a/content/utils.js b/content/utils.js index 987f37ef1..edc9b877c 100644 --- a/content/utils.js +++ b/content/utils.js @@ -15,10 +15,6 @@ function GM_getConfig() { return GM_getService().config; } -function GM_getEnabled() { - return GM_prefRoot.getValue("enabled", true); -} - function GM_setEnabled(enabled) { GM_prefRoot.setValue("enabled", enabled); } diff --git a/modules/util/getEnabled.js b/modules/util/getEnabled.js new file mode 100644 index 000000000..eb0a33737 --- /dev/null +++ b/modules/util/getEnabled.js @@ -0,0 +1,7 @@ +Components.utils.import('resource://greasemonkey/prefmanager.js'); + +const EXPORTED_SYMBOLS = ['getEnabled']; + +function getEnabled() { + return GM_prefRoot.getValue("enabled", true); +}