Internet Roadtrip Simple Interactive Street View

Make the mebedded Street View in the Internet Roadtrip somewhat interactive.

// ==UserScript==
// @name        Internet Roadtrip Simple Interactive Street View
// @namespace   jdranczewski.github.io
// @match       https://neal.fun/internet-roadtrip/*
// @version     0.1.2
// @author      jdranczewski
// @description Make the mebedded Street View in the Internet Roadtrip somewhat interactive.
// @license     MIT
// @run-at      document-end
// @require     https://cdn.jsdelivr.net/npm/[email protected]
// ==/UserScript==

(async function() {
	// Get some references
	const switchFrameOrder = (await IRF.vdom.container).methods.switchFrameOrder;
	const refs = (await IRF.vdom.container).$refs;

	// Execute code AFTER a vue method executes
	(await IRF.vdom.container).state.switchFrameOrder = new Proxy(switchFrameOrder, {
		apply: (target, thisArg, args) => {
			const returnValue = Reflect.apply(target, thisArg, args);
			// Change the pointer events on the pano that's at the front
			if (1 === thisArg.currFrame) {
				refs.pano1.style.pointerEvents = "auto"
			} else {
				refs.pano1.style.pointerEvents = "none";
			}
			return returnValue;
		},
	});

	// Always enable pointer events for the pano that's at the back
	refs.pano0.style.pointerEvents = "auto"

})();