- Removed code that saved new preference - this is done automatically by firefox
- Changed behaviour to instantly change icon location by using a preference observer instead of requiring a browser restart
- Added default preference parameter in default preference file
- Added credit in about box
- Bombed to version 0.11.0
<text value="&createdBy;" style="font-weight: bold;"/>
<text value="Kristian Kræmmer Nielsen <jkkn@tv2.dk>" class="url"
onclick="window.close();openUILinkIn('http://jkkn.dk/tv2developer/', 'tab');"/>
+ <separator class="thin"/>
+ <text value="&patchesBy;" style="font-weight: bold;"/>
+ <text value="Adrian Bak <adba@tv2.dk>"/>
<separator class="thin"/>
<text value="&homePage;" style="font-weight: bold;"/>
<text value="http://jkkn.dk/tv2developer/"
oncommand="window.openDialog('chrome://tv2developer/content/about.xul','tv2about','modal,centerscreen,chrome,resizable=no')" />
</popup>
</popupset>
+
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="tv2-swap-button" type="menu-button"
context="tv2developer-contextmenu"
onclick="checkForMiddleClick(this, event);"
onmouseover="TV2Developer.handleStatusText(event);"
onmouseout="TV2Developer.setStatusText('');">
- <menupopup context=""
+ <menupopup context=""
id="tv2developer-popupmenu"
onpopupshowing="TV2Developer.fillMenu(event)"
oncommand="TV2Developer.handleMenu(event); event.stopPropagation();"
</toolbarpalette>
<statusbar id="status-bar">
- <statusbarpanel class="statusbarpanel-menu-iconic" id="tv2developer_statusbutton" src="chrome://tv2developer/skin/interaktiv.png"/>
+ <statusbarpanel id="tv2developer_statusbutton"
+ class="statusbarpanel-menu-iconic"
+ context="tv2developer-contextmenu"
+ src="chrome://tv2developer/skin/interaktiv.png"/>
</statusbar>
</overlay>
_hackEnabled: false,
init: function() {
- // the status bar thingy.
- document.getElementById('statusbarmode').checked = TV2Util.getPref('useStatusBarMode', false);
-
var hacks = document.getElementById('mac-hacks');
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
this._keyBranch = prefs.getBranch('ui.key.');
}
}
- // Save the statusbar thing
- var statusbar = document.getElementById('statusbarmode').checked;
- TV2Util.setPref('useStatusBarMode', statusbar);
-
},
update: function() {
- if(this._prefBranch != null) { // sometimes it's null on my mac (adba)
- var instantApply = this._prefBranch.getBoolPref("instantApply", false);
- }
+ var instantApply = this._prefBranch.getBoolPref("instantApply", false);
if (instantApply) this.save();
}
<prefpane id="pane1" label="&optionsDialog.options.label;">
<preferences>
<preference id="pref_developer-initials" name="tv2developer.developer-initials" type="string"/>
+ <preference id="pref_statusbarmode" name="tv2developer.useStatusBarMode" type="bool"/>
</preferences>
<groupbox>
oncommand="TV2Options.update()"
tooltiptext="&optionsDialog.mac.accesskeys.tooltiptext;"/>
</groupbox>
+
<groupbox id="misc">
<checkbox id="statusbarmode" label="&optionsDialog.misc.statusbarmode;"
- oncommand="TV2Options.update()"
- tooltiptext="&optionsDialog.misc.statusbarmode.tooltiptext;"/>
+ preference="pref_statusbarmode"
+ tooltiptext="&optionsDialog.misc.statusbarmode.tooltiptext;"/>
</groupbox>
</prefpane>
var TV2Developer = {
_lastAction: null,
- _statusBarIconEnabled: false,
+ _useStatusBarIconInstead: false,
/* toggle between statusbar/toolbar mode */
- enableStatusBarIcon: function( enabled ) {
- this._statusBarIconEnabled = enabled;
+ updateStatusBarMode: function() {
+ var enabled = this._useStatusBarIconInstead = TV2Util.getPref('useStatusBarMode');
+
var statusbutton = document.getElementById('tv2developer_statusbutton');
var swapbutton = document.getElementById('tv2-swap-button');
var popupmenu = document.getElementById('tv2developer-popupmenu');
statusbutton.hidden = !enabled;
swapbutton.hidden = enabled;
- statusbutton.setAttribute('context', 'tv2developer-contextmenu'); // Add the rightclick menu.
- if(enabled) {
+ if (enabled) {
statusbutton.appendChild(popupmenu);
} else {
swapbutton.appendChild(popupmenu);
/* method for initialize, reading properties, adding icon at firstrun, added keyshortcuts */
init: function() {
- // init
+ // init
this._lastAction = TV2Util.getPref('lastaction-linktype');
// add shortcuts depending on platform
var shortcuts = document.getElementById('mainKeyset');
catch(e) { }
}
- // initializes the statusbar icon.
- this.enableStatusBarIcon(TV2Util.getPref('useStatusBarMode', false));
+ // initializes the statusbar icon by observe optional preference changes
+ TV2Util.prefs.addObserver('useStatusBarMode', {
+ observe: function(subject, topic, data) {
+ if (topic == 'nsPref:changed') {
+ TV2Developer.updateStatusBarMode();
+ }
+ }}, false);
+ TV2Developer.updateStatusBarMode();
},
/* utility function to create shortcut object */
/* shortcut to open menu */
handleKeyShortcut: function(event) {
- var popupmenu = document.getElementById('tv2developer-popupmenu');
- popupmenu.showPopup();
+ if (!this._useStatusBarIconInstead) { // normal icon dropdown
+ document.getElementById('tv2-swap-button').open = true;
+ } else { // status bar icon
+ var popupmenu = document.getElementById('tv2developer-popupmenu');
+ popupmenu.showPopup();
+ }
},
/* utility function to go to a link */
/* preference functions */
_prefs: null,
get prefs() {
- if (!this._prefs)
+ if (!this._prefs) {
this._prefs =
Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch('tv2developer.');
+ this._prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ }
return this._prefs;
},
/* default preference functions */
_defPrefs: null,
get defPrefs() {
- if (!this._defPrefs)
+ if (!this._defPrefs) {
this._defPrefs =
Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getDefaultBranch('tv2developer.');
+ this._defPrefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ }
return this._defPrefs;
},
pref('tv2developer.developer-initials', 'CHANGE-THIS');
pref('tv2developer.lastaction-linktype', 'tango/entry');
pref('tv2developer.php4sites', '2000,ally,annonceinfo,arkivsalg,auth,betaling,betalingsputnik,bryllup,dagsdato,finans,formel1,harris,hovsa,inc,it,konsol,loginsputnik,louth,million,piszulu,playmoney,podcast-files,pokermoney,rss,sms,spil,spil-deal,spil-million,spil-solo,sputnikmobil,swim,titoonic,trafikken,tv2,tv2r,tvsputnik,wimbledon,wptmoney,zulu');
+pref('tv2developer.useStatusBarMode', false);
<!ENTITY aboutDialog.title "TV 2 Links - Om">
<!ENTITY aboutDialog.appname "TV 2 Links Plugin">
<!ENTITY createdBy "Udviklet af:">
+<!ENTITY patchesBy "Tilføjelser af:">
<!ENTITY homePage "Hjemmeside:">
<!ENTITY optionsDialog.title "TV 2 Links - Indstillinger">
<!ENTITY optionsDialog.mac.accesskeys "Slå genvejstaster til i Firefox på Mac">
<!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
-<!ENTITY optionsDialog.misc.statusbarmode "Slås statusbar til">
-<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
+<!ENTITY optionsDialog.misc.statusbarmode "Placér ikon i statusbar istedet">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Dette flytter ikonet ned i statusbaren istedet for i toolbaren">
<!ENTITY optionsDialog.php4sites.label "Gamle PHP 4 sites">
<!ENTITY version "version">
<!ENTITY aboutDialog.title "TV 2 Developer - about">
<!ENTITY aboutDialog.appname "TV 2 Developer Plugin">
-<!ENTITY createdBy "Created By:">
+<!ENTITY createdBy "Created by:">
+<!ENTITY patchesBy "Patches by:">
<!ENTITY homePage "Home Page:">
<!ENTITY optionsDialog.title "TV 2 Developer - Options">
<!ENTITY optionsDialog.mac.accesskeys "Enable accesskeys in Firefox on Mac">
<!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Changing this requires restart of Firefox">
-<!ENTITY optionsDialog.misc.statusbarmode "Enable statusbar mode">
-<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "Changing this requires restart of Firefox">
+<!ENTITY optionsDialog.misc.statusbarmode "Place icon in statusbar instead">
+<!ENTITY optionsDialog.misc.statusbarmode.tooltiptext "This moves the icon into the statusbar instead of as a toolbar icon">
<!ENTITY optionsDialog.php4sites.label "PHP 4 legacy sites">
<!ENTITY optionsDialog.php4sites.tooltiptext "Sites listed here will be seen as PHP 4 sites.">