From f92c7e8519a58073bd639ccac7aea7735645e201 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 21 Feb 2016 13:42:58 -0500 Subject: [PATCH] Use hideCommentOrDimComment feature --- ytch.user.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ytch.user.js b/ytch.user.js index b1165d0..7d89ba0 100644 --- a/ytch.user.js +++ b/ytch.user.js @@ -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 + } } } }