some work on the js

This commit is contained in:
Andre Henriques 2024-09-23 12:24:35 +01:00
parent b8e617ef6c
commit aa407f2273
2 changed files with 11 additions and 0 deletions

View File

@ -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)) {

View File

@ -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);
});