app/assets/javascripts/ish_manager/iro.js in ish_manager-0.1.8.415 vs app/assets/javascripts/ish_manager/iro.js in ish_manager-0.1.8.416
- old
+ new
@@ -5,47 +5,64 @@
scale = 200 // pixels per dollar
$(".gameuiW").each( function (idx, w) {
+ // logg($(w).data(), 'data')
+ let ans
+
let ccStrike = $(w).data('ccStrike')
let ccStartPrice = $(w).data('ccStartprice') // e.g. 0.88
let ccCurrentPrice = $(w).data('ccCurrentprice')
- let cUS = $(w).data('cus')
+ let cUS = $(w).data('ccCus')
$(".c-u-s").each(function (idx, elem) {
$(elem).html(cUS)
})
$(".windW").each(function (idx, elem) {
- $(elem).css('left', (origin - cUS)*scale)
+ ans = ( origin - cUS ) * scale
+ $(elem).css('left', ans)
})
$($(w).find('.elephantW')).css('left', (origin - ccStrike)* scale )
$(w).find('.elephantC > .amount').html( " $" + ccStrike )
$(w).find('.riderStart > .amount').html( " $" + ccStartPrice )
$(w).find('.riderStart').css('width', scale * ccStartPrice )
$(w).find('.riderStart').css('left', -1 * scale * ccStartPrice )
$(w).find('.riderStart2').css('width', scale * ccStartPrice )
- let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(1)/100
+ let currentAmount = ((ccStartPrice - ccCurrentPrice)*100).toPrecision(2)/100
let ccCurrentGain = ccStartPrice - ccCurrentPrice
- // logg(ccCurrentGain, 'ccCurrentGain')
- // logg(currentAmount, 'currentAmount')
$(w).find('.riderCurrent > .amount').html( " $" + currentAmount )
- let ans = `${-1*ccCurrentGain*scale}px`
- logg(ans, 'ans')
+ ans = `${-1*ccCurrentGain*scale}px`
$(w).find('.riderW').css('left', ans)
if (ccCurrentGain > 0) {
$(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
} else {
- ccCurrentGain = -1 * ccCurrentGain
- $(w).find('.riderCurrent').css('width', scale * ccCurrentGain )
- $(w).find('.riderCurrent').css('background', 'red')
- $(w).find('.riderCurrent').css('right', `-${ccCurrentGain*scale}px`)
+ $(w).find('.riderCurrent').css('display', 'none')
+ $(w).find('.riderCurrent2').css('display', 'block')
+ $(w).find('.riderCurrent2').css('width', -1 * scale * ccCurrentGain )
$(w).find('.rider').addClass('riderF')
+ }
+ })
+
+
+
+ $(".gameuiW.next-position").each( function (idx, w) {
+ logg($(w).data(), 'next-position')
+
+ let ans
+
+ let gainp = $(w).data('ccGainp')
+ if (gainp > 0) {
+ $(w).find('.elephant').css('border-width', `${gainp*200 + 1}px` )
+ $(w).find('.elephantLoss').css('display', 'none')
+ } else {
+ gainp = -1 * gainp
+ $(w).find('.elephantLoss').css('border-width', `${gainp*200 + 1}px` )
}
})
})