sourcehypertextpublicfurryswitch.js

const pn = {
	list: {
		they: {
			case: {
				nom: "they",
				acc: "them",
				pos: "their",
				gen: "theirs",
				ref: "themself"
			},
			plural: true
		},
		he: {
			case: {
				nom: "he",
				acc: "him",
				pos: "his",
				gen: "his",
				ref: "himself"
			},
			plural: false
		},
		she: {
			case: {
				nom: "she",
				acc: "her",
				pos: "her",
				gen: "hers",
				ref: "herself"
			},
			plural: false
		},
		shi: {
			case: {
				nom: "shi",
				acc: "hir",
				pos: "hir",
				gen: "hirs",
				ref: "hirself"
			},
			plural: false
		},
		/* Dutch */
		hij: {
			case: {
				nom: "hij",
				acc: "hem",
				dat: "hem",
				pos: "zijn",
				gen: "zijne"
			},
			plural: false
		},
		zij: {
			case: {
				nom: "ze",
				acc: "haar",
				dat: "haar",
				pos: "haar",
				gen: "hare"
			},
			plural: false
		},
		die: {
			case: {
				nom: "die",
				acc: "hen",
				dat: "hun",
				pos: "hun",
				gen: "hunne"
			},
			plural: false
		}
	},
	switch: function (set) {
		for (const declension in pn.list[set].case) {
			for (const el of $$(`.pn-${declension}`)) {
				el.innerHTML = pn.list[set].case[declension];
				if (el.classList.contains("pn-upper")) {
					el.innerHTML =
						el.innerHTML[0].toUpperCase() + el.innerHTML.substring(1);
				}
			}
		}
		for (const el of $$(`.pn-pl`)) {
			el.style.display = pn.list[set].plural ? "inline" : "none";
		}
		for (const el of $$(`.pn-sg`)) {
			el.style.display = pn.list[set].plural ? "none" : "inline";
		}
	}
};