🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Filter Google Search Results by Language

Support Chinese, Chinese (Simplified), Chinese (Traditional), Japanese, English.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name Filter Google Search Results by Language
// @name:en Filter Google Search Results by Language
// @description Support Chinese, Chinese (Simplified), Chinese (Traditional), Japanese, English.
// @description:en Support Chinese, Chinese (Simplified), Chinese (Traditional), Japanese, English.
// @version 20151208
// @include https://www.google.com/*
// @grant none
// @namespace https://greasyfork.org/users/22325
// ==/UserScript==

(function() {

    function get_form_lr(){

        var list = ['lang_zh-CN%7Clang_zh-TW', 'lang_zh-CN', 'lang_zh-TW', 'lang_ja', 'lang_en', ''];
        var strlist = ['中文', '中文 (简体)', '中文 (繁體)', '日本語', 'English', '不限语言'];

        var baseurl = document.location.href.replace(/lr=([^&]+)&?/, '');
        var current = (RegExp.$1)? RegExp.$1 : '';
        var generateOption = function(v) {
            var i;
            var valuestr;
            for( i = 0 ; i < list.length ; i++ ){
                if( v == list[i] ){
                    valuestr = strlist[i];
                }
            }
            return '<option value="' + v + '"' 
                 + ((v == current)? ' selected="1"' : '') + '>' + valuestr + '</option>';
        };
        var opts = list.map(generateOption).join("\n");

        var func =  "var baseurl = document.location.href.replace(/&+lr=([^&]+|)(&+|$)/, '&');" + 
                    "baseurl = baseurl.replace( /\\?lr=.+?&/ , '?' );" + 
                    "var url = baseurl.replace(/https:\\/\\/www\\.google\\.com\\/search\\?/, 'search?');" + 
                    "url = url + '&lr=' + this.options[ this.selectedIndex ].value;" + 
                    "location.href = url;";
        return '<select style="width:90px" size="1" name="lr5" onchange="' + func + '">' + opts + '</select>';

    }

	document.getElementById('logocont').innerHTML = document.getElementById('logocont').innerHTML + "<div style=\"position:fixed;margin-left:17px; margin-top:20px; display\"><form>" + get_form_lr() + "</form></div>";
})();