commit fdc1a3315b4fb9c2486d004d3cad0098e92eab3b
parent 2e45b48173b69b17e06df8f2e0dd338e8ff8ef64
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Sat, 7 May 2011 23:28:29 +0200
Suite de l'écran des préférences.
Diffstat:
2 files changed, 75 insertions(+), 14 deletions(-)
diff --git a/code/serveur/php/jeu.html b/code/serveur/php/jeu.html
@@ -124,6 +124,17 @@ html, body {
</p>
</div>
</div>
+ <div class="screen" id="prefs">
+ <form id="prefs-form" action="#" method="GET">
+ <label id="theme-label" for="theme">Thème : </label>
+ <select name="theme" id="theme">
+ <option value="green">Colline verdoyante</option>
+ <option value="black">Bas-fond de cachot</option>
+ </select>
+ <input type="submit" name="prefs-apply" id="prefs-apply" value="Appliquer" />
+ <input type="reset" name="prefs-cancel" id="prefs-cancel" value="Annuler" />
+ </form>
+ </div>
<div id="templates" style="display: none;">
<div class="relationBox">
<div class="relation"><img class="icon" alt="" src="ressources/img/72/default.png" /><span class="text"></span></div>
diff --git a/code/serveur/php/ressources/pticlic.js b/code/serveur/php/ressources/pticlic.js
@@ -280,10 +280,10 @@ frontpage.jss = function(w, h, iconSize) {
frontpage.enter = function () {
try {
if (location.hash != '') state.commit();
- console.log("fubar");
$("#frontpage .frontpage-button.game").clickOnce(frontpage.click.goGame);
$("#frontpage .frontpage-button.connection").clickOnce(frontpage.click.goConnection);
$("#frontpage .frontpage-button.info").clickOnce(frontpage.click.goInfo);
+ $("#frontpage .frontpage-button.prefs").clickOnce(frontpage.click.goPrefs);
jss();
UI().dismiss();
} catch(e) {alert("Error frontpage.enter");alert(e);}
@@ -292,7 +292,6 @@ frontpage.enter = function () {
frontpage.click = {};
frontpage.click.goGame = function(){
try {
- console.log("goGame");
state.set('screen', 'game').validate();
} catch(e) {alert("Error frontpage.click.goGame");alert(e);}
};
@@ -311,6 +310,12 @@ frontpage.click.goInfo = function() {
} catch(e) {alert("Error frontpage.click.goInfo");alert(e);}
};
+frontpage.click.goPrefs = function() {
+ try {
+ UI().show("PtiClic", "Chargement…");
+ state.set('screen', 'prefs').commit().validate();
+ } catch(e) {alert("Error frontpage.click.goPrefs");alert(e);}
+};
// ==== Code métier pour le jeu
game = {};
@@ -590,12 +595,8 @@ connection.jss = function(w, h, iconSize) {
} catch(e) {alert("Error anonymous 1 in connection.jss");alert(e);}
};
- (c)
- .css('text-align', 'center');
-
- $c("label")
- .css("white-space", "nowrap");
$c("input, label")
+ .css("white-space", "nowrap")
.css('position', 'absolute')
.fitFont(w*0.3, h*0.25);
$c("#user-label").east({left:w/2,top:h*0.25});
@@ -608,8 +609,8 @@ connection.jss = function(w, h, iconSize) {
connection.enter = function() {
try {
- jss();
$("#connect-form").unbind("submit", connection.connect).submit(connection.connect);
+ jss();
UI().dismiss();
} catch(e) {alert("Error connection.enter");alert(e);}
};
@@ -623,7 +624,7 @@ connection.connect = function() {
user: $("#user").val(),
passwd: $("#passwd").val(),
}, connection.connectFetched, connection.connectFetched);
- return false
+ return false;
} catch(e) {alert("Error connection.connect");alert(e);}
}
@@ -653,12 +654,61 @@ info.jss = function(w,h,iconSize) {
info.enter = function() {
try {
+ $("#info-back").clickOnce(info.click.goBack);
jss();
- $("#info-back").clickOnce(function(){
- try {
- state.set('screen', 'frontpage').validate();
- } catch(e) {alert("Error anonymous in info.enter");alert(e);}
- });
UI().dismiss();
} catch(e) {alert("Error info.enter");alert(e);}
};
+
+info.click = {};
+info.click.goBack = function(){
+ try {
+ state.set('screen', 'frontpage').validate();
+ } catch(e) {alert("Error anonymous in info.enter");alert(e);}
+};
+
+// ==== Code métier pour la page de configuration
+prefs = {};
+
+prefs.jss = function(w,h,iconSize) {
+ try {
+ var p = $("#prefs.screen");
+ var $p = function() {
+ try {
+ return p.find.apply(p,arguments);
+ } catch(e) {alert("Error anonymous 1 in prefs.jss");alert(e);}
+ };
+
+ $("input, label, select")
+ .css("white-space", "nowrap")
+ .css('position', 'absolute')
+ .fitFont(w*0.4, h*0.1);
+ $p("#theme-label").east({left:w/2,top:h*0.25});
+ $p("#theme").west({left:w/2,top:h*0.25});
+ $p("#prefs-cancel").east({left:w*0.45,top:h*0.5});
+ $p("#prefs-apply").west({left:w*0.55,top:h*0.5});
+ } catch(e) {alert("Error prefs.jss");alert(e);}
+}
+
+prefs.enter = function() {
+ try {
+ $("#prefs-form").unbind('submit', prefs.apply).submit(prefs.apply);
+ $("#prefs-cancel").clickOnce(prefs.cancel);
+ jss();
+ UI().dismiss();
+ } catch(e) {alert("Error prefs.enter");alert(e);}
+};
+
+prefs.apply = function(){
+ try {
+ alert($("#theme").val());
+ state.set('screen', 'frontpage').validate();
+ return false;
+ } catch(e) {alert("Error anonymous in prefs.click.apply");alert(e);}
+};
+
+prefs.cancel = function(){
+ try {
+ state.set('screen', 'frontpage').validate();
+ } catch(e) {alert("Error anonymous in prefs.click.cancel");alert(e);}
+};