[英]How to change a class CSS with a Greasemonkey/Tampermonkey script?
[英]How to remove CSS Class with Tampermonkey?
这看起来是一个由AJAX驱动的网页,因此您需要使用支持AJAX的技术来处理它。 EG waitForKeyElements ,或MutationObserver
,或类似的。
这是一个应该有效的完整脚本 :
// ==UserScript==
// @name _Remove a select class from nodes
// @match *://app.hubspot.com/reports-dashboard/*
// @match *://app.hubspot.com/sales-notifications-embedded/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
//- The @grant directive is needed to restore the proper sandbox.
console.log ("Do you see this?");
waitForKeyElements (".disable-stream", removeDSclass);
function removeDSclass (jNode) {
console.log ("Cleaned node: ", jNode);
jNode.removeClass ("disable-stream");
}
请注意,有两个@match
语句,因为OP关心的节点原来是在iframe中。
var divs =document.getElementsByClassName("stream-notifications");
divs=Array.from(divs);
divs.forEach(function(div){
div.classList.remove('disable-stream');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.