From 3982e32e4f0a7e250e1553ed49052092a3acdaac Mon Sep 17 00:00:00 2001 From: Geoff Greer Date: Fri, 18 May 2012 23:41:15 -0700 Subject: [PATCH] Much better --- background.js | 26 ++++++++++++++------------ options.html | 8 +++----- options.js | 28 ++++++---------------------- 3 files changed, 23 insertions(+), 39 deletions(-) diff --git a/background.js b/background.js index 336ed49..58194e6 100644 --- a/background.js +++ b/background.js @@ -1,17 +1,19 @@ -var active_urls = []; - function check_url(tab_id, change_info, tab) { - var i; - for (i = 0; i < active_urls.length; i++) { - if(tab.url === active_urls[i]) { - chrome.pageAction.show(tab_id); - break; + var active_urls = JSON.parse(localStorage.urls); + var i; + + chrome.pageAction.hide(tab_id); + + for (i = 0; i < active_urls.length; i++) { + if(tab.url === active_urls[i]) { + chrome.pageAction.show(tab_id); + break; + } + } + + if(tab.url === "https://reach-bb.k1k.me/waterfall") { + chrome.pageAction.show(tab_id); } - } - chrome.pageAction.hide(tab_id); - if(tab.url === "https://reach-bb.k1k.me/waterfall") { - chrome.pageAction.show(tab_id); - } } chrome.tabs.onUpdated.addListener(check_url); diff --git a/options.html b/options.html index c7e1bac..33184b9 100644 --- a/options.html +++ b/options.html @@ -1,12 +1,10 @@ -Options + Options -
- -
- + + diff --git a/options.js b/options.js index f842e7d..cd2d375 100644 --- a/options.js +++ b/options.js @@ -1,36 +1,20 @@ function restore() { var i; - var url_input; - var url_list_node; - var urls = []; + var url_list_node = document.getElementById("url_list"); + var urls; if (localStorage.urls) { urls = JSON.parse(localStorage.urls); } - url_list_node = document.getElementById("url_list"); - - for (i=0; i