feat: import code from CWS listing
This is an import from the code as uploaded to the Chrome Web Store in
version 0.1.4.
It also adds a .gitreview file to facilitate uploading the code for
review in Gerrit.
Change-Id: Ib15fdf3b9508b2cc9e49ac0414fcaea3e6441bbb
diff --git a/popup.js b/popup.js
new file mode 100644
index 0000000..39d2579
--- /dev/null
+++ b/popup.js
@@ -0,0 +1,19 @@
+var websites = {"badware": "http://www.google.com/safebrowsing/report_badware/?url=", "webspam": "https://www.google.com/webmasters/tools/spamreportform?spamurl=", "phishing": "http://www.google.com/safebrowsing/report_phish/?url="};
+
+var options = document.querySelectorAll("div#options div.option");
+
+for (var i = 0; i < options.length; i++) {
+ options[i].innerText = chrome.i18n.getMessage("report_"+options[i].id);
+ options[i].onclick = function(a) {
+ var id = this.id;
+ chrome.tabs.query({
+ lastFocusedWindow: true,
+ active: true
+ }, function(tab){
+ chrome.tabs.create({
+ url: websites[id]+encodeURI(tab[0].url),
+ index: tab[0].index + 1
+ });
+ });
+ }
+}