-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
73 lines (64 loc) · 2.09 KB
/
content.js
File metadata and controls
73 lines (64 loc) · 2.09 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// // Listen for messages
// chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
// // If the received message has the expected format...
// if (msg.text === 'report_back') {
// // Call the specified callback, passing
// // the web-page's DOM content as argument
// sendResponse(document.all[0].outerHTML);
// }
// });
// // Listen for messages
// chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
// // If the received message has the expected format...
// if (msg.text === 'report_back') {
// // Call the specified callback, passing
// // the web-page's DOM content as argument
// sendResponse(document.all[0].outerHTML);
// }
// });
$( document ).ready(function(){
console.log("mo0o0");
var onScreen = 99999;
function trackSlaps(){
window.setInterval(function(){
var cur = $('img[alt="✋"]').length;
console.log(cur);
if(cur>onScreen){
console.log("THWACK");
$.post('http://localhost:3000');
}
onScreen = cur;
}, 1000);
}
setTimeout(trackSlaps, 5000);
// var observer = new MutationObserver(function(mutations, observer) {
// // fired when a mutation occurs
// console.log(mutations, observer);
// // ...
// });
// observer.observe(document.getElementById('js_1'), {
// subtree: true,
// attributes: true
// //...
// });
// var observer = new MutationObserver(function(mutations) {
// mutations.forEach(function(mutation) {
// if (mutation.addedNodes && mutation.addedNodes.length > 0) {
// // element added to DOM
// console.log(mutation)
// var hasClass = [].some.call(mutation.addedNodes, function(el) {
// return el.classList.contains('_1ift')
// });
// if (hasClass) {
// // element has class `MyClass`
// console.log('element ".1ift" added');
// }
// }
// });
// });
// observer.observe(document.body, {
// subtree: true,
// attributes: true
// //...
// });
});