-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain.js
More file actions
33 lines (23 loc) · 694 Bytes
/
main.js
File metadata and controls
33 lines (23 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ideas from:
// https://antoinevastel.com/javascript/2019/06/10/monitor-js-execution.html
function myBotCheck() {
let err = new Error('test err');
console.log('err.stack: ', err.stack);
if (err.stack.toString().includes('puppeteer')) {
document.getElementById('yesOrNo').innerHTML = 'Yes';
}
}
function overrideFunction(item) {
item.obj[item.propName] = (function (orig) {
return function () {
myBotCheck();
let args = arguments;
let value = orig.apply(this, args);
return value;
};
}(item.obj[item.propName]));
}
overrideFunction({
propName: 'querySelector',
obj: document
});