StickyUnitsWME

Used to make Measurement Units "Sticky." Supports cookies, and a fallback unit in the event the cookie is not found. Cookie setup can be found here https://i.imgur.com/DOn3sQw.png

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         StickyUnitsWME
// @namespace    http://tampermonkey.net/
// @version      2024-11-04 - 03
// @description  Used to make Measurement Units "Sticky." Supports cookies, and a fallback unit in the event the cookie is not found. Cookie setup can be found here https://i.imgur.com/DOn3sQw.png
// @author       PlurallyDialLLC
// @include         /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/?.*$/
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// @run-at       document-start
// ==/UserScript==


const METRIC = false; // To make editing easier for non-scripters.
const IMPERIAL = true; // To make editing easier for non-scripters.



//  \/ CONFIG \/

const FALLBACK_UNIT = IMPERIAL; // Unit that will be used IF a cookie is not found. Type either IMPERIAL or METRIC.

//  \/ CONFIG /\


(async function() {
    'use strict';
    const WME_COOKIE = await cookieStore.get("WME_MandateUnitType");
    const USE_IMPERIAL_UNIT = (WME_COOKIE && WME_COOKIE.value === "IMPERIAL" ) ? IMPERIAL : (WME_COOKIE && WME_COOKIE.value === "METRIC" ) ? METRIC : FALLBACK_UNIT;
    let pref = JSON.parse(localStorage.getItem("preferences-1"))
    pref.isImperial = USE_IMPERIAL_UNIT;
    localStorage.setItem("preferences-1",JSON.stringify(pref))
})();