diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d1a815..9c490b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.8.4] - 2019-09-26
+
+### Compatibility note
+- Require Firefox >= 55
+- Require Chrome >= 22
+
+## Changed
+- Force redirects only on main frames
+- Added google link fix script, to avoid the sub frame permission for force redirection on google
+
## [1.8.3] - 2019-09-23
### Compatibility note
diff --git a/GitLabPages/index.html b/GitLabPages/index.html
index 6a75f0c..6d8c21d 100644
--- a/GitLabPages/index.html
+++ b/GitLabPages/index.html
@@ -39,13 +39,16 @@
+ height="1" width="1" id="void_roebert_eu_iframe" style="border:0; border:none;">
+ height="1" width="1" id="redirect_roebert_eu_iframe" style="border:0; border:none;">
-
-
+
+
+
+
diff --git a/clearurls.js b/clearurls.js
index cdb4f98..8d28ff5 100644
--- a/clearurls.js
+++ b/clearurls.js
@@ -630,148 +630,147 @@ function start()
* Expand urls and bypass tracking.
* Cancel the active request.
*/
- if(result.redirect &&
- (request.type === 'main_frame' ||
- request.type === 'sub_frame'))
- {
- if(providers[i].shouldForceRedirect() ) {
- browser.tabs.update(request.tabId, {url: result.url});
- return {cancel: true};
- }
-
- return {
- redirectUrl: result.url
- };
+ if(result.redirect)
+ {
+ if(providers[i].shouldForceRedirect() &&
+ request.type === 'main_frame') {
+ browser.tabs.update(request.tabId, {url: result.url});
+ return {cancel: true};
}
- /*
- * Cancel the Request and redirect to the site blocked alert page,
- * to inform the user about the full url blocking.
- */
- if(result.cancel){
- return {
- redirectUrl: siteBlockedAlert
- };
- }
+ return {
+ redirectUrl: result.url
+ };
+ }
- /*
- * Ensure that the function go not into
- * a loop.
- */
- if(result.changes){
- return {
- redirectUrl: result.url
- };
- }
+ /*
+ * Cancel the Request and redirect to the site blocked alert page,
+ * to inform the user about the full url blocking.
+ */
+ if(result.cancel){
+ return {
+ redirectUrl: siteBlockedAlert
+ };
+ }
+
+ /*
+ * Ensure that the function go not into
+ * a loop.
+ */
+ if(result.changes){
+ return {
+ redirectUrl: result.url
+ };
}
}
-
- // Default case
- return {};
}
- /**
- * Call loadOldDataFromStore, getHash, counter, status and log functions
- */
-
- loadOldDataFromStore();
- getHash();
- setBadgedStatus();
-
- /**
- * Call by each tab is updated.
- * And if url has changed.
- */
- function handleUpdated(tabId, changeInfo, tabInfo) {
- if(changeInfo.url)
- {
- delete badges[tabId];
- }
- currentURL = tabInfo.url;
- }
-
- /**
- * Call by each tab is updated.
- */
- browser.tabs.onUpdated.addListener(handleUpdated);
-
- /**
- * Call by each tab change to set the actual tab id
- */
- function handleActivated(activeInfo) {
- tabid = activeInfo.tabId;
- browser.tabs.get(tabid).then(function (tab) {
- currentURL = tab.url;
- });
- }
-
- /**
- * Call by each tab change.
- */
- browser.tabs.onActivated.addListener(handleActivated);
-
- /**
- * Check the request.
- */
- function promise(requestDetails)
- {
- if(isDataURL(requestDetails))
- {
- return {};
- }
- else {
- var ret = clearUrl(requestDetails);
- return ret;
- }
- }
-
- /**
- * To prevent long loading on data urls
- * we will check here for data urls.
- *
- * @type {requestDetails}
- * @return {boolean}
- */
- function isDataURL(requestDetails) {
- var s = requestDetails.url;
-
- return s.substring(0,4) == "data";
- }
-
- /**
- * Call by each Request and checking the url.
- *
- * @type {Array}
- */
- browser.webRequest.onBeforeRequest.addListener(
- promise,
- {urls: [""], types: getData("types")},
- ["blocking"]
- );
+ // Default case
+ return {};
}
/**
- * Function to log all activities from ClearUrls.
- * Only logging when activated.
- * The log is only temporary saved in the cache and will
- * permanently saved with the saveLogOnClose function.
- *
- * @param beforeProcessing the url before the clear process
- * @param afterProcessing the url after the clear process
- * @param rule the rule that triggered the process
+ * Call loadOldDataFromStore, getHash, counter, status and log functions
*/
- function pushToLog(beforeProcessing, afterProcessing, rule)
- {
- if(storage.loggingStatus)
+
+ loadOldDataFromStore();
+ getHash();
+ setBadgedStatus();
+
+ /**
+ * Call by each tab is updated.
+ * And if url has changed.
+ */
+ function handleUpdated(tabId, changeInfo, tabInfo) {
+ if(changeInfo.url)
{
- storage.log.log.push(
- {
- "before": beforeProcessing,
- "after": afterProcessing,
- "rule": rule,
- "timestamp": Date.now()
- }
- );
- deferSaveOnDisk('log');
+ delete badges[tabId];
+ }
+ currentURL = tabInfo.url;
+ }
+
+ /**
+ * Call by each tab is updated.
+ */
+ browser.tabs.onUpdated.addListener(handleUpdated);
+
+ /**
+ * Call by each tab change to set the actual tab id
+ */
+ function handleActivated(activeInfo) {
+ tabid = activeInfo.tabId;
+ browser.tabs.get(tabid).then(function (tab) {
+ currentURL = tab.url;
+ });
+ }
+
+ /**
+ * Call by each tab change.
+ */
+ browser.tabs.onActivated.addListener(handleActivated);
+
+ /**
+ * Check the request.
+ */
+ function promise(requestDetails)
+ {
+ if(isDataURL(requestDetails))
+ {
+ return {};
+ }
+ else {
+ var ret = clearUrl(requestDetails);
+ return ret;
}
}
+
+ /**
+ * To prevent long loading on data urls
+ * we will check here for data urls.
+ *
+ * @type {requestDetails}
+ * @return {boolean}
+ */
+ function isDataURL(requestDetails) {
+ var s = requestDetails.url;
+
+ return s.substring(0,4) == "data";
+ }
+
+ /**
+ * Call by each Request and checking the url.
+ *
+ * @type {Array}
+ */
+ browser.webRequest.onBeforeRequest.addListener(
+ promise,
+ {urls: [""], types: getData("types")},
+ ["blocking"]
+ );
+ }
+
+ /**
+ * Function to log all activities from ClearUrls.
+ * Only logging when activated.
+ * The log is only temporary saved in the cache and will
+ * permanently saved with the saveLogOnClose function.
+ *
+ * @param beforeProcessing the url before the clear process
+ * @param afterProcessing the url after the clear process
+ * @param rule the rule that triggered the process
+ */
+ function pushToLog(beforeProcessing, afterProcessing, rule)
+ {
+ if(storage.loggingStatus)
+ {
+ storage.log.log.push(
+ {
+ "before": beforeProcessing,
+ "after": afterProcessing,
+ "rule": rule,
+ "timestamp": Date.now()
+ }
+ );
+ deferSaveOnDisk('log');
+ }
+ }
diff --git a/core_js/google_link_fix.js b/core_js/google_link_fix.js
new file mode 100644
index 0000000..823943c
--- /dev/null
+++ b/core_js/google_link_fix.js
@@ -0,0 +1,76 @@
+/*
+* ClearURLs
+* Copyright (c) 2017-2019 Kevin Röbert
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see .
+*
+* Based on:
+* Remove Google Redirection
+* https://github.com/kodango/Remove-Google-Redirection/blob/master/extension/chrome/remove-google-redirection.user.js
+* Copyright (c) 2017 kodango
+* MIT License: https://github.com/kodango/Remove-Google-Redirection/blob/master/LICENSE
+*/
+(function (window) {
+ "use strict";
+
+ function injectFunction(func) {
+ var ele = document.createElement('script');
+ var s = document.getElementsByTagName('script')[0];
+
+ ele.type = 'text/javascript';
+ ele.textContent = '(' + func + ')();';
+
+ s.parentNode.insertBefore(ele, s);
+ }
+
+ /*
+ * Disable the url rewrite function
+ */
+ function disableURLRewrite() {
+ function inject_init() {
+ /* Define the url rewrite function */
+ Object.defineProperty(window, 'rwt', {
+ value: function() { return true; },
+ writable: false, // set the property to read-only
+ configurable: false
+ });
+ }
+
+ injectFunction(inject_init);
+ }
+
+ /*
+ * The main entry
+ */
+ function main()
+ {
+ disableURLRewrite();
+
+ document.addEventListener('mouseover', function (event) {
+ var a = event.target, depth = 1;
+
+ while (a && a.tagName != 'A' && depth-- > 0) {
+ a = a.parentNode;
+ }
+
+ if (a && a.tagName == 'A') {
+ a.removeAttribute('onmousedown');
+ var clone = a.cloneNode(true);
+ a.parentNode.replaceChild(clone, a);
+ }
+ }, true);
+ }
+
+ main();
+})(window);
diff --git a/manifest.json b/manifest.json
index 1dd6c71..ab7a4d6 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "ClearURLs",
- "version": "1.8.3",
+ "version": "1.8.4",
"author": "Kevin Röbert",
"description": "Remove tracking elements from URLs.",
"homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",
@@ -59,9 +59,9 @@
"browser-polyfill.js",
"external_js/jquery-3.2.1.min.js",
"external_js/sha256.jquery.js",
- "core_js/message_handler.js",
- "core_js/tools.js",
- "core_js/storage.js",
+ "core_js/message_handler.js",
+ "core_js/tools.js",
+ "core_js/storage.js",
"clearurls.js",
"core_js/pureCleaning.js",
"core_js/context_menu.js",
@@ -75,9 +75,111 @@
"js": [
"browser-polyfill.js"
]
+ },
+ {
+ "all_frames": true,
+ "matches": ["*://*.google.com/*", "*://*.google.ad/*",
+ "*://*.google.ae/*", "*://*.google.com.af/*",
+ "*://*.google.com.ag/*", "*://*.google.com.ai/*",
+ "*://*.google.al/*", "*://*.google.am/*",
+ "*://*.google.co.ao/*", "*://*.google.com.ar/*",
+ "*://*.google.as/*", "*://*.google.at/*",
+ "*://*.google.com.au/*", "*://*.google.az/*",
+ "*://*.google.ba/*", "*://*.google.com.bd/*",
+ "*://*.google.be/*", "*://*.google.bf/*",
+ "*://*.google.bg/*", "*://*.google.com.bh/*",
+ "*://*.google.bi/*", "*://*.google.bj/*",
+ "*://*.google.com.bn/*", "*://*.google.com.bo/*",
+ "*://*.google.com.br/*", "*://*.google.bs/*",
+ "*://*.google.bt/*", "*://*.google.co.bw/*",
+ "*://*.google.by/*", "*://*.google.com.bz/*",
+ "*://*.google.ca/*", "*://*.google.cd/*",
+ "*://*.google.cf/*", "*://*.google.cg/*",
+ "*://*.google.ch/*", "*://*.google.ci/*",
+ "*://*.google.co.ck/*", "*://*.google.cl/*",
+ "*://*.google.cm/*", "*://*.google.cn/*",
+ "*://*.google.com.co/*", "*://*.google.co.cr/*",
+ "*://*.google.com.cu/*", "*://*.google.cv/*",
+ "*://*.google.com.cy/*", "*://*.google.cz/*",
+ "*://*.google.de/*", "*://*.google.dj/*",
+ "*://*.google.dk/*", "*://*.google.dm/*",
+ "*://*.google.com.do/*", "*://*.google.dz/*",
+ "*://*.google.com.ec/*", "*://*.google.ee/*",
+ "*://*.google.com.eg/*", "*://*.google.es/*",
+ "*://*.google.com.et/*", "*://*.google.fi/*",
+ "*://*.google.com.fj/*", "*://*.google.fm/*",
+ "*://*.google.fr/*", "*://*.google.ga/*",
+ "*://*.google.ge/*", "*://*.google.gg/*",
+ "*://*.google.com.gh/*", "*://*.google.com.gi/*",
+ "*://*.google.gl/*", "*://*.google.gm/*",
+ "*://*.google.gp/*", "*://*.google.gr/*",
+ "*://*.google.com.gt/*", "*://*.google.gy/*",
+ "*://*.google.com.hk/*", "*://*.google.hn/*",
+ "*://*.google.hr/*", "*://*.google.ht/*",
+ "*://*.google.hu/*", "*://*.google.co.id/*",
+ "*://*.google.ie/*", "*://*.google.co.il/*",
+ "*://*.google.im/*", "*://*.google.co.in/*",
+ "*://*.google.iq/*", "*://*.google.is/*", "*://*.google.it/*",
+ "*://*.google.je/*", "*://*.google.com.jm/*",
+ "*://*.google.jo/*", "*://*.google.co.jp/*",
+ "*://*.google.co.ke/*", "*://*.google.com.kh/*",
+ "*://*.google.ki/*", "*://*.google.kg/*",
+ "*://*.google.co.kr/*", "*://*.google.com.kw/*",
+ "*://*.google.kz/*", "*://*.google.la/*",
+ "*://*.google.com.lb/*", "*://*.google.li/*",
+ "*://*.google.lk/*", "*://*.google.co.ls/*",
+ "*://*.google.lt/*", "*://*.google.lu/*", "*://*.google.lv/*",
+ "*://*.google.com.ly/*", "*://*.google.co.ma/*",
+ "*://*.google.md/*", "*://*.google.me/*", "*://*.google.mg/*",
+ "*://*.google.mk/*", "*://*.google.ml/*",
+ "*://*.google.com.mm/*", "*://*.google.mn/*",
+ "*://*.google.ms/*", "*://*.google.com.mt/*",
+ "*://*.google.mu/*", "*://*.google.mv/*", "*://*.google.mw/*",
+ "*://*.google.com.mx/*", "*://*.google.com.my/*",
+ "*://*.google.co.mz/*", "*://*.google.com.na/*",
+ "*://*.google.com.nf/*", "*://*.google.com.ng/*",
+ "*://*.google.com.ni/*", "*://*.google.ne/*",
+ "*://*.google.nl/*", "*://*.google.no/*",
+ "*://*.google.com.np/*", "*://*.google.nr/*",
+ "*://*.google.nu/*", "*://*.google.co.nz/*",
+ "*://*.google.com.om/*", "*://*.google.com.pa/*",
+ "*://*.google.com.pe/*", "*://*.google.com.pg/*",
+ "*://*.google.com.ph/*", "*://*.google.com.pk/*",
+ "*://*.google.pl/*", "*://*.google.pn/*",
+ "*://*.google.com.pr/*", "*://*.google.ps/*",
+ "*://*.google.pt/*", "*://*.google.com.py/*",
+ "*://*.google.com.qa/*", "*://*.google.ro/*",
+ "*://*.google.ru/*", "*://*.google.rw/*",
+ "*://*.google.com.sa/*", "*://*.google.com.sb/*",
+ "*://*.google.sc/*", "*://*.google.se/*",
+ "*://*.google.com.sg/*", "*://*.google.sh/*",
+ "*://*.google.si/*", "*://*.google.sk/*",
+ "*://*.google.com.sl/*", "*://*.google.sn/*",
+ "*://*.google.so/*", "*://*.google.sm/*",
+ "*://*.google.sr/*", "*://*.google.st/*",
+ "*://*.google.com.sv/*", "*://*.google.td/*",
+ "*://*.google.tg/*", "*://*.google.co.th/*",
+ "*://*.google.com.tj/*", "*://*.google.tk/*",
+ "*://*.google.tl/*", "*://*.google.tm/*",
+ "*://*.google.tn/*", "*://*.google.to/*",
+ "*://*.google.com.tr/*", "*://*.google.tt/*",
+ "*://*.google.com.tw/*", "*://*.google.co.tz/*",
+ "*://*.google.com.ua/*", "*://*.google.co.ug/*",
+ "*://*.google.co.uk/*", "*://*.google.com.uy/*",
+ "*://*.google.co.uz/*", "*://*.google.com.vc/*",
+ "*://*.google.co.ve/*", "*://*.google.vg/*",
+ "*://*.google.co.vi/*", "*://*.google.com.vn/*",
+ "*://*.google.vu/*", "*://*.google.ws/*",
+ "*://*.google.rs/*", "*://*.google.co.za/*",
+ "*://*.google.co.zm/*", "*://*.google.co.zw/*",
+ "*://*.google.cat/*"],
+ "js": [
+ "core_js/google_link_fix.js"
+ ],
+ "run_at": "document_end"
+ }
+ ],
+ "options_ui": {
+ "page": "html/settings.html"
}
- ],
- "options_ui": {
- "page": "html/settings.html"
}
-}