Created
July 12, 2013 22:48
-
-
Save jasonfarrell/5988429 to your computer and use it in GitHub Desktop.
Firefox Tips — Code from 2009 article by Use All Five. This is most likely out of date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changePreference(prefencePage) { | |
document.getElementById("options-iframe").setAttribute("src", prefencePage.selectedItem.value); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkPrefs: function() | |
{ | |
//run the button check function | |
this.fixEnableButtons(); | |
//update the scope (since this is in a bigger object) | |
var that = this; | |
//start the timer, and run this function on time up | |
var prefTimer = setTimeout(function(){that.checkPrefs();},500); | |
}, | |
fixEnableButtons: function() | |
{ | |
//grab the icon xul dom elements | |
var enablePlugin = document.getElementById('sbEnable'); | |
var disablePlugin = document.getElementById('sbDisable'); | |
//check the preference and update accordingly | |
if(yourplugin.prefs.getBoolPref("isEnabled")) | |
{ | |
enablePlugin.style.display = "none"; | |
disablePlugin.style.display = "block"; | |
} | |
else | |
{ | |
enablePlugin.style.display = "block"; | |
disablePlugin.style.display = "none"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<listbox id="options-preference-list" onselect="changePreference(this)"> | |
<listitem class="listitem-iconic" selected="true" image="chrome://yourplugin/skin/options/your-icon.png" label="Account" value="chrome://yourplugin/content/options/account.xul" /> | |
<listitem class="listitem-iconic" selected="true" image="chrome://yourplugin/skin/options/your-icon.png" label="Application" value="chrome://yourplugin/content/options/application.xul" /> | |
<listitem class="listitem-iconic" selected="true" image="chrome://yourplugin/skin/options/your-icon.png" label="Settings" value="chrome://yourplugin/content/options/settings.xul" /> | |
</listbox> | |
<iframe flex="1" id="options-iframe" src="chrome://yourplugin/content/options/account.xul" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listitem[selected="true"][current="true"] { | |
background-color: #057ca0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gBrowser.tabContainer.addEventListener("TabSelect", function(e) { onTabChange();}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment