Advertisement
Guest User

Code csgo

a guest
Jan 28th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. // TEMP REMOVE
  2. function addright(that, watdo) {}
  3. function addleft(that, watdo) {}
  4.  
  5. function postTrade(tslt) {
  6. var left = $('.left').serialize();
  7. var right = $('.right').serialize();
  8. var optional = "";
  9. if ($("#steamoffers").val() != null) {
  10. var str = $("#steamoffers").val();
  11. var n = str.indexOf("token=");
  12. if (n != -1) optional = "&steamoffers="+str.substring(n+6,n+14);
  13. }
  14. $.ajax({
  15. type: "POST",
  16. url: "ajax/postTrade.php",
  17. data: left + '&' + right + '&tslt=' + tslt + '&' + $('#notes').serialize() + optional,
  18. success: function(data) {
  19. if (data) {
  20. window.alert(data);
  21. } else {
  22. window.location.href = "mytrades";
  23. }
  24. }
  25. });
  26. }
  27.  
  28. function setBackpackCurl(type) {
  29. $("#backpack").html('<img src="http://csgolounge.com/img/load.gif" id="loading" style="margin: 0.75em 2%">');
  30. if (type == 1) $.ajax({url: 'ajax/tradeBackpackApi.php',type: 'POST', success: function(data) { $("#backpack").html(data); }});
  31. else if (type == 2) $.ajax({url: 'ajax/tradeGifts.php', success: function(data) { $("#backpack").html(data); }});
  32. else if (type == 3) $.ajax({url: 'ajax/tradeBackpack.php',type: 'POST', success: function(data) { $("#backpack").html(data); }});
  33. else if (type == 4) $.ajax({url: 'ajax/tradeBackpackApi.php',type: 'POST',data: "refresh=1", success: function(data) { $("#backpack").html(data); }});
  34. }
  35.  
  36. function searchFraze(fraze, page) {
  37. page = typeof page !== 'undefined' ? page : 1;
  38. $.ajax({
  39. url: 'ajax/tradeCsRight.php',
  40. type: 'POST',
  41. data: "type=10&fraze="+fraze+"&page="+page,
  42. success: function(data) {
  43. $("#itemlist").html(data);
  44. }
  45. });
  46. }
  47.  
  48. function searchFrazeSteam(fraze, page) {
  49. page = typeof page !== 'undefined' ? page : 1;
  50. $.ajax({
  51. url: 'ajax/tradeSteamRight.php',
  52. type: 'POST',
  53. data: "type=10&fraze="+fraze+"&page="+page,
  54. success: function(data) {
  55. $("#itemlist").html(data);
  56. }
  57. });
  58. }
  59.  
  60. function setCat(type, search) {
  61. $.ajax({
  62. url: 'ajax/tradeWhatRight.php',
  63. type: 'POST',
  64. data: "type="+type+"&search="+search,
  65. success: function(data) {
  66. $("#rightlist").html(data);
  67. }
  68. });
  69. }
  70.  
  71. function setSubCat(app, type, search) {
  72. $.ajax({
  73. url: 'ajax/trade'+app+'Right.php',
  74. type: 'POST',
  75. data: "type="+type+"&search="+search,
  76. success: function(data) {
  77. $("#itemlist").html(data);
  78. }
  79. });
  80. }
  81.  
  82. $(document).ready(function(){
  83. var addTrade = 0;
  84. var timer;
  85. var delay = 600;
  86.  
  87. setSubCat('Cs',6,addTrade);
  88.  
  89. $('#itemfilter').bind('input', function() {
  90. window.clearTimeout(timer);
  91. timer = window.setTimeout(function(){
  92. filterResults(1,1);
  93. }, delay);
  94. })
  95.  
  96. $.ajax({
  97. url: 'ajax/tradeBackpackApi.php',
  98. type: 'POST',
  99. success: function(data) {
  100. $("#backpack").html(data);
  101. }
  102. });
  103.  
  104. $("#backpack").on( "click", ".item", function() {
  105. if ($('.left').children().size() < 8) {
  106. var oitm = $(this).parent();
  107. if (oitm.has('.item input').length) {
  108. oitm.addClass('frmbp');
  109. oitm.prepend('<div class="itemoptions"><div class="optr">remove</div><div class="optw">to want</div></div>');
  110. oitm.appendTo('.left').find('.name').remove();
  111. }
  112. }
  113. });
  114. $(".left").on( "click", ".optw", function() {
  115. if ($('.right').children().size() < 8) {
  116. $(this).parent().hide();
  117. $(this).html('to have');
  118. $(this).siblings(".quals").remove();
  119. var newone = $(this).parent().parent().clone();
  120. $(this).parent().parent().remove();
  121. newone.find("input[name='ldef_index[]']").attr('name', 'rdef_index[]');
  122. newone.find("input[name='lquality[]']").attr('name', 'rquality[]');
  123. newone.appendTo('.right');
  124. }
  125. });
  126.  
  127. $("#rightlist").on( "click", ".item", function() {
  128. if ($('.right').children().size() < 8) {
  129. var clone = $(this).parent().clone();
  130. clone.prepend('<div class="itemoptions"><div class="optr">remove</div></div>');
  131. clone.appendTo('.right').find('.name').remove();
  132. }
  133. });
  134. $(".right").on( "click", ".optw", function() {
  135. if ($('.left').children().size() < 8) {
  136. $(this).parent().hide();
  137. $(this).html('to want');
  138. $(this).siblings(".quals").remove();
  139. var newone = $(this).parent().parent().clone();
  140. $(this).parent().parent().remove();
  141. newone.find("input[name='rdef_index[]']").attr('name', 'ldef_index[]');
  142. newone.find("input[name='rquality[]']").attr('name', 'lquality[]');
  143. newone.appendTo('.left');
  144. }
  145. });
  146. $(".tradepoll").on( "click", ".optr", function() {
  147. var tmp = $(this).parent().parent();
  148. if (tmp.hasClass('frmbp')) {
  149. $(this).parent().parent().appendTo('#trash');
  150. $(this).parent().remove();
  151. } else {
  152. $(this).parent().parent().remove();
  153. }
  154. });
  155. $(".tradepoll").on( "click", ".quals div", function() {
  156. var itm = $(this).parent().parent().siblings('.item');
  157. itm.removeClass().addClass("item").addClass($(this).text());
  158. if (itm.children("input[name='lquality[]']").length == 1) itm.children("input[name='lquality[]']").val(qualities[$(this).text()]);
  159. else if (itm.children("input[name='rquality[]']").length == 1) itm.children("input[name='rquality[]']").val(qualities[$(this).text()]);
  160. });
  161. $(".tradepoll").on( "click", ".oitm", function() { $(this).children(".itemoptions").fadeIn(100); });
  162. $(".tradepoll").on( "mouseleave", ".oitm", function() {
  163. $(this).children(".itemoptions").fadeOut(100);
  164. });
  165. $(".tradepoll").on( "mouseleave", ".quals", function() {
  166. $(this).siblings().show();
  167. $(this).remove();
  168. });
  169.  
  170. $('input[name="bq"]').search('#backpack .name', function(on) {
  171. on.reset(function() {
  172. $('#backpack .name').parent().show();
  173. });
  174. on.empty(function() {
  175. $('#backpack .name').parent().hide();
  176. });
  177. on.results(function(results) {
  178. filtersReset('bq');
  179. $('#backpack .name').parent().hide();
  180. results.parent().show();
  181. });
  182. });
  183.  
  184. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement