From 8806e8d876454d21e88645bca9156083b0562387 Mon Sep 17 00:00:00 2001 From: Sriram Hariharan Date: Sat, 7 Jul 2018 16:57:23 -0500 Subject: [PATCH] cleaned up some code --- background.js | 35 +++++++++++++++-------------------- content.js | 33 ++++++++++++++++----------------- icons/icon128.png | Bin 0 -> 18991 bytes icons/icon16.png | Bin 0 -> 17606 bytes icons/icon32.png | Bin 0 -> 18405 bytes icons/icon48.png | Bin 0 -> 17118 bytes manifest.json | 28 ++++++++++++++++++++++------ popup.html | 15 +++++++++++++++ 8 files changed, 68 insertions(+), 43 deletions(-) create mode 100644 icons/icon128.png create mode 100644 icons/icon16.png create mode 100644 icons/icon32.png create mode 100644 icons/icon48.png create mode 100644 popup.html diff --git a/background.js b/background.js index 082ad879..015b8d35 100644 --- a/background.js +++ b/background.js @@ -1,24 +1,19 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) { - -chrome.runtime.onMessage.addListener( -function (request, sender, sendResponse) { - console.log(sender.tab ? - "from a content script:" + sender.tab.url : - "from the extension"); - if (request.greeting == "hello") - sendResponse({ farewell: "goodbye" }); -}); - const xhr = new XMLHttpRequest(); - const method = request.method ? request.method.toUpperCase() : "GET"; - xhr.open(method, request.url, true); - xhr.onload = () => response(xhr.responseText); - xhr.onerror = () => response(xhr.statusText); - if (method == "POST") { - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - } - xhr.send(request.data); - return true; + const xhr = new XMLHttpRequest(); + const method = request.method ? request.method.toUpperCase() : "GET"; + xhr.open(method, request.url, true); + xhr.onload = () => response(xhr.responseText); + xhr.onerror = () => response(xhr.statusText); + if (method == "POST") { + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + } + xhr.send(request.data); + return true; }); - +chrome.runtime.onInstalled.addListener(function() { + chrome.storage.sync.set({color: '#3aa757'}, function() { + console.log("The color is green."); + }); +}); diff --git a/content.js b/content.js index 2c6a3356..aef6cc42 100644 --- a/content.js +++ b/content.js @@ -11,7 +11,7 @@ var description; $(document).ready( function() { loadDataBase(); //make heading - $("table thead th:nth-child(8)").after('Dist'); + $("table thead th:nth-child(9)").after('Dist'); var modhtml = '