User:Þjarkur/Draft submit button.js

/*

Ensures that a "Submit this draft" button is displayed in draftspace for new editors

  • /

(function () {

if (

// Don't show for extendedconfirmed users (temporarily commented out to allow for testing)

// mw.config.get('wgUserGroups').includes('extendedconfirmed') ||

// Only show when in view mode

mw.config.get('wgAction') !== 'view' ||

// Only show in draftspace

mw.config.get('wgNamespaceNumber') !== 118 ||

// Don't show on diff pages

mw.config.get('wgDiffOldId') ||

// Don't show when viewing old versions

mw.config.get('wgRevisionId') !== mw.config.get('wgCurRevisionId') ||

// Don't show if article doesn't exist

!mw.config.get('wgCurRevisionId')

) return;

var hasDraftTemplate = 0 <= mw.config.get('wgCategories').findIndex(function (category) {

return /(AfC|Draft articles|Candidates for speedy)/.test(category)

})

if (hasDraftTemplate) return;

var url = (new mw.Uri()).extend({

action: 'edit',

section: 'new',

preload: 'Template:AFC_submission/Subst',

editintro: 'Template:AFC_submission/Subst/Editintro',

}).toString();

var draftnotice =

'

'+

'

'+

'

'+

'

'+

'

'+

'

'+

'

'+

'

';

$('#mw-content-text').prepend($(draftnotice))

})()