diff --git a/vasl_templates/webapp/data/default-template-pack/common.css b/vasl_templates/webapp/data/default-template-pack/common.css index 95df434..49d7c5b 100644 --- a/vasl_templates/webapp/data/default-template-pack/common.css +++ b/vasl_templates/webapp/data/default-template-pack/common.css @@ -18,3 +18,5 @@ td.l { text-align: left ; } td.r { text-align: right ; } sup { font-size: 75% ; } + +.exc { font-style: italic ; color: #404040 ; } diff --git a/vasl_templates/webapp/data/default-template-pack/nat_caps.j2 b/vasl_templates/webapp/data/default-template-pack/nat_caps.j2 index af5fd7d..7bcdb30 100644 --- a/vasl_templates/webapp/data/default-template-pack/nat_caps.j2 +++ b/vasl_templates/webapp/data/default-template-pack/nat_caps.j2 @@ -7,7 +7,6 @@ td { padding: 2px 5px ; } li.comment { font-size: 96% ; font-style: italic ; color: #404040 ; } span.comment { font-size: 85% ; font-style: italic ; color: #404040 ; } -.exc { color: #404040 ; } diff --git a/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2 b/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2 index 9b28e2e..7d3f76e 100644 --- a/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2 +++ b/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2 @@ -17,6 +17,7 @@ .ma-note table td { padding: 0 10px 0 5px ; } .extra-notes-caption { border: 1px solid #e0e0e0 ; background: #fcfcfc ; font-weight: bold ; padding: 2px 5px ; } .disabled { color: #808080 ; } +.disabled .exc { color: #808080 ; } .slashed { text-decoration: line-through ; } diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 index bb33783..c2e48f3 100644 --- a/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 +++ b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 @@ -9,7 +9,6 @@ .capability .brewup { color: #a04010 ; } .comment { font-size: 96% ; font-style: italic ; color: #404040 ; white-space: nowrap ; } .comment .split-mg-red { color: #a04010 ; } -.comment .exc { color: #606060 ; } diff --git a/vasl_templates/webapp/static/nat_caps.js b/vasl_templates/webapp/static/nat_caps.js index 9462232..94fc885 100644 --- a/vasl_templates/webapp/static/nat_caps.js +++ b/vasl_templates/webapp/static/nat_caps.js @@ -10,7 +10,6 @@ function set_nat_caps_params( player_nat, params ) // initialize params.NAT_CAPS = {} ; - var excRegex = new RegExp( /\[EXC: .*?\]/g ) ; var val ; function add_nat_cap( key, val ) { @@ -20,7 +19,7 @@ function set_nat_caps_params( player_nat, params ) function fixup_content( val ) { val = strReplaceAll( val, "1st", "1st" ) ; val = strReplaceAll( val, "2nd", "2nd" ) ; - return wrapSubstrings( val, excRegex, "", "" ) ; + return wrapExcWithSpan( val ) ; } // set the TH# color diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js index f10e65b..56d2201 100644 --- a/vasl_templates/webapp/static/snippets.js +++ b/vasl_templates/webapp/static/snippets.js @@ -405,6 +405,25 @@ function make_snippet( $btn, params, extra_params, show_date_warnings ) if ( extra_params ) $.extend( true, params, extra_params ) ; + // allow EXC blocks to be styled + params.VICTORY_CONDITIONS = wrapExcWithSpan( params.VICTORY_CONDITIONS ) ; + params.SCENARIO_NOTE = wrapExcWithSpan( params.SCENARIO_NOTE ) ; + if ( params.SSR ) { + for ( i=0 ; i < params.SSR.length ; ++i ) + params.SSR[i] = wrapExcWithSpan( params.SSR[i] ) ; + } + params.OB_NOTE = wrapExcWithSpan( params.OB_NOTE ) ; + params.VO_NOTE_HTML = wrapExcWithSpan( params.VO_NOTE_HTML ) ; + [ "VEHICLES", "ORDNANCE" ].forEach( function( voType ) { + for ( var playerId=1 ; playerId <= 2 ; ++playerId ) { + var notes = params[ "OB_" + voType + "_MA_NOTES_" + playerId ] ; + if ( ! notes ) + continue ; + for ( var i=0 ; i < notes.length ; ++i ) + notes[i][1] = wrapExcWithSpan( notes[i][1] ) ; + } + } ) ; + // check that the players have different nationalities if ( params.PLAYER_1 === params.PLAYER_2 ) showWarningMsg( "Both players have the same nationality!" ) ; @@ -492,19 +511,13 @@ function adjust_vo_comments( params ) return val.substring(0,match.index) + buf.join("") + val.substring(match.index+match[0].length ) ; } - // allow comment EXC's to be styled - var excRegex = new RegExp( /\[EXC: .*?\]/g ) ; - function adjustExc( val ) { - return wrapSubstrings( val, excRegex, "", "" ) ; - } - // adjust comments if ( params.OB_VO ) { for ( i=0 ; i < params.OB_VO.length ; ++i ) { if ( ! params.OB_VO[i].comments ) continue ; for ( var j=0 ; j < params.OB_VO[i].comments.length ; ++j ) { - params.OB_VO[i].comments[j] = adjustSplitMG( adjustExc( + params.OB_VO[i].comments[j] = adjustSplitMG( wrapExcWithSpan( params.OB_VO[i].comments[j] ) ) ; } diff --git a/vasl_templates/webapp/static/utils.js b/vasl_templates/webapp/static/utils.js index 94428ba..0d2052d 100644 --- a/vasl_templates/webapp/static/utils.js +++ b/vasl_templates/webapp/static/utils.js @@ -466,6 +466,13 @@ function fixup_external_links( $root ) } ) ; } +function wrapExcWithSpan( val ) +{ + // wrap an EXC block with a + var excRegex = new RegExp( /\[EXC: .*?\]/g ) ; + return wrapSubstrings( val, excRegex, "", "" ) ; +} + function getUrlParam( param ) { // look for the specified URL parameter