MediaWiki:Common.js/FairUseUpload.js

/*jshint browser:true jquery:true curly:false smarttabs:true laxbreak:true laxcomma:true */ /*global mediaWiki */ if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'Upload' && !(/(?:^\?|&)wpForReUpload=[^0&]?[^&]/).test(window.location.search)  ) $(function($) { "use strict"; // Overlay the summary with a prompt for the image type. var $textarea = $('#wpUploadDescription'), $prompt = $(document.createElement('div'))  ; // We need a position:relative parent to work with so we'll wrap the contents $textarea.wrap(' '); var $container = $textarea.parent; // Textarea has width:100% so spills its borders $textarea.css({ boxSizing: 'border-box', MozBoxSizing: 'border-box' }); $prompt.css({ position: 'absolute', top: 0, left: 0, bottom: 0, right: 0, backgroundColor: 'rgba(0,0,0,0.8)' }).append( ' ' + ' Anime Image ' + ' Manga Image ' + ' ' ); $container.append($prompt); // Disable the textarea in case we didn't cover it perfectly $textarea.prop('disabled', true); function unlockUI { $prompt.remove; $textarea.prop('disabled', false).css({ boxSizing: , MozBoxSizing:  }).unwrap; // NOTE: If we don't remove prompt then it will be promoted upwards as well } // Default text. "Other Image" button will leave this unmodified. $textarea.val( '' ); // Set up the event handlers $prompt.find('.upload-sd-panel').click(function(evt) { evt.preventDefault; // We're submitting the form somehow? $textarea.val( '' ); unlockUI; }); $prompt.find('.upload-other').click(function(evt) { evt.preventDefault; unlockUI; }); // Set the license to I don't know instead of None window.setTimeout(function { $('#wpLicense').val('No license').change; }, 0); }); // MultipleUpload is harder to work with, we'll just prefill the generic Information // template. if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'MultipleUpload') $(function($) { "use strict"; // Default text only since there's no real way to do this coherently $('#wpUploadDescription').val( '' ); // Set the license to I don't know instead of None window.setTimeout(function { $('#wpLicense').val('No license').change; }, 0); });