-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOMwatcher.js
More file actions
23 lines (22 loc) · 1.07 KB
/
Copy pathDOMwatcher.js
File metadata and controls
23 lines (22 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var num_mutations_observed=0;
var num_animations_observed=0;
const observer = new MutationObserver(function (mutationsList, observer){num_mutations_observed++;});
observer.observe(document, { childList: true, subtree: true});
function dynamic_content_listener(event) {
num_animations_observed++;
}
var style=document.createElement("style");
var sheet;
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
sheet=style.sheet;
sheet.insertRule("@keyframes ruffleObjectOrEmbedInserted { from { opacity: 0.99; } to { opacity: 1; } }",0);
sheet.insertRule("object, embed { animation-duration:0.001s; animation-name: ruffleObjectOrEmbedInserted; }",1);
document.addEventListener("animationstart", dynamic_content_listener, false);
document.addEventListener("MSAnimationStart", dynamic_content_listener, false);
document.addEventListener("webkitAnimationStart", dynamic_content_listener, false);
function log_variables()
{
console.log("# of mutations: "+num_mutations_observed+" | # of animations: "+num_animations_observed);
}
setInterval(log_variables,1000);