Skip to content

Instantly share code, notes, and snippets.

@jason-s13r
Last active January 1, 2016 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jason-s13r/8105640 to your computer and use it in GitHub Desktop.
Save jason-s13r/8105640 to your computer and use it in GitHub Desktop.
javascript:window.setInterval(function(){$("#clickers, #sellers, #upgrades, #banks").find('[id$="_cst"]').each(function(){var b=$(this),a=b.text().replace(/[\$,]/g,""),c=a.replace(/[0-9\.]/g,""),a=1*a.replace(/[A-Z]/,""),c={Q:1E15,T:1E12,B:1E9,M:1E6}[c]||1,a=a*c,d=$("#seller_rps"),c=$("#sell_amt"),d=d.text().replace(/,/g,""),c=c.text().replace(/,/g,""),a=(a-c)/d,b="#"+b.attr("id").replace("_cst","_btn"),b=$(b);0<a?(a="Purchase in "+a.toFixed(0)+" seconds",b.html(a)):b.html("Purchase")})},1E3);
window.setInterval(function () {
$('#clickers, #sellers, #upgrades, #banks').find('[id$="_cst"]').each(function () {
var multipliers = {
Qt: 1E18,
Q: 1E15,
T: 1E12,
B: 1E9,
M: 1E6
};
var $this = $(this);
var price = $this.text().replace(/[\$,]/g, "");
var multiplier = price.replace(/[0-9\.]/g, "");
price = price.replace(/[A-Z]/gi, "") * 1;
multiplier = multipliers[multiplier] || 1;
price = price * multiplier;
var $income = $("#seller_rps");
var $cash = $("#sell_amt");
var income = $income.text()
.replace(/,/g, "");
var cash = $cash.text()
.replace(/,/g, "");
var seconds = (price - cash) / income;
var buybtn = "#" + $this.attr("id")
.replace("_cst", "_btn");
var $buybtn = $(buybtn);
if (seconds > 0) {
var text = "Purchase in " + seconds.toFixed(0) + " seconds";
$buybtn.html(text);
} else {
$buybtn.html('Purchase');
}
});
}, 1E3);
window.setInterval(function () {
$('#clickers, #sellers, #upgrades, #banks').find('[id$="_cst"]').each(function () {
var multipliers = {
Qt: 1E18,
Q: 1E15,
T: 1E12,
B: 1E9,
M: 1E6
};
var $this = $(this);
var price = $this.text().replace(/[\$,]/g, "");
var multiplier = price.replace(/[0-9\.]/g, "");
price = price.replace(/[A-Z]/gi, "") * 1;
multiplier = multipliers[multiplier] || 1;
price = price * multiplier;
var $income = $("#seller_rps");
var $cash = $("#sell_amt");
var income = $income.text()
.replace(/,/g, "");
var cash = $cash.text()
.replace(/,/g, "");
var seconds = (price - cash) / income;
var buybtn = "#" + $this.attr("id")
.replace("_cst", "_btn");
var $buybtn = $(buybtn);
if (seconds > 0) {
var text = "Purchase in " + seconds.toFixed(0) + " seconds";
$buybtn.html(text);
} else {
$buybtn.html('Purchase');
}
});
}, 1E3);
name: Clicking bad bookmarklet
description: Clicking bad thing
authors:
- Jason Schwarzenberger
resources:
normalize_css: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment