|
@@ -231,6 +231,7 @@ $(document).ready(function(){
|
231
|
231
|
|
232
|
232
|
function onFocus(){
|
233
|
233
|
document.body.className = 'focused';
|
|
234
|
+ do_action_body_focused();
|
234
|
235
|
}
|
235
|
236
|
|
236
|
237
|
if (/*@cc_on!@*/false) { // check for Internet Explorer
|
|
@@ -1170,35 +1171,51 @@ $(document).ready(function(){
|
1170
|
1171
|
////////////////////////////////////////
|
1171
|
1172
|
/// Gestion de nouveaux éléments
|
1172
|
1173
|
|
|
1174
|
+ do_check_new_elements = false;
|
|
1175
|
+
|
1173
|
1176
|
function check_new_elements()
|
1174
|
1177
|
{
|
1175
|
1178
|
if ($('ul.elements li').length)
|
1176
|
1179
|
{
|
1177
|
|
- var url = url_element_new_count
|
1178
|
|
- +'/'
|
1179
|
|
- +str_replace('element_', '', $('ul.elements li:first').attr('id'))
|
1180
|
|
- ;
|
1181
|
|
- $.getJSON(url, function(response){
|
|
1180
|
+ console.log('?');
|
|
1181
|
+ // Si l'utilisateur a quitté la page on reporte le check
|
|
1182
|
+ if ($('body.blurred').length)
|
|
1183
|
+ {
|
|
1184
|
+ // on passe la variable a vrai de façon a ce que lorsque la page
|
|
1185
|
+ // et ré affiché on lance le check
|
|
1186
|
+ do_check_new_elements = true;
|
|
1187
|
+ console.log('on repassera');
|
|
1188
|
+ }
|
|
1189
|
+ else
|
|
1190
|
+ {
|
|
1191
|
+ console.log('on fait');
|
|
1192
|
+ var url = url_element_new_count
|
|
1193
|
+ +'/'
|
|
1194
|
+ +str_replace('element_', '', $('ul.elements li:first').attr('id'))
|
|
1195
|
+ ;
|
|
1196
|
+ $.getJSON(url, function(response){
|
1182
|
1197
|
|
1183
|
|
- if (response.status == 'mustbeconnected')
|
1184
|
|
- {
|
1185
|
|
- $(location).attr('href', url_index);
|
1186
|
|
- }
|
|
1198
|
+ if (response.status == 'mustbeconnected')
|
|
1199
|
+ {
|
|
1200
|
+ $(location).attr('href', url_index);
|
|
1201
|
+ }
|
1187
|
1202
|
|
1188
|
|
- if (response.status == 'success' && response.count)
|
1189
|
|
- {
|
1190
|
|
- $('div.display_more_elements').show();
|
1191
|
|
- $('div.display_more_elements span').html(response.message);
|
1192
|
|
- }
|
|
1203
|
+ if (response.status == 'success' && response.count)
|
|
1204
|
+ {
|
|
1205
|
+ $('div.display_more_elements').show();
|
|
1206
|
+ $('div.display_more_elements span').html(response.message);
|
|
1207
|
+ }
|
1193
|
1208
|
|
1194
|
|
- setTimeout(check_new_elements, 300000);
|
1195
|
|
- });
|
|
1209
|
+ setTimeout(check_new_elements, 150000);
|
|
1210
|
+ });
|
|
1211
|
+ }
|
|
1212
|
+
|
1196
|
1213
|
}
|
1197
|
1214
|
}
|
1198
|
1215
|
|
1199
|
1216
|
if ($('div.display_more_elements').length)
|
1200
|
1217
|
{
|
1201
|
|
- setTimeout(check_new_elements, 300000);
|
|
1218
|
+ setTimeout(check_new_elements, 150000);
|
1202
|
1219
|
}
|
1203
|
1220
|
|
1204
|
1221
|
$('a.show_new_elements').live('click', function(){
|
|
@@ -1251,5 +1268,16 @@ $(document).ready(function(){
|
1251
|
1268
|
}
|
1252
|
1269
|
});
|
1253
|
1270
|
}
|
|
1271
|
+
|
|
1272
|
+ /*
|
|
1273
|
+ * Action a effectuer lorsque l'utilisateur met le focus sur la page
|
|
1274
|
+ */
|
|
1275
|
+ function do_action_body_focused()
|
|
1276
|
+ {
|
|
1277
|
+ if (do_check_new_elements)
|
|
1278
|
+ {
|
|
1279
|
+ check_new_elements();
|
|
1280
|
+ }
|
|
1281
|
+ }
|
1254
|
1282
|
|
1255
|
1283
|
});
|