Greasy Fork is available in English.

Steam Game Page - Add Links To Game Trailer & Gameplay Search On YouTube

This script adds links to the right of the breadcrumbs on a Steam game page so you can easily and quickly search youtube for a trailer for the game or for a gameplay video.

  1. // ==UserScript==
  2. // @name Steam Game Page - Add Links To Game Trailer & Gameplay Search On YouTube
  3. // @namespace coop
  4. // @version 0.4
  5. // @description This script adds links to the right of the breadcrumbs on a Steam game page so you can easily and quickly search youtube for a trailer for the game or for a gameplay video.
  6. // @author You
  7. // @match http://store.steampowered.com/app/*
  8. // @match https://store.steampowered.com/app/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. const gameName = document.querySelector('.apphub_AppName').textContent.trim()
  13.  
  14. const breadcrumbsContainer = document.querySelector('.breadcrumbs')
  15.  
  16. breadcrumbsContainer.setAttribute('style', `
  17. display: flex;
  18. justify-content: space-between;
  19. margin-right: 320px;
  20. `)
  21.  
  22. const metaLinksContainer = document.createElement('div')
  23. metaLinksContainer.setAttribute('style', `
  24. display: flex;
  25. justify-content: space-between;
  26. width: 193px;
  27. `)
  28.  
  29. const gogSearchLink = document.createElement('a')
  30. gogSearchLink.href = 'https://www.google.com/search?q=site%3Agog.com+' + gameName
  31. gogSearchLink.textContent = 'Find On GoG'
  32. gogSearchLink.setAttribute('target', '_blank')
  33.  
  34. const ytTrailerSearchLink = document.createElement('a')
  35. ytTrailerSearchLink.href = 'https://www.youtube.com/results?search_query=' + encodeURIComponent(gameName) + ' trailer'
  36. ytTrailerSearchLink.textContent = 'Trailer'
  37. ytTrailerSearchLink.setAttribute('target', '_blank')
  38.  
  39.  
  40. const ytGameplaySearchLink = document.createElement('a')
  41. ytGameplaySearchLink.href = 'https://www.youtube.com/results?search_query=' + encodeURIComponent(gameName) + ' gameplay'
  42. ytGameplaySearchLink.textContent = 'Gameplay'
  43. ytGameplaySearchLink.setAttribute('target', '_blank')
  44.  
  45. metaLinksContainer.appendChild(gogSearchLink)
  46. metaLinksContainer.appendChild(ytTrailerSearchLink)
  47. metaLinksContainer.appendChild(ytGameplaySearchLink)
  48.  
  49. breadcrumbsContainer.appendChild(metaLinksContainer)