Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5954367
sections.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
937 B
Referenced Files
None
Subscribers
None
sections.js
View Options
/**
* Set up functionality of collapsable sections
*
* @param {HTMLElement} bodyContent
* @return {void}
*/
function
init
(
bodyContent
)
{
if
(
!
document
.
body
.
classList
.
contains
(
'citizen-sections-enabled'
)
)
{
return
;
}
const
onEditSectionClick
=
(
e
)
=>
{
e
.
stopPropagation
();
};
const
handleClick
=
(
e
)
=>
{
const
target
=
e
.
target
;
const
isEditSection
=
target
.
closest
(
'.mw-editsection, .mw-editsection-like'
);
if
(
isEditSection
)
{
onEditSectionClick
(
e
);
return
;
}
const
heading
=
target
.
closest
(
'.citizen-section-heading'
);
if
(
heading
&&
heading
.
nextElementSibling
&&
heading
.
nextElementSibling
.
classList
.
contains
(
'citizen-section'
)
)
{
const
section
=
heading
.
nextElementSibling
;
if
(
section
)
{
section
.
hidden
=
section
.
hidden
?
false
:
'until-found'
;
}
}
};
bodyContent
.
addEventListener
(
'click'
,
handleClick
,
false
);
}
module
.
exports
=
{
init
:
init
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 02:57 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ef/e8/0061c6037ca2b5d4d1a83e0325a6
Default Alt Text
sections.js (937 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment