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:
-
-
Example url: This is an example of an url you want to redirect. It is not really used for anything,
- it's just there to show what types of urls you're targetting. You can leave this out, but then you can't use the Test pattern button.
-
-
Include pattern: This is pattern for the urls you want to redirect. In the simplest case, where you just want
- to redirect one specific url to another then this will just be the exact url you want to redirect. For instance, if you just want http://aaa.com to
- redirect to http://bbb.com then Include pattern will just be http://aaa.com. For more complex patterns that match many
- urls you can use either wildcards or regular expressions.
-
-
Exclude pattern: Urls that match this pattern will never be redirected. This is not necessary to
- fill out, but can be useful when you want to redirect all urls that contain some text except if they contain some other text.
- Redirects like that can often be done with a complex regular expression, but using an exclude pattern makes it much simpler. The exclude
- patterns can use wildcard characters or regular expressions like the include patterns.
-
-
Redirect to: This is the url that you will be redirected to when you open any page where the url matches the
- include pattern. You can use the special signs $1, $2, $3 etc. in the url, they will be replaced by the results of captures with regular
- expressions or stars with wildcards. For instance, if you have the include pattern http://google.com/*, redirect to http://froogle.com/$1
- and you open the page http://google.com/foobar, then you will be redireced to http://froogle.com/foobar, since 'foobar' was what the star replaced. $1 is for the
- first star in the pattern, $2 for the second and so on. For regular expression $1 is for the first parantheses, $2 for the second etc.
-
-
Pattern type: This specifies how Redirector should interpret the patterns, either as
- wildcards or regular expressions.
-
-
Unescape matches: A common usage of Redirector is to catch urls like
- http://foo.com/redirect.php?url=http%3A%2F%2Fbar%2Ecom%2Fpath and try to catch the url parameter and redirect to it. A pattern
- like http://foo.com/redirect.php?url=* might be used for that purpose. However, if the url parameter is escaped (also known
- as urlencoded) then that won't work. In the url above we see that it starts with http%3A%2F%2F instead of http://, and Firefox
- won't accept this as a new url to redirect to. So, in cases like these you can check the Unescape matches option and then all
- matches will be unescaped (turned from e.g. http%3A%2F%2Fbar%2Ecom to http://bar.com) before being inserted into the target url.
-
-
-
-
-
-
-
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:
-
-
http://example.com/* matches http://example.com/, http://example.com/foo, http://example.com/bar and all other urls that start with http://example.com/.
-
http://*.example.com matches all subdomains of example.com, like http://www.example.com, http://mail.example.com.
-
http*://example.com matches both http://example.com and https://example.com.
- $1, $2, $3 in the redirect urls will match the text that the stars matched. Examples:
-
-
http://example.com/* matches http://example.com/foobar, $1 is foobar.
-
http://*.example.com/* matches http://www.example.com/foobar, $1 is www, $2 is foobar.
-
-
-
-
-
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
-
-
-
- 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
-
-
-
-
- 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
-
-
-
- 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
-
-
-
- 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
-
-
-
- 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
-
-
-
\ 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
--
cgit v1.2.3