MediaWiki:Group-user.js: Difference between revisions
From Destinypedia, the Destiny wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for registered users only */ | /* Any JavaScript here will be loaded for registered users only */ | ||
/* | /* Upload cleanup and fix mobile */ | ||
$(function() { | $(function() { | ||
if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !$('#wpForReUpload').length && !$('.warning').length) { | if (mw.config.get('wgCanonicalSpecialPageName') === 'Upload' && !$('#wpForReUpload').length && !$('.warning').length) { | ||
Line 20: | Line 20: | ||
var fileExt = file.split('.').pop().toLowerCase(); | var fileExt = file.split('.').pop().toLowerCase(); | ||
var regex = new RegExp('(\.' + fileExt + ')+$', 'i'); | var regex = new RegExp('(\.' + fileExt + ')+$', 'i'); | ||
fileName = fileName.replace(regex, ' | fileName = fileName.replace(regex, ''); | ||
if (fileExt == 'jpeg' || fileExt == 'jfif') | if (fileExt == 'jpeg' || fileExt == 'jfif') | ||
fileExt = 'jpg'; | fileExt = 'jpg'; | ||
$('#wpDestFile').val(fileName + '.' + fileExt); | $('#wpDestFile').val(fileName + '.' + fileExt); | ||
} | } | ||
var textAreas = ['#wpDestFile', '#wpUploadDescription']; | |||
for (var i = 0; i < textAreas.length; i++) { | |||
if ($(textAreas[i]).length) | |||
$(textAreas[i]).val($(textAreas[i]).val().replace(/[\u200B-\u200F\uFEFF]/g, '').replace(/[‘’]/g, "'").replace(/[“”]/g, '"')); | |||
} | |||
}); | }); | ||
} | } |