summaryrefslogtreecommitdiff
path: root/javas/bidding.js
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2015-08-24 16:07:10 +0200
committeremkael <emkael@tlen.pl>2015-08-24 16:07:10 +0200
commitae4d9172b4ab1a020980eccfc4ade462513b3768 (patch)
tree3e28c0f68330b05ee362f98e0336892f5e975ed5 /javas/bidding.js
* initial commit
Diffstat (limited to 'javas/bidding.js')
-rw-r--r--javas/bidding.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/javas/bidding.js b/javas/bidding.js
new file mode 100644
index 0000000..5165aa8
--- /dev/null
+++ b/javas/bidding.js
@@ -0,0 +1,43 @@
+var display_bidding = function(element, bidding) {
+ var popup = $('<div id="bidding_popup"></div>');
+ popup.css({
+ 'position': 'absolute',
+ 'width': '250px',
+ 'left': element.position().left + element.width(),
+ 'top': element.position().top
+ });
+ popup.html(bidding);
+ element.after(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');
+ }
+ }
+ }
+ );
+ return false;
+};
+
+var bind_bidding_links = function() {
+ $('a.biddingLink').each(function() {
+ $(this).unbind('click').click(load_bidding);
+ });
+ $(document).click(function() {
+ $('#bidding_popup').remove();
+ });
+};
+
+$(document).ready(function() {
+ setInterval(bind_bidding_links, 1000);
+});