-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBingRebatesAntiClickjack.user.js
40 lines (37 loc) · 1.39 KB
/
BingRebatesAntiClickjack.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// ==UserScript==
// @name Bing Rebates Anti-Clickjack
// @namespace http://github.com/planetarian
// @version 0.2
// @description Removes Bing Rebates jdoqocy.com clickjacking
// @author Chami
// @match https://rewards.bing.com/*
// @match https://www.bing.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @updateURL https://github.com/planetarian/TamperMonkey-Scripts/raw/main/BingRebatesAntiClickjack.user.js
// @downloadURL https://github.com/planetarian/TamperMonkey-Scripts/raw/main/BingRebatesAntiClickjack.user.js
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// Remove Bing Rebates 'Up to X% cash back' text from results
GM_addStyle(".rebateContainer { display: none !important; }");
// Sanitize clickjacked URLs
const srcs = document.links;
for (const src of srcs) {
var url = src.href;
var match = url.match("[?&]murl=(?<murl>[^&]+)");
if (!match) continue;
try {
url = decodeURIComponent(match.groups.murl);
match = url.match("[?&]url=(?<url>[^&]+)");
if (!match) {
console.error("Invalid jdoqocy link: " + url);
continue;
}
src.href = decodeURIComponent(match.groups.url);
}
catch (err) {
console.error(err);
}
}
})();