Index: lib/main.js |
=================================================================== |
--- a/lib/main.js |
+++ b/lib/main.js |
@@ -76,51 +76,3 @@ |
require("typedItCollector").onBrowserInitialized(window); |
} |
- |
-var URLFIXER = { |
- load : function () { |
- document.addEventListener("URLFixerNetErrorCorrection", URLFIXER.netErrorCorrection, false, true); |
- }, |
- |
- netErrorCorrection : function (evt) { |
- var button = evt.target; |
- var oldUrl = button.getAttribute("old"); |
- var newUrl = button.getAttribute("new"); |
- |
- if (newUrl.indexOf("http://") == -1 && newUrl.indexOf("https://") == -1) { |
- newUrl = oldUrl.split("//")[0] + "//" + newUrl; |
- } |
- |
- var rv = newUrl; |
- |
- var oldParts = oldUrl.split("://"); |
- var newParts = newUrl.split("://"); |
- |
- // Discard the protocol if they're the same. |
- if (oldParts[0] == newParts[0]) { |
- oldParts.shift(); |
- newParts.shift(); |
- oldUrl = "//" + oldParts.join("//"); |
- newUrl = "//" + newParts.join("//"); |
- } |
- |
- // Ignore www subdomain if both of them have it. |
- if (oldUrl.indexOf("//www.") != -1 && (oldUrl.indexOf("//www.") === newUrl.indexOf("//www."))) { |
- oldUrl = oldUrl.split("//www.")[1]; |
- newUrl = newUrl.split("//www.")[1]; |
- } |
- |
- // Ignore trailing slashes |
- if (oldUrl.charAt(oldUrl.length - 1) == "/" && newUrl.charAt(newUrl.length - 1) == "/") { |
- oldUrl = oldUrl.substr(0, oldUrl.length - 1); |
- newUrl = newUrl.substr(0, newUrl.length - 1); |
- } |
- |
- var corrections = URLFIXER.getJSONPref("custom_replace", {}); |
- corrections[oldUrl] = newUrl; |
- URLFIXER.setJSONPref("custom_replace", corrections); |
- |
- content.location.href = rv; |
- } |
-}; |
- |