Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Auto scroll to Github best comment
- // Choose one of the following method (Bookmark toolbar link or Browser console)
- // Minified code (drag and drop to your bookmarks)
- 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 }`;
- // Original code (copy paste in your browser console)
- 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}`
Add Comment
Please, Sign In to add comment