Zum Inhalt springen

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

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
feat: 1. remove urlshorteners; 2. add spam log of pages
refactor: moved rhs menu modifications to user:lustiger_seth/toolbar_adaptions.js
 
Zeile 2: Zeile 2:
tasks:
tasks:
- 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.
- delete items from the rhs toolbar that i don't use.
- add other reasonable items
- highlight undone threads at WP:VM (dewiki)
- highlight undone threads at WP:VM (dewiki)
tested in firefox only
tested in firefox only
Zeile 41: Zeile 39:
}
}
}
}

// right hand side tools
remove_item("t-urlshortener");
remove_item("t-urlshortener-qrcode");
// new link for spam log
jQuery(document).ready(function(){
mw.loader.using("mediawiki.util",
function(){
let link = "/wiki/Special:Log?type=spamblacklist&page=" + encodeURIComponent(mw.config.get('wgPageName')) + "&wpFormIdentifier=logeventslist";
if(mw.config.get("wgRelevantUserName") !== null){
link = "/w/index.php?title=Special:Log/spamblacklist/"
+ mw.util.wikiUrlencode(mw.config.get("wgRelevantUserName"))
}
mw.util.addPortletLink(
"p-tb",
link,
"Spam log",
"n-spam",
"show spam log of user/page",
"#n-mainpage-description",
null);
});
});


// highlight undone threads at WP:VM (dewiki)
// highlight undone threads at WP:VM (dewiki)

Aktuelle Version vom 26. Januar 2025, 14:01 Uhr

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

	// left hand side menu
	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"
	remove_item("n-mainpage-description"); // redundant link to "main page"
	// delete "switch to old look"
	const vector_main_menu = document.getElementById("vector-main-menu");
	if(vector_main_menu !== null && vector_main_menu.children){
		for(let i = 0; i < vector_main_menu.children.length; ++i){
			const elem_content = vector_main_menu.children[i].innerHTML;
			if(elem_content.includes("Switch to old look") 
				|| elem_content.includes("Language")
			){
				vector_main_menu.children[i].remove();
			}
		}
	}

	// highlight undone threads at WP:VM (dewiki)
	if(mw.config.get('wgPageName') === 'Wikipedia:Vandalismusmeldung'){
		const toc = document.getElementById("mw-panel-toc-list");
		if(toc){
			const threads = toc.children;
			const re_done = /_\(erl\.\)(?:_[0-9])?$/;
			for(let i = 1; i < threads.length; ++i){
				if(re_done.test(threads[i].id)){
					// threads[i].style.background = '#ff6666';
				}else{
					threads[i].style.background = '#ffff00';
				}
			}
		}
	}

});