Deku Deals Link Target Modifier

Various things I like

  1. // ==UserScript==
  2. // @name Deku Deals Link Target Modifier
  3. // @namespace https://codeberg.org/shmup/junk-trove
  4. // @version 1.0
  5. // @description Various things I like
  6. // @author shmup
  7. // @match https://www.dekudeals.com/*
  8. // @grant none
  9. // @run-at document-end
  10. // @license Unlicense
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. // open the eshop links in the same tab
  17. document
  18. .querySelectorAll("a[href*='nintendo.com/store/products/']")
  19. .forEach((link) => {
  20. link.target = "_self";
  21. });
  22.  
  23. // open the game links in a new tab
  24. document.querySelectorAll("a[href*='/items/']").forEach((link) => {
  25. link.target = "_blank";
  26. });
  27.  
  28. // auto-expand the game info
  29. document.querySelectorAll("main a.collapse-control").forEach((expand) => {
  30. const h3 = expand.querySelector("h3");
  31. if (h3 && h3.textContent.trim() === "Screenshots") return;
  32. expand.click();
  33. });
  34.  
  35. // scroll to the price history
  36. const priceHistory = document.querySelector("#price-history");
  37. if (priceHistory) {
  38. priceHistory.scrollIntoView();
  39. }
  40. })();