From fd367b5341037ea5026b859e995a66d32f78498b Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Fri, 11 Oct 2024 22:39:31 +0800 Subject: Remove some examples (#12196) --- examples/view-transitions/src/scripts/utils.js | 76 -------------------------- 1 file changed, 76 deletions(-) delete mode 100644 examples/view-transitions/src/scripts/utils.js (limited to 'examples/view-transitions/src/scripts/utils.js') diff --git a/examples/view-transitions/src/scripts/utils.js b/examples/view-transitions/src/scripts/utils.js deleted file mode 100644 index 5b7f78535..000000000 --- a/examples/view-transitions/src/scripts/utils.js +++ /dev/null @@ -1,76 +0,0 @@ -export function getNavigationType(fromPath, toPath) { - if (fromPath.startsWith('/movies') && toPath === '/') { - return 'movie-to-home'; - } - - if (fromPath === '/tv' && toPath.startsWith('/tv/')) { - return 'tv-to-show'; - } - - if (fromPath === '/' && toPath.startsWith('/movies')) { - return 'home-to-movie'; - } - - if (fromPath.startsWith('/tv/') && toPath === '/tv') { - return 'show-to-tv'; - } - - if ( - (fromPath.startsWith('/movies') || fromPath.startsWith('/tv')) && - toPath.startsWith('/people') - ) { - return 'movie-to-person'; - } - - if ( - fromPath.startsWith('/people') && - (toPath.startsWith('/movies') || toPath.startsWith('/tv/')) - ) { - return 'person-to-movie'; - } - - return 'other'; -} - -export function isBackNavigation(navigateEvent) { - if (navigateEvent.navigationType === 'push' || navigateEvent.navigationType === 'replace') { - return false; - } - if ( - navigateEvent.destination.index !== -1 && - navigateEvent.destination.index < navigation.currentEntry.index - ) { - return true; - } - return false; -} - -export function shouldNotIntercept(navigationEvent) { - return ( - navigationEvent.canIntercept === false || - // If this is just a hashChange, - // just let the browser handle scrolling to the content. - navigationEvent.hashChange || - // If this is a download, - // let the browser perform the download. - navigationEvent.downloadRequest || - // If this is a form submission, - // let that go to the server. - navigationEvent.formData - ); -} - -export function useTvFragment(navigateEvent) { - const toUrl = new URL(navigateEvent.destination.url); - const toPath = toUrl.pathname; - - return toPath.startsWith('/tv'); -} - -export function getPathId(path) { - return path.split('/')[2]; -} - -export function updateTheDOMSomehow(data) { - document.getElementById('content').innerHTML = data; -} -- cgit v1.2.3