Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F8097468
mediawiki.page.media.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
mediawiki.page.media.js
View Options
/*!
* Add magnify links to thumbs and resize broken media spans, where needed
*/
(
function
()
{
mw
.
hook
(
'wikipage.content'
).
add
(
(
$content
)
=>
{
$content
.
find
(
'figure[typeof~="mw:File/Thumb"] > :not(figcaption) .mw-file-element'
).
each
(
function
()
{
const
inner
=
this
.
parentNode
;
const
wrapper
=
inner
.
parentNode
;
if
(
this
.
classList
.
contains
(
'mw-broken-media'
)
)
{
// Resize broken media spans, where needed
const
isDefault
=
wrapper
.
classList
.
contains
(
'mw-default-size'
);
if
(
isDefault
)
{
return
;
}
if
(
this
.
hasAttribute
(
'data-width'
)
)
{
this
.
style
.
width
=
this
.
getAttribute
(
'data-width'
)
+
'px'
;
}
if
(
this
.
hasAttribute
(
'data-height'
)
)
{
this
.
style
.
height
=
this
.
getAttribute
(
'data-height'
)
+
'px'
;
}
}
else
{
// Add magnify links to thumbs, where needed
const
resource
=
this
.
getAttribute
(
'resource'
);
if
(
!
resource
)
{
return
;
}
if
(
inner
.
classList
.
contains
(
'mw-file-description'
)
)
{
return
;
}
const
desc
=
this
.
ownerDocument
.
createElement
(
'a'
);
desc
.
setAttribute
(
'href'
,
resource
);
// Using a different class than mw-file-description to avoid the
// expectation that the media will be found inside it
desc
.
classList
.
add
(
'mw-file-magnify'
);
wrapper
.
insertBefore
(
desc
,
inner
.
nextSibling
);
}
}
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 8, 01:49 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f5/77/2e459576cd7da72bead58057c5e4
Default Alt Text
mediawiki.page.media.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment