您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Callback binding for HTML Node creation events
此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://updategreasyfork.deno.dev/scripts/19857/174436/node-creation-observer.js
Fire a callback each time an element that matches the selector is created.
Don't apply the callback for the same element multiple times.
In this case, the removeOnFirstMatch
property should be set to false.
Fire a callback when the first element that matches the selector is created.
In this case, the removeOnFirstMatch
property should be set to true.
// Add a new callback for a selector
NodeCreationObserver.onCreation(
String selector,
function callback,
boolean removeOnFirstMatch (optionnal, default value: false)
);
// Stop observing a selector
NodeCreationObserver.remove(
String selector
);
// Stop observing all the selectors
NodeCreationObserver.stop();
// Use case 1
NodeCreationObserver.onCreation("MY_SELECTOR", function (element) {
// callback body
});
// Use case 2
NodeCreationObserver.onCreation("#my_element_id", function (element) {
// callback body
}, true);
// When observing "MY_SELECTOR" is no longer needed
NodeCreationObserver.remove("MY_SELECTOR");
// When node observing is no longer needed
NodeCreationObserver.stop();
Based on the MutationObserver API