Guest User

Untitled

a guest
Nov 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. // chromium plugin
  2. (function() {
  3. Notification.requestPermission();
  4. WebSocket.prototype._send = WebSocket.prototype.send;
  5. WebSocket.prototype.send = function(data) {
  6. this._send(data);
  7. this.addEventListener('message', function(msg) {
  8. console.log('>> ' + msg.data);
  9. if (msg.data.includes("Presence")) {
  10. var d = eval(msg.data.split(',').slice(1).join());
  11. console.log('+++', d[1].id, d[1].type);
  12. if (d[1].type === 'available' && d[1].id.includes("505000000")) {
  13. new Notification("online alert");
  14. }
  15. }
  16. }, false);
  17. this.send = function(data) {
  18. this._send(data);
  19. console.log("<<< " + data);
  20. };
  21. console.log("<< " + data);
  22. }
  23. })();
Add Comment
Please, Sign In to add comment