From 1dff54e0aaba3a95af75a7e6d8cd1c846223be26 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 25 Sep 2013 00:56:26 -0500 Subject: [PATCH 01/22] V2.0 Submitted for review The submitted 2.0 version. Includes auto-install for favorites and fix the customization icon update. Rename "Statusbar" to "Add-on Bar" --- ReadMe.txt | 4 +-- content/browserOverlay.js | 56 ++++++++++++++++++++++++++++++-------- install.rdf | 2 -- locale/en-US/quickjava.dtd | 2 +- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 18e43c9..299c2a5 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -2,10 +2,10 @@ //By Doug G. // //Allows quick enable and disable of Java, Javascript, Cookies, Image Animations, Flash, Silverlight, Images, Stylesheets and Proxy -//from the Statusbar and/or Toolbar. +//from the Add-on bar and/or Toolbar. // //Version History -//Version 2.0 Major update! Favorite toolbar button added (auto-install needed). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization +//Version 2.0 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. //Version 1.8.1.1 ClickToPlay as an option (hidden) for Enabled state //Version 1.8.1 Update to work with FF23 and above, fix button spacing and skinning (provided by anonymous user), Slight change to look of icons to modernize (provided by Dave). //Version 1.8.0 Back to Red buttons, a few minor bug fixes and added links on Options page. Thanks again to Dave for more help. diff --git a/content/browserOverlay.js b/content/browserOverlay.js index a901a46..a83e32f 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -10,13 +10,14 @@ thatoneguydotnet.QuickJava={ onLoad: function(evt) { this.errMsg = ''; - this.debugMode = true; + this.debugMode = false; this.alertPluginNames = false; this.alertPluginNamesOnMatch = false; - this.curVersion = ''; - this.firstInstallUrl = ''; - this.newVersionUrl = ''; - this.massToggle = false; + this.firstInstallUrl = 'http://quickjavaplugin.blogspot.com/2012/07/quickjava-quick-help.html'; + this.newVersionUrl = 'http://quickjavaplugin.blogspot.com/2013/09/quickjava-20.html'; + + this.curVersion = ''; //do not initialize, automatically loaded + this.massToggle = false; //program use, do not initialize to true try { @@ -104,9 +105,14 @@ versionCheck: function(addon) { if (this.curVersion != addon.version) { - if (this.curVersion == '' && this.firstInstallUrl != '') + if (this.curVersion == '') { - this.openTab(this.firstInstallUrl,true); + this.installButton("nav-bar", "QuickJava_ToolbarIcon_Container_Favorites_Item"); + this.updateIcons(); + if (this.firstInstallUrl != '') + { + this.openTab(this.firstInstallUrl,true); + } } else if (this.newVersionUrl != '') { @@ -116,6 +122,29 @@ versionCheck: function(addon) this.prefs.setCharPref("thatoneguydotnet.QuickJava.curVersion", this.curVersion) } }, + +installButton: function(toolbarId, id, afterId) + { + if (!document.getElementById(id)) { + var toolbar = document.getElementById(toolbarId); + + // If no afterId is given, then append the item to the toolbar + var before = null; + if (afterId) { + let elem = document.getElementById(afterId); + if (elem && elem.parentNode == toolbar) + before = elem.nextElementSibling; + } + + toolbar.insertItem(id, before); + toolbar.setAttribute("currentset", toolbar.currentSet); + document.persist(toolbar.id, "currentset"); + + if (toolbarId == "addon-bar") + toolbar.collapsed = false; + } + }, + newTabOpened: function(e) { thatoneguydotnet.QuickJava.setStartupValues(2); @@ -304,7 +333,7 @@ reset_pref_click: function(event, whichReset) if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } return true; }, - + GetTypeFromId: function(id) { if (id == this.qj_Prefix_Sb_Container + this.qj_JS || id == this.qj_Prefix_Tb_Container + this.qj_JS) { return this.qj_JS; } @@ -317,7 +346,7 @@ GetTypeFromId: function(id) if (id == this.qj_Prefix_Sb_Container + this.qj_CS || id == this.qj_Prefix_Tb_Container + this.qj_CS) { return this.qj_CS; } if (id == this.qj_Prefix_Sb_Container + this.qj_P || id == this.qj_Prefix_Tb_Container + this.qj_P) { return this.qj_P; } }, - + updateIcons: function() { if(!this.massToggle) @@ -338,6 +367,11 @@ updateIcons: function() return true; }, +customizationChange: function() + { + thatoneguydotnet.QuickJava.updateIcons(); + }, + GetRegEx: function(whichIcon) { switch (whichIcon) @@ -690,7 +724,7 @@ updateCustomStyle: function() onLoadDetails: function(evt) { gBrowser.tabContainer.addEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false) - window.addEventListener("aftercustomization", thatoneguydotnet.QuickJava.updateIcons, false); + window.addEventListener("customizationchange", thatoneguydotnet.QuickJava.customizationChange, false); this.PluginObserver = { register: function() @@ -760,7 +794,7 @@ onUnload: function(evt) { this.PrefObserver.unregister(); this.PluginObserver.unregister(); - window.removeEventListener("aftercustomization", thatoneguydotnet.QuickJava.updateIcons, false); + window.removeEventListener("customizationchange", thatoneguydotnet.QuickJava.customizationChange, false); gBrowser.tabContainer.removeEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false) }, }; diff --git a/install.rdf b/install.rdf index 7c62c8c..cd9c94c 100644 --- a/install.rdf +++ b/install.rdf @@ -19,8 +19,6 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> 23.* - strel - \ No newline at end of file diff --git a/locale/en-US/quickjava.dtd b/locale/en-US/quickjava.dtd index b533100..56c38f1 100644 --- a/locale/en-US/quickjava.dtd +++ b/locale/en-US/quickjava.dtd @@ -28,7 +28,7 @@ - + From e33a4207fdcbab65a520fb51f434ee26cce87d33 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 25 Sep 2013 22:49:17 -0500 Subject: [PATCH 02/22] V2.0.1 Better custom CSS example --- ReadMe.txt | 2 +- content/options.xul | 2 +- content/skin/classic/quickjava/quickjava.css | 4 ++-- install.rdf | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 299c2a5..a61e0f8 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,7 +5,7 @@ //from the Add-on bar and/or Toolbar. // //Version History -//Version 2.0 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. +//Version 2.0.1 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. //Version 1.8.1.1 ClickToPlay as an option (hidden) for Enabled state //Version 1.8.1 Update to work with FF23 and above, fix button spacing and skinning (provided by anonymous user), Slight change to look of icons to modernize (provided by Dave). //Version 1.8.0 Back to Red buttons, a few minor bug fixes and added links on Options page. Thanks again to Dave for more help. diff --git a/content/options.xul b/content/options.xul index f671e85..ccd1a2c 100644 --- a/content/options.xul +++ b/content/options.xul @@ -274,7 +274,7 @@ diff --git a/content/skin/classic/quickjava/quickjava.css b/content/skin/classic/quickjava/quickjava.css index 5b795d1..6dc2360 100644 --- a/content/skin/classic/quickjava/quickjava.css +++ b/content/skin/classic/quickjava/quickjava.css @@ -7,7 +7,7 @@ text-align: center; text-shadow: none; color: #FFF; - background: -moz-linear-gradient( + background: linear-gradient( rgba(246,110,110,0.8), rgba(212, 76, 76,0.8), rgba(246,110,110,0.8)); @@ -19,7 +19,7 @@ } .quickjava-button[status="1"] { - background: -moz-linear-gradient( + background: linear-gradient( rgba(110,162,212,0.8), rgba( 76,128,178,0.8), rgba(110,162,212,0.8)); diff --git a/install.rdf b/install.rdf index cd9c94c..7189aeb 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {E6C1199F-E687-42da-8C24-E7770CC3AE66} QuickJava - 2.0 + 2.0.1 Enable/Disable Javascript, Java, Flash, Silverlight, Animated Images, Cookies, Images, CSS, and Proxy from Toolbar. Doug Greene http://quickjavaplugin.blogspot.com/ @@ -16,7 +16,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 4.0b1 - 23.* + 26.* strel From 634e560d4fc8159e613a4f4100439db14d4deef3 Mon Sep 17 00:00:00 2001 From: Doug Date: Thu, 26 Sep 2013 23:32:36 -0500 Subject: [PATCH 03/22] V2.0.2 Code cleanup Code cleanup and width added to example --- ReadMe.txt | 2 +- content/browserOverlay.js | 83 +++++++++++++++++---------------------- content/options.xul | 2 +- install.rdf | 2 +- 4 files changed, 40 insertions(+), 49 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index a61e0f8..49d423d 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,7 +5,7 @@ //from the Add-on bar and/or Toolbar. // //Version History -//Version 2.0.1 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. +//Version 2.0.2 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. //Version 1.8.1.1 ClickToPlay as an option (hidden) for Enabled state //Version 1.8.1 Update to work with FF23 and above, fix button spacing and skinning (provided by anonymous user), Slight change to look of icons to modernize (provided by Dave). //Version 1.8.0 Back to Red buttons, a few minor bug fixes and added links on Options page. Thanks again to Dave for more help. diff --git a/content/browserOverlay.js b/content/browserOverlay.js index a83e32f..931b7c4 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -9,8 +9,7 @@ thatoneguydotnet.QuickJava={ onLoad: function(evt) { - this.errMsg = ''; - this.debugMode = false; + if (typeof(Ci) == 'undefined') { return false; } //This is not a normal window (example: options dialog) this.alertPluginNames = false; this.alertPluginNamesOnMatch = false; this.firstInstallUrl = 'http://quickjavaplugin.blogspot.com/2012/07/quickjava-quick-help.html'; @@ -57,7 +56,6 @@ onLoad: function(evt) this.customStyleIndxDefault = -1; this.customStyleIndxEnabled = -1; - if (!Ci) { return false; } //This is not a normal window (example: options dialog) this.Plugin = Components.classes["@mozilla.org/observer-service;1"] .getService (Components.interfaces.nsIObserverService); this.prefs = Components.classes["@mozilla.org/preferences-service;1"]. @@ -84,16 +82,15 @@ onLoad: function(evt) //Update all icons this.updateIcons(); - } catch (e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, handleError: function(e) { - this.errMsg = "An exception occurred in the QuickJava script. Error name: " + e.name + this.consoleLog("An exception occurred in the QuickJava script. Error name: " + e.name + ".\n\n Error description: " + e.description + ".\n\n Error number: " + e.number - + ".\n\n Error message: " + e.message; + + ".\n\n Error message: " + e.message, true); }, firstStartup: function(e) { @@ -241,7 +238,6 @@ getCookieOnValue: function() onClick: function(event) { - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } try { // event.button == 2 // right @@ -261,14 +257,12 @@ onClick: function(event) if (event.button != 0 && event.button != 1) { this.updateIcons(); } - } catch(e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } return true; }, onCommand: function(event) { - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } try { // event.button == 2 // right, not supported onCommand @@ -279,15 +273,13 @@ onCommand: function(event) { this.updateIcons(); } - } catch(e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } return true; }, onCommandFavorites: function(event) { - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } try { // event.button == 2 // right, not supported onCommand @@ -314,14 +306,12 @@ onCommandFavorites: function(event) { BrowserReload(); } - } catch(e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } return true; }, reset_pref_click: function(event, whichReset) { - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } try { var optionField = document.getElementById(this.qj_Option_Pref_RegEx + whichReset); @@ -329,8 +319,7 @@ reset_pref_click: function(event, whichReset) { optionField.value = optionField.defaultValue; } - } catch(e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } return true; }, @@ -349,6 +338,7 @@ GetTypeFromId: function(id) updateIcons: function() { + //this.consoleLog('updateIcons'); if(!this.massToggle) { //Set the icons @@ -422,7 +412,7 @@ setFavIcon: function() if (differentIndicator) { differentIndicator.setAttribute("status", (anyEnabled && !allEnabled ? "1" : "0")); } }, - // + // GetPluginTags: function() { if (!("nsIPluginHost" in Components.interfaces)) return false; var phs = Components.classes["@mozilla.org/plugin/host;1"] @@ -455,7 +445,7 @@ toggleEnabledIfFavorite: function(whichIcon, turnOn) // Sets plugin enabled status of plugin(s), whose name matches on aRegEx, // to aValue. aName is used for the "not found" message and is optional toggleEnabled: function(whichIcon) { - if (!Ci) { return false; } //This is not a normal window (example: options dialog) + if (typeof(Ci) == 'undefined') { return false; } //This is not a normal window (example: options dialog) var setEnabled = !this.isEnabled(whichIcon); if (whichIcon == this.qj_JS) { @@ -486,7 +476,7 @@ toggleEnabled: function(whichIcon) { else { var aRegEx = this.GetRegEx(whichIcon); - if (!aRegEx) { if (this.debugMode) { alert('Invalid toggleEnabled: ' + whichIcon); } return; } + if (!aRegEx) { this.consoleLog('Invalid toggleEnabled: ' + whichIcon); return; } var plugins = this.GetPluginTags(); if (!plugins) return; var found = false; @@ -573,39 +563,31 @@ openTab: function(url, focusTab) { openHelp: function() { - try - { + try { this.openTab('http://quickjavaplugin.blogspot.com/2012/07/quickjava-quick-help.html',true); - } catch (e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, openHome: function() { - try - { + try { this.openTab('http://quickjavaplugin.blogspot.com/',true); - } catch (e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, -openDonate: function() -{ - try - { +openDonate: function() { + try { this.openTab('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9DSQG8KAB95C6',true); - } catch (e) { this.handleError(e); } - if (this.debugMode && this.errMsg != '') { alert(this.errMsg); this.errMsg = ''; } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, -showOptions: function() - { - window.openDialog("chrome://quickjava/content/options.xul", "", "chrome,toolbar"); - }, +showOptions: function() { + window.openDialog("chrome://quickjava/content/options.xul", "", "chrome,toolbar"); +}, // Returns plugin enabled status of plugin(s), whose name matches on aRegEx isEnabled: function(whichIcon) { - if (!Ci) { return false; } //This is not a normal window (example: options dialog) + if (typeof(Ci) == 'undefined') { return false; } //This is not a normal window (example: options dialog) if (whichIcon == this.qj_JS) { return this.prefs.getBoolPref("javascript.enabled"); } if (whichIcon == this.qj_AI) { return (this.prefs.getCharPref("image.animation_mode") == "normal"); } @@ -721,6 +703,11 @@ updateCustomStyle: function() } }, +consoleLog: function(msg, stackTrace) + { + if (window.console && window.console.log) { window.console.log('[QuickJava]: ' + msg); if (stackTrace && window.console.trace) { window.console.trace(); } } + }, + onLoadDetails: function(evt) { gBrowser.tabContainer.addEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false) @@ -792,11 +779,15 @@ onLoadDetails: function(evt) onUnload: function(evt) { - this.PrefObserver.unregister(); - this.PluginObserver.unregister(); - window.removeEventListener("customizationchange", thatoneguydotnet.QuickJava.customizationChange, false); - gBrowser.tabContainer.removeEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false) - }, + try + { + if (typeof(Ci) == 'undefined') { return false; } //This is not a normal window (example: options dialog) + if (thatoneguydotnet.QuickJava.PrefObserver && thatoneguydotnet.QuickJava.PrefObserver.unregister) { thatoneguydotnet.QuickJava.PrefObserver.unregister(); } + if (thatoneguydotnet.QuickJava.PluginObserver && thatoneguydotnet.QuickJava.PluginObserver.unregister) { thatoneguydotnet.QuickJava.PluginObserver.unregister(); } + window.removeEventListener("customizationchange", thatoneguydotnet.QuickJava.customizationChange, false); + if (gBrowser) { gBrowser.tabContainer.removeEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false); } + } catch (e) { try { this.handleError(e); } catch (e) {} } + } }; window.addEventListener('load', function(e) { thatoneguydotnet.QuickJava.onLoad(e); },false); diff --git a/content/options.xul b/content/options.xul index ccd1a2c..8bd188d 100644 --- a/content/options.xul +++ b/content/options.xul @@ -274,7 +274,7 @@ diff --git a/install.rdf b/install.rdf index 7189aeb..4ed9acf 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {E6C1199F-E687-42da-8C24-E7770CC3AE66} QuickJava - 2.0.1 + 2.0.2 Enable/Disable Javascript, Java, Flash, Silverlight, Animated Images, Cookies, Images, CSS, and Proxy from Toolbar. Doug Greene http://quickjavaplugin.blogspot.com/ From 240564924599cac28d7a067cf852b4db0979f05c Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 5 Nov 2013 15:51:26 -0600 Subject: [PATCH 04/22] Fix for Issue #13 Fix bug with stylesheets assumed to have href --- content/browserOverlay.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/browserOverlay.js b/content/browserOverlay.js index 931b7c4..4909867 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -650,7 +650,8 @@ updateCustomStyle: function() { for(var i = 0; i < document.styleSheets.length;i++) { - if(document.styleSheets[i].href.match(".*quickjava\.css$")) + if (document.styleSheets[i].href + && document.styleSheets[i].href.match(".*quickjava\.css$")) { this.myStyleSheet = document.styleSheets[i]; } From d2c8b486ad5ff550edf5275cfbed62396daeb430 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 5 Nov 2013 16:07:15 -0600 Subject: [PATCH 05/22] Fix spelling issue Submitted by Dave D --- locale/en-US/quickjava.dtd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en-US/quickjava.dtd b/locale/en-US/quickjava.dtd index 56c38f1..b4269d7 100644 --- a/locale/en-US/quickjava.dtd +++ b/locale/en-US/quickjava.dtd @@ -16,7 +16,7 @@ - + From 25ef54c29f6770fbc6246f4ea047920ea28eeea3 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 5 Nov 2013 21:18:21 -0600 Subject: [PATCH 06/22] V2.0.3 //Version 2.0.3 Fixed a bug causing issues with other addons and corrected a spelling mistake in english --- ReadMe.txt | 1 + content/browserOverlay.js | 2 +- install.rdf | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 49d423d..92fd466 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,6 +5,7 @@ //from the Add-on bar and/or Toolbar. // //Version History +//Version 2.0.3 Fixed a bug causing issues with other addons. //Version 2.0.2 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. //Version 1.8.1.1 ClickToPlay as an option (hidden) for Enabled state //Version 1.8.1 Update to work with FF23 and above, fix button spacing and skinning (provided by anonymous user), Slight change to look of icons to modernize (provided by Dave). diff --git a/content/browserOverlay.js b/content/browserOverlay.js index 4909867..ad83570 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -13,7 +13,7 @@ onLoad: function(evt) this.alertPluginNames = false; this.alertPluginNamesOnMatch = false; this.firstInstallUrl = 'http://quickjavaplugin.blogspot.com/2012/07/quickjava-quick-help.html'; - this.newVersionUrl = 'http://quickjavaplugin.blogspot.com/2013/09/quickjava-20.html'; + this.newVersionUrl = ''; this.curVersion = ''; //do not initialize, automatically loaded this.massToggle = false; //program use, do not initialize to true diff --git a/install.rdf b/install.rdf index 4ed9acf..d329b8b 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {E6C1199F-E687-42da-8C24-E7770CC3AE66} QuickJava - 2.0.2 + 2.0.3 Enable/Disable Javascript, Java, Flash, Silverlight, Animated Images, Cookies, Images, CSS, and Proxy from Toolbar. Doug Greene http://quickjavaplugin.blogspot.com/ @@ -16,7 +16,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 4.0b1 - 26.* + 27.* strel From 886af2d6d947b55d18d66d4a931868d0c55a0ea4 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 29 Jan 2014 21:52:29 -0600 Subject: [PATCH 07/22] Version 2.0.4 Fixed a bug when using the dropdown of the QJ Favorites to toggle settings https://github.com/ThatOneGuyDotNet/QuickJava/issues/15 --- ReadMe.txt | 1 + content/browserOverlay.js | 21 +++++++++++---------- content/browserOverlay.xul | 18 +++++++++--------- install.rdf | 6 +++--- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 92fd466..b08e794 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,6 +5,7 @@ //from the Add-on bar and/or Toolbar. // //Version History +//Version 2.0.4 Fixed a bug when using the dropdown of the QJ Favorites to toggle settings //Version 2.0.3 Fixed a bug causing issues with other addons. //Version 2.0.2 Major update! Favorite toolbar button added (auto-install for new users or 1.8.0 and below). Middle click only toggles visible status bar values. Customizable startup options. Update icons after customization. //Version 1.8.1.1 ClickToPlay as an option (hidden) for Enabled state diff --git a/content/browserOverlay.js b/content/browserOverlay.js index ad83570..238c317 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -39,6 +39,7 @@ onLoad: function(evt) this.qj_Prefix_Sb_Container = this.qj_Prefix_Sb + 'Container_'; this.qj_Prefix_Tb = this.qj_Prefix + 'ToolbarIcon_'; this.qj_Prefix_Tb_Container = this.qj_Prefix_Tb + 'Container_'; + this.qj_Prefix_Tb_FM_Container = this.qj_Prefix_Tb_Container + 'Favorites_Menu_'; this.qj_JS = 'JavaScript'; this.qj_J = 'Java'; @@ -191,7 +192,7 @@ getProxyOnValue: function() var onValue = this.prefs.getIntPref("thatoneguydotnet.QuickJava.priorvalue.Proxy"); var curValue = this.prefs.getIntPref("network.proxy.type"); var updateStoredValue = false; - + //If not off, set the new default on value to current value if (curValue != 0 && curValue != onValue) { @@ -325,15 +326,15 @@ reset_pref_click: function(event, whichReset) GetTypeFromId: function(id) { - if (id == this.qj_Prefix_Sb_Container + this.qj_JS || id == this.qj_Prefix_Tb_Container + this.qj_JS) { return this.qj_JS; } - if (id == this.qj_Prefix_Sb_Container + this.qj_J || id == this.qj_Prefix_Tb_Container + this.qj_J) { return this.qj_J; } - if (id == this.qj_Prefix_Sb_Container + this.qj_F || id == this.qj_Prefix_Tb_Container + this.qj_F) { return this.qj_F; } - if (id == this.qj_Prefix_Sb_Container + this.qj_SL || id == this.qj_Prefix_Tb_Container + this.qj_SL) { return this.qj_SL; } - if (id == this.qj_Prefix_Sb_Container + this.qj_AI || id == this.qj_Prefix_Tb_Container + this.qj_AI) { return this.qj_AI; } - if (id == this.qj_Prefix_Sb_Container + this.qj_C || id == this.qj_Prefix_Tb_Container + this.qj_C) { return this.qj_C; } - if (id == this.qj_Prefix_Sb_Container + this.qj_I || id == this.qj_Prefix_Tb_Container + this.qj_I) { return this.qj_I; } - if (id == this.qj_Prefix_Sb_Container + this.qj_CS || id == this.qj_Prefix_Tb_Container + this.qj_CS) { return this.qj_CS; } - if (id == this.qj_Prefix_Sb_Container + this.qj_P || id == this.qj_Prefix_Tb_Container + this.qj_P) { return this.qj_P; } + if (id == this.qj_Prefix_Sb_Container + this.qj_JS || id == this.qj_Prefix_Tb_Container + this.qj_JS || id == this.qj_Prefix_Tb_FM_Container + this.qj_JS) { return this.qj_JS; } + if (id == this.qj_Prefix_Sb_Container + this.qj_J || id == this.qj_Prefix_Tb_Container + this.qj_J || id == this.qj_Prefix_Tb_FM_Container + this.qj_J) { return this.qj_J; } + if (id == this.qj_Prefix_Sb_Container + this.qj_F || id == this.qj_Prefix_Tb_Container + this.qj_F || id == this.qj_Prefix_Tb_FM_Container + this.qj_F) { return this.qj_F; } + if (id == this.qj_Prefix_Sb_Container + this.qj_SL || id == this.qj_Prefix_Tb_Container + this.qj_SL || id == this.qj_Prefix_Tb_FM_Container + this.qj_SL) { return this.qj_SL; } + if (id == this.qj_Prefix_Sb_Container + this.qj_AI || id == this.qj_Prefix_Tb_Container + this.qj_AI || id == this.qj_Prefix_Tb_FM_Container + this.qj_AI) { return this.qj_AI; } + if (id == this.qj_Prefix_Sb_Container + this.qj_C || id == this.qj_Prefix_Tb_Container + this.qj_C || id == this.qj_Prefix_Tb_FM_Container + this.qj_C) { return this.qj_C; } + if (id == this.qj_Prefix_Sb_Container + this.qj_I || id == this.qj_Prefix_Tb_Container + this.qj_I || id == this.qj_Prefix_Tb_FM_Container + this.qj_I) { return this.qj_I; } + if (id == this.qj_Prefix_Sb_Container + this.qj_CS || id == this.qj_Prefix_Tb_Container + this.qj_CS || id == this.qj_Prefix_Tb_FM_Container + this.qj_CS) { return this.qj_CS; } + if (id == this.qj_Prefix_Sb_Container + this.qj_P || id == this.qj_Prefix_Tb_Container + this.qj_P || id == this.qj_Prefix_Tb_FM_Container + this.qj_P) { return this.qj_P; } }, updateIcons: function() diff --git a/content/browserOverlay.xul b/content/browserOverlay.xul index 1eb1853..52f4d29 100644 --- a/content/browserOverlay.xul +++ b/content/browserOverlay.xul @@ -162,15 +162,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/install.rdf b/install.rdf index d329b8b..3b06b17 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {E6C1199F-E687-42da-8C24-E7770CC3AE66} QuickJava - 2.0.3 + 2.0.4 Enable/Disable Javascript, Java, Flash, Silverlight, Animated Images, Cookies, Images, CSS, and Proxy from Toolbar. Doug Greene http://quickjavaplugin.blogspot.com/ @@ -15,8 +15,8 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - 4.0b1 - 27.* + 20.0 + 29.* strel From cc1de5767adcb2730d88c90279f29c1d38656c02 Mon Sep 17 00:00:00 2001 From: Doug Date: Sun, 2 Nov 2014 15:26:32 -0600 Subject: [PATCH 08/22] WIP - BROKEN!!! -Trying to get the Fav Icon to work in vertical toolbar The Fav Icon uses tricks because of limitations in the xul files (not drawing as specifications say they should). This checkin works in the vert toolbar, but only works in the regular toolbar after it has been removed and re-added. Maybe try again when Mozilla gets things fixed? Didn't want to lose my work. --- content/browserOverlay.js | 68 +++++++++++++++++++++++++++++---- content/browserOverlay.xul | 77 +++++++++++++++++++------------------- 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/content/browserOverlay.js b/content/browserOverlay.js index 238c317..b3b7a51 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -121,7 +121,7 @@ versionCheck: function(addon) } }, -installButton: function(toolbarId, id, afterId) +installButton: function(toolbarId, id, afterId) { if (!document.getElementById(id)) { var toolbar = document.getElementById(toolbarId); @@ -162,6 +162,7 @@ setStartupValues: function(startupType) this.setStartupValue(this.qj_C); this.setStartupValue(this.qj_CS); } + this.updateIcons(); }, setStartupValue: function(whichIcon) { @@ -259,6 +260,8 @@ onClick: function(event) this.updateIcons(); } } catch (e) { try { this.handleError(e); } catch (e) {} } + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; return true; }, @@ -275,6 +278,8 @@ onCommand: function(event) this.updateIcons(); } } catch (e) { try { this.handleError(e); } catch (e) {} } + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; return true; }, @@ -339,6 +344,7 @@ GetTypeFromId: function(id) updateIcons: function() { + this.addMenupopupToNavButtonIfNeeded(); //this.consoleLog('updateIcons'); if(!this.massToggle) { @@ -360,7 +366,10 @@ updateIcons: function() customizationChange: function() { - thatoneguydotnet.QuickJava.updateIcons(); + try + { + thatoneguydotnet.QuickJava.updateIcons(); + } catch (e) { try { this.handleError(e); } catch (e) {} } }, GetRegEx: function(whichIcon) @@ -489,7 +498,7 @@ toggleEnabled: function(whichIcon) { { plugins[i].enabledState = (setEnabled ? Ci.nsIPluginTag.STATE_ENABLED : Ci.nsIPluginTag.STATE_DISABLED); //Doesn't seem to be working, Flash still runs on the test page w/o asking after setting to CLICKTOPLAY - if (setEnabled && this.prefs.getBoolPref("thatoneguydotnet.QuickJava.enabledState.ClickToPlay")) { + if (setEnabled && this.prefs.getBoolPref("thatoneguydotnet.QuickJava.enabledState.ClickToPlay")) { plugins[i].enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; //alert(plugins[i].enabledState + ', ' + Ci.nsIPluginTag.STATE_CLICKTOPLAY); } @@ -562,27 +571,35 @@ openTab: function(url, focusTab) { } }, -openHelp: function() +openHelp: function(event) { try { + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; this.openTab('http://quickjavaplugin.blogspot.com/2012/07/quickjava-quick-help.html',true); } catch (e) { try { this.handleError(e); } catch (e) {} } }, - openHome: function() + openHome: function(event) { try { + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; this.openTab('http://quickjavaplugin.blogspot.com/',true); } catch (e) { try { this.handleError(e); } catch (e) {} } }, -openDonate: function() { +openDonate: function(event) { try { + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; this.openTab('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9DSQG8KAB95C6',true); } catch (e) { try { this.handleError(e); } catch (e) {} } }, -showOptions: function() { +showOptions: function(event) { + //If it's part of the favorites dropdown don't toggle the remaining items + event.cancelBubble = true; window.openDialog("chrome://quickjava/content/options.xul", "", "chrome,toolbar"); }, @@ -595,7 +612,7 @@ isEnabled: function(whichIcon) { if (whichIcon == this.qj_C) { return (this.prefs.getIntPref("network.cookie.cookieBehavior") != 2); } if (whichIcon == this.qj_I) { return (this.prefs.getIntPref("permissions.default.image") == 1); } - if (whichIcon == this.qj_CS) { return !(getMarkupDocumentViewer().authorStyleDisabled); } + if (whichIcon == this.qj_CS) { return !(getMarkupDocumentViewer && getMarkupDocumentViewer().authorStyleDisabled); } if (whichIcon == this.qj_P) { return (this.prefs.getIntPref("network.proxy.type") != 0); } var aRegEx = this.GetRegEx(whichIcon); @@ -645,6 +662,40 @@ isEnabledAnyFavorites: function() || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_CS) && this.isEnabled(this.qj_CS)); }, + addMenupopupToNavButtonIfNeeded: function() { + var navButton = document.getElementById('QuickJava_ToolbarIcon_Container_Favorites_Item2'); + + if (navButton) { + var toolbarButton = document.getAnonymousElementByAttribute(navButton, 'anonid', 'button'); +// var mainMenuBox = document.getElementById('QJ_fav_icon_hbox'); + if (toolbarButton /*&& mainMenuBox*/) + { + var menuBoxes = document.getElementById('QuickJava_ToolbarIcon_Favorites_Label'); + if (!menuBoxes) { + //