Danxor

Salty Stats

Nov 7th, 2013
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ($("#p2stats").length == 0)
  2. {      
  3.     $("#wager").after('<button id="Bet100" type="button">Max</button>')
  4.     $("#wager").after('<button id="Bet75" type="button">75%</button>')
  5.     $("#wager").after('<button id="Bet50" type="button">50%</button>')
  6.     $("#wager").after('<button id="Bet25" type="button">25%</button>')
  7.     $("#wager").after('<button id="Bet10" type="button">10%</button>')
  8.     $("#wager").after('<br/><button id="Bet1" type="button">1</button>')
  9.  
  10.     $("#Bet1").click(function()
  11.     {
  12.         $("#wager").val("1")
  13.     });
  14.  
  15.     $("#Bet10").click(function()
  16.     {
  17.         $("#wager").val(Math.floor($("#balance").text() * .1))
  18.     });
  19.    
  20.     $("#Bet25").click(function()
  21.     {
  22.         $("#wager").val(Math.floor($("#balance").text() * .25))
  23.     });
  24.  
  25.     $("#Bet50").click(function()
  26.     {
  27.         $("#wager").val(Math.floor($("#balance").text() * .5))
  28.     });
  29.  
  30.     $("#Bet75").click(function()
  31.     {
  32.         $("#wager").val(Math.floor($("#balance").text() * .75))
  33.     });
  34.  
  35.     $("#Bet100").click(function()
  36.     {
  37.         $("#wager").val($("#balance").text())
  38.     });
  39.  
  40.     $("#p1name").after("<br><span id=\"p1stats\">Salty Stat Tracker Loaded</span>");
  41.     $("#p2name").after("<br><span id=\"p2stats\">Salty Stat Tracker Loaded</span>");           
  42.     $("#p1stats").next("br").remove();
  43.     $("#p2stats").next("br").remove();
  44.     $('#p2name').addClass('right')
  45.     $('#p2stats').addClass('right')
  46.     $("#p2name").bind("DOMSubtreeModified",p2name_Changed);
  47. }
  48.  
  49. function p2name_Changed (event)
  50. {
  51.     $.ajax(
  52.     {
  53.         type: "get",
  54.         url: "ajax_get_stats.php",
  55.         data: "",
  56.         dataType: "json",  
  57.         cache: "false",
  58.         timeout: 1000,
  59.         success: function (data)
  60.         {
  61.             p1name = data.p1name;
  62.             p1totalmatches = data.p1totalmatches;
  63.             p1winrate= data.p1winrate;
  64.             p1tier = data.p1tier;          
  65.             p1life = data.p1life;          
  66.             p1meter = data.p1meter;          
  67.             p2name = data.p2name;          
  68.             p2totalmatches = data.p2totalmatches;        
  69.             p2winrate = data.p2winrate;          
  70.             p2tier = data.p2tier;          
  71.             p2life = data.p2life;          
  72.             p2meter = data.p2meter;        
  73.             $("#p1stats").text("Tier: " + p1tier + " Matches: " + p1totalmatches + " Win: " + p1winrate + "%" + " Life: " + p1life);          
  74.             $("#p2stats").text("Tier: " + p2tier + " Matches: " + p2totalmatches + " Win: " + p2winrate + "%" + " Life: " + p2life);          
  75.         }
  76.     })
  77. }
Advertisement
Add Comment
Please, Sign In to add comment