Use hideCommentOrDimComment feature

This commit is contained in:
Austen Adler 2016-02-21 13:42:58 -05:00
parent befe757f90
commit f92c7e8519

View File

@ -3,7 +3,7 @@
// @namespace https://austenwares.com/gogs/stonewareslord/ytch
// @description Hides youtube comments that contain specified text
// @author stonewareslord
// @version 0.1
// @version 0.1.1
// @homepage https://austenwares.com/gogs/stonewareslord/ytch
// @include http://youtube.com/watch*
// @include https://youtube.com/watch*
@ -11,7 +11,6 @@
// @include https://www.youtube.com/watch*
// @run-at document-body
// ==/UserScript==
// Options
// Set this to 'hide' to hide comments that contain words
// Set this to 'dim' to dim comments that contain words
@ -31,10 +30,15 @@ function clearComments(){
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);
if(hideCommentOrDimComment == 'hide'){
// They want to hide, remove the comment
commentToRemove.parentNode.removeChild(commentToRemove);
} else if(hideCommentOrDimComment == 'dim'){
// They want to dim, set the opacity to 40%
commentToRemove.style.opacity = 0.4;
} else {
// hideCommentOrDimComment is improperly set, do nothing
}
}
}
}