MediaWiki:Common.js: Difference between revisions
Constrain contribute box width; consistent Gallery placement |
Fix Gallery whitespace: no clear:both; collapse contribute UI |
||
| Line 598: | Line 598: | ||
/** | /** | ||
* Soldier page contribute | * Soldier page contribute tools — compact disclosure under Gallery heading. | ||
* | * Sits in the text column beside the floated infobox (no clear:both gap). | ||
*/ | */ | ||
$(function () { | $(function () { | ||
| Line 641: | Line 640: | ||
return headingWrap($h2); | return headingWrap($h2); | ||
} | } | ||
var $anchor = findSectionHeading(['Technical record', 'Sources']); | var $anchor = findSectionHeading(['Technical record', 'Sources']); | ||
var $wrap = $('<div>', { 'class': 'mw-heading mw-heading2' }); | var $wrap = $('<div>', { 'class': 'mw-heading mw-heading2' }); | ||
| Line 657: | Line 655: | ||
return; | return; | ||
} | } | ||
/* Always directly under the Gallery heading — same place on every profile. */ | |||
ensureGalleryAnchor().after($box); | |||
} | } | ||
| Line 682: | Line 663: | ||
var uploadUrl = mw.util.getUrl('Special:Upload') + '&wpRitchieSoldierPage=' + encodeURIComponent(pageTitle); | var uploadUrl = mw.util.getUrl('Special:Upload') + '&wpRitchieSoldierPage=' + encodeURIComponent(pageTitle); | ||
var $box = $('< | var $box = $('<details>', { 'class': 'soldier-upload-box' }); | ||
$box.append($('< | var $summary = $('<summary>').text('Add photos or OCR a document'); | ||
$box.append($summary); | |||
document.createTextNode(' | |||
var $body = $('<div>', { 'class': 'soldier-upload-body' }); | |||
$body.append($('<p>', { 'class': 'soldier-contrib-help' }).append( | |||
document.createTextNode('Photos for the portrait or Gallery, or a document scan for OCR review. Also '), | |||
$('<a>', { href: uploadUrl, text: 'Special:Upload' }), | $('<a>', { href: uploadUrl, text: 'Special:Upload' }), | ||
document.createTextNode('.') | document.createTextNode('.') | ||
| Line 699: | Line 683: | ||
'<a href="' + mw.util.getUrl('Special:UserLogin', { returnto: pageTitle }) + '">Log in</a> to upload files or run document OCR.' | '<a href="' + mw.util.getUrl('Special:UserLogin', { returnto: pageTitle }) + '">Log in</a> to upload files or run document OCR.' | ||
)); | )); | ||
$ | $body.append($photoSection); | ||
$ | $body.append($('<div>', { 'class': 'soldier-ocr-slot' })); | ||
$box.append($body); | |||
placeContributeBox($box); | placeContributeBox($box); | ||
return; | return; | ||
| Line 720: | Line 705: | ||
$form.append($file, $profile, $gallery, $submit, $status); | $form.append($file, $profile, $gallery, $submit, $status); | ||
$photoSection.append($form); | $photoSection.append($form); | ||
$ | $body.append($photoSection); | ||
$ | $body.append($('<div>', { 'class': 'soldier-ocr-slot' })); | ||
$box.append($body); | |||
placeContributeBox($box); | placeContributeBox($box); | ||