<meta name="rating" content="adult" />
<script>
	window.SweetCube ??= {passageInitOverwrites:[], originalPassageContents:{}};

    function applyModifications(modifications={}){
		function applyModification(passage, modification){
			passage.element.innerHTML = modification;
			return passage;
		}


		window.SweetCube.passageInitOverwrites.push((pid,passage)=>{
			const passageName = passage?.element?.attributes?.name?.value;
			if(!passageName || !modifications[passageName])
				return passage;

			window.SweetCube.originalPassageContents[passageName] = passage.element.innerHTML;

			const modification = modifications[passageName];

			return applyModification(passage,modification);
		});
    }

	const modificationsString = localStorage.getItem("SweetCube.Modifications");
	if(modificationsString){
		const modifications = JSON.parse(modificationsString);
		applyModifications(modifications);
	}

</script>
