SGDB-Extension/script.js

28 lines
817 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";
icon.src = "moz-extension://74d32219-b2a6-4a7f-bec5-0b89b0441173/icons/icon_16_white.png";
span.append(icon);
sgdb_button.append(span);
const buttonContainer = document.querySelector(".apphub_OtherSiteInfo");
if(buttonContainer) {
sgdb_button.style.marginRight = "3px";
buttonContainer.prepend(sgdb_button);
}
}