16,983
edits
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup); | mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup); | ||
/* | /* Clean-up Unicode */ | ||
function | function unicodeFixer() { | ||
var textAreas = ['#wpTextbox1', '#wikitext-editor']; | var textAreas = ['#wpTextbox1', '#wikitext-editor']; | ||
for (var i = 0; i < textAreas.length; i++) { | for (var i = 0; i < textAreas.length; i++) { | ||
if ($(textAreas[i]).length) | if ($(textAreas[i]).length) | ||
$(textAreas[i]).val($(textAreas[i]).val().replace(/[‘’]/g, "'").replace(/[“”]/g, '"')); | $(textAreas[i]).val($(textAreas[i]).val().replace(/[\u200B-\u200F\uFEFF]/g, '').replace(/[‘’]/g, "'").replace(/[“”]/g, '"')); | ||
} | } | ||
} | } | ||
$(function() { | $(function() { | ||
if (['edit', 'submit'].includes(mw.config.get('wgAction')) && ![8, 10, 274, 828, 2300].includes(mw.config.get('wgNamespaceNumber'))) { | if (['edit', 'submit'].includes(mw.config.get('wgAction')) && ![8, 10, 274, 828, 2300].includes(mw.config.get('wgNamespaceNumber'))) { | ||
$('.editButtons input').click( | $('.editButtons input').click(unicodeFixer); | ||
if ($('body.skin-minerva').length) | if ($('body.skin-minerva').length) | ||
setTimeout(function() { $('.header-action button').click( | setTimeout(function() { $('.header-action button').click(unicodeFixer) }, 3000); | ||
} | } | ||
}); | }); |