討論 » 建立請求

Adding a map to Indeed / Linkedin job board posts?

§
發表於:2023-08-13

Hi all,

I'm looking to see if there is a script that will add to job postings as they already have a location and sometimes a zipcode too. Trying to get an idea of where the job is by showing the general area of where the location is within the state via google maps. Trying to speed up the job searching process.

Thanks!

§
發表於:2023-08-15
編輯:2023-08-15

This is the concept for indeed, but I won't do it for you

const companyInfoElements = document.querySelectorAll(".companyInfo");

companyInfoElements.forEach((companyInfo, i) => {
const companyName = companyInfo.querySelector(".companyName").textContent;
const companyLocation = companyInfo.querySelector(".companyLocation").textContent;

const googleMapsUrl = `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(companyLocation)}`;

const iframe = document.createElement("iframe");
iframe.setAttribute("src", googleMapsUrl);
iframe.setAttribute("width", "300");
iframe.setAttribute("height", "200");
iframe.style.position = "absolute";
iframe.style.display = "none";

document.querySelectorAll("li")[i].addEventListener("mouseenter", () => {
iframe.style.display = "block";
});

document.querySelectorAll("li")[i].addEventListener("mouseleave", () => {
iframe.style.display = "none";
});

document.querySelectorAll("li")[i].appendChild(iframe);
});

發表回覆

登入以回復