-
Notifications
You must be signed in to change notification settings - Fork 0
/
numpost.js
1 lines (1 loc) · 16.5 KB
/
numpost.js
1
function openNav(){document.getElementById("myTopnav").style.left="0"}function closeNav(){document.getElementById("myTopnav").style.left="-250px"}function menuoverlayOn(){document.getElementById("menuoverlay").style.display="block"}function menuoverlayOff(){document.getElementById("menuoverlay").style.display="none"}function addClassBody(){var t,e;e="flow",-1==(t=document.body).className.split(" ").indexOf(e)&&(t.className+=" "+e)}function removeClassBody(){var t=document.body;t.className=t.className.replace(/\bflow\b/g,"")}function jump(t){var e=document.getElementById(t).offsetTop;window.scrollTo(0,e)}function scrollFunction(){document.body.scrollTop>200||document.documentElement.scrollTop>200?document.getElementById("backToTop").style.display="block":document.getElementById("backToTop").style.display="none"}function topFunction(){document.body.scrollTop=0,document.documentElement.scrollTop=0}function videoPlay(t){return t.innerHTML=t.innerHTML.replace("\x3c!--","").replace("--\x3e",""),t.onclick=null,!1}for(var btns=document.getElementsByClassName("dropbtn"),i=0;i<btns.length;i++)btns[i].addEventListener("click",function(){var t=document.getElementsByClassName("active");t.length>0&&(t[0].className=t[0].className.replace(" active","")),this.className+=" active"});window.onclick=function(t){if(!t.target.matches(".dropbtn")){var e,a=document.getElementsByClassName("dropbtn");for(e=0;e<a.length;e++){var n=a[e];n.classList.contains("active")&&n.classList.remove("active")}}};var randomRandomIndex,showRandomPost,randomRelatedIndex,showRelatedPost,x=document.querySelectorAll(".lazyloadimg");for(i=0;i<x.length;i++)x[i].innerHTML=x[i].innerHTML.replace("\x3c!--","").replace("--\x3e","");!function(){var t=document.createElement("script");t.src="https://s7.addthis.com/js/300/addthis_widget.js#pubid="+AddThisPubID;var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}(),function(t,e,a){var n={widgetTitle:"",widgetStyle:2,homePage:"https://www.digitalpoin.com/",numPosts:10,summaryLength:370,titleLength:"auto",thumbnailSize:135,thumbnailHeight:75,noImage:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAA3NCSVQICAjb4U/gAAAADElEQVQImWOor68HAAL+AX7vOF2TAAAAAElFTkSuQmCC",containerId:"random-post",newTabLink:!1,moreText:"Baca Selengkapnya",callBack:function(){}};for(var i in RandomPostConfig)n[i]="undefined"==RandomPostConfig[i]?n[i]:RandomPostConfig[i];var l=function(t){var n=e.createElement("script");n.type="text/javascript",n.src=t,a.appendChild(n)};randomRandomIndex=function(t){var e=t.feed.openSearch$totalResults.$t-n.numPosts,a=function(t,e){return Math.floor(Math.random()*(e-t+1))+t}(1,e>0?e:1);l(n.homePage.replace(/\/$/,"")+"/feeds/posts/summary?alt=json-in-script&orderby=updated&start-index="+a+"&max-results="+n.numPosts+"&callback=showRandomPost")},showRandomPost=function(t){var e,a,i,l,s,o=document.getElementById(n.containerId),r=function(t){var e,a,n=t.length;if(0===n)return!1;for(;--n;)e=Math.floor(Math.random()*(n+1)),a=t[n],t[n]=t[e],t[e]=a;return t}(t.feed.entry),d=n.widgetStyle,c=n.widgetTitle+'<ul class="random-post-style-'+d+'">',m=n.newTabLink?' target="_blank"':"",u='<span style="display:block;clear:both;"></span>';if(o){for(var p=0;p<n.numPosts&&p!=r.length;p++){a=r[p].title.$t,i="auto"!==n.titleLength&&n.titleLength<a.length?a.substring(0,n.titleLength)+"…":a,l="media$thumbnail"in r[p]&&!1!==n.thumbnailSize?r[p].media$thumbnail.url.replace(/.*?:\/\//g,"https://cdn.statically.io/img/").replace(/\/s[0-9]+(\-c)?/,"/w"+n.thumbnailSize+"-h75-p-k-no-nu"):n.noImage,s="summary"in r[p]&&n.summaryLength>0?r[p].summary.$t.replace(/<br ?\/?>/g," ").replace(/<.*?>/g,"").replace(/[<>]/g,"").substring(0,n.summaryLength)+"…":"";for(var h=0,f=r[p].link.length;f>h;h++)e="alternate"==r[p].link[h].rel?r[p].link[h].href:"#";c+=2==d?'<li><div class="random-post-item-thumbnail"><a aria-label="'+a+'" href="'+e+'" title="'+a+'"'+m+'><img alt="'+a+'" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailHeight+'" title="'+a+'"></a></div><div class="random-post-item-title"><a title="'+a+'" href="'+e+'"'+m+">"+i+'</a></div><span class="random-post-item-summary"><span class="random-post-item-summary-text">'+s+'</span> <a href="'+e+'" class="random-post-item-more"'+m+">"+n.moreText+"</a></span>"+u+"</li>":3==d||4==d?'<li class="random-post-item" tabindex="0"><a class="random-post-item-title" href="'+e+'"'+m+' target="_blank"><img alt="" class="random-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"></a><div class="random-post-item-tooltip"><a class="random-post-item-title" title="'+a+'" href="'+e+'"'+m+" target='_blank'>"+i+"</a></div>"+u+"</li>":5==d?'<li class="random-post-item" tabindex="0"><a class="random-post-item-wrapper" href="'+e+'" title="'+a+'"'+m+' target="_blank"><img alt="" class="random-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"><span class="random-post-item-tooltip">'+i+"</span></a>"+u+"</li>":6==d?'<li><a class="random-post-item-title" title="'+a+'" href="'+e+'"'+m+" target='_blank'>"+i+'</a><div class="random-post-item-tooltip"><img alt="" class="random-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"><span class="random-post-item-summary"><span class="random-post-item-summary-text">'+s+"</span></span>"+u+"</div></li>":'<li><a title="'+a+'" href="'+e+'"'+m+" target='_blank'>"+i+"</a></li>"}o.innerHTML=c+="</ul>"+u,n.callBack()}},l(n.homePage.replace(/\/$/,"")+"/feeds/posts/summary?alt=json-in-script&orderby=updated&max-results=0&callback=randomRandomIndex")}(window,document,document.getElementsByTagName("head")[0]),function(t,e,a){var n={widgetTitle:"",widgetStyle:1,homePage:"https://www.digitalpoin.com/",numPosts:6,summaryLength:370,titleLength:"auto",thumbnailSize:300,thumbnailHeight:169,noImage:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAA3NCSVQICAjb4U/gAAAADElEQVQImWOor68HAAL+AX7vOF2TAAAAAElFTkSuQmCC",containerId:"related-post",newTabLink:!1,moreText:"Baca Selengkapnya",callBack:function(){}};for(var i in relatedPostConfig)n[i]="undefined"==relatedPostConfig[i]?n[i]:relatedPostConfig[i];var l=function(t){var n=e.createElement("script");n.type="text/javascript",n.src=t,a.appendChild(n)},s=function(t){var e,a,n=t.length;if(0===n)return!1;for(;--n;)e=Math.floor(Math.random()*(n+1)),a=t[n],t[n]=t[e],t[e]=a;return t},o="object"==typeof labelArray&&labelArray.length>0?"/-/"+s(labelArray)[0]:"";randomRelatedIndex=function(t){var e=t.feed.openSearch$totalResults.$t-n.numPosts,a=function(t,e){return Math.floor(Math.random()*(e-t+1))+t}(1,e>0?e:1);l(n.homePage.replace(/\/$/,"")+"/feeds/posts/summary"+o+"?alt=json-in-script&orderby=updated&start-index="+a+"&max-results="+n.numPosts+"&callback=showRelatedPost")},showRelatedPost=function(t){var e,a,i,l,o,r=document.getElementById(n.containerId),d=s(t.feed.entry),c=n.widgetStyle,m=n.widgetTitle+'<ul class="related-post-style-'+c+'">',u=n.newTabLink?' target="_blank"':"",p='<span style="display:block;clear:both;"></span>';if(r){for(var h=0;h<n.numPosts&&h!=d.length;h++){a=d[h].title.$t,i="auto"!==n.titleLength&&n.titleLength<a.length?a.substring(0,n.titleLength)+"…":a,l="media$thumbnail"in d[h]&&!1!==n.thumbnailSize?d[h].media$thumbnail.url.replace(/.*?:\/\//g,"https://cdn.statically.io/img/").replace(/\/s[0-9]+(\-c)?/,"/w"+n.thumbnailSize+"-h169-p-k-no-nu"):n.noImage,o="summary"in d[h]&&n.summaryLength>0?d[h].summary.$t.replace(/<br ?\/?>/g," ").replace(/<.*?>/g,"").replace(/[<>]/g,"").substring(0,n.summaryLength)+"…":"";for(var f=0,g=d[h].link.length;g>f;f++)e="alternate"==d[h].link[f].rel?d[h].link[f].href:"#";m+=2==c?'<li><a aria-label="'+a+'" href="'+e+'" title="'+a+'"'+u+'><div class="related-post-item-thumbnail"><img alt="'+a+'" class="related-post-item-thumbnail" src="'+l+'" width="16" height="9" title="'+a+'"></div></a><a class="related-post-item-title" title="'+a+'" href="'+e+'"'+u+">"+i+'</a><span class="related-post-item-summary"><span class="related-post-item-summary-text">'+o+'</span> <a href="'+e+'" class="related-post-item-more"'+u+">"+n.moreText+"</a></span>"+p+"</li>":3==c||4==c?'<li class="related-post-item" tabindex="0"><a class="related-post-item-title" href="'+e+'"'+u+' target="_blank"><img alt="" class="related-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"></a><div class="related-post-item-tooltip"><a class="related-post-item-title" title="'+a+'" href="'+e+'"'+u+" target='_blank'>"+i+"</a></div>"+p+"</li>":5==c?'<li class="related-post-item" tabindex="0"><a class="related-post-item-wrapper" href="'+e+'" title="'+a+'"'+u+' target="_blank"><img alt="" class="related-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"><span class="related-post-item-tooltip">'+i+"</span></a>"+p+"</li>":6==c?'<li><a class="related-post-item-title" title="'+a+'" href="'+e+'"'+u+" target='_blank'>"+i+'</a><div class="related-post-item-tooltip"><img alt="" class="related-post-item-thumbnail" src="'+l+'" width="'+n.thumbnailSize+'" height="'+n.thumbnailSize+'"><span class="related-post-item-summary"><span class="related-post-item-summary-text">'+o+"</span></span>"+p+"</div></li>":'<li><a title="'+a+'" href="'+e+'"'+u+" target='_blank'>"+i+"</a></li>"}r.innerHTML=m+="</ul>"+p,n.callBack()}},l(n.homePage.replace(/\/$/,"")+"/feeds/posts/summary"+o+"?alt=json-in-script&orderby=updated&max-results=0&callback=randomRelatedIndex")}(window,document,document.getElementsByTagName("head")[0]);var imgEl=document.querySelectorAll(".post-body img");for(i=0;i<imgEl.length;i++)imgEl[i].getAttribute("src")&&(imgEl[i].setAttribute("data-src",imgEl[i].getAttribute("src")),imgEl[i].removeAttribute("src"),imgEl[i].className+=" lazyload");!function(t,e){var a=function(t,e){"use strict";var a,n;if(function(){var e,a={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(e in n=t.lazySizesConfig||t.lazysizesConfig||{},a)e in n||(n[e]=a[e])}(),!e||!e.getElementsByClassName)return{init:function(){},cfg:n,noSupport:!0};var i=e.documentElement,l=t.Date,s=t.HTMLPictureElement,o="addEventListener",r="getAttribute",d=t[o],c=t.setTimeout,m=t.requestAnimationFrame||c,u=t.requestIdleCallback,p=/^picture$/i,h=["load","error","lazyincluded","_lazyloaded"],f={},g=Array.prototype.forEach,y=function(t,e){return f[e]||(f[e]=new RegExp("(\\s|^)"+e+"(\\s|$)")),f[e].test(t[r]("class")||"")&&f[e]},b=function(t,e){y(t,e)||t.setAttribute("class",(t[r]("class")||"").trim()+" "+e)},v=function(t,e){var a;(a=y(t,e))&&t.setAttribute("class",(t[r]("class")||"").replace(a," "))},A=function(t,e,a){var n=a?o:"removeEventListener";a&&A(t,e),h.forEach(function(a){t[n](a,e)})},z=function(t,n,i,l,s){var o=e.createEvent("Event");return i||(i={}),i.instance=a,o.initEvent(n,!l,!s),o.detail=i,t.dispatchEvent(o),o},w=function(e,a){var i;!s&&(i=t.picturefill||n.pf)?(a&&a.src&&!e[r]("srcset")&&e.setAttribute("srcset",a.src),i({reevaluate:!0,elements:[e]})):a&&a.src&&(e.src=a.src)},C=function(t,e){return(getComputedStyle(t,null)||{})[e]},E=function(t,e,a){for(a=a||t.offsetWidth;a<n.minSize&&e&&!t._lazysizesWidth;)a=e.offsetWidth,e=e.parentNode;return a},k=function(){var t,a,n=[],i=[],l=n,s=function(){var e=l;for(l=n.length?i:n,t=!0,a=!1;e.length;)e.shift()();t=!1},o=function(n,i){t&&!i?n.apply(this,arguments):(l.push(n),a||(a=!0,(e.hidden?c:m)(s)))};return o._lsFlush=s,o}(),x=function(t,e){return e?function(){k(t)}:function(){var e=this,a=arguments;k(function(){t.apply(e,a)})}},T=function(t){var e,a=0,i=n.throttleDelay,s=n.ricTimeout,o=function(){e=!1,a=l.now(),t()},r=u&&s>49?function(){u(o,{timeout:s}),s!==n.ricTimeout&&(s=n.ricTimeout)}:x(function(){c(o)},!0);return function(t){var n;(t=!0===t)&&(s=33),e||(e=!0,0>(n=i-(l.now()-a))&&(n=0),t||9>n?r():c(r,n))}},S=function(t){var e,a,n=function(){e=null,t()},i=function(){var t=l.now()-a;99>t?c(i,99-t):(u||n)(n)};return function(){a=l.now(),e||(e=c(i,99))}},L=function(){var s,m,u,h,f,E,L,N,P,_,I,M,R=/^img$/i,$=/^iframe$/i,H="onscroll"in t&&!/(gle|ing)bot/.test(navigator.userAgent),F=0,O=0,j=-1,W=function(t){O--,(!t||0>O||!t.target)&&(O=0)},Q=function(t){return null==M&&(M="hidden"==C(e.body,"visibility")),M||"hidden"!=C(t.parentNode,"visibility")&&"hidden"!=C(t,"visibility")},D=function(t,a){var n,l=t,s=Q(t);for(N-=a,I+=a,P-=a,_+=a;s&&(l=l.offsetParent)&&l!=e.body&&l!=i;)(s=(C(l,"opacity")||1)>0)&&"visible"!=C(l,"overflow")&&(n=l.getBoundingClientRect(),s=_>n.left&&P<n.right&&I>n.top-1&&N<n.bottom+1);return s},U=function(){var t,l,o,d,c,u,p,f,g,y,b,v,A=a.elements;if((h=n.loadMode)&&8>O&&(t=A.length)){for(l=0,j++;t>l;l++)if(A[l]&&!A[l]._lazyRace)if(!H||a.prematureUnveil&&a.prematureUnveil(A[l]))Y(A[l]);else if((f=A[l][r]("data-expand"))&&(u=1*f)||(u=F),y||(y=!n.expand||n.expand<1?i.clientHeight>500&&i.clientWidth>500?500:370:n.expand,a._defEx=y,b=y*n.expFactor,v=n.hFac,M=null,b>F&&1>O&&j>2&&h>2&&!e.hidden?(F=b,j=0):F=h>1&&j>1&&6>O?y:0),g!==u&&(E=innerWidth+u*v,L=innerHeight+u,p=-1*u,g=u),o=A[l].getBoundingClientRect(),(I=o.bottom)>=p&&(N=o.top)<=L&&(_=o.right)>=p*v&&(P=o.left)<=E&&(I||_||P||N)&&(n.loadHidden||Q(A[l]))&&(m&&3>O&&!f&&(3>h||4>j)||D(A[l],u))){if(Y(A[l]),c=!0,O>9)break}else!c&&m&&!d&&4>O&&4>j&&h>2&&(s[0]||n.preloadAfterLoad)&&(s[0]||!f&&(I||_||P||N||"auto"!=A[l][r](n.sizesAttr)))&&(d=s[0]||A[l]);d&&!c&&Y(d)}},V=T(U),q=function(t){var e=t.target;return e._lazyCache?void delete e._lazyCache:(W(t),b(e,n.loadedClass),v(e,n.loadingClass),A(e,K),void z(e,"lazyloaded"))},G=x(q),K=function(t){G({target:t.target})},X=function(t){var e,a=t[r](n.srcsetAttr);(e=n.customMedia[t[r]("data-media")||t[r]("media")])&&t.setAttribute("media",e),a&&t.setAttribute("srcset",a)},J=x(function(t,e,a,i,l){var s,o,d,m,h,f;(h=z(t,"lazybeforeunveil",e)).defaultPrevented||(i&&(a?b(t,n.autosizesClass):t.setAttribute("sizes",i)),o=t[r](n.srcsetAttr),s=t[r](n.srcAttr).replace(/.*?:\/\//g,"https://cdn.statically.io/img/"),l&&(d=t.parentNode,m=d&&p.test(d.nodeName||"")),f=e.firesLoad||"src"in t&&(o||s||m),h={target:t},b(t,n.loadingClass),f&&(clearTimeout(u),u=c(W,2500),A(t,K,!0)),m&&g.call(d.getElementsByTagName("source"),X),o?t.setAttribute("srcset",o):s&&!m&&($.test(t.nodeName)?function(t,e){try{t.contentWindow.location.replace(e)}catch(a){t.src=e}}(t,s):t.src=s),l&&(o||m)&&w(t,{src:s})),t._lazyRace&&delete t._lazyRace,v(t,n.lazyClass),k(function(){var e=t.complete&&t.naturalWidth>1;f&&!e||(e&&b(t,"ls-is-cached"),q(h),t._lazyCache=!0,c(function(){"_lazyCache"in t&&delete t._lazyCache},9)),"lazy"==t.loading&&O--},!0)}),Y=function(t){if(!t._lazyRace){var e,a=R.test(t.nodeName),i=a&&(t[r](n.sizesAttr)||t[r]("sizes")),l="auto"==i;(!l&&m||!a||!t[r]("src")&&!t.srcset||t.complete||y(t,n.errorClass)||!y(t,n.lazyClass))&&(e=z(t,"lazyunveilread").detail,l&&B.updateElem(t,!0,t.offsetWidth),t._lazyRace=!0,O++,J(t,e,l,i,a))}},Z=S(function(){n.loadMode=3,V()}),tt=function(){3==n.loadMode&&(n.loadMode=2),Z()},et=function(){if(!m){if(l.now()-f<999)return void c(et,999);m=!0,n.loadMode=3,V(),d("scroll",tt,!0)}};return{_:function(){f=l.now(),a.elements=e.getElementsByClassName(n.lazyClass),s=e.getElementsByClassName(n.lazyClass+" "+n.preloadClass),d("scroll",V,!0),d("resize",V,!0),t.MutationObserver?new MutationObserver(V).observe(i,{childList:!0,subtree:!0,attributes:!0}):(i[o]("DOMNodeInserted",V,!0),i[o]("DOMAttrModified",V,!0),setInterval(V,999)),d("hashchange",V,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(t){e[o](t,V,!0)}),/d$|^c/.test(e.readyState)?et():(d("load",et),e[o]("DOMContentLoaded",V),c(et,2e4)),a.elements.length?(U(),k._lsFlush()):V()},checkElems:V,unveil:Y,_aLSL:tt}}(),B=function(){var t,a=x(function(t,e,a,n){var i,l,s;if(t._lazysizesWidth=n,n+="px",t.setAttribute("sizes",n),p.test(e.nodeName||""))for(i=e.getElementsByTagName("source"),l=0,s=i.length;s>l;l++)i[l].setAttribute("sizes",n);a.detail.dataAttr||w(t,a.detail)}),i=function(t,e,n){var i,l=t.parentNode;l&&(n=E(t,l,n),(i=z(t,"lazybeforesizes",{width:n,dataAttr:!!e})).defaultPrevented||(n=i.detail.width)&&n!==t._lazysizesWidth&&a(t,l,i,n))},l=S(function(){var e,a=t.length;if(a)for(e=0;a>e;e++)i(t[e])});return{_:function(){t=e.getElementsByClassName(n.autosizesClass),d("resize",l)},checkElems:l,updateElem:i}}(),N=function(){!N.i&&e.getElementsByClassName&&(N.i=!0,B._(),L._())};return c(function(){n.init&&N()}),a={cfg:n,autoSizer:B,loader:L,init:N,uP:w,aC:b,rC:v,hC:y,fire:z,gW:E,rAF:k}}(t,t.document);t.lazySizes=a,"object"==typeof module&&module.exports&&(module.exports=a)}("undefined"!=typeof window?window:{});var a=b?c%d:e[f];