User:SD0001/sandbox4.js

// Fork of User:Jackmcbarn/advancedtemplatesandbox.js

if ($('#wpTemplateSandboxPage').attr('type') == 'hidden') {

mw.loader.using('jquery.makeCollapsible', function () {

$('#templatesandbox-editform').makeCollapsible({collapsed: !$('#wpTemplateSandboxPage').attr('value')});

});

$('#templatesandbox-editform').prepend('Preview page with this template');

$('#wpTemplateSandboxPage')

.before(' ')

.after('')

.replaceWith($('#wpTemplateSandboxPage').clone().attr({

type: 'text',

tabindex: +($('#wpDiff').attr('tabIndex')) + 0.5,

size: 60,

spellcheck: true,

'data-mw-searchsuggest': '{"wrapAsLink":false}'

}).addClass('mw-searchInput'));

}

if ($('#wpTemplateSandboxTemplate').attr('type') == 'hidden') {

$('#wpTemplateSandboxTemplate')

.before(' ')

.after('
')

.replaceWith($('#wpTemplateSandboxTemplate').clone().attr({

type: 'text',

tabindex: +($('#wpDiff').attr('tabIndex')) + 0.25,

size: 60,

spellcheck: true

}));

var val = $('#wpTemplateSandboxTemplate').val();

if (val.endsWith('/sandbox')) {

val = val.slice(0, -8);

$('#wpTemplateSandboxTemplate').val(val);

}

}