Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // chromium plugin
- (function() {
- Notification.requestPermission();
- WebSocket.prototype._send = WebSocket.prototype.send;
- WebSocket.prototype.send = function(data) {
- this._send(data);
- this.addEventListener('message', function(msg) {
- console.log('>> ' + msg.data);
- if (msg.data.includes("Presence")) {
- var d = eval(msg.data.split(',').slice(1).join());
- console.log('+++', d[1].id, d[1].type);
- if (d[1].type === 'available' && d[1].id.includes("505000000")) {
- new Notification("online alert");
- }
- }
- }, false);
- this.send = function(data) {
- this._send(data);
- console.log("<<< " + data);
- };
- console.log("<< " + data);
- }
- })();
Add Comment
Please, Sign In to add comment