SGDB-Extension/script.js

30 lines
860 B
JavaScript
Raw Normal View History

const url = window.location.href;
const appIDMatch = url.match(/\/app\/(\d+)/);
if(appIDMatch) {
const appID = appIDMatch[1];
const sgdb_button = document.createElement('a');
sgdb_button.href = `https://steamgriddb.com/steam/${appID}`;
sgdb_button.className = "btnv6_blue_hoverfade btn_medium";
const span = document.createElement('span');
span.setAttribute("data-tooltip-text", "View on SteamGridDB");
const icon = document.createElement("img");
icon.className = "ico16";
2024-08-08 14:49:18 -07:00
icon.src = browser.runtime.getURL("icons/sgdb_16.png");
icon.style.backgroundImage = "none";
span.append(icon);
sgdb_button.append(span);
const buttonContainer = document.querySelector(".apphub_OtherSiteInfo");
if(buttonContainer) {
sgdb_button.style.marginRight = "3px";
2024-08-08 14:49:18 -07:00
sgdb_button.style.marginLeft = "3px";
buttonContainer.prepend(sgdb_button);
}
}