Adds a customizable scroll-to-top button near the page bottom.
या स्क्रिप्टच्या अशा आवृत्त्या ज्यांत कोड अपडेट करण्यात आले होते. सर्व आवृत्त्या दाखवा.
This details the technical modifications and refactoring between the two versions.
I. Architectural & Core Changes:
CSS Injection vs. Inline Styling:
:hover
:active
element.style
createButtonElement
setButtonHoverStyle
resetButtonStyles
setButtonPressStyle
handleScrollEvent
setTimeout
_injS
<style>
#_sid
<head>
opacity
visibility
transform
#_bid
.visible
Visibility/State Handling:
shouldShowButton
showThreshold
bottomThreshold
element.style.opacity
element.style.visibility
_hSE
_cfg.bh.shThrPx
Configuration Structure (APP_CONFIG vs _cfg):
APP_CONFIG
_cfg
button
behavior
scroll
b
bh
sc
size
sz
transitionSpeed
trMs
Smooth Scroll Implementation (smoothScrollToTop vs _scT/_smS):
smoothScrollToTop
_scT
_smS
scrollDuration
scroll.breakpoints
requestAnimationFrame
_cfg.bh.smScr
_cfg.bh.natSmScr
'scrollBehavior' in document.documentElement.style
window.scrollTo({ behavior: 'smooth' })
smScr
window.scrollTo({ behavior: 'auto' })
performance.now()
cancelAnimationFrame
_gEF()
II. Added Features & Options:
_eas
_cfg.b.svg.pd
_cfg.b.lbl
aria-label
title
@noframes
_init
try...catch
III. Removed Functionality:
behavior.bottomThreshold
scroll.fps
_cfg.sc.durMs
IV. Internal & Minor Changes:
enhanced-scroll-button
estb-dxrk1e-s
estb-styles-dxrk1e-s
_
_btn
_sto
_gSP
_deb
debounce
immediate
window.scrollY
pageYOffset
document.documentElement
document.body
attributes: false
Summary:
Version 3.1.0 represents a significant refactoring towards using CSS for styling and transitions, simplifying JavaScript logic, and improving performance and maintainability. It introduces native smooth scroll support and more easing options while removing some less essential complexity (like bottom threshold and dynamic scroll speed). The configuration structure change is the main breaking change for end-users modifying the script.
APP_CONFIG.button.position
APP_CONFIG.button.svg
enableSmoothScroll
minimumPageHeight
EASING_FUNCTIONS
Thanks for the user named LeFiXER. I fixed some issues regarding to this userscript.
Date: 2024-07-24