Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/main.js

Issue 8382011: Applied changes from emailed code review (Closed)
Patch Set: Created Sept. 28, 2012, 12:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
- }
-};
-

Powered by Google App Engine
This is Rietveld