Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TEMP REMOVE
- function addright(that, watdo) {}
- function addleft(that, watdo) {}
- function postTrade(tslt) {
- var left = $('.left').serialize();
- var right = $('.right').serialize();
- var optional = "";
- if ($("#steamoffers").val() != null) {
- var str = $("#steamoffers").val();
- var n = str.indexOf("token=");
- if (n != -1) optional = "&steamoffers="+str.substring(n+6,n+14);
- }
- $.ajax({
- type: "POST",
- url: "ajax/postTrade.php",
- data: left + '&' + right + '&tslt=' + tslt + '&' + $('#notes').serialize() + optional,
- success: function(data) {
- if (data) {
- window.alert(data);
- } else {
- window.location.href = "mytrades";
- }
- }
- });
- }
- function setBackpackCurl(type) {
- $("#backpack").html('<img src="http://csgolounge.com/img/load.gif" id="loading" style="margin: 0.75em 2%">');
- if (type == 1) $.ajax({url: 'ajax/tradeBackpackApi.php',type: 'POST', success: function(data) { $("#backpack").html(data); }});
- else if (type == 2) $.ajax({url: 'ajax/tradeGifts.php', success: function(data) { $("#backpack").html(data); }});
- else if (type == 3) $.ajax({url: 'ajax/tradeBackpack.php',type: 'POST', success: function(data) { $("#backpack").html(data); }});
- else if (type == 4) $.ajax({url: 'ajax/tradeBackpackApi.php',type: 'POST',data: "refresh=1", success: function(data) { $("#backpack").html(data); }});
- }
- function searchFraze(fraze, page) {
- page = typeof page !== 'undefined' ? page : 1;
- $.ajax({
- url: 'ajax/tradeCsRight.php',
- type: 'POST',
- data: "type=10&fraze="+fraze+"&page="+page,
- success: function(data) {
- $("#itemlist").html(data);
- }
- });
- }
- function searchFrazeSteam(fraze, page) {
- page = typeof page !== 'undefined' ? page : 1;
- $.ajax({
- url: 'ajax/tradeSteamRight.php',
- type: 'POST',
- data: "type=10&fraze="+fraze+"&page="+page,
- success: function(data) {
- $("#itemlist").html(data);
- }
- });
- }
- function setCat(type, search) {
- $.ajax({
- url: 'ajax/tradeWhatRight.php',
- type: 'POST',
- data: "type="+type+"&search="+search,
- success: function(data) {
- $("#rightlist").html(data);
- }
- });
- }
- function setSubCat(app, type, search) {
- $.ajax({
- url: 'ajax/trade'+app+'Right.php',
- type: 'POST',
- data: "type="+type+"&search="+search,
- success: function(data) {
- $("#itemlist").html(data);
- }
- });
- }
- $(document).ready(function(){
- var addTrade = 0;
- var timer;
- var delay = 600;
- setSubCat('Cs',6,addTrade);
- $('#itemfilter').bind('input', function() {
- window.clearTimeout(timer);
- timer = window.setTimeout(function(){
- filterResults(1,1);
- }, delay);
- })
- $.ajax({
- url: 'ajax/tradeBackpackApi.php',
- type: 'POST',
- success: function(data) {
- $("#backpack").html(data);
- }
- });
- $("#backpack").on( "click", ".item", function() {
- if ($('.left').children().size() < 8) {
- var oitm = $(this).parent();
- if (oitm.has('.item input').length) {
- oitm.addClass('frmbp');
- oitm.prepend('<div class="itemoptions"><div class="optr">remove</div><div class="optw">to want</div></div>');
- oitm.appendTo('.left').find('.name').remove();
- }
- }
- });
- $(".left").on( "click", ".optw", function() {
- if ($('.right').children().size() < 8) {
- $(this).parent().hide();
- $(this).html('to have');
- $(this).siblings(".quals").remove();
- var newone = $(this).parent().parent().clone();
- $(this).parent().parent().remove();
- newone.find("input[name='ldef_index[]']").attr('name', 'rdef_index[]');
- newone.find("input[name='lquality[]']").attr('name', 'rquality[]');
- newone.appendTo('.right');
- }
- });
- $("#rightlist").on( "click", ".item", function() {
- if ($('.right').children().size() < 8) {
- var clone = $(this).parent().clone();
- clone.prepend('<div class="itemoptions"><div class="optr">remove</div></div>');
- clone.appendTo('.right').find('.name').remove();
- }
- });
- $(".right").on( "click", ".optw", function() {
- if ($('.left').children().size() < 8) {
- $(this).parent().hide();
- $(this).html('to want');
- $(this).siblings(".quals").remove();
- var newone = $(this).parent().parent().clone();
- $(this).parent().parent().remove();
- newone.find("input[name='rdef_index[]']").attr('name', 'ldef_index[]');
- newone.find("input[name='rquality[]']").attr('name', 'lquality[]');
- newone.appendTo('.left');
- }
- });
- $(".tradepoll").on( "click", ".optr", function() {
- var tmp = $(this).parent().parent();
- if (tmp.hasClass('frmbp')) {
- $(this).parent().parent().appendTo('#trash');
- $(this).parent().remove();
- } else {
- $(this).parent().parent().remove();
- }
- });
- $(".tradepoll").on( "click", ".quals div", function() {
- var itm = $(this).parent().parent().siblings('.item');
- itm.removeClass().addClass("item").addClass($(this).text());
- if (itm.children("input[name='lquality[]']").length == 1) itm.children("input[name='lquality[]']").val(qualities[$(this).text()]);
- else if (itm.children("input[name='rquality[]']").length == 1) itm.children("input[name='rquality[]']").val(qualities[$(this).text()]);
- });
- $(".tradepoll").on( "click", ".oitm", function() { $(this).children(".itemoptions").fadeIn(100); });
- $(".tradepoll").on( "mouseleave", ".oitm", function() {
- $(this).children(".itemoptions").fadeOut(100);
- });
- $(".tradepoll").on( "mouseleave", ".quals", function() {
- $(this).siblings().show();
- $(this).remove();
- });
- $('input[name="bq"]').search('#backpack .name', function(on) {
- on.reset(function() {
- $('#backpack .name').parent().show();
- });
- on.empty(function() {
- $('#backpack .name').parent().hide();
- });
- on.results(function(results) {
- filtersReset('bq');
- $('#backpack .name').parent().hide();
- results.parent().show();
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement