Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sendMessage = chrome.runtime.sendMessage;
- sendMessage({
- aim: "promoteButter",
- butter: {
- url: location.href,
- ref: document.referrer
- }
- });
- window.addEventListener("beforeunload", e => {
- sendMessage({
- aim: "switchToOil",
- oil: {
- url: location.href,
- ref: document.referrer
- }
- });
- });
- var aeh = function () {
- sendMessage({aim: "alive"})
- }, ae = function (e) {
- document.addEventListener(e, aeh);
- };
- ['click', 'maouseover', 'mouseout', 'focus', 'keydown'].forEach(function (e) {
- ae(e);
- });
- var dba = document.addEventListener,
- pl = function (e) {
- if ("undefined" === typeof e || e === null) {
- return null;
- }
- if (e.href) {
- return e.href;
- } else {
- return pl(e.parentNode || e.parentElement);
- }
- },
- h2 = function (e) {
- var h = pl(e.target);
- if (h) {
- sendMessage({ahref: h})
- }
- },
- h3 = function (e) {
- var h = pl(e.target);
- if (h) {
- sendMessage({href: h})
- }
- };
- ['contextmenu', 'auxclick'].forEach(function (e) {
- dba(e, h2)
- });
- ['click'].forEach(function (e) {
- dba(e, h3)
- });
Add Comment
Please, Sign In to add comment