CryptalEquine / iZurvive UAZ Markers

// ==UserScript==
// @name          iZurvive UAZ Markers
// @namespace     ium
// @license       MIT
// @description   Adds UAZ markers to iZurvive
// @author        Sassy
// @include       *dayz.ginfo.gg*
// @include       *izurvive.com*
// @version       1.0.2
// @run-at        document-end
// @grant         unsafeWindow
// @updateURL     https://openuserjs.org/meta/CryptalEquine/iZurvive_UAZ_Markers.meta.js
// ==/UserScript==

const sleep = t => new Promise(s => setTimeout(s, t));
const Log = console.log;

var UAZs = [
   [301.54, 9308.08],
   [341.58, 9371.1],
   [383.54, 9451.48],
   [446.87, 9463.63],
   [709.39, 1871.93],
   [788.79, 1929.27],
   [861.06, 1953.98],
   [886.21, 7718.47],
   [1046.65, 7590.62],
   [1021.8, 13895.67],
   [1153.98, 7244.55],
   [1191.98, 7244.9],
   [1519.15, 14083.45],
   [1527.73, 14056.98],
   [1569.43, 13631.67],
   [1593.69, 14174.39],
   [1712.55, 14504.47],
   [1709.96, 14517.07],
   [2037, 10044.86],
   [2433.34, 15026.76],
   [2529.49, 5059.83],
   [2637.69, 5121.07],
   [2667.61, 6770.47],
   [2715.5, 6773.72],
   [2807.85, 5367.01],
   [2893.79, 5453.34],
   [2965.39, 7782.96],
   [3090.19, 7822.79],
   [3112.25, 8053.32],
   [3199.58, 6083.63],
   [3286.64, 14978.1],
   [3354.17, 15200.13],
   [3351.58, 15253.35],
   [3410.22, 12458.59],
   [3627.39, 8959.31],
   [3691.72, 15166.79],
   [3751.66, 8953.91],
   [3810, 8709.05],
   [3832.44, 10857.18],
   [3819.75, 10856.76],
   [3809.9, 10863.02],
   [3849.03, 10654.59],
   [3894.19, 10744.25],
   [3883.62, 10851.29],
   [3852, 10839.63],
   [3862.53, 10824.59],
   [3875.6, 10815.12],
   [3890.11, 10857.24],
   [3871.98, 10800.32],
   [3867.45, 10872.92],
   [3892.49, 10887.21],
   [3877.31, 10892.91],
   [3912.54, 8805.16],
   [3950.2, 10568.75],
   [3909.29, 10859.82],
   [3903.16, 10835.89],
   [3900.94, 10846.41],
   [4048.81, 10470.41],
   [4033.67, 11655.44],
   [4023.79, 11725.56],
   [4113.18, 10385.96],
   [4110.46, 10554.69],
   [4113.01, 10512.01],
   [4121.8, 10575.03],
   [4111.96, 13118.82],
   [4178.16, 10491.15],
   [4186.76, 10454.01],
   [4177.21, 10573.3],
   [4181.98, 11098.11],
   [4250.7, 10192.02],
   [4255.77, 11513.86],
   [4248.18, 11564.04],
   [4250.09, 11528.46],
   [4260.34, 11035.22],
   [4369.02, 10086.86],
   [4420.98, 9648.61],
   [4387.58, 10099.57],
   [4387.36, 10087],
   [4471.21, 2390.74],
   [4452.04, 4637.32],
   [4525.11, 9382.05],
   [4619.63, 5912.9],
   [4603.54, 9601.53],
   [4630.51, 9682.1],
   [4629.62, 10466.64],
   [4656.05, 11015.69],
   [4715.06, 9472.62],
   [4764.79, 2458.09],
   [4777.98, 11020.57],
   [4818.58, 10409.59],
   [4861.87, 2475.62],
   [4913.25, 2607.3],
   [4882.18, 10417.97],
   [4922.88, 10402.56],
   [5063.56, 2348.29],
   [5067.1, 2451.12],
   [5066.59, 5556.03],
   [5178.57, 2324.06],
   [5302.69, 9794.25],
   [5384, 2201.14],
   [5411.92, 2646.02],
   [5403.42, 14485.63],
   [5680.6, 2375.61],
   [5763.65, 2333.35],
   [5779.18, 2460.12],
   [5791.36, 3097.94],
   [5985.38, 3282.15],
   [6056.5, 7772.43],
   [6080.68, 3295.92],
   [6071.72, 7682.53],
   [6160.69, 3053],
   [6131.43, 3106.64],
   [6191.9, 3554.26],
   [6222.94, 14874.13],
   [6259.95, 3238.55],
   [6338.88, 2490.99],
   [6319.26, 7821.57],
   [6568.65, 2948.82],
   [6643.21, 14442.72],
   [6639.88, 15243.16],
   [6806.81, 3538.4],
   [6917.28, 3095.77],
   [7108.55, 7592.31],
   [7308.47, 3091.11],
   [7750.81, 12734.4],
   [7800.71, 14542.47],
   [7864.93, 12766.12],
   [7930.17, 14669.32],
   [8001.13, 12767.7],
   [8011.52, 14654.84],
   [8089.15, 9318.55],
   [8041.5, 14611.96],
   [8203.22, 12705.33],
   [8653.32, 13313.21],
   [9346.94, 2005.51],
   [9525.62, 13650.96],
   [10190.97, 4060.85],
   [10406.43, 2446.91],
   [10456.66, 5963.41],
   [10728.37, 14357.74],
   [11398.49, 14398.09],
   [11636.17, 15101.56],
   [11697.3, 14108.56],
   [11641.32, 15074.88],
   [11725.6, 9163.37],
   [11964.91, 9142.68],
   [11953.67, 12514.58],
   [12098.17, 9733.31],
   [12128.79, 12645.08],
   [12212.32, 13847.89],
   [12455.16, 12515.59],
   [12441.05, 12508.02],
   [12539.61, 13796.42],
   [12522.08, 13781.65],
   [12545.02, 13786.7],
   [12581.56, 13796.99],
   [12579.11, 13828.82],
   [12555.94, 13814.12],
   [12552.48, 13804.33],
   [12612.04, 13831.92],
   [12621.19, 13817.79],
   [13492.72, 14249.81],
   [13502.55, 13840.49],
   [13549.66, 14022.77],
   [13581.32, 12121.23],
   [13591.99, 14051.29],
   [13623.3, 13755.48],
   [13846.45, 13198.09],
   [15213.69, 13882.34]
];

var circleStyle = {
   radius: 1,
   fillColor: "#ff0000",
   color: "#ff0000",
   opacity: 0.75,
   fillOpacity: 0.5
};

function makeCircle(_coords) {
   var t = unsafeWindow.L.LocUtil.pointToCoords(_coords, unsafeWindow.iZurvive._locSearch.options.scalingParams)
   unsafeWindow.L.circleMarker(t, circleStyle).addTo(unsafeWindow.iZurvive._map);
}

async function main() {
   Log('Loaded main script');
   
   if (unsafeWindow.iZurvive == null) {
      await sleep(100);
      return main();
   }
   
   var uazSanitised = UAZs.map(function(n) {
      return {x: n[0], y: n[1]};
   });
   
   for (var c of uazSanitised) {
      makeCircle(c);
   }
   
   Log('Markers created');
}  

await main();