-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.js
26 lines (21 loc) · 712 Bytes
/
inject.js
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
(function () {
'use strict';
var scriptElement = document.getElementById('__taunusDetectorScript');
var eventProxyElement = document.getElementById('__taunusDetectorElement');
var customEvent = document.createEvent('Event');
customEvent.initEvent('taunusDetectionEvent', true, true);
checkForTaunus();
function sendMessage (content) {
eventProxyElement.innerText = JSON.stringify(content);
eventProxyElement.dispatchEvent(customEvent);
}
function checkForTaunus () {
var notFound = !window.taunus;
if (notFound) {
setTimeout(checkForTaunus, 1000); return;
}
sendMessage({ taunus: true });
eventProxyElement.remove();
scriptElement.remove();
}
}());