User:DannyS712 test/refund.js

// $(function { var rf_config = {	name: 'Refund requester',	version: 1.1,	debug: false }; var rf_summary = 'Request a refund with ' + rf_config.name + ' (version ' + rf_config.version + ')';

mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title', 'mediawiki.RegExp'], function {	//if ( mw.config.get( 'wgPageName' ) == "Wikipedia:Requests_for_undeletion") {		importScript( 'User:DannyS712 test/page.js' );   	UND_init; //	} } ); function request_refund( request ){ var requesting_page = mw.config.get( 'wgPageName' ); var old = get_page( requesting_page ); var new_page = old + request; set_page( requesting_page, new_page, rf_summary, false ); } function make_request { var page = ["placeholder"], type = ["placeholder"], reason = ["placeholder"]; $('.UND-page').each(function {page.push(this.value);}); $('.UND-type').each(function {type.push(this.value);}); $('.UND-reason').each(function {reason.push(this.value);}); page = page[1]; type = type[1]; reason = reason[1]; if (rf_config.debug) console.log ( page, type, reason ); var output = "\n\n"; if (type == "G13") output = output + ""; else output = output + "" + page + ""; $("#UND-interface-content").css({     "min-height": "7em",      "width" : "875px",      "height" : "200px",    }); $("#UND-interface-content").empty; $('.UND-tip').remove; $("#UND-interface-content").append(		$(' ').attr('id','UND-submit').text('Submit request'),		$(' ').attr('id','UND-submit').text(''),		$(' ').css({'resize':'none'}).attr({'id':'UND-output','readonly':'true','rows':'5','cols':'25'}).text(output)	); $("#UND-interface-footer").append( $(' ').attr('id', 'UND-back').css('margin-left','1em').text('Back') ); $('#UND-submit').click(function {		var request = output;       $('#UND-back').remove;        $('#UND-interface-content').empty;        $('#UND-interface-content').append( $(' ').attr('id','UND-submitting').text('\nSubmitting...') );		if (rf_config.debug) console.log ( request );		request_refund ( request );	}); $('#UND-back').click(function {        $('#UND-back').remove;        $("#UND-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "200px", });       screen1;    }); } function screen1 { $("#UND-interface-header, #UND-interface-content, #UND-interface-footer").empty; $("#UND-interface-header").text("Request undeletion*"); $("#UND-interface-footer").append($(' ').attr('id', 'UND-cancel').text('Close')); $('#UND-cancel').click(function {$('#UND-modal').remove;}); $("#UND-interface-footer").prepend(		$(' ').attr('class','UND-tip').text('*For more information, see ').append($('').attr('href','//en.wikipedia.org/wiki/WP:CSDRFU').text('undeleting speedily-deleted pages')),		$(' ').attr('class','UND-tip'),		$(' ').attr('class','UND-tip').text('**Leave blank if you are requesting a G13 undeletion'),		$(' ').attr('class','UND-tip')	); $("#UND-interface-content").append(		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Page: '), $(' ').attr({'type':'text','class':'UND-page'}) ),   	$(' ').css('margin-bottom','0.5em').append( $(' ').text( 'Refund type: '), $(' ').attr('class','UND-type') .append($(" ").attr({'value':'G13','selected':'true'}).text('G13')) .append($(" ").attr('value','Other').text('Other')) ),		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Reason**: '), $(' ').attr({'type':'text','class':'UND-reason'}) )   );    $("#UND-interface-content").append($(' ').attr('id','UND-request').text('Preview request')); $('#UND-request').click(function {make_request}); } function UND_init { mw.util.addPortletLink('p-cactions', 'javascript:void(0)', 'Undelete', 'aca-UND', 'Easily request undeletion', null); $('#aca-UND').on('click', function {   $('body').prepend(' '+ ' '+       ' '+ ' '+       ' '+        ' '+        ' '+      ' '+    ' ');    $("#UND-modal").css({ "position": "fixed", "z-index": "1", "left": "0", "top": "0", "width": "100%", "height": "100%", "overflow": "hidden", "background-color": "rgba(0,0,0,0.4)" });   $("#UND-interface").css({ "background-color": "#e8f0ff", "margin": "15% auto", "padding": "2px 20px", "border": "1px solid #888", "width": "80%", "max-width": "60em", });   $("#UND-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "200px", });   $("#UND-interface-footor").css("min-height", "3em");    screen1;  }); } }); //