SHARE
TWEET

Untitled

a guest Feb 17th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Auto scroll to Github best comment
  2. // Choose one of the following method (Bookmark toolbar link or Browser console)
  3.  
  4. // Minified code (drag and drop to your bookmarks)
  5. javascript:var bestCommentId;var bestScore=0;Array.from(document.querySelectorAll(".js-targetable-comment")).forEach(item=>{if(item.querySelector("button.reaction-summary-item")){let commentScore=0;Array.from(item.querySelectorAll("button.reaction-summary-item")).forEach(i=>{if(!!i.innerText){commentScore+=Number(i.innerText.replace(/\D/g,''))}});if(commentScore>bestScore){bestScore=commentScore;bestCommentId=item.id}}});console.log('Comment score',bestScore);location.href=`#${ bestCommentId }`;
  6.  
  7. // Original code (copy paste in your browser console)
  8. var bestCommentId;
  9. var bestScore = 0;
  10. Array.from(document.querySelectorAll(".js-targetable-comment")).forEach(item => {
  11.     if (item.querySelector("button.reaction-summary-item")) {
  12.         let commentScore = 0;
  13.         Array.from(item.querySelectorAll("button.reaction-summary-item")).forEach(i => {
  14.             if (!!i.innerText) {
  15.                 commentScore += Number(i.innerText.replace(/\D/g, ''));
  16.             }
  17.         });
  18.         if (commentScore > bestScore) {
  19.             bestScore = commentScore;
  20.             bestCommentId = item.id;
  21.         }
  22.     }
  23. });
  24. console.log('Comment score', bestScore);
  25. location.href = `#${bestCommentId}`
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top