Added script, install instructions
This commit is contained in:
parent
f3b6302fdd
commit
0d96d5bf97
@ -1,2 +1,5 @@
|
|||||||
# ytch
|
# ytch
|
||||||
Youtube comment hider
|
Youtube comment hider
|
||||||
|
|
||||||
|
###Installation
|
||||||
|
Drag ytch.user.js into Firefox (with Greasemonkey installed) or chrome (with Tampermonkey installed)
|
||||||
|
40
ytch.user.js
Normal file
40
ytch.user.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name Youtube comment hider
|
||||||
|
// @namespace https://austenwares.com/gogs/stonewareslord/ytch
|
||||||
|
// @description Hides youtube comments that contain specified text
|
||||||
|
// @author stonewareslord
|
||||||
|
// @version 0.1
|
||||||
|
// @homepage https://austenwares.com/gogs/stonewareslord/ytch
|
||||||
|
// @include http://youtube.com/watch*
|
||||||
|
// @include https://youtube.com/watch*
|
||||||
|
// @run-at document-start
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
// Options
|
||||||
|
// Set this to 'hide' to hide comments that contain words
|
||||||
|
// Set this to 'dim' to dim comments that contain words
|
||||||
|
var hideCommentOrDimComment = 'hide';
|
||||||
|
// Set this to an array of words or phrases to check for
|
||||||
|
// All entries should be wrapped in '' or ""
|
||||||
|
// All entries except the last one should end in a comma after ' or "
|
||||||
|
var wordList = [
|
||||||
|
'Example first string',
|
||||||
|
'Example second string',
|
||||||
|
"Example third string (with quotes)",
|
||||||
|
'Example last string (no comma after tick)'
|
||||||
|
];
|
||||||
|
function clearComments(words){
|
||||||
|
comments = document.querySelectorAll('.comment-item>.content>.comment-text>.comment-text-content');
|
||||||
|
for (var i = 0; i < comments.length; i++) {
|
||||||
|
for (var j = 0; j < wordList.length; j++) {
|
||||||
|
if (comments[i].textContent.includes(wordList[j])) {
|
||||||
|
commentToRemove=comments[i].parentNode.parentNode.parentNode;//.parentNode;
|
||||||
|
// Set the opacity to 40%
|
||||||
|
commentToRemove.style.opacity=.4;
|
||||||
|
// Remove the comment chain entirely
|
||||||
|
//commentToRemove.parentNode.removeChild(commentToRemove);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setInterval(clearComments(wordList), 1000);
|
Loading…
x
Reference in New Issue
Block a user