NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Build Millions of Storage Space
// @namespace sk.seko
// @description Allows you to build storage by 50% and 100%
// @include http://*.war-facts.com/buy_storage.php?colony=*
// @version 1.1
// @grant none
// ==/UserScript==
// Version 1.0 = Original version by apache
// Version 1.1 = fixes and rounding (by Seko)
var form = document.getElementsByTagName('form')[0];
window.add100p = function(amount, by) {
var now = parseFloat(amount);
var goal = String(by*now);
var adjusted = goal.substr(0,2) + new Array(goal.length-1).join("0");
return parseFloat(adjusted) - now;
}
// + 50 %
var button1 = document.createElement('input');
button1.setAttribute('onClick','{addstorage.value = add100p(form.getElementsByTagName("td")[1].textContent,1.5);form.submit();}');
button1.setAttribute('class', 'info');
button1.setAttribute('value', '+50%');
button1.setAttribute('type', 'button');
form.insertBefore(button1, null);
// + 100 %
var button2 = document.createElement('input');
button2.setAttribute('onClick','{addstorage.value = add100p(form.getElementsByTagName("td")[1].textContent,2.0);form.submit();}');
button2.setAttribute('class', 'info');
button2.setAttribute('value', '+100%');
button2.setAttribute('type', 'button');
form.insertBefore(button2, null);