Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427583
filewarning.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
filewarning.js
View Options
/*!
* mediawiki.filewarning
*
* @author Mark Holmquist, 2015
* @since 1.25
*/
(
function
()
{
const
warningConfig
=
mw
.
config
.
get
(
'wgFileWarning'
),
warningMessages
=
warningConfig
.
messages
,
warningLink
=
warningConfig
.
link
,
$origMimetype
=
$
(
'.fullMedia .fileInfo .mime-type'
),
$mimetype
=
$origMimetype
.
clone
(),
$header
=
$
(
'<h3>'
)
.
addClass
(
'mediawiki-filewarning-header empty'
),
$main
=
$
(
'<p>'
)
.
addClass
(
'mediawiki-filewarning-main empty'
),
$info
=
$
(
'<a>'
)
.
addClass
(
'mediawiki-filewarning-info empty'
),
$footer
=
$
(
'<p>'
)
.
addClass
(
'mediawiki-filewarning-footer empty'
),
dialog
=
new
OO
.
ui
.
PopupButtonWidget
(
{
classes
:
[
'mediawiki-filewarning-anchor'
],
label
:
$mimetype
,
flags
:
[
'warning'
],
icon
:
'alert'
,
framed
:
false
,
popup
:
{
// This popup is always "visible", but hidden using CSS. OOUI event handlers that try to
// close it interfere with other things on the page. (T309093)
autoClose
:
false
,
classes
:
[
'mediawiki-filewarning'
],
padded
:
true
,
width
:
400
,
$content
:
$header
.
add
(
$main
).
add
(
$info
).
add
(
$footer
)
}
}
);
function
loadMessage
(
$target
,
message
)
{
if
(
message
)
{
$target
.
removeClass
(
'empty'
)
// eslint-disable-next-line mediawiki/msg-doc
.
text
(
mw
.
msg
(
message
)
);
}
}
// The main message must be populated for the dialog to show.
if
(
warningConfig
&&
warningConfig
.
messages
&&
warningConfig
.
messages
.
main
)
{
$mimetype
.
addClass
(
'has-warning'
);
$origMimetype
.
replaceWith
(
dialog
.
$element
);
if
(
warningMessages
)
{
loadMessage
(
$main
,
warningMessages
.
main
);
loadMessage
(
$header
,
warningMessages
.
header
);
loadMessage
(
$footer
,
warningMessages
.
footer
);
if
(
warningLink
)
{
loadMessage
(
$info
,
warningMessages
.
info
);
$info
.
attr
(
'href'
,
warningLink
);
}
}
// Position the popup relative to $button rather than the default $element, so that it isn't
// pushed away by padding added to .mediawiki-filewarning-anchor in CSS. (T363157)
dialog
.
getPopup
().
setFloatableContainer
(
dialog
.
$button
);
// Make OOUI open the dialog, it won't appear until the user
// hovers over the warning.
dialog
.
getPopup
().
toggle
(
true
);
// Override toggle handler because we don't need it for this popup
// object at all. Sort of nasty, but it gets the job done.
dialog
.
getPopup
().
toggle
=
function
()
{};
}
}()
);
File Metadata
Details
Attached
Mime Type
text/x-asm
Expires
Sat, May 16, 14:49 (1 d, 2 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b9/f0/79b197b5bee164d65e5c4510aa47
Default Alt Text
filewarning.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment