Welcome to Assassin's Creed Wiki! Log in and join the community.
MediaWiki:Upload.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* <pre style="overflow: scroll; height: 25em"><nowiki> */
function setupUploadForm()
{
var wpLicense = document.getElementById('wpLicense');
var mwUploadTable = document.getElementById('mw-upload-table');
if (wpLicense)
{
if (window.location.search.indexOf('basic=true') == -1)
{
// Bind upload button to verify function
document.getElementById('mw-upload-form').onsubmit = verifySummary;
// Hide row for existing summary box
var wpUploadDescription = document.getElementById('wpUploadDescription');
wpUploadDescription.parentNode.parentNode.style.display = 'none';
mwUploadTable.className = 'hidable start-hidden';
// Create new tbodies to allow for hideable bit
var tbody1 = mwUploadTable.tBodies[0];
var tbody2 = document.createElement('tbody');
tbody2.className = 'hidable-content';
var tbody3 = document.createElement('tbody');
mwUploadTable.appendChild(tbody2);
mwUploadTable.appendChild(tbody3);
// Move existing rows to the right tbody
tbody3.appendChild(tbody1.rows[6]);
tbody3.appendChild(tbody1.rows[6]);
tbody3.appendChild(tbody1.rows[6]);
tbody3.appendChild(tbody1.rows[6]);
var newRow, newRowLabel, newRowControl;
// Source
newRow = tbody1.insertRow(6);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowLabel.style.width = '125px';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Source:</label>';
newRowControl.innerHTML = '<textarea id="sourceBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// Description
newRow = tbody1.insertRow(7);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Description:</label>';
newRowControl.innerHTML = '<textarea id="descriptionBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// Show/hide optional fields
newRow = tbody1.insertRow(8);
newRowLabel = newRow.insertCell(0);
newRowLabel.colSpan = '2';
newRowLabel.style.textAlign = 'center';
newRowLabel.innerHTML = 'Optional fields <span class="hidable-button"></span>';
// Attention
newRow = tbody2.insertRow(0);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Attention:</label>';
newRowControl.innerHTML = '<textarea id="attentionBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// Author
newRow = tbody2.insertRow(1);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Original designer / artist:</label>';
newRowControl.innerHTML = '<textarea id="authorBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// File specs
newRow = tbody2.insertRow(2);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Conversion / editing / upload information:</label>';
newRowControl.innerHTML = '<textarea id="filespecsBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// Artist cat
newRow = tbody2.insertRow(4);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Artist categories:</label>';
newRowControl.innerHTML = '<textarea id="catartistBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
// Licensee cat
newRow = tbody2.insertRow(5);
newRowLabel = newRow.insertCell(0);
newRowControl = newRow.insertCell(1);
newRowLabel.className = 'mw-label';
newRowControl.className = 'mw-input';
newRowLabel.innerHTML = '<label>Licensee categories:</label>';
newRowControl.innerHTML = '<textarea id="catlicenseeBox" cols="60" rows="2" style="overflow: auto;" tabindex="5"></textarea>';
}
else
{
// Old style form just needs Information template in the summary box
document.getElementById('wpUploadDescription').value = '==Summary==\r
{{Information\r
|attention=\r
|description=\r
|source=\r
|author=\r
|filespecs=\r
|licensing=\r
|other versions=\r
|cat artist=\r
|cat licensee=\r
|cat subject=\r
|cat type=\r
}}';
}
}
}
function verifySummary()
{
var wpLicense = document.getElementById('wpLicense');
// Check for licensing
if (wpLicense.value == "")
{
alert('Licensing must be completed.');
return false;
}
// Check for source
if (document.getElementById('sourceBox').value == "")
{
alert('Source must be completed.');
return false;
}
var strBuilder = '==Summary==\r
{{Information\r
';
strBuilder += '|attention=' + document.getElementById('attentionBox').value + '\r
';
strBuilder += '|description=' + document.getElementById('descriptionBox').value + '\r
';
strBuilder += '|source=' + document.getElementById('sourceBox').value + '\r
';
strBuilder += '|author=' + document.getElementById('authorBox').value + '\r
';
strBuilder += '|filespecs=' + document.getElementById('filespecsBox').value + '\r
';
strBuilder += '|licensing=' + wpLicense.options[wpLicense.selectedIndex].title + '\r
';
strBuilder += '|cat artist=' + document.getElementById('catartistBox').value + '\r
';
strBuilder += '|cat licensee=' + document.getElementById('catlicenseeBox').value + '\r
';
strBuilder += '}}';
document.getElementById('wpUploadDescription').value = strBuilder;
wpLicense.selectedIndex = 0;
return true;
}
/* </nowiki></pre> */