Advertisement
amarullz

dqhack

May 10th, 2022 (edited)
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Copyright 2022 Ahmad Amarullah (https://amarullz.com)
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *     http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  *
  16.  */
  17. window.DQHACK=function(){
  18.     window.disqus_shortname='amarullz';
  19.     window.DQTOK=[];
  20.     window.DQEL={};
  21.     var dqc_holder=document.createElement('span');
  22.     document.body.appendChild(dqc_holder);
  23.     window.DQUP=function(){
  24.         dqc_holder.innerHTML='';
  25.         var urls=[[]];
  26.         var n=0;
  27.         var p=0;
  28.         for (var k in window.DQEL){
  29.             if (!window.DQEL[k].DQLOADED){
  30.                 if (n>3){
  31.                     p++;
  32.                     n=0;
  33.                     urls[p]=[];
  34.                 }
  35.                 urls[p].push("2="+encodeURIComponent(k));
  36.                 n++;
  37.                 window.DQEL[k].DQLOADED=true;
  38.             }
  39.         }
  40.         for (var i=0;i<urls.length;i++){
  41.             var quri=(urls[i].join('&'));
  42.             var sc=document.createElement('script');
  43.             sc.src='https://amarullz.disqus.com/count-data.js?'+quri;
  44.             dqc_holder.appendChild(sc);
  45.         }
  46.     };
  47.     window.DQFIND=function(){
  48.         var hasNew=false;
  49.         var f=document.getElementsByTagName('a');
  50.         for (var i=0;i<f.length;i++){
  51.             var n=f[i].getAttribute('href');
  52.             if (n&&(!f[i].DQSET)&&(n.indexOf('https://')==0)&&((n.indexOf('#respond')>0)||(n.indexOf('#comments')>0))){
  53.                 if (!(f[i] in window.DQTOK)){
  54.                     window.DQTOK.push(f[i]);
  55.                 }
  56.             }
  57.         }
  58.         for (var i=0;i<window.DQTOK.length;i++){
  59.             var v=window.DQTOK[i];
  60.             if (!v.DQSET){
  61.                 var n=v.getAttribute('href');
  62.                 var hr=n.split('#');
  63.                 var l=document.createElement('a');
  64.                 l.setAttribute('href',hr[0]+'#disqus_thread');
  65.                 l.innerHTML='<span class="fa fw fa-comments"></span> 0';
  66.                 l.setAttribute('title','Forum Diskusi');
  67.                 var s=document.createElement('span');
  68.                 s.className='post-meta-separator';
  69.                 s.innerHTML=' &mdash; ';
  70.                 v.parentNode.appendChild(s);
  71.                 v.parentNode.appendChild(l);
  72.                 v.DQSET=true;
  73.                 if (!(hr[0] in window.DQEL)) window.DQEL[hr[0]]={DQLOADED:false,l:[]};
  74.                 window.DQEL[hr[0]].l.push(l);
  75.                 hasNew=true;
  76.             }
  77.         }
  78.         if (hasNew){
  79.             window.DQUP();
  80.         }
  81.         setTimeout(window.DQFIND,2000);
  82.     };
  83.     window.DISQUSWIDGETS={
  84.         displayCount:function(v){
  85.             if ('counts' in v){
  86.                 var c=v.counts;
  87.                 for (var i=0;i<c.length;i++){
  88.                     var d=c[i].id;
  89.                     var n=c[i].comments;
  90.                     if (d in window.DQEL){
  91.                         for (var j=0;j<window.DQEL[d].l.length;j++){
  92.                             window.DQEL[d].l[j].innerHTML='<span class="fa fw fa-comments"></span> '+n;
  93.                         }
  94.                     }
  95.                 }
  96.             }
  97.         }
  98.     };
  99.     window.DQFIND();
  100. };
  101. document.addEventListener("DOMContentLoaded",window.DQHACK);
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement