User:Erutuon/scripts/katakanaOnyomi.js

$(function {	// Based on the change_codepoint function in Module:ja.	function changeCodePoints(difference, minimum, maximum) {		return function (str) {			if (typeof str !== 'string')				throw new TypeError("Expected String, got " + typeof(str));			return str				.split("")				.map(function (char) { const codePoint = char.codePointAt(0); return (minimum <= codePoint && codePoint <= maximum) ? String.fromCodePoint(codePoint + difference) : char; })				.join("");		};	}	// Based on the kata_to_hira and hira_to_kata functions in Module:ja.	// Codepoints between and including ぁ (U+3041) and ゖ (U+3096) can be	// converted to katakana by adding 96.	// const kataToHira = changeCodePoints(-96);	const hiraToKata = changeCodePoints(96, "ぁ".codePointAt(0), "ゖ".codePointAt(0));	document		.querySelectorAll('.on-yomi .Hira a')		.forEach(function (elem) { elem.innerText = hiraToKata(elem.innerText) }); });