Hide search box for Google maps/Baidu maps

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();});
        }
    });
})();