Project Zomboid Fans Map Tool

Makes the standard (non full screen) maps most of the width/height of you screen space. Puts the site into dark mode. Makes coordinates on the page into links that re-centre the map to them.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Project Zomboid Fans Map Tool
// @description  Makes the standard (non full screen) maps most of the width/height of you screen space. Puts the site into dark mode. Makes coordinates on the page into links that re-centre the map to them.
// @namespace    https://monkeyr.com/
// @version      1.2
// @license      MIT
// @author       mh
// @match        https://pzfans.com/*-online-map/
// @match        https://pzfans.com/vanilla-full-map/
// @match        https://pzfans.com/project-zomboid-maps/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pzfans.com
// @grant        GM_addStyle
// @require      https://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

(function($) {
    'use strict';
    // add the dark theme then make the map bigger
    GM_addStyle(`
      html, #contentDiv{
        filter: invert(100%) hue-rotate(180deg);
      }
      .grid-container {max-width: inherit}
      .site-content .content-area {width:100%!important}
      #right-sidebar {display: none}
      #contentDiv {height:90vh!important}
    `);
    // loop each paragraph and heading looking for coords, when found make them a link with data of the coords
    $.each(['p','h2','h3'], (i,v)=>{
        $(v).each(function(){
            const p = $(this);
            p.html(p.html().replace(/(\d+),\s*(\d+)/ig, (f,x,y)=>{
                return `<a href="#" data-x="${x}" data-y="${y}" class="coord">${f}</a>`;
            }));
        });
    });
    // find those links with data and make them re-center the map on the coords provided
    $('a.coord').on('click', function(e){
        e.preventDefault();
        const a = $(this);
        $('#x').val(a.data('x'));
        $('#y').val(a.data('y'));
        panto();
        $("#layerSelector")[0].scrollIntoView({
            behavior: "instant", // or "auto" or "smooth"
            block: "start" // or "end"
        });
    });
})(jQuery);