Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2752931
skinPrefs.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
skinPrefs.js
View Options
/*!
* Special:Preferences skin section enhancements.
* When the skin tab is infused by OOUI, toggle skin preferences based on skin state.
*/
(
function
()
{
function
invalidateSkinPrefsDisplay
(
$root
)
{
const
// The skin preferences section. Skins with preferences should use the
// section `rendering/skin/skin-prefs` toa dd skin specific preferences
// in their onGetPreferences() hook.
// At time of writing, this functionality is only used by Vector and Monobook.
$skinPrefs
=
$root
.
find
(
'#mw-prefsection-rendering-skin-skin-prefs'
),
// oo-ui-fieldLayout is the wrapper class name for each preference. When all wrappers are
// disabled by hide-if (oo-ui-fieldLayout-disabled), the whole section should be hidden.
show
=
!!
$skinPrefs
.
find
(
'.oo-ui-fieldLayout'
).
not
(
'.oo-ui-fieldLayout-disabled'
).
length
;
$skinPrefs
.
parent
().
css
(
'display'
,
show
?
''
:
'none'
);
}
function
onHTMLFormEnhance
(
$root
)
{
const
$skins
=
$root
.
find
(
'#mw-input-wpskin'
);
// Don't kick in before this tab panel is infused and hide-if executed (T352358).
if
(
!
$skins
.
length
||
$skins
.
closest
(
'.mw-htmlform-autoinfuse-lazy'
).
length
)
{
return
;
}
// No need to listen for subsequent events.
mw
.
hook
(
'htmlform.enhance'
).
remove
(
onHTMLFormEnhance
);
// Set the initial skin preference display state based on the skin selected.
invalidateSkinPrefsDisplay
(
$root
);
// Observe skin radio state selection changes.
OO
.
ui
.
infuse
(
$skins
).
on
(
'change'
,
()
=>
{
invalidateSkinPrefsDisplay
(
$root
);
}
);
}
// Wait for the tab to be infused by OOUI before manipulating it further. htmlform.enhance is
// emitted on page load by resources/src/mediawiki.htmlform/htmlform.js, again for each tab
// infused by resources/src/mediawiki.special.preferences.ooui/tabs.js, and possibly other
// scenarios.
mw
.
hook
(
'htmlform.enhance'
).
add
(
onHTMLFormEnhance
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 3, 20:34 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
58/62/13f3cc320fe3f43b2cfee262a284
Default Alt Text
skinPrefs.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment