Created
September 10, 2018 06:34
-
-
Save vsubhash/673be40439fa9fd9ca51b1b096623ef1 to your computer and use it in GitHub Desktop.
Show newer YouTube comments (com.vsubhash.js.show-youtube-comments-newer) is a User Script for YouTube that will display newer comments first instead of the default moderated "Top Comments". This script can be installed in Firfox browsers using the Greasemonkey add-on.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Show newer YouTube comments | |
// @namespace com.vsubhash.js.show-youtube-comments-newer | |
// @description Automatically changes YouTube comments filter off | |
// @include https://www.youtube.com/watch* | |
// @exclude %exclude% | |
// @version 2018 | |
// @grant none | |
// ==/UserScript== | |
document.addEventListener("DOMContentLoaded", startItDelayed, false); | |
function startItDelayed() { | |
window.setTimeout(switchCommentsList, 10*1000); | |
} | |
function switchCommentsList() { | |
console.log("Showing newer comments"); | |
var arButtons = document.getElementsByTagName("button"); | |
console.log(arButtons.length); | |
var bFound = false; | |
for (var i = 0; i < arButtons.length; i++) { | |
//console.log(arButtons[i].textContent); | |
if (arButtons[i].textContent.trim() == "Top comments") { | |
arButtons[i].click(); | |
bFound = true; | |
break; | |
} | |
} | |
if (bFound) { | |
//console.log("Menu found--------------"); | |
var arButtons = document.getElementsByTagName("button"); | |
console.log(arButtons.length); | |
for (var i = 0; i < arButtons.length; i++) { | |
//console.log(arButtons[i].textContent); | |
if (arButtons[i].textContent.trim() == "Newest first") { | |
arButtons[i].click(); | |
bFound = true; | |
break; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment