User:Gryllida/js/draft-review.js

mw.loader.using(['mediawiki.api'], function () {

"use strict";

// next draft link

var linknextdraft = mw.util.addPortletLink(mw.config.get('skin') === 'vector' ? 'p-views' : 'p-cactions',

'javascript:void(0);', 'Next Draft', 'p-gryllida-nextdraft', 'Visits next random draft', '8'

);

linknextdraft.addEventListener('click', function(){

window.open("https://en.wikipedia.org/wiki/Special:RandomInCategory/Category:Pending_AfC_submissions","_self")

});

});

// button to press a few shortcuts to add a comment

/* var linkAddCommentInline = mw.util.addPortletLink(mw.config.get('skin') === 'vector' ? 'p-views' : 'p-cactions',

'javascript:void(0);', 'Add inline comment', 'p-gryllida-addInlineComment', 'Adds comment to draft inline', '8'

);

linkAddCommentInline.addEventListener('click', function(){

var e = jQuery.Event("keydown");

e.which = 85; // 'u' code value

e.ctrlKey = true; // Alt key pressed

$('body').trigger(e);

/* simulateKeyPress('ctrl+u');

jQuery.event.trigger({ type : 'keypress', which : 39 });

jQuery.event.trigger({ type : 'keypress', which : 39 });

simulateKeyPress('()');

jQuery.event.trigger({ type : 'keypress', which : 37 });

simulateKeyPress('ctrl+b');

});*/

//$('.ve-ui-toolbar-saveButton')[0].click(); // alt+s does not work