您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replaces the "Videos" navigation tab with "YouTube" so you can easily go to YouTube with your Google search query
// ==UserScript== // @name Google - Change "Videos" tab to "YouTube" // @namespace http://userscripts.org/users/23652 // @description Replaces the "Videos" navigation tab with "YouTube" so you can easily go to YouTube with your Google search query // @include http://www.google.com/search?*q=* // @include https://www.google.com/search?*q=* // @copyright JoeSimmons // @version 1.0.2 // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html // @grant GM_addStyle // ==/UserScript== (function () { var videosLink = document.querySelector('#hdtb-msb .hdtb-mitem a[href*="&tbm=vid"]'), intv; function changeLink() { if (videosLink.firstChild.data === 'YouTube' && videosLink.href.indexOf('youtube.com') !== -1) { return window.clearInterval(intv); } // change the link's text videosLink.firstChild.data = 'YouTube'; // change the link's url videosLink.href = 'https://www.youtube.com/results?search_query=' + location.href.match(/[?&]?q=([^&]*)/)[1]; } // make sure the page is not in a frame // and if there is a "Videos" link if (window.frameElement || window !== window.top || !videosLink) { return; } // change the link's text // keep changing it until it actually changes... sometimes it doesn't work right away intv = window.setInterval(changeLink, 500); }());