MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / enableSmoothScroll

Function enableSmoothScroll

scripts/smoothScroll.js:119–976  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117
118// https://chromewebstore.google.com/detail/smoothscroll/nbokbjkabcmbfdlbddjidfmibcpneigj
119export function enableSmoothScroll() {
120 if (localStorage.getItem("ufs_smoothScroll_disable") == 1) return;
121 // =======================================================================
122 // ============================ sscr.js ==================================
123 // =======================================================================
124
125 // Scroll Variables (tweakable)
126 let defaultOptions = {
127 // Scrolling Core
128 frameRate: 150, // [Hz]
129 animationTime: 400, // [px]
130 stepSize: 100, // [px]
131 // Pulse (less tweakable)
132 // ratio of 'tail' to 'acceleration'
133 pulseAlgorithm: true,
134 pulseScale: 4,
135 pulseNormalize: 1,
136 // Acceleration
137 accelerationDelta: 50, // 20
138 accelerationMax: 3, // 1
139 // Keyboard Settings
140 keyboardSupport: true, // option
141 arrowScroll: 50, // [px]
142 // Other
143 touchpadSupport: true,
144 fixedBackground: true,
145 reverseDirection: false, // for linux users mostly
146 excluded: "",
147 };
148 let options = defaultOptions;
149 // Other Variables
150 let isExcluded = false;
151 let isFrame = false;
152 let direction = {
153 x: 0,
154 y: 0,
155 };
156 let initDone = false;
157 let root = document.documentElement;
158 let activeElement;
159 let observer;
160 let deltaBuffer = [];
161 let deltaBufferTimer;
162 let isMac = /^Mac/.test(navigator.platform);
163 let isWin = /Windows/i.test(navigator.userAgent);
164 let isLinux = /Linux/i.test(navigator.userAgent);
165 let key = {
166 left: 37,
167 up: 38,
168 right: 39,
169 down: 40,
170 spacebar: 32,
171 pageup: 33,
172 pagedown: 34,
173 end: 35,
174 home: 36,
175 };
176 let arrowKeys = {

Callers 4

main.jsFile · 0.90
web_timer_main.jsFile · 0.90
smoothScroll.jsFile · 0.85
lazyEnableSmoothScrollFunction · 0.85

Calls 5

initTestFunction · 0.85
addEventFunction · 0.85
cleanupFunction · 0.85
getMethod · 0.80
initFunction · 0.70

Tested by

no test coverage detected