Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10005)

Unified Diff: chrome/test/data/extensions/samples/mappy/mappy_content_script.js

Issue 159763: Rolling back change 22245. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/samples/mappy/mappy_content_script.js
===================================================================
--- chrome/test/data/extensions/samples/mappy/mappy_content_script.js (revision 22246)
+++ chrome/test/data/extensions/samples/mappy/mappy_content_script.js (working copy)
@@ -1,55 +0,0 @@
-// find map on demand
-
-console.log("mappy_content_script.js loaded");
-
-var maps_key = "ABQIAAAATfHumDbW3OmRByfquHd3SRTRERdeAiwZ9EeJWta3L_JZVS0bOBRQeZgr4K0xyVKzUdnnuFl8X9PX0w";
-
-chrome.extension.onConnect.addListener(function(port) {
- //console.log("extension connected");
- port.onMessage.addListener(function(data) {
- //console.log("extension sent message");
- findAddress(port);
- });
-});
-
-var findAddress = function(port) {
- var found;
- var re = /(\d+ [':.,\s\w]*,\s*[A-Za-z]+\s*\d{5}(-\d{4})?)/m;
- var node = document.body;
- var done = false;
- while (!done) {
- done = true;
- for (var i = 0; i < node.childNodes.length; ++i) {
- var child = node.childNodes[i];
- if (child.textContent.match(re)) {
- node = child;
- found = node;
- done = false;
- break;
- }
- }
- }
- if (found) {
- var text = "";
- if (found.childNodes.length) {
- for (var i = 0; i < found.childNodes.length; ++i) {
- text += found.childNodes[i].textContent + " ";
- }
- } else {
- text = found.textContent;
- }
- var match = re.exec(text);
- if (match && match.length) {
- console.log("found: " + match[0]);
- var trim = /\s{2,}/g;
- var map = match[0].replace(trim, " ");
- port.postMessage({message:"map", values:[map]});
- } else {
- console.log("found bad " + found.textContent);
- console.log("no match in: " + text);
- }
- } else {
- console.log("no match in " + node.textContent);
- }
-}
-

Powered by Google App Engine
This is Rietveld 408576698