diff options
Diffstat (limited to 'res/javas/bidding.js')
-rw-r--r-- | res/javas/bidding.js | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/res/javas/bidding.js b/res/javas/bidding.js index 5932e66..72a4ec4 100644 --- a/res/javas/bidding.js +++ b/res/javas/bidding.js @@ -1,40 +1,36 @@ var display_bidding = function(element, bidding) { - var popup = $('<div id="bidding_popup"></div>'); - popup.css({ - 'position': 'absolute', - 'width': '250px', - 'left': element.offset().left + element.width(), - 'top': element.offset().top - }); - popup.html(bidding); - $('body').append(popup); + var popup = $('<tr class="bidding_popup"><td class="n"> </td><td class="bidding_cell noc" colspan="1000"></td></tr>'); + popup.find('.bidding_cell').html(bidding); + element.closest('tr').after(popup); + element.data('bidding-row', popup); } var load_bidding = function() { - $('#bidding_popup').remove(); var elem = $(this); - $.ajax( - { - url: elem.attr('data-bidding-link'), - complete: function(xhr, status) { - if (status == 'success') { - display_bidding(elem, xhr.responseText); - } - else { - display_bidding(elem, 'Brak danych'); + if (elem.data('bidding-row')) { + elem.data('bidding-row').remove(); + elem.removeData('bidding-row'); + } else { + $.ajax( + { + url: elem.attr('data-bidding-link'), + complete: function(xhr, status) { + if (status == 'success') { + display_bidding(elem, xhr.responseText); + } + else { + display_bidding(elem, 'Brak danych'); + } } } - } - ); + ); + } return false; }; var bind_bidding_links = function() { $('a.biddingLink').each(function() { - $(this).unbind('click').click(load_bidding); - }); - $(document).click(function() { - $('#bidding_popup').remove(); + $(this).unbind('click').attr('title', 'Pokaż/ukryj licytację').click(load_bidding); }); }; |