Wired up notification framework. Next is bringing to forefront automatically.
This commit is contained in:
+46
-1
@@ -4,4 +4,49 @@
|
|||||||
if (url) { window.location.href = url; return null; }
|
if (url) { window.location.href = url; return null; }
|
||||||
return originalOpen.apply(this, arguments);
|
return originalOpen.apply(this, arguments);
|
||||||
};
|
};
|
||||||
})();
|
if (window.location.href.includes('helpalert.html')) {
|
||||||
|
if (Notification.permission === 'default') {
|
||||||
|
Notification.requestPermission();
|
||||||
|
}
|
||||||
|
var seenAlerts = {};
|
||||||
|
setInterval(function() {
|
||||||
|
if (!document.body) return;
|
||||||
|
|
||||||
|
var text = document.body.innerText;
|
||||||
|
var currentAlerts = {};
|
||||||
|
|
||||||
|
var lines = text.split('\n');
|
||||||
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
if (lines[i].trim().startsWith('Geo:') && i > 0) {
|
||||||
|
var name = lines[i - 1].trim();
|
||||||
|
if (name && name !== 'Claim' && name !== 'VIDEO') {
|
||||||
|
currentAlerts[name] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var key in currentAlerts) {
|
||||||
|
if (!seenAlerts[key]) {
|
||||||
|
console.log('[DuressGuard] NEW ALERT:', key);
|
||||||
|
if (Notification.permission === 'granted') {
|
||||||
|
new Notification('DURESS ALERT', {
|
||||||
|
body: key,
|
||||||
|
requireInteraction: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var ctx = new AudioContext();
|
||||||
|
var osc = ctx.createOscillator();
|
||||||
|
var gain = ctx.createGain();
|
||||||
|
osc.connect(gain);
|
||||||
|
gain.connect(ctx.destination);
|
||||||
|
osc.frequency.value = 800;
|
||||||
|
gain.gain.value = 0.3;
|
||||||
|
osc.start();
|
||||||
|
osc.stop(ctx.currentTime + 0.5);
|
||||||
|
} catch(e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
seenAlerts = currentAlerts;
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
})();;
|
||||||
Reference in New Issue
Block a user