Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10361285
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/front/index.ts b/src/front/index.ts
index 7fb054e..14f9d28 100644
--- a/src/front/index.ts
+++ b/src/front/index.ts
@@ -1,31 +1,28 @@
export * from "./controllers.js";
(function enableScrollPreservation() {
/* https://github.com/hotwired/turbo/issues/37#issuecomment-1422200868 */
- Turbo.scrollTop = 0;
+ let scrollTop = 0;
- Turbo.shouldPreserveScroll = false;
-
- let shouldPreserveScroll = 0;
+ let shouldPreserveScroll = false;
document.addEventListener("turbo:click", function (event) {
- if (event.target.hasAttribute("data-turbo-preserve-scroll")) {
+ if ((event.target as HTMLDivElement).hasAttribute("data-turbo-preserve-scroll")) {
shouldPreserveScroll = true;
} else {
shouldPreserveScroll = false;
}
});
- document.addEventListener("turbo:visit", function (event) {
+ document.addEventListener("turbo:visit", function () {
if (shouldPreserveScroll) {
- Turbo.scrollTop = document.documentElement.scrollTop;
+ scrollTop = document.documentElement.scrollTop;
} else {
- Turbo.scrollTop = 0;
+ scrollTop = 0;
}
});
addEventListener("turbo:visit", () => {
- Turbo.navigator.currentVisit.scrolled = true;
- document.documentElement.scrollTop = Turbo.scrollTop;
+ document.documentElement.scrollTop = scrollTop;
});
})();
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 12:33 (16 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034582
Default Alt Text
(1 KB)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline
Log In to Comment