Greasy Fork is available in English.

WME GetNodeID

Gives NodeID of selected segments

Stan na 16-05-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name                WME GetNodeID
// @namespace           Fafa114
// @description         Gives NodeID of selected segments
// @include             https://www.waze.com/editor/*
// @include             https://www.waze.com/*/editor/*
// @version             0.2
// @grant               na
// ==/UserScript==

if ('undefined' == typeof __RTLM_PAGE_SCOPE_RUN__) {
	(function page_scope_runner() {
		var my_src = "(" + page_scope_runner.caller.toString() + ")();"; // If we're _not_ already running in the page, grab the full source of this script.

		// Create a script node holding this script, plus a marker that lets us know we are running in the page scope (not the Greasemonkey sandbox).
		// Note that we are intentionally *not* scope-wrapping here.
		var script = document.createElement('script');
		script.setAttribute("type", "text/javascript");
		script.textContent = "var __RTLM_PAGE_SCOPE_RUN__ = true;\n" + my_src;

		// Insert the script node into the page, so it will run, and immediately remove it to clean up.  Use setTimeout to force execution "outside" of the user script scope completely.
		setTimeout(function() {
			document.body.appendChild(script);
			document.body.removeChild(script);
		}, 0);
	})();
	return; // Stop running, because we know Greasemonkey actually runs us in an anonymous wrapper.
}

function bootstrap(){
	if (typeof(unsafeWindow) === "undefined"){
		unsafeWindow = ( function () {
			var dummyElem = document.createElement('p');
			dummyElem.setAttribute('onclick', 'return window;');
			return dummyElem.onclick();
		}) ();
	}
	/* begin running the code! */
	setTimeout(init, 700);
}

function NodesID() {
	var Nbr = Waze.selectionManager.selectedItems.length;
	var NbrSeg = 0;
	var Texte = "";
	var Mem = [];
	if (Nbr > 0) {
        for(i = 0; i<Nbr; i++){ 
        	if (Waze.selectionManager.selectedItems[i].model.type == "segment") { 
				var TrouveFrom = false;
				var TrouveTo = false;
				for(u = 0; u<Mem.length; u++){
					if (Waze.selectionManager.selectedItems[i].model.attributes.fromNodeID == Mem[u]){
						TrouveFrom = true;
					}
					if (Waze.selectionManager.selectedItems[i].model.attributes.toNodeID == Mem[u]){
						TrouveTo = true;
					}
				}
				if (TrouveFrom == false){
					Mem[Mem.length] = Waze.selectionManager.selectedItems[i].model.attributes.fromNodeID;
					if (i == 0){
						Texte = Waze.selectionManager.selectedItems[i].model.attributes.fromNodeID;
					}else{
						Texte = Texte + ', ' + Waze.selectionManager.selectedItems[i].model.attributes.fromNodeID;
					}
				}
				if (TrouveTo == false){
					Mem[Mem.length] = Waze.selectionManager.selectedItems[i].model.attributes.toNodeID;
					Texte = Texte + ', ' + Waze.selectionManager.selectedItems[i].model.attributes.toNodeID;
				}
				NbrSeg++;
			}
		}
        if (NbrSeg > 0) {
			segeditgen = document.getElementById("segment-edit-general");
			segextra = document.getElementById("segment-extra-details");
			if (!segextra) {
				segextra = document.createElement('div');
				segextra.id = 'segment-extra-details';
				segeditgen.appendChild(segextra);
			}

			segextra.innerHTML = '<div{width:20px;}><B>WME GetNodeID</B><br>Segment(s) sélectionné(s) : ' + NbrSeg + '<br><br>Liste des IDs de Noeuds:<br><wbr>' + Texte + '</wbr></div>';
			$("#sidebar").animate({ scrollTop: $("#sidebar").offset().top + 5000 }, 1); //5000 pour être sûr d'être tout en bas...
    	}
  	}
  	return true;
}

function init(){
	Waze = unsafeWindow.Waze;
	if(typeof(Waze) == 'undefined'){
		window.setTimeout(init, 700);
		return;
	}
	Waze.selectionManager.events.register("selectionchanged", null, NodesID);
	NodesID(); // exécution de la fonction dès le lancement du script pour fonctionnement avec un permalink
}

bootstrap();