Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4114238
signature.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
signature.js
View Options
/*!
* JavaScript for Special:Preferences: signature field enhancements.
*/
(
function
()
{
mw
.
hook
(
'htmlform.enhance'
).
add
(
(
$root
)
=>
{
const
$signatureInput
=
$root
.
find
(
'#mw-input-wpnickname'
);
if
(
// This preference could theoretically be disabled ($wgHiddenPrefs)
!
$signatureInput
.
length
||
$signatureInput
.
closest
(
'.mw-htmlform-autoinfuse-lazy'
).
length
)
{
return
;
}
const
signatureInput
=
OO
.
ui
.
infuse
(
$signatureInput
);
// Add a visible length limit
mw
.
widgets
.
visibleCodePointLimit
(
signatureInput
);
// Use appropriate font
function
updateFont
(
useEditFont
)
{
// The following classes are used here:
// * mw-editfont-monospace
// * mw-editfont-sans-serif
// * mw-editfont-serif
signatureInput
.
$element
.
toggleClass
(
'mw-editfont-'
+
mw
.
user
.
options
.
get
(
'editfont'
),
useEditFont
);
}
const
$fancyToggleInput
=
$root
.
find
(
'#mw-input-wpfancysig'
);
if
(
$fancyToggleInput
.
length
)
{
const
fancyToggleInput
=
OO
.
ui
.
infuse
(
$fancyToggleInput
);
fancyToggleInput
.
on
(
'change'
,
()
=>
{
updateFont
(
fancyToggleInput
.
isSelected
()
);
}
);
// !!+ casts '0' to false
updateFont
(
!!+
mw
.
user
.
options
.
get
(
'fancysig'
)
);
}
// Highlight lint errors
$root
.
find
(
'[data-mw-lint-error-location]'
).
each
(
function
()
{
const
$item
=
$
(
this
),
location
=
$item
.
data
(
'mw-lint-error-location'
),
button
=
new
OO
.
ui
.
ButtonWidget
(
{
label
:
mw
.
msg
(
'prefs-signature-highlight-error'
)
}
);
button
.
on
(
'click'
,
()
=>
{
signatureInput
.
selectRange
(
location
[
0
],
location
[
1
]
);
}
);
$item
.
append
(
button
.
$element
);
}
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 23:57 (21 h, 8 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a2/69/5c1aa58df486c4ef1f582e226881
Default Alt Text
signature.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment