diff --git a/.gitignore b/.gitignore index 5ebd21a..02d3419 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,4 @@ pip-log.txt # Mac crap .DS_Store +{E6C1199F-E687-42da-8C24-E7770CC3AE66} diff --git a/ReadMe.txt b/ReadMe.txt index 8993dbb..effa0a2 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,10 +1,23 @@ +This plugin is Obsolete as of FF 57. + +For additional information please visit: +http://quickjavaplugin.blogspot.com/2017/10/quickjava-to-be-obsolete-with-firefox.html + + +Old Notes: + //QuickJava //By Doug G. // //Allows quick enable and disable of Java, Javascript, Cookies, Image Animations, Flash, Silverlight, Images, Stylesheets and Proxy //from the Add-on bar and/or Toolbar. // +//License: https://www.mozilla.org/en-US/MPL/1.1/ +// //Version History +//Version 2.1.0 Add WebGL (thanks ccrtnsp) and WebRTC support. Move preferences to extensions branch. Fix CSS toggle bugs. Fix Options 'Reset' buttons bug. Fix install/new version popup. Add jp locale (thanks to Hideki!) Also thanks to Gitoffthelawn, Compyooter, staudenmeir, and jimbo1qaz for bug reports and communication. +//Version 2.0.8 Add error handling due to CSS method sometimes throwing an exception, have not figured out what causes this yet +//Version 2.0.7 Changed how the stylesheets are being read due to change in FF44 //Version 2.0.6 Fixed a bug when customizing some toolbars, thanks to Quicksaver (the developer of the Puzzle Toolbar addon) for the code //Version 2.0.5 Fixed a bug when toggling CSS //Version 2.0.4 Fixed a bug when using the dropdown of the QJ Favorites to toggle settings diff --git a/chrome.manifest b/chrome.manifest index 49d211b..7a0f053 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -6,4 +6,5 @@ skin quickjava classic/1.0 chrome://quickjava/content/skin/classic/quickjava/ style chrome://browser/content/browser.xul chrome://quickjava/skin/quickjava.css style chrome://global/content/customizeToolbar.xul chrome://quickjava/skin/quickjava.css locale quickjava en-US locale/en-US/ -locale quickjava es locale/es/ \ No newline at end of file +locale quickjava es locale/es/ +locale quickjava jp locale/jp/ diff --git a/content/browserOverlay.js b/content/browserOverlay.js index 1f93040..91b5a26 100644 --- a/content/browserOverlay.js +++ b/content/browserOverlay.js @@ -7,20 +7,22 @@ if(!thatoneguydotnet.QuickJava) thatoneguydotnet.QuickJava={}; thatoneguydotnet.QuickJava={ -onLoad: function(evt) - { - 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'; - this.newVersionUrl = ''; - - this.curVersion = ''; //do not initialize, automatically loaded - this.massToggle = false; //program use, do not initialize to true - - try - { - this.qj_Prefix_Pref = 'thatoneguydotnet.QuickJava'; +qj_JS : 'JavaScript', +qj_J : 'Java', +qj_F : 'Flash', +qj_WebGL : 'WebGL', +qj_WebRTC : 'WebRTC', +qj_SL : 'Silverlight', +qj_AI : 'AnimatedImage', +qj_C : 'Cookies', +qj_I : 'Images', +qj_CS : 'CSS', +qj_P : 'Proxy', + +initQJ: function() + { + this.qj_Prefix_Pref = 'extensions.thatoneguydotnet.QuickJava'; + this.qj_Prefix_PrefOld = 'thatoneguydotnet.QuickJava'; this.Plugin_TopicStr = this.qj_Prefix_Pref + ".plugins.refreshIcons"; this.qj_Pref_CustomStyle = '.custombuttonstyle'; this.qj_Pref_Default = '.default'; @@ -41,19 +43,23 @@ onLoad: function(evt) 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'; - this.qj_F = 'Flash'; - this.qj_SL = 'Silverlight'; - this.qj_AI = 'AnimatedImage'; - this.qj_C = 'Cookies'; - this.qj_I = 'Images'; - this.qj_CS = 'CSS'; - this.qj_P = 'Proxy'; - this.qj_Fav = 'Favorites'; this.qj_Fav_Different = this.qj_Fav + '_Different'; + }, + +onLoad: function(evt) + { + 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/p/welcome.html'; + this.newVersionUrl = 'http://quickjavaplugin.blogspot.com/2016/08/new-version-210.html'; + + this.curVersion = ''; //do not initialize, automatically loaded + this.massToggle = false; //program use, do not initialize to true + try + { this.customStyleIndxDefault = -1; this.customStyleIndxEnabled = -1; @@ -64,6 +70,7 @@ onLoad: function(evt) //Initialize pref monitors this.onLoadDetails(); + this.movePreferences(); //First startup routine if (Components.classes["@mozilla.org/appshell/window-mediator;1"] @@ -71,11 +78,11 @@ onLoad: function(evt) .getEnumerator("").getNext() == window) { this.firstStartup(); - this.setStartupValues(0); + setTimeout('thatoneguydotnet.QuickJava.setStartupValues(0);',10); } else { - this.setStartupValues(1); + setTimeout('thatoneguydotnet.QuickJava.setStartupValues(1);',10); } //Update custom style @@ -89,38 +96,43 @@ onLoad: function(evt) handleError: function(e) { 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, true); + + ".\n Error description: " + e.description + + ".\n Error number: " + e.number + + ".\n Error message: " + e.message + + ".\n Stack: " + e.stack + , true); }, firstStartup: function(e) { - this.curVersion = this.prefs.getCharPref("thatoneguydotnet.QuickJava.curVersion"); + this.curVersion = this.prefs.getCharPref(this.qj_Prefix_Pref + ".curVersion"); Components.utils.import("resource://gre/modules/AddonManager.jsm"); AddonManager.getAddonByID("{E6C1199F-E687-42da-8C24-E7770CC3AE66}", function(addon) { thatoneguydotnet.QuickJava.versionCheck(addon);}); }, versionCheck: function(addon) { - if (this.curVersion != addon.version) + //strip out any non-numeric or decimal characters (such as "signed" text) + var curVersionClean = this.curVersion.replace(/[^\d.]/g, ''); + var addonVersionClean = addon.version.replace(/[^\d.]/g, ''); + if (curVersionClean != addonVersionClean) { - if (this.curVersion == '') + if (curVersionClean == '') { this.installButton("nav-bar", "QuickJava_ToolbarIcon_Container_Favorites_Item"); this.updateIcons(); if (this.firstInstallUrl != '') { - this.openTab(this.firstInstallUrl,true); + setTimeout('thatoneguydotnet.QuickJava.openTab(thatoneguydotnet.QuickJava.firstInstallUrl,true);', 1000); } } else if (this.newVersionUrl != '') { - this.openTab(this.newVersionUrl,true); + setTimeout('thatoneguydotnet.QuickJava.openTab(thatoneguydotnet.QuickJava.newVersionUrl,true);', 1000); } - this.curVersion = addon.version; - this.prefs.setCharPref("thatoneguydotnet.QuickJava.curVersion", this.curVersion) + curVersionClean = addonVersionClean; + this.prefs.setCharPref(this.qj_Prefix_Pref + ".curVersion", curVersionClean) } }, - + installButton: function(toolbarId, id, afterId) { if (!document.getElementById(id)) { @@ -147,16 +159,24 @@ newTabOpened: function(e) { thatoneguydotnet.QuickJava.setStartupValues(2); }, + +newTabSelected: function(e) +{ + thatoneguydotnet.QuickJava.updateIcons(); +}, + setStartupValues: function(startupType) { /* 0 = initial luanch, 1 = new window, 2 = new tab */ - var runAt = this.prefs.getIntPref('thatoneguydotnet.QuickJava.startupStatus.type'); + var runAt = this.prefs.getIntPref(this.qj_Prefix_Pref + '.startupStatus.type'); if (runAt >= startupType) { this.setStartupValue(this.qj_I); this.setStartupValue(this.qj_J); this.setStartupValue(this.qj_JS); this.setStartupValue(this.qj_F); + this.setStartupValue(this.qj_WebGL); + this.setStartupValue(this.qj_WebRTC); this.setStartupValue(this.qj_SL); this.setStartupValue(this.qj_AI); this.setStartupValue(this.qj_C); @@ -165,16 +185,19 @@ setStartupValues: function(startupType) }, setStartupValue: function(whichIcon) { - /* 0 = no change, 1 = enabled, 2 = disabled */ - var statusToSet = this.prefs.getIntPref('thatoneguydotnet.QuickJava.startupStatus.' + whichIcon); - if (statusToSet > 0) + try { - var turnOn = (statusToSet == 1 ? 1 : 0); - if (this.isEnabled(whichIcon) != turnOn) + /* 0 = no change, 1 = enabled, 2 = disabled */ + var statusToSet = this.prefs.getIntPref(this.qj_Prefix_Pref + '.startupStatus.' + whichIcon); + if (statusToSet > 0) { - this.toggleEnabled(whichIcon); + var turnOn = (statusToSet == 1 ? 1 : 0); + if (this.isEnabled(whichIcon) != turnOn) + { + this.toggleEnabled(whichIcon); + } } - } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, findElement: function(node, childId) { @@ -189,7 +212,7 @@ findElement: function(node, childId) }, getProxyOnValue: function() { - var onValue = this.prefs.getIntPref("thatoneguydotnet.QuickJava.priorvalue.Proxy"); + var onValue = this.prefs.getIntPref(this.qj_Prefix_Pref + ".priorvalue.Proxy"); var curValue = this.prefs.getIntPref("network.proxy.type"); var updateStoredValue = false; @@ -207,14 +230,14 @@ getProxyOnValue: function() } if(updateStoredValue) { - this.prefs.setIntPref("thatoneguydotnet.QuickJava.priorvalue.Proxy", onValue); + this.prefs.setIntPref(this.qj_Prefix_Pref + ".priorvalue.Proxy", onValue); } return onValue; }, getCookieOnValue: function() { - var onValue = this.prefs.getIntPref("thatoneguydotnet.QuickJava.priorvalue.Cookie"); + var onValue = this.prefs.getIntPref(this.qj_Prefix_Pref + ".priorvalue.Cookie"); var curValue = this.prefs.getIntPref("network.cookie.cookieBehavior"); var updateStoredValue = false; @@ -232,7 +255,7 @@ getCookieOnValue: function() } if (updateStoredValue) { - this.prefs.setIntPref("thatoneguydotnet.QuickJava.priorvalue.Cookie", onValue); + this.prefs.setIntPref(this.qj_Prefix_Pref + ".priorvalue.Cookie", onValue); } return onValue; }, @@ -250,6 +273,8 @@ onClick: function(event) this.toggleEnabledIfStatusbarVisible(this.qj_J); this.toggleEnabledIfStatusbarVisible(this.qj_JS); this.toggleEnabledIfStatusbarVisible(this.qj_F); + this.toggleEnabledIfStatusbarVisible(this.qj_WebGL); + this.toggleEnabledIfStatusbarVisible(this.qj_WebRTC); this.toggleEnabledIfStatusbarVisible(this.qj_SL); this.toggleEnabledIfStatusbarVisible(this.qj_AI); this.toggleEnabledIfStatusbarVisible(this.qj_C); @@ -295,6 +320,8 @@ onCommandFavorites: function(event) doReload = (this.toggleEnabledIfFavorite(this.qj_J, turnOn) && this.checkForReload(this.qj_J)) || doReload; doReload = (this.toggleEnabledIfFavorite(this.qj_JS, turnOn) && this.checkForReload(this.qj_JS)) || doReload; doReload = (this.toggleEnabledIfFavorite(this.qj_F, turnOn) && this.checkForReload(this.qj_F)) || doReload; + doReload = (this.toggleEnabledIfFavorite(this.qj_WebGL, turnOn) && this.checkForReload(this.qj_WebGL)) || doReload; + doReload = (this.toggleEnabledIfFavorite(this.qj_WebRTC, turnOn) && this.checkForReload(this.qj_WebRTC)) || doReload; doReload = (this.toggleEnabledIfFavorite(this.qj_SL, turnOn) && this.checkForReload(this.qj_SL)) || doReload; doReload = (this.toggleEnabledIfFavorite(this.qj_AI, turnOn) && this.checkForReload(this.qj_AI)) || doReload; doReload = (this.toggleEnabledIfFavorite(this.qj_C, turnOn) && this.checkForReload(this.qj_C)) || doReload; @@ -329,6 +356,8 @@ GetTypeFromId: function(id) 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_WebGL || id == this.qj_Prefix_Tb_Container + this.qj_WebGL || id == this.qj_Prefix_Tb_FM_Container + this.qj_WebGL) { return this.qj_WebGL; } + if (id == this.qj_Prefix_Sb_Container + this.qj_WebRTC || id == this.qj_Prefix_Tb_Container + this.qj_WebRTC || id == this.qj_Prefix_Tb_FM_Container + this.qj_WebRTC) { return this.qj_WebRTC; } 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; } @@ -341,7 +370,7 @@ updateIcons: function() { //this.consoleLog('updateIcons'); //do as setTimeout so any other processes can finish first - setTimeout('thatoneguydotnet.QuickJava.updateIconsNow();',10); + setTimeout('thatoneguydotnet.QuickJava.updateIconsNow();',100); this.updateIconsNow(); }, @@ -354,6 +383,8 @@ updateIconsNow: function() this.setIcon(this.qj_JS, this.isEnabled(this.qj_JS)); this.setIcon(this.qj_J, this.isEnabled(this.qj_J)); this.setIcon(this.qj_F, this.isEnabled(this.qj_F)); + this.setIcon(this.qj_WebGL, this.isEnabled(this.qj_WebGL)); + this.setIcon(this.qj_WebRTC, this.isEnabled(this.qj_WebRTC)); this.setIcon(this.qj_SL, this.isEnabled(this.qj_SL)); this.setIcon(this.qj_AI, this.isEnabled(this.qj_AI)); this.setIcon(this.qj_C, this.isEnabled(this.qj_C)); @@ -371,18 +402,20 @@ GetRegEx: function(whichIcon) switch (whichIcon) { case this.qj_J: - return new RegExp(this.prefs.getCharPref("thatoneguydotnet.QuickJava.regex.Java"), 'i'); + return new RegExp(this.prefs.getCharPref(this.qj_Prefix_Pref + ".regex.Java"), 'i'); break; case this.qj_F: - return new RegExp(this.prefs.getCharPref("thatoneguydotnet.QuickJava.regex.Flash"), 'i'); + return new RegExp(this.prefs.getCharPref(this.qj_Prefix_Pref + ".regex.Flash"), 'i'); break; case this.qj_SL: - return new RegExp(this.prefs.getCharPref("thatoneguydotnet.QuickJava.regex.Silverlight"), 'i'); + return new RegExp(this.prefs.getCharPref(this.qj_Prefix_Pref + ".regex.Silverlight"), 'i'); break; } }, setIcon: function(whichIcon, onOff) + { + try { var isHidden = this.prefs.getBoolPref(this.qj_Prefix_Pref_Hide + whichIcon); var statusNumber = (onOff == 1 ? "1" : (onOff == 0 ? "0" : "-2")); @@ -400,6 +433,7 @@ setIcon: function(whichIcon, onOff) favDropDown.setAttribute("checked", onOff == 1 ? true : false); favDropDown.setAttribute("style", this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + whichIcon) ? "" : "display: none;"); } + } catch (e) { try { this.handleError(e); } catch (e) {} } }, setFavIcon: function() @@ -450,6 +484,7 @@ toggleEnabledIfFavorite: function(whichIcon, turnOn) // to aValue. aName is used for the "not found" message and is optional toggleEnabled: function(whichIcon) { 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) { @@ -477,6 +512,14 @@ toggleEnabled: function(whichIcon) { var onValue = this.getProxyOnValue(); this.prefs.setIntPref("network.proxy.type", (setEnabled ? onValue : "0")); } + else if (whichIcon == this.qj_WebGL) + { + this.prefs.setBoolPref("webgl.disabled", !setEnabled); + } + else if (whichIcon == this.qj_WebRTC) + { + this.prefs.setBoolPref("media.peerconnection.enabled", setEnabled); + } else { var aRegEx = this.GetRegEx(whichIcon); @@ -492,7 +535,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(this.qj_Prefix_Pref + ".enabledState.ClickToPlay")) { plugins[i].enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY; //alert(plugins[i].enabledState + ', ' + Ci.nsIPluginTag.STATE_CLICKTOPLAY); } @@ -510,9 +553,10 @@ toggleEnabled: function(whichIcon) { var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow(null); - msgAlert(window, "No " + aName + " plugin found!"); + this.consoleLog(window, "No " + aName + " plugin found!"); } } + this.updateIcons(); if(!this.massToggle && this.checkForReload(whichIcon)) { @@ -544,7 +588,7 @@ setStyleDisabledExtended: function(turnOff) { var setSheet = ''; var firstSheet = ''; - var curSheetAry = gPageStyleMenu.getAllStyleSheets(); + var curSheetAry = gPageStyleMenu.getBrowserStyleSheets(); for (curSheetIdx in curSheetAry) { //this.consoleLog('gPageStyleMenu *' + curSheetAry[curSheetIdx].title + '*'); setSheet = curSheetAry[curSheetIdx].title; @@ -604,6 +648,8 @@ showOptions: function() { // Returns plugin enabled status of plugin(s), whose name matches on aRegEx isEnabled: function(whichIcon) { +try +{ 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"); } @@ -611,7 +657,15 @@ 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_WebGL) { return this.prefs.getBoolPref("webgl.disabled") == false; } + if (whichIcon == this.qj_WebRTC) { return this.prefs.getBoolPref("media.peerconnection.enabled"); } + + if (whichIcon == this.qj_CS) { + let styleSheetInfo = gPageStyleMenu._getStyleSheetInfo(gBrowser.selectedBrowser); + let styleSheets = styleSheetInfo.filteredStyleSheets; + return !(styleSheetInfo.authorStyleDisabled); + } + if (whichIcon == this.qj_P) { return (this.prefs.getIntPref("network.proxy.type") != 0); } var aRegEx = this.GetRegEx(whichIcon); @@ -632,6 +686,7 @@ isEnabled: function(whichIcon) { } } } +} catch (e) { try { this.handleError(e); } catch (e) {} } return 0; }, @@ -642,6 +697,8 @@ isEnabledAllFavorites: function() && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_J) || this.isEnabled(this.qj_J)) && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_JS) || this.isEnabled(this.qj_JS)) && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_F) || this.isEnabled(this.qj_F)) + && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_WebGL) || this.isEnabled(this.qj_WebGL)) + && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_WebRTC) || this.isEnabled(this.qj_WebRTC)) && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_SL) || this.isEnabled(this.qj_SL)) && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_AI) || this.isEnabled(this.qj_AI)) && (!this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_C) || this.isEnabled(this.qj_C)) @@ -655,6 +712,8 @@ isEnabledAnyFavorites: function() || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_J) && this.isEnabled(this.qj_J)) || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_JS) && this.isEnabled(this.qj_JS)) || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_F) && this.isEnabled(this.qj_F)) + || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_WebGL) && this.isEnabled(this.qj_WebGL)) + || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_WebRTC) && this.isEnabled(this.qj_WebRTC)) || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_SL) && this.isEnabled(this.qj_SL)) || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_AI) && this.isEnabled(this.qj_AI)) || (this.prefs.getBoolPref(this.qj_Prefix_Pref_Fav + this.qj_C) && this.isEnabled(this.qj_C)) @@ -728,9 +787,10 @@ consoleLog: function(msg, stackTrace) onLoadDetails: function(evt) { + gBrowser.tabContainer.addEventListener("TabSelect", thatoneguydotnet.QuickJava.newTabSelected, false) gBrowser.tabContainer.addEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false) this.CUIListener = { - handler: function(aWidgetId) { + handler: function(aWidgetId) { if (aWidgetId.indexOf('QuickJava') >= 0) { thatoneguydotnet.QuickJava.consoleLog(aWidgetId); /* Our toolbar icons may have been added or removed to/from a toolbar or panel */ @@ -798,6 +858,7 @@ onLoadDetails: function(evt) } else if (aData == "javascript.enabled" || aData == "permissions.default.image" || aData == "network.proxy.type" || aData == "network.cookie.cookieBehavior" || aData == "image.animation_mode" + || aData == "webgl.disabled" || aData == "media.peerconnection.enabled" || (aData.match("^"+this.QuickJavaObject.qj_Prefix_Pref)==this.QuickJavaObject.qj_Prefix_Pref)) { thatoneguydotnet.QuickJava.updateIcons(); @@ -818,10 +879,115 @@ onUnload: function(evt) if (thatoneguydotnet.QuickJava.PrefObserver && thatoneguydotnet.QuickJava.PrefObserver.unregister) { thatoneguydotnet.QuickJava.PrefObserver.unregister(); } if (thatoneguydotnet.QuickJava.PluginObserver && thatoneguydotnet.QuickJava.PluginObserver.unregister) { thatoneguydotnet.QuickJava.PluginObserver.unregister(); } if (gBrowser) { gBrowser.tabContainer.removeEventListener("TabOpen", thatoneguydotnet.QuickJava.newTabOpened, false); } + if (gBrowser) { gBrowser.tabContainer.removeEventListener("TabSelect", thatoneguydotnet.QuickJava.newTabSelected, false); } if (this.CUIListener) { CustomizableUI.removeListener(this.CUIListener); } } catch (e) { try { this.handleError(e); } catch (e) {} } + }, + +movePreferences: function() + { + if (this.prefs.getPrefType(this.qj_Prefix_PrefOld + '.curVersion')) + { + this.consoleLog('QuickJava moving preferences'); + + this.movePreference(this.qj_Prefix_PrefOld + '.curVersion', false, true, false); // Bool,Char,Int + + /* which icons are hidden in status/addon bar */ + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.JavaScript', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Java', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Flash', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.WebGL', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.WebRTC', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Silverlight', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.AnimatedImage', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Cookies', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Images', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.CSS', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.hidestatus.Proxy', true, false, false); // Bool,Char,Int + + /* 0 = initial luanch, 1 = new window, 2 = new tab */ + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.type', false, false, true); // Bool,Char,Int + + /* 0 = no change, 1 = enabled, 2 = disabled */ + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.JavaScript', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Java', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Flash', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.WebGL', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.WebRTC', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Silverlight', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.AnimatedImage', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Cookies', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Images', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.CSS', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.startupStatus.Proxy', false, false, true); // Bool,Char,Int + + /* which icons are visible in the favorites menu button */ + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.JavaScript', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Java', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Flash', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.WebGL', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.WebRTC', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Silverlight', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.AnimatedImage', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Cookies', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Images', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.CSS', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.Proxy', true, false, false); // Bool,Char,Int + + /* What to display/do when some favories are enabled and some are different. 1 = Enabled, 0 = Disabled */ + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.differentDisplay', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.favorites.differentToggle', false, false, true); // Bool,Char,Int + + /* which icons cause a reload of the page when they are changed */ + this.movePreference(this.qj_Prefix_PrefOld + '.reload.JavaScript', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Java', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Flash', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.WebGL', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.WebRTC', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Silverlight', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.AnimatedImage', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Cookies', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Images', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.CSS', true, false, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.reload.Proxy', true, false, false); // Bool,Char,Int + + this.movePreference(this.qj_Prefix_PrefOld + '.priorvalue.Proxy', false, false, true); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.priorvalue.Cookie', false, false, true); // Bool,Char,Int + + this.movePreference(this.qj_Prefix_PrefOld + '.enabledState.ClickToPlay', true, false, false); // Bool,Char,Int + + this.movePreference(this.qj_Prefix_PrefOld + '.regex.Java', false, true, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.regex.Flash', false, true, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.regex.Silverlight', false, true, false); // Bool,Char,Int + + this.movePreference(this.qj_Prefix_PrefOld + '.custombuttonstyle.default', false, true, false); // Bool,Char,Int + this.movePreference(this.qj_Prefix_PrefOld + '.custombuttonstyle.enabled', false, true, false); // Bool,Char,Int + } + }, + +movePreference : function(oldPrefName, isBool, isChar, isInt) + { + if (this.prefs.getPrefType(oldPrefName))//this.qj_Prefix_PrefOld + '.curVersion')) + { + var newPrefName = oldPrefName.replace(this.qj_Prefix_PrefOld,this.qj_Prefix_Pref); + this.consoleLog('Move ' + oldPrefName + ' to ' + newPrefName); + if (isBool) + { + this.prefs.setBoolPref(newPrefName, this.prefs.getBoolPref(oldPrefName)); + } + else if (isChar) + { + this.prefs.setCharPref(newPrefName, this.prefs.getCharPref(oldPrefName)); + } + else if (isInt) + { + this.prefs.setIntPref(newPrefName, this.prefs.getIntPref(oldPrefName)); + } + this.prefs.clearUserPref(oldPrefName); + } } }; +thatoneguydotnet.QuickJava.initQJ(); window.addEventListener('load', function(e) { thatoneguydotnet.QuickJava.onLoad(e); },false); -window.addEventListener('unload',function(e) { thatoneguydotnet.QuickJava.onUnload(e); },false); +window.addEventListener('unload',function(e) { thatoneguydotnet.QuickJava.onUnload(e); },false); \ No newline at end of file diff --git a/content/browserOverlay.xul b/content/browserOverlay.xul index 52f4d29..54c6cf3 100644 --- a/content/browserOverlay.xul +++ b/content/browserOverlay.xul @@ -6,7 +6,7 @@