commit 6fd2bf7771e9a0cf68ba9f86c0987a996880564d Author: Nes370 Date: Thu Aug 8 10:34:58 2024 -0700 Initial Commit Mostly functional extension! diff --git a/icons/icon_128.png b/icons/icon_128.png new file mode 100644 index 0000000..d127817 Binary files /dev/null and b/icons/icon_128.png differ diff --git a/icons/icon_16.png b/icons/icon_16.png new file mode 100644 index 0000000..161305a Binary files /dev/null and b/icons/icon_16.png differ diff --git a/icons/icon_16_white.png b/icons/icon_16_white.png new file mode 100644 index 0000000..5fe9d81 Binary files /dev/null and b/icons/icon_16_white.png differ diff --git a/icons/icon_32.png b/icons/icon_32.png new file mode 100644 index 0000000..6bcc784 Binary files /dev/null and b/icons/icon_32.png differ diff --git a/icons/icon_48.png b/icons/icon_48.png new file mode 100644 index 0000000..4f6b500 Binary files /dev/null and b/icons/icon_48.png differ diff --git a/icons/icon_64.png b/icons/icon_64.png new file mode 100644 index 0000000..208f1d7 Binary files /dev/null and b/icons/icon_64.png differ diff --git a/icons/icon_96.png b/icons/icon_96.png new file mode 100644 index 0000000..9de6e70 Binary files /dev/null and b/icons/icon_96.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..8ee54d5 --- /dev/null +++ b/manifest.json @@ -0,0 +1,33 @@ +{ + "manifest_version": 3, + "name": "SGDB Button on Steam", + "version": "1.0.0", + "description": "Adds a button on Steam game pages to bring you to its SteamGridDB entry.", + "permissions": [ + "storage" + ], + "action": { + "default_icon": "icons/icon_128.png", + "default_popup": "popup.html" + }, + "icons": { + "16": "icons/icon_16.png", + "32": "icons/icon_32.png", + "48": "icons/icon_48.png", + "64": "icons/icon_64.png", + "96": "icons/icon_96.png", + "128": "icons/icon_128.png" + }, + "content_scripts": [ + { + "matches": [ "*://store.steampowered.com/app/*", "*://steamcommunity.com/app/*" ], + "js": [ "script.js" ] + } + ], + "web_accessible_resources": [ + { + "resources": [ "icons/icon_16_white.png" ], + "matches": [ "*://store.steampowered.com/app/*", "*://steamcommunity.com/app/*" ] + } + ] +} diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..4530431 --- /dev/null +++ b/popup.html @@ -0,0 +1,20 @@ + + + + + + + SGBD Button Placement + + + +

SGBD Button on Steam

+

Created by Nes

+ + diff --git a/script.js b/script.js new file mode 100644 index 0000000..5172088 --- /dev/null +++ b/script.js @@ -0,0 +1,27 @@ +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); + } + +}