diff --git a/clearurls.js b/clearurls.js index 56f39f7..729dfa8 100644 --- a/clearurls.js +++ b/clearurls.js @@ -7,6 +7,8 @@ var data = []; var providers = []; var prvKeys = []; var globalStatus; +var badges = []; +var tabid = 0; /** * Initialize the JSON provider object keys. @@ -124,6 +126,10 @@ function Provider(_name,_completeProvider = false){ rules.push(rule); }; + /** + * Set the rules for the provider + * @param String _rules RegEx as string + */ this.setRules = function(_rules) { rules = _rules; }; @@ -191,6 +197,12 @@ function removeFieldsFormURL(provider, request) if(bevorReplace != url) { + if(badges[tabid] == null) + { + badges[tabid] = 0; + } + + browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid}); changes = true; } } @@ -261,6 +273,30 @@ function clearUrl(request) } }; +/** + * Call by each tab is closed. + */ +function handleRemoved(tabId, removeInfo) { + delete badges[tabId]; +} + +/** + * Call by each tab is closed. + */ +browser.tabs.onRemoved.addListener(handleRemoved); + +/** + * Call by each tab change to set the actual tab id + */ +function handleActivated(activeInfo) { + tabid = activeInfo.tabId; +} + +/** + * Call by each tab change. + */ +browser.tabs.onActivated.addListener(handleActivated); + /** * Call by each Request and checking the url. * diff --git a/manifest.json b/manifest.json index 688d1a6..bb435b9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ClearURLs", - "version": "0.4", + "version": "0.5", "author": "Kevin R., Arne S.", "description": "Remove tracking elements form URLs. ", "homepage_url": "https://github.com/KevinRoebert/ClearUrls", diff --git a/popup.html b/popup.html index 948bbf3..a58101a 100644 --- a/popup.html +++ b/popup.html @@ -2,6 +2,7 @@ ClearURLs Add-on + @@ -9,37 +10,13 @@
-
ClearURLs 0.4
+
ClearURLs 0.5
Enable globally:
-
- Enable individually:
-
- - - -
-
-
-
- My rules (advanced):
-
- ---placeholder---
-
-
- Add new rule:
-
-
-
-
diff --git a/popup_style.css b/popup_style.css index c0934ab..45a0cb3 100644 --- a/popup_style.css +++ b/popup_style.css @@ -1,8 +1,9 @@ body { margin: 0; + top: 0; background: #fff; - min-width: 500px; - max-width: 600px; + min-width: 180px; + max-width: 180px; font-family: "Arial"; } @@ -11,13 +12,8 @@ img { margin: auto; } - - - - #main { - max-width: 500px; - max-height: 400px; + top: 0; overflow-y: auto; overflow-x: hidden; white-space: nowrap; @@ -36,15 +32,12 @@ img { color: #dedede; font-size: 11pt; text-align: center; + top: 0; padding: 2px 0px 2px 0px; margin: 5px 0px 5px 0px; } - - - - -#default::after, #presets::after, .element::after, #rules::after, #addRuleOuter::after, #addRuleInner::after { +#default::after { content: " "; clear: both; display: table; @@ -52,7 +45,6 @@ img { #global { width: 50%; - float: left; } .status { @@ -75,76 +67,6 @@ img { background-image: url("icon128_g.png"); } - - -#individual { - width: 50%; - float: right; -} - -#presets, #rules, #addRuleOuter { - margin: 10px 0px 0px 10px; -} - - - - - -#custom { - margin-top: 20px; - width: 100%; - display: block; - float: left; -} - -#addRuleInner { - margin-top: 5px; -} - -#addRuleField { - overflow: hidden; - float: left; - width: calc(100% - 55px); - height: 25px; - border-radius: 3px; - height: 30px; -} - -#addRuleField input { - width: 100%; - height: 100%; - border: none; - background-color: #d7d6db; - -webkit-transition: .4s; - transition: .4s; - padding-left: 10px; - padding-right: 10px; -} - -#addRuleField input:focus { - background-color: #ccc; - -webkit-transition: .4s; - transition: .4s; -} - -#addRuleBtn { - width: 45px; - padding: 3px 0px 3px 0px; - float: right; - background-color: #b5e61d; - border: none; - border-radius: 3px; - height: 30px; -} - -#addRuleBtn:active { - background-color: #96d160; -} - - - - - .switch { margin-right: 10px; width: 50px; @@ -152,15 +74,4 @@ img { float: left; background: none; border: none; -}/* -.switchEnabled { - background-image: url("switchEnabled.png"); -} -.switchDisabled { - background-image: url("switchDisabled.png"); -}*/ - -.textElement { - clear: right; - text-overflow: ellipsis; } \ No newline at end of file