// ==UserScript==
// @name WME RA Util
// @namespace https://greasyfork.org/users/30701-justins83-waze
// @version 2025.02.02.01
// @description Providing basic utility for RA adjustment without the need to delete & recreate
// @include https://www.waze.com/editor*
// @include https://www.waze.com/*/editor*
// @include https://beta.waze.com/*
// @exclude https://www.waze.com/user/editor*
// @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
// @connect greasyfork.org
// @author JustinS83
// @grant GM_xmlhttpRequest
// @license GPLv3
// @contributionURL https://github.com/WazeDev/Thank-The-Authors
// @downloadURL none
// ==/UserScript==
/* global W */
/* global WazeWrap */
/* global OpenLayers */
/* global require */
/* global $ */
/* global _ */
/* global I18n */
/* eslint curly: ["warn", "multi-or-nest"] */
/*
non-normal RA color:#FF8000
normal RA color:#4cc600
*/
(function() {
var RAUtilWindow = null;
var UpdateSegmentGeometry;
var MoveNode, MultiAction;
var drc_layer;
let wEvents;
const SCRIPT_VERSION = GM_info.script.version.toString();
const SCRIPT_NAME = GM_info.script.name;
const DOWNLOAD_URL = GM_info.scriptUpdateURL;
//var totalActions = 0;
var _settings;
const updateMessage = "Fixed center calculation - was using custom calculations (for some reason?) in some cases, which also failed because of WME changes - this caused the RA Angle circles to be drawn off center (sometimes incredibly so). Now always using the RA's center position as defined by WME.
Fixed variable scoping in some areas.";
function bootstrap(tries = 1) {
if (W && W.map && W.model && require && WazeWrap.Ready){
loadScriptUpdateMonitor();
init();
}
else if (tries < 1000)
setTimeout(function () {bootstrap(++tries);}, 200);
}
bootstrap();
function loadScriptUpdateMonitor() {
let updateMonitor;
try {
updateMonitor = new WazeWrap.Alerts.ScriptUpdateMonitor(SCRIPT_NAME, SCRIPT_VERSION, DOWNLOAD_URL, GM_xmlhttpRequest);
updateMonitor.start();
} catch (ex) {
// Report, but don't stop if ScriptUpdateMonitor fails.
console.error(`${SCRIPT_NAME}:`, ex);
}
}
function init(){
injectCss();
UpdateSegmentGeometry = require('Waze/Action/UpdateSegmentGeometry');
MoveNode = require("Waze/Action/MoveNode");
MultiAction = require("Waze/Action/MultiAction");
console.log("RA UTIL");
console.log(GM_info.script);
if(W.map.events)
wEvents = W.map.events;
else
wEvents = W.map.getMapEventsListener();
RAUtilWindow = document.createElement('div');
RAUtilWindow.id = "RAUtilWindow";
RAUtilWindow.style.position = 'fixed';
RAUtilWindow.style.visibility = 'hidden';
RAUtilWindow.style.top = '15%';
RAUtilWindow.style.left = '25%';
RAUtilWindow.style.width = '510px';
RAUtilWindow.style.zIndex = 100;
RAUtilWindow.style.backgroundColor = '#FFFFFE';
RAUtilWindow.style.borderWidth = '0px';
RAUtilWindow.style.borderStyle = 'solid';
RAUtilWindow.style.borderRadius = '10px';
RAUtilWindow.style.boxShadow = '5px 5px 10px Silver';
RAUtilWindow.style.padding = '4px';
var alertsHTML = '
Enable Roundabout Angles
'; //***************** Shift Amount ************************** // Define BOX alertsHTML += 'in'; // Move node OUT alertsHTML += 'out'; alertsHTML += '
in'; // Move node OUT alertsHTML += 'out'; alertsHTML += '