Changeset b5a09ce2 in Klonkt for src/views/shell.ejs
- Timestamp:
- 06/30/2026 05:32:33 PM (2 months ago)
- Branches:
- main
- Children:
- 857a06f
- Parents:
- 1d6f9a2
- File:
-
- 1 edited
-
src/views/shell.ejs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/views/shell.ejs
r1d6f9a2 rb5a09ce2 771 771 document.body.addEventListener('htmx:afterSettle', function (e) { scan(e.target); }); 772 772 })(); 773 774 // iOS animated-cover → video: an animated WebP is janky on iOS Safari, so on iOS we swap any 775 // <img data-ios-mp4="…"> for a muted, looping, inline <video> (the WebP's matching MP4). Every 776 // other browser keeps the crisp WebP. Runs on load + htmx swaps. 777 (function () { 778 if (window.__iosVideoWired) return; window.__iosVideoWired = true; 779 var ua = navigator.userAgent || ''; 780 var IS_IOS = /iP(hone|od|ad)/.test(navigator.platform || '') || /iPad|iPhone|iPod/.test(ua) || 781 (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1); // iPadOS reports as Mac 782 if (!IS_IOS) return; 783 function swap(root) { 784 (root || document).querySelectorAll('img[data-ios-mp4]').forEach(function (img) { 785 var mp4 = img.getAttribute('data-ios-mp4'); 786 if (!mp4 || img.dataset.iosSwapped) return; 787 img.dataset.iosSwapped = '1'; 788 var v = document.createElement('video'); 789 v.src = mp4; v.muted = true; v.loop = true; v.autoplay = true; 790 v.setAttribute('muted', ''); v.setAttribute('playsinline', ''); v.setAttribute('webkit-playsinline', ''); 791 v.poster = img.getAttribute('src') || ''; 792 v.className = img.className; 793 if (img.getAttribute('style')) v.setAttribute('style', img.getAttribute('style')); 794 if (img.parentNode) img.parentNode.replaceChild(v, img); 795 var p = v.play && v.play(); if (p && p.catch) p.catch(function () {}); 796 }); 797 } 798 swap(document); 799 document.body.addEventListener('htmx:afterSettle', function (e) { swap(e.target); }); 800 })(); 773 801 </script> 774 802
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)