您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enables the user to have a bigger map when using the map-maker. It also hides top bar and sidebar.
当前为
- // ==UserScript==
- // @name GeoGuessr Bigger Map on Map-Maker
- // @namespace MrMike/GeoGuessr/GeoGuessrBiggerMapOnMapMaker
- // @version 0.6.0
- // @description Enables the user to have a bigger map when using the map-maker. It also hides top bar and sidebar.
- // @author MrAmericanMike
- // @include /^(https?)?(\:)?(\/\/)?([^\/]*\.)?geoguessr\.com($|\/.*)/
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- (function () {
- "use strict";
- // Enable this if you want the delete key to delete the current location not having to go click the delete button
- // set the value either true or false
- const ENABLE_DELETE_KEY = true;
- const ENABLE_LEAVE_PAGE_PREVENTION = true;
- if (ENABLE_LEAVE_PAGE_PREVENTION) {
- window.addEventListener("beforeunload", (event) => {
- if (event.path[0].location.pathname == "/map-maker") {
- event.preventDefault();
- return event.returnValue = "Are you sure you want to exit?";
- }
- });
- }
- function addGlobalStyle(css) {
- var head, style;
- head = document.getElementsByTagName("head")[0];
- if (!head) { return; }
- style = document.createElement("style");
- style.innerHTML = css.replace(/;/g, " !important;");
- head.appendChild(style);
- }
- function doStyles() {
- addGlobalStyle(`
- .container__content {
- max-width: 98%;
- }
- .container--large {
- --width: 100rem;
- }
- .container--small {
- --width: 90rem;
- }
- .classic_layout__SWwJr {
- --layout-header-height: 0rem;
- }
- .classic_header__g_G4W, .title{
- display: none;
- }
- .classic_main__JenaD{
- margin: 0px;
- padding: 0px;
- }
- .classic_hasSubmenu__LfnDs {
- grid-template-columns: 0 1fr;
- }
- aside {
- display: none;
- }
- .streetview-panel {
- height: 100%;
- max-height: 100%;
- width: 50vw;
- }
- .map-maker-map__search {
- border: none;
- box-shadow: var(--shadow-1);
- font-size: var(--font-size-14);
- margin: 1rem;
- max-width: 75%;
- width: 50rem;
- }
- `);
- }
- function resetStyles() {
- addGlobalStyle(`
- .container--large {
- --width: 87.5rem;
- }
- .container--small {
- --width: 40rem;
- }
- .classic_layout__SWwJr {
- --layout-header-height: 5rem;
- }
- .container__content {
- margin: 0 auto;
- max-width: var(--width);
- }
- aside {
- display: block;
- }
- `);
- }
- function keyDown(event) {
- if (event.key == "Delete") {
- let buttons = document.getElementsByClassName("button--danger");
- for (let x = 0; x < buttons.length; x++) {
- if (buttons[x].textContent == "Delete") {
- buttons[x].click();
- }
- }
- }
- }
- // LISTEN FOR PAGE CHANGES
- let currentTab = "";
- let oldTab = "";
- window.addEventListener("click", (event) => {
- for (let x = 250; x < 2000; x += 250) {
- setTimeout(() => {
- lookForURLChange(event);
- }, x);
- }
- });
- function lookForURLChange(event) {
- if (event.explicitOriginalTarget) {
- if (event.explicitOriginalTarget.baseURI) {
- currentTab = event.explicitOriginalTarget.baseURI;
- }
- }
- if (event.path) {
- event.path.forEach((element) => {
- if (element.hasOwnProperty("URL") && element.hasOwnProperty("location")) {
- currentTab = element.location.pathname;
- }
- });
- }
- if (oldTab != currentTab) {
- oldTab = currentTab;
- if (currentTab.includes("map-maker")) {
- setTimeout(doStyles, 0);
- if (ENABLE_DELETE_KEY) {
- document.addEventListener("keydown", keyDown, true);
- }
- }
- else {
- setTimeout(resetStyles, 0);
- if (ENABLE_DELETE_KEY) {
- document.removeEventListener("keydown", keyDown, true);
- }
- }
- }
- }
- if (window.location.pathname.includes("map-maker")) {
- setTimeout(doStyles, 5);
- if (ENABLE_DELETE_KEY) {
- document.addEventListener("keydown", keyDown, true);
- }
- }
- })();