User:Red-tailed hawk/SATG CORP.js

//Written by Abelmoschus Esculentus and DannyS712, modified by Red-tailed hawk //Date: 25 September 2022 //Modified from User:DannyS712/SATG.js //Available under CC-BY-SA 3.0 Unported license and the GFDL // function screen3(number) { var source = ["placeholder"], ind = ["placeholder"], ind_just = ["placeholder"], rel = ["placeholder"], rel_just = ["placeholder"], sig = ["placeholder"], sig_just = ["placeholder"], sec = ["placeholder"], sec_just = ["placeholder"]; $('.SATG_CORP-source').each(function {		source.push(this.value);  }); $('.SATG_CORP-selecti').each(function {		ind.push(this.value);  }); $('.SATG_CORP-justi').each(function {		ind_just.push(this.value);  }); $('.SATG_CORP-selectr').each(function {		rel.push(this.value);  }); $('.SATG_CORP-justr').each(function {		rel_just.push(this.value);  }); $('.SATG_CORP-selects').each(function {		sig.push(this.value);  }); $('.SATG_CORP-justs').each(function {		sig_just.push(this.value);  }); $('.SATG_CORP-select2').each(function {		sec.push(this.value);  }); $('.SATG_CORP-just2').each(function {		sec_just.push(this.value);  }); var outstring = ""; $("#SATG_CORP-interface-content").css({     "min-height": "7em",      "width" : "875px",      "height" : "400px",      "overflow-y": "hidden"    }); $("#SATG_CORP-interface-content").empty; $("#SATG_CORP-interface-content").text('Generating...'); $('.SATG_CORP-tip').remove; $("#SATG_CORP-interface-content").empty; $("#SATG_CORP-interface-content").append(		$(' ').attr('id','SATG_CORP-copy').text('Copy'),		$(' ').attr('id','SATG_CORP-copied').text(''),		$(' ').css({'resize':'none'}).attr({'id':'SATG_CORP-outstring','readonly':'true','rows':'20','cols':'35'}).text(outstring)	); $('#SATG_CORP-copy').click(function {		var copy = document.getElementById("SATG_CORP-outstring");		copy.select;		document.execCommand("copy");		$('#SATG_CORP-copied').text(' Copied to your clipboard!');	}); } function screen4(number) { if ($("#SATG_CORP-interface-content").text == "Loading form...") { $("#SATG_CORP-interface-content").empty; }   $("#SATG_CORP-interface-footer").append(    	$(' ').attr('id', 'SATG_CORP-back').css('margin-left','1em').text('Back')	); $("#SATG_CORP-interface-footer").prepend(		$(' ').attr('class','SATG_CORP-tip').text('**Only available for options "Yes", "No", "Partially" and "Unknown"'),		$(' ').attr('class','SATG_CORP-tip')	); $('#SATG_CORP-back').click(function {        $('#SATG_CORP-back').remove;        $("#SATG_CORP-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "400px", "overflow-y": "scroll" });       screen0;    }); /*var arr = [ {val : 1, text: 'Yes'}, {val : 2, text: 'No'}, {val : 3, text: 'Partially'}, {val : 4, text: 'Unknown'}, {val : 5, text: 'None'} ];*/   for (var i = 1; i <= number; i++) { if (i != 1) { $("#SATG_CORP-interface-content").append(' '); }   	$("#SATG_CORP-interface-content").append(    		$(' ').css('margin-bottom','0.5em').append( $(' ').text('Source '+i+': '), $(' ').attr({'type':'text','class':'SATG_CORP-source'}) ),         $(' ').css('margin-bottom','0.5em').append( $(' ').text('Independent? '), $(' ').attr('class','SATG_CORP-selecti') .append($(" ").attr('value','y').text('Yes')) .append($(" ").attr('value','n').text('No')) .append($(" ").attr('value','-').text('Partially')) .append($(" ").attr('value','?').text('Unknown')) .append($(" ").attr({'value':'','selected':'true'}).text('None')), $(' ').text(' **Justification: '), $(' ').attr({'type':'text','class':'SATG_CORP-justi'}) ),         $(' ').css('margin-bottom','0.5em').append( $(' ').text('Reliable? '), $(' ').attr('class','SATG_CORP-selectr') .append($(" ").attr('value','y').text('Yes')) .append($(" ").attr('value','n').text('No')) .append($(" ").attr('value','-').text('Partially')) .append($(" ").attr('value','?').text('Unknown')) .append($(" ").attr({'value':'','selected':'true'}).text('None')), $(' ').text(' **Justification: '), $(' ').attr({'type':'text','class':'SATG_CORP-justr'}) ),        $(' ').css('margin-bottom','0.5em').append( $(' ').attr('id','SATG_CORP-labels-'+i).text('Significant coverage? '), $(' ').attr('class','SATG_CORP-selects') .append($(" ").attr('value','y').text('Yes')) .append($(" ").attr('value','n').text('No')) .append($(" ").attr('value','-').text('Partially')) .append($(" ").attr('value','?').text('Unknown')) .append($(" ").attr({'value':'','selected':'true'}).text('None')), $(' ').text(' **Justification: '), $(' ').attr({'type':'text','class':'SATG_CORP-justs'}) ),       $(' ').css('margin-bottom','0.5em').append( $(' ').attr('id','SATG_CORP-labels-'+i).text('Secondary coverage? '), $(' ').attr('class','SATG_CORP-select2') .append($(" ").attr('value','y').text('Yes')) .append($(" ").attr('value','n').text('No')) .append($(" ").attr('value','-').text('Partially')) .append($(" ").attr('value','?').text('Unknown')) .append($(" ").attr({'value':'','selected':'true'}).text('None')), $(' ').text(' **Justification: '), $(' ').attr({'type':'text','class':'SATG_CORP-just2'}) )   	);    }    $("#SATG_CORP-interface-content").append(    	$(' ').attr('id','SATG_CORP-generate').text('Generate!')    ); $('#SATG_CORP-generate').click(function {   	screen3(number);    }); } function SATG_CORP_init { mw.util.addPortletLink('p-tb', 'javascript:void(0)', 'NCORP Table Generator', 'aca-SATG_CORP', null, null); $('#aca-SATG_CORP').on('click', function {   $('body').prepend(''+ ''+ ' '+ ' '+       ' '+ ' '+       ' '+ ' '+   ' ');    $("#SATG_CORP-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)" });   $("#SATG_CORP-interface").css({ "background-color": "#e8f0ff", "margin": "15% auto", "padding": "2px 20px", "border": "1px solid #888", "width": "80%", "max-width": "60em", "font-size": "90%" });   $("#SATG_CORP-interface-content").css({ "min-height": "7em", "width" : "875px", "height" : "400px", "overflow-y": "scroll" });   $("#SATG_CORP-interface-footor").css("min-height", "3em");    screen0;  }); } var screen0 = function { $("#SATG_CORP-interface-header, #SATG_CORP-interface-content, #SATG_CORP-interface-footer").empty; $("#SATG_CORP-interface-header").text("Source Assess Table Generator for Corporations"); $("#SATG_CORP-interface-content").append(   $(' ').css('margin-bottom','0.5em').append( $(' ').attr({'for':'SATG_CORP-userinput-label', 'id':'SATG_CORP-userinput-label'}).text('How many sources do you want to assess? '), $(' ').attr({'type':'number', 'name':'SATG_CORP-userinput','id':'SATG_CORP-userinput','min':'1','max':'100','value':'1'}) //set limits ),   $(' ').css('margin-bottom','0.5em').append( $(' ').attr({'name':'SATG_CORP-userinput-button', 'id':'SATG_CORP-userinput-button'}).text('Load') ) );  $("#SATG_CORP-interface-footer").append(    $(' ').attr('id', 'SATG_CORP-cancel').text('Close')  ); $('#SATG_CORP-cancel').click(function {   $('#SATG_CORP-modal').remove;  }); $('#SATG_CORP-userinput-button').click(function { 	var temp = $('#SATG_CORP-userinput').val;  	if (temp > 100 || temp < 1) {  		alert('Invalid value');  	}  	else {  		$('#SATG_CORP-interface-content').empty;  		$('#SATG_CORP-interface-content').text('Loading form...');  		screen4(temp);  	}  }); }; mw.loader.using(['mediawiki.util'], function { SATG_CORP_init; }); //