Added compatibility for Edge/Chrome browsers.

Version bump due to significant changes.
main 1.0.3
Nes370 2024-08-09 12:36:26 -07:00
parent f263c0358f
commit a6ff96f098
4 changed files with 36 additions and 22 deletions

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "SGDB Button on Steam",
"version": "1.0.2",
"version": "1.0.3",
"description": "Adds a button on Steam game pages to bring you to its SteamGridDB entry.",
"icons": {
"16": "icons/icon_16.png",
@ -32,7 +32,7 @@
"web_accessible_resources": [
{
"resources": [ "icons/sgdb_16.png" ],
"matches": [ "*://store.steampowered.com/app/*", "*://steamcommunity.com/app/*" ]
"matches": [ "*://store.steampowered.com/*", "*://steamcommunity.com/*" ]
}
]
}

View File

@ -7,6 +7,8 @@
<title>SGDB Button on Steam</title>
<style>
body {
min-width: 350px;
max-width: 100%;
text-align: center;
font-family: "Open Sans", sans-serif;
background-color: #32414c;

View File

@ -2,7 +2,13 @@ document.addEventListener("DOMContentLoaded", function() {
const headerIcon = document.querySelector("#sgdb-icon");
const nesIcon = document.querySelector("#nes-icon");
const giteaIcon = document.querySelector("#gitea-icon");
if(chrome) {
headerIcon.src = chrome.runtime.getURL("icons/icon_32.png");
nesIcon.src = chrome.runtime.getURL("icons/nes_32.png");
giteaIcon.src = chrome.runtime.getURL("icons/gitea_32.png");
} else {
headerIcon.src = browser.runtime.getURL("icons/icon_32.png");
nesIcon.src = browser.runtime.getURL("icons/nes_32.png");
giteaIcon.src = browser.runtime.getURL("icons/gitea_32.png");
}
});

View File

@ -1,29 +1,35 @@
const url = window.location.href;
const appIDMatch = url.match(/\/app\/(\d+)/);
if(appIDMatch) {
const buttonContainer = document.querySelector(".apphub_OtherSiteInfo");
if(buttonContainer) {
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";
sgdb_button.style.marginRight = "3px";
sgdb_button.style.marginLeft = "3px";
const span = document.createElement('span');
span.setAttribute("data-tooltip-text", "View on SteamGridDB");
const icon = document.createElement("img");
icon.className = "ico16";
if(chrome) {
icon.src = chrome.runtime.getURL("icons/sgdb_16.png");
} else {
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";
sgdb_button.style.marginLeft = "3px";
buttonContainer.prepend(sgdb_button);
}
}