NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Stock Price
// @namespace torn.com
// @include *www.torn.com/stockexchange.php?step=portfolio*
// @author Ahab [1735214]
// @version 1.5
// @license MIT
// @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// ==/UserScript==
function stock_price(){
$.each($("li[class^='info']"), function(){
var a = this.children[0].children[0].innerText.split(" ")[1].replace(/,/g, '')
var b = this.children[1].children[1].innerText.split("\n")[0].split("$")[1].replace(/,/g, '')
var d = parseFloat(this.children[0].children[1].innerText.split("$")[1].replace(/,/g, '')) * a
var c = ""
if (a*b > d){
c = ('-$'+(Intl.NumberFormat('en-US').format(a*b-d))).fontcolor('#d83500')
}
else{
c = ('+$'+(Intl.NumberFormat('en-US').format(d-a*b))).fontcolor('#678c00')
}
if(this.children[7].children[0]){
this.children[7].children[0].remove()
$('<div style="font-style: initial;">').append(('BB Active | Bought for $'+Intl.NumberFormat('en-US').format(a*b)+' | Profit ').fontcolor('#333'),c).appendTo(this.children[7])
}
else{
$('<div style="font-style: initial">').append(('Bought for $'+Intl.NumberFormat('en-US').format(a*b)+' | Profit ').fontcolor('#333'),c).appendTo(this.children[7])
}
})
}
waitForKeyElements('.item-wrap.last', stock_price);