User:Back on the list/custom.js

function preloadTextInSection { if (window.preloadedText) { return; } else { window.preloadedText = true; }	var pretext = ""; var lang = ""; if (! (window.location.search && window.location.search.split("?")[1])) { return; }	try { parts = window.location.search.split("?")[1].split("&"); } catch (e) { return; }	for (var k = 0; k < parts.length; k++) { pair = parts[k].split("="); if (pair[0] == "plt") { pretext = decodeURIComponent(pair[1].replace(/\+/gi," ")); } else if (pair[0]=="lang") { lang = decodeURIComponent(pair[1].replace(/\+/gi," ")); }	}	if (pretext.length > 0) { var lines = document.editform.wpTextbox1.value.split("\n"); var langsec; var done = false; var ft = ""; for (var c1 = 0; c1 < lines.length; c1++) { if (!done) { if (/^\[\[[a-z\-]{2,7}:[^\[]*\]\]$/.exec(lines[c1])) {					ft += "\n\n" + pretext + "\n\n";					done = true;				} else if (lines[c1][0] == '=' && lines[c1][1] == '=' && lines[c1][2] != '=') {					langsec = lines[c1].substring(2, lines[c1].length-2);					if (langsec != "English" && langsec != "Translingual" && lang < langsec) {						ft += pretext + "\n\n\n\n";						done = true;					}				}			}			ft += lines[c1]			if (c1 < lines.length-1) ft += '\n';		}		if (!done) {			if (lines.length > 1) ft += "\n\n\n";			ft += pretext;		}		document.editform.wpTextbox1.value = ft;	} } $(preloadTextInSection);