Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7104454
index.ts
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
892 B
Referenced Files
None
Subscribers
None
index.ts
View Options
export
*
from
"./controllers.js"
;
(
function
enableScrollPreservation
()
{
/* https://github.com/hotwired/turbo/issues/37#issuecomment-1422200868 */
let
scrollTop
=
0
;
let
shouldPreserveScroll
=
false
;
document
.
addEventListener
(
"turbo:click"
,
function
(
event
)
{
if
((
event
.
target
as
HTMLDivElement
).
hasAttribute
(
"data-turbo-preserve-scroll"
))
{
shouldPreserveScroll
=
true
;
}
else
{
shouldPreserveScroll
=
false
;
}
});
document
.
addEventListener
(
"turbo:visit"
,
function
()
{
if
(
shouldPreserveScroll
)
{
scrollTop
=
document
.
documentElement
.
scrollTop
;
}
else
{
scrollTop
=
0
;
}
});
addEventListener
(
"turbo:visit"
,
()
=>
{
/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any */
(
window
as
any
).
Turbo
.
navigator
.
currentVisit
.
scrolled
=
true
;
document
.
documentElement
.
scrollTop
=
scrollTop
;
});
})();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 03:02 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
798351
Default Alt Text
index.ts (892 B)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline
Log In to Comment