Last active
July 26, 2023 05:33
-
-
Save jkingaround/2d458ee67c72a0ab37b1 to your computer and use it in GitHub Desktop.
Neopets : Quick NP Links
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
// ==UserScript== | |
// @name Neopets : Quick NP Links | |
// @namespace https://www.reddit.com/user/jkingaround | |
// @include *neopets.com/bank.phtml | |
// @include *neopets.com/useobject.phtml | |
// @include *neopets.com/island/tradingpost.phtml | |
// @grant none | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js | |
// ==/UserScript== | |
var page = document.URL, | |
options = "<option value='100000'>100K</option><option value='250000'>250K</option><option value='500000'>500K</option><option value='750000'>750K</option><option value='1000000'>1M</option><option value='2000000'>2M</option><option value='3000000'>3M</option><option value='4000000'>4M</option><option value='5000000'>5M</option><option value='6000000'>6M</option><option value='7000000'>7M</option><option value='8000000'>8M</option><option value='9000000'>9M</option><option value='10000000'>10M</option>"; | |
if(page.indexOf("tradingpost.phtml") != -1){ | |
if($("input[value='Make an offer!']").length > 0){ | |
$("input[name='neopoints']").after(" <select id='tradeDropdown' style='height:24px'>" + options + "</select>"); | |
$('#tradeDropdown').change(function() { | |
$(this).prev().val($(this).val()); | |
}); | |
} | |
} | |
if(page.indexOf("bank.phtml") != -1){ | |
var currentAmount = $("td:contains('Current Balance')").next().html(); | |
currentAmount = currentAmount.replace(' NP',''); | |
currentAmount = currentAmount.replace(/,/g , ""); | |
var onHand = $('#npanchor').text().replace(/,/g , ""); | |
var bankTotal = $('td:contains("Current Balance")').next().text().replace(/,/g , ""); | |
//alert(currentAmount); | |
$("input[value='Deposit']").before("<select id='withdrawDropdown' style='height:24px'><option value='" + onHand + "'>All</option>" + options + "</select> "); | |
$("input[value='Withdraw']").before("<select id='depositDropdown' style='height:24px'>" + options + "<option value='" + bankTotal + "'>All</option></select> "); | |
$("#depositDropdown").prev().prev().val($("#depositDropdown").val()); | |
$("#withdrawDropdown").prev().prev().val($("#withdrawDropdown").val()); | |
$('#withdrawDropdown').change(function() { | |
$(this).prev().prev().val($(this).val()); | |
}); | |
$('#depositDropdown').change(function() { | |
$(this).prev().prev().val($(this).val()); | |
}); | |
} | |
if(page.indexOf("useobject.phtml") !== -1){ | |
if($("b:contains('Start Price (NP)')").length > 0){ // if we're on the auctions page | |
$("input[name='min_increment']").before("<select id='auctionDropdown_min' style='height:24px'>" + options + "</select> "); | |
$("input[name='start_price']").before("<select id='auctionDropdown' style='height:24px'>" + options + "</select> "); | |
$("#auctionDropdown").next().val($("#auctionDropdown").val()); | |
$('#auctionDropdown').change(function() { | |
// alert('The option with value ' + $(this).val() + ' was selected.'); | |
$(this).next().val($(this).val()); | |
}); | |
$("#auctionDropdown_min").next().val($("#auctionDropdown_min").val()); | |
$('#auctionDropdown_min').change(function() { | |
$(this).next().val($(this).val()); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment