@@ -103,10 +109,18 @@ function lienurl(s){
}
$(document).ready(function() {
+ var doalert=false; // pas d'alerte au chargement init
var pos = 0;
var lastdate = 0;
var lastday='';
var oldscrollHeight = $("#chatbox")[0].scrollHeight;
+ var whenal=localStorage.getItem('whenal');
+ if (whenal===null) whenal="alno";
+ $("#whenal").val(whenal);
+ $("#whenal").change(function(){
+ whenal=$("#whenal").val();
+ localStorage.setItem('whenal',whenal);
+ });
$("#submitmsg").click(function() {
var clientmsg = $("#usermsg").val();
@@ -118,7 +132,8 @@ function lienurl(s){
data: {text: clientmsg,name:'',room:''},
async: false,
success: function(data) {
- loadLog();
+ doalert=false;
+ loadLog(); // pas d'alerte si propre message
},
error: function(request, status, error) {
$("#usermsg").val(clientmsg);
@@ -166,7 +181,12 @@ function lienurl(s){
html="";
}
}
- $("#chatbox").append(html);
+ $("#chatbox").append(html);
+ if (doalert &&(whenal=="alyes" || ((whenal!=="alno") && !document.hasFocus()))){
+ alert('New message!');
+ }
+ doalert=true; // par défaut, alerte pour les autres cas
+
}
var newscrollHeight = $("#chatbox")[0].scrollHeight;
if (newscrollHeight > oldscrollHeight) {
diff --git a/sources/style.css b/sources/style.css
index 0d0196b..57907da 100644
--- a/sources/style.css
+++ b/sources/style.css
@@ -65,8 +65,6 @@ a:hover { text-decoration: underline; }
#menu { padding: 12.5px 25px 12.5px 25px; }
-.welcome { float: left; }
-
.logout { float: right; }
.tform { display: table; }