PageSourceSearch

https://www.tapbit.com/assets/scripts/home-safari-video-preload.js

js tapbit.com collected 2026-10-03 21:39:06 UTC 1,252 bytes, 35 lines download raw bytes

1(() => {
2  const script = document.currentScript;
3  const heroUrl = script?.dataset.heroUrl;
4  const phoneUrl = script?.dataset.phoneUrl;
5
6  if (!heroUrl || !phoneUrl) return;
7
8  const userAgent = navigator.userAgent.toLowerCase();
9  const isAppleMobile = /iphone|ipad|ipod|ios/.test(userAgent);
10  const isIpadDesktopMode = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
11  const isSafari =
12    userAgent.includes('safari') &&
13    !/(chrome|chromium|crios|android|edg|edge|firefox|fxios|opr|opera)/.test(userAgent);
14
15  if (!isAppleMobile && !isIpadDesktopMode && !isSafari) return;
16
17  const preloadVideo = (url, priority, marker) => {
18    if (document.querySelector(`[${marker}]`)) return;
19
20    const preloadLink = document.createElement('link');
21    preloadLink.rel = 'preload';
22    preloadLink.as = 'video';
23    preloadLink.href = url;
24    preloadLink.type = 'video/quicktime; codecs="hvc1"';
25    preloadLink.setAttribute('fetchpriority', priority);
26    preloadLink.setAttribute(marker, '');
27    document.head.appendChild(preloadLink);
28  };
29
30  preloadVideo(heroUrl, 'high', 'data-home-hero-preload');
31
32  if (window.matchMedia('(min-width: 768px)').matches) {
33    preloadVideo(phoneUrl, 'low', 'data-home-phone-preload');
34  }
35})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.