In this article we will delve into the fascinating world of
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js, exploring its many facets, investigating its origins and analyzing its impact on today's society. For centuries,
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js has been the object of admiration, study and debate, and its influence extends to fields as diverse as science, culture, politics and entertainment. Through this comprehensive analysis, we will unravel the myths and realities surrounding
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js, and offer a fresh perspective on a topic that continues to capture our interest and wonder. Prepare for an exciting journey through the history and meaning of
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js, and discover why it continues to be relevant in the contemporary world.
<syntaxhighlight lang="javascript">
// ==UserScript==
// @name MCH stub creator
// @namespace http://opensourceexile.blogspot.com/
// @description Create wikipedia stubs from MCH bio pages
// @include http://www.teara.govt.nz/en/biographies/*
// ==/UserScript==
// See https://secure.wikimedia.org/wikipedia/enhttps://wikifreehand.com/en/Wikipedia:WikiProject_Missing_encyclopedic_articles/NZ/Dictionary_of_New_Zealand_Biography
var rawTitle=document.getElementsByName("DC.title").content;
var rawName=rawTitle;
var first=rawTitle.substring(rawTitle.indexOf(', ')+2);
var last=rawTitle.substring(0,rawTitle.indexOf(', '));
var fixedName= rawTitle.substring(rawTitle.indexOf(', ')+2) + ' ' + rawTitle.substring(0,rawTitle.indexOf(', '));
var rawDates=document.getElementsByTagName("p").item(0).childNodes.textContent;
var birthDate=rawDates.substring(0,4);
var deathDate=rawDates.substring(5,9);
var rawBio=document.getElementsByTagName("p").item(1).childNodes.textContent;
if (rawBio.indexOf(' and ') == -1 ){
var regexpBio=/^(.*), (*)$/;
var cookedBio=rawBio.replace(regexpBio, "$1 and $2");
} else {
var cookedBio=rawBio;
}
var rawFooter=document.getElementById("footer-citation").childNodes.textContent;
var refAuthor=rawFooter.substring(rawFooter.indexOf(':')+1).substring(0,rawFooter.indexOf("'")-rawFooter.indexOf(':')-3);
var refLast=refAuthor.substring(refAuthor.lastIndexOf(' '));
var refFirst=refAuthor.substring(0,refAuthor.lastIndexOf(' '));
var rawDate=rawFooter.substring(rawFooter.indexOf('updated')+7)
var refDate=rawDate.substring(0,rawDate.indexOf('\n'));
var refURL=rawFooter.substring(rawFooter.indexOf('URL:')+5);
var regexpId=/^.*\/(?)\/.*$/;
var id=refURL.replace(regexpId,"$1");
alert("\n" + "'''" + fixedName + "''' (" + birthDate + "–" + deathDate + ")" + " was a ] " + cookedBio.toLowerCase() + ".<ref name=\"DNZB " + last + "\">{{DNZB|title=" + fixedName + "|first=" + refFirst +"|last=" + refLast + "|id=" + id + "|accessdate=December 2011}}</ref>\n\n==References==\n{{Reflist}}\n\n{{Persondata <!-- Metadata: see ]. --> \n| NAME = " + rawName + "\n| ALTERNATIVE NAMES = \n| SHORT DESCRIPTION = " + rawBio + "\n| DATE OF BIRTH = " + birthDate + "\n| PLACE OF BIRTH = \n| DATE OF DEATH = " + deathDate + "\n| PLACE OF DEATH = \n}}\n{{DEFAULTSORT:" + rawName +"}}\n\n]\n]\n]\n\n{{NewZealand-bio-stub}}\n\n")
</syntaxhighlight>