Merge branch 'unstable' of https://github.com/jsmaniac/2011-m1s2-ter into unstable
|
@ -52,6 +52,8 @@ body {
|
|||
<script src="ressources/pticlic.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="screen" id="logo">
|
||||
</div>
|
||||
<div class="screen" id="game">
|
||||
<div id="mc-caption-block"></div>
|
||||
<div id="mn-caption-block"></div>
|
||||
|
@ -64,19 +66,19 @@ body {
|
|||
|
||||
<span id="title">PtiClic</span>
|
||||
<div class="frontpage-button game">
|
||||
<div><img class="icon" alt="" src="ressources/img/mode_normal.png" /></div>
|
||||
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
|
||||
<div class="text">Jouer</div>
|
||||
</div>
|
||||
<div class="frontpage-button prefs">
|
||||
<div><img class="icon" alt="" src="ressources/img/config.png" /></div>
|
||||
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
|
||||
<div class="text">Configuration</div>
|
||||
</div>
|
||||
<div class="frontpage-button connection">
|
||||
<div><img class="icon" alt="" src="ressources/img/config.png" /></div>
|
||||
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
|
||||
<div class="text">Connexion</div>
|
||||
</div>
|
||||
<div class="frontpage-button about">
|
||||
<div><img class="icon" alt="" src="ressources/img/rel/default.png" /></div>
|
||||
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
|
||||
<div class="text">A Propos</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -87,7 +89,7 @@ body {
|
|||
</div>
|
||||
<div id="templates" style="display: none;">
|
||||
<div class="relationBox">
|
||||
<div class="relation"><img class="icon" alt="" src="ressources/img/rel/default.png" /><span class="text"></span></div>
|
||||
<div class="relation"><img class="icon" alt="" src="ressources/img/72/default.png" /><span class="text"></span></div>
|
||||
<div class="clearboth"></div>
|
||||
</div>
|
||||
<div class="scoreLine">
|
||||
|
|
BIN
code/serveur/php/ressources/img/36/-1.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
code/serveur/php/ressources/img/36/0.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
code/serveur/php/ressources/img/36/10.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
code/serveur/php/ressources/img/36/5.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
code/serveur/php/ressources/img/36/7.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
code/serveur/php/ressources/img/36/9.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
code/serveur/php/ressources/img/36/aide.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
code/serveur/php/ressources/img/36/config.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
BIN
code/serveur/php/ressources/img/36/mode_normal.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
code/serveur/php/ressources/img/48/-1.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
code/serveur/php/ressources/img/48/0.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
code/serveur/php/ressources/img/48/10.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
code/serveur/php/ressources/img/48/5.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
code/serveur/php/ressources/img/48/7.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
code/serveur/php/ressources/img/48/9.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
code/serveur/php/ressources/img/48/aide.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
code/serveur/php/ressources/img/48/config.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
code/serveur/php/ressources/img/48/default.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
code/serveur/php/ressources/img/48/mode_normal.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
BIN
code/serveur/php/ressources/img/72/default.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 9.0 KiB |
|
@ -4,7 +4,7 @@ Number.prototype.clip = function(min, max, floor) {
|
|||
} catch(e) {alert("Error Number.prototype.clip");alert(e);}
|
||||
};
|
||||
|
||||
function dichotomy(start, isBigger) {
|
||||
function dichotomy(start, isBigger, foo) {
|
||||
try {
|
||||
var i = 0, min = 0, max, half;
|
||||
|
||||
|
@ -57,7 +57,7 @@ $.fn.fitFont = function(w, h, minFont, maxFont) {
|
|||
fubar = wrappers;
|
||||
return (wrappers.maxHeight() > h || wrappers.maxWidth() > w);
|
||||
} catch(e) {alert("Error anonymous in $.fn.fitFont");alert(e);}
|
||||
}).clip(minFont || 0, maxFont || Infinity));
|
||||
},this).clip(minFont || 0, maxFont || Infinity));
|
||||
|
||||
// Restore stuff
|
||||
this.css("position", oldpos);
|
||||
|
|
|
@ -5,10 +5,12 @@ function State(init) {
|
|||
if (!this.screen) this.screen = 'frontpage';
|
||||
} catch(e) {alert("Error State");alert(e);}
|
||||
};
|
||||
var futureHashChange = null;
|
||||
State.prototype.commit = function() {
|
||||
try {
|
||||
location.hash="#"+encodeURI($.JSON.encode(this));
|
||||
return this;
|
||||
futureHashChange = "#"+encodeURI($.JSON.encode(this));
|
||||
location.hash = futureHashChange;
|
||||
return this;
|
||||
} catch(e) {alert("Error State.prototype.commit");alert(e);}
|
||||
};
|
||||
State.prototype.get = function(key) {
|
||||
|
@ -41,37 +43,47 @@ var oldScreen = '';
|
|||
var ui = {};
|
||||
function hashchange() {
|
||||
try {
|
||||
var stateJSON = decodeURI(location.hash.substring(location.hash.indexOf("#") + 1));
|
||||
state = new State($.parseJSON(stateJSON)).validate();
|
||||
if (futureHashChange === location.hash) {
|
||||
futureHashChange = null;
|
||||
} else {
|
||||
var stateJSON = decodeURI(location.hash.substring(location.hash.indexOf("#") + 1));
|
||||
state = new State($.parseJSON(stateJSON)).validate();
|
||||
}
|
||||
} catch(e) {alert("Error hashchange");alert(e);}
|
||||
}
|
||||
|
||||
// ==== JavaScript Style général
|
||||
function jss() {
|
||||
try {
|
||||
var w = $(window).width();
|
||||
var h = $(window).height();
|
||||
var iconSize;
|
||||
if (h > 600) iconSize = 72;
|
||||
else if(h > 500) iconSize = 48;
|
||||
else iconSize = 36;
|
||||
|
||||
$(".screen")
|
||||
.wh(w, h)
|
||||
.northWest({top:0,left:0});
|
||||
|
||||
$("body, html")
|
||||
.css({
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
overflow: "hidden",
|
||||
textAlign: "left"
|
||||
var w = $(window).width();
|
||||
var h = $(window).height();
|
||||
var iconSize;
|
||||
if (h > 600) iconSize = 72;
|
||||
else if(h > 500) iconSize = 48;
|
||||
else iconSize = 36;
|
||||
|
||||
$(".screen")
|
||||
.wh(w, h)
|
||||
.northWest({top:0,left:0});
|
||||
|
||||
$("body, html")
|
||||
.css({
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
overflow: "hidden",
|
||||
textAlign: "left"
|
||||
});
|
||||
|
||||
$(".screen").hide();
|
||||
$("#"+state.screen+".screen").show();
|
||||
|
||||
if (window[state.screen] && window[state.screen].jss) window[state.screen].jss(w, h, iconSize);
|
||||
|
||||
$("img.icon").each(function(i,e) {
|
||||
e=$(e);
|
||||
if (typeof(e.data('image')) != 'undefined')
|
||||
e.attr("src", "ressources/img/"+iconSize+"/"+e.data('image')+".png");
|
||||
});
|
||||
|
||||
$(".screen").hide();
|
||||
$("#"+state.screen+".screen").show();
|
||||
|
||||
if (window[state.screen] && window[state.screen].jss) window[state.screen].jss(w, h, iconSize);
|
||||
} catch(e) {alert("Error jss");alert(e);}
|
||||
}
|
||||
// ==== Interface Android
|
||||
|
@ -87,7 +99,7 @@ function UI () {
|
|||
show: function(title, text) {},
|
||||
dismiss: function() {},
|
||||
exit: function() {},
|
||||
log: function() {},
|
||||
log: function(msg) { window.console && console.log(msg); },
|
||||
setScreen: function() {}
|
||||
};
|
||||
}
|
||||
|
@ -141,8 +153,15 @@ frontpage.jss = function(w, h, iconSize) {
|
|||
|
||||
$fp(".text")
|
||||
.fitFont(buttonWidth, labelHeight, 10);
|
||||
|
||||
$fp(".icon")
|
||||
.wh(iconSize);
|
||||
|
||||
$fp(".game .icon").data('image', 'mode_normal');
|
||||
$fp(".prefs .icon").data('image', 'config');
|
||||
$fp(".connection .icon").data('image', 'config');
|
||||
$fp(".about .icon").data('image', 'aide');
|
||||
|
||||
$fp(".frontpage-button")
|
||||
.css('text-align', 'center')
|
||||
.width(buttonWidth);
|
||||
|
@ -266,7 +285,6 @@ game.enter = function () {
|
|||
} else {
|
||||
game.buildUi();
|
||||
}
|
||||
jss();
|
||||
} catch(e) {alert("Error game.enter");alert(e);}
|
||||
};
|
||||
|
||||
|
@ -290,7 +308,7 @@ game.buildUi = function () {
|
|||
.html(relation.name.replace(/%(m[cn])/g, '<span class="$1"/>'))
|
||||
.end()
|
||||
.find(".icon")
|
||||
.attr("src", "ressources/img/rel/"+relation.id+".png")
|
||||
.data("image",relation.id)
|
||||
.end()
|
||||
.click(function(e) {
|
||||
game.nextWord({left:e.pageX, top:e.pageY}, this);
|
||||
|
|