„MediaWiki:Timeless.js” változatai közötti eltérés

A VIK Wikiből
a onlick
should be stored in local storage now
2. sor: 2. sor:


$(".mw-indicators").append('<div id="sidebar-toggle-btn" class="mw-indicator"><a onclick="toggleSidebar()"><span>Toggle sidebar</span></a></div>');
$(".mw-indicators").append('<div id="sidebar-toggle-btn" class="mw-indicator"><a onclick="toggleSidebar()"><span>Toggle sidebar</span></a></div>');
// Use class hidden to not play animation
if (localStorage.getItem("sidebar") == "hidden")
{ $("#mw-related-navigation").addClass("hidden"); }


function toggleSidebar() {
function toggleSidebar() {
var sidebar = $("#mw-related-navigation");
var sidebar = $("#mw-related-navigation");


if (sidebar.hasClass("hide")) { sidebar.removeClass("hide"); sidebar.addClass("show"); }
if (sidebar.hasClass("hide") || sidebar.hasClass("hidden")) {
else { sidebar.removeClass("show"); sidebar.addClass("hide"); }
sidebar.removeClass("hidden");
sidebar.removeClass("hide");
sidebar.addClass("show");  
localStorage.setItem("sidebar", "show");
} else {  
sidebar.removeClass("show");  
sidebar.addClass("hide");  
localStorage.setItem("sidebar", "hidden");
}
}
}

A lap 2024. július 21., 16:43-kori változata

/* A Timeless felület használói számára betöltendő JavaScriptek */

$(".mw-indicators").append('<div id="sidebar-toggle-btn" class="mw-indicator"><a onclick="toggleSidebar()"><span>Toggle sidebar</span></a></div>');

// Use class hidden to not play animation
if (localStorage.getItem("sidebar") == "hidden") 
{ $("#mw-related-navigation").addClass("hidden"); }

function toggleSidebar() {
	var sidebar = $("#mw-related-navigation");

	if (sidebar.hasClass("hide") || sidebar.hasClass("hidden")) {
		sidebar.removeClass("hidden");
		sidebar.removeClass("hide");  
		sidebar.addClass("show"); 
		localStorage.setItem("sidebar", "show");
	} else { 
		sidebar.removeClass("show"); 
		sidebar.addClass("hide"); 
		localStorage.setItem("sidebar", "hidden");
	}
}