Nexus Clash Mini-Map (B4)

Adds a mini-map below the standard map view

目前為 2020-09-01 提交的版本,檢視 最新版本

// ==UserScript==
// @name          Nexus Clash Mini-Map (B4)
// @namespace     https://roadha.us/
// @author        haliphax
// @version       0.1
// @description   Adds a mini-map below the standard map view
// @include       https://www.nexusclash.com/modules.php?name=Game*
// ==/UserScript==

(function(){
    'use strict';

    let txt = document.querySelector('.tile_description b u').innerText,
        coords = /\(([0-9]+), ([0-9]+) ([a-z]+), a/i.exec(txt);

    if (coords == null) return;

    let x = (parseInt(coords[1]) * 24 - 144) * -1,
        y = (parseInt(coords[2]) * 24 - 144) * -1,
        map = coords[3].toLowerCase(),
        row = document.createElement('tr');

    if (map == 'laurentia') map = 'valhalla';

    row.innerHTML = '<td><div id="ultramap" style="position: relative; margin: 0 auto; width: 312px; height: 312px; background-image: url(https://plscks.github.io/testHYPERMAP/' + map +'.png); background-position: ' + x + 'px ' + y + 'px; background-repeat: no-repeat;"><div id="position" style="width: 72px;height: 72px;top: 120px;left: 120px;z-index: 99;position: absolute;background: url(https://plscks.github.io/testHYPERMAP/icons/you.png);"></div></div></td>';
    document.getElementById('mapheading').parentNode.parentNode.appendChild(row);
}());