-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
studocu_bypassPreview.js
132 lines (126 loc) · 4.75 KB
/
studocu_bypassPreview.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
122
123
124
125
126
127
128
129
130
131
132
export default {
icon: "https://d20ohkaloyme4g.cloudfront.net/img/favicon.ico",
name: {
en: "Studocu - Bypass preview",
vi: "Studocu - Xem miễn phí VIP",
},
description: {
en: "View VIP document on Studocu.com, bypass preview popup / reveal blurred content.",
vi: "Xem tài liệu VIP trên Studocu.com, loại bỏ popup chặn xem trước, loại bỏ hiệu ứng làm mờ.",
},
whiteList: ["https://www.studocu.com/*", "https://studeersnel.nl/*"],
// https://github.com/lambwheit/Studocu-Paywall-Bypass
onDocumentStart: async () => {
// ==UserScript==
// @name Bypass studocu paywall
// @namespace http://tampermonkey.net/
// @version 1.21
// @description try to take over the world!
// @author https://github.com/lambwheit
// @match https://studeersnel.nl/*
// @match https://www.studocu.com/*
// @icon https://www.google.com/s2/favicons?domain=studocu.com
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName("head")[0];
if (!head) {
return;
}
style = document.createElement("style");
style.type = "text/css";
style.innerHTML = css;
head.appendChild(style);
}
(function () {
"use strict";
addGlobalStyle(".page-content{filter:blur(0px)!important}");
console.log("blur remover loaded");
window.addEventListener("load", function () {
console.log("load listener injected");
try {
window.addEventListener("click", function (evt) {
if (evt.detail === 3) {
var head = document.getElementsByTagName("head")[0].innerHTML;
var tit = document.getElementsByTagName("h1")[0].innerHTML;
var pages = document.getElementById("page-container").childNodes;
for (var i = 0; i < pages.length; i++) {
pages[i].childNodes[0].style = "display: block;";
}
var pdf = pages[0].parentNode.parentNode.parentNode.innerHTML;
var newWindow = window.open(
"",
"Document",
"height=865,width=625,status=yes,toolbar=no,menubar=no"
);
newWindow.document.getElementsByTagName("head")[0].innerHTML =
head + "<style> .nofilter{filter: none !important;} </style>";
newWindow.document.title = tit;
newWindow.document.getElementsByTagName("body")[0].innerHTML =
pdf;
newWindow.document.getElementsByTagName(
"body"
)[0].childNodes[0].style = "";
}
});
} catch (error) {
console.log("failed to create doc viewer");
}
setTimeout(() => {
try {
var element = document.getElementById("viewer-wrapper");
if (element != null) {
var elements = element.childNodes;
if (elements.length > 3) {
elements[3].parentNode.removeChild(elements[3]);
}
}
} catch (error) {
console.log("no over-page ads found");
}
try {
var pages = document.getElementsByClassName("page-content");
for (var i = 0; i < pages.length; i++) {
var pagecontent = pages[i].parentNode.childNodes;
for (var j = 0; j < pagecontent.length; j++) {
if (pagecontent[j].className != "page-content") {
pagecontent[j].parentNode.removeChild(pagecontent[j]);
}
}
}
} catch (error) {
console.log("no ads on top of pages found");
}
try {
document
.getElementById("document-wrapper")
.removeChild(
document.getElementById("document-wrapper").childNodes[0]
);
} catch (errror) {
console.log("no overpage ads found");
}
try {
var container = document.getElementById("page-container");
if (container != null) {
Array.from(container.children).forEach(function (child) {
if (child.className.includes("banner-wrapper")) {
container.removeChild(child);
}
});
}
} catch {
console.log("no overpage ads found");
}
try {
let page = document.querySelector("#page-container-wrapper");
let overlay = page.parentElement.previousElementSibling;
if (overlay) {
overlay.style.display = "none";
}
} catch (e) {}
}, 100);
});
})();
},
};