Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4133613
drawers.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
drawers.js
View Options
const
$drawerContainer
=
$
(
document
.
body
);
const
BODY_CLASS_SCROLL_LOCKED
=
'has-drawer--with-scroll-locked'
;
/**
* Discard a drawer from display on the page.
*
* @private
* @param {Drawer} drawer
*/
function
discardDrawer
(
drawer
)
{
// remove the class
$drawerContainer
.
removeClass
(
BODY_CLASS_SCROLL_LOCKED
);
// FIXME: queue removal from DOM (using setTimeout so that any animations have time to run)
// This works around an issue in MobileFrontend that the Drawer onBeforeHide method is
// called /before/ the animation for closing has completed. This needs to be accounted
// for in Drawer so this function can be synchronous.
setTimeout
(
()
=>
{
// detach the node from the DOM. Use detach rather than remove to allow reuse without
// losing any existing events.
drawer
.
$el
.
detach
();
},
100
);
}
/**
* Lock scroll of viewport.
*
* @ignore
*/
function
lockScroll
()
{
$drawerContainer
.
addClass
(
BODY_CLASS_SCROLL_LOCKED
);
}
/**
* @param {Drawer} drawer to display
* @param {Object} options for display
* @param {boolean} options.hideOnScroll whether a scroll closes the drawer
* @ignore
*/
function
displayDrawer
(
drawer
,
options
)
{
$drawerContainer
.
append
(
drawer
.
$el
);
drawer
.
show
();
if
(
options
.
hideOnScroll
)
{
$
(
window
).
one
(
'scroll.drawer'
,
()
=>
{
drawer
.
hide
();
}
);
}
}
module
.
exports
=
{
displayDrawer
,
lockScroll
,
discardDrawer
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 12:14 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ba/30/118a17465ac02f50a060d248f236
Default Alt Text
drawers.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment