Zum Inhalt springen

„Benutzer:Lustiger seth/left menu adaptions.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
check for undefined
fixed check for existence
Zeile 4: Zeile 4:
*/
*/
$(function (){
$(function (){
if(typeof document.getElementById("n-mainpage-description") !== "undefined"){
if(document.getElementById("n-mainpage-description") !== null){
document.getElementById("n-mainpage-description").replaceWith(
document.getElementById("n-mainpage-description").replaceWith(
document.getElementById("n-recentchanges")
document.getElementById("n-recentchanges")
Zeile 29: Zeile 29:
// this needs a time-out, because the link is loaded delayed
// this needs a time-out, because the link is loaded delayed
setTimeout(function(){
setTimeout(function(){
if(typeof document.getElementById("t-wikibase") !== "undefined"){
if(document.getElementById("t-wikibase") !== null){
const tools_children = document.getElementById("t-wikibase").parentNode.children;
const tools_children = document.getElementById("t-wikibase").parentNode.children;
for(let i = 0; i < tools_children.length; ++i){
for(let i = 0; i < tools_children.length; ++i){

Version vom 13. Februar 2022, 13:11 Uhr

/*
task: delete items from the left hand side menu that i don't use
tested in firefox only
*/
$(function (){
	if(document.getElementById("n-mainpage-description") !== null){
		document.getElementById("n-mainpage-description").replaceWith(
			document.getElementById("n-recentchanges")
		);
	}
	document.getElementById("p-Mitmachen").remove(); // "participate"
	// the previous command includes the following
	//document.getElementById("n-Artikel-verbessern").remove(); // "improve articles"
	//document.getElementById("n-Neuerartikel").remove(); // "create article"
	//document.getElementById("n-portal").remove(); // "community portal"
	//document.getElementById("n-help").remove();
	//document.getElementById("n-contact").remove();
	//document.getElementById("n-sitesupport").remove(); // "donate"
	// delete "switch to old look"
	const mw_panel_children = document.getElementById("mw-panel").children;
	for(let i = 0; i < mw_panel_children.length; ++i){
		const elem_content = mw_panel_children[i].innerHTML;
		if(elem_content.includes("Switch to old look") 
			|| elem_content.includes("Language")
		){
			mw_panel_children[i].remove();
		}
	}
	// this needs a time-out, because the link is loaded delayed
	setTimeout(function(){
		if(document.getElementById("t-wikibase") !== null){
			const tools_children = document.getElementById("t-wikibase").parentNode.children;
			for(let i = 0; i < tools_children.length; ++i){
				const elem_content = tools_children[i].innerHTML;
				if(elem_content.includes("Edit interlanguage links")){
					tools_children[i].remove();
				}
			}
		}
	}, 1000);
});