In this article, we will explore the fascinating world of
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js. Throughout history,
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js has played a crucial role in various fields, from science to popular culture. As we delve deeper into this topic, we will analyze its origins, impact, and evolution over time. From its beginnings to the present,
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js has continued to capture the attention of people of all ages and interests, demonstrating its relevance and significance in modern society. Through this article, we will discover what makes
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js so special and worthy of study. Get ready to embark on a journey of discovery and knowledge about
Wikipedia:WikiProject Missing encyclopedic articles/NZ/Dictionary of New Zealand Biography/MCH.js!
<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://wiki386.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>