Last active
December 27, 2015 05:29
-
-
Save jeremychase/7274545 to your computer and use it in GitHub Desktop.
clicking bad shady accountant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:$('.ratio-info').remove(); | |
$('#clickers .s_div, #sellers .s_div').each( | |
function(index, div) { | |
var divname = $(div).attr('id'); | |
var rawCost = $('#' + divname + '_cst').text(); | |
var rawRps = $('#' + divname + '_rps').text(); | |
var costMulti = 1; | |
var rpsMulti = 1; | |
if (rawCost.charAt(rawCost.length -1) === 'M') { | |
costMulti = 1000000; | |
} | |
else if (rawCost.charAt(rawCost.length -1) === 'B') { | |
costMulti = 1000000000; | |
} | |
else if (rawCost.charAt(rawCost.length -1) === 'T') { | |
costMulti = 1000000000000; | |
} | |
else if (rawCost.charAt(rawCost.length -1) === 'Q') { | |
costMulti = 1000000000000000; | |
} | |
if (rawRps.charAt(rawRps.length -1) === 'M') { | |
rpsMulti = 1000000; | |
} | |
else if (rawRps.charAt(rawRps.length -1) === 'B') { | |
rpsMulti = 1000000000; | |
} | |
else if (rawRps.charAt(rawRps.length -1) === 'T') { | |
rpsMulti = 1000000000000; | |
} | |
else if (rawRps.charAt(rawRps.length -1) === 'Q') { | |
rpsMulti = 1000000000000000; | |
} | |
var cost = parseFloat(rawCost.replace(/[^0-9.]/g, '')) * costMulti; | |
var rps = parseFloat(rawRps.replace(/[^0-9.]/g, '')) * rpsMulti; | |
$('#' + divname + '_amt').before('<span class="ratio-info" style="color:#C00; float:right; margin-left:10px;"> $' + (cost/rps).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' per unit</span>'); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment