commit 7dd66ab6db280af8c2a692c64d783334c3f412f2
parent a8a8334e892b5c7c29865cc2ad59f0c37dbfe9d6
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Sat, 21 May 2011 11:43:40 +0200
Correction d'un bug pour la connexion sur score.
Diffstat:
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/code/serveur/php/ressources/my-extensions.js b/code/serveur/php/ressources/my-extensions.js
@@ -8,8 +8,15 @@ Number.prototype.mapInterval = function(a,b,x,y) {
return x + ((this-a) / (b-a) * (y-x));
}
-dichotomyStop = false;
-function dichotomy(start, isBigger, debug) {
+Array.prototype.equalp = function(a) {
+ if (this.length != a.length) return false;
+ for (var i = 0; i < this.length; i++) {
+ if (this[i] !== a[i]) return false;
+ }
+ return true;
+};
+
+function dichotomy(start, isBigger) {
try {
var i = 0, min = 0, max, half;
for (max = start || 1; ++i < 10 && !isBigger(max); max *= 2);
@@ -47,7 +54,7 @@ $.fn.fitFont = function() {
var size = dichotomy(parseInt(this.css("font-size"), 10), function(x) {
setFont.css("fontSize", x);
return that.$ormap(function(i,e) { return e.hasScroll(); });
- }, this);
+ });
this.css("font-size", Math.max(0, size));
return this;
} catch(e) {alert("Error $.fn.fitFont");alert(e);throw(e);}
diff --git a/code/serveur/php/ressources/pticlic.js b/code/serveur/php/ressources/pticlic.js
@@ -275,7 +275,7 @@ runstate.scoreCache = new Cache(function getScore(k, dfd, arg) {
if (data.isError) {
dfd.reject(data);
message("Erreur", data.msg);
- if ((data.error == 10 || data.error == 3) && state.screen == 'game' && state.pgid == k) {
+ if ((data.error == 10 || data.error == 3) && state.screen == 'score' && state.pgid == k && state.answers.equalp(arg)) {
$.screen('connection').trigger('goto');
} else {
$.screen('frontpage').trigger('goto');