// -------------------------------------------------------------------- function add_vo( vo_type, player_no ) { // load the available vehicles/ordnance var nat = $( "select[name='PLAYER_" + player_no + "']" ).val() ; var entries = gVehicleOrdnanceListings[ vo_type ][ nat ] ; if ( entries === undefined ) { showWarningMsg( "There are no " + get_nationality_display_name(nat) + " " + vo_type + " listings." ) ; return ; } var buf = [] ; for ( var i=0 ; i < entries.length ; ++i ) buf.push( "" ) ; function format_vo_entry( opt ) { if ( ! opt.id ) return opt.text ; var vo_entry = entries[opt.id] ; var div_class = "vo-entry" ; if ( is_small_vasl_piece( vo_entry ) ) div_class += " small-piece" ; var extn_name ; if ( vo_entry.id.substr(0,4) === "kfw-" ) extn_name = "KFW" ; else if ( vo_entry.extn_id ) { extn_name = gAppConfig.VASL_EXTENSIONS[ vo_entry.extn_id ].displayNameAbbrev ; if ( ! extn_name ) extn_name = gAppConfig.VASL_EXTENSIONS[ vo_entry.extn_id ].displayName ; if ( ! extn_name ) extn_name = vo_entry.extn_id ; } var buf2 = [ "
This " + vo_type2 + " is already in the OB.
Do you want to add it again?", { width: 300, ok: add_sel_entry, } ) ; return ; } // add the new vehicle/ordnance add_sel_entry() ; }, Cancel: function() { $(this).dialog( "close" ) ; }, }, } ) ; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function do_add_vo( vo_type, player_no, vo_entry, vo_image_id, elite, custom_capabilities, custom_comments, seq_id ) { // initialize var nat = get_player_nat( player_no ) ; var nat_type = gTemplatePack.nationalities[ nat ].type ; var vo_note_key = get_vo_note_key( vo_entry ) ; var is_landing_craft = vo_note_key ? vo_note_key.substring( 0, 3 ) === "LC " : null ; var $sortable2 = $( "#ob_" + vo_type + "-sortable_" + player_no ) ; if ( seq_id === null ) { // auto-assign a sequence ID var usedSeqIds = {} ; $sortable2.children( "li" ).each( function() { usedSeqIds[ $(this).data( "sortable2-data" ).id ] = true ; } ) ; seq_id = auto_assign_id( usedSeqIds, "seq_id" ) ; } // check if an asl-rulebook2 Chapter H note is available var aslrb2_url = null ; var aslrb2_nat = nat ; if ( [ "allied-minor", "axis-minor" ].indexOf( nat_type ) != -1 ) aslrb2_nat = nat_type ; else { var pos = aslrb2_nat.indexOf( "~" ) ; if ( pos > 0 ) { // NOTE: This is a derived nationality - use the base nationality. aslrb2_nat = aslrb2_nat.substring( 0, pos ) ; } else { // check for K:FW vehicles/ordnance pos = vo_entry.id.indexOf( "/" ) ; if ( pos > 0 ) { var nat2 = vo_entry.id.substring( 0, pos ) ; if ( nat2 == "kfw-uro" || nat2 == "kfw-bcfk" || nat2 == "kfw-un-common") aslrb2_nat = "un-forces" ; else if ( nat2 == "kfw-kpa" || nat2 == "kfw-cpva" ) aslrb2_nat = "communist-forces" ; } } } var entries = is_landing_craft ? gAslRulebook2VoNoteTargets["landing-craft"] : gAslRulebook2VoNoteTargets[aslrb2_nat] && gAslRulebook2VoNoteTargets[aslrb2_nat][vo_type] ; if ( entries ) { var key = vo_note_key ; if ( is_landing_craft ) key = vo_note_key.substring( 3 ) ; else { var match = key.match( /^kfw-(un|un-common|comm):/ ) ; if ( match ) key = key.substring( match[0].length ) ; } var aslrb2_entry = entries[ key ] ; if ( aslrb2_entry ) aslrb2_url = gShowAslRulebook2VoNoteUrl.replace( "TARGET", aslrb2_entry.target ) ; } // add the specified vehicle/ordnance // NOTE: We set a fixed height for the sortable2 entries (based on the CSS settings in tabs-ob.css), // so that the vehicle/ordnance images won't get truncated if there are a lot of them. var div_tag = "