Merge branch 'unstable' of https://github.com/jsmaniac/2011-m1s2-ter into unstable
This commit is contained in:
commit
ec4b21e7fb
|
@ -3,40 +3,10 @@
|
|||
<head>
|
||||
<title>PtiClic pre-alpha 0.2</title>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
html, body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.screen {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#splash.screen {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mn-caption-block {
|
||||
border-top-width: medium;
|
||||
border-top-style: solid;
|
||||
border-bottom-width: medium;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
.relationBox {
|
||||
border-width: thin;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.clearboth {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.frontpage-button {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="ressources/green.css" />
|
||||
<meta name="viewport" content="target-densitydpi=device-dpi" />
|
||||
<style>.screen { display: none; }</style>
|
||||
<link rel="stylesheet" href="ressources/green.css" title="green" />
|
||||
<link rel="alternate stylesheet" href="ressources/black.css" title="black" />
|
||||
<script src="ressources/jquery-1.5.1.min.js"></script>
|
||||
<script src="ressources/jquery-ui-1.8.11.custom.min.js"></script>
|
||||
<script src="ressources/jquery.ba-hashchange.min.js"></script>
|
||||
|
@ -45,6 +15,7 @@ html, body {
|
|||
<script src="ressources/pticlic.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="nojs">Chargement…</div>
|
||||
<div class="screen" id="splash">
|
||||
<img src="ressources/img/splash.png" />
|
||||
</div>
|
||||
|
@ -144,6 +115,8 @@ html, body {
|
|||
<span class="word"></span> (<span class="score"></span>)
|
||||
</div>
|
||||
</div>
|
||||
<div id="message" style="display: none;">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
|
|
|
@ -772,13 +772,13 @@ function getUserInfo($user, $key) {
|
|||
}
|
||||
|
||||
function setUserInfo($user, $key, $value) {
|
||||
getDB()->exec("UPDATE user_info SET value = '".SQLite3::escapeString($value)
|
||||
."' WHERE user = '".SQLite3::escapeString($user)
|
||||
."' AND key = '".SQLite3::escapeString($key)."';");
|
||||
getDB()->exec("INSERT OR REPLACE INTO user_info(user, key, value) values('".SQLite3::escapeString($user)
|
||||
."', '".SQLite3::escapeString($key)
|
||||
."', '".SQLite3::escapeString($value)."');");
|
||||
}
|
||||
|
||||
function userPrefsDefaults() {
|
||||
$prefs = Array(
|
||||
return Array(
|
||||
"theme" => "green"
|
||||
);
|
||||
}
|
||||
|
@ -793,8 +793,12 @@ function userPrefs($user) {
|
|||
}
|
||||
|
||||
function setUserPref($user, $key, $value) {
|
||||
if (array_key_exists($key, userPrefsDefaults()))
|
||||
if (array_key_exists($key, userPrefsDefaults())) {
|
||||
setUserInfo($user, $key, $value);
|
||||
echo 'true';
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -5,6 +5,10 @@ html, body {
|
|||
color: white;
|
||||
}
|
||||
|
||||
#nojs {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.screen {
|
||||
background-color: black;
|
||||
}
|
||||
|
@ -26,7 +30,7 @@ html, body {
|
|||
background-color: #222222;
|
||||
}
|
||||
|
||||
.relationBox {
|
||||
#message, .relationBox {
|
||||
border-color: #cccccc;
|
||||
background-color: #222222;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,10 @@ html, body {
|
|||
color: black;
|
||||
}
|
||||
|
||||
#nojs {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.screen {
|
||||
background-color: #FFFFE0;
|
||||
}
|
||||
|
@ -26,7 +30,7 @@ html, body {
|
|||
background-color: #F0F8D0;
|
||||
}
|
||||
|
||||
.relationBox {
|
||||
#message, .relationBox {
|
||||
border-color: #44AA44;
|
||||
background-color: #F0F8D0;
|
||||
}
|
||||
|
|
|
@ -95,8 +95,9 @@ function queueize(method) {
|
|||
try {
|
||||
return function() {
|
||||
var $this = this;
|
||||
var args = arguments;
|
||||
return this.queue(function(next) {
|
||||
$this[method].apply($this,arguments);
|
||||
$this[method].apply($this,args);
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
@ -105,6 +106,9 @@ function queueize(method) {
|
|||
|
||||
$.fn.qAddClass = queueize("addClass");
|
||||
$.fn.qRemoveClass = queueize("removeClass");
|
||||
$.fn.qShow = queueize("show");
|
||||
$.fn.qHide = queueize("hide");
|
||||
$.fn.qCss = queueize("css");
|
||||
|
||||
$.fn.wh = function(w, h) {
|
||||
try {
|
||||
|
|
|
@ -66,6 +66,22 @@ function jss() {
|
|||
else if(h > 500) iconSize = 48;
|
||||
else iconSize = 36;
|
||||
|
||||
$('#nojs').hide();
|
||||
|
||||
$('#message:visible')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
borderWidth: 'thin',
|
||||
borderStyle: 'solid',
|
||||
MozBorderRadius: 10,
|
||||
WebkitBorderRadius: 10,
|
||||
padding: 10,
|
||||
textAlign: 'center'
|
||||
})
|
||||
.wh(w/2, h*0.1)
|
||||
.fitFont(w/2, h*0.1)
|
||||
.center({left: w/2, top:h*0.1});
|
||||
|
||||
$("#"+state.screen+".screen")
|
||||
.wh(w, h)
|
||||
.northWest({top:0,left:0});
|
||||
|
@ -78,6 +94,8 @@ function jss() {
|
|||
textAlign: "left"
|
||||
});
|
||||
|
||||
$(".clearboth").css('clear', 'both');
|
||||
|
||||
$(".screen").hide();
|
||||
$("#"+state.screen+".screen").show();
|
||||
|
||||
|
@ -109,9 +127,24 @@ function UI () {
|
|||
log: function(msg) {
|
||||
try {
|
||||
window.console && console.log(msg);
|
||||
} catch(e) {alert("Error UI.log");alert(e);}
|
||||
} catch(e) {alert("Error UI().log");alert(e);}
|
||||
},
|
||||
info: function(title, msg) {
|
||||
try {
|
||||
$('#message')
|
||||
.qCss('opacity',0)
|
||||
.qShow()
|
||||
.queue(function(next){
|
||||
$('#message')
|
||||
.text(msg);
|
||||
jss();
|
||||
next();
|
||||
})
|
||||
.animate({opacity:0.9}, 700)
|
||||
.delay(1000)
|
||||
.animate({opacity:0}, 700);
|
||||
} catch(e) {alert("Error UI().info");alert(e);}
|
||||
},
|
||||
info: function(title, msg) { alert(msg); },
|
||||
setScreen: function() {}
|
||||
};
|
||||
}
|
||||
|
@ -338,7 +371,10 @@ game.jss = function(w, h, iconSize) {
|
|||
.fitIn("#mc-caption-block", 0.1);
|
||||
|
||||
$g("#mn-caption-block")
|
||||
.css({borderWidth: h/100})
|
||||
.css({
|
||||
borderWidth: h/100,
|
||||
borderStyle: 'solid none'
|
||||
})
|
||||
.wh(w, mnh)
|
||||
.north($g("#mc-caption-block").south());
|
||||
|
||||
|
@ -351,7 +387,9 @@ game.jss = function(w, h, iconSize) {
|
|||
margin: 10,
|
||||
padding: 10,
|
||||
MozBorderRadius: 10,
|
||||
WebkitBorderRadius: 10
|
||||
WebkitBorderRadius: 10,
|
||||
borderWidth: 'thin',
|
||||
borderStyle: 'solid',
|
||||
});
|
||||
|
||||
$g(".relationBox:visible .icon")
|
||||
|
@ -598,11 +636,11 @@ connection.jss = function(w, h, iconSize) {
|
|||
$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});
|
||||
$c("#user").west({left:w/2,top:h*0.25});
|
||||
$c("#passwd-label").east({left:w/2,top:h*0.5});
|
||||
$c("#passwd").west({left:w/2,top:h*0.5});
|
||||
.fitFont(w*0.3, h*0.06);
|
||||
$c("#user-label").east({left:w*0.45,top:h*0.25});
|
||||
$c("#user").west({left:w*0.55,top:h*0.25});
|
||||
$c("#passwd-label").east({left:w*0.45,top:h*0.5});
|
||||
$c("#passwd").west({left:w*0.55,top:h*0.5});
|
||||
$c("#connect").center({left:w/2,top:h*0.75});
|
||||
} catch(e) {alert("Error connection.jss");alert(e);}
|
||||
};
|
||||
|
@ -682,9 +720,9 @@ prefs.jss = function(w,h,iconSize) {
|
|||
$("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});
|
||||
.fitFont(w*0.3, h*0.06);
|
||||
$p("#theme-label").east({left:w*0.45,top:h*0.25});
|
||||
$p("#theme").west({left:w*0.55,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);}
|
||||
|
@ -701,14 +739,32 @@ prefs.enter = function() {
|
|||
|
||||
prefs.apply = function(){
|
||||
try {
|
||||
alert($("#theme").val());
|
||||
var newtheme = $("#theme").val();
|
||||
ajaj.request("server.php?callback=?", {
|
||||
action: 8,
|
||||
key: 'theme',
|
||||
value: newtheme
|
||||
}, function(data) {
|
||||
if (data)
|
||||
UI().info("Préférences", "Les préférences ont été enregistrées.");
|
||||
else
|
||||
UI().info("Préférences", "Les préférences n'ont pas pu être enregistrées.");
|
||||
});
|
||||
$("link[@rel*=stylesheet][title]").each(function(i,e){
|
||||
// Il semblerait que pour qu'un "aleternate stylesheet" puisse être activé, il faut d'abord qu'il ait été désactivé…
|
||||
e.disabled = true;
|
||||
e.disabled = (e.getAttribute('title') != newtheme);
|
||||
});
|
||||
state.set('screen', 'frontpage').validate();
|
||||
return false;
|
||||
} catch(e) {alert("Error anonymous in prefs.click.apply");alert(e);}
|
||||
} catch(e) {alert("Error anonymous in prefs.apply");alert(e);}
|
||||
};
|
||||
|
||||
function switchStylestyle(styleName) {
|
||||
}
|
||||
|
||||
prefs.cancel = function(){
|
||||
try {
|
||||
state.set('screen', 'frontpage').validate();
|
||||
} catch(e) {alert("Error anonymous in prefs.click.cancel");alert(e);}
|
||||
} catch(e) {alert("Error anonymous in prefs.cancel");alert(e);}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user