Ajout des try/catch manquants.
This commit is contained in:
parent
02b0fbd618
commit
28b06e7dfc
|
@ -129,14 +129,20 @@ function UI () {
|
||||||
window.console && console.log(msg);
|
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) { alert(msg); },
|
info: function(title, msg) {
|
||||||
|
try {
|
||||||
|
alert(msg);
|
||||||
|
} catch(e) {alert("Error UI().info");alert(e);}
|
||||||
|
},
|
||||||
setScreen: function() {},
|
setScreen: function() {},
|
||||||
switchCSS: function(newtheme) {
|
switchCSS: function(newtheme) {
|
||||||
|
try {
|
||||||
$("link[@rel*=stylesheet][title]").each(function(i,e){
|
$("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é…
|
// 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 = true;
|
||||||
e.disabled = (e.getAttribute('title') != newtheme);
|
e.disabled = (e.getAttribute('title') != newtheme);
|
||||||
});
|
});
|
||||||
|
} catch(e) {alert("Error UI().switchCSS");alert(e);}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -149,10 +155,12 @@ function UIInfo(title, msg) {
|
||||||
.qCss('opacity',0)
|
.qCss('opacity',0)
|
||||||
.qShow()
|
.qShow()
|
||||||
.queue(function(next){
|
.queue(function(next){
|
||||||
|
try {
|
||||||
$('#message')
|
$('#message')
|
||||||
.text(msg);
|
.text(msg);
|
||||||
jss();
|
jss();
|
||||||
next();
|
next();
|
||||||
|
} catch(e) {alert("Error anonymous in UIInfo");alert(e);}
|
||||||
})
|
})
|
||||||
.animate({opacity:0.9}, 700)
|
.animate({opacity:0.9}, 700)
|
||||||
.delay(5000)
|
.delay(5000)
|
||||||
|
@ -172,6 +180,7 @@ $(function() {
|
||||||
// ==== Asynchronous Javascript And Json.
|
// ==== Asynchronous Javascript And Json.
|
||||||
ajaj = {};
|
ajaj = {};
|
||||||
ajaj.request = function(url, data, okFunction, smallErrorFunction, bigErrorFunction) {
|
ajaj.request = function(url, data, okFunction, smallErrorFunction, bigErrorFunction) {
|
||||||
|
try {
|
||||||
smallErrorFunction = smallErrorFunction || ajaj.smallError;
|
smallErrorFunction = smallErrorFunction || ajaj.smallError;
|
||||||
bigErrorFunction = bigErrorFunction || ajaj.bigError;
|
bigErrorFunction = bigErrorFunction || ajaj.bigError;
|
||||||
var user = UI().getPreference("user");
|
var user = UI().getPreference("user");
|
||||||
|
@ -180,13 +189,14 @@ ajaj.request = function(url, data, okFunction, smallErrorFunction, bigErrorFunct
|
||||||
// TODO : on transfère le user/passwd à chaque fois ici… c'est pas très bon.
|
// TODO : on transfère le user/passwd à chaque fois ici… c'est pas très bon.
|
||||||
data = $.extend({user:user, passwd:passwd}, data);
|
data = $.extend({user:user, passwd:passwd}, data);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
return $.getJSON(url, data, function(data) {
|
return $.getJSON(url, data, function(data) {
|
||||||
|
try {
|
||||||
if (data && data.isError) {
|
if (data && data.isError) {
|
||||||
smallErrorFunction(data);
|
smallErrorFunction(data);
|
||||||
} else {
|
} else {
|
||||||
okFunction(data);
|
okFunction(data);
|
||||||
}
|
}
|
||||||
|
} catch(e) {alert("Error anonymous in ajaj.request");alert(e);}
|
||||||
}).error(bigErrorFunction);
|
}).error(bigErrorFunction);
|
||||||
} catch(e) {alert("Error ajaj.request");alert(e);}
|
} catch(e) {alert("Error ajaj.request");alert(e);}
|
||||||
}
|
}
|
||||||
|
@ -638,11 +648,13 @@ score.click.jaivu = function() {
|
||||||
info = {};
|
info = {};
|
||||||
|
|
||||||
info.jss = function(w,h,iconSize) {
|
info.jss = function(w,h,iconSize) {
|
||||||
|
try {
|
||||||
$("#info-back-p").css('text-align', 'center');
|
$("#info-back-p").css('text-align', 'center');
|
||||||
$("#info.screen .container input").css('font-size', 'inherit');
|
$("#info.screen .container input").css('font-size', 'inherit');
|
||||||
$("#info.screen .container")
|
$("#info.screen .container")
|
||||||
.fitFont(w*0.9, h*0.9, null, null, true)
|
.fitFont(w*0.9, h*0.9, null, null, true)
|
||||||
.center($("#info.screen"));
|
.center($("#info.screen"));
|
||||||
|
} catch(e) {alert("Error info.jss");alert(e);}
|
||||||
}
|
}
|
||||||
|
|
||||||
info.enter = function() {
|
info.enter = function() {
|
||||||
|
@ -758,12 +770,14 @@ prefs.apply = function(){
|
||||||
key: 'theme',
|
key: 'theme',
|
||||||
value: newtheme
|
value: newtheme
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
|
try {
|
||||||
if (data) {
|
if (data) {
|
||||||
UIInfo("Préférences", "Les préférences ont été enregistrées.");
|
UIInfo("Préférences", "Les préférences ont été enregistrées.");
|
||||||
UI().switchCSS(newtheme);
|
UI().switchCSS(newtheme);
|
||||||
} else {
|
} else {
|
||||||
UIInfo("Préférences", "Les préférences n'ont pas pu être enregistrées.");
|
UIInfo("Préférences", "Les préférences n'ont pas pu être enregistrées.");
|
||||||
}
|
}
|
||||||
|
} catch(e) {alert("Error anonymous in prefs.apply");alert(e);}
|
||||||
});
|
});
|
||||||
state.set('screen', 'frontpage').validate();
|
state.set('screen', 'frontpage').validate();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user