js/adventure.js
// custom loading for this page, so it can serve multiple sources
custom loading for this page, so it can serve multiple sources
custom loading for this page so it can serve multiple sources
function hashChange () {
	const [advId, ...hashParts] = window.location.hash.slice(1).split(HASH_PART_SEP);
	const fromIndex = adventures.filter(adv => UrlUtil.encodeForHash(adv.id) === UrlUtil.encodeForHash(advId));
	if (fromIndex.length) {
		document.title = `${fromIndex[0].name} - 5etools`;
		const shortName = fromIndex[0].name.includes(Parser.SOURCE_JSON_TO_FULL[SRC_TYP]) ? fromIndex[0].name.replace(Parser.SOURCE_JSON_TO_FULL[SRC_TYP], Parser.sourceJsonToAbv(SRC_TYP)) : fromIndex[0].name;
		$(`.adv-header`).html(shortName);
		$(`.adv-message`).html("Browse adventure content. Press F to find.");
		loadAdventure(fromIndex[0], advId, hashParts);
	} else {
		throw new Error("No adventure with ID: " + advId);
	}
}
function hashChange ( ) { const [ advId , ... hashParts ] = window . location . hash . slice ( 1 ) . split ( HASH_PART_SEP ) ; const fromIndex = adventures . filter ( adv => UrlUtil . encodeForHash ( adv . id ) === UrlUtil . encodeForHash ( advId ) ) ; if ( fromIndex . length ) { document . title = ` ${ fromIndex [ 0 ] . name } ` ; const shortName = fromIndex [ 0 ] . name . includes ( Parser . SOURCE_JSON_TO_FULL [ SRC_TYP ] ) ? fromIndex [ 0 ] . name . replace ( Parser . SOURCE_JSON_TO_FULL [ SRC_TYP ] , Parser . sourceJsonToAbv ( SRC_TYP ) ) : fromIndex [ 0 ] . name ; $ ( ` ` ) . html ( shortName ) ; $ ( ` ` ) . html ( "Browse adventure content. Press F to find." ) ; loadAdventure ( fromIndex [ 0 ] , advId , hashParts ) ; } else { throw new Error ( "No adventure with ID: " + advId ) ; } }
custom loading for this page, so it can serve multiple sources
custom loading for this page so it can serve multiple sources
// prevent TftYP names from causing the header to wrap