PageSourceSearch

https://muxtly.pages.dev/assets/js/backtotop.js

js muxtly.pages.dev collected 2026-10-03 05:40:42 UTC 2,026 bytes, 41 lines download raw bytes

1/* Muxtly floating "back to top" button.
2 * Injected on every page (root, translated, info, hub). Uses CSS variables
3 * defined in style.css so it inherits the site theme automatically.
4 * No external deps; button is created dynamically, nothing to add in HTML.
5 */
6(function () {
7  if (document.getElementById('muxtly-top-btn')) return;
8
9  var btn = document.createElement('button');
10  btn.id = 'muxtly-top-btn';
11  btn.setAttribute('aria-label', 'Back to top');
12  btn.title = 'Back to top';
13  btn.innerHTML =
14    '<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5"/><path d="M5 12l7-7 7 7"/></svg>';
15  btn.style.cssText =
16    'position:fixed;right:18px;bottom:18px;z-index:9999;width:46px;height:46px;' +
17    'border-radius:50%;border:1px solid var(--border,#334155);cursor:pointer;' +
18    'background:var(--primary,#4f46e5);color:#fff;display:flex;align-items:center;justify-content:center;' +
19    'box-shadow:0 6px 20px rgba(0,0,0,.35);opacity:0;visibility:hidden;transform:translateY(8px);' +
20    'transition:opacity .25s,visibility .25s,transform .25s,background .2s;';
21  btn.addEventListener('mouseenter', function () { btn.style.background = 'var(--primary-hover,#a5b4fc)'; });
22  btn.addEventListener('mouseleave', function () { btn.style.background = 'var(--primary,#4f46e5)'; });
23
24  var show = false;
25  function update() {
26    var y = window.pageYOffset || document.documentElement.scrollTop || 0;
27    var should = y > 400;
28    if (should === show) return;
29    show = should;
30    btn.style.opacity = show ? '1' : '0';
31    btn.style.visibility = show ? 'visible' : 'hidden';
32    btn.style.transform = show ? 'translateY(0)' : 'translateY(8px)';
33  }
34  function toTop() {
35    window.scrollTo({ top: 0, behavior: 'smooth' });
36  }
37  btn.addEventListener('click', toTop);
38  document.body.appendChild(btn);
39  update();
40  window.addEventListener('scroll', update, { passive: true });
41})();

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.