User:DannyS712 test/itn.js

// function screen2(number) { var article = ["placeholder"], image = ["placeholder"], blurb = ["placeholder"], rd = ["placeholder"], ong = ["placeholder"], src = ["placeholder"], up = ["placeholder"], creator = ["placeholder"], updater = ["placeholder"], ITNR = ["placeholder"]; $('.ITN-article').each(function {article.push(this.value);}); $('.ITN-image').each(function {image.push(this.value);}); $('.ITN-label-rd').each(function {rd.push(this.value);}); $('.ITN-label-ong').each(function {ong.push(this.value);}); $('.ITN-src').each(function {src.push(this.value);}); $('.ITN-label-up').each(function {up.push(this.value);}); $('.ITN-creator').each(function {creator.push(this.value);}); $('.ITN-updater').each(function {updater.push(this.value);}); $('.ITN-label-ITNR').each(function {ITNR.push(this.value);});

var output = ""; for (var i = 1; i <= number; i++) { output = "==== " + article[i] + " ====\n"; output += "\n"; }	$("#ITN-interface-content").css({     "min-height": "7em",      "width" : "875px",      "height" : "400px",      "overflow-y": "hidden"    }); $("#ITN-interface-content").empty; $("#ITN-interface-content").text('Generating...'); $('.ITN-tip').remove; $("#ITN-interface-content").empty; $("#ITN-interface-content").append(		$(' ').attr('id','ITN-copy').text('Copy'),		$(' ').attr('id','ITN-copied').text(''),		$(' ').css({'resize':'none'}).attr({'id':'ITN-output','readonly':'true','rows':'20','cols':'35'}).text(output)	); $("#ITN-interface-footer").append(		$(' ').attr('id', 'ITN-back').css('margin-left','1em').text('Back')	); $('#ITN-copy').click(function {		var copy = document.getElementById("ITN-output");		copy.select;		document.execCommand("copy");		$('#ITN-copied').text(' Copied to your clipboard!');	}); $('#ITN-back').click(function {        $('#ITN-back').remove;        $("#ITN-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "400px", "overflow-y": "scroll" });       screen1;    }); } function screen1 { var number = 1; $("#ITN-interface-header, #ITN-interface-content, #ITN-interface-footer").empty; $("#ITN-interface-header").text("Source Assess Table Generator"); $("#ITN-interface-footer").append($(' ').attr('id', 'ITN-cancel').text('Close')); $('#ITN-cancel').click(function {$('#ITN-modal').remove;}); $("#ITN-interface-footer").prepend(		$(' ').attr('class','ITN-tip').text('**Leave blank if you aren\'t sure"'),		$(' ').attr('class','ITN-tip')	);	$("#ITN-interface-content").append(		$(' ').css('margin-bottom','0.5em').append(			$(' ').text('Article: '),			$(' ').attr({'type':'text','class':'ITN-article'})   	),		$(' ').css('margin-bottom','0.5em').append(			$(' ').text('Image: '),			$(' ').attr({'type':'text','class':'ITN-image'})    	),		$(' ').css('margin-bottom','0.5em').append(			$(' ').text('Blurb: '),			$(' ').attr({'type':'text','class':'ITN-blurb'})    	),    	$(' ').css('margin-bottom','0.5em').append(	        $(' ').text( 'Recent deaths?'),	        $(' ').attr('class','ITN-label-rd')	         .append($(" ").attr('value','yes').text('Yes'))	         .append($(" ").attr({'value':'no','selected':'true'}).text('No'))    	),    	$(' ').css('margin-bottom','0.5em').append(    		$(' ').attr('id','ITN-label-ong').text( 'Ongoing?'), $(' ').attr('class','ITN-label-ong') .append($(" ").attr('value','yes').text('Yes')) .append($(" ").attr('value','rem').text('Remove')) .append($(" ").attr({'value':'no','selected':'true'}).text('No')) ),		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Sources: '), $(' ').attr({'type':'text','class':'ITN-src'}) ),   	$(' ').css('margin-bottom','0.5em').append( $(' ').text( 'Updated?'), $(' ').attr('class','ITN-label-up') .append($(" ").attr('value','yes').text('Yes')) .append($(" ").attr({'value':'no','selected':'true'}).text('No')) ),		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Creator: '), $(' ').attr({'type':'text','class':'ITN-creator'}) ),		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Updater: '), $(' ').attr({'type':'text','class':'ITN-updater'}) ),   	$(' ').css('margin-bottom','0.5em').append( $(' ').text( 'ITNR?'), $(' ').attr('class','ITN-label-ITNR') .append($(" ").attr('value','yes').text('Yes')) .append($(" ").attr({'value':'no','selected':'true'}).text('No')) )   );    $("#ITN-interface-content").append($(' ').attr('id','ITN-generate').text('Generate!')); $('#ITN-generate').click(function {screen2(number);}); } function ITN_init { mw.util.addPortletLink('p-cactions', 'javascript:void(0)', 'ITN Generator', 'aca-ITN', 'Easily create an ITN nomination', null); $('#aca-ITN').on('click', function {   $('body').prepend(' '+ ' '+       ' '+ ' '+       ' '+        ' '+        ' '+      ' '+    ' ');    $("#ITN-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)" });   $("#ITN-interface").css({ "background-color": "#e8f0ff", "margin": "15% auto", "padding": "2px 20px", "border": "1px solid #888", "width": "80%", "max-width": "60em", "font-size": "90%" });   $("#ITN-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "400px", "overflow-y": "scroll" });   $("#ITN-interface-footor").css("min-height", "3em");    screen1;  }); } mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.Title', 'mediawiki.RegExp'], function { ITN_init; }); //