Hide search box for Google maps/Baidu maps

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey 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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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