„Benutzer:Lustiger seth/left menu adaptions.js“ – Versionsunterschied
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
fix: cope with multiple equal headings |
fix: cope with undef toc |
||
Zeile 56: | Zeile 56: | ||
if(mw.config.get('wgPageName') === 'Wikipedia:Vandalismusmeldung'){ |
if(mw.config.get('wgPageName') === 'Wikipedia:Vandalismusmeldung'){ |
||
const toc = document.getElementById("mw-panel-toc-list"); |
const toc = document.getElementById("mw-panel-toc-list"); |
||
const threads = toc.children; |
if(toc){ |
||
const threads = toc.children; |
|||
const re_done = /_\(erl\.\)(?:_[0-9])?$/; |
const re_done = /_\(erl\.\)(?:_[0-9])?$/; |
||
for(let i = 1; i < threads.length; ++i){ |
for(let i = 1; i < threads.length; ++i){ |
||
if(re_done.test(threads[i].id)){ |
if(re_done.test(threads[i].id)){ |
||
// threads[i].style.background = '#ff6666'; |
// threads[i].style.background = '#ff6666'; |
||
}else{ |
}else{ |
||
threads[i].style.background = '#ffff00'; |
threads[i].style.background = '#ffff00'; |
||
} |
|||
} |
} |
||
} |
} |
Version vom 30. Dezember 2024, 20:22 Uhr
/*
tasks:
- delete items from the left hand side menu that i don't use.
- add other reasonable items
- highlight undone thredas at WP:VM (dewiki)
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"
remove_item("n-mainpage-description"); // redundant link to "main page"
// delete "switch to old look"
const vector_main_menu_children = document.getElementById("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();
}
}
// 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);
});
});
// highlight undone thredas 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';
}
}
}
}
});