-
Notifications
You must be signed in to change notification settings - Fork 9
/
scriptlets.js
122 lines (109 loc) · 2.65 KB
/
scriptlets.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
///my personal scriptlets - not maintained
/// this is from https://github.com/uBlock-user/uBO-Scriptlets/commit/3d1f48573749ac85b20031f78e0d5f7c7bb0f3af#
/// cookie-set.js
/// alias cs.js
// example.com##+js(cs, name, value, age)
(() => {
console.log("Running...")
'use strict';
const cs = ev => {
if (ev) { window.removeEventListener(ev.type, cs, true); }
try {
document.cookie = '{{1}}={{2}}; max-age={{3}}; secure; path=/;';
} catch { }
};
if (document.readyState === 'loading') {
window.addEventListener('DOMContentLoaded', cs, true);
} else {
cs();
}
})();
/// console-log.js
/// alias clog.js
// example.com##+js(clog, data)
(() => {
'use strict';
console.log("{{1}}")
})();
/// unload-diffuser.js
/// alias noul.js
/// example.com##+js(unload-diffuser)
(() => {
'use strict';
window.onbeforeunload = null
try{
Object.defineProperity(window,"onbeforeunload",{value:null,writable:false})
}
catch(err){
console.log(err)
}
})();
/// redirect-to-localhost.js
/// alias redirectlocal.js
/// example.com##+js(redirectlocal)
(() => {
'use strict';
try{
window.stop()
}
catch(err){
}
location.href = "http://localhost"
})();
/// throw-if.js
/// alias towif.js
/// example.com##+js(throw-if,badfunc,badvalue)
/*(() => {
'use strict';
var funcName = "{{1}}"
var arg = "{{2}}"
console.log(funcName)
var func = window[funcName]
window[funcName] = function(fArg){
if(fArg === arg){
throw new Error(Math.round(Math.random()*9000000))
}
else{
window.setTimeout(func,0,fArg)
}
}
})();*/
///https://github.com/NanoAdblocker/NanoFilters/blob/master/NanoFilters/NanoResources.txt#L307
/// click-element.js
/// alias clickelm.js
/// example.com##+js(clickelem,#badbutton)
(() => {
var selector = '{{1}}';
if ( selector === '' || selector === '{{1}}' ) {
return;
}
var click = function() {
var elements = document.querySelectorAll(selector);
for ( var element of elements ) {
element.click();
}
};
if ( document.readyState === 'complete' ) {
click();
} else {
addEventListener('load', click);
}
})();
/// derstandard-cookie-defuse.js
/// alias derstandard-c.js
/// derstandard.de##+js(derstandard-cookie-defuse)
(() => {
var selector = '{{1}}';
var click = function() {
var frame = document.getElementById("sp_message_iframe_485649").src
var u = new URL(frame)
u.searchParams.forEach(function(value,name){
document.cookie = name + "=" + value
})
};
if ( document.readyState === 'complete' ) {
click();
} else {
addEventListener('load', click);
}
})();