User:Hamaryns/monobook.js

/* */

// Parse lines into array. Search for ""...process from that line // until the next heading (any line starting with "=".) // For each line, if in the *Langname: translation... // then change it to *: translation... // and strip out // from that section. function checkTrans {

// debug with Firebug console.debug;

var l;   oldtext = txt; var newtxt = "";

if (txt.search(/\{\{checktrans\}\}/gi) == -1) return; if (txt.search(/\{\{ttbc\|/g) != -1) return; // remove? l = txt.split("\n");

var ok = true;

for (line in l) { var line2 = line;

if (!ok && line.search(/^=/) != -1) { ok = true; }     if (ok && line.search(/\{\{checktrans\}\}/gi) != -1) { ok = false; }     if (!ok) { // get rid of this line2 = line2.replace(/\{\{top\}\}/g, ""); line2 = line2.replace(/\{\{mid\}\}/g, ""); line2 = line2.replace(/\{\{bottom\}\}/g, ""); }     if (line.search(/^\* /) != -1) { line = "*" + line.substring(2); }     if (!ok) { if (line.search(/\{\{ttbc/) == -1 && line.search(/^\*(.*?): /) != -1) { var chrat = line.search(/: /); if (line.substring(1, chrat).search(/\:/g) == -1) { line2 = "*:" + line.substring(chrat+1); }       }      }      newtxt = newtxt + line2 + "\n"; }

txt = newtxt; comment("ttbc"); }

// Parse lines into array. Search for "*Dutch:"... // replace any definition in there with ... function replaceDutch {

// debug with Firebug console.debug;

var l;   oldtext = txt; var newtxt = "";

if (txt.search(/\*Dutch\:\s*\[\[/gi) == -1) return; l = txt.split("\n");

for (line in l) { var line2 = line;

if (line.search(/\{\{t\|nl\|/) == -1 && line.search(/^\*Dutch:\s*\[\[/) != -1) { line2 = line.replace(//, "").replace(//, "|undefined"); }

newtxt = newtxt + line2 + "\n"; }

txt = newtxt; comment(""); }

function myFunctions { replaceDutch; checkTrans; }

addLoadEvent(myFunctions);