From aa407f2273435254d8d9210ed479e289371e80c0 Mon Sep 17 00:00:00 2001 From: Andre Henriques Date: Mon, 23 Sep 2024 12:24:35 +0100 Subject: [PATCH] some work on the js --- extensions/background-script.js | 7 +++++++ extensions/definitions.js | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/extensions/background-script.js b/extensions/background-script.js index 3b29319..bd780cd 100644 --- a/extensions/background-script.js +++ b/extensions/background-script.js @@ -17,6 +17,10 @@ browser.runtime.onMessage.addListener(async (message, sender, sendResponse) => { const tab = await browser.tabs.get(windowList[0]); + browser.tabs.sendMessage(tab.id, { + type: "GET_DATA_FROM_PAGE", + }); + browser.tabs.sendMessage(sender.tab.id, { type: "MY_GET_URL_R", url: tab.url, @@ -48,6 +52,9 @@ browser.runtime.onInstalled.addListener(async () => { browser.menus.onClicked.addListener(async function (e, tab) { let windowList = (await browser.storage.local.get("windows")).windows ?? []; + + console.log("test", e.menuItemId, e.menuItemId === "mark-page-clear"); + if (e.menuItemId === "mark-page") { console.log("marking page", tab); if (windowList.includes(tab.id)) { diff --git a/extensions/definitions.js b/extensions/definitions.js index c49138b..f2b1d04 100644 --- a/extensions/definitions.js +++ b/extensions/definitions.js @@ -10,6 +10,10 @@ window.addEventListener("message", function (e) { } else if (e.data.type === "HAS_EXTENSION_Q") { console.log("Got request for ext"); window.postMessage({ type: "HAS_EXTENSION" }); + } else if (e.data.type === "GET_DATA_FROM_PAGE") { + console.log( + document.querySelector('header[data-test="job-details-header"]'), + ); } //console.log("here2", e); });