24 lines
932 B
JavaScript
24 lines
932 B
JavaScript
|
// ==UserScript==
|
||
|
// @name BGG XML Api Link
|
||
|
// @namespace https://boardgamegeek.com/boardgame/
|
||
|
// @version 1.0.0
|
||
|
// @description Add a link to the XML Api entry for the given game
|
||
|
// @author Rinma
|
||
|
// @match https://boardgamegeek.com/boardgame/*/*
|
||
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=boardgamegeek.com
|
||
|
// @grant none
|
||
|
// ==/UserScript==
|
||
|
|
||
|
(function() {
|
||
|
'use strict';
|
||
|
|
||
|
const xmlApiLinkButton = document.createElement("button");
|
||
|
xmlApiLinkButton.innerHTML = "Open XML Api";
|
||
|
xmlApiLinkButton.classList.add("btn", "btn-xs", "btn-white");
|
||
|
xmlApiLinkButton.onclick = () => {
|
||
|
window.open(`https://api.geekdo.com/xmlapi/boardgame/${window.location.pathname.split("/")[2]}}`, "_blank");
|
||
|
}
|
||
|
|
||
|
const buttonMenu = document.querySelector(".game-header-secondary-actions");
|
||
|
buttonMenu.insertBefore(xmlApiLinkButton, buttonMenu.firstChild);
|
||
|
})();
|