Google Maps RAP Helper

Provides enhancements to the Report a Problem workflow on Google Maps.

当前为 2025-08-12 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Google Maps RAP Helper
// @namespace    https://github.com/gncnpk/google-maps-rap-helper
// @version      0.0.4
// @description  Provides enhancements to the Report a Problem workflow on Google Maps.
// @author       Gavin Canon-Phratsachack (https://github.com/gncnpk)
// @match        https://www.google.com/local/place/rap/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com/maps
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    const style = document.createElement('style');
    style.textContent = `
    .bXBVC {
      width: auto !important;
      min-width: 660px !important;
    }
    .VrVhlb {
      padding: 7px 0 !important;
    }
    .oUMFGb {
      padding-bottom: 0 !important;
    }
    .F1scXd {
      padding-top: 0 !important;
    }
    .Fr7WSc {
      margin-top: 0 !important;
      margin-bottom: 8px !important;
    }
    .d8o5Xb.PE43zc {
      display: none !important;
    }
    .d8o5Xb.jkFcB {
      display: none !important;
    }
    .VfPpkd-LgbsSe.ksBjEc.lKxP2d.LQeN7.nbyAjc {
      min-height: 0 !important;
    }
    .VfPpkd-fmcmS-yrriRe-OWXEXe-INsAgc {
      height: 42px !important;
    }
    .NBJ1Qd {
      margin: auto 15px !important;
    }
    .lY28cc {
      height: 42px !important;
    }
    .VrVhlb.Ia4Txd {
      padding: 0 !important;
    }
    .VrVhlb.aEENkc {
      padding: 0 !important;
      display: inline-flex !important;
    }
    .M4WCbd {
      padding-top: 14px !important;
    }
    .VfPpkd-NLUYnc-V67aGc.VfPpkd-NLUYnc-V67aGc-OWXEXe-TATcMc-KLRBe {
      padding-top: 5px !important;
    }
    .VfPpkd-fmcmS-yrriRe-W0vJo-fmcmS.VfPpkd-fmcmS-yrriRe-W0vJo-fmcmS-OWXEXe-Rfh2Tc-EglORb {
      margin-top: -5px !important;
      margin-bottom: 6px !important;
    }
    .mY1Jkc {
      display: none !important;
    }
    .gpDxW .oUMFGb {
      padding: 6px 0 !important;
    }
    .oFv6Y {
      padding-top: 0 !important;
    }
    .iYoXh {
      margin: auto !important;
    }
    .x4Mfpc {
      margin-bottom: 0 !important;
      margin-top: 4px !important;
    }
  `;
    document.head.appendChild(style);

    function AAP_removeClutteredElements() {
        Array.from(document.getElementsByClassName("oUMFGb")[0].children).slice(0, 2).forEach((e) => {
            e.style = "display:none;"
        });
        Array.from(document.getElementsByClassName("oUMFGb")).slice(3, 6).forEach((e) => {
            e.children[0].style = "display:none;"
        });
        Array.from(document.getElementsByClassName("oUMFGb")[5].children[1].children).slice(0, 2).forEach((e) => {
            e.style = "display:none;"
        });
        document.getElementsByClassName("VfPpkd-fmcmS-yrriRe-W0vJo-RWgCYc")[1].style = "display: none;";
        document.getElementsByClassName("VfPpkd-LgbsSe ksBjEc lKxP2d LQeN7 nbyAjc")[0].className = "VfPpkd-LgbsSe VfPpkd-LgbsSe-OWXEXe-INsAgc VfPpkd-LgbsSe-OWXEXe-Bz112c-M1Soyc VfPpkd-LgbsSe-OWXEXe-dgl2Hf Rj2Mlf OLiIxf PDpWxe LQeN7 ZY937 s73B3c wF1tve Q8G3mf";
    }

    function SAE_removeClutteredElements() {
        Array.from(document.getElementsByClassName("x4Mfpc")[0].children).slice(0, 2).forEach((e) => {
            e.style = "display: none !important";
        })
    }

    function AAP_showAllFields() {
        document.getElementsByClassName("vIDuvd IXetx")[0].click()
    }

    function SAE_showAllSmallFields() {
        Array.from(document.getElementsByClassName("VfPpkd-rOvkhd-XPtOyb-hhpA7")[0].children).forEach((e) => {
            if (!e.className.includes("VfPpkd-rOvkhd-XPtOyb-OWXEXe-gk6SMd") && e.innerText.split("\n")[1] !== "Location") {
                e.children[0].click();
            }
        })
    }

    function AAP_compactElements() {
        let claimBusinessJSController = document.getElementsByClassName("VrVhlb Ia4Txd")[0].children[0];
        document.getElementsByClassName("VrVhlb aEENkc")[0].appendChild(claimBusinessJSController)
        claimBusinessJSController.style = "margin-left: 5px";
    }

    function SAE_compactElements() {
        Array.from(document.getElementsByClassName("VrVhlb")).slice(1, 3).forEach((e) => {
            e.children[0].style = "display: flex !important";
            e.children[0].children[0].style = "width: 100% !important"
        });
        Array.from(document.getElementsByClassName("VrVhlb")).slice(4, 5).forEach((e) => {
            e.children[0].style = "display: flex !important";
            e.children[0].children[0].style = "width: 100% !important"
        });
        Array.from(document.getElementsByClassName("VrVhlb")).slice(6, 9).forEach((e) => {
            e.children[0].style = "display: flex !important";
            e.children[0].children[0].style = "width: 100% !important"
        });
    }
    addEventListener("load", () => {
        if (window.location.href.includes("addaplace")) {
            AAP_removeClutteredElements();
            AAP_showAllFields();
            AAP_compactElements();
        } else if (window.location.href.includes("editv2")) {
            SAE_removeClutteredElements();
            SAE_compactElements();
            SAE_showAllSmallFields();
        }

    })
})();