您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make vDip show big map by default on game board screen
// ==UserScript== // @name Always show big map on vdip // @namespace https://dankhammer.com/ // @version 0.1 // @description Make vDip show big map by default on game board screen // @author tickl // @match https://www.vdiplomacy.com/board.php* // @match https://vdiplomacy.com/board.php* // @icon https://www.google.com/s2/favicons?domain=vdiplomacy.com // @grant none // @run-at document-end // ==/UserScript== let imgHref = window.location.href; if (imgHref.includes('vdiplomacy.com')) { if (window.localStorage.getItem("alwayslargemap") == null) { window.localStorage.setItem("alwayslargemap", true) } var useLargeMap = window.localStorage.getItem("alwayslargemap") if (useLargeMap == "true") { document.getElementById("mapImage").src = document.getElementById("LargeMapLink").href document.getElementById("LargeMapLink").children[0].textContent = "Swap to Small Map" }else{ document.getElementById("LargeMapLink").children[0].textContent = "Swap to Big Map" } document.getElementById("LargeMapLink").removeAttribute("href") document.getElementById("LargeMapLink").onclick = function(){ useLargeMap = window.localStorage.getItem("alwayslargemap") if (useLargeMap == "false") { window.localStorage.setItem("alwayslargemap", true) }else{ window.localStorage.setItem("alwayslargemap", false) } //refresh the map using swapping document.getElementsByClassName("maptools")[0].children[1].onclick() document.getElementsByClassName("maptools")[0].children[1].onclick() } var contents = document.getElementsByClassName("content") Array.from(contents).forEach( function(frame){ frame.style="max-width: 100%" } ) console.log('View vDip Large Image start up.'); var callback = function (mutationsList, observer) { var useLargeMap = window.localStorage.getItem("alwayslargemap") if (useLargeMap == "true") { document.getElementById("LargeMapLink").children[0].children[0].textContent = "Swap to Small Map" document.getElementById("mapImage").src = document.getElementById("LargeMapLink").childElements("LargeMapLink")[0].href }else{ document.getElementById("LargeMapLink").children[0].children[0].textContent = "Swap to Big Map" } document.getElementById("LargeMapLink").removeAttribute("href") document.getElementById("LargeMapLink").children[0].removeAttribute("href") }; const observeConfig = { attributes: false, childList: true }; const observer = new MutationObserver(callback); observer.observe(document.getElementById("LargeMapLink"), observeConfig); }