jdswatsup / All Neopets Stocks Seller

// ==UserScript==
// @name           	All Neopets Stocks Seller
// @homepage      	http://www.shopneopia.com
// @version         1.3.5
// @description    	Autofill's first 750,000 shares of stocks on Neopets.com automatically, user just needs to click the 'sell shares' button at top right of page. Set amount of shares per Stock to sell on-page. Shop Neopia exclusive! 
//                  Update 1.3 Added user interface on stock portfolio for stock settings. Enter desired amount of shares there.
//                  Update 1.3.5 Fix provided by Zachafer. Set's limit of stocks to fill. Keeps from Neopets server overload and grey blank page.
// @author          |2eap
// @include        	http://www.neopets.com/stockmarket.phtml?type=*
// ==/UserScript==

var input=document.createElement("input");
input.type="button";
input.value="Stock Settings";
input.onclick = show_prompt;
input.setAttribute("style", "font-size:25px;position:fixed;top:5px;right:5px;");
document.body.appendChild(input); 
 

function show_prompt() { 
var userinputval = prompt("Please enter the amount to sell from each stock.","1000");
    alert("Success! All of your stocks now have: "+userinputval +" set as their value!");

if (document.location == "http://www.neopets.com/stockmarket.phtml?type=portfolio") {

	var inputs = document.getElementsByTagName('input');
// limitation fix provided by Zachafer
	for (i = 0; i < 750 && i < inputs.length; i++) {
// end of adopted code		
			var input = inputs[i];
	
       		if (input.type == "text" && input.value == "") {
	
           		input.value = userinputval;

       		}

		}
}
}