WME Change Segment Display

Change display of edited segments

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* global W */
// ==UserScript==
// @name         WME Change Segment Display
// @namespace    https://greasyfork.org/en/users/19426-bmtg
// @version      0.21
// @description  Change display of edited segments
// @author       bmtg
// @match        http://*/*
// @include     https://editor-beta.waze.com/*editor/*
// @include     https://www.waze.com/*editor/*
// @exclude     https://www.waze.com/*user/editor/*
// @grant	   none
// ==/UserScript==
/* jshint -W097 */

(function () {
	'use strict';
	function CSD_bootstrap() {
		if ( "undefined" !== typeof W.loginManager && "undefined" !== typeof W.map) {
			setTimeout(monitorSegments,500);  //  Run the code to check for data return from the Sheets
		} else {
			console.log("Waiting for WME map and login...");
			setTimeout(function () { CSD_bootstrap(); }, 300);
		}
	}
	
	function monitorSegments() {
		for (var segObj in W.model.segments.objects) {
			var segment = W.model.segments.get(segObj);
			var line = document.getElementById(segment.geometry.id);

			if (line === null) {
				continue;
			}

			if ( line.getAttribute('stroke') === '#ff8383' ) {
				line.setAttribute('stroke','#ffFFFF');
				line.setAttribute('stroke-linecap','0');
				line.setAttribute('stroke-width','15');
				line.setAttribute('stroke-dasharray','9 2');
			} else if ( line.getAttribute('stroke') === '#eb7171') {
				line.setAttribute('stroke','#FFFFFF');
				//line.setAttribute('stroke-linecap','0');
				line.setAttribute('stroke-width','14');
				//line.setAttribute('stroke-dasharray','9 4');
			}
		}
		
		//console.log("CSD refreshing");
		setTimeout(monitorSegments,700);
	}
	
	
	
	
	CSD_bootstrap();
	
})();