-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathantimessaggero.js
104 lines (96 loc) · 2.66 KB
/
antimessaggero.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
setTimeout(function () {
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", main);
} else {
main()
}
}, 100);
function main () {
removePaywall();
unlockArticle();
closeVideoPopUp();
removeBlurFilter();
removeExcessSpacing();
uncoverBodyText();
removeStickyPromo();
}
function removePaywall () {
setTimeout(function () {
document.body.style.overflow = "scroll";
let paywallElement = $('#datawall');
if (paywallElement.length > 0) {
paywallElement[0].remove();
window.scrollTo(0, 0);
} else {
removePaywall();
}
}, 100);
}
function unlockArticle () {
setTimeout(function () {
document.body.style.overflow = "scroll";
let layoverElement = document.body.getElementsByClassName("modal");
if (layoverElement.length > 0) {
layoverElement[0].remove();
let correlatiElem = $('#correlati');
if (correlatiElem.length > 0) {
correlatiElem[0].style.display = "none";
}
} else {
let paywallStripe = $('#paywall_strip');
if (paywallStripe.length > 0) {
paywallStripe[0].remove();
}
else {
unlockArticle();
}
let paywallWrapper = $('#paywall_wrapper');
if (paywallWrapper.length > 0) {
paywallWrapper[0].remove();
} else {
unlockArticle();
}
}
}, 100);
}
function closeVideoPopUp () {
let popUpVideo = $('.floatingVideo');
setTimeout(function () {
if (popUpVideo.length > 0) {
popUpVideo[0].click();
} else {
closeVideoPopUp()
}
}, 100);
}
function removeBlurFilter () {
$('.wrapper .contenuto .body-text > :not(.adv_banner)').css("filter", "unset")
}
function removeExcessSpacing () {
let elems = document.body.getElementsByClassName("inread_adv");
if (elems.length > 0) {
for (let elem of elems) {
elem.parentNode.removeChild(elem)
}
}
}
function uncoverBodyText () {
let elem = document.body.getElementsByClassName("body-text")[0];
setTimeout(function () {
if (elem.style.length === 3) {
elem.style = null
} else {
uncoverBodyText();
}
}, 100);
}
function removeStickyPromo () {
let stickyPromo = $('#mp_strip_sticky');
setTimeout(function () {
if (stickyPromo.length > 0) {
stickyPromo[0].remove();
} else {
removeStickyPromo();
}
}, 100);
}