Greasy Fork

Greasy Fork is available in English.

多吉搜索直达按钮

给百度、360、搜狗、必应等搜索引擎的结果页加入多吉搜索按钮,一键跳转到多吉搜索进行相同关键词的检索。

目前为 2019-11-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         多吉搜索直达按钮
// @description  给百度、360、搜狗、必应等搜索引擎的结果页加入多吉搜索按钮,一键跳转到多吉搜索进行相同关键词的检索。
// @namespace    http://greasyfork.icu/zh-CN/users/393603-tsing
// @version      2.0
// @author       Tsing
// @include      *://ipv6.baidu.com/s?*
// @include      *://www.baidu.com/s?*
// @include      *://www.so.com/s?*
// @include      *://www.sogou.com/web?*
// @include      *://cn.bing.com/search?*
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @grant        none
// @note         2019.10.31 V1.0 在百度搜索的结果页加入多吉搜索按钮。
// @note         2019.11.06 V2.0 听取多吉搜索开发者 @nicoljiang 的建议,给检索关键词进行 urlencode 编码,并新增支持360、搜狗、必应搜索。给多吉搜索选择一个特征色号:#dd2248,保证视觉统一性。
// ==/UserScript==

(function() {
    'use strict';

    var hostname = window.location.hostname;

    if(hostname.match(RegExp(/baidu.com/))){
        // 百度搜索
        var url_baidu = "https://www.dogedoge.com/results?q=" + encodeURIComponent($("#kw").val()) + "&from=TsingScript";
        $("#form").append('<span style="display: inline-block;"><a href="' + url_baidu + '" target="_blank" title="利用多吉搜索引擎进行检索" id="dogedoge" style="display:block; float:left; font-size:14px; text-align:center; width:100px; height:33px; line-height:33px; margin-left:5px; color:#fff; letter-spacing:1px; background:#3385ff; border-bottom:1px solid #2d78f4; outline:medium;">多吉搜索</a></span>')

    }else if(hostname.match(RegExp(/so.com/))){
        // 360搜索
        var url_360 = "https://www.dogedoge.com/results?q=" + encodeURIComponent($("#keyword").val()) + "&from=TsingScript";
        $(".adv-search-wrap").after('<span class="adv-search-wrap"><a href="' + url_360 + '" target="_blank" title="利用多吉搜索引擎进行检索" id="dogedoge" style="display:block; background:#19b955;height:38px;line-height:38px;width:90px;text-align:center;color:#ffffff;font-size:14px;">多吉搜索</a></span>');

    }else if(hostname.match(RegExp(/sogou.com/))){
        //搜狗搜索
        var url_sogou = "https://www.dogedoge.com/results?q=" + encodeURIComponent($("#upquery").val()) + "&from=TsingScript";
        $(".querybox").append('<a href="' + url_sogou + '" target="_blank" title="利用多吉搜索引擎进行检索" id="dogedoge" class="sbtn1" style="text-align:center;line-height:34px;color:#333;" onmouseup="this.className=\'sbtn1\'" onmousedown="this.className=\'btnactive\'" onmouseout="this.className=\'sbtn1\'" onmouseover="this.className=\'btnactive\'">多吉搜索</a>');

    }else if(hostname.match(RegExp(/bing.com/))){
        //必应搜索
        var url_bing = "https://www.dogedoge.com/results?q=" + encodeURIComponent($("#sb_form_q").val()) + "&from=TsingScript";
        $("#sb_form").append('<a href="'+ url_bing + '" target="_blank" title="利用多吉搜索引擎进行检索" id="dogedoge" class="b_searchbox" style="display:inline-block; width:100px; line-height:32px; margin:0 0 0 10px; padding:5px; color:#444; font-size:16px; font-weight:500; text-align:center; border-radius:6px; border-color:#eee; box-shadow:0 0 0 1px rgba(0,0,0,.1), 0 2px 4px 0 rgba(0,0,0,.16)">多吉搜索</a>');
    }

})();