Skip to content

Instantly share code, notes, and snippets.

@heartnn
Last active March 13, 2024 16:30
Show Gist options
  • Save heartnn/23bb0963d7db22504a3f0db2e338c821 to your computer and use it in GitHub Desktop.
Save heartnn/23bb0963d7db22504a3f0db2e338c821 to your computer and use it in GitHub Desktop.
My UserScript
// ==UserScript==
// @name Better.Caoliu
// @namespace Better.Caoliu
// @version 2.01
// @updateURL https://userscripts.org/scripts/source/122991.meta.js
// @downloadURL https://userscripts.org/scripts/source/122991.user.js
// @description This script removes redirection or ads in Caoliu, linkbucks, adf.ly, imagedunk, imageporter, imgchili, rmdown, ilix.in, 400kb.com, jptorrent.org, ref.so, imagekitty.com and etc.
// t66y:
// @match http://t66y.com/htm_data/*
// @match http://www.t66y.com/htm_data/*
// @match http://cl.eye.rs/htm_data/*
// @match http://cl.orc.st/htm_data/*
// viidii.com
// @match http://www.viidii.com/?*
// linkbucks
// @match http://*.allanalpass.com/*
// @match http://*.amy.gs/*
// @match http://*.any.gs/*
// @match http://*.baberepublic.com/*
// @match http://*.deb.gs/*
// @match http://*.drstickyfingers.com/*
// @match http://*.dyo.gs/*
// @match http://*.fapoff.com/*
// @match http://*.filesonthe.net/*
// @match http://*.galleries.bz/*
// @match http://*.hornywood.tv/*
// @match http://*.linkbabes.com/*
// @match http://*.linkbucks.com/*
// @match http://*.linkgalleries.net/*
// @match http://*.linkseer.net/*
// @match http://*.miniurls.co/*
// @match http://*.picbucks.com/*
// @match http://*.picturesetc.net/*
// @match http://*.placepictures.com/*
// @match http://*.poontown.net/*
// @match http://*.qqc.co/*
// @match http://*.qvvo.com/*
// @match http://*.realfiles.net/*
// @match http://*.rqq.co/*
// @match http://*.seriousdeals.net/*
// @match http://*.seriousfiles.com/*
// @match http://*.seriousurls.com/*
// @match http://*.sexpalace.gs/*
// @match http://*.seriousfiles.com/*
// @match http://*.theseblogs.com/*
// @match http://*.thesefiles.com/*
// @match http://*.theseforums.com/*
// @match http://*.thosegalleries.com/*
// @match http://*.tinybucks.net/*
// @match http://*.tinylinks.co/*
// @match http://*.tnabucks.com/*
// @match http://*.tubeviral.com/*
// @match http://*.uberpicz.com/*
// @match http://*.ubervidz.com/*
// @match http://*.ubucks.net/*
// @match http://*.ugalleries.net/*
// @match http://*.ultrafiles.net/*
// @match http://*.urlbeat.net/*
// @match http://*.urlpulse.net/*
// @match http://*.whackyvidz.com/*
// @match http://*.youfap.me/*
// @match http://*.yyv.co/*
// @match http://*.zxxo.net/*
// @match http://*.zff.co/*
// @match http://*.freegaysitepass.com/*
// adf.ly
// @match http://adf.ly/*
// @match http://www.adf.ly/*
// @match http://9.bb/*
// @match http://u.bb/*
// @match http://j.gs/*
// @match http://q.gs/*
// imagedunk
// @match http://picleet.com/*
// @match http://imagedunk.com/*
// imageporter
// @match http://imageporter.com/*
// @match http://www.imageporter.com/*
// @match http://picturedip.com/*
// @match http://piclambo.net/*
// imgchili
// @match http://imgchili.com/show/*
// rmdown
// @match http://www.rmdown.com/link.php?hash=*
// ilix.in
// @match http://ilix.in/*
// 400kb.com
// @match http://www.400kb.com/go.php?ref=*
// jptorrent.org
// @match http://*.jptorrent.org/link.php?ref=*
// ref.so
// @match http://ref.so/*
// pixhub.eu
// @match http://pixhub.eu/images/show/*
// imagekitty.com
// @match http://www.imagekitty.com/*
// imagetwist.com
// @match http://imagetwist.com/*
// @match http://www.imagetwist.com/*
// imagehyper.com
// @match http://serve.imagehyper.com/img.php?*
// imagebam.com
// @match http://www.imagebam.com/image/*
// upsimple.com
// @match http://upsimple.com/view/*
// imagevenue.com
// @match http://*.imagevenue.com/img.php?image=*
// wvw.fs-dy.com
// @match http://wvw.fs-dy.com/link.php?ref=*
// @match http://torrents.jav-board.com/downxx.php?aid=*
// tiung.com
// @match http://www.tiung.com/x/download.php?file=*
// javjunkies.com
// @match http://javjunkies.com/*
// adfoc.us
// @match http://adfoc.us/*
// adcrun.ch
// @match http://adcrun.ch/*
// comicalpic.net
// @match http://comicalpic.net/*
// imgah.com
// @match http://imgah.com/*
// ==/UserScript==
(function(mb,a,nb,ob,N,wa,xa,pb,qb,ya,rb,f,sb,tb,ub,V,za,vb,wb,xb,yb,I,ea,Aa,W,X,zb,H,Ba,d,Ab,Bb,Ca,fa,Cb,Da,Db,ga,Eb,Fb,ha,Gb,Hb,Ib,Jb,Kb,Q,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Y,J,Z,Ea,Fa,Sb,Tb,Ga,Ha,Ub,Vb,Wb,Ia,Xb,Ja,Yb,Zb,O,Ka,ia,$,$b,ac,bc,cc,dc,La,ec,fc,gc,hc,ic,jc,kc,lc,ja,mc,nc,oc,pc,qc,rc,Ma,R,sc,ka,tc,uc,vc,wc,xc,yc,zc,la,u,Ac,Bc,Cc,Na,p,Oa,Dc,Pa,Ec,t,Fc,Gc,Hc,Ic,Jc,v,Kc,Lc,Mc,ma,Nc,Oc,Qa,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Ra,Wc,Xc,Yc,Sa,Zc,$c,ad,bd,Ta,cd,dd,ed,fd,gd,hd,id,jd,kd,na,ld,y,md,Ua,nd,od,pd,qd,k,rd,sd,z,td,
q,ud,oa,vd,wd,xd,yd,zd,Ad,Bd,Cd,Dd,pa,Ed,Fd,Gd,Va,Hd,Id,Jd,Kd,aa,B,A,w,Ld,Wa,Md,Nd,Od,Xa,Pd,S,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Ya,Yd,Za,qa,Zd,$d,ae,be,ce,de,ee,fe,e,ge,E,C,$a,m,he,ie,je,F,ra,ke,le,T,me,ne,oe,K,x,n,b,ab,pe,qe,re,se,bb,te,ue,ve,we,xe,ye,ze,cb,Ae,Be,Ce,De,Ee,Fe,Ge,He,Ie,ba,Je,Ke,Le,db,Me,Ne,Oe,U,eb,Pe,P,Qe,Re,Se,fb,s,Te,Ue,Ve,r,gb,hb,l,ib,L,We,Xe,Ye,Ze,sa,M,jb,ta,$e,ca,kb,ua,af,bf,lb,cf,df,ef,ff,va,gf,D,hf,jf,kf,lf,mf,nf,of,pf,qf){(function(){[nd,nb][a](x);var c=function(b,c){function e(a,b){Object[xa](b)[n](function(h){a[h]=
b[h]});return a}function k(){p||(p=ab,b[gb](ya,k,N),q[n](function(a){a(g)}),q[l]=f)}function m(a,c){return(c||b)[kb](a)}function g(a,c){var e;if(typeof a===wb)return g[Ad](a);if(a instanceof g)return a;if(this instanceof g)if(typeof a===Va)if(a[f]===I){var G=b[ea](aa);G[W]=a;e=[];g[n](G[kb](X),function(a){a[H][ua](a)});g[n](G[Ba],function(a){e[V](a)});G[W]=d}else e=m(a,c);else e=a instanceof Array?a:a?[a]:[];else return new g(a,c);for(var G=e[l],k=f;k<G;++k)this[k]=e[k];this[l]=G}function r(a,b,h,
c){function d(a){if(h){if(v(a[Z],h))c[Ea](this,arguments)}else c[Ea](this,arguments)}a[J]||(a[J]=++F,z[a[J]]=[]);a[za](b,d,N);z[a[J]][V]({ev:b,fn:c,filter:h,proxy:d})}function t(a,b,h,c){if(a[J])z[a[J]][n](function(d,e){!d||(b&&d[Fa]!==b||h&&d[Ve]!==h||c&&d[ca]!==c)||(a[gb](d[Fa],d[s],N),delete z[a[J]][e])})}var q=[],u=N,p=N;g[ca]=g[B];var y=b[Ca][f],C=Function[B][ta][fa](Array[B][n]);e(g,{forEach:C,ready:function(a){if(p)a(g);else{var c=b[sb];if(c===tb||c===xd)p=ab,a(g);else if(q[V](a),!u)b[za](ya,
k,N)}},extend:e,select:m,proxy:function(c){var e=b[ea](X);e[Da]=[Db,ga][a](D)+c[Ee]()+[[ha,ha][a](ga),[[d,[Ze,[Hb,d][a](ha)][a](ga)][a](A),A][a](D)][a](w);y[ba](e);y[ua](e)},addCss:function(a){var c=b[ea](Q);c[Da]=a;b[Lb][ba](c)}});var v=Function[B][ta][fa](Element[B][nf]||Element[B][Nb]||Element[B][Ob]||Element[B][Pb]),E=Function[B][ta][fa](Array[B][Wa]),z=Object[Rb](Y),F=f;e(g[ca],{forEach:Array[B][n],map:function(a){return this[l]===f?g([]):g(E(this,a))},filter:function(a){var b=[];this[n](function(h){if(v(h,
a))b[V](h)});return g(b)},find:function(a){return this[l]===f?g([]):g(a,this[f])},children:function(a){return this[l]===f?g([]):a?this[Wa](function(b){return v(b,a)}):g(this[f][Ca])},parent:function(){return this[l]===f?g([]):this[f][H]},closest:function(a){if(this[l]===f||!(b instanceof Element))return g([]);for(var b=this[f];(b=b[H])&&b instanceof Element;)if(v(b,a))return g(b);return g([])},remove:function(){this[n](function(a){a[H][ua](a)});return this},on:function(b,h,c){if(this[l]===f)return g([]);
switch(arguments[l]){case Ga:c=h;h=Y;break;case Ha:break;default:throw[eb,Xa][a](x);}r(this[f],b,h,c)},off:function(b,h,c){if(this[l]===f)return g([]);switch(arguments[l]){case Ga:c=h;h=Y;break;case Ha:break;default:throw[eb,Xa][a](x);}t(this[f],b,h,c)},css:function(a){if(this[l]===f)return g([]);var b=this[f];if(typeof a===Va){var h=b[Q][a];return h!==d?h:getComputedStyle(b)[a]}Object[xa](a)[n](function(h){b[Q][h]=a[h]})},append:function(a){if(this[l]===f)return g([]);if(a=g(a)[f])this[f][ba](a);
return this},prepend:function(a){if(this[l]===f)return g([]);a=g(a)[f];var b=this[f];if(a)b[S](a,b[Ba][f]);return this},insertBefore:function(a){if(this[l]===f)return g([]);a=g(a)[f];var b=this[f];if(a)a[H][S](b,a);return this},before:function(a){if(this[l]===f)return g([]);a=g(a)[f];var b=this[f];if(a)b[H][S](a,b);return this},insertAfter:function(a){if(this[l]===f)return g([]);a=g(a)[f];var b=this[f];if(a)a[H][S](b,a[Ia]);return this},after:function(a){if(this[l]===f)return g([]);a=g(a)[f];var b=
this[f];if(a)b[H][S](a,b[Ia]);return this}});return g}(document,window),rf={"zh-CN":{enabled:Ne,feedback:Me,feedback_title:Rd,donation:pf,donation_title:bf},"en-US":{enabled:Ka,feedback:De,feedback_title:[Zd,Ae,ac,cb][a](x),donation:ye,donation_title:[de,La,ec,fc][a](x)}},sf=navigator[gc]||hc;c[ic](c,{isArrayLike:function(a){return typeof a===ge&&l in a&&!(a instanceof Window)},die:function(a){if(c[te](a))c[n](a,function(a){c[E](a)});else c[n]([ja,mc,nc,oc],function(b){a[b]&&(a[b]=Y);if(a[hf](b))a[$a](b)})},
clearCookies:function(){for(var b=document[Ma][ef](w),c=f;c<b[l];c++){var e=b[c],k=e[R](m),e=k>-F?e[tc](f,k):e;document[Ma]=e+[[[d,[d,uc][a](w),vc][a](m),d][a](K),oe,yc,jf,[la,la,la][a](u),ke][a](x)}},tips:function(){var h=[[d,aa][a](I),[[je,[Cc,lb][a](p)][a](m),Oa][a](b),[[d,d,[Ka,d,Pa][a](A)][a](D),[d,C][a](I)][a](w),[[[t,ib][a](m),d][a](u),d,[Gc,e][a](b),Xe,[lb,Oa][a](b),M][a](v),[[Q,jb][a](m),Lc][a](u),[Z,Za][a](m),[[ma,[M,d,[Nc,d,[M,d][a](p)][a](A),d,[cb,d,I][a](A)][a](D)][a](m),[[C,Pa][a](p),
[d,C][a](I)][a](w)][a](v),[[[t,ib][a](m),d][a](u),d,[He,Qa][a](b),Ya,M][a](v),[[Q,jb][a](m),Qc][a](u),[ma,[M,d,[Rc,d,M][a](A)][a](D)][a](m),[[Z,[[Za,d][a](p),d,[Ya,d,I][a](A)][a](D)][a](m),[[C,d][a](p),d][a](I),[aa,d][a](p)][a](v)][a](x),G=[[d,[[va,Tc][a](D),[Uc,Vc][a](w),[Ra,Wc][a](w),[Ra,hb][a](w),[Te,Sa][a](w),fb][a](u),[[$c,ad][a](w),[bd,Se][a](w),[cd,dd][a](w),[ed,d][a](A)][a](u),[va,[fd,Sa][a](D),fb][a](u),[Pd,d][a](A),va][a](b),[[Od,hb][a](D),[df,of][a](w),[kd,d][a](A)][a](u)][a](x);c[na](G);
var k=rf[sf],h=h[sa](/\{\{([0-9a-zA-Z_]+)\}\}/g,function(a,b){return k[b]||a});document[y][ba](c(h)[f])}});var da=[{hosts:[[Kd,e][a](b),[Ua,mb,Gd][a](b),[Ua,pd,ve][a](b)],fn:function(){c[E](c([[d,pa][a](b),[bb,[d,pa][a](b)][a](K),C][a](x)));c([[d,pa][a](b),C][a](x))[n](function(a){a[t]=a[t][sa](yd,cf)[sa](/______/g,b)})}},{hosts:[[se,e][a](b)],fn:function(){var a=document[q](ud);a&&a[t]&&(location[t]=a[t])}},{hosts:[[vd,e][a](b),[td,z][a](b),[re,z][a](b),[sd,e][a](b),[rd,z][a](b),[ue,e][a](b),[Bd,
z][a](b),[Cd,e][a](b),[gf,k][a](b),[qd,xe][a](b),[od,ze][a](b),[Hd,e][a](b),[Id,e][a](b),[Jd,k][a](b),[md,k][a](b),[ld,P][a](b),[jd,e][a](b),[Ge,k][a](b),[Ke,e][a](b),[id,k][a](b),[Ue,P][a](b),[$e,e][a](b),[hd,k][a](b),[Pe,P][a](b),[gd,k][a](b),[Ta,e][a](b),[Zc,e][a](b),[Yc,z][a](b),[Ta,e][a](b),[Sd,e][a](b),[Xc,e][a](b),[Je,e][a](b),[Sc,e][a](b),[Wd,k][a](b),[Xd,P][a](b),[Pc,e][a](b),[Oc,e][a](b),[Mc,e][a](b),[mf,e][a](b),[Kc,k][a](b),[Jc,k][a](b),[ae,k][a](b),[be,k][a](b),[kf,k][a](b),[lf,e][a](b),
[we,Qa][a](b),[Ic,P][a](b),[Hc,k][a](b),[ff,P][a](b),[Fc,e][a](b)],fn:function(){c[s](function(){var a=Lbjs;a&&a.TargetUrl&&(document.body.innerHTML="",a.IsClick=!0,window.onbeforeunload=null,location.href=a.TargetUrl)})}},{hosts:[[Ec,qe][a](b),[Dc,Na][a](b),[ie,Na][a](b),[Bc,z][a](b),[Re,z][a](b)],fn:function(){if(location[ra][R]([d,[Ac,le][a](b)][a](v))!==-F)document[y][W]=d;else{var h=document[q]([ne,C][a](x));if(h)h[T]();else c[zc](),c[s](function(){if(window.zzz){var a=new XMLHttpRequest;a.onreadystatechange=
function(){if(4==a.readyState&&200==a.status){var b=a.responseText;/^https?:\/\//.test(b)&&(location.href=b)}};a.open("POST","/shortener/go",!0);a.setRequestHeader("Content-type","application/x-www-form-urlencoded");a.send("zzz="+zzz)}})}}},{hosts:[[xc,e][a](b),[wc,e][a](b)],fn:function(){c[s](function(){splashpage.closeit()});c([y,ka][a](p))[n](function(a){if(a[he]!==sc)c(a)[r]()})}},{hosts:[[rc,e][a](b),[qc,e][a](b),[pc,k][a](b)],fn:function(){c[s](function(){jsm_url="";popunder=function(){};splashpage.closeit()});
c(oa)[r]();c([y,aa][a](p),function(a){if(a[q](X))c(a)[r]()})}},{hosts:[[lc,e][a](b)],fn:function(){if(document[ma][R](kc)!==-F)c([jc,[d,fe][a](b),[d,ee][a](b)][a](K))[r](),c([y,dc][a](x))[n](function(a){if(a[q](oa))c(a)[r]()}),c(ce)[cc]({display:bc});else location[$b]()}},{hosts:[[$d,e][a](b)],fn:function(){c(bb)[r]();var b=document[q]([[$,ia][a](O),[qa,d][a](L)][a](m));b&&(c[E](b),b[T]())}},{hosts:[[Yd,Vd][a](b)],fn:function(){c[na]([d,[[Zb,Ud][a](D),[Td,d][a](A)][a](u)][a](b));c[s](function(){if(seconds){seconds=
0;var a=document.querySelector("#captcha-form");a?a.focus():setInterval(function(){var a=document.querySelector("form");a&&a.submit&&a.submit()},100)}});var h=document[q]([[oa,Le][a](O),[[Yb,d][a](L),[Ja,d][a](L)][a](O)][a](m));h&&(location[t]=h[Ja])}},{hosts:[[Xb,e][a](b)],fn:function(){c[s](function(){update&&(update=function(){},timer(),clearInterval(MyMar1))});c([X,[Qd,ka][a](p)][a](K))[n](function(a){if(!a[q](U))c(a)[r]()});c[E](c([U,$][a](K)));document[q](U)[Wb]()}},{hosts:[[Vb,Qe][a](b)],fn:function(){c([y,
ka][a](p))[n](function(a){if(!a[q](U))c(a)[r]()});var b=document[q]([[$,ia][a](O),[qa,d][a](L)][a](m));if(b)b[T]()}},{hosts:[[Nd,me][a](b)],fn:function(){var b=document[q]([Ub,C][a](p));b&&(document[y][W]=d,location[t]=b[t])}},{hosts:[[Oe,Tb][a](b)],fn:function(){c[na]([[[d,db][a](b),[d,db][a](b)][a](K),[[y,Md][a](D),Sb][a](u),[Qb,d][a](A)][a](x));c([d,Mb][a](b))[r]()}},{hosts:[[Ld,e][a](b)],fn:function(){c(Kb)[r]()}},{hosts:[[Ie,e][a](b)],fn:function(){c[s](function(){doClose()})}},{hosts:[[Jb,e][a](b)],
fn:function(){c[s](function(){c("#dialog-confirm").dialog("close");createCookie("hasVisitedBefore","true",1E3)});c([Ib,Fe,Ye][a](K))[r]()}},{hosts:[[Gb,e][a](b)],fn:function(){c[s](function(){closeOverlay()})}},{hosts:[[Fb,e][a](b)],fn:function(){c(Eb)[r]();c[E](document);c[s](function(){SetCookie("pf",1,"")})}},{hosts:[[Ce,e][a](b)],fn:function(){c[s](function(){interstitialBox.closeit()})}},{hosts:[[Cb,Bb,e][a](b),[Ab,e][a](b)],fn:function(){c[E](c(U));var b=document[q]([[$,ia][a](O),[qa,d][a](L)][a](m));
if(b&&b[T])b[T]()}},{hosts:[[zb,e][a](b)],fn:function(){setInterval(function(){c[E]([document,document[y]])},Be);c[s](function(){var a;if(a=countdown.toString().match(/http[:a-zA-Z0-9\.?\/&=]+/)[0])document.body.innerHTML="",location.href=a})}},{hosts:[[af,e][a](b)],fn:function(){location[ra][R]([d,Aa,yb,d][a](v))!==-F&&(location[ra]=[d,Aa,d][a](v));c([[[C,[ja,d][a](L),t][a](O),M][a](m),[Fd,[Ed,d][a](L)][a](b)][a](v))[n](function(a){var b=a[xb](ja)[Dd](We);b&&b[F]&&(a[t]=b[F],a[$a](Z),c[E](a))})}},
{hosts:[[vb,La][a](b)],fn:function(){c[s](function(){-1!==click_url.indexOf("http://adfoc.us/serve/click/")&&(document.body.innerHTML="",location.replace(click_url))})}},{hosts:[[zd,ub][a](b)],fn:function(){c[s](function(){var a=document.body.querySelector("iframe.fly_frame+script");a&&(a=a.innerHTML.replace(/^\s+|\s+$/g,""),0===a.indexOf("eval(")&&(a=a.replace(/^eval\(/g,"String("),a=eval(a),a=a.match(/skip_ad\.click\(function\(\)\{(.*),function\(/)[1],eval(a+',function(r){var o = JSON.parse(r);if(o.message.url.length>4){location.href = o.message.url;document.body.innerHTML = "";};});')))})}},
{hosts:[[rb,k][a](b)],fn:function(){c([d,qb][a](b))[r]()}},{hosts:[[pe,e][a](b)],fn:function(){c(pb)[r]()}}];c(function(){for(var a=location[wd],b=f;b<da[l];++b)for(var d=f;d<da[b][wa][l];++d)if(a[R](da[b][wa][d])!==-F){da[b][ca]();c[ob]();return}});window[qf]=c})()})("eye","join","strict","tips",!1,"hosts","keys","#boxes","overlay_ad","readystatechange","comicalpic",0,"readyState","interactive","ch","push","addEventListener","adfoc","function","getAttribute","attention","<","createElement","main",
"innerHTML","script","tiung","parentNode","childNodes","","jav-board","fs-dy","children","bind","wvw","textContent","try","(","#disclaimer","upsimple",")","imagebam","e","#h","imagehyper","#dhtmlwindowholder","style","head","adultpage","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","!important","create",null,"__i","target","apply","ev","scroll","eu",2,3,"#btn_open","jptorrent","submit","nextSibling","400kb","src",'"ifram"',"blockUI","[","enabled","type","input","reload","to","block",
"css","tr","us","do","better","language","en-US","extend","#ad","imgChili","imgchili","onclick","onsubmit","onmouseover","onmouseout","piclambo","picturedip","imageporter","cookie","indexOf","CENTER","*","substr","expires","Thu","picleet","imagedunk","Jan","clearCookies","00",":","1market","j",'"bc_tips_container"',"bb",">","Caoliu","9","&emsp","adf","href","freegaysitepass","github","zxxo","yyv","ugalleries","/","ubucks",'blue"',"uberpicz","title","feedback_title","tubeviral","me","tnabucks",'red"',
"donation_title","thosegalleries","position","fixed","top","2em","right","thesefiles","sexpalace","opacity","seriousurls","4","background","#abc","seriousfiles","5px","border-radius","3px","hover","seriousdeals","realfiles","poontown","picbucks","pointer","addCss","miniurls","body","linkseer","cl","use","hornywood","orc","galleries","net","deb","baberepublic","gs","amy","querySelector","#directlink","iframe","allanalpass","host","complete",/^http\:\/\/www\.viidii\.(?:com|info)\/\?(.*?)&z/,"adcrun",
"ready","dyo","fapoff","match","tpc_content",'php"',"JAV","rs","string","linkbabes","linkbucks","linkgalleries","t66y","div","prototype","}",";","imagekitty","map","overflow","ref","#toggleGoogle","invalid","8","insertBefore","#wrap","\u6709\u95ee\u9898\u70b9\u6b64\u53cd\u9988","theseblogs","none","display","in","tinybucks","tinylinks","donation","ilix",'"_blank"','"submit"',"Click","rmdown","ultrafiles","urlbeat","#all","Help","sidebar","sidebar2","com","object","die","a","removeAttribute","=","tagName",
"u","class",1,"pathname","GMT","php","click","so","#continue","01",","," ","forEach",".",!0,"imgah","ly","any","viidii","img","isArrayLike","drstickyfingers","st","youfap","bz","Donation","tv","feedback","here",100,"imagevenue","Feedback","toString","#l","picturesetc","opengg","imagetwist","appendChild","theseforums","placepictures","name","adult","\u53cd\u9988","\u5df2\u542f\u7528","pixhub","form","Arguments","rqq","co","org","q","padding","0","proxy","green","qqc","filter","remove","removeEventListener",
"color","length",'"http',"]",/location\.href\s*=\s*"([^"]+)"/,"OpenGG","#r","catch","replace",'"','"color',"call","qvvo","fn","querySelectorAll","removeChild","javjunkies","\u6211\u8981\u6350\u52a9\u6b64\u9879\u76ee","Better","$1","red","split","zff","bc_tips_container","filesonthe","{","hasAttribute","1970","urlpulse","whackyvidz","ubervidz","matches","cursor","\u6350\u52a9","$");
// ==UserScript==
// @namespace https://greasyfork.org/users/10250
// @name 网页字体替换为微软雅黑
// @description 网页字体替换为微软雅黑(优先)或思源黑体
// @include *:*
// @author heartnn
// @homepage https://www.heartnn.com/
// @supportURL https://greasyfork.org/zh-CN/scripts/374194
// @version 1.07
// @license MIT
// ==/UserScript==
(function() {
function addStyle(rules) {
var styleElement = document.createElement('style');
styleElement.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(styleElement);
styleElement.appendChild(document.createTextNode(rules));
}
addStyle(`
@font-face{font-family:"Apple Color Emoji";src:local("Apple Color Emoji");unicode-range:U+2100-10FFFF}
@font-face{font-family:"Segoe UI Emoji";src:local("Segoe UI Emoji");unicode-range:U+2100-10FFFF}
:not(i,s,a:hover,span,textarea,[aria-hidden=true],[class^=fa],[class*=icon],#_#_){font-family:"Apple Color Emoji","Segoe UI Emoji",-apple-system, "Noto Sans", "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "Microsoft YaHei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp",icomoon,iconfont,brand-icons,FontAwesome,genericons,Inconsolata,"Material Icons","Material Icons Extended","Glyphicons Halflings","dzicon",sans-serif,system-ui}
:root :is(pre,code,textarea,samp,kbd,var,[class*=code],#_#_){font-family:"Apple Color Emoji","Segoe UI Emoji",ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono","Source Han Mono SC","Noto Sans Mono CJK SC","Microsoft YaHei Mono","WenQuanYi Micro Hei Mono",monospace}
:root :is(pre,code,textarea,samp,kbd,var,[class*=code],#_#_) :is(a,span){font-family:"Apple Color Emoji","Segoe UI Emoji",ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono","Source Han Mono SC","Noto Sans Mono CJK SC","Microsoft YaHei Mono","WenQuanYi Micro Hei Mono",monospace}
`);
})();
// ==UserScript==
// @name 电影信息查询脚本
// @description Fetch Douban Description, IMDb information for PT upload
// @version 10.3.7.9
// @author Secant(TYT@NexusHD)
// @include http*://movie.douban.com/subject/*
// @require https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// @icon https://movie.douban.com/favicon.ico
// @contributionURL https://i.loli.net/2020/02/28/JPGgHc3UMwXedhv.jpg
// @contributionAmount 10
// @namespace https://greasyfork.org/users/152136
// @grant GM_xmlhttpRequest
// @connect front-gateway.mtime.cn
// @connect api.douban.com
// @connect proxy.secant.workers.dev
// @connect p.media-imdb.com
// ==/UserScript==
/*jshint esversion: 8 */
(function ($) {
const a = [
"MGIyYmRlZGE0M2I1Njg4OTI=",
"MGRhZDU1MWVjMGY4NGVkMDI=",
"OTA3ZmY1YzQyZThlYzcw",
"MDI2NDZkM2ZiNjlhNTJmZjA=",
"MTgzOWM4ZWNiMjAzOTli",
"NzJkNDdiZjIzY2VmOGZk",
"OWVjYmI1MzQ0MjUyYTRh",
"MGRmOTkzYzY2YzBjNjM2ZTI=",
];
(function (b, e) {
const f = function (g) {
while (--g) {
b["push"](b["shift"]());
}
};
f(++e);
})(a, 0x1e4);
const b = function (c, d) {
c = c - 0x0;
let e = a[c];
if (b["pbhcos"] === undefined) {
(function () {
const g =
typeof window !== "undefined"
? window
: typeof process === "object" &&
typeof require === "function" &&
typeof global === "object"
? global
: this;
const h =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
g["atob"] ||
(g["atob"] = function (i) {
const j = String(i)["replace"](/=+$/, "");
let k = "";
for (
let l = 0x0, m, n, o = 0x0;
(n = j["charAt"](o++));
~n && ((m = l % 0x4 ? m * 0x40 + n : n), l++ % 0x4)
? (k += String["fromCharCode"](
0xff & (m >> ((-0x2 * l) & 0x6))
))
: 0x0
) {
n = h["indexOf"](n);
}
return k;
});
})();
b["ICpnUS"] = function (g) {
const h = atob(g);
let j = [];
for (let k = 0x0, l = h["length"]; k < l; k++) {
j +=
"%" + ("00" + h["charCodeAt"](k)["toString"](0x10))["slice"](-0x2);
}
return decodeURIComponent(j);
};
b["Snsmje"] = {};
b["pbhcos"] = !![];
}
const f = b["Snsmje"][c];
if (f === undefined) {
e = b["ICpnUS"](e);
b["Snsmje"][c] = e;
} else {
e = f;
}
return e;
};
const DoubanAPIKeys = [
b("0x7") + b("0x1"),
b("0x5") + b("0x6"),
b("0x4") + b("0x0"),
b("0x3") + b("0x2"),
];
const TIMEOUT = 6000;
const $toggle = $('<span class="pl">描述文本:</span>');
const $infoGen = $('<a href="javascript:void(0)">获取</a>');
const $message = $('<span style="display:none;padding:0px 5px"></span>');
const $copyPaste = $('<textarea type="text" rows="0" cols="0"/>').css({
position: "absolute",
top: 0,
left: -9999,
});
function decodeEntities(encodedString) {
var textArea = document.createElement("textarea");
textArea.innerHTML = encodedString;
return textArea.value;
}
function addComma(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
function jsCopy(e) {
e.select();
try {
return document.execCommand("copy");
} catch (err) {
return false;
}
}
function $$(htmlString) {
return $(htmlString, document.implementation.createHTMLDocument("virtual"));
}
$.fn.extend({
nextNodeUtil: function (selector) {
const siblings = [];
try {
let current = this[0];
do {
siblings.push(current);
current = current.nextSibling;
} while (
current.nodeType === Node.TEXT_NODE ||
!current.matches(selector)
);
return $(siblings);
} catch (e) {
return $(siblings);
}
},
});
function getPoster() {
try {
return $("#mainpic img")[0].src.replace(
/^.+(p\d+).+$/,
(_, p1) =>
`https://img9.doubanio.com/view/photo/l_ratio_poster/public/${p1}.jpg`
);
} catch (e) {
return null;
}
}
function getTitles() {
let isChinese = false;
const chineseTitle = document.title.replace(/\(豆瓣\)$/, "").trim();
const originalTitle =
$("#content h1>span[property]").text().replace(chineseTitle, "").trim() ||
((isChinese = true), chineseTitle);
try {
let akaTitles = $('#info span.pl:contains("又名")')[0]
.nextSibling.textContent.trim()
.split(" / ");
const transTitle = isChinese
? akaTitles.find((e) => {
return e.match(/[a-z]/i);
}) || chineseTitle
: chineseTitle;
const priority = (e) => {
if (e === transTitle) {
return 0;
}
if (e.match(/\(港.?台\)/)) {
return 1;
}
if (e.match(/\([港台]\)/)) {
return 2;
}
return 3;
};
akaTitles = akaTitles
.sort((a, b) => priority(a) - priority(b))
.filter((e) => e !== transTitle);
return [
{
chineseTitle: chineseTitle,
originalTitle: originalTitle,
translatedTitle: transTitle,
alsoKnownAsTitles: akaTitles,
},
isChinese,
];
} catch (e) {
return [
{
chineseTitle: chineseTitle,
originalTitle: originalTitle,
translatedTitle: chineseTitle,
alsoKnownAsTitles: [],
},
isChinese,
];
}
}
function getYear() {
return parseInt($("#content>h1>span.year").text().slice(1, -1));
}
function getRegions() {
try {
return $('#info span.pl:contains("制片国家/地区")')[0]
.nextSibling.textContent.trim()
.split(" / ");
} catch (e) {
return [];
}
}
function getGenres() {
try {
return $('#info span[property="v:genre"]')
.toArray()
.map((e) => e.innerText.trim());
} catch (e) {
return [];
}
}
function getLanguages() {
try {
return $('#info span.pl:contains("语言")')[0]
.nextSibling.textContent.trim()
.split(" / ");
} catch (e) {
return [];
}
}
function getReleaseDates() {
try {
return $('#info span[property="v:initialReleaseDate"]')
.toArray()
.map((e) => e.innerText.trim())
.sort((a, b) => new Date(a) - new Date(b));
} catch (e) {
return [];
}
}
function getDurations() {
try {
return $('span[property="v:runtime"]')
.nextNodeUtil("br")
.toArray()
.map((e) => e.textContent)
.join("")
.trim()
.split(" / ");
} catch (e) {
return [];
}
}
function getEpisodeDuration() {
try {
return $(
'#info span.pl:contains("单集片长")'
)[0].nextSibling.textContent.trim();
} catch (e) {
return null;
}
}
function getEpisodeCount() {
try {
return parseInt(
$('#info span.pl:contains("集数")')[0].nextSibling.textContent.trim()
);
} catch (e) {
return null;
}
}
function getTags() {
return $("div.tags-body>a")
.toArray()
.map((e) => e.textContent);
}
function getDoubanID() {
return window.location.href.match(/subject\/(\d+)/)[1];
}
function getDoubanScore() {
const $interest = $("#interest_sectl");
const ratingAverage = parseFloat(
$interest.find('[property="v:average"]').text()
);
const ratingVotes = parseInt($interest.find('[property="v:votes"]').text());
const ratingHist = Object.fromEntries(
$interest
.find(".ratings-on-weight .rating_per")
.toArray()
.map((e, i) => [5 - i, parseFloat(e.textContent.slice(0, -1)) / 100])
);
return {
rating: ratingAverage,
ratingCount: ratingVotes,
ratingHistograms: {
"Douban Users": {
aggregateRating: ratingAverage,
demographic: "Douban Users",
histogram: ratingHist,
totalRatings: ratingVotes,
},
},
};
}
function getDescription() {
try {
return Array.from(
$('[id^="link-report"]>[property="v:summary"],[id^="link-report"]>span.all.hidden')[0]
.childNodes
)
.filter((e) => e.nodeType === 3)
.map((e) => e.textContent.trim())
.join("\n");
} catch (e) {
return null;
}
}
async function DoubanAPI(
ID,
apikeys = DoubanAPIKeys.slice(),
timeout = TIMEOUT
) {
if (ID) {
const index = Math.floor(Math.random() * apikeys.length);
const [apikey] = apikeys.splice(index, 1);
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://api.douban.com/v2/movie/${ID}?apikey=${apikey}`,
headers: {
referrer: "http://api.douban.com/",
},
responseType: "json",
timout: timeout,
onload: (x) => {
const e = x.response;
if (e.code === 104 && apikeys.length > 0) {
console.warn(e);
resolve(DoubanAPI(ID, apikeys));
} else if (e.code) {
console.warn(e);
resolve(null);
} else {
resolve(e);
}
},
ontimeout: (e) => {
console.warn(e);
resolve(null);
},
onerror: (e) => {
console.warn(e);
resolve(null);
},
});
});
} else {
return null;
}
}
async function getIMDbID(timeout = TIMEOUT) {
const $season = $("#season");
try {
if ($season[0] && $season.find(":selected")[0].innerText !== "1") {
const DoubanID = $season.find("option:first-of-type").val();
const resp = await Promise.race([
fetch(`https://movie.douban.com/subject/${DoubanID}`),
new Promise((resolve) =>
setTimeout(() => {
resolve({
ok: false,
message: `fetch ${DoubanID} douban page time out`,
});
}, timeout)
),
]);
if (resp.ok) {
const htmlString = await resp.text();
return $$(htmlString)
.find('#info .pl:contains("IMDb:")')[0]
.nextSibling.textContent.match(/tt(\d+)/)[1];
} else {
console.warn(resp);
return null;
}
} else {
return $(
'#info .pl:contains("IMDb:")'
)[0].nextSibling.textContent.match(/tt(\d+)/)[1];
}
} catch (e) {
return null;
}
}
async function getIMDbScore(ID, timeout = TIMEOUT) {
if (ID) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: "GET",
// p.media-imdb.com: HTTPS -> HTTP
url: `http://p.media-imdb.com/static-content/documents/v1/title/tt${ID}/ratings%3Fjsonp=imdb.rating.run:imdb.api.title.ratings/data.json`,
// url: `https://proxy.secant.workers.dev/worker/proxy/p.media-imdb.com/static-content/documents/v1/title/tt${ID}/ratings%253Fjsonp=imdb.rating.run:imdb.api.title.ratings/data.json`,
timout: timeout,
onload: (x) => {
try {
const e = JSON.parse(x.responseText.slice(16, -1));
resolve(e.resource);
} catch (e) {
console.warn(e);
resolve(null);
}
},
ontimeout: (e) => {
console.warn(e);
resolve(null);
},
onerror: (e) => {
console.warn(e);
resolve(null);
},
});
});
} else {
return null;
}
}
async function getAwards(ID, timeout = TIMEOUT) {
if (ID) {
const resp = await Promise.race([
fetch(`https://movie.douban.com/subject/${ID}/awards`),
new Promise((resolve) =>
setTimeout(() => {
resolve({
ok: false,
message: `fetch ${ID} douban awards time out`,
});
}, timeout)
),
]);
if (resp.ok) {
const htmlString = await resp.text();
return $$(htmlString)
.find("div.awards")
.toArray()
.map((e) => {
const $title = $(e).find(".hd>h2");
const $awards = $(e).find(".award");
return {
name: $title.find("a").text().trim(),
year: parseInt($title.find(".year").text().match(/\d+/)[0]),
awards: $awards.toArray().map((e) => ({
name: $(e).find("li:first-of-type").text().trim(),
people: $(e)
.find("li:nth-of-type(2)")
.text()
.split("/")
.map((e) => e.trim()),
})),
};
});
} else {
return [];
}
} else {
return [];
}
}
async function getCelebrities(ID, timeout = TIMEOUT) {
if (ID) {
const fetchCeleb = await Promise.race([
fetch(`https://movie.douban.com/subject/${ID}/celebrities`),
new Promise((resolve) =>
setTimeout(() => {
resolve({
ok: false,
message: `fetch ${ID} douban celebrities time out`,
});
}, timeout)
),
]);
const fetchAPI = DoubanAPI(ID);
const respCeleb = await fetchCeleb;
let jsonCeleb, jsonAPI;
if (respCeleb.ok) {
const htmlString = await respCeleb.text();
const entries = $$(htmlString)
.find("#celebrities>div.list-wrapper")
.toArray()
.map((e) => {
const [positionChinese, positionForeign] = $(e)
.find("h2")
.text()
.match(/([^ ]*)(?:$| )(.*)/)
.slice(1, 3);
const people = $(e)
.find("li.celebrity")
.toArray()
.map((e) => {
let [nameChinese, nameForeign] = $(e)
.find(".info>.name")
.text()
.match(/([^ ]*)(?:$| )(.*)/)
.slice(1, 3);
if (!nameChinese.match(/[\u4E00-\u9FCC]/)) {
nameForeign = nameChinese + " " + nameForeign;
nameChinese = null;
}
const [roleChinese, roleForeign, character] = $(e)
.find(".info>.role")
.text()
.match(/([^ ]*)(?:$| )([^(]*)(?:$| )(.*)/)
.slice(1, 4);
return {
name: {
chs: nameChinese,
for: nameForeign,
},
role: {
chs: roleChinese,
for: roleForeign,
},
character: character.replace(/[()]/g, ""),
};
});
return [
positionForeign.toLowerCase(),
{
position: positionChinese,
people: people,
},
];
});
if (entries.length) {
jsonCeleb = Object.fromEntries(entries);
} else {
jsonCeleb = null;
}
} else {
jsonCeleb = null;
}
const respAPI = await fetchAPI;
if (respAPI) {
const splitName = (e, chsRole, forRole) => {
let [nameChinese, nameForeign] = e
.match(/([^ ]*)(?:$| )(.*)/)
.slice(1, 3);
if (!nameChinese.match(/[\u4E00-\u9FCC]/)) {
nameForeign = nameChinese + " " + nameForeign;
nameChinese = null;
}
return {
name: {
chs: nameChinese,
for: nameForeign,
},
role: {
chs: chsRole,
for: forRole,
},
character: "",
};
};
jsonAPI = {
director: {
position: "导演",
people: (respAPI.attrs.director || []).map((e) =>
splitName(e, "导演", "Director")
),
},
cast: {
position: "演员",
people: (respAPI.attrs.cast || []).map((e) =>
splitName(e, "演员", "Actor/Actress")
),
},
writer: {
position: "编剧",
people: (respAPI.attrs.writer || []).map((e) =>
splitName(e, "编剧", "Writer")
),
},
};
} else {
jsonAPI = null;
}
if (jsonCeleb === null) {
return jsonAPI;
} else if (jsonAPI === null) {
return jsonCeleb;
} else {
["director", "cast", "writer"].forEach((prop) => {
if (jsonCeleb[prop]) {
jsonAPI[prop].people.forEach((e) => {
const flag = jsonCeleb[prop].people.filter((f) => {
return f.name.for === e.name.for;
});
if (flag.length === 0) {
jsonCeleb[prop].people.push(e);
}
});
} else {
jsonCeleb[prop] = jsonAPI[prop];
}
});
return jsonCeleb;
}
} else {
return null;
}
}
// Mtime is HTTP only
async function MtimeSearch(
chineseTitle,
year,
timeout = TIMEOUT + 2000 //mtime search is slow?
) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://front-gateway.mtime.cn/mtime-search/search/unionSearch?keyword=${encodeURIComponent(
chineseTitle
)}`,
headers: {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
},
responseType: "json",
timeout: timeout,
onload: (x) => {
const e = x.response;
try {
resolve(
e.data.movies.find((movie) => {
const titles = movie.titleOthersCn;
titles.unshift(movie.name, movie.nameEn);
if (year !== movie.year && year !== movie.rYear) {
return false;
}
if (titles.some((title) => chineseTitle.includes(title))) {
return true;
}
return false;
}) || null
);
} catch (e) {
console.warn(e);
resolve(null);
}
},
ontimeout: (e) => {
console.warn(e);
resolve(null);
},
onerror: (e) => {
console.warn(e);
resolve(null);
},
});
});
}
// ERROR 521 is handled. (generate cookies on the spot)
async function getBehindTheScene(ID, timeout = TIMEOUT) {
if (ID) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
method: "GET",
url: `https://front-gateway.mtime.cn/library/movie/extendDetail.api?movieId=${ID}`,
headers: {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
},
responseType: "json",
timeout: timeout,
onload: (x) => {
try {
resolve(x.response.data.dataBankEntry);
} catch (e) {
console.warn(e);
resolve(null);
}
},
ontimeout: (e) => {
console.warn(e);
resolve(null);
},
onerror: (e) => {
console.warn(e);
resolve(null);
},
});
});
} else {
return null;
}
}
async function getInfo() {
const [titles, isChinese] = getTitles(),
year = getYear(),
regions = getRegions(),
genres = getGenres(),
languages = getLanguages(),
releaseDates = getReleaseDates(),
durations = getDurations(),
episodeDuration = getEpisodeDuration(),
episodeCount = getEpisodeCount(),
tags = getTags(),
DoubanID = getDoubanID(),
DoubanScore = getDoubanScore(),
poster = getPoster(),
description = getDescription();
let IMDbID, IMDbScore, awards, celebrities, behindTheScene;
const concurrentFetches = [];
concurrentFetches.push(
// IMDb Fetch
getIMDbID()
.then((e) => {
IMDbID = e;
return getIMDbScore(IMDbID);
})
.then((e) => {
IMDbScore = e;
}),
// Awards Fetch
getAwards(DoubanID).then((e) => {
awards = e;
}),
// Celebrities Fetch
getCelebrities(DoubanID).then((e) => {
celebrities = e;
}),
// MTime
// 更换时光网接口
MtimeSearch(titles.chineseTitle, year)
.then((e) => (e ? getBehindTheScene(e.movieId) : null))
.then((e) => {
behindTheScene = e;
})
);
await Promise.all(concurrentFetches);
// Amend Titles
if (IMDbScore && IMDbScore.title) {
if (isChinese) {
if (!titles.translatedTitle.includes(IMDbScore.title)) {
titles.alsoKnownAsTitles.push(titles.translatedTitle);
const index = titles.alsoKnownAsTitles.indexOf(IMDbScore.title);
if (index >= 0) {
titles.alsoKnownAsTitles.splice(index, 1);
}
titles.translatedTitle = IMDbScore.title;
}
} else {
if (
!titles.originalTitle.includes(IMDbScore.title) &&
titles.alsoKnownAsTitles.indexOf(IMDbScore.title) === -1
) {
titles.alsoKnownAsTitles.push(IMDbScore.title);
}
}
}
return {
poster: poster,
titles: titles,
year: year,
regions: regions,
genres: genres,
languages: languages,
releaseDates: releaseDates,
durations: durations,
episodeDuration: episodeDuration,
episodeCount: episodeCount,
tags: tags,
DoubanID: DoubanID,
DoubanScore: DoubanScore,
IMDbID: IMDbID,
IMDbScore: IMDbScore,
awards: awards,
celebrities: celebrities,
description: description,
behindTheScene: behindTheScene,
};
}
function formatInfo(info) {
let temp;
const infoText = (
(info.poster ? `[img]${info.poster}[/img]\n\n` : "") +
"◎译  名 " +
[info.titles.translatedTitle]
.concat(info.titles.alsoKnownAsTitles)
.join(" / ") +
"\n" +
"◎片  名 " +
info.titles.originalTitle +
"\n" +
"◎年  代 " +
info.year +
"\n" +
(info.regions.length
? "◎产  地 " + info.regions.join(" / ") + "\n"
: "") +
(info.genres.length
? "◎类  别 " + info.genres.join(" / ") + "\n"
: "") +
(info.languages.length
? "◎语  言 " + info.languages.join(" / ") + "\n"
: "") +
(info.releaseDates.length
? "◎上映日期 " + info.releaseDates.join(" / ") + "\n"
: "") +
(info.IMDbScore && info.IMDbScore.rating
? `◎IMDb评星  ${
((temp = Math.round(info.IMDbScore.rating * 2)),
"★".repeat(Math.floor(temp / 2)) +
(temp % 2 === 1 ? "✦" : "") +
"☆".repeat(10 - Math.ceil(temp / 2)))
}\n◎IMDb评分  ${Number(info.IMDbScore.rating).toFixed(
1
)}/10 from ${addComma(info.IMDbScore.ratingCount)} users\n`
: "") +
(info.IMDbID
? `◎IMDb链接  https://www.imdb.com/title/tt${info.IMDbID}/\n`
: "") +
(info.DoubanScore && info.DoubanScore.rating
? `◎豆瓣评星 ${
((temp = Math.round(info.DoubanScore.rating)),
"★".repeat(Math.floor(temp / 2)) +
(temp % 2 === 1 ? "✦" : "") +
"☆".repeat(5 - Math.ceil(temp / 2)))
}\n◎豆瓣评分 ${Number(info.DoubanScore.rating).toFixed(
1
)}/10 from ${addComma(info.DoubanScore.ratingCount)} users\n`
: "") +
(info.DoubanID
? `◎豆瓣链接 https://movie.douban.com/subject/${info.DoubanID}/\n`
: "") +
(info.durations && info.durations.length
? "◎片  长 " + info.durations.join(" / ") + "\n"
: "") +
(info.episodeDuration
? "◎单集片长 " + info.episodeDuration + "\n"
: "") +
(info.episodeCount ? "◎集  数 " + info.episodeCount + "\n" : "") +
(info.celebrities
? Object.entries(info.celebrities)
.map((e) => {
const position = e[1].position;
let title = "◎";
switch (position.length) {
case 1:
title += "   " + position + " ";
break;
case 2:
title += position.split("").join("  ") + " ";
break;
case 3:
title += position.split("").join("  ") + " ";
break;
case 4:
title += position + " ";
break;
default:
title += position + "\n      ";
}
const people = e[1].people
.map((f, i) => {
const name = f.name.chs
? f.name.for
? f.name.chs + " / " + f.name.for
: f.name.chs
: f.name.for;
return (
(i > 0 ? "      " : "") +
name +
(f.character ? ` | ${f.character}` : "")
);
})
.join("\n");
return title + people;
})
.join("\n") + "\n\n"
: "") +
(info.tags.length ? "◎标  签 " + info.tags.join(" | ") + "\n\n" : "") +
(info.description
? "◎简  介 \n" + info.description.replace(/^|\n/g, "\n  ") + "\n\n"
: "") +
(info.awards.length
? "◎获奖情况 \n\n" +
info.awards
.map((e) => {
const awardName = "  " + e.name + " (" + e.year + ")\n";
const awardItems = e.awards
.map((e) => "  " + e.name + (e.people ? " " + e.people : ""))
.join("\n");
return awardName + awardItems;
})
.join("\n\n") +
"\n\n"
: "") +
(info.behindTheScene
? (info.behindTheScene.classicLineList &&
info.behindTheScene.classicLineList.length > 0
? "◎台词金句\n\n  " +
info.behindTheScene.classicLineList
.map((e) => e.replace(/\r?\n/g, "\n  "))
.join("\n  ") +
"\n\n"
: "") +
(info.behindTheScene.behindTextList &&
info.behindTheScene.behindTextList.length > 0
? "◎幕后揭秘\n\n  " +
info.behindTheScene.behindTextList
.map((e) =>
decodeEntities(e)
.replace(/<.+?>/g, "")
.replace(/  /g, "\n\n  ")
.trim()
)
.join("\n\n  ") +
"\n\n"
: "")
: "")
).trim();
return infoText;
}
$("body").append($copyPaste);
$("#info").append($toggle).append(" ").append($infoGen).append($message);
$infoGen.state = 0;
const infoGenClickEvent = async (e) => {
switch ($infoGen.state) {
case 0: //获取
$infoGen.off("click");
$infoGen.text("获取中...");
$copyPaste.val(formatInfo(await getInfo()));
$infoGen.state = 1;
$infoGen.text("复制");
$infoGen.on("click", infoGenClickEvent);
break;
case 1: //复制
{
const copyResult = jsCopy($copyPaste[0]);
if (copyResult) {
$message
.css({ color: "green" })
.text("复制成功")
.fadeIn(200, () => $message.fadeOut(200));
} else {
$message
.css({ color: "red" })
.text("复制失败")
.fadeIn(200, () => $message.fadeOut(200));
}
}
break;
}
};
$infoGen.on("click", infoGenClickEvent);
})(window.$.noConflict(true));
// ==UserScript==
// @name Font-sub:Sarasa-Gothic
// @name:en-US Font substitute: Sarasa Gothic
// @name:zh-CN 字体替换:更纱黑体
// @name:zh-TW 字体替换:更紗黑體
// @name:zh-HK 字体替换:更紗黑體
// @name:ja-JP フォント置換:更紗ゴシック
// @name:ko-KR 글꼴 대체:사라사고딕
// @namespace https://gist.github.com/heartnn/23bb0963d7db22504a3f0db2e338c821
// @version 99
// @author zozovo
// @description Substitute fonts with Sarasa Gothic CJK and Sarasa Mono.
// @description:en-US Substitute fonts with Sarasa Gothic CJK and Sarasa Mono.
// @description:zh-CN 将字体替换为 更纱黑体(中日韩)和 等宽更纱黑体。
// @description:zh-TW 將字體替換為 更紗黑體(中日韓)和 等寬更紗黑體。
// @description:zh-HK 將字體替換為 更紗黑體(中日韓)和 等寬更紗黑體。
// @description:ja-JP フォントを 更紗ゴシック(CJK) および 更紗ゴシック Mono に 置き換えます。
// @description:ko-KR 글꼴을 사라사고딕 CJK 및 사라사고딕 Mono 교체합니다.
// @match *://*/*
// @run-at document-start
// @grant GM_addStyle
// @license MIT
// @supportURL https://gist.github.com/heartnn/23bb0963d7db22504a3f0db2e338c821
// ==/UserScript==
GM_addStyle(`
@font-face {
font-family: "Color Emoji";
src: local("Apple Color Emoji"), local("Noto Color Emoji"), local("Segoe UI Emoji");
unicode-range: U+200C, U+200D, U+FE0E, U+FE0F, U+2190-21FF, U+27F?, U+2900-297F, U+2B??, U+23??, U+25A0-27BF, U+32??, U+1F???
}
@font-face {
font-family: "Monochrome Emoji";
src: local("Apple Monochrome Emoji"), local("Noto Emoji"), local("Segoe Fluent Icons"), local("Segoe MDL2 Assets");
unicode-range: U+200C, U+200D, U+FE0E, U+FE0F, U+2190-21FF, U+27F?, U+2900-297F, U+2B??, U+23??, U+25A0-27BF, U+32??, U+1F???
}
@font-face {
font-family: "Consolas";
src: local("Sarasa Fixed SC"), local("Sarasa Fixed HC"), local("Sarasa Fixed TC"), local("Sarasa Fixed J"), local("Sarasa Fixed K")
}
@font-face {
font-family: "Courier New";
src: local("Sarasa Fixed SC"), local("Sarasa Fixed HC"), local("Sarasa Fixed TC"), local("Sarasa Fixed J"), local("Sarasa Fixed K")
}
:root {
--icon-font-family: "Color Emoji", "Monochrome Emoji", dzicon;
--normal-font-family: "Sarasa UI SC";
--code-font-family: "Sarasa Fixed SC"
}
:is([lang$=HK], [lang$=MO]) {
--normal-font-family: "Sarasa UI HC";
--code-font-family: "Sarasa Fixed HC"
}
:is([lang$=TW], [lang$=hant]) {
--normal-font-family: "Sarasa UI TC";
--code-font-family: "Sarasa Fixed TC"
}
:lang(ja) {
--normal-font-family: "Sarasa UI J";
--code-font-family: "Sarasa Fixed J"
}
:lang(ko) {
--normal-font-family: "Sarasa UI K";
--code-font-family: "Sarasa Fixed K"
}
:not(#_#_) :not([class*=fa-], [class*=icon]):not([aria-hidden="true"] *, [role="presentation"] *, [role="none"] *) {
&:not(i, s, a:hover, span, textarea):not([aria-hidden="true"], [role="presentation"], [role="none"]) {
font-family: var(--icon-font-family), var(--normal-font-family), system-ui;
&:where(pre, code, samp, kbd, var),
&:where([class*=font-mono], [class*=cm-]) {
font-family: var(--icon-font-family), var(--code-font-family), monospace;
& :not(i, a, span) {
font-family: var(--icon-font-family), var(--code-font-family), monospace;
}
}
&:where([class*=code]:not(#readme, .readme)) {
font-family: var(--icon-font-family), var(--code-font-family), monospace;
}
}
}
`);
// ==UserScript==
// @name Inoreader去广告
// @description 去掉Inoreader的页面广告和升级按钮
// @author heartnn
// @version 1.0.0
// @grant none
// @noframes
// @include http://www.inoreader.com/*
// @include https://www.inoreader.com/*
// @icon http://www.inoreader.com/favicon.ico
// ==/UserScript==
/*jshint multistr: true */
var styleEl = document.createElement('style');
styleEl.type = 'text/css';
styleEl.innerHTML = "\
#sb_rp_tools,#sb_rp_notifications,#sb_rp_gear{margin-right:-74px;}\
.block_article_ad,.ad_title,#sinner_container,#sb_rp_upgrade_button,div.trc_rbox_container,div.ad_size_large_rectangle,div.sinner_under_footer{display: none !important;}\
#reader_pane.reader_pane_sinner{padding-right:0px;}\
";
document.documentElement.appendChild(styleEl);
// ==UserScript==
// @name 【转盘助手油猴版】网盘链接状态实时判断
// @namespace https://greasyfork.org/users/10250
// @version 2.0.2-fix
// @description 功能介绍:网盘链接状态判断:实时判断网页中百度网盘链接状态,节约时间,方便又快捷。
// @author heartnn
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAOESURBVGhD7ZhPSFRRHIWzhUaISpQUBLmQsECiFoUIYdFCRA3CTURLiRB31SKkEAwCtT/Qqk0UEejaQjdiCoYbsRDMAo200mIyM5x5M753OteuzhvffX/GueMkzPfx2/ju1XPG9+447sA2J1sg02QLZJpsgUyTLbCR9/QpvUWbaDNtpV10hupGS4EQbaOldIeHOfQEfUiXqA5SKmDSB7SI2oP6mUfnqA42XeAXPUPtwYJ6mepi0wXEq3+a2oMFdYTqIqVbaJoWUHs4P09RnaT8ED+h9oB+Pqc6SbmA4AK1h3RzPzWoTrQU+EEPUHtYlbepbrQUELyk4py3B7abS79S3WgrILhK7aHtXqTpQGuBP/QwFYH30QYqno9COkzTgdYCAnHGP6IRusYyTRfaC2w1aSuwGBnHzGIXvi29QsxclF/VT1oKhJbfYPz7zfX5EGqHacVvKZ2kpcCH0L2EAmJ+hcfkVb57PwE6O4HWVuDaNeDKFeDSJeD8eeDsWeDkSeDIEeDgQeDtW7nJhc0XsCxgYQHWu3cwe3pgvn4tLwAfQ/cdBRbCo/IqUFjIH8yfHGSGfQ4vLvEgHIY5NATzxQus3L2LWFMTovX1MI4fR2TvXkRyc9cnWlkpNwE/wyMJ4Sdtt9BXvpfl5DiDus1ovLcSLnHHmp5OCOk5u3bBmpqSO/89xLO/uzH3p5cPcfzTV2OjM6TXzPh8CuUSDyI8zXfvVgdWTLSmhoe++swXd1xLizOg1xQU8HOHKb+BC1zmjXHsmDKs2xhHj8IaH5e74yzxl3DokDOk11RXy80ecJk3seZmZVDX2bOHD8FPuTuRgQFg505nULd5/Fhu9IDLvDH7+9VBXSZ244bcqeb6dWdQ1RQV8TkK8P7HpT7wJjTKy5VhHZOfD2t2Vm5Uw8cKvCuVoe3T1iY3+MCl/pjd3erAGyYmjpgA8K0DeXnO0GtTVrZ6ggeCywPAIyRaV6cMvT7iGJ2YkBv8aW93BhfDXyLG4m/avnBLMKz5eRilperwnGhDg1wZDHE8VlUlhudrgL4+uSAggQsIrMlJGCUlygLmSPL/6/n0Kf5nRXExMDgoLyRBUgUE1ufPMCoqEsJHz52TV5Pn2TOgthb48kV+IUmSLrCKYWDlzh1EeNatvvq9vfLC1rO5AhKLf5mtdHSsPuSZIqUC/wPZApkmWyDTZAtkmm1eAPgL6lT4ekNP9cAAAAAASUVORK5CYII=
// @match *://*/*
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_setValue
// @connect pan.baidu.com
// @run-at document-end
// @compatible Chrome
// @compatible Firefox
// @compatible Edge
// @compatible Safari
// @compatible Opera
// @compatible UC
// ==/UserScript==
! function (e, t) {
"object" == typeof module && module.exports ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : e.findAndReplaceDOMText = t()
}(this, function () {
var e = "retain",
t = document,
n = {}.hasOwnProperty;
function r() {
return function (e, t, n, o, d) {
if (t && !t.nodeType && arguments.length <= 2) return !1;
var a = "function" == typeof n;
a && (s = n, n = function (e, t) {
return s(e.text, t.startIndex)
});
var s;
var p = i(t, {
find: e,
wrap: a ? null : n,
replace: a ? n : "$" + (o || "&"),
prepMatch: function (e, t) {
if (!e[0]) throw "findAndReplaceDOMText cannot handle zero-length matches";
if (o > 0) {
var n = e[o];
e.index += e[0].indexOf(n), e[0] = n
}
return e.endIndex = e.index + e[0].length, e.startIndex = e.index, e.index = t, e
}, filterElements: d
});
return r.revert = function () {
return p.revert()
}, !0
}.apply(null, arguments) || i.apply(null, arguments)
}
function i(e, t) {
return new o(e, t)
}
function o(t, i) {
var o = i.preset && r.PRESETS[i.preset];
if (i.portionMode = i.portionMode || e, o)
for (var d in o) n.call(o, d) && !n.call(i, d) && (i[d] = o[d]);
this.node = t, this.options = i, this.prepMatch = i.prepMatch || this.prepMatch, this.reverts = [], this.matches = this.search(), this.matches.length && this.processMatches()
}
return r.NON_PROSE_ELEMENTS = {
br: 1,
hr: 1,
script: 1,
style: 1,
img: 1,
video: 1,
audio: 1,
canvas: 1,
svg: 1,
map: 1,
object: 1,
input: 1,
textarea: 1,
select: 1,
option: 1,
optgroup: 1,
button: 1
}, r.NON_CONTIGUOUS_PROSE_ELEMENTS = {
address: 1,
article: 1,
aside: 1,
blockquote: 1,
dd: 1,
div: 1,
dl: 1,
fieldset: 1,
figcaption: 1,
figure: 1,
footer: 1,
form: 1,
h1: 1,
h2: 1,
h3: 1,
h4: 1,
h5: 1,
h6: 1,
header: 1,
hgroup: 1,
hr: 1,
main: 1,
nav: 1,
noscript: 1,
ol: 1,
output: 1,
p: 1,
pre: 1,
section: 1,
ul: 1,
br: 1,
li: 1,
summary: 1,
dt: 1,
details: 1,
rp: 1,
rt: 1,
rtc: 1,
script: 1,
style: 1,
img: 1,
video: 1,
audio: 1,
canvas: 1,
svg: 1,
map: 1,
object: 1,
input: 1,
textarea: 1,
select: 1,
option: 1,
optgroup: 1,
button: 1,
table: 1,
tbody: 1,
thead: 1,
th: 1,
tr: 1,
td: 1,
caption: 1,
col: 1,
tfoot: 1,
colgroup: 1
}, r.NON_INLINE_PROSE = function (e) {
return n.call(r.NON_CONTIGUOUS_PROSE_ELEMENTS, e.nodeName.toLowerCase())
}, r.PRESETS = {
prose: {
forceContext: r.NON_INLINE_PROSE,
filterElements: function (e) {
return !n.call(r.NON_PROSE_ELEMENTS, e.nodeName.toLowerCase())
}
}
}, r.Finder = o, o.prototype = {
search: function () {
var e, t = 0,
n = 0,
r = this.options.find,
i = this.getAggregateText(),
o = [],
d = this;
return r = "string" == typeof r ? RegExp(String(r).replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1"), "g") : r,
function i(a) {
for (var s = 0, p = a.length; s < p; ++s) {
var h = a[s];
if ("string" == typeof h) {
if (r.global)
for (; e = r.exec(h);) o.push(d.prepMatch(e, t++, n));
else(e = h.match(r)) && o.push(d.prepMatch(e, 0, n));
n += h.length
} else i(h)
}
}(i), o
}, prepMatch: function (e, t, n) {
if (!e[0]) throw new Error("findAndReplaceDOMText cannot handle zero-length matches");
return e.endIndex = n + e.index + e[0].length, e.startIndex = n + e.index, e.index = t, e
}, getAggregateText: function () {
var e = this.options.filterElements,
t = this.options.forceContext;
return function n(r) {
if (r.nodeType === Node.TEXT_NODE) return [r.data];
if (e && !e(r)) return [];
var i = [""];
var o = 0;
if (r = r.firstChild)
do {
if (r.nodeType !== Node.TEXT_NODE) {
var d = n(r);
t && r.nodeType === Node.ELEMENT_NODE && (!0 === t || t(r)) ? (i[++o] = d, i[++o] = "") : ("string" == typeof d[0] && (i[o] += d.shift()), d.length && (i[++o] = d, i[++o] = ""))
} else i[o] += r.data
} while (r = r.nextSibling);
return i
}(this.node)
}, processMatches: function () {
var e, t, n, r = this.matches,
i = this.node,
o = this.options.filterElements,
d = [],
a = i,
s = r.shift(),
p = 0,
h = 0,
l = [i];
e: for (;;) {
if (a.nodeType === Node.TEXT_NODE && (!t && a.length + p >= s.endIndex ? t = {
node: a,
index: h++,
text: a.data.substring(s.startIndex - p, s.endIndex - p),
indexInMatch: 0 === p ? 0 : p - s.startIndex,
indexInNode: s.startIndex - p,
endIndexInNode: s.endIndex - p,
isEnd: !0
} : e && d.push({
node: a,
index: h++,
text: a.data,
indexInMatch: p - s.startIndex,
indexInNode: 0
}), !e && a.length + p > s.startIndex && (e = {
node: a,
index: h++,
indexInMatch: 0,
indexInNode: s.startIndex - p,
endIndexInNode: s.endIndex - p,
text: a.data.substring(s.startIndex - p, s.endIndex - p)
}), p += a.data.length), n = a.nodeType === Node.ELEMENT_NODE && o && !o(a), e && t) {
if (a = this.replaceMatch(s, e, d, t), p -= t.node.data.length - t.endIndexInNode, e = null, t = null, d = [], h = 0, 0, !(s = r.shift())) break
} else if (!n && (a.firstChild || a.nextSibling)) {
a.firstChild ? (l.push(a), a = a.firstChild) : a = a.nextSibling;
continue
}
for (;;) {
if (a.nextSibling) {
a = a.nextSibling;
break
}
if ((a = l.pop()) === i) break e
}
}
}, revert: function () {
for (var e = this.reverts.length; e--;) this.reverts[e]();
this.reverts = []
}, prepareReplacementString: function (e, t, n) {
var r = this.options.portionMode;
return "first" === r && t.indexInMatch > 0 ? "" : (e = e.replace(/\$(\d+|&|`|')/g, function (e, t) {
var r;
switch (t) {
case "&":
r = n[0];
break;
case "`":
r = n.input.substring(0, n.startIndex);
break;
case "'":
r = n.input.substring(n.endIndex);
break;
default:
r = n[+t] || ""
}
return r
}), "first" === r ? e : t.isEnd ? e.substring(t.indexInMatch) : e.substring(t.indexInMatch, t.indexInMatch + t.text.length))
}, getPortionReplacementNode: function (e, n) {
var r = this.options.replace || "$&",
i = this.options.wrap,
o = this.options.wrapClass;
if (i && i.nodeType) {
var d = t.createElement("div");
d.innerHTML = i.outerHTML || (new XMLSerializer).serializeToString(i), i = d.firstChild
}
if ("function" == typeof r) return (r = r(e, n)) && r.nodeType ? r : t.createTextNode(String(r));
var a = "string" == typeof i ? t.createElement(i) : i;
return a && o && (a.className = o), (r = t.createTextNode(this.prepareReplacementString(r, e, n))).data && a ? (a.appendChild(r), a) : r
}, replaceMatch: function (e, n, r, i) {
var o, d, a = n.node,
s = i.node;
if (a === s) {
var p = a;
n.indexInNode > 0 && (o = t.createTextNode(p.data.substring(0, n.indexInNode)), p.parentNode.insertBefore(o, p));
var h = this.getPortionReplacementNode(i, e);
return p.parentNode.insertBefore(h, p), i.endIndexInNode < p.length && (d = t.createTextNode(p.data.substring(i.endIndexInNode)), p.parentNode.insertBefore(d, p)), p.parentNode.removeChild(p), this.reverts.push(function () {
o === h.previousSibling && o.parentNode.removeChild(o), d === h.nextSibling && d.parentNode.removeChild(d), h.parentNode.replaceChild(p, h)
}), h
}
o = t.createTextNode(a.data.substring(0, n.indexInNode)), d = t.createTextNode(s.data.substring(i.endIndexInNode));
for (var l = this.getPortionReplacementNode(n, e), c = [], f = 0, u = r.length; f < u; ++f) {
var x = r[f],
N = this.getPortionReplacementNode(x, e);
x.node.parentNode.replaceChild(N, x.node), this.reverts.push(function (e, t) {
return function () {
t.parentNode.replaceChild(e.node, t)
}
}(x, N)), c.push(N)
}
var g = this.getPortionReplacementNode(i, e);
return a.parentNode.insertBefore(o, a), a.parentNode.insertBefore(l, a), a.parentNode.removeChild(a), s.parentNode.insertBefore(g, s), s.parentNode.insertBefore(d, s), s.parentNode.removeChild(s), this.reverts.push(function () {
o.parentNode.removeChild(o), l.parentNode.replaceChild(a, l), d.parentNode.removeChild(d), g.parentNode.replaceChild(s, g)
}), g
}
}, r
});
var pageTexts = {
html404Title:"页面不存在",
htmlNonExistent:"链接不存在",
htmlNeedPassword:"请输入提取码",
htmlNormal:"分享无限制",
}
var server_window_url = window.location.href;
//链接状态判断
var validateUrl = {};
var elementObjects = {};
var saveKey = []; //保存对象的key,用shortUrl代替
var validateUrl = {};
validateUrl.analysisBaiduPanUrl = function(){
if (findAndReplaceDOMText(document.body, {
find: /(?:https?:\/\/)?pan\.baidu\.com\/s\/([\w\-]{4,25})\b/g,
replace: function (e, t) {
let pluginNode, createNode, node = e.node,
s = t[0],
a = !1;
for (; node = node.parentNode;) {
if ("QUZHUANPAN-PLUGIN" === node.nodeName) {
pluginNode = node;
break
}
if ("BODY" === node.nodeName || "HTML" === node.nodeName) break;
!a && "A" === node.nodeName && node.href && (a = !0)
}
if (pluginNode){
createNode = e.text;
}else {
if (pluginNode = document.createElement("QUZHUANPAN-PLUGIN"), 0 == e.index) {
let t = document.createElement("QUZHUANPAN-PLUGIN-TIPS");
t.setAttribute("title", ""), pluginNode.appendChild(t);
let createNode = document.createTextNode(e.text);
pluginNode.appendChild(createNode)
} else pluginNode.textContent = e.text;
a || (pluginNode.onclick = function (e) {
e.stopPropagation();
e.preventDefault();
if(s.indexOf("https") == -1){ s = s.replace("http","https"); }
if(s.indexOf("https://") == -1){
s = "https://"+url;
}
window.open(s, "_blank");
}), createNode = pluginNode
}
let c = t[1];
return elementObjects[c] ? elementObjects[c].elements.push(pluginNode) : elementObjects[c] = {
elements: [pluginNode],
pwd: ""
}, saveKey.push(c), createNode
}, preset: "prose"
}));
};
validateUrl.addCssForPlugin = function(){
var css ="QUZHUANPAN-PLUGIN {display: inline;cursor: pointer;}"+
"QUZHUANPAN-PLUGIN-TIPS {white-space: nowrap;}"+
".QUZHUANPAN-PLUGIN-VALIDATE-NOTPASS {text-decoration: line-through;color: #ccc;}"+
"QUZHUANPAN-PLUGIN-TIPS::before {background-position: center;background-size: 100% 100%;background-repeat: no-repeat;box-sizing: border-box;width: 1em;height: 1em;margin: 0 1px .15em 1px;vertical-align: middle;display: inline-block;}"+
".QUZHUANPAN-PLUGIN-VALIDATE-NOTPASS>QUZHUANPAN-PLUGIN-TIPS::before {content: '';background-image: url(http://www.quzhuanpan.com/media/tampermonkey/tips/error.png)}"+
".QUZHUANPAN-PLUGIN-VALIDATE-PASS>QUZHUANPAN-PLUGIN-TIPS::before {content: '';background-image: url(http://www.quzhuanpan.com/media/tampermonkey/tips/success.png)}"+
".QUZHUANPAN-PLUGIN-VALIDATE-UNCERTAINTY>QUZHUANPAN-PLUGIN-TIPS::before {content: '';background-image: url(http://www.quzhuanpan.com/media/tampermonkey/tips/uncertainty.png)}"+
".QUZHUANPAN-PLUGIN-VALIDATE-LOCK>QUZHUANPAN-PLUGIN-TIPS::before{content: '';background-image: url(http://www.quzhuanpan.com/media/tampermonkey/tips/lock.png)}";
var $body = document.getElementsByTagName("body")[0];
var $style = document.createElement("style");
$style.innerHTML=css;
$body.appendChild($style);
};
//异步方法
validateUrl.judge = function(url, elements){
let obj = {"judgeResult":""};
var baiduXhr = new XMLHttpRequest();
if(url.indexOf("https") == -1){ url = url.replace("http","https"); }
if(url.indexOf("https://") == -1){
url = "https://"+url;
}
GM_xmlhttpRequest({
url: url,
method: "GET",
headers: {"Content-Type": "application/x-www-form-urlencoded"},
onload: function(response) {
var status = response.status;
if(status==200||status=='200'){
var responseText = response.responseText;
if(!responseText){ //为空,地址出现了重定向 或 其它情况
obj.judgeResult = "isUncertainty";
}else{
responseText = responseText.replace(/\s+/g, "");
if(responseText.length > 5000){
responseText = responseText.substring(0,4999);
}
if(responseText.indexOf(pageTexts.htmlNonExistent)!= -1){
obj.judgeResult = "isNonExistent"; //不存在, 资源被和谐
}
else if(responseText.indexOf(pageTexts.htmlNeedPassword) != -1){
obj.judgeResult = "isNeedPassword"; //需要密码
}
else if(responseText.indexOf(pageTexts.htmlNormal) != -1){
obj.judgeResult = "isOk"; //正常链接
}
else if(responseText.indexOf(pageTexts.html404Title) != -1){
//不确定的链接,可能是访问太快,百度返回链接未找到
obj.judgeResult = "isUncertainty";
}
}
var $ele;
for(let i = 0; i < elements.length; i++){
$ele = elements[i];
if(obj.judgeResult == "isOk"){ //链接正常
$ele.classList.add("QUZHUANPAN-PLUGIN-VALIDATE-PASS");
}
else if(obj.judgeResult == "isNonExistent"){ //不存在
$ele.classList.add("QUZHUANPAN-PLUGIN-VALIDATE-NOTPASS");
}
else if(obj.judgeResult == "isNeedPassword"){ //需要密码
$ele.classList.add("QUZHUANPAN-PLUGIN-VALIDATE-LOCK");
}
else if(obj.judgeResult == 'isUncertainty'){ //不确定
$ele.classList.add("QUZHUANPAN-PLUGIN-VALIDATE-UNCERTAINTY");
}
}
}
}
});
};
validateUrl.sleep = function(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime) {
return;
}
}
};
validateUrl.createRandom = function(low, high){
return Math.floor(Math.random()*(high-low)+low);
};
validateUrl.collectAndDealUrl = function(){
let copySaveKey = new Array();
let isExist = false;
for (let e = 0; e < saveKey.length; e++) { //过滤相同key
isExist = false;
for(let k=0;k<copySaveKey.length;k++){
if(saveKey[e] == copySaveKey[k]){
isExist = true;
break;
}
}
if(!isExist){
copySaveKey.push(saveKey[e]);
}
}
for (let e = 0; e < copySaveKey.length; e++) {
let elementObject = elementObjects[copySaveKey[e]];
let elements = elementObject.elements;
let url = "";
for(let i = 0; i < elements.length; i++){
url = url + elements[i].innerText;
if(url.indexOf("pan.baidu.com/s/")!=-1){
break;
}
}
if(!!url){
validateUrl.judge(url, elements);
}
}
};
//提取资源
var resourcePickup={};
resourcePickup.get_baidu_code = function(){
var $a = document.getElementsByTagName("a");
for(var i=0;i<$a.length;i++){
var classs = $a[i].getAttribute("class");
if(classs.indexOf("g-button")!=-1 && classs.indexOf("g-button-blue-large")){
$a[i].addEventListener("click", function(){
var $inputs = document.getElementsByTagName("input");
var input_code = "****";
for(var j=0;j<$inputs.length;j++){
var tabindex = $inputs[j].getAttribute("tabindex");
var type = $inputs[j].getAttribute("type");
if((tabindex==1||tabindex=='1') && (type=='text'||type=='TEXT') ){
input_code = $inputs[j].value;
if(!input_code){
input_code = "****";
}
}
}
GM_setValue("plugin_code",input_code);
GM_setValue("plugin_pickup_time",new Date().getTime());
GM_setValue("init_window_url",server_window_url);
}, false);
}
}
};
resourcePickup.getElementsByClass = function(oParent, sClass){
var aResult=[];
try {
var aEle=oParent.getElementsByTagName('*');
for(var i=0;i<aEle.length;i++){
if(aEle[i].className==sClass)
{
aResult.push(aEle[i]);
}
}
} catch (e) {
console.log("quzhuanpan tampermonkey scprit exception for getElementsByClass。。。"+e.message);
}
return aResult;
};
resourcePickup.get_baidu_share = function(){
var plugin_code = GM_getValue("plugin_code");
var plugin_pickup_time = GM_getValue("plugin_pickup_time");
var init_window_url = GM_getValue("init_window_url");
if(!init_window_url){init_window_url="";}
var $layoutMain = document.getElementById("layoutMain");
if(!$layoutMain){
$layoutMain = document.getElementById("bd-main");
}
var classArrayObj = resourcePickup.getElementsByClass($layoutMain,"file-name");
var fileName = "";
for(var i=0;i<classArrayObj.length;i++){
if(!fileName){
fileName = classArrayObj[i].getAttribute("title");
}else{
break;
}
}
var isOk = false;
if(!!plugin_code){
var nowTime = new Date().getTime();
if(nowTime - Number(plugin_pickup_time) < 1000*3){
isOk = true;
}
}else{isOk = true;plugin_code="";}
GM_setValue("plugin_code","");
GM_setValue("plugin_pickup_time","");
GM_setValue("init_window_url","");
if(isOk && !!fileName){
var s = document.getElementsByTagName("script");
var num = s.length;
var script;
var text;
var allText = "";
for(var i=0; i< num; i++){
script = s[i];
text = script.innerText;
if(!!text){
text = text.replace(/\t/g,"");
text = text.replace(/\r/g,"");
text = text.replace(/\n/g,"");
text = text.replace(/\+/g,"%2B");//"+"
text = text.replace(/\&/g,"%26");//"&"
text = text.replace(/\#/g,"%23");//"#"
allText = allText + text; //追加
}
}
var url = window.location.href;
var params = "fileName="+fileName+"&url="+url+"&code="+plugin_code+"&scripts="+allText+"&initUrl="+init_window_url+"";
GM_xmlhttpRequest({
url: "https://www.quzhuanpan.com/browser/js/analysis_tampermonkey",
method: "POST",
headers: {"Content-Type": "application/x-www-form-urlencoded"},
data:params,
onload: function(response) {
var status = response.status;
if(status==200||status=='200'){
//alert(response.responseText);
var serverResponseJson = JSON.parse(response.responseText);
}
}
});
}
};
//所有方法都通过此方法注入油猴,此方法名不可更改
function start_xx_j(){
validateUrl.addCssForPlugin();
if(server_window_url.indexOf("pan.baidu.com/share/init") != -1){
resourcePickup.get_baidu_code();
}else if(server_window_url.indexOf("pan.baidu.com/s/") != -1){
resourcePickup.get_baidu_share();
}else{
validateUrl.analysisBaiduPanUrl();
validateUrl.collectAndDealUrl();
}
}
(function() {
'use strict';
/*
* oTarget:监听对象
* sEventType:监听事件类型,如click,mouseover
* fnHandler:监听函数
*/
function addEventHandler(oTarget, sEventType, fnHandler) {
try {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = fnHandler;
}
}catch (e) {
console.log("quzhuanpan tampermonkey scprit exception。。。"+e.message);
}
}
/*
* 采用事件监听给对象绑定方法后,可以解除相应的绑定
* oTarget:监听对象
* sEventType:监听事件类型,如click,mouseover
* fnHandler:监听函数
*/
function removeEventHandler(oTarget, sEventType, fnHandler) {
try {
if (oTarget.removeEventListener){
oTarget.removeEventListener(sEventType, fnHandler, false);
} else if (oTarget.detachEvent){
oTarget.detachEvent("on" + sEventType, fnHandler);
}else {
delete oTarget["on" + sEventType];
}
}catch (e) {
console.log("quzhuanpan tampermonkey scprit exception。。。"+e.message);
}
}
/**
* @param {Object} oParent
* @param {Object} sClass
* 通过className获取class对象
*/
function getByClass(oParent, sClass){
var aResult=[];
try {
var aEle=oParent.getElementsByTagName('*');
for(var i=0;i<aEle.length;i++){
if(aEle[i].className==sClass)
{
aResult.push(aEle[i]);
}
}
} catch (e) {
console.log("quzhuanpan tampermonkey scprit exception。。。"+e.message);
}
return aResult;
}
//清空一个元素,即删除一个元素的所有子元素
function removeAllChildById(id){
var $div = document.getElementById(id);
if(!!$div){
while($div.hasChildNodes()){
$div.removeChild($div.firstChild);
}
}
}
start_xx_j();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment