Added compatibility for Edge/Chrome browsers.
Version bump due to significant changes.main 1.0.3
parent
f263c0358f
commit
a6ff96f098
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "SGDB Button on Steam",
|
"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.",
|
"description": "Adds a button on Steam game pages to bring you to its SteamGridDB entry.",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "icons/icon_16.png",
|
"16": "icons/icon_16.png",
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
{
|
{
|
||||||
"resources": [ "icons/sgdb_16.png" ],
|
"resources": [ "icons/sgdb_16.png" ],
|
||||||
"matches": [ "*://store.steampowered.com/app/*", "*://steamcommunity.com/app/*" ]
|
"matches": [ "*://store.steampowered.com/*", "*://steamcommunity.com/*" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
<title>SGDB Button on Steam</title>
|
<title>SGDB Button on Steam</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
min-width: 350px;
|
||||||
|
max-width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: "Open Sans", sans-serif;
|
font-family: "Open Sans", sans-serif;
|
||||||
background-color: #32414c;
|
background-color: #32414c;
|
||||||
|
|
12
popup.js
12
popup.js
|
@ -2,7 +2,13 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||||
const headerIcon = document.querySelector("#sgdb-icon");
|
const headerIcon = document.querySelector("#sgdb-icon");
|
||||||
const nesIcon = document.querySelector("#nes-icon");
|
const nesIcon = document.querySelector("#nes-icon");
|
||||||
const giteaIcon = document.querySelector("#gitea-icon");
|
const giteaIcon = document.querySelector("#gitea-icon");
|
||||||
headerIcon.src = browser.runtime.getURL("icons/icon_32.png");
|
if(chrome) {
|
||||||
nesIcon.src = browser.runtime.getURL("icons/nes_32.png");
|
headerIcon.src = chrome.runtime.getURL("icons/icon_32.png");
|
||||||
giteaIcon.src = browser.runtime.getURL("icons/gitea_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");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
40
script.js
40
script.js
|
@ -1,29 +1,35 @@
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
|
|
||||||
const appIDMatch = url.match(/\/app\/(\d+)/);
|
const appIDMatch = url.match(/\/app\/(\d+)/);
|
||||||
if(appIDMatch) {
|
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 = browser.runtime.getURL("icons/sgdb_16.png");
|
|
||||||
icon.style.backgroundImage = "none";
|
|
||||||
span.append(icon);
|
|
||||||
|
|
||||||
sgdb_button.append(span);
|
|
||||||
|
|
||||||
const buttonContainer = document.querySelector(".apphub_OtherSiteInfo");
|
const buttonContainer = document.querySelector(".apphub_OtherSiteInfo");
|
||||||
if(buttonContainer) {
|
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.marginRight = "3px";
|
||||||
sgdb_button.style.marginLeft = "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);
|
||||||
buttonContainer.prepend(sgdb_button);
|
buttonContainer.prepend(sgdb_button);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue