Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4113396
editorLoadingOverlay.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
editorLoadingOverlay.js
View Options
const
fakeToolbar
=
require
(
'./fakeToolbar'
),
IconButton
=
require
(
'../mobile.startup/IconButton'
),
Overlay
=
require
(
'../mobile.startup/Overlay'
);
/* global $ */
/**
* Like loadingOverlay(), but with a fake editor toolbar instead of the spinner.
*
* @private
* @param {Function} afterShow Callback which runs after overlay is shown
* @param {Function} afterHide Callback which runs after overlay is hidden
* @param {Function} [loadBasicEditor] Callback for the "Use basic editor" button
* @return {module:mobile.startup/Overlay}
*/
module
.
exports
=
function
editorLoadingOverlay
(
afterShow
,
afterHide
,
loadBasicEditor
)
{
let
timeout
;
const
$fakeToolbar
=
fakeToolbar
(),
$loadBasicWrapper
=
$
(
'<div>'
).
addClass
(
've-loadbasiceditor'
),
loadBasicButton
=
new
IconButton
(
{
label
:
mw
.
msg
(
'mobile-frontend-editor-loadbasiceditor'
),
action
:
'progressive'
,
weight
:
'normal'
,
size
:
'medium'
,
isIconOnly
:
false
,
icon
:
null
}
),
overlay
=
new
Overlay
(
{
className
:
'overlay overlay-loading'
,
noHeader
:
true
,
isBorderBox
:
false
,
onBeforeExit
:
function
(
exit
)
{
exit
();
afterHide
();
if
(
timeout
)
{
clearTimeout
(
timeout
);
}
}
}
),
logFeatureUse
=
function
(
feature
,
action
)
{
mw
.
track
(
'visualEditorFeatureUse'
,
{
feature
:
feature
,
action
:
action
,
// eslint-disable-next-line camelcase
editor_interface
:
'visualeditor'
}
);
};
overlay
.
show
=
function
()
{
Overlay
.
prototype
.
show
.
call
(
this
);
afterShow
();
};
overlay
.
$el
.
find
(
'.overlay-content'
).
append
(
$fakeToolbar
);
if
(
loadBasicEditor
)
{
overlay
.
$el
.
find
(
'.overlay-content'
).
append
(
$loadBasicWrapper
.
append
(
$
(
'<p>'
).
text
(
mw
.
msg
(
'mobile-frontend-editor-loadingtooslow'
)
),
loadBasicButton
.
$el
)
);
timeout
=
setTimeout
(
function
()
{
$loadBasicWrapper
.
addClass
(
've-loadbasiceditor-shown'
);
logFeatureUse
(
'mobileVisualFallback'
,
'context-show'
);
},
3000
);
loadBasicButton
.
$el
.
on
(
'click'
,
function
()
{
$loadBasicWrapper
.
removeClass
(
've-loadbasiceditor-shown'
);
logFeatureUse
(
'mobileVisualFallback'
,
'fallback-confirm'
);
loadBasicEditor
();
}
);
}
// Animate the toolbar sliding into place.
$fakeToolbar
.
addClass
(
'toolbar-hidden'
);
setTimeout
(
function
()
{
$fakeToolbar
.
addClass
(
'toolbar-shown'
);
setTimeout
(
function
()
{
$fakeToolbar
.
addClass
(
'toolbar-shown-done'
);
},
250
);
}
);
return
overlay
;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 23:23 (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4b/1a/77499170ae96df8da02ef76351cd
Default Alt Text
editorLoadingOverlay.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment