您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
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.
当前为
- // ==UserScript==
- // @name Steam Game Page - Add Links To Game Trailer & Gameplay Search On YouTube
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @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.
- // @author You
- // @match http://store.steampowered.com/app/*
- // @grant none
- // ==/UserScript==
- const gameName = document.querySelector('.apphub_AppName').textContent.trim()
- const breadcrumbsContainer = document.querySelector('.breadcrumbs')
- breadcrumbsContainer.setAttribute('style', `
- display: flex;
- justify-content: space-between;
- margin-right: 320px;
- `)
- const metaLinksContainer = document.createElement('div')
- metaLinksContainer.setAttribute('style', `
- display: flex;
- justify-content: space-between;
- width: 126px;
- `)
- const ytTrailerSearchLink = document.createElement('a')
- ytTrailerSearchLink.href = 'https://www.youtube.com/results?search_query=' + encodeURIComponent(gameName) + ' trailer'
- ytTrailerSearchLink.textContent = 'Trailer'
- ytTrailerSearchLink.setAttribute('target', '_blank')
- const ytGameplaySearchLink = document.createElement('a')
- ytGameplaySearchLink.href = 'https://www.youtube.com/results?search_query=' + encodeURIComponent(gameName) + ' gameplay'
- ytGameplaySearchLink.textContent = 'Gameplay'
- ytGameplaySearchLink.setAttribute('target', '_blank')
- metaLinksContainer.appendChild(ytTrailerSearchLink)
- metaLinksContainer.appendChild(ytGameplaySearchLink)
- breadcrumbsContainer.appendChild(metaLinksContainer)