2024-07-06 14:36:13 +00:00
|
|
|
// ==UserScript==
|
|
|
|
// @name BGG XML Api Link
|
|
|
|
// @namespace https://boardgamegeek.com/boardgame/
|
2024-07-06 14:48:57 +00:00
|
|
|
// @version 1.0.2
|
2024-07-06 14:36:13 +00:00
|
|
|
// @description Add a link to the XML Api entry for the given game
|
|
|
|
// @author Rinma
|
2024-07-06 14:48:46 +00:00
|
|
|
// @homepage https://forgejo.over-world.org/Rinma/bgg-xml-api-link
|
2024-07-06 14:36:13 +00:00
|
|
|
// @match https://boardgamegeek.com/boardgame/*/*
|
|
|
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=boardgamegeek.com
|
|
|
|
// @grant none
|
2024-07-06 14:43:35 +00:00
|
|
|
// @updateURL https://forgejo.over-world.org/Rinma/bgg-xml-api-link/raw/branch/main/index.js
|
|
|
|
// @downloadURL https://forgejo.over-world.org/Rinma/bgg-xml-api-link/raw/branch/main/index.js
|
|
|
|
// @supportURL https://forgejo.over-world.org/Rinma/bgg-xml-api-link/issues/new
|
2024-07-06 14:36:13 +00:00
|
|
|
// ==/UserScript==
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const xmlApiLinkButton = document.createElement("button");
|
|
|
|
xmlApiLinkButton.innerHTML = "Open XML Api";
|
|
|
|
xmlApiLinkButton.classList.add("btn", "btn-xs", "btn-white");
|
|
|
|
xmlApiLinkButton.onclick = () => {
|
2024-07-06 14:39:55 +00:00
|
|
|
window.open(`https://api.geekdo.com/xmlapi/boardgame/${window.location.pathname.split("/")[2]}`, "_blank");
|
2024-07-06 14:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const buttonMenu = document.querySelector(".game-header-secondary-actions");
|
|
|
|
buttonMenu.insertBefore(xmlApiLinkButton, buttonMenu.firstChild);
|
|
|
|
})();
|