From 433ed8cdca328b6077c8aa84155882af361aeafa Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Wed, 22 Sep 2010 19:17:33 +0000 Subject: v2.5, supports FF4.0 betas and has simplified chinese locale. git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@370 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/code/redirector.prototype.js | 15 ++++++- 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 +++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 chrome/locale/zh-CN/browserOverlay.xul.dtd create mode 100644 chrome/locale/zh-CN/editRedirect.xul.dtd create mode 100644 chrome/locale/zh-CN/redirector.properties create mode 100644 chrome/locale/zh-CN/settings.xul.dtd (limited to 'chrome') diff --git a/chrome/content/code/redirector.prototype.js b/chrome/content/code/redirector.prototype.js index d7b4bc8..be920d8 100644 --- a/chrome/content/code/redirector.prototype.js +++ b/chrome/content/code/redirector.prototype.js @@ -143,6 +143,7 @@ Redirector.prototype = { // nsIContentPolicy implementation shouldLoad: function(contentType, contentLocation, requestOrigin, aContext, mimeTypeGuess, extra) { + rdump('nsIContentPolicy::ShouldLoad ' + contentLocation.spec); try { //This is also done in getRedirectUrl, but we want to exit as quickly as possible for performance if (!this._prefs.enabled) { @@ -181,10 +182,19 @@ Redirector.prototype = { //end nsIContentPolicy //nsIChannelEventSink implementation + + //For FF4.0. Got this from a thread about adblock plus, https://adblockplus.org/forum/viewtopic.php?t=5895 + asyncOnChannelRedirect: function(oldChannel, newChannel, flags, redirectCallback) { + this.onChannelRedirect(oldChannel, newChannel, flags); + redirectCallback.onRedirectVerifyCallback(0); + }, + onChannelRedirect: function(oldChannel, newChannel, flags) { try { let newLocation = newChannel.URI.spec; + rdump('nsIChannelEventSink::onChannelRedirect ' + newLocation); + if (!(newChannel.loadFlags & Ci.nsIChannel.LOAD_DOCUMENT_URI)) { //We only redirect documents... return; @@ -242,12 +252,13 @@ Redirector.prototype = { if (this._prefs) { this._prefs.dispose(); } + this._cout.logStringMessage('REDIRECTOR CREATED'); this._prefs = new RedirectorPrefs(); //Check if we need to update existing redirects var data = this._prefs.redirects; var version = this._prefs.version; this._loadStrings(); - var currentVersion = '2.0.2'; + var currentVersion = '2.5'; //Here update checks are handled if (version == 'undefined') { //Either a fresh install of Redirector, or first time install of v2.0 if (data) { //There is some data in redirects, we are upgrading from a previous version, need to upgrade data @@ -264,7 +275,7 @@ Redirector.prototype = { this._prefs.redirects = newArr.join(':::'); } this._prefs.version = currentVersion; - } else if (version == '2.0' || version == '2.0.1') { + } else if (version == '2.0' || version == '2.0.1' || version == '2.0.2') { this._prefs.version = currentVersion; } //Update finished diff --git a/chrome/locale/zh-CN/browserOverlay.xul.dtd b/chrome/locale/zh-CN/browserOverlay.xul.dtd new file mode 100644 index 0000000..b0567f8 --- /dev/null +++ b/chrome/locale/zh-CN/browserOverlay.xul.dtd @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/chrome/locale/zh-CN/editRedirect.xul.dtd b/chrome/locale/zh-CN/editRedirect.xul.dtd new file mode 100644 index 0000000..f0ab422 --- /dev/null +++ b/chrome/locale/zh-CN/editRedirect.xul.dtd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/chrome/locale/zh-CN/redirector.properties b/chrome/locale/zh-CN/redirector.properties new file mode 100644 index 0000000..866ec1a --- /dev/null +++ b/chrome/locale/zh-CN/redirector.properties @@ -0,0 +1,33 @@ +# $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 new file mode 100644 index 0000000..0facb3a --- /dev/null +++ b/chrome/locale/zh-CN/settings.xul.dtd @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2