-
Notifications
You must be signed in to change notification settings - Fork 4
/
comic.min.js
2 lines (2 loc) · 7.54 KB
/
comic.min.js
1
2
/*! Comic Viewer for Blogger V2 <https://dte-project.github.io/blogger/comic.html> */
!function(e,t){function r(e,t){function r(e){return decodeURIComponent(e)}function n(e){return void 0!==e}function i(e){return"string"==typeof e}function a(e){return i(e)&&""!==e.trim()?'""'===e||"[]"===e||"{}"===e||'"'===e[0]&&'"'===e.slice(-1)||"["===e[0]&&"]"===e.slice(-1)||"{"===e[0]&&"}"===e.slice(-1):!1}function s(e){if(i(e)){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("'"===e.slice(0,1)&&"'"===e.slice(-1))return e.slice(1,-1);if(/^-?(\d*\.)?\d+$/.test(e))return+e;if(a(e))try{return JSON.parse(e)}catch(t){}}return e}function o(e,t,r){for(var n,i=t.split("["),a=0,s=i.length;s-1>a;++a)n=i[a].replace(/\]$/,""),e=e[n]||(e[n]={});e[i[a].replace(/\]$/,"")]=r}var l={},c=e.replace(/^.*?\?/,"");return""===c?l:(c.split(/&(?:amp;)?/).forEach(function(e){var i=e.split("="),a=r(i[0]),c=n(i[1])?r(i[1]):!0;c=!n(t)||t?s(c):c,"]"===a.slice(-1)?o(l,a,c):l[a]=c}),l)}e[t]=r}(window,"q2o"),function(e,t){function r(e){return void 0!==e}function n(e){return"string"==typeof e}function i(e){return"number"==typeof e||/^-?(\d*\.)?\d+$/.test(e)}function a(e){return null!==e&&"object"==typeof e}function s(e,t){t=t||{};for(var n in e)r(t[n])?a(e[n])&&a(t[n])&&(t[n]=s(e[n],t[n])):t[n]=e[n];return t}function o(e,t,r){e.addEventListener(t,r,!1)}function l(e,n,i){if(e=t.createElement(e),r(n)&&""!==n&&(e.innerHTML=n),a(i))for(var s in i)i[s]!==!1&&e.setAttribute(s,i[s]);return e}function c(e,t){t=t.split(/\s+/);for(var r;r=t.shift();)e.classList.add(r)}function f(e,t){t=t.split(/\s+/);for(var r;r=t.shift();)e.classList.remove(r)}function u(e,t,r){t&&e.insertBefore(t,r)}function d(e){e.parentNode&&e.parentNode.removeChild(e)}function h(e,t){return e=(e+"").split(/[?&#]/)[0].replace(/\/+$/,""),r(t)&&(e=e.replace(/\.[\w-]+$/,t?"."+t:"")),e}function p(e){return("file:"===C.protocol?"https:":"")+"//www.blogger.com/feeds/"+e+"/posts/summary"}function v(e,t,r){var n=/\.css$/i.test(h(e)),i=l(n?"link":"script","",s(n?{href:e,rel:"stylesheet"}:{src:e},r));return i.readyState?i.onreadystatechange=function(){("loaded"===i.readyState||"complete"===i.readyState)&&(i.onreadystatechange=null,t&&t(i))}:t&&o(i,"load",t),u(j,i,j.firstChild),i}function g(e,t,r){r=r||[],r.unshift(t),"function"==typeof z&&z.apply(e,r)}function m(e,t){return Math.floor(Math.random()*(t-e+1))+e}function y(e){return e.replace(/<\/?(\w+)(?:\s[^<>])?>/g,function(e,t){return/^a(bbr)?|br?|blockquote|c(aption|ite|ode)|del|h(r|[0-6])|ins|li|[ou]l|p(re)?|s(u[bp])?|t(able|body|head|foot|[dhr])|u|var$/i.test(t)?e:""}).trim()}function b(e,t){return e.replace(/\/[a-z]\d+(-[a-z](\d+)?)*\//,function(){return/^\d+$/.test(t+"")&&(t="s"+t),"/"+t+"/"})}function x(e,t,r,n,i,a,s,o,l){var c,f,u,d=1,h=Math.ceil(t/r),p="";if(h>1){if(e>n+n?e>h-n-n?(f=h-n-n,u=h):(f=e-n,u=e+n):(f=d,u=Math.min(d+n+n,h)),s&&(p="<span>",p+=e===d?'<b title="'+s+'">'+s+"</b>":'<a href="'+i(e-1)+'" title="'+s+'" rel="prev">'+s+"</a>",p+="</span> "),a&&l){for(p+="<span>",f>d&&(p+='<a href="'+i(d)+'" title="'+a+'" rel="prev">'+d+"</a>",f>d+1&&(p+=" <span>…</span>")),c=f;u>=c;++c)p+=e===c?' <b title="'+c+'">'+c+"</b>":' <a href="'+i(c)+'" title="'+c+'" rel="'+(c>e?"next":"prev")+'">'+c+"</a>";h>u&&(h-1>u&&(p+=" <span>…</span>"),p+=' <a href="'+i(h)+'" title="'+l+'" rel="next">'+h+"</a>"),p+="</span>"}return o&&(p+=" <span>",p+=e===h?'<b title="'+o+'">'+o+"</b>":'<a href="'+i(e+1)+'" title="'+o+'" rel="next">'+o+"</a>",p+="</span>"),p}}function w(e){e&&(ft.innerHTML=""),v(p("298900102869691923")+"?alt=json&max-results=0&callback=_"+S,function(){var e=ft.offsetWidth;et.style.width=e?e+"px":"100%",ct.style.height=""})}function $(e,r){if(e===!0)w();else{var n=t.createElement("img");n.src=e,o(n,"load",function(){this.width=this.offsetWidth,this.height=this.offsetHeight,++pt,r&&pt!==Q||(f(et,"loading"),d(tt),et.style.width=ft.offsetWidth+"px",ct.style.height=ft.offsetHeight+"px"),g(this,"load.asset",[this.src])}),o(n,"error",function(){c(et,"error"),d(tt),g(this,"error.asset",[this.src])}),c(et,"loading"),u(et,tt,dt),u(ft,n)}}function k(e){if(f(et,"error"),f(et,"loading"),ft.innerHTML="",i(e)){pt=0;for(var t=0;Q>t&&Z[e][t];++t)$(Z[e][t],1)}else n(e)?$(e):w(1)}function L(e){dt.innerHTML=n(e)?e:e>0?"<p>"+x(e,Y,Q,V,function(e){return"#"+F.replace("%i%",e)},J.first,J.previous,J.next,J.last)+"</p>":""}function M(e){var t=F.replace("%i%","(-?(?:\\d*\\.)?\\d+)"),r=RegExp("^#?"+t+"$").exec(C.hash);r=r&&r[1]&&+r[1]||0,0===r?(k(ot),L('<p><span><a href="#'+F.replace("%i%",1)+'">'+J.enter+"</a></span></p>")):0>r||r>Y?(w(1),L()):(k(r-1),L(r),u(dt,l("h3",J.current.replace("%i%",r).replace("%i~%",Math.ceil(Y/Q))),dt.firstChild)),et.className=rt+" step-"+r,e&&g(et,"change",[r])}var N=e.q2o,H=t.currentScript,C=e.location,S=Date.now(),T={i:S,hash:"!page=%i%",direction:"ltr",name:"js-comic",css:1,ad:!0,save:!0,source:".type\\:comic",find:"a[href],img[src]",container:0,image:1600,chunk:1,kin:2,top:0,text:{loading:"Loading…",first:"First",previous:"Previous",next:"Next",last:"Last",current:"Page %i% of %i~%",enter:"Read on…",exit:"Home"}},j=t.head,q=s(T,N(H.src)),E=t.querySelector(q.source);if(E){var R=N(C.search);r(R[_])&&(q=s(q,R[_]));var _=q.i,B=q.name,W=q.ad,z=q.e;z=z&&e[z],W===!0&&(W=10);var A,D,I,O,P,F=q.hash,J=q.text,U=E.querySelectorAll(q.find),G=q.image,K=q.direction,Q=q.chunk,V=q.kin,X={},Y=0,Z=[],et=l("div",'<div class="'+B+"-image "+B+'-height" style="overflow:hidden;"'+(q.save?"":' oncontextmenu="return false;"')+'><div style="float:left;"></div></div><div class="'+B+'-content"></div><div class="'+B+'-controls"></div>',{"class":B+" "+B+"-width "+K+" loading",id:B+":"+_}),tt=l("p",J.loading,{"class":B+"-loading"}),rt=et.className,nt=t.body,it=nt.parentNode;for(D=0,I=U.length;I>D;++D){O=U[D],P=O.parentNode;var at=/\.(gif|jpe?g|png)$/i;if(!(P&&P.href&&at.test(P.href))){for(A=b(O.href&&at.test(O.href.split("?")[0])&&O.href||O.src,G);O!==E&&O.parentNode!==E;)O=O.parentNode;X[A]=O}}for(D in X)d(X[D]);X=Object.keys(X);var st,ot=X.shift(),lt=et.children,ct=lt[0],ft=ct.firstChild,ut=lt[1],dt=lt[2],ht=l("div");for(Y=X.length,ht.innerHTML=y(E.innerHTML);st=ht.firstChild;)ut.appendChild(st);for(W&&(X.splice(m(1,Y),0,!0),Y+=1),D=0;Y>D;D+=Q)Z.push(X.slice(D,D+Q));var pt=0;M(),o(e,"hashchange",M),o(dt,"click",function(e){var t,r=e.target,n=q.top;"a"===r.nodeName.toLowerCase()&&(n!==!1&&(t=et.getBoundingClientRect().top-n,nt.scrollTop+=t,it.scrollTop+=t),C.hash=r.hash,g(r,"click",[r.href]),e.preventDefault())}),e["_"+(S+1)]=function(e){e=e.feed||{};var t,r,n,i=e.entry||[],a=i.length,s=l("ul","",{"class":B+"-ads"}),o=' style="display:block;width:80px;height:80px;">';if(a){for(t=0;W>t&&t!==W;++t){r=i[t],n="media$thumbnail"in r?'<img alt="" src="'+r.media$thumbnail.url.replace(/\/s\d+(-c)?\//,"/s80-c/")+'" width="80" height="80"'+o:'<span class="img"'+o+"</span>";var c=(r.link.find(function(e){return"alternate"===e.rel})||{}).href;c&&(n+='<h3><a href="'+c+'" target="_blank">'+e.title.$t+" · "+r.title.$t+"</a></h3>",n+="<p>"+r.summary.$t.replace(/<.*?>/g,"").replace(/[<>]/g,"").slice(0,200)+"…</p>",u(s,l("li",n)))}u(ft,s),f(et,"error"),f(et,"loading"),d(tt),g(s,"load.ad",[e])}},e["_"+S]=function(e){e=e.feed||{};var t=m(1,+e.openSearch$totalResults.$t-W);v(p("298900102869691923")+"?alt=json&orderby=updated&start-index="+t+"&max-results="+(W||0)+"&callback=_"+(S+1))},H.id||(H.id=B+"-js"),c(H,B+"-js");var st=q.container,vt=q.css;vt&&!t.getElementById(B+"-css")&&v(n(vt)?vt:h(H.src,"css"),function(){g(this,"load.asset",[this.href])},{"class":B+"-css",id:B+"-css"}),st&&(E.style.display="none",E=t.querySelector(st)),E.innerHTML="",u(E,et),g(et,"ready",[q,et])}}(window,document);