Jump to content

User:Gryllida/js/draft-review.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
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("http://en.wiki.x.io/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