Hide search box for Google maps/Baidu maps

google baidu 地图隐藏搜索框(F2)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Hide search box for Google maps/Baidu maps
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  google baidu 地图隐藏搜索框(F2)
// @author       You
// @match        http://map.baidu.com/*
// @match        https://www.google.com/maps/*
// @match        http://www.google.cn/maps/*
// @require      http://code.jquery.com/jquery-3.1.0.slim.min.js
// @grant        none
// ==/UserScript==

(function() {
    var zList = new Object();
    zList.baidu_id = "left-panel,app-right-top,map-operate,mapType,newuilogo,map-bottom-tip,tooltip-route".split(",");
    zList.baidu_class = "BMap_scaleCtrl,BMap_cpyCtrl".split(",");
    zList.google_id = "vasquette,watermark,omnibox-container".split(",");
    zList.google_class = "app-viewcard-strip,scene-footer-container,widget-pane-toggle-button-container,widget-scene-effects noprint".split(",");
    //判断域名
    if(document.domain.match("google")){
        zList.domain = "google";
    } else if(document.domain.match("baidu")){
        zList.domain = "baidu";
    } else {
        zList.domain = 0;
    }
    //alert(zList[zList.domain + "_id"].join("---"));
    $(window).keydown(function(event){
        if(event.keyCode == 113 && zList.domain){
            $.each(zList[zList.domain + "_id"],function(i,n){$("#"+n).toggle();});
            $.each(zList[zList.domain + "_class"],function(i,n){$("."+n).toggle();});
        }
    });
})();