„Benutzer:Lustiger seth/seth-style.js“ – Versionsunterschied
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
init |
(kein Unterschied)
|
Version vom 5. April 2023, 16:15 Uhr
// apply lower case style and converted umlauts and sz-ligature on comments of lustiger_seth
// (not tested very well.)
function sethsche_schreibung(){
function lc_replacer(match, offset, string){
return match.toLowerCase();
}
function replacer(match, p1, p2, offset, string, groups){
//console.log(p1);
const split_html = p2.split(/(<[^>]+>)/);
for(var i = split_html.length - 1; i >= 0; --i){
if(split_html[i][0] != "<"){
split_html[i] = split_html[i].replace(/\b[A-ZÄÖÜ][a-zäöüß]+\b/g, lc_replacer)
.replace(/ä/g, "ae").replace(/ö/g, "oe").replace(/ü/g, "ue").replace(/ß/g, "ss");
}
}
result = " id=\"" + p1 + "\"></span>" + split_html.join('')
+ "<span data-mw-comment-end=\"" + p1 + "\"";
return result;
}
const content = document.getElementById("mw-content-text")
.getElementsByClassName("mw-parser-output")[0];
content.innerHTML = content.innerHTML.replace(
/ id="(c-Lustiger_seth-[^"]+)"><\/span>((?:.|[\n\r\s])*?)<span data-mw-comment-end="\1"/g,
replacer);
}
sethsche_schreibung();