GOG DB Plus

Add GOGDB button to GOG game page. 为GOG游戏页面添加GOGDB按钮。

  1. // ==UserScript==
  2. // @name GOG DB Plus
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Add GOGDB button to GOG game page. 为GOG游戏页面添加GOGDB按钮。
  6. // @author WK
  7. // @match https://www.gog.com/*/game/*
  8. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAA9lBMVEX////MyN6If7OJgLOWjrvw7/auqMuMgLSxqM2kksSbhr+fhL/WyuM4IYccAHk2IYMuGYAAAHKkncTe2+ksDX4+JYcoAH6voMs8AIhaJ5djL5tYDpD9/P5wY6P8+v759fytm8tLBJDn5PCSbLVpJJh7cKjDvdf08vmaeLvDudj18vpjJJw0HXxyZ6AwAHteQpSAa6prSp9LApmDY7ikhslVRY1jU5aIZLx/Wbh4TbRzNK2pgM2JRLpUPotbNo7IruCRWMOeZMigV8XVwOa6i9Z3Wp95VaKXccOifMlQIoh8W69nP59lOahQNJRmUqSAabNCI5VKOY9tff7FAAABPUlEQVR4Ac3RVXaDUABF0Rt3RRp5wRrDIe7unvkPJs7qbz9zcDYOvjGX2+PxeH3wewKBQBC+UDgciUQ/GIsnEslUmkrRDEOz1E8mm8vlc28jdIHjqXiaivs5LshSgihx3G+RvJUuAb4nloHyEytAteic6aAMyE9UHqjiXVLTS5KRpgzTsuwMJdTq9WjDwXSz2ZIML7FM27arHNXudKON3gdJRalIRgjgCOEA8DyP/uBjzeHQHBkCPo0n0+l0MMO7UsmyrIjk4LzfXywWc/yj4HK5XEWVav1REPP1q80Ht9snymJnt8vu+Z1aPzzGg4MlEIKgSAHho3I642wjknUw8Lp4RgICDpYuzl/RCV+BP+7iuNKxcirgfPpDLaVpSZecSjJM/FoZFtC6osR+0OV5RHHe58KFtB9pL/wefGF369AsI1+AY60AAAAASUVORK5CYII=
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. var layoutDiv = document.querySelector('div.layout.ng-scope');
  15. var card_product = layoutDiv.getAttribute("card-product");
  16. addGOGDBButton(card_product);
  17.  
  18. function addGOGDBButton(card_product) {
  19. // Get "Buy now" button
  20. const originalButton = document.querySelector('button.button--big.buy-now-button');
  21.  
  22. // Cheeck if "Buy now" button exists
  23. if (!originalButton) {
  24. console.error("'Buy now' Button not found。");
  25. return;
  26. }
  27.  
  28. // Create a new button
  29. const newButton = document.createElement('button');
  30.  
  31. // Copy original button's classname & attribute
  32. newButton.className = originalButton.className;
  33. newButton.setAttribute('onclick', "window.open('https://www.gogdb.org/product/"+card_product+"','_blank')");
  34. newButton.setAttribute('title', "Show in GOGDB");
  35.  
  36. // Set text to new button
  37. newButton.textContent = 'GOGDB';
  38.  
  39. // Inser new button afrer the original button
  40. originalButton.parentNode.insertBefore(newButton, originalButton.nextSibling);
  41. }
  42.  
  43. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址