MediaWiki:Common.js: Atšķirības starp versijām
Izskats
Nav labojuma kopsavilkuma |
Nav labojuma kopsavilkuma |
||
| 1. rindiņa: | 1. rindiņa: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
mw.hook('wikipage.content').add(function ($content) { | mw.hook('wikipage.content').add(function ($content) { | ||
var $wrap = $content.find('#mw-createaccount-form .mw-htmlform-ooui'); | var $wrap = $content.find('#mw-createaccount-form .mw-htmlform-ooui'); | ||
if (!$wrap.length) return; | if (!$wrap.length) $wrap = $content.find('#mw-createaccount-form'); // fallback | ||
function blockFor(id) { | |||
var $el = $wrap.find(id); | |||
if (!$el.length) return null; | |||
// field container in both OOUI & legacy HTMLForm | |||
var $blk = $el.closest('.oo-ui-fieldLayout, .mw-htmlform-field, .mw-htmlform-field-HTMLCheckField, .mw-htmlform-field-HTMLInfoField, tr, li, dd, div'); | |||
return $blk.length ? $blk : $el; | |||
} | |||
[ | [ | ||
'# | '#wpCreateaccountMail', | ||
'# | '#wpReason', | ||
'# | '#wpName2', | ||
'# | '#wpPassword2', | ||
'# | '#wpRetype', | ||
'# | '#wpEmail', | ||
'#wpRealName', | |||
'#mw-input-captchaWord', | '#mw-input-captchaWord', | ||
'# | '#wpCreateaccount' | ||
].forEach(function (sel) { | ].forEach(function (sel) { | ||
var | var b = blockFor(sel); | ||
if ( | if (b) b.appendTo($wrap); // move into desired order | ||
}); | }); | ||
}); | }); | ||
Versija, kas saglabāta 2025. gada 19. septembris, plkst. 18.45
/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.content').add(function ($content) {
var $wrap = $content.find('#mw-createaccount-form .mw-htmlform-ooui');
if (!$wrap.length) $wrap = $content.find('#mw-createaccount-form'); // fallback
function blockFor(id) {
var $el = $wrap.find(id);
if (!$el.length) return null;
// field container in both OOUI & legacy HTMLForm
var $blk = $el.closest('.oo-ui-fieldLayout, .mw-htmlform-field, .mw-htmlform-field-HTMLCheckField, .mw-htmlform-field-HTMLInfoField, tr, li, dd, div');
return $blk.length ? $blk : $el;
}
[
'#wpCreateaccountMail',
'#wpReason',
'#wpName2',
'#wpPassword2',
'#wpRetype',
'#wpEmail',
'#wpRealName',
'#mw-input-captchaWord',
'#wpCreateaccount'
].forEach(function (sel) {
var b = blockFor(sel);
if (b) b.appendTo($wrap); // move into desired order
});
});