aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpapush2021-08-29 16:53:20 +0200
committerpapush2021-08-29 16:53:20 +0200
commit810b2ba15eb9b994c9e26e205ace52dfae0c184e (patch)
tree8fdd82c94999d05ce508511a566d8faee5377d81
parentaba52e86792a697e006f119851277e2770a01c45 (diff)
fix browser pref syncing and clean up overlay init
-rw-r--r--chrome/js/browserOverlay.js33
1 files changed, 9 insertions, 24 deletions
diff --git a/chrome/js/browserOverlay.js b/chrome/js/browserOverlay.js
index 1d3efab..81d19f2 100644
--- a/chrome/js/browserOverlay.js
+++ b/chrome/js/browserOverlay.js
@@ -2,33 +2,19 @@ Components.utils.import("chrome://redirector/content/js/redirectorprefs.js");
Components.utils.import("chrome://redirector/content/js/redirector.js");
var RedirectorOverlay = {
-
strings : null,
prefs : null,
onLoad : function(event) {
- try {
-
- // initialization code
- document.getElementById('contentAreaContextMenu')
- .addEventListener("popupshowing", function(e) { RedirectorOverlay.showContextMenu(e); }, false);
-
- this.strings = document.getElementById("redirector-strings");
- this.prefs = new RedirectorPrefs();
- this.changedPrefs(this.prefs);
- this.prefs.addListener(this);
- document.addEventListener('keypress', function(event) {
- if ((event.charCode == 114) && event.altKey) { //alt+r
- RedirectorOverlay.toggleEnabled();
- }
- }, true);
- } catch(e) {
- if (this.strings) {
- alert(this.strings.getString("initError") + "\n\n" + e);
- } else {
- alert(e);
+ this.strings = document.getElementById("redirector-strings");
+ this.prefs = new RedirectorPrefs();
+ this.changedPrefs(this.prefs);
+ this.prefs.addListener(this);
+ document.addEventListener('keypress', function(event) {
+ if ((event.charCode == 114) && event.altKey) { //alt+r
+ RedirectorOverlay.toggleEnabled();
}
- }
+ }, true);
},
onUnload : function(event) {
@@ -37,8 +23,6 @@ var RedirectorOverlay = {
},
changedPrefs : function(prefs) {
- var button = document.getElementById('redirector-button');
- document.getElementById('redirector-context').hidden = !prefs.showContextMenu;
this.refreshUI();
},
@@ -70,5 +54,6 @@ var RedirectorOverlay = {
});
}
};
+
window.addEventListener("load", function(event) { RedirectorOverlay.onLoad(event); }, false);
window.addEventListener("unload", function(event) { RedirectorOverlay.onUnload(event); }, false);