您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enables the user to have a bigger map when using the map-maker // It also hides the Search Bar and the Sidebar when using the map-maker
当前为
- // ==UserScript==
- // @name GeoGuessr Bigger Map on Map-Maker
- // @namespace https://bitbucket.org/MrAmericanMike/
- // @version 0.3.3
- // @description Enables the user to have a bigger map when using the map-maker // It also hides the Search Bar and the Sidebar when using the map-maker
- // @author MrAmericanMike
- // @include /^(https?)?(\:)?(\/\/)?([^\/]*\.)?geoguessr\.com($|\/.*)/
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- console.log("GeoGuessr Bigger Map on Map-Maker");
- const ENABLE_DELETE_KEY = false; // Enable this if you want the delete key to delete the current location not having to go click the delete button
- function addGlobalStyle(css) {
- var head, style;
- head = document.getElementsByTagName("head")[0];
- if (!head) { return; }
- style = document.createElement("style");
- style.type = "text/css";
- style.innerHTML = css.replace(/;/g, " !important;");
- head.appendChild(style);
- }
- function doStyles(){
- addGlobalStyle (`
- .container {
- --width: 100%;
- }
- .layout {
- --layout-content-padding-top: 0.5rem;
- --layout-content-padding-bottom: 2.5rem;
- --layout-content-horizontal-padding: 0.5rem;
- }
- .layout--always-show-sidebar-on-large-devices {
- grid-template-columns: 0rem 1fr;
- }
- aside, .title, .header__search-bar {
- display: none;
- }
- .map-maker-map {
- width: 100%;
- height: 90vh;
- padding-bottom: 0%;
- position: relative;
- }
- .streetview-panel {
- width: 50rem;
- height: 100%;
- max-height: 100%;
- right: 0;
- top: 0;
- position: absolute;
- }
- `);
- }
- function resetStyles(){
- addGlobalStyle (`
- .container {
- --width: 87.5rem;
- }
- .layout {
- --layout-content-padding-top: 0.5rem;
- --layout-content-padding-bottom: 2.5rem;
- --layout-content-horizontal-padding: 0.5rem;
- }
- .layout--always-show-sidebar-on-large-devices {
- grid-template-columns: 18rem 1fr;
- }
- aside, .title, .header__search-bar {
- display: block;
- }
- .map-maker-map {
- width: 100%;
- height: 0;
- padding-bottom: 50%;
- position: relative;
- overflow: hidden;
- box-shadow: var(--shadow-1);
- }
- .streetview-panel {
- width: 35rem;
- height: 100%;
- max-height: 30rem;
- right: 0;
- top: 0;
- position: absolute;
- background: var(--color-grey-0);
- display: flex;
- flex-direction: column;
- transform: translateX(100%);
- transition: transform .2s ease;
- box-shadow: var(--shadow-1);
- }
- `);
- }
- function keyDown(event){
- console.log(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 = 0; x < 2500; x+=250){
- setTimeout(() => {
- lookForURLChange(event);
- }, x);
- }
- });
- function lookForURLChange(event) {
- if(event["explicitOriginalTarget"]["baseURI"]){
- currentTab = event["explicitOriginalTarget"]["baseURI"];
- }
- else if(event.hasOwnProperty("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.aremoveEventListener("keydown", keyDown, true);
- }
- }
- }
- }
- if(window.location.pathname.includes("map-maker")){
- setTimeout(doStyles, 5);
- if(ENABLE_DELETE_KEY){
- document.addEventListener("keydown", keyDown, true);
- }
- }