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 existence before deletion
+ spam log
Zeile 1: Zeile 1:
/*
/*
tasks:
task: delete items from the left hand side menu that i don't use
- delete items from the left hand side menu that i don't use.
- add other reasonable items
tested in firefox only
tested in firefox only
*/
*/
Zeile 45: Zeile 47:
}
}
}, 1000);
}, 1000);

// new link for spam log
jQuery(document).ready(function(){
mw.loader.using("mediawiki.util",
function(){
mw.util.addPortletLink(
"p-tb",
"/w/index.php?title=Special:Log/spamblacklist/"
+ mw.util.wikiUrlencode(mw.config.get("wgRelevantUserName")),
"Spam log",
"n-spam",
"show spam log of user",
"#n-mainpage-description",
null);
});
});

});
});

Version vom 12. April 2022, 23:07 Uhr

/*
tasks:
  - delete items from the left hand side menu that i don't use.
  - add other reasonable items
tested in firefox only
*/
$(function (){
	function remove_item(id){
		if(document.getElementById(id) !== null){
			document.getElementById(id).remove();
		}
	}

	if(document.getElementById("n-mainpage-description") !== null){
		document.getElementById("n-mainpage-description").replaceWith(
			document.getElementById("n-recentchanges")
		);
	}
	remove_item("p-Mitmachen") // "participate"
	// the previous command includes the following
	//remove_item("n-Artikel-verbessern"); // "improve articles"
	//remove_item("n-Neuerartikel"); // "create article"
	//remove_item("n-portal"); // "community portal"
	//remove_item("n-help");
	//remove_item("n-contact");
	//remove_item("n-sitesupport"); // "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);

	// new link for spam log
	jQuery(document).ready(function(){
		mw.loader.using("mediawiki.util", 
			function(){
				mw.util.addPortletLink(
					"p-tb",
					"/w/index.php?title=Special:Log/spamblacklist/"
					+ mw.util.wikiUrlencode(mw.config.get("wgRelevantUserName")),
					"Spam log",
					"n-spam",
					"show spam log of user",
					"#n-mainpage-description",
					null);
			});
	});

});