User:Erutuon/scripts/epigraphicLatin.js

$( => {	const forEachTextNode = (func) => {		const key = Symbol;		const apply = node => {			if (!(node instanceof Node)) {				throw new TypeError("Expected Node");			}			for (const child of node.childNodes) {				if (child[key])					continue;				switch (child.nodeType) {					case Node.ELEMENT_NODE: apply(child); break;					case Node.TEXT_NODE: func(child);				}				child[key] = true;			}		};		return apply;	};	const epigraphifyLatin = forEachTextNode(textNode => { textNode.originalLatin = textNode.nodeValue; // a method to restore original value textNode.nodeValue = textNode.nodeValue .normalize("NFD") .toUpperCase .replace(/I\u0304/g, "ꟾ") .replace(/\u0304/g, "\u0301") // macron → acute .normalize("NFC"); });	$(":lang(la)").get.forEach(epigraphifyLatin); });