From e3b36411d27c6fa6575b386738f9bfd3d582c50a Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Fri, 26 Aug 2011 15:11:28 +0200 Subject: Deleted old files --- chrome/code/redirector.js | 2 +- chrome/content/code/browserOverlay.xul.js | 105 ----------- chrome/content/code/editRedirect.xul.js | 103 ----------- chrome/content/code/redirect.js | 227 ----------------------- chrome/content/code/redirectorprefs.js | 93 ---------- chrome/content/code/settings.xul.js | 278 ----------------------------- chrome/content/log.html | 35 ---- chrome/content/ui/browserOverlay.xul | 34 ---- chrome/content/ui/editRedirect.xul | 58 ------ chrome/content/ui/help.html | 182 ------------------- chrome/content/ui/settings.xul | 118 ------------ chrome/content/unittest/run.html | 99 ---------- chrome/content/unittest/testcases.js | 129 ------------- chrome/locale/en-US/browserOverlay.xul.dtd | 9 - chrome/locale/en-US/editRedirect.xul.dtd | 14 -- chrome/locale/en-US/redirector.properties | 33 ---- chrome/locale/en-US/settings.xul.dtd | 65 ------- chrome/locale/zh-CN/browserOverlay.xul.dtd | 9 - chrome/locale/zh-CN/editRedirect.xul.dtd | 14 -- chrome/locale/zh-CN/redirector.properties | 33 ---- chrome/locale/zh-CN/settings.xul.dtd | 65 ------- chrome/skin/movedown.png | Bin 294 -> 0 bytes chrome/skin/movedowndisabled.png | Bin 361 -> 0 bytes chrome/skin/moveup.png | Bin 360 -> 0 bytes chrome/skin/moveupdisabled.png | Bin 282 -> 0 bytes chrome/skin/redirector.css | 15 -- chrome/skin/redirector.png | Bin 1462 -> 0 bytes chrome/skin/statusactive.png | Bin 360 -> 0 bytes chrome/skin/statusinactive.png | Bin 396 -> 0 bytes components/redirector.component.js | 51 ------ 30 files changed, 1 insertion(+), 1770 deletions(-) delete mode 100644 chrome/content/code/browserOverlay.xul.js delete mode 100644 chrome/content/code/editRedirect.xul.js delete mode 100644 chrome/content/code/redirect.js delete mode 100644 chrome/content/code/redirectorprefs.js delete mode 100644 chrome/content/code/settings.xul.js delete mode 100644 chrome/content/log.html delete mode 100644 chrome/content/ui/browserOverlay.xul delete mode 100644 chrome/content/ui/editRedirect.xul delete mode 100644 chrome/content/ui/help.html delete mode 100644 chrome/content/ui/settings.xul delete mode 100644 chrome/content/unittest/run.html delete mode 100644 chrome/content/unittest/testcases.js delete mode 100644 chrome/locale/en-US/browserOverlay.xul.dtd delete mode 100644 chrome/locale/en-US/editRedirect.xul.dtd delete mode 100644 chrome/locale/en-US/redirector.properties delete mode 100644 chrome/locale/en-US/settings.xul.dtd delete mode 100644 chrome/locale/zh-CN/browserOverlay.xul.dtd delete mode 100644 chrome/locale/zh-CN/editRedirect.xul.dtd delete mode 100644 chrome/locale/zh-CN/redirector.properties delete mode 100644 chrome/locale/zh-CN/settings.xul.dtd delete mode 100644 chrome/skin/movedown.png delete mode 100644 chrome/skin/movedowndisabled.png delete mode 100644 chrome/skin/moveup.png delete mode 100644 chrome/skin/moveupdisabled.png delete mode 100644 chrome/skin/redirector.css delete mode 100644 chrome/skin/redirector.png delete mode 100644 chrome/skin/statusactive.png delete mode 100644 chrome/skin/statusinactive.png delete mode 100644 components/redirector.component.js diff --git a/chrome/code/redirector.js b/chrome/code/redirector.js index f4b2093..df2a25b 100644 --- a/chrome/code/redirector.js +++ b/chrome/code/redirector.js @@ -65,7 +65,7 @@ Redirector = { fileStream.init(file, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0644, 0); var stream = Cc["@mozilla.org/intl/converter-output-stream;1"].createInstance(Ci.nsIConverterOutputStream); stream.init(fileStream, "UTF-8", 16384, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); - var rjson = { globalExcludePattern : '', createdBy : 'Redirector v' + RedirectorPrefs.version, redirects :[]}; + var rjson = { globalExcludePattern : '', createdBy : 'Redirector v' + this._prefs.version, redirects :[]}; for each (var re in this._list) { rjson.redirects.push(re.toObject()); } diff --git a/chrome/content/code/browserOverlay.xul.js b/chrome/content/code/browserOverlay.xul.js deleted file mode 100644 index 19a37df..0000000 --- a/chrome/content/code/browserOverlay.xul.js +++ /dev/null @@ -1,105 +0,0 @@ -//// $Id$ - -var Redirector = Components.classes["@einaregilsson.com/redirector;1"].getService(Components.interfaces.rdIRedirector); - -var RedirectorOverlay = { - - strings : null, - prefs : null, - - onLoad : function(event) { - try { - - // initialization code - document.getElementById('contentAreaContextMenu') - .addEventListener("popupshowing", function(e) { RedirectorOverlay.showContextMenu(e); }, false); - - this.strings = document.getElementById("redirector-strings"); - this.prefs = new RedirectorPrefs(); - this.changedPrefs(this.prefs); - this.prefs.addListener(this); - } catch(e) { - if (this.strings) { - alert(this.strings.getString("initError") + "\n\n" + e); - } else { - alert(e); - } - } - }, - - onUnload : function(event) { - this.prefs.dispose(); - Redirector.debug("Finished cleanup"); - }, - - changedPrefs : function(prefs) { - var statusImg = document.getElementById('redirector-statusbar-img'); - - if (prefs.enabled) { - statusImg.src = 'chrome://redirector/skin/statusactive.png' - statusImg.setAttribute('tooltiptext', this.strings.getString('enabledTooltip')); - } else { - statusImg.src = 'chrome://redirector/skin/statusinactive.png' - statusImg.setAttribute('tooltiptext', this.strings.getString('disabledTooltip')); - } - - document.getElementById('redirector-status').hidden = !prefs.showStatusBarIcon; - document.getElementById('redirector-context').hidden = !prefs.showContextMenu; - }, - - showContextMenu : function(event) { - if (gContextMenu.onLink) { - document.getElementById("redirector-context").label = this.strings.getString('addLinkUrl'); - } else { - document.getElementById("redirector-context").label = this.strings.getString('addCurrentUrl'); - } - }, - - onContextMenuCommand: function(event) { - var redirect = new Redirect(window.content.location.href, window.content.location.href); - if (gContextMenu.onLink) { - redirect.redirectUrl = gContextMenu.link.toString(); - } - - var args = { saved : false, 'redirect' : redirect }; - window.openDialog("chrome://redirector/content/ui/editRedirect.xul", "redirect", "chrome,dialog,modal,centerscreen", args); - if (args.saved) { - Redirector.addRedirect(args.redirect); - } - }, - - onMenuItemCommand: function(event) { - this.openSettings(); - }, - - toggleEnabled : function(event) { - this.prefs.enabled = !this.prefs.enabled; - }, - - openSettings : function() { - var windowName = "redirectorSettings"; - var windowsMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); - var win = windowsMediator.getMostRecentWindow(windowName); - if (win) { - win.focus(); - } else { - window.openDialog("chrome://redirector/content/ui/settings.xul", - windowName, - "chrome,dialog,resizable=yes,centerscreen", this); - } - - }, - - statusBarClick : function(event) { - var LEFT = 0, RIGHT = 2; - - if (event.button == LEFT) { - RedirectorOverlay.toggleEnabled(); - } else if (event.button == RIGHT) { - this.openSettings(); - } - } - -}; -window.addEventListener("load", function(event) { RedirectorOverlay.onLoad(event); }, false); -window.addEventListener("unload", function(event) { RedirectorOverlay.onUnload(event); }, false); diff --git a/chrome/content/code/editRedirect.xul.js b/chrome/content/code/editRedirect.xul.js deleted file mode 100644 index 650a8bf..0000000 --- a/chrome/content/code/editRedirect.xul.js +++ /dev/null @@ -1,103 +0,0 @@ -//// $Id$ - -var EditRedirect = { - txtExampleUrl : null, - txtIncludePattern : null, - txtRedirectUrl : null, - txtExcludePattern : null, - chkUnescapeMatches : null, - rdoRegex : null, - rdoWildcard : null, - - onLoad : function() { - var args = window.arguments[0]; - var redirect = args.redirect; - this.txtExampleUrl = document.getElementById('txtExampleUrl'); - this.txtIncludePattern = document.getElementById('txtIncludePattern'); - this.txtRedirectUrl= document.getElementById('txtRedirectUrl'); - this.txtExcludePattern= document.getElementById('txtExcludePattern'); - this.chkUnescapeMatches= document.getElementById('chkUnescapeMatches'); - this.rdoWildcard= document.getElementById('rdoWildcard'); - this.rdoRegex = document.getElementById('rdoRegex'); - - this.txtExampleUrl.value = redirect.exampleUrl; - this.txtIncludePattern.value = redirect.includePattern; - this.txtExcludePattern.value = redirect.excludePattern; - this.txtRedirectUrl.value = redirect.redirectUrl; - this.chkUnescapeMatches.setAttribute('checked', redirect.unescapeMatches); - this.rdoRegex.setAttribute('selected', redirect.isRegex()); - this.rdoWildcard.setAttribute('selected', redirect.isWildcard()); - - this.txtIncludePattern.focus(); - this.strings = document.getElementById("redirector-strings"); - }, - - onAccept : function() { - var args = window.arguments[0]; - var msg, title; - args.saved = true; - this.saveValues(args.redirect); - - var oldDisabled = args.redirect.disabled; - args.redirect.disabled = false; - if (!/^\s*$/.test(args.redirect.exampleUrl)) { - var result = args.redirect.getMatch(args.redirect.exampleUrl); - if (!result.isMatch) { - title = this.strings.getString('warningExampleUrlDoesntMatchPatternTitle'); - msg = this.strings.getString('warningExampleUrlDoesntMatchPattern'); - var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); - var rv = ps.confirmEx(window, title, msg, ps.STD_YES_NO_BUTTONS, ps.BUTTON_TITLE_YES, ps.BUTTON_TITLE_NO, null, null, {}); - return rv == 0; - } else { - var resultUrl = result.redirectTo; - if (!resultUrl.match(/https?:/)) { - var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); - var uri = ioService.newURI(args.redirect.exampleUrl, null, null); - resultUrl = uri.resolve(resultUrl); - } - - var secondResult = args.redirect.getMatch(resultUrl); - if (secondResult.isMatch) { - title = this.strings.getString('errorExampleUrlMatchesRecursiveTitle'); - msg = this.strings.getFormattedString('errorExampleUrlMatchesRecursive', [args.redirect.exampleUrl, resultUrl]); - this.msgBox(title, msg); - return false; - } - } - } - return true; - }, - - msgBox : function(title, text) { - Components.classes["@mozilla.org/embedcomp/prompt-service;1"] - .getService(Components.interfaces.nsIPromptService) - .alert(window, title, text); - }, - - saveValues : function(redirect) { - redirect.exampleUrl = this.txtExampleUrl.value; - redirect.includePattern = this.txtIncludePattern.value; - redirect.excludePattern = this.txtExcludePattern.value; - redirect.redirectUrl = this.txtRedirectUrl.value; - redirect.patternType = this.rdoRegex.getAttribute('selected') == 'true' ? Redirect.REGEX : Redirect.WILDCARD; - var val = this.chkUnescapeMatches.getAttribute('checked'); - redirect.unescapeMatches = val === 'true' || val === true; - //Disabled cannot be set here - }, - - testPattern : function() { - try { - var redirect = new Redirect(); - this.saveValues(redirect); - var extName = this.strings.getString('extensionName'); - var result = redirect.test(); - if (result.isMatch) { - this.msgBox(extName, this.strings.getFormattedString('testPatternSuccess', [redirect.includePattern, redirect.exampleUrl, result.redirectTo])); - } else if (result.isExcludeMatch) { - this.msgBox(extName, this.strings.getFormattedString('testPatternExclude', [redirect.exampleUrl, redirect.excludePattern])); - } else { - this.msgBox(extName, this.strings.getFormattedString('testPatternFailure', [redirect.includePattern, redirect.exampleUrl])); - } - } catch(e) {alert(e);} - } -}; \ No newline at end of file diff --git a/chrome/content/code/redirect.js b/chrome/content/code/redirect.js deleted file mode 100644 index b8ca7c8..0000000 --- a/chrome/content/code/redirect.js +++ /dev/null @@ -1,227 +0,0 @@ -//// $Id$ - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - - -function Redirect(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled) { - this._init(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled); -} - -//Static -Redirect.WILDCARD = 'W'; -Redirect.REGEX = 'R'; - -Redirect.prototype = { - - // rdIRedirect implementation - - //attributes - exampleUrl : null, - - get includePattern() { return this._includePattern; }, - set includePattern(value) { - this._includePattern = value; - this._rxInclude = this._compile(value); - }, - - get excludePattern() { return this._excludePattern; }, - set excludePattern(value) { - this._excludePattern = value; - this._rxExclude = this._compile(value); - }, - - redirectUrl : null, - - get patternType() { return this._patternType; }, - set patternType(value) { - this._patternType = value; - this.compile(); - }, - - unescapeMatches : false, - - disabled : false, - - //Functions - clone : function() { - return new Redirect(this.exampleUrl, this.includePattern, - this.redirectUrl, this.patternType, - this.excludePattern, this.unescapeMatches, - this.disabled); - }, - - compile : function() { - this._rxInclude = this._compile(this._includePattern); - this._rxExclude = this._compile(this._excludePattern); - }, - - copyValues : function(other) { - this.exampleUrl = other.exampleUrl; - this.includePattern = other.includePattern; - this.excludePattern = other.excludePattern; - this.redirectUrl = other.redirectUrl; - this.patternType = other.patternType; - this.unescapeMatches = other.unescapeMatches; - this.disabled = other.disabled; - }, - - deserialize : function(str) { - if (!str || !str.split) { - throw Error("Invalid serialized redirect: " + str); - } - var parts = str.split(',,,'); - if (parts.length < 5) { - throw Error("Invalid serialized redirect, too few fields: " + str); - } - this._init.apply(this, parts); - }, - - equals : function(redirect) { - return this.exampleUrl == redirect.exampleUrl - && this.includePattern == redirect.includePattern - && this.excludePattern == redirect.excludePattern - && this.redirectUrl == redirect.redirectUrl - && this.patternType == redirect.patternType - && this.unescapeMatches == redirect.unescapeMatches - ; - }, - - getMatch: function(url) { - var result = { - isMatch : false, - isExcludeMatch : false, - isDisabledMatch : false, - redirectTo : '', - toString : function() { return "{ isMatch : " + this.isMatch + - ", isExcludeMatch : " + this.isExcludeMatch + - ", isDisabledMatch : " + this.isDisabledMatch + - ", redirectTo : \"" + this.redirectTo + "\"" + - "}"; } - }; - var redirectTo = null; - - redirectTo = this._includeMatch(url); - if (redirectTo !== null) { - if (this.disabled) { - result.isDisabledMatch = true; - } else if (this._excludeMatch(url)) { - result.isExcludeMatch = true; - } else { - result.isMatch = true; - result.redirectTo = redirectTo; - } - } - return result; - }, - - isRegex: function() { - return this.patternType == Redirect.REGEX; - }, - - isWildcard : function() { - return this.patternType == Redirect.WILDCARD; - }, - - serialize : function() { - return [ this.exampleUrl - , this.includePattern - , this.redirectUrl - , this.patternType - , this.excludePattern - , this.unescapeMatches - , this.disabled ].join(',,,'); - }, - - test : function() { - return this.getMatch(this.exampleUrl); - }, - - //end rdIRedirect - - //nsISupports - QueryInterface : XPCOMUtils.generateQI([Components.interfaces.rdIRedirect]), - - //end nsISupports - - //Private functions below - - _includePattern : null, - _excludePattern : null, - _patternType : null, - _rxInclude : null, - _rxExclude : null, - - _preparePattern : function(pattern) { - if (this.patternType == Redirect.REGEX) { - return pattern; - } else { //Convert wildcard to regex pattern - var converted = '^'; - for (var i = 0; i < pattern.length; i++) { - var ch = pattern.charAt(i); - if ('()[]{}?.^$\\+'.indexOf(ch) != -1) { - converted += '\\' + ch; - } else if (ch == '*') { - converted += '(.*?)'; - } else { - converted += ch; - } - } - converted += '$'; - return converted; - } - }, - - _compile : function(pattern) { - if (!pattern) { - return null; - } - return new RegExp(this._preparePattern(pattern),"gi"); - }, - - _init : function(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled) { - this.exampleUrl = exampleUrl || ''; - this.includePattern = includePattern || ''; - this.excludePattern = excludePattern || ''; - this.redirectUrl = redirectUrl || ''; - this.patternType = patternType || Redirect.WILDCARD; - this.unescapeMatches = (unescapeMatches === 'true' || unescapeMatches === true); - this.disabled = (disabled === 'true' || disabled === true); - }, - - toString : function() { - return 'REDIRECT: {' - + '\n\tExample url : ' + this.exampleUrl - + '\n\tInclude pattern : ' + this.includePattern - + '\n\tExclude pattern : ' + this.excludePattern - + '\n\tRedirect url : ' + this.redirectUrl - + '\n\tPattern type : ' + this.patternType - + '\n\tUnescape matches : ' + this.unescapeMatches - + '\n\tDisabled : ' + this.disabled - + '\n}\n'; - }, - - _includeMatch : function(url) { - if (!this._rxInclude) { - return null; - } - var matches = this._rxInclude.exec(url); - if (!matches) { - return null; - } - var resultUrl = this.redirectUrl; - for (var i = 1; i < matches.length; i++) { - resultUrl = resultUrl.replace(new RegExp('\\$' + i, 'gi'), this.unescapeMatches ? unescape(matches[i]) : matches[i]); - } - this._rxInclude.lastIndex = 0; - return resultUrl; - }, - - _excludeMatch : function(url) { - if (!this._rxExclude) { - return false; - } - var shouldExclude = !!this._rxExclude.exec(url); - this._rxExclude.lastIndex = 0; - return shouldExclude; - } -}; \ No newline at end of file diff --git a/chrome/content/code/redirectorprefs.js b/chrome/content/code/redirectorprefs.js deleted file mode 100644 index 52c3056..0000000 --- a/chrome/content/code/redirectorprefs.js +++ /dev/null @@ -1,93 +0,0 @@ -// $Id$ - -function RedirectorPrefs() { - this.init(); -} - -RedirectorPrefs.prototype = { - - //Preferences: - _version : null, - _enabled : null, - _showStatusBarIcon : null, - _showContextMenu : null, - _debugEnabled : null, - _defaultDir : null, - _redirects : null, - - _prefBranch : null, - - _listeners : null, - - //Preferences props - - get version() { return this._version; }, - set version(value) { this._prefBranch.setCharPref('version', value); }, - - get enabled() { return this._enabled; }, - set enabled(value) { this._prefBranch.setBoolPref('enabled', value); }, - - get showStatusBarIcon() { return this._showStatusBarIcon; }, - set showStatusBarIcon(value) { this._prefBranch.setBoolPref('showStatusBarIcon', value); }, - - get showContextMenu() { return this._showContextMenu; }, - set showContextMenu(value) { this._prefBranch.setBoolPref('showContextMenu', value); }, - - get debugEnabled() { return this._debugEnabled; }, - set debugEnabled(value) { this._prefBranch.setBoolPref('debugEnabled', value); }, - - get defaultDir() { return this._defaultDir; }, - set defaultDir(value) { this._prefBranch.setCharPref('defaultDir', value); }, - - get redirects() { return this._redirects; }, - set redirects(value) { this._prefBranch.setCharPref('redirects', value); }, - - init : function() { - this._prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.redirector."); - this.reload(); - this._listeners = []; - this.service.addObserver('extensions.redirector', this, false); - }, - - dispose : function() { - this._listeners = null; - this.service.removeObserver('extensions.redirector', this); - }, - - reload : function() { - this._version = this._prefBranch.getCharPref('version'); - this._enabled = this._prefBranch.getBoolPref('enabled'); - this._showStatusBarIcon = this._prefBranch.getBoolPref('showStatusBarIcon'); - this._showContextMenu = this._prefBranch.getBoolPref('showContextMenu'); - this._debugEnabled = this._prefBranch.getBoolPref('debugEnabled'); - this._defaultDir = this._prefBranch.getCharPref('defaultDir'); - this._redirects = this._prefBranch.getCharPref('redirects'); - }, - - get service() { - return Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranchInternal); - }, - - observe : function(subject, topic, data) { - if (topic != 'nsPref:changed') { - return; - } - this.reload(); - for each (var listener in this._listeners) { - listener && listener.changedPrefs && listener.changedPrefs(this); - } - }, - - addListener : function(listener) { - this._listeners.push(listener); - }, - - removeListener : function(listener) { - for (var i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] == listener) { - this._listeners.splice(i,1); - return; - } - } - }, -} \ No newline at end of file diff --git a/chrome/content/code/settings.xul.js b/chrome/content/code/settings.xul.js deleted file mode 100644 index 4ec306d..0000000 --- a/chrome/content/code/settings.xul.js +++ /dev/null @@ -1,278 +0,0 @@ -// $Id$ - -var Redirector = Components.classes["@einaregilsson.com/redirector;1"].getService(Components.interfaces.rdIRedirector); -const Cc = Components.classes; -const Ci = Components.interfaces; -const nsLocalFile = Components.Constructor("@mozilla.org/file/local;1", "nsILocalFile", "initWithPath"); - -var Settings = { - - lstRedirects: null, - btnDelete : null, - btnEdit : null, - btnUp : null, - btnDown : null, - btnExport : null, - btnImport : null, - chkEnableRedirector : null, - chkShowStatusBarIcon : null, - chkShowContextMenu : null, - chkEnableDebugOutput : null, - prefs : null, - - onLoad : function() { - try { - //Get references to controls - this.lstRedirects = document.getElementById('lstRedirects'); - this.btnDelete = document.getElementById('btnDelete'); - this.btnEdit = document.getElementById('btnEdit'); - this.btnUp = document.getElementById('btnUp'); - this.btnDown = document.getElementById('btnDown'); - this.btnExport = document.getElementById('btnExport'); - this.btnImport = document.getElementById('btnImport'); - this.chkEnableRedirector = document.getElementById('chkEnableRedirector'); - this.chkShowStatusBarIcon = document.getElementById('chkShowStatusBarIcon'); - this.chkShowContextMenu = document.getElementById('chkShowContextMenu'); - this.chkEnableDebugOutput = document.getElementById('chkEnableDebugOutput'); - - this.prefs = new RedirectorPrefs(); - //Preferences - this.changedPrefs(this.prefs); - this.prefs.addListener(this); - - //Redirect list - this.lstRedirects.selType = 'single'; - this.template = document.getElementsByTagName('richlistitem')[0]; - this.lstRedirects.removeChild(this.template); - var list = []; - for (var i = 0; i < Redirector.redirectCount; i++) { - list.push(Redirector.getRedirectAt(i)); - } - this.addItemsToListBox(list); - this.selectionChange(); - - this.strings = document.getElementById('redirector-strings'); - this.strings.getPluralized = function(id, number) { - id += number == 1 ? 'Singular' : ''; - return this.getFormattedString(id, [number]); - }; - } catch(e) { - alert(e); - } - }, - - onUnload : function() { - this.prefs.dispose(); - }, - - changedPrefs : function(prefs) { - this.chkEnableRedirector.setAttribute('checked', prefs.enabled); - this.chkShowStatusBarIcon.setAttribute('checked', prefs.showStatusBarIcon); - this.chkShowContextMenu.setAttribute('checked', prefs.showContextMenu); - this.chkEnableDebugOutput.setAttribute('checked', prefs.debugEnabled); - }, - - addItemsToListBox : function(items) { - - var item, row, value, newItem; - - for each (item in items) { - newItem = this.template.cloneNode(true); - - newItem.getElementsByAttribute('name', 'dscrIncludePattern')[0].setAttribute('value', item.includePattern); - newItem.getElementsByAttribute('name', 'dscrExcludePattern')[0].setAttribute('value', item.excludePattern); - newItem.getElementsByAttribute('name', 'dscrRedirectTo')[0].setAttribute('value', item.redirectUrl); - var checkEnabled = newItem.getElementsByAttribute('name', 'chkEnabled')[0]; - checkEnabled.setAttribute('checked', !item.disabled); - newItem.setAttribute('class', item.disabled ? 'disabledRedirect' : ''); - newItem.item = item; - this.lstRedirects.appendChild(newItem); - newItem.setAttribute('selected', false) - } - - //Enable, disable functionality - this.lstRedirects.addEventListener('click', function(ev) { - if (ev.originalTarget && ev.originalTarget.tagName == 'checkbox') { - var parent = ev.originalTarget.parentNode; - while (!parent.item) { - parent = parent.parentNode; - } - parent.item.disabled = !ev.originalTarget.hasAttribute('checked'); - parent.setAttribute('class', parent.item.disabled ? 'disabledRedirect' : ''); - Redirector.save(); - } - },false); - }, - - moveUp : function(){ - if (this.lstRedirects.selectedIndex <= 0) { - return; - } - this.switchItems(this.lstRedirects.selectedIndex-1); - }, - - moveDown : function() { - if (this.lstRedirects.selectedIndex == Redirector.redirectCount-1) { - return; - } - this.switchItems(this.lstRedirects.selectedIndex); - }, - - switchItems : function(firstIndex) { - Redirector.switchItems(firstIndex, firstIndex+1); - var firstItem = this.lstRedirects.children[firstIndex]; - var secondItem = this.lstRedirects.children[firstIndex+1]; - this.lstRedirects.removeChild(secondItem); - this.lstRedirects.insertBefore(secondItem, firstItem); - this.selectionChange(); - }, - - setListItemValues : function(listItem, item){ - listItem.getElementsByAttribute('name', 'dscrIncludePattern')[0].setAttribute('value', item.includePattern); - listItem.getElementsByAttribute('name', 'dscrExcludePattern')[0].setAttribute('value', item.excludePattern); - listItem.getElementsByAttribute('name', 'dscrRedirectTo')[0].setAttribute('value', item.redirectUrl); - }, - - preferenceChange : function(event) { - this.prefs[event.originalTarget.getAttribute('preference')] = event.originalTarget.hasAttribute('checked'); - }, - - addRedirect : function() { - var args = { saved : false, redirect : new Redirect() }; - window.openDialog("chrome://redirector/content/ui/editRedirect.xul", "redirect", "chrome,dialog,modal,centerscreen", args); - if (args.saved) { - Redirector.addRedirect(args.redirect); - //Get it from redirector since it has processed it and it's no longer the same - //object as the one we added. - this.addItemsToListBox([Redirector.getRedirectAt(Redirector.redirectCount-1)]); - this.selectionChange(); - } - }, - - editRedirect : function() { - - if (this.lstRedirects.selectedIndex == -1) { - return; - } - //.selectedItem is still there after it has been removed, that's why we have the .selectedIndex check above as well - var listItem = this.lstRedirects.selectedItem; - if (!listItem) { - return; - } - var redirect = listItem.item; - var args = { saved: false, "redirect":redirect.clone()}; - window.openDialog("chrome://redirector/content/ui/editRedirect.xul", "redirect", "chrome,dialog,modal,centerscreen", args); - - if (args.saved) { - redirect.copyValues(args.redirect); - this.setListItemValues(listItem, redirect); - Redirector.save(); - this.selectionChange(); - } - }, - - deleteRedirect : function() { - var index = this.lstRedirects.selectedIndex; - - if (index == -1) { - return; - } - - var text = this.strings.getString("deleteConfirmationText"); - var title = this.strings.getString("deleteConfirmationTitle"); - var reallyDelete = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService).confirm(null, title, text); - if (!reallyDelete) { - return; - } - - try { - this.lstRedirects.removeChild(this.lstRedirects.children[index]); - Redirector.deleteRedirectAt(index); - this.selectionChange(); - } catch(e) { - alert(e); - } - }, - - listKeypress : function(event) { - if (event.keyCode == 13) { //Enter button - this.editRedirect(); - } else if (event.keyCode == 46) { //Del button - this.deleteRedirect(); - } - }, - - selectionChange : function() { - if (!this.lstRedirects) { - return; - } - var index = this.lstRedirects.selectedIndex; - - this.btnEdit.disabled = (index == -1); - this.btnDelete.disabled = (index == -1); - this.btnUp.disabled = (index <= 0); - this.btnDown.disabled = (index == -1 || index >= Redirector.redirectCount-1); - this.btnExport.disabled = (Redirector.redirectCount== 0); - }, - - getFile : function(captionKey, mode) { - //Mostly borrowed from Adblock Plus - var picker = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); - picker.init(window, this.strings.getString(captionKey), mode); - picker.defaultExtension = ".rdx"; - var dir = this.prefs.defaultDir; - if (dir) { - picker.displayDirectory = new nsLocalFile(dir); - } - picker.appendFilter(this.strings.getString('redirectorFiles'), '*.rdx'); - - if (picker.show() == picker.returnCancel) { - return null; - } - this.prefs.defaultDir = picker.displayDirectory.path; - return picker.file; - }, - - export : function() { - var file = this.getFile('exportCaption', Ci.nsIFilePicker.modeSave); - if (file) { - Redirector.exportRedirects(file); - } - }, - - import : function() { - var file = this.getFile('importCaption', Ci.nsIFilePicker.modeOpen); - var result; - if (!file) { - return; - } - result = Redirector.importRedirects(file); - var msg, imported, existed; - imported = result & 0xFFFF; - existed = result >> 16; - - if (imported > 0) { - msg = this.strings.getPluralized('importedMessage', imported); - if (existed > 0) { - msg += ', ' + this.strings.getPluralized('existedMessage',existed); - } else { - msg += '.'; - } - } else if (imported == 0 && existed > 0) { - msg = this.strings.getPluralized('allExistedMessage', existed); - } else { //Both 0 - msg = this.strings.getString('importedNone'); - } - - var title = this.strings.getString("importResult"); - Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService).alert(null, title, msg); - - if (imported > 0) { - var newlist = []; - for (var i = Redirector.redirectCount-imported; i < Redirector.redirectCount; i++) { - newlist.push(Redirector.getRedirectAt(i)); - } - this.addItemsToListBox(newlist); - } - } -}; diff --git a/chrome/content/log.html b/chrome/content/log.html deleted file mode 100644 index a4f04d1..0000000 --- a/chrome/content/log.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - Redirector Log Message Listener - <style type="text/css"> - body { font-family:Arial, sans-serif; } - </style> - </head> - <body onunload="unload();" onload="load();"> - <script> - var listener = { - observe : function(msg) { - var prefix = 'REDIRECTOR:'; - if (msg.message.substr(0, prefix.length) == prefix) - { - if (document) { - document.body.innerHTML += msg.message.substr(prefix.length) + '<br>'; - } else { - //Been destroyed and we're still getting message, lets try to unsubscribe... - try { unload(); } catch(e) {} - } - } - } - }; - var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService); - - function load() { - consoleService.registerListener(listener); - } - function unload() { - consoleService.unregisterListener(listener); - } - </script> - </body> -</html> \ No newline at end of file diff --git a/chrome/content/ui/browserOverlay.xul b/chrome/content/ui/browserOverlay.xul deleted file mode 100644 index 32bf1d5..0000000 --- a/chrome/content/ui/browserOverlay.xul +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- $Id$ --> -<!DOCTYPE overlay SYSTEM "chrome://redirector/locale/browserOverlay.xul.dtd"> -<overlay id="redirector-overlay" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <script src="../code/redirect.js"/> - <script src="../code/redirectorprefs.js"/> - <script src="../code/browserOverlay.xul.js"/> - - <stringbundleset id="stringbundleset"> - <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/> - </stringbundleset> - - <menupopup id="menu_ToolsPopup"> - <menuitem id="redirector-menuitem" label="&RedirectorMenuItem.label;" - accesskey="&RedirectorMenuItem.accesskey;" - oncommand="RedirectorOverlay.onMenuItemCommand(event);"/> - </menupopup> - <popup id="contentAreaContextMenu"> - <menuitem id="redirector-context" label="&RedirectorContext.label;" - accesskey="&RedirectorContext.accesskey;" - insertafter="context-stop" - oncommand="RedirectorOverlay.onContextMenuCommand(event)"/> - </popup> - <statusbar id="status-bar"> - <statusbarpanel id="redirector-status"> - <image id="redirector-statusbar-img" src="chrome://redirector/skin/statusactive.png" - tooltiptext="Redirector is enabled;" - style="width:16px; height:16px;" - onclick="RedirectorOverlay.statusBarClick(event);" /> - </statusbarpanel> - </statusbar> - -</overlay> \ No newline at end of file diff --git a/chrome/content/ui/editRedirect.xul b/chrome/content/ui/editRedirect.xul deleted file mode 100644 index a8531ea..0000000 --- a/chrome/content/ui/editRedirect.xul +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- $Id$ --> -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://redirector/skin/redirector.css" type="text/css"?> -<!DOCTYPE dialog SYSTEM "chrome://redirector/locale/editRedirect.xul.dtd"> -<dialog title="&redirectWindow.title;" - orient="vertical" - autostretch="always" - onload="EditRedirect.onLoad();" - buttons="accept,cancel" - ondialogaccept="return EditRedirect.onAccept();" - xmlns:nc="http://home.netscape.com/NC-rdf#" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - - <script type="application/x-javascript" src="../code/redirect.js"/> - <script type="application/x-javascript" src="../code/editRedirect.xul.js"/> - <stringbundleset id="stringbundleset"> - <stringbundle id="redirector-strings" src="chrome://redirector/locale/redirector.properties"/> - </stringbundleset> - - <grid> - <rows class="editRedirects"> - <row align="center"> - <text value="&txtExampleUrl.label;" /> - <textbox id="txtExampleUrl" /> - </row> - <row align="center"> - <text value="&txtIncludePattern.label;" /> - <textbox id="txtIncludePattern" taborder="1"/> - <button id="btnTestPattern" label="&btnTestPattern.label;" onclick="EditRedirect.testPattern();" taborder="2"/> - </row> - <row align="center"> - <text value="&txtExcludePattern.label;" /> - <textbox id="txtExcludePattern" taborder="3"/> - </row> - <row align="center"> - <text value="&txtRedirectUrl.label;" /> - <textbox id="txtRedirectUrl" taborder="4"/> - </row> - <row align="center"> - <text value="&rdoPatternTypes.label;"/> - <radiogroup> - <hbox> - <radio id="rdoWildcard" label="&rdoWildcard.label;" accesskey="&rdoWildcard.accessKey;" selected="true" taborder="5"/> - <radio id="rdoRegex" label="&rdoRegex.label;" accesskey="&rdoRegex.accessKey;" taborder="6"/> - </hbox> - </radiogroup> - </row> - <row align="center"> - <text value="&chkUnescapeMatches.label;" /> - <hbox> - <checkbox id="chkUnescapeMatches" label="" taborder="7"/> - <spacer flex="1" /> - </hbox> - </row> - </rows> - </grid> -</dialog> diff --git a/chrome/content/ui/help.html b/chrome/content/ui/help.html deleted file mode 100644 index 19105a4..0000000 --- a/chrome/content/ui/help.html +++ /dev/null @@ -1,182 +0,0 @@ -<!-- $Id$ --> -<html> - <head> - <title>Redirector Help - - - -

Redirector Help

-

Table of contents

- - - - -

What is Redirector?

- -

Redirector is an extension for Firefox that allows you to automatically redirect from - one webpage to another. For example, every time you visit http://abc.com you will automatically - load http://def.com instead. This can be useful for instance to always redirect articles to printer friendly - versions, redirect http:// to https:// for sites that support both, bypass advertising pages that appear before - being able to view certain pages and more.

- - -

Basic usage

-

To add a new redirect you can go to the Tools menuitem and select Redirector. That will - open the Redirector settings window which shows all your redirects. The window can also be opened - by right clicking on the R icon in your statusbar. - There you can press the Add... button and then you can enter the details for the new redirect. A redirect - consists of a few things: -

-

- - -

Wildcards

- -

Wildcards are the simplest way to specify include and exclude patterns. When you create a wildcard pattern there - is just one special character, the asterisk *. An asterisk in your pattern will match zero or more characters and you can - have more than one star in your pattern. Some examples: -

- $1, $2, $3 in the redirect urls will match the text that the stars matched. Examples: - -

- - -

Regular expressions

- -

Regular expressions allow for more complicated patterns but they are a lot harder to learn than wildcards. I'm not gonna - create a regex tutorial here but normal javascript regex syntax works, look at http://regular-expressions.info for - an introduction to regular expressions. $1,$2 etc. can be used in the redirect url and will be replaced with contents of captures in - the regular expressions. Captures are specified with parantheses. Example: http://example.com/index.asp\?id=(\d+) will match the url - http://example.com/index.asp?id=12345 and $1 will be replaced by 12345. (A common mistake in regex patterns is to forget to escape - the ? sign in the querystring of the url. ? is a special character in regular expressions so if you want to match an url with a querystring - you should escape it as \?).

- - -

Examples

- -
    -
  1. - Static redirect
    - Redirects from http://example.com/foo to http://example.com/bar -

    - Include pattern: http://example.com/foo
    - Exclude pattern:
    - Redirect to: http://example.com/bar
    - Pattern type: Wildcard
    -

    - -
  2. -
  3. - Redirect using query string parameter and wildcards
    - Redirects from http://example.com/index.php?id=12345&a=b to http://example.com/printerfriendly.php?id=12345&a=b - where 12345 could be any number. -

    - Include pattern: http://example.com/index.php?id=*&a=b
    - Exclude pattern:
    - Redirect to: http://example.com/printerfriendly.com?id=$1&a=b
    - Pattern type: Wildcard
    -

    -
  4. -
  5. - Redirect using query string parameter and regular expressions
    - Redirects from http://example.com/index.php?id=12345&a=b to http://example.com/printerfriendly.php?id=12345&a=b - where 12345 could be any number. -

    - Include pattern: http://example.com/index.php\?id=(\d+)&a=b
    - Exclude pattern:
    - Redirect to: http://example.com/printerfriendly.com?id=$1&a=b
    - Pattern type: Regular Expression
    -

    -
  6. -
  7. - Redirect to a different folder using wildcards
    - Redirects from http://example.com/category/fish/index.php to http://example.com/category/cats/index.php - where fish could be any word. The exclude pattern makes sure that there is only one - folder there, so for instance http://example.com/category/fish/cat/mouse/index.php would not match. -

    - Include pattern: http://example.com/category/*/index.php
    - Exclude pattern: http://example.com/category/*/*/index.php
    - Redirect to: http://example.com/category/cats/index.php
    - Pattern type: Wildcard
    -

    -
  8. -
  9. - Redirect http to https using wildcards
    - Redirects from http://mail.google.com/randomcharacters to https://mail.google.com/randomcharacters - where randomcharacters could be anything. -

    - Include pattern: http://mail.google.com*
    - Exclude pattern:
    - Redirect to: https://mail.google.com$1
    - Pattern type: Wildcard
    -

    -
  10. -
- - \ No newline at end of file diff --git a/chrome/content/ui/settings.xul b/chrome/content/ui/settings.xul deleted file mode 100644 index 27f16dd..0000000 --- a/chrome/content/ui/settings.xul +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - -

Redirector Unit Tests

- - -
-
- - \ No newline at end of file diff --git a/chrome/content/unittest/testcases.js b/chrome/content/unittest/testcases.js deleted file mode 100644 index afefff7..0000000 --- a/chrome/content/unittest/testcases.js +++ /dev/null @@ -1,129 +0,0 @@ -//// $Id$ -var nsIContentPolicy = Components.interfaces.nsIContentPolicy; - -var tests = { - "Wildcard matches" : { - run : function(data,log) { - var pattern = data[0], - url = data[1], - expected = data[2]; - var parts = expected.split(','); - var redirectUrl = ''; - if (!(parts.length == 1 && parts[0] == '')) { - for (var i in parts) { - redirectUrl += '$' + (parseFloat(i)+1) + ','; - } - redirectUrl = redirectUrl.substr(0, redirectUrl.length-1); - } - var redirect = new Redirect(null, pattern, redirectUrl, Redirect.WILDCARD); - var result = redirect.getMatch(url); - return { passed: result.isMatch && (result.redirectTo == expected), message : "Expected '" + expected + "', actual was '" + result.redirectTo + "'"}; - }, - - describe : function(data) { return data[0] + ' == ' + data[1] + ', matches=' + data[2]; }, - tests : [ - ['http://foo*', 'http://foobar.is', 'bar.is'], - ['http://foo*', 'http://foo', ''], - ['*://foo.is', 'http://foo.is', 'http'], - ['*http://foo.is', 'http://foo.is', ''], - ['http*foo*', 'http://foobar.is', '://,bar.is'], - ['http*foo*', 'http://foo', '://,'], - ['*://f*.is', 'http://foo.is', 'http,oo'], - ['*http://f*.is', 'http://foo.is', ',oo'], - ['*foo*', 'http://foo', 'http://,'], - ['*foo*', 'foobar.is', ',bar.is'], - ['*foo*', 'http://foobar.is', 'http://,bar.is'], - ['http://foo.is', 'http://foo.is', ''], - ['*', 'http://foo.is', 'http://foo.is'], - ['*://*oo*bar*', 'http://foo.is/bar/baz', 'http,f,.is/,/baz'], - ['*://**oo*bar*', 'http://foo.is/bar/baz', 'http,,f,.is/,/baz'], - ] - }, - - "Regex matches" : { - run : function(data) { - var pattern = data[0], - url = data[1], - expected = data[2]; - var parts = expected.split(','); - var redirectUrl = ''; - if (!(parts.length == 1 && parts[0] == '')) { - for (var i in parts) { - redirectUrl += '$' + (parseFloat(i)+1) + ','; - } - redirectUrl = redirectUrl.substr(0, redirectUrl.length-1); - } - var redirect = new Redirect(null, pattern, redirectUrl, Redirect.REGEX, null, null); - var result = redirect.getMatch(url); - return { passed: result.isMatch && result.redirectTo == expected, message : "Expected '" + expected + "', actual was '" + result.redirectTo + "'"}; - }, - - describe : function(data) { return data[0] + ' == ' + data[1] + ', matches=' + data[2]; }, - tests : [ - ['http://foo(.*)', 'http://foobar.is', 'bar.is'], - ['http://foo(.*)', 'http://foo', ''], - ['(.*)://foo.is', 'http://foo.is', 'http'], - ['(.*)http://foo\\.is', 'http://foo.is', ''], - ['http(.*)foo(.*)', 'http://foobar.is', '://,bar.is'], - ['http(.*)foo(.*)', 'http://foo', '://,'], - ['(.*)://f(.*)\\.is', 'http://foo.is', 'http,oo'], - ['(.*)http://f(.*)\\.is', 'http://foo.is', ',oo'], - ['(.*)foo(.*)', 'http://foo', 'http://,'], - ['(.*)foo(.*)', 'foobar.is', ',bar.is'], - ['(.*)foo(.*)', 'http://foobar.is', 'http://,bar.is'], - ['http://foo\.is', 'http://foo.is', ''], - ['(.*)', 'http://foo.is', 'http://foo.is'], - ['(.*)://(.*)oo(.*)bar(.*)', 'http://foo.is/bar/baz', 'http,f,.is/,/baz'], - ['(.*)://(.*?)(.*)oo(.*)bar(.*)', 'http://foo.is/bar/baz', 'http,,f,.is/,/baz'], - ] - }, - - "nsIContentPolicy implementation" : { - run : function(data) { - var runTest = function() { - var args = { - contentType : nsIContentPolicy.TYPE_DOCUMENT, - contentLocation : "http://foo.is", - requestOrigin : null, - aContext : { loadURI : function(){}}, - mimeTypeGuess : null, - extra : null - }; - for (var key in data[1]) { - args[key] = data[1][key]; - } - - var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); - args.contentLocation = ioService.newURI(args.contentLocation, null, null); - var contentPolicy = redirector.QueryInterface(nsIContentPolicy); - var result = contentPolicy.shouldLoad(args.contentType, args.contentLocation, args.requestOrigin, args.aContext, args.mimeTypeGuess, args.extra); - return { passed: result == nsIContentPolicy.ACCEPT, message : "Expected nsIContentPolicy.ACCEPT, actual was " + result }; - } - - if (typeof data[2] == "function") { - return data[2](runTest); - } else { - return runTest(); - } - }, - - describe : function(data) { return data[0]; }, - tests : [ - ["Accepts if not TYPE_DOCUMENT", { contentType : nsIContentPolicy.TYPE_STYLESHEET}], - ["Accepts if not http or https", { contentLocation : "resource://foo/bar"}], - ["Accepts if no aContext", { aContext : null}], - ["Accepts if aContext has no loadURI function", { aContext : { foo : function(){}}}], - ["Accepts if Redirector is not enabled", {}, function(doFunc) { - try { - redirector.enabled = false; - return doFunc(); - redirector.enabled = true; - - } catch(e) { - redirector.enabled = true; - throw e; - } - }] - ] - } -}; diff --git a/chrome/locale/en-US/browserOverlay.xul.dtd b/chrome/locale/en-US/browserOverlay.xul.dtd deleted file mode 100644 index 3aaa0fc..0000000 --- a/chrome/locale/en-US/browserOverlay.xul.dtd +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/chrome/locale/en-US/editRedirect.xul.dtd b/chrome/locale/en-US/editRedirect.xul.dtd deleted file mode 100644 index 4b48d9c..0000000 --- a/chrome/locale/en-US/editRedirect.xul.dtd +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/chrome/locale/en-US/redirector.properties b/chrome/locale/en-US/redirector.properties deleted file mode 100644 index 128d08e..0000000 --- a/chrome/locale/en-US/redirector.properties +++ /dev/null @@ -1,33 +0,0 @@ -# $Id$ -initError=Failed to initialize Redirector. -extensions.redirector@einaregilsson.com.description=Automatically redirects to user-defined urls on certain pages -extensionName=Redirector -addCurrentUrl=Add current url to Redirector -addLinkUrl=Add link url to Redirector -recursiveError=A redirect with the pattern %S matches %S and is trying to redirect to it again. You should change this rule so it won't work recursively. -enabledTooltip=Redirector is enabled -disabledTooltip=Redirector is disabled -testPatternSuccess=The pattern %S matches example URL %S, and would redirect you to url: %S -testPatternFailure=The pattern %S does not match example URL %S -testPatternExclude=Example URL %S matches the exclude pattern %S and so would not be redirected -regexPatternError=The pattern '%S' is not a legal regular expression pattern. Details: %S -xpathDeprecated=XPath patterns are no longer supported as of version 1.5.1, please remove those redirects. -redirectorFiles=Redirector files (*.rdx) -exportCaption=Export redirects... -importCaption=Import redirects... -deleteConfirmationText=Are you sure you want to permanently delete this redirect? -deleteConfirmationTitle=Delete redirect? -importedMessage=%S redirects were imported -importedMessageSingular=%S redirect was imported -existedMessage=%S redirects were identical to existing redirects and were therefore not imported. -existedMessageSingular=%S redirect was identical to an existing redirect and was therefore not imported. -allExistedMessage=All %S redirects in the file were identical to existing redirects, no redirects were imported. -allExistedMessageSingular=The single redirect in the file was identical to an existing redirect and was therefore not imported. -importedNone=There were no usable redirects in the given file, no redirects were imported. -importResult=Import results -invalidRedirectTitle=Redirector Add-on: Invalid Redirect detected -invalidRedirectText=The pattern "%S" redirected the url %S to %S which also matches the pattern. This will cause an endless loop and so the redirect has been disabled to prevent this from happening. You should edit this redirect to fix it. -warningExampleUrlDoesntMatchPatternTitle=Warning: Example url does not match redirect -warningExampleUrlDoesntMatchPattern=The example url does not match the redirect specified. Are you sure you want to save this redirect? -errorExampleUrlMatchesRecursiveTitle=Error: Recursive match detected -errorExampleUrlMatchesRecursive=The example url %S matches the redirect and would redirect you to %S, which also matches the redirect. This is not allowed as it can cause an endless loop of requests. \ No newline at end of file diff --git a/chrome/locale/en-US/settings.xul.dtd b/chrome/locale/en-US/settings.xul.dtd deleted file mode 100644 index ff55b68..0000000 --- a/chrome/locale/en-US/settings.xul.dtd +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/chrome/locale/zh-CN/browserOverlay.xul.dtd b/chrome/locale/zh-CN/browserOverlay.xul.dtd deleted file mode 100644 index b0567f8..0000000 --- a/chrome/locale/zh-CN/browserOverlay.xul.dtd +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/chrome/locale/zh-CN/editRedirect.xul.dtd b/chrome/locale/zh-CN/editRedirect.xul.dtd deleted file mode 100644 index f0ab422..0000000 --- a/chrome/locale/zh-CN/editRedirect.xul.dtd +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/chrome/locale/zh-CN/redirector.properties b/chrome/locale/zh-CN/redirector.properties deleted file mode 100644 index 866ec1a..0000000 --- a/chrome/locale/zh-CN/redirector.properties +++ /dev/null @@ -1,33 +0,0 @@ -# $Id: redirector.properties 288 2009-10-26 08:13:15Z einar@einaregilsson.com $ -initError=Failed to initialize Redirector. -extensions.redirector@einaregilsson.com.description=根据您设置的规则自动跳转网页。 -extensionName=Redirector -addCurrentUrl=Add current url to Redirector -addLinkUrl=为链接创建 Redirector 规则 -recursiveError=A redirect with the pattern %S matches %S and is trying to redirect to it again. You should change this rule so it won't work recursively. -enabledTooltip=Redirector is enabled -disabledTooltip=Redirector is disabled -testPatternSuccess=The pattern %S matches example URL %S, and would redirect you to url: %S -testPatternFailure=The pattern %S does not match example URL %S -testPatternExclude=Example URL %S matches the exclude pattern %S and so would not be redirected -regexPatternError=The pattern '%S' is not a legal regular expression pattern. Details: %S -xpathDeprecated=XPath patterns are no longer supported as of version 1.5.1, please remove those redirects. -redirectorFiles=Redirector files (*.rdx) -exportCaption=Export redirects... -importCaption=Import redirects... -deleteConfirmationText=Are you sure you want to permanently delete this redirect? -deleteConfirmationTitle=Delete redirect? -importedMessage=%S redirects were imported -importedMessageSingular=%S redirect was imported -existedMessage=%S redirects were identical to existing redirects and were therefore not imported. -existedMessageSingular=%S redirect was identical to an existing redirect and was therefore not imported. -allExistedMessage=All %S redirects in the file were identical to existing redirects, no redirects were imported. -allExistedMessageSingular=The single redirect in the file was identical to an existing redirect and was therefore not imported. -importedNone=There were no usable redirects in the given file, no redirects were imported. -importResult=Import results -invalidRedirectTitle=Redirector Add-on: Invalid Redirect detected -invalidRedirectText=The pattern "%S" redirected the url %S to %S which also matches the pattern. This will cause an endless loop and so the redirect has been disabled to prevent this from happening. You should edit this redirect to fix it. -warningExampleUrlDoesntMatchPatternTitle=Warning: Example url does not match redirect -warningExampleUrlDoesntMatchPattern=The example url does not match the redirect specified. Are you sure you want to save this redirect? -errorExampleUrlMatchesRecursiveTitle=Error: Recursive match detected -errorExampleUrlMatchesRecursive=The example url %S matches the redirect and would redirect you to %S, which also matches the redirect. This is not allowed as it can cause an endless loop of requests. \ No newline at end of file diff --git a/chrome/locale/zh-CN/settings.xul.dtd b/chrome/locale/zh-CN/settings.xul.dtd deleted file mode 100644 index 0facb3a..0000000 --- a/chrome/locale/zh-CN/settings.xul.dtd +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/chrome/skin/movedown.png b/chrome/skin/movedown.png deleted file mode 100644 index d32b79c..0000000 Binary files a/chrome/skin/movedown.png and /dev/null differ diff --git a/chrome/skin/movedowndisabled.png b/chrome/skin/movedowndisabled.png deleted file mode 100644 index afd8fc6..0000000 Binary files a/chrome/skin/movedowndisabled.png and /dev/null differ diff --git a/chrome/skin/moveup.png b/chrome/skin/moveup.png deleted file mode 100644 index 3025378..0000000 Binary files a/chrome/skin/moveup.png and /dev/null differ diff --git a/chrome/skin/moveupdisabled.png b/chrome/skin/moveupdisabled.png deleted file mode 100644 index e526b29..0000000 Binary files a/chrome/skin/moveupdisabled.png and /dev/null differ diff --git a/chrome/skin/redirector.css b/chrome/skin/redirector.css deleted file mode 100644 index 12e3d55..0000000 --- a/chrome/skin/redirector.css +++ /dev/null @@ -1,15 +0,0 @@ -/* $Id$ */ - -.disabledRedirect { color:grey; } -#lstRedirects richlistitem { border-bottom:dotted 1px grey; padding:3px; } -.redirectRows > row > label { font-weight:bold;} -.editRedirects > row > textbox { width: 350px; } -#redirectorSettings > tabbox { margin:4px; } -#btnUp { list-style-image: url('chrome://redirector/skin/moveup.png'); } -#btnDown { list-style-image: url('chrome://redirector/skin/movedown.png'); } -#btnUp[disabled=true] { list-style-image: url('chrome://redirector/skin/moveupdisabled.png'); } -#btnDown[disabled=true] { list-style-image: url('chrome://redirector/skin/movedowndisabled.png'); } - -#btnUp, #btnDown { width:25px; min-width:25px; } -#lblExport, #lblImport { padding-top:5px; } -#grpImportExport { padding-top:10px; padding-left:5px;} \ No newline at end of file diff --git a/chrome/skin/redirector.png b/chrome/skin/redirector.png deleted file mode 100644 index f8de12c..0000000 Binary files a/chrome/skin/redirector.png and /dev/null differ diff --git a/chrome/skin/statusactive.png b/chrome/skin/statusactive.png deleted file mode 100644 index 06ce766..0000000 Binary files a/chrome/skin/statusactive.png and /dev/null differ diff --git a/chrome/skin/statusinactive.png b/chrome/skin/statusinactive.png deleted file mode 100644 index 8b83562..0000000 Binary files a/chrome/skin/statusinactive.png and /dev/null differ diff --git a/components/redirector.component.js b/components/redirector.component.js deleted file mode 100644 index 751f548..0000000 --- a/components/redirector.component.js +++ /dev/null @@ -1,51 +0,0 @@ -//// $Id$ - -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Ci = Components.interfaces; -Cr = Components.results; -Cc = Components.classes; -const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader); - -function rdump(msg) { - //dump('\nREDIRECTOR: ' + msg); -} -var redirector = null; -function Redirector() { - this._init(); -} - -try { - loader.loadSubScript('chrome://redirector/content/code/redirector.prototype.js'); - loader.loadSubScript('chrome://redirector/content/code/redirect.js'); - loader.loadSubScript('chrome://redirector/content/code/redirectorprefs.js'); -} catch(e) { - rdump('ERROR: ' + e); - for (i in e) { - Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage('REDIRECTOR: Loading Redirector implementation failed: ' + i + e[i]); - } -} - -//Add the xpcom stuff to the prototype -var xpcomInfo = Redirector.prototype; -xpcomInfo.classDescription = "Redirector Component"; -xpcomInfo.classID = Components.ID("{b7a7a54f-0581-47ff-b086-d6920cb7a3f7}"); -xpcomInfo.contractID = "@einaregilsson.com/redirector;1"; -xpcomInfo._xpcom_categories = [{category:'content-policy'},{category:'net-channel-event-sinks'}]; -xpcomInfo.QueryInterface = XPCOMUtils.generateQI([Ci.nsIContentPolicy, Ci.nsIChannelEventSink, Ci.rdIRedirector]); -xpcomInfo._xpcom_factory = { - createInstance: function(outer, iid) { - if (outer) throw Cr.NS_ERROR_NO_AGGREGATION; - if (redirector == null) { - rdump('Creating new instance'); - redirector = new Redirector(); - } else { - rdump('Using existing instance'); - } - return redirector.QueryInterface(iid); - } -}; - -if (XPCOMUtils.generateNSGetFactory) - var NSGetFactory = XPCOMUtils.generateNSGetFactory([Redirector]); -else - var NSGetModule = XPCOMUtils.generateNSGetModule([Redirector]); \ No newline at end of file -- cgit v1.2.3-70-g09d2