WME UI Bugs

Corrects bugs of WME User Interface like moving location info on the right when UR or place update is open, StreetView when editing house numbers...

目前為 2015-06-28 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name                WME UI Bugs
// @namespace           https://greasyfork.org/fr/scripts/10691-wme-ui-bugs
// @description         Corrects bugs of WME User Interface like moving location info on the right when UR or place update is open, StreetView when editing house numbers...
// @include             https://www.waze.com/editor/*
// @include             https://www.waze.com/*/editor/*
// @version             0.3
// @grant               na
// ==/UserScript==

// V0.2	Ajout gestion des place update
// V0.2 Prise en charge des contrôles de Street View lors de l'édition des numéros de maisons.
// V0.3 

if ('undefined' == typeof __RTLM_PAGE_SCOPE_RUN__) {
	(function page_scope_runner() {
		var my_src = "(" + page_scope_runner.caller.toString() + ")();";
		var script = document.createElement('script');
		script.setAttribute("type", "text/javascript");
		script.textContent = "var __RTLM_PAGE_SCOPE_RUN__ = true;\n" + my_src;
		setTimeout(function() {
			document.body.appendChild(script);
			document.body.removeChild(script);
		}, 0);
	})();
	return;
}

function bootstrapUIBugs(){
	if (typeof(unsafeWindow) === "undefined"){
		unsafeWindow = ( function () {
			var dummyElem = document.createElement('p');
			dummyElem.setAttribute('onclick', 'return window;');
			return dummyElem.onclick();
		}) ();
	}
	setTimeout(initUIBugs, 700);
}

function LocationPos() {
    //JQuery renvoie toujours Objet même s'il n'existe pas (!!) Il faut tester la longueur... Si = 0, n'existe pas.
	if ($(".problem-edit").length > 0 || $(".place-update-edit").length > 0){  // On teste si un UR ou Place update est ouvert
		$( ".WazeControlLocationInfo" ).css("left","350px");	// On déplace le texte vers la droite grâce à Jquery
	}else{
		$( ".WazeControlLocationInfo" ).css("left","73px");	// On déplace le texte à son emplacement d'origine grâce à Jquery
	}
}

function ModifySv(){
	if ($(".lightboxShown").length > 0){ // Si l'édition des numéros de rues est en cours
		$( ".close-button" ).css("top","55px"); // On déplace le bouton fermer
		$('.gmnoprint[controlwidth="25"]').css("top","55px"); // On déplace les contrôles de position de SV
		$('.gmnoprint[style*="top: 103px"]').css("top","158px"); 
	}else{
		$( ".close-button" ).css("top","0px"); // On remet le bouton fermer à sa place
		$('.gmnoprint[controlwidth="25"]').css("top","0px"); // On remet les contrôles de position de SV à leur place
		$('.gmnoprint[style*="top: 158px"]').css("top","103px"); 
	}
}

function initUIBugs(){
	Waze = unsafeWindow.Waze;
	if(typeof(Waze) == 'undefined'){
		setTimeout(initUIBugs, 700);
		return;
	}
	$("body").click(function(){LocationPos()}); // ajout d'un listener click sur "toute la page" et non pas seulement la map
	$('body').mousemove(function(){ModifySv()}); // listener mousemove
	setTimeout(LocationPos,1000);
}

bootstrapUIBugs();