Spaces:
Running
Running
Download onescroll.html from SharpMeow/snapped-labels: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/spaces/SharpMeow/snapped-labels/resolve/main/onescroll.html
- Command line
-
hf download hf://spaces/SharpMeow/snapped-labels/onescroll.html
-
curl -L -o onescroll.html https://huggingface.co/spaces/SharpMeow/snapped-labels/resolve/main/onescroll.html
2.94 kB
| <!-- space-onescroll:start --> | |
| <!-- one page scroll bar: written by python -m kit spaceconnect render; do not edit --> | |
| <style>iframe[srcdoc]{display:block;max-height:none}</style> | |
| <script> | |
| (function () { | |
| if (window.__oneScroll) return; | |
| window.__oneScroll = true; | |
| var CSS = 'html,body{height:auto!important;min-height:0!important}html{overflow:hidden!important}'; | |
| function size(f) { | |
| var d, st = f.__os; | |
| try { d = f.contentDocument; } catch (e) { return; } | |
| if (!d || !d.body || st.off) return; | |
| var de = d.documentElement, r = Math.ceil(de.getBoundingClientRect().height), over = de.scrollHeight; | |
| var ch = f.clientHeight, t = r; | |
| if (over > ch + 1) t = Math.max(r, over); | |
| else if (r >= st.r) t = Math.max(r, ch); | |
| st.r = r; | |
| if (Math.abs(t - ch) < 2) return; | |
| var now = Date.now(); | |
| st.n = now - st.t0 < 4000 ? st.n + 1 : 1; | |
| if (st.n === 1) st.t0 = now; | |
| if (st.n > 40) { st.off = true; f.removeAttribute('scrolling'); var g = d.getElementById('space-onescroll'); if (g) g.remove(); return; } | |
| f.style.setProperty('height', t + 'px', 'important'); | |
| } | |
| function attach(f) { | |
| var d, st = f.__os; | |
| try { d = f.contentDocument; } catch (e) { return; } | |
| if (!d || !d.documentElement || st.doc === d) return; | |
| st.doc = d; st.r = Infinity; st.n = 0; st.off = false; | |
| if (!d.getElementById('space-onescroll')) { | |
| var s = d.createElement('style'); s.id = 'space-onescroll'; s.textContent = CSS; | |
| (d.head || d.documentElement).appendChild(s); | |
| } | |
| f.setAttribute('scrolling', 'no'); | |
| f.style.setProperty('min-height', '0', 'important'); | |
| f.style.setProperty('max-height', 'none', 'important'); | |
| var w = d.defaultView, go = function () { size(f); }; | |
| if (w && w.ResizeObserver) { var ro = new w.ResizeObserver(go); ro.observe(d.documentElement); if (d.body) ro.observe(d.body); } | |
| d.addEventListener('load', go, true); | |
| go(); | |
| } | |
| function bind(f) { | |
| if (f.__os || f.getAttribute('data-scroll') === 'inner') return; | |
| try { if (!f.contentDocument) return; } catch (e) { return; } | |
| f.__os = {t0: 0, n: 0, r: 0}; | |
| f.addEventListener('load', function () { attach(f); }); | |
| if (f.contentDocument.readyState !== 'loading') attach(f); | |
| else f.contentDocument.addEventListener('DOMContentLoaded', function () { attach(f); }); | |
| } | |
| function scan() { var fs = document.getElementsByTagName('iframe'); for (var i = 0; i < fs.length; i++) bind(fs[i]); } | |
| function start() { | |
| scan(); | |
| new MutationObserver(scan).observe(document.documentElement, {childList: true, subtree: true}); | |
| window.addEventListener('resize', function () { | |
| var fs = document.getElementsByTagName('iframe'); | |
| for (var i = 0; i < fs.length; i++) if (fs[i].__os) size(fs[i]); | |
| }); | |
| } | |
| if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start(); | |
| })(); | |
| </script> | |
| <!-- space-onescroll:end --> | |