Jump to content

User:DannyS712 test/FNP.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DannyS712 test (talk | contribs) at 04:25, 13 June 2019 (purge). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
var scriptUrl = mw.config.get( 'wgScriptPath' ) + '/api.php';

mw.loader.using( ['mediawiki.util', 'ext.gadget.Twinkle'], function () {
    $(document).ready( function () { 
    	var page = mw.config.get('wgPageName');
    	console.log( page );
    	if ( page && page === 'Special:BlankPage/FilteredNewPages'){
    		FNP_init();
    	}
    } );
} );

function FNP_init(){
	console.log( 'Starting' );
	FNP_form_start();
}
function FNP_form_start(){
	console.log( 'Opening form' );
	var FNP_window = new Morebits.simpleWindow();
	FNP_window.setTitle('Filtered new pages feed');
	FNP_window.setScriptName('Filtered new pages');
	
	var FNP_form = new Morebits.quickForm( FNP_run, null );
	FNP_form.append({ type: 'header', label: 'State' });
	FNP_form.append({
		type: 'checkbox',
		list: [
			{ label: 'Unreviewed pages', value: 'unreviewed' },
			{ label: 'Reviewed pages', value: 'reviewed' },
			]
	});
	FNP_form.append({ type: 'header', label: 'Type' });
	FNP_form.append({
		type: 'checkbox',
		list: [
			{ label: 'Nominated for deletion', value: 'deletion' },
			{ label: 'Redirects', value: 'redirect' },
			{ label: 'All others', value: 'other' },
			]
	});
	FNP_form.append({ type: 'header', label: 'That' });
	FNP_form.append({
		type: 'checkbox',
		list: [
			{ label: 'Have no categories', value: 'noCat' },
			{ label: 'Have no citations', value: 'noCite' },
			{ label: 'Are orphaned', value: 'orphan' },
			{ label: 'Were previously deleted', value: 'wereDel' },
			{ label: 'Were created by newcomers (non-autoconfirmed users)', value: 'newcomers' },
			{ label: 'Were created by learners (newly autoconfirmed users', value: 'learners' },
			{ label: 'Were created by blocked users', value: 'blocked' },
			{ label: 'Were created by bots', value: 'bot' },
			]
	});
	FNP_form.append({ type: 'header', label: 'Predicted class' });
	FNP_form.append({
		type: 'checkbox',
		list: [
			{ label: 'Stub', value: 'classStub' },
			{ label: 'Start', value: 'classStart' },
			{ label: 'C-class', value: 'classC' },
			{ label: 'B-class', value: 'classB' },
			{ label: 'Good', value: 'classGood' },
			{ label: 'Featured', value: 'classFeatured' },
			]
	});
	FNP_form.append({ type: 'header', label: 'Potential issues' });
	FNP_form.append({
		type: 'checkbox',
		list: [
			{ label: 'Vandalism', value: 'issueV' },
			{ label: 'Spam', value: 'issueS' },
			{ label: 'Attack', value: 'issueA' },
			{ label: 'Copyvio', value: 'issueC' },
			{ label: 'None', value: 'issueN' },
			]
	});
	FNP_form.append({ type: 'submit', });
	var FNP_form_shown = FNP_form.render();
	
	FNP_window.setContent( FNP_form_shown );
	
	FNP_window.display();
}
function FNP_run( form ){
	console.log( 'Options:' );
	//console.log( form );
	var options = (form.target.form ? form.target.form : form.target).getChecked();
	console.log( options );
	form.purgeContent();
}