function detectFunctions() { const cup0 = document.getElementById("Cup0");

const originalValue = cup0.innerHTML;

// create a proxy to detect function calls const handler = { apply(target, thisArg, args) { console.log(Function '${target.name}' called); console.log(Changes made to element with id 'Cup0': ${cup0.innerHTML}); return Reflect.apply(target, thisArg, args); } };

// wrap all functions that affect the Cup0 element with the proxy const functions = Object.getOwnPropertyNames(window) .map(name => window[name]) .filter(value => typeof value === 'function');

functions.forEach(func => { const proxy = new Proxy(func, handler); window[func.name] = proxy; }); }

detectFunctions(); // start detecting function calls

js code to detect functions that affect element with id Cup0 from dom and console log the functions name and what these function change done by this

原文地址: https://www.cveoy.top/t/topic/8gz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录