Advertisement
cherryprodesign

Disqus Gportálra

Mar 26th, 2016
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. $(document).ready(function() {
  3.  
  4.     if($("#commentContainer").length > 0){
  5.         $( "#commentContainer" ).replaceWith( '<div id="disqus_thread"></div>' );
  6.         var url = window.location.href;
  7.  
  8.         var id = '/gindex.php?pg='+getPageIdentifier('pg',url)+'&postid='+getPageIdentifier('postid',url);
  9.         var disqus_config = function () {
  10.             var titleSelector = '#'+id+' > h2';
  11.             this.page.title = "'"+$(titleSelector).html()+"'";
  12.             this.page.url = "'"+url+"'";  
  13.             this.page.identifier = "'"+id+"'";
  14.         };
  15.         (function() {  
  16.             var d = document, s = d.createElement('script');
  17.        
  18.             s.src = '//gphacks.disqus.com/embed.js';
  19.        
  20.             s.setAttribute('data-timestamp', +new Date());
  21.             (d.head || d.body).appendChild(s);
  22.         })();
  23.     }
  24.  
  25.     $('.blogcommentcount > div > a').each(function(){
  26.         var str = this.href;
  27.         this.setAttribute('class','disqus-comment-count');
  28.         if(str.indexOf("#commentList") == -1){
  29.             var poz = str.indexOf("&cmd=inscomment");
  30.             str = str.substring(0,poz) + "#disqus_thread";
  31.         }
  32.         else
  33.             str = str.replace("#commentList", "#disqus_thread");
  34.  
  35.         this.setAttribute('data-disqus-url',str.substring(0, str.indexOf("#disqus_thread")));
  36.         this.href = str;
  37.     });
  38.    
  39.     var count = document.createElement('script');
  40.     count.setAttribute('id', 'dsq-count-scr');
  41.     count.setAttribute('src', '//gphacks.disqus.com/count.js');
  42.     count.setAttribute('async','');
  43.     document.body.appendChild(count);
  44.  
  45. });
  46.  
  47.     function getPageIdentifier( name, url ) {
  48.         if (!url)
  49.             url = location.href;
  50.         name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  51.         var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)";
  52.         var regex = new RegExp( regexS );
  53.         var results = regex.exec( url );
  54.         return results == null ? null : results[1];
  55.     }
  56. </script>
  57.  
  58. <noscript>A <a href="https://disqus.com/?ref_noscript" rel="nofollow">Disqus</a> használatához engedélyezd a böngésződben a Javascriptet.</noscript>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement