SHARE
TWEET

Untitled

a guest Sep 18th, 2017 8,893 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var sendMessage = chrome.runtime.sendMessage;
  2. sendMessage({
  3.     aim: "promoteButter",
  4.     butter: {
  5.         url: location.href,
  6.         ref: document.referrer
  7.     }
  8. });
  9.  
  10. window.addEventListener("beforeunload", e => {
  11.     sendMessage({
  12.         aim: "switchToOil",
  13.         oil: {
  14.             url: location.href,
  15.             ref: document.referrer
  16.         }
  17.     });
  18. });
  19.  
  20. var aeh = function () {
  21.     sendMessage({aim: "alive"})
  22. }, ae = function (e) {
  23.     document.addEventListener(e, aeh);
  24. };
  25. ['click', 'maouseover', 'mouseout', 'focus', 'keydown'].forEach(function (e) {
  26.     ae(e);
  27. });
  28.  
  29. var dba = document.addEventListener,
  30.     pl = function (e) {
  31.         if ("undefined" === typeof e || e === null) {
  32.             return null;
  33.         }
  34.         if (e.href) {
  35.             return e.href;
  36.         } else {
  37.             return pl(e.parentNode || e.parentElement);
  38.         }
  39.     },
  40.     h2 = function (e) {
  41.         var h = pl(e.target);
  42.         if (h) {
  43.             sendMessage({ahref: h})
  44.         }
  45.     },
  46.     h3 = function (e) {
  47.         var h = pl(e.target);
  48.         if (h) {
  49.             sendMessage({href: h})
  50.         }
  51.     };
  52. ['contextmenu', 'auxclick'].forEach(function (e) {
  53.     dba(e, h2)
  54. });
  55. ['click'].forEach(function (e) {
  56.     dba(e, h3)
  57. });
RAW Paste Data
Top