mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	* Use cookie for frontend request * Remove api helper to use SDK * Added error handling to status box * Remove additional places that check for session.user * Refactor sending password * prettier clean up * remove deadcode * Move all authentication requests to the client * refactor upload panel to only fetch assets after the upload panel disappear * Added keydown to remove focus on title change on album viewer
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Svelte
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Svelte
		
	
	
	
	
	
| <script lang="ts">
 | |
| 	import { onMount } from 'svelte';
 | |
| 
 | |
| 	export let once = false;
 | |
| 	export let top = 0;
 | |
| 	export let bottom = 0;
 | |
| 	export let left = 0;
 | |
| 	export let right = 0;
 | |
| 
 | |
| 	let intersecting = false;
 | |
| 	let container: any;
 | |
| 
 | |
| 	onMount(() => {
 | |
| 		if (typeof IntersectionObserver !== 'undefined') {
 | |
| 			const rootMargin = `${bottom}px ${left}px ${top}px ${right}px`;
 | |
| 
 | |
| 			const observer = new IntersectionObserver(
 | |
| 				(entries) => {
 | |
| 					intersecting = entries[0].isIntersecting;
 | |
| 					if (intersecting && once) {
 | |
| 						observer.unobserve(container);
 | |
| 					}
 | |
| 				},
 | |
| 				{
 | |
| 					rootMargin
 | |
| 				}
 | |
| 			);
 | |
| 
 | |
| 			observer.observe(container);
 | |
| 			return () => observer.unobserve(container);
 | |
| 		}
 | |
| 
 | |
| 		// The following is a fallback for older browsers
 | |
| 		function handler() {
 | |
| 			const bcr = container.getBoundingClientRect();
 | |
| 
 | |
| 			intersecting =
 | |
| 				bcr.bottom + bottom > 0 &&
 | |
| 				bcr.right + right > 0 &&
 | |
| 				bcr.top - top < window.innerHeight &&
 | |
| 				bcr.left - left < window.innerWidth;
 | |
| 
 | |
| 			if (intersecting && once) {
 | |
| 				window.removeEventListener('scroll', handler);
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		window.addEventListener('scroll', handler);
 | |
| 		return () => window.removeEventListener('scroll', handler);
 | |
| 	});
 | |
| </script>
 | |
| 
 | |
| <div bind:this={container}>
 | |
| 	<slot {intersecting} />
 | |
| </div>
 |