Google to YouTube Search

Use your Google Search terms to search YouTube by clicking a new YouTube link added to your Google Search page. Also added Reddit and Github search options.

当前为 2023-06-11 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name               Google to YouTube Search
// @namespace          https://greasyfork.org/en/users/10118-drhouse
// @version            5.0
// @description        Use your Google Search terms to search YouTube by clicking a new YouTube link added to your Google Search page. Also added Reddit and Github search options.
// @run-at             document-start
// @include            https://www.google.*/search*
// @require            http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require            https://greasyfork.org/scripts/439099-monkeyconfig-modern-reloaded/code/MonkeyConfig%20Modern%20Reloaded.js?version=1012538
// @grant              GM_getValue
// @grant              GM_setValue
// @grant              GM_addStyle
// @grant              GM_registerMenuCommand
// @author             drhouse
// @license            CC-BY-NC-SA-4.0
// @icon               https://www.google.com/s2/favicons?domain=google.com
// ==/UserScript==
/* global jQuery, MonkeyConfig, $ */
$(document).ready(function () {
    var cfg = new MonkeyConfig({
            title: 'Configure',
            menuCommand: true,
            params: {
                'YouTube': {
                    type: 'checkbox',
                    default: true
                },
                'Reddit': {
                    type: 'checkbox',
                    default: true
                },
                'Github': {
                    type: 'checkbox',
                    default: true
                },
            },
        })
    
    var gquery = $("textarea").text()
    $('#hdtb-tls').css('margin-right','0px');
    if (cfg.get('Github'))
    $('<div class="hdtb-mitem hdtb-imb" id="above"><a class="q qs" href="https://github.com/search?q='+encodeURIComponent(gquery)+'&type=repositories">Github</a></div>').addClass('zItAnd FOU1zf').insertAfter("#cnt > div:nth-child(8) > div > div.aAbqZ > div > div.TrmO7").last();
    if (cfg.get('Reddit'))
    $('<div class="hdtb-mitem hdtb-imb" id="above"><a class="q qs" href="https://www.reddit.com/search/?q='+encodeURIComponent(gquery)+'">Reddit</a></div>').addClass('zItAnd FOU1zf').insertAfter("#cnt > div:nth-child(8) > div > div.aAbqZ > div > div.TrmO7").last();
    if (cfg.get('YouTube'))
    $('<div class="hdtb-mitem hdtb-imb" id="above"><a class="q qs" href="https://www.youtube.com/results?search_query='+encodeURIComponent(gquery)+'">YouTube</a></div>').addClass('zItAnd FOU1zf').insertAfter("#cnt > div:nth-child(8) > div > div.aAbqZ > div > div.TrmO7").last();
});