:: cheatMenuScript[script]
$(document).on(':passagedisplay', function (ev) {

	// Autocomplete for Goto-Input
	jUIPromise.then(function () {
		var inputId = '#textbox--cheatteleportdestination';
		var tags = Story.lookupWith(function (p) {
			return (p.tags.includes("menu") || p.tags.includes("outdoors") || p.tags.includes("indoors") || p.tags.includes("quest"));
		}).map((passage)=>passage.title);
		$(inputId).autocomplete({
			source: tags
		});

	});
});

:: cheatMenuWidgets[widget]
<<widget 'cheatMenu'>>
	<div id="cheatMenu" class="collapsed">
		<<link "CM">>
			<<toggleclass  '#cheatMenu' 'collapsed'>>
			<<toggleclass  '#cheatMenu' 'expanded'>>
		<</link>>
		<div>
			<<link "Misc">>
			<</link>>
			<p>Cash: <<textbox "$finances.cash" $finances.cash>></p>
			<<button "Confirm">>
				<<regt>>
			<</button>>

			<ul>
				<li><<link 'Remove all mood'>><<run $pc._moodlets = {}>><<regt>><</link>></li>
				<li><<link 'Reset pain'>><<run $pc._pain = _pain = new setup.Pain()>><<regt>><</link>></li>
			</ul>

			<<link "Teleport">>
			<</link>>
			<ul class="teleportList">
				<li><<link "Parents Home">><<gt 'korrPar'>><</link>></li>
				<li><<link "Test">><<gt 'test'>><</link>></li>
				<li><<link "Reference Page">><<gt 'Reference'>><</link>></li>
				<li>
					<<textbox "_cheatTeleportDestination" "">>
					<<button 'Go'>>
						<<set _cheatTeleportDestinations = _cheatTeleportDestination.split(",")>>
						<<gt _cheatTeleportDestinations[0] _cheatTeleportDestinations[1]>>
					<</button>>
				</li>
			</ul>

			<<link "Time">>
			<</link>>
			<ul>
				<li><<addTimeLink "Add 1 minute" 1>></li>
				<li><<addTimeLink "Add 5 minutes" 5>></li>
				<li><<addTimeLink "Add 15 minutes" 15>></li>
				<li><<addTimeLink "Add 1 hour" 60>></li>
				<li><<addTimeLink "Add 4 hours" 240>></li>
				<li><<addTimeLink "Add 1 day" 1440>></li>
				<li><<addTimeLink "Add 7 days" 10080>></li>
			</ul>
		</div>
	</div>
<</widget>>

<<widget 'addTimeLink'>>
    <<set _minutes =_args[1]>>
    <<set _label = _args[0]>>
    <<capture _minutes>>
        <<link _label>>
            <<set _cachedTimeFactor = $pc.timeFactor>>
            <<set $pc.timeFactor = 0>>
            <<set $time.minutes += _minutes>>
            <<set $pc.timeFactor = _cachedTimeFactor>>
            <<regt>>
        <</link>>
    <</capture>>
<</widget>>
