Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5964602
toc.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
toc.js
View Options
(
function
()
{
'use strict'
;
function
initToc
(
tocNode
)
{
const
toggleNode
=
tocNode
.
querySelector
(
'.toctogglecheckbox'
);
if
(
!
toggleNode
)
{
return
;
}
let
hidden
=
false
;
toggleNode
.
addEventListener
(
'change'
,
()
=>
{
hidden
=
!
hidden
;
mw
.
cookie
.
set
(
'hidetoc'
,
hidden
?
'1'
:
null
);
toggleNode
.
setAttribute
(
'aria-label'
,
hidden
?
mw
.
message
(
'table-of-contents-show-button-aria-label'
).
plain
()
:
mw
.
message
(
'table-of-contents-hide-button-aria-label'
).
plain
()
);
}
);
// Initial state
if
(
mw
.
cookie
.
get
(
'hidetoc'
)
===
'1'
)
{
toggleNode
.
checked
=
true
;
hidden
=
true
;
}
toggleNode
.
setAttribute
(
'aria-label'
,
hidden
?
mw
.
message
(
'table-of-contents-show-button-aria-label'
).
plain
()
:
mw
.
message
(
'table-of-contents-hide-button-aria-label'
).
plain
()
);
}
mw
.
hook
(
'wikipage.content'
).
add
(
(
$content
)
=>
{
const
tocs
=
$content
[
0
]
?
$content
[
0
].
querySelectorAll
(
'.toc'
)
:
[];
let
i
=
tocs
.
length
;
while
(
i
--
)
{
initToc
(
tocs
[
i
]
);
}
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 10:25 (1 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
03/0e/e2c306c7681cf1f90d840864177d
Default Alt Text
toc.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment