Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4139351
Toolbar.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
Toolbar.js
View Options
const
mobile
=
require
(
'mobile.startup'
),
ToggleList
=
require
(
'../../includes/Skins/ToggleList/ToggleList.js'
),
page
=
mobile
.
currentPage
(),
// The top level menu.
selector
=
'.page-actions-menu'
,
// The secondary overflow submenu component container.
overflowSubmenuSelector
=
'#page-actions-overflow'
,
overflowListSelector
=
'.toggle-list__list'
;
/**
* @param {Window} window
* @param {Element} toolbar
* @ignore
*/
function
bind
(
window
,
toolbar
)
{
const
overflowSubmenu
=
toolbar
.
querySelector
(
overflowSubmenuSelector
);
if
(
overflowSubmenu
)
{
ToggleList
.
bind
(
window
,
overflowSubmenu
);
}
}
/**
* @param {Window} window
* @param {Element} toolbar
* @ignore
*/
function
render
(
window
,
toolbar
)
{
const
overflowList
=
toolbar
.
querySelector
(
overflowListSelector
);
checkForReadOnlyMode
();
renderDownloadButton
(
window
,
overflowList
);
}
/**
* Initialize page edit action link (#ca-edit) for read only mode.
* (e.g. when $wgReadOnly is set in LocalSettings.php)
*
* Mark the edit link as disabled if the user is not actually able to edit the page for some
* reason (e.g. page is protected or user is blocked).
*
* Note that the link is still clickable, but clicking it will probably open a view-source
* form or display an error message, rather than open an edit form.
*
* This check occurs in JavaScript as anonymous page views are cached
* in Varnish.
*
* @ignore
*/
function
checkForReadOnlyMode
()
{
if
(
mw
.
config
.
get
(
'wgMinervaReadOnly'
)
)
{
document
.
body
.
classList
.
add
(
'minerva-read-only'
);
}
}
/**
* Initialize and inject the download button
*
* There are many restrictions when we can show the download button, this function should handle
* all device/os/operating system related checks and if device supports printing it will inject
* the Download icon
*
* @ignore
* @param {Window} window
* @param {Element|null} overflowList
*/
function
renderDownloadButton
(
window
,
overflowList
)
{
const
downloadPageAction
=
require
(
'./downloadPageAction.js'
).
downloadPageAction
,
$downloadAction
=
downloadPageAction
(
page
,
mw
.
config
.
get
(
'wgMinervaDownloadNamespaces'
,
[]
),
window
,
!!
overflowList
);
if
(
$downloadAction
)
{
mw
.
track
(
'minerva.downloadAsPDF'
,
{
action
:
'buttonVisible'
}
);
}
}
module
.
exports
=
{
selector
,
bind
,
render
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 15:02 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
df/ad/34214a8f8c04f9cbc6bc6f66ecee
Default Alt Text
Toolbar.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment