Create attractive VASL scenarios, with loads of useful information embedded to assist with game play.
https://vasl-templates.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
4.2 KiB
126 lines
4.2 KiB
<!doctype html> <!-- NOTE: For testing porpoises only! -->
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title> {{VO_TYPE0}} listings: {{NATIONALITY}} </title>
|
|
<style>
|
|
table { border-collapse: collapse ; }
|
|
th { text-align: left ; padding: 0.2em 0.5em ; background: #eee ; border: 1px solid #ccc ; }
|
|
td { padding: 0.2em 0.5em ; }
|
|
.val { padding: 0.1em 0.25em ; background: #eee ; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="results" style="display:none;"></div>
|
|
</body>
|
|
|
|
<script src="{{url_for('static',filename='jquery/jquery-3.3.1.min.js')}}"></script>
|
|
<script src="{{url_for('static',filename='snippets.js')}}"></script>
|
|
<script src="{{url_for('static',filename='utils.js')}}"></script>
|
|
|
|
<script>
|
|
$(document).ready( function () {
|
|
// get the vehicle listings
|
|
var url ;
|
|
if ( "{{VO_TYPE}}" == "ordnance" )
|
|
url = "{{url_for( 'get_ordnance_listings', report=1 )}}" ;
|
|
else
|
|
url = "{{url_for( 'get_vehicle_listings', report=1 )}}" ; // nb: includes landing craft
|
|
if ( getUrlParam( "merge_common" ) === "1" )
|
|
url += "&merge_common=1" ;
|
|
$.getJSON( url, function(data) {
|
|
load_vo_listings( data ) ;
|
|
} ).fail( function( xhr, status, errorMsg ) {
|
|
alert( "Can't get the {{VO_TYPE0}} listings:\n\n" + errorMsg ) ;
|
|
} ) ;
|
|
} ) ;
|
|
|
|
function load_vo_listings( objs )
|
|
{
|
|
// initialize
|
|
var theater = "{{THEATER}}".toUpperCase() ;
|
|
var nat = "{{NATIONALITY}}" ;
|
|
var year = {{YEAR}} ;
|
|
var month = {{MONTH}} ;
|
|
var $results = $("#results") ;
|
|
var vo_name = getUrlParam( "name" ) ; // nb: restricts the report to a single vehicle/ordnance
|
|
if ( vo_name )
|
|
vo_name = decodeURIComponent( vo_name ).toLowerCase() ;
|
|
|
|
// check if there are any vehicles/ordnance for the specified nationality
|
|
if ( "{{VO_TYPE}}" === "landing-craft" )
|
|
nat = "landing-craft" ;
|
|
if ( ! (nat in objs ) ) {
|
|
$results.text( "No listings for nationality: " + nat ).show() ;
|
|
return ;
|
|
}
|
|
|
|
// load the vehicles/ordnance
|
|
var buf = [] ;
|
|
buf.push( "<table>" ) ;
|
|
buf.push( "<tr>", "<th>Name" ) ;
|
|
if ( "{{VO_TYPE}}" === "vehicles" ) {
|
|
buf.push( "<th>Radio" ) ;
|
|
buf.push( "<th>IF" ) ;
|
|
buf.push( "<th>Crew survival" ) ;
|
|
}
|
|
if ( "{{VO_TYPE}}" === "landing-craft" ) {
|
|
buf.push( "<th>Damage points" ) ;
|
|
buf.push( "<th>Crew survival" ) ;
|
|
}
|
|
buf.push( "<th colspan='2'>Capabilities", "<th colspan='2'>Notes" ) ;
|
|
for ( var i=0 ; i < objs[nat].length ; ++i ) {
|
|
var obj = objs[nat][i] ;
|
|
if ( vo_name && obj.name.toLowerCase() != vo_name )
|
|
continue ;
|
|
buf.push( "<tr>" ) ;
|
|
buf.push( "<td>", fmtval(obj.name) ) ;
|
|
if ( "{{VO_TYPE}}" === "vehicles" ) {
|
|
buf.push( "<td>", fmtval(obj.no_radio) ) ;
|
|
var has_if = "✓" ;
|
|
if ( typeof(obj.no_if) === "string" ) // nb: only for the French B1-bis :-/
|
|
has_if = "(" + obj.no_if + ")" ;
|
|
else if ( obj.no_if )
|
|
has_if = null ;
|
|
buf.push( "<td>", fmtval(has_if) ) ;
|
|
buf.push( "<td>", fmtval(make_crew_survival(obj)) ) ;
|
|
}
|
|
if ( "{{VO_TYPE}}" === "landing-craft" ) {
|
|
buf.push( "<td>", fmtval(obj.damage_points) ) ;
|
|
buf.push( "<td>", fmtval(make_crew_survival(obj)) ) ;
|
|
}
|
|
var capabilities = make_capabilities( obj, nat, theater, year, month, true, true ) ;
|
|
buf.push( "<td>", listval(capabilities) ) ;
|
|
var capabilities = make_capabilities( obj, nat, theater, year, month, true, false ) ;
|
|
buf.push( "<td>", listval(capabilities) ) ;
|
|
buf.push( "<td>", "<span class='val'>" + fmtval(obj.note_number) + "</span>" ) ;
|
|
buf.push( "<td>", listval(obj.notes) ) ;
|
|
}
|
|
buf.push( "</table>" ) ;
|
|
$results.html( buf.join("") ).show() ;
|
|
}
|
|
|
|
function fmtval( val )
|
|
{
|
|
// return the formatted value
|
|
if ( ! val )
|
|
return "<small><em>n/a</em></small>" ;
|
|
return val ;
|
|
}
|
|
|
|
function listval( vals )
|
|
{
|
|
// return the formatted list of values
|
|
if ( ! vals )
|
|
return "<small><em>n/a</em></small>" ;
|
|
var buf = [] ;
|
|
for ( var i=0 ; i < vals.length ; ++i )
|
|
buf.push( "<span class='val'>" + vals[i] + "</span>" ) ;
|
|
return buf.join( " " ) ;
|
|
}
|
|
|
|
</script>
|
|
|
|
</html>
|
|
|