diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html
index bc88d13e3..5fa7f127c 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html
@@ -47,6 +47,7 @@
+
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html
index 69e99d89d..721720c7c 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html
@@ -125,6 +125,7 @@
+
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html
index a59db5a72..b97c830ad 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html
@@ -54,6 +54,7 @@
+
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/index.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/index.html
index 1df084686..f43a4578c 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/index.html
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/index.html
@@ -20,6 +20,7 @@
+
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/communication.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/communication.js
index ba1f21fa1..f902ad85f 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/communication.js
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/communication.js
@@ -8,7 +8,7 @@ var GempLotrCommunication = Class.extend({
},
startGameSession: function(callback) {
- $.ajax({
+ $.ajaxq("gameState", {
type: "GET",
url: this.url + "/game/" + getUrlParam("gameId"),
cache: false,
@@ -19,7 +19,7 @@ var GempLotrCommunication = Class.extend({
});
},
updateGameState: function(callback) {
- $.ajax({
+ $.ajaxq("gameState", {
type: "POST",
url: this.url + "/game/" + getUrlParam("gameId"),
cache: false,
@@ -30,7 +30,8 @@ var GempLotrCommunication = Class.extend({
});
},
getGameCardModifiers: function(cardId, callback) {
- $.ajax({
+ $.ajaxq("gameCardModifiers");
+ $.ajaxq("gameCardModifiers", {
type: "GET",
url: this.url + "/game/" + getUrlParam("gameId") + "/cardInfo",
cache: false,
@@ -42,7 +43,7 @@ var GempLotrCommunication = Class.extend({
});
},
gameDecisionMade: function(decisionId, response, callback) {
- $.ajax({
+ $.ajaxq("gameState", {
type: "POST",
url: this.url + "/game/" + getUrlParam("gameId"),
cache: false,
@@ -56,7 +57,7 @@ var GempLotrCommunication = Class.extend({
});
},
concede: function() {
- $.ajax({
+ $.ajaxq("gameState", {
type: "POST",
url: this.url + "/game/" + getUrlParam("gameId") + "/concede",
cache: false,
@@ -67,7 +68,7 @@ var GempLotrCommunication = Class.extend({
});
},
getDeck: function(deckType, callback) {
- $.ajax({
+ $.ajaxq("deck", {
type: "GET",
url: this.url + "/deck/" + deckType,
cache: false,
@@ -79,7 +80,7 @@ var GempLotrCommunication = Class.extend({
});
},
getCollection: function(collectionType, filter, start, count, callback) {
- $.ajax({
+ $.ajaxq("collection", {
type: "GET",
url: this.url + "/collection/" + collectionType,
cache: false,
@@ -94,7 +95,7 @@ var GempLotrCommunication = Class.extend({
});
},
saveDeck: function(deckType, contents, callback) {
- $.ajax({
+ $.ajaxq("deck", {
type: "POST",
url: this.url + "/deck/" + deckType,
cache: false,
@@ -107,7 +108,8 @@ var GempLotrCommunication = Class.extend({
});
},
getDeckStats: function(contents, callback) {
- $.ajax({
+ $.ajaxq("deckStats");
+ $.ajaxq("deckStats", {
type: "POST",
url: this.url + "/deck",
cache: false,
@@ -120,7 +122,7 @@ var GempLotrCommunication = Class.extend({
});
},
startChat: function(room, callback) {
- $.ajax({
+ $.ajaxq("chat", {
type: "GET",
url: this.url + "/chat/" + room,
cache: false,
@@ -132,7 +134,7 @@ var GempLotrCommunication = Class.extend({
});
},
updateChat: function(room, callback) {
- $.ajax({
+ $.ajaxq("chat", {
type: "POST",
url: this.url + "/chat/" + room,
cache: false,
@@ -144,7 +146,7 @@ var GempLotrCommunication = Class.extend({
});
},
sendChatMessage: function(room, message, callback) {
- $.ajax({
+ $.ajaxq("chat", {
type: "POST",
url: this.url + "/chat/" + room,
cache: false,
@@ -157,7 +159,7 @@ var GempLotrCommunication = Class.extend({
});
},
getHall: function(callback) {
- $.ajax({
+ $.ajaxq("hall", {
type: "GET",
url: this.url + "/hall",
cache: false,
@@ -169,7 +171,7 @@ var GempLotrCommunication = Class.extend({
});
},
joinTable: function(tableId, callback) {
- $.ajax({
+ $.ajaxq("hall", {
type: "POST",
url: this.url + "/hall/" + tableId,
cache: false,
@@ -181,7 +183,7 @@ var GempLotrCommunication = Class.extend({
});
},
createTable: function(format, callback) {
- $.ajax({
+ $.ajaxq("hall", {
type: "POST",
url: this.url + "/hall",
cache: false,
@@ -194,7 +196,7 @@ var GempLotrCommunication = Class.extend({
});
},
leaveTable: function() {
- $.ajax({
+ $.ajaxq("hall", {
type: "POST",
url: this.url + "/hall/leave",
cache: false,
@@ -205,7 +207,7 @@ var GempLotrCommunication = Class.extend({
});
},
getStatus: function(callback) {
- $.ajax({
+ $.ajaxq("status", {
type: "GET",
url: this.url + "/",
cache: false,
@@ -217,7 +219,7 @@ var GempLotrCommunication = Class.extend({
});
},
login: function(login, password, callback) {
- $.ajax({
+ $.ajaxq("login", {
type: "POST",
url: this.url + "/login",
cache: false,
@@ -231,7 +233,7 @@ var GempLotrCommunication = Class.extend({
});
},
register: function(login, password, callback) {
- $.ajax({
+ $.ajaxq("register", {
type: "POST",
url: this.url + "/register",
cache: false,
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/jquery/jquery.ajaxq-0.0.1.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/jquery/jquery.ajaxq-0.0.1.js
new file mode 100644
index 000000000..1dcad7326
--- /dev/null
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/jquery/jquery.ajaxq-0.0.1.js
@@ -0,0 +1,63 @@
+/*
+ * jQuery AjaxQ - AJAX request queueing for jQuery
+ *
+ * Version: 0.0.1
+ * Date: July 22, 2008
+ *
+ * Copyright (c) 2008 Oleg Podolsky (oleg.podolsky@gmail.com)
+ * Licensed under the MIT (MIT-LICENSE.txt) license.
+ *
+ * http://plugins.jquery.com/project/ajaxq
+ * http://code.google.com/p/jquery-ajaxq/
+ */
+
+jQuery.ajaxq = function (queue, options)
+{
+ // Initialize storage for request queues if it's not initialized yet
+ if (typeof document.ajaxq == "undefined") document.ajaxq = {q:{}, r:null};
+
+ // Initialize current queue if it's not initialized yet
+ if (typeof document.ajaxq.q[queue] == "undefined") document.ajaxq.q[queue] = [];
+
+ if (typeof options != "undefined") // Request settings are given, enqueue the new request
+ {
+ // Copy the original options, because options.complete is going to be overridden
+
+ var optionsCopy = {};
+ for (var o in options) optionsCopy[o] = options[o];
+ options = optionsCopy;
+
+ // Override the original callback
+
+ var originalCompleteCallback = options.complete;
+
+ options.complete = function (request, status)
+ {
+ // Dequeue the current request
+ document.ajaxq.q[queue].shift();
+ document.ajaxq.r = null;
+
+ // Run the original callback
+ if (originalCompleteCallback) originalCompleteCallback(request, status);
+
+ // Run the next request from the queue
+ if (document.ajaxq.q[queue].length > 0) document.ajaxq.r = jQuery.ajax(document.ajaxq.q[queue][0]);
+ };
+
+ // Enqueue the request
+ document.ajaxq.q[queue].push(options);
+
+ // Also, if no request is currently running, start it
+ if (document.ajaxq.q[queue].length == 1) document.ajaxq.r = jQuery.ajax(options);
+ }
+ else // No request settings are given, stop current request and clear the queue
+ {
+ if (document.ajaxq.r)
+ {
+ document.ajaxq.r.abort();
+ document.ajaxq.r = null;
+ }
+
+ document.ajaxq.q[queue] = [];
+ }
+}
\ No newline at end of file