From 0f68d65e9a29c1f2ea87644c8f80703b96b4beaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Sat, 16 Dec 2017 23:50:50 +0100 Subject: [PATCH] New Addon version 1.2 + Badges counts only per url (for this feature we need the new "tabs" permission) + New Interface. Special thanks to @grahamperrin and @Thorin-Oakenpants. (#21) + Files in folder ordered - Remove siteBlockedAlert.html page. We're show now nothing. + Revised texts for Rules-Status + Add File for version number --- clearurls.js | 36 ++--- log.js => core_js/log.js | 0 popup_new.js => core_js/popup_new.js | 2 +- core_js/write_version.js | 6 + bootstrap.min.css => css/bootstrap.min.css | 0 css/core.css | 16 +++ .../dataTables.bootstrap.min.css | 0 switchButtons.css => css/switchButtons.css | 6 +- .../bootstrap.min.js | 0 .../dataTables.bootstrap.min.js | 0 external_js/desktop.ini | 6 + .../jquery-3.2.1.min.js | 0 .../jquery.dataTables.min.js | 0 .../sha256.jquery.js | 0 log.html => html/log.html | 40 +++--- html/popup.html | 134 ++++++++++++++++++ .../siteBlockedAlert.html | 8 +- icon128.png => img/icon128.png | Bin icon19.png => img/icon19.png | Bin icon32.png => img/icon32.png | Bin icon38.png => img/icon38.png | Bin icon48.png => img/icon48.png | Bin icon512.png => img/icon512.png | Bin icon64.png => img/icon64.png | Bin icon96.png => img/icon96.png | Bin .../img-noise-361x370.png | Bin manifest.json | 29 ++-- popup_new.html | 92 ------------ .../interface_structure_v_1.2.png | Bin 0 -> 40406 bytes 29 files changed, 225 insertions(+), 150 deletions(-) rename log.js => core_js/log.js (100%) rename popup_new.js => core_js/popup_new.js (98%) create mode 100644 core_js/write_version.js rename bootstrap.min.css => css/bootstrap.min.css (100%) create mode 100644 css/core.css rename dataTables.bootstrap.min.css => css/dataTables.bootstrap.min.css (100%) rename switchButtons.css => css/switchButtons.css (96%) rename bootstrap.min.js => external_js/bootstrap.min.js (100%) rename dataTables.bootstrap.min.js => external_js/dataTables.bootstrap.min.js (100%) create mode 100644 external_js/desktop.ini rename jquery-3.2.1.min.js => external_js/jquery-3.2.1.min.js (100%) rename jquery.dataTables.min.js => external_js/jquery.dataTables.min.js (100%) rename sha256.jquery.js => external_js/sha256.jquery.js (100%) rename log.html => html/log.html (59%) create mode 100644 html/popup.html rename siteBlockedAlert.html => html/siteBlockedAlert.html (86%) rename icon128.png => img/icon128.png (100%) rename icon19.png => img/icon19.png (100%) rename icon32.png => img/icon32.png (100%) rename icon38.png => img/icon38.png (100%) rename icon48.png => img/icon48.png (100%) rename icon512.png => img/icon512.png (100%) rename icon64.png => img/icon64.png (100%) rename icon96.png => img/icon96.png (100%) rename img-noise-361x370.png => img/img-noise-361x370.png (100%) delete mode 100644 popup_new.html create mode 100644 promotion/wiki_screens/interface_structure_v_1.2.png diff --git a/clearurls.js b/clearurls.js index f201043..4cdbe39 100644 --- a/clearurls.js +++ b/clearurls.js @@ -14,7 +14,7 @@ var badgedStatus; var tabid = 0; var globalCounter; var globalurlcounter; -var siteBlockedAlert = browser.extension.getURL('./siteBlockedAlert.html'); +var siteBlockedAlert = browser.extension.getURL('./'); var dataHash; var localDataHash; @@ -98,20 +98,20 @@ function loadOldDataFromStore() /** * Save the hash status to the local storage. * The status can have the following values: - * 1 "unchanged" - * 2 "authorized, changed" - * 3 "unauthorized, changed" + * 1 "up to date" + * 2 "updated" + * 3 "update available" * @param status_code the number for the status */ function storeHashStatus(status_code) { switch(status_code) { - case 1: status_code = "unchanged"; + case 1: status_code = "up to date"; break; - case 2: status_code = "authorized, changed"; + case 2: status_code = "updated"; break; - case 3: status_code = "unauthorized, changed"; + case 3: status_code = "update available"; break; default: status_code = "error"; } @@ -619,13 +619,6 @@ function getLoggingStatus() browser.windows.onRemoved.addListener(saveLog); browser.tabs.onCreated.addListener(saveLog); -/** -* Call by each tab is closed. -*/ -function handleRemoved(tabId, removeInfo) { - delete badges[tabId]; -} - /** * Function that calls some function on storage change. */ @@ -672,9 +665,20 @@ getLogOnStart(); browser.storage.onChanged.addListener(reactToStorageChange); /** -* Call by each tab is closed. +* Call by each tab is updated. +* And if url has changed. */ -browser.tabs.onRemoved.addListener(handleRemoved); +function handleUpdated(tabId, changeInfo, tabInfo) { + if(changeInfo.url) + { + delete badges[tabId]; + } +} + +/** +* Call by each tab is updated. +*/ +browser.tabs.onUpdated.addListener(handleUpdated); /** * Call by each tab change to set the actual tab id diff --git a/log.js b/core_js/log.js similarity index 100% rename from log.js rename to core_js/log.js diff --git a/popup_new.js b/core_js/popup_new.js similarity index 98% rename from popup_new.js rename to core_js/popup_new.js index f207465..32a92f7 100644 --- a/popup_new.js +++ b/core_js/popup_new.js @@ -183,7 +183,7 @@ $(document).ready(function(){ $('#reset_counter_btn').on("click", resetGlobalCounter); $('#tabcounter').on('change', changeTabcounter); $('#logging').on('change', changeLogging); - $('#loggingPage').attr('href', browser.extension.getURL('./log.html')); + $('#loggingPage').attr('href', browser.extension.getURL('./html/log.html')); browser.storage.onChanged.addListener(changeStatistics); }); diff --git a/core_js/write_version.js b/core_js/write_version.js new file mode 100644 index 0000000..3d8f894 --- /dev/null +++ b/core_js/write_version.js @@ -0,0 +1,6 @@ +/** + * This file writes only the version into every page. + * @return version + */ +var version = "1.2"; +$('#version').text(version); diff --git a/bootstrap.min.css b/css/bootstrap.min.css similarity index 100% rename from bootstrap.min.css rename to css/bootstrap.min.css diff --git a/css/core.css b/css/core.css new file mode 100644 index 0000000..a73fc80 --- /dev/null +++ b/css/core.css @@ -0,0 +1,16 @@ +body { + font-size: 13px; +} + +.small-version { + font-size: 10px; +} + +.navbar-header { + margin-top: 0; + margin-bottom: 8px; +} + +.col-sm-1 { + margin-top: -10px; +} diff --git a/dataTables.bootstrap.min.css b/css/dataTables.bootstrap.min.css similarity index 100% rename from dataTables.bootstrap.min.css rename to css/dataTables.bootstrap.min.css diff --git a/switchButtons.css b/css/switchButtons.css similarity index 96% rename from switchButtons.css rename to css/switchButtons.css index 2c21c96..ac6c5fa 100644 --- a/switchButtons.css +++ b/css/switchButtons.css @@ -64,4 +64,8 @@ input:checked + .slider:before { .switch label { position: absolute; left: 60px; -} \ No newline at end of file +} + +label { + font-weight: normal; +} diff --git a/bootstrap.min.js b/external_js/bootstrap.min.js similarity index 100% rename from bootstrap.min.js rename to external_js/bootstrap.min.js diff --git a/dataTables.bootstrap.min.js b/external_js/dataTables.bootstrap.min.js similarity index 100% rename from dataTables.bootstrap.min.js rename to external_js/dataTables.bootstrap.min.js diff --git a/external_js/desktop.ini b/external_js/desktop.ini new file mode 100644 index 0000000..6e81bd2 --- /dev/null +++ b/external_js/desktop.ini @@ -0,0 +1,6 @@ +[LocalizedFileNames] +sha256.jquery.js=@sha256.jquery.js,0 +jquery.dataTables.min.js=@jquery.dataTables.min.js,0 +dataTables.bootstrap.min.js=@dataTables.bootstrap.min.js,0 +bootstrap.min.js=@bootstrap.min.js,0 +jquery-3.2.1.min.js=@jquery-3.2.1.min.js,0 diff --git a/jquery-3.2.1.min.js b/external_js/jquery-3.2.1.min.js similarity index 100% rename from jquery-3.2.1.min.js rename to external_js/jquery-3.2.1.min.js diff --git a/jquery.dataTables.min.js b/external_js/jquery.dataTables.min.js similarity index 100% rename from jquery.dataTables.min.js rename to external_js/jquery.dataTables.min.js diff --git a/sha256.jquery.js b/external_js/sha256.jquery.js similarity index 100% rename from sha256.jquery.js rename to external_js/sha256.jquery.js diff --git a/log.html b/html/log.html similarity index 59% rename from log.html rename to html/log.html index 96c0e23..aa37927 100644 --- a/log.html +++ b/html/log.html @@ -7,8 +7,9 @@ - - + + +