Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4095460
editfont.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
editfont.js
View Options
/*!
* JavaScript for Special:Preferences: editfont field enhancements.
*/
(
function
()
{
mw
.
hook
(
'htmlform.enhance'
).
add
(
(
$root
)
=>
{
const
$target
=
$root
.
find
(
'#mw-input-wpeditfont'
);
if
(
// This preference could theoretically be disabled ($wgHiddenPrefs)
!
$target
.
length
||
$target
.
closest
(
'.mw-htmlform-autoinfuse-lazy'
).
length
)
{
return
;
}
const
widget
=
OO
.
ui
.
infuse
(
$target
);
// Style options
widget
.
dropdownWidget
.
menu
.
items
.
forEach
(
(
item
)
=>
{
// The following classes are used here:
// * mw-editfont-monospace
// * mw-editfont-sans-serif
// * mw-editfont-serif
item
.
$label
.
addClass
(
'mw-editfont-'
+
item
.
getData
()
);
}
);
let
lastValue
;
function
updateLabel
(
value
)
{
// Style selected item label
// The following classes are used here:
// * mw-editfont-monospace
// * mw-editfont-sans-serif
// * mw-editfont-serif
widget
.
dropdownWidget
.
$label
.
removeClass
(
'mw-editfont-'
+
lastValue
)
.
addClass
(
'mw-editfont-'
+
value
);
lastValue
=
value
;
}
widget
.
on
(
'change'
,
updateLabel
);
updateLabel
(
widget
.
getValue
()
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 13:53 (4 w, 8 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
cc/f2/c871ec596165427d7de337d693e2
Default Alt Text
editfont.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment