forked from hant0508-zz/usescripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNNM Club and Rustorka ad remover.user.js
58 lines (50 loc) · 1.95 KB
/
NNM Club and Rustorka ad remover.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// ==UserScript==
// @name NNM Club and Rustorka ad remover
// @namespace http://tampermonkey.net/
// @version 1.0.4
// @description Removes ad banners by marketgid/tovarro on nnmclub.to and rustorka.com (use with Ublock Origin or Adblock Plus)
// @author hant0508
// @include /^https?://nnmclub.to/*/
// @include /^https?://nnm-club.to/*/
// @include /^https?://nnm-club.me/*/
// @include /^https?://nnm-club.name/*/
// @include /^https?://rustorka.com/*/
// @grant none
// ==/UserScript==
var tries = 0;
var snapResults = [];
function rem()
{
for (var i = 0; i < snapResults.length; i++)
for (var k = snapResults[i].snapshotLength - 1; k >= 0; k--)
{
var elm = snapResults[i].snapshotItem(k);
elm.parentNode.removeChild(elm);
}
}
function xpath()
{
var time;
// var regex1 = "/html/body//div[@id!=\"body_container\" and ./div/div/div/div/a[contains(@href, 'marketgid') or contains(@href, 'tovarro')]]";
// var regex2 = "/html/body/*[1 and .//a[contains(@href, 'bgrndi.com') or contains(@href, 'traforet.com')]]";
// var regex3 = "/html/body//div[@id=\"page_container\"]/div//opan[a]";
var regex1 = "/html/body//div[@class=\"copyright\"]//iframe";
var regex2 = "/html/body//div[@class=\"wrap\"]//td/center/noindex/iframe";
var regex4 = "/html/body//div[@id=\"sidebar1-wrap\"]/iframe";
var regex5 = "/html/body//div[@class=\"post_body\"]//table//div/iframe";
var regex = [regex1, regex2, regex4, regex5];
for (var i = 0; i < regex.length; i++)
snapResults[i] = document.evaluate(regex[i], document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if (tries <= 100) time = 200;
else time = 1000;
window.setTimeout (xpath,time);
for (var i = 0; i < snapResults.length; i++)
if (snapResults[i].snapshotLength)
{
tries = 0;
break;
}
tries++;
rem();
}
xpath();