Greasy Fork is available in English.

WME Validator Visiblity Toggle

Validator Visiblity Toggle

Από την 18/12/2015. Δείτε την τελευταία έκδοση.

// ==UserScript==
// @name          WME Validator Visiblity Toggle
// @version       0.0.4
// @namespace     https://greasyfork.org/en/users/5920-rickzabel
// @description	  Validator Visiblity Toggle
// @author        rickzabel
// @homepage      https://greasyfork.org/en/scripts/13733-wme-maximized-basic-rickzabel-edits
// @include       https://www.waze.com/*
// @include       https://wiki.waze.com/*
// @include       https://editor-beta.waze.com/*     
// @run-at        document-start
// @grant         none
// ==/UserScript==
(function() {
	function begin() {
		if (typeof($) === 'function') {
			var g = "";
			//$(".user-profile").after('<li><a id="Vjerk"></a></li>');
			$("#user-details").prepend('<a id="Vjerk"></a> <a id="VjerkUserProfile"></a>');
			
			
			
			
			var Vjerk = localStorage.getItem('Vjerk');
			console.log("ValidatorToggle: CheckVjerk " + Vjerk);
			if (Vjerk == "1") {
				$('#Vjerk').html("Show Validator");
				g = '.c2821834348 {display: none !important; } ';
			} else {
				$('#Vjerk').html("Hide Validator");
				g = '.c2821834348 {display: block !important; } ';
			}
			$("head").append($('<style id="VjerkCSS" type="text/css">' + g + '</style>'));
			
			$('#Vjerk').click(function() {
				var Vjerk = localStorage.getItem('Vjerk');
				if (Vjerk == "1") {
					$(localStorage.setItem('Vjerk', '0'));
				} else {
					$(localStorage.setItem('Vjerk', '1'));
				}
				//console.log("ValidatorToggle: Switch Clicked " + Vjerk);
			});
			
			
			$("head").append($('<style id="VjerkUserProfileCSS" type="text/css">' + g + '</style>'));
			//$("#user-details").prepend('<li><a id="VjerkUserProfile"></a></li>');
			var VjerkUserProfile = localStorage.getItem('VjerkUserProfile');
			console.log("ValidatorToggle: CheckVjerk " + VjerkUserProfile);
			if (VjerkUserProfile == "1") {
				$('#VjerkUserProfile').html("Show Profile");
				g = '.user-profile {display: none !important; } ';
			} else {
				$('#VjerkUserProfile').html("Hide Profile");
				g = '.user-profile {display: block !important; } ';
			}
			
			$('#VjerkUserProfile').click(function() {
				var VjerkUserProfile = localStorage.getItem('VjerkUserProfile');
				if (VjerkUserProfile == "1") {
					$(localStorage.setItem('VjerkUserProfile', '0'));
				} else {
					$(localStorage.setItem('VjerkUserProfile', '1'));
				}
				//console.log("ValidatorToggle: Switch Clicked " + VjerkUserProfile);
			});
			window.window.setInterval(CheckVjerk, 1000);
		} else {
			window.setTimeout(begin, 400);
		}
	}

	function CheckVjerk() {
		var Vjerk = localStorage.getItem('Vjerk');
		console.log("ValidatorToggle: CheckVjerk " + Vjerk);
		if (Vjerk == "0") {
			$("#VjerkCSS").html('.c2821834348 {display: block !important;}');
			$('#Vjerk').html("Hide Validator");
		} else if (Vjerk == "1") {
			$("#VjerkCSS").html('.c2821834348 {display: none !important;}');
			$('#Vjerk').html("Show Validator");
		}
		
		
		var VjerkUserProfile = localStorage.getItem('VjerkUserProfile');
		console.log("ValidatorToggle: Check VjerkUserProfile " + VjerkUserProfile);
		if (VjerkUserProfile == "0") {
			$("#VjerkUserProfileCSS").html('.user-profile {display: block !important;}');
			$('#VjerkUserProfile').html("Hide Profile");
		} else if (VjerkUserProfile == "1") {
			$("#VjerkUserProfileCSS").html('.user-profile {display: none !important;}');
			$('#VjerkUserProfile').html("Show Profile");
		}
	}
	window.setTimeout(begin, 4000);
})();