Replace IGDB with cs.rin.ru for Backloggd

Replaces the IGDB button on Backloggd with a cs.rin.ru downolad link

当前为 2025-03-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Replace IGDB with cs.rin.ru for Backloggd
  3. // @description Replaces the IGDB button on Backloggd with a cs.rin.ru downolad link
  4. // @author Soap
  5. // @namespace soap.systems
  6. // @homepageURL https://soap.systems
  7. // @match *://backloggd.com/games/*
  8. // @match *://*.backloggd.com/games/*
  9. // @grant none
  10. // @version 1.0
  11. // @icon https://external-content.duckduckgo.com/ip3/www.backloggd.com.ico
  12. // @license GPLv3
  13. // ==/UserScript==
  14.  
  15. /*
  16. TODO:
  17. - add a ProtonDB button if the "released on" section doesn't include Linux
  18. - scrape the IGDB link to add a gog-games.to link if it exists
  19. - SteamRip link? Might be kinda redundant
  20. */
  21.  
  22. // We have to get the game name and the right element from the IGDB link because Backloggd doesn't have any meaningful class names
  23. const link = document.querySelector('a[href^="https://www.igdb.com/games/"]')
  24. const linkElement = link.parentElement
  25.  
  26. if (linkElement) {
  27. let searchURL = getSearchURL(link)
  28. linkElement.innerHTML = `Download on <a href="${searchURL}" target="_blank">cs.rin.ru</a>`
  29. }
  30.  
  31.  
  32. function getSearchURL(link) {
  33. // examle IGDB link: https://backloggd.com/games/yakuza-6-the-song-of-life
  34. let searchQuery = link.href.split('/').pop()
  35. searchQuery = searchQuery.replaceAll('-', ' ')
  36. searchQuery = encodeURIComponent(searchQuery)
  37. let searchURL = 'https://cs.rin.ru/forum/search.php?keywords=' + searchQuery + '&terms=all&author=&sc=1&sf=titleonly&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search'
  38. return searchURL
  39. }