-
-
Save ETiV/6130889 to your computer and use it in GitHub Desktop.
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 CleanComments | |
// @namespace ForBetterJanDan | |
// @description 眼不见心不烦, 删除煎蛋多说"吐槽"中某些人的评论 | |
// @include http://jandan.net/* | |
// @version 1 | |
// ==/UserScript== | |
document.addEventListener('DOMNodeInserted',function(){ | |
// 屏蔽关键字列表, 内容为多说的UserID | |
// 根据吐槽列表中发帖人的多说UserID进行过滤, 登录后的用户才有. | |
// 可以自行添加新的关键字. | |
var denyUserIDList = ['1043922']; | |
// 屏蔽关键字列表, 内容为用户自己填写的URL | |
// 根据吐槽列表中发帖人的URL进行过滤, 广告的通常手段. | |
// 可以自行添加新的关键字. | |
var denyURLList = ['http://t.qq.com/zhuanyezhaoge']; | |
// 功能实现 | |
if ($ != undefined) { | |
denyUserIDList.forEach(function(e){ | |
var el = $('.ds-avatar[data-user-id="'+e+'"]'); | |
if (el) el.parent().parent().remove(); | |
}); | |
denyURLList.forEach(function(e){ | |
var el = $('a[href="'+e+'"]'); | |
if (el) el.parent().parent().parent().remove(); | |
}); | |
} else { | |
denyUserIDList.forEach(function(e){ | |
var el = document.querySelector('.ds-avatar[data-user-id="'+e+'"]'); | |
if (el) el.parentNode.parentNode.remove(); | |
}); | |
denyURLList.forEach(function(e){ | |
var el = document.querySelector('a[href="'+e+'"]'); | |
if (el) el.parentNode.parentNode.parentNode.remove(); | |
}); | |
} | |
},false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment