From 78d0426320dea3c8642f6db644fc79a580fc6c00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20Kr=E6mmer=20Nielsen?= Date: Thu, 20 Dec 2007 01:35:16 +0100 Subject: [PATCH] Added support for php4 sites short urls on 4-chars initials and on custom named test-webs Made php5 sites customizable in options dialog --- content/options.js | 86 +++++++++++++++++++++++++++- content/options.xul | 27 ++++++++- content/tv2developer-quickbox.js | 23 ++++++-- content/tv2developer-util.js | 34 +++++++++++ content/tv2developer.js | 15 +++-- defaults/preferences/tv2developer.js | 1 + locale/da-DK/tv2developer.dtd | 9 +++ locale/da-DK/tv2developer.properties | 14 ++--- locale/en-US/tv2developer.dtd | 9 +++ locale/en-US/tv2developer.properties | 14 ++--- version | 2 +- 11 files changed, 199 insertions(+), 35 deletions(-) diff --git a/content/options.js b/content/options.js index 1db758f..dc7e658 100755 --- a/content/options.js +++ b/content/options.js @@ -9,7 +9,7 @@ var TV2Options = { var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService); this._keyBranch = prefs.getBranch('ui.key.'); this._prefBranch = prefs.getBranch('browser.preferences.'); - // we show the options for hacing accesskeys if user has set a preference or accesskeys are disabled + // we show the options for hacking accesskeys if user has set a preference or accesskeys are disabled this._hackEnabled = this._keyBranch.prefHasUserValue('menuAccessKey') || (this._keyBranch.getIntPref('menuAccessKey') == 0); @@ -19,6 +19,74 @@ var TV2Options = { document.getElementById('mac-accesskeys').checked = (this._keyBranch.getIntPref('menuAccessKey') != 0); } + // fill in php5 sites + document.getElementById('php5auto').selectedIndex = + (TV2Util.hasPref('php5sites') ? 1 : 0); + this.php5sitesFillIn(TV2Util.getPref('php5sites', '')); + }, + + /* fill in list */ + php5sitesFillIn: function(php5set) { + var php5sites = php5set.split(',').sort(); + var php5list = document.getElementById('php5sites'); + var child = php5list.childNodes; + for (var i=child.length-1; i>=0; --i) { + if (child[i].tagName == 'listitem') { + php5list.removeChild(child[i]); + } + } + for (var i=0; i add) { + insertBefore = php5childs[i]; + break; + } + } + } + var newItem = document.createElement('listitem'); + newItem.setAttribute('label', add); + php5sites.insertBefore(newItem, insertBefore); + php5sites.selectedItem = newItem; + php5sites.focus(); + } + }, + + php5sitesRemove: function(obj) { + var php5sites = document.getElementById('php5sites'); + php5sites.removeChild(php5sites.selectedItem); + php5sites.focus(); + }, + + php5sitesAuto: function(obj) { + var php5sites = document.getElementById('php5sites'); + var useDefaults = (obj.selectedIndex == 0); + if (useDefaults && !php5sites.disabled) { + this.php5sitesFillIn(TV2Util.getDefaultPref('php5sites')); + } else { + php5sites.focus(); + } + php5sites.disabled = useDefaults; + document.getElementById('php5sites_add').disabled = useDefaults; }, save: function() { @@ -30,6 +98,22 @@ var TV2Options = { this._keyBranch.clearUserPref('menuAccessKey'); } } + // save php5 sites list + var php5auto = document.getElementById('php5auto'); + if (php5auto.selectedIndex == 1) { + var php5childs = document.getElementById('php5sites').childNodes; + var php5sites = []; + for (var i=0; i -