Page MenuHomeSealhub

No OneTemporary

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

Mime Type
text/x-diff
Expires
Sat, Nov 8, 12:33 (12 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034582
Default Alt Text
(1 KB)

Event Timeline