Benjamin Renard commited on 2014-01-12 02:05:14
Showing 1 changed files, with 16 additions and 1 deletions.
| ... | ... |
@@ -3,13 +3,28 @@ function GroupList() {
|
| 3 | 3 |
lastChange=0; |
| 4 | 4 |
|
| 5 | 5 |
this.loadFromLocalStorage=function() {
|
| 6 |
- if (localStorage.groups!==undefined) {
|
|
| 6 |
+ if (jQuery.type(localStorage.groups)!='undefined') {
|
|
| 7 |
+ try {
|
|
| 7 | 8 |
var data=JSON.parse(localStorage.groups); |
| 8 | 9 |
this.lastChange=data.lastChange; |
| 9 | 10 |
for (el in data.groups) {
|
| 10 | 11 |
this[el]=new Group(el,data.groups[el]); |
| 11 | 12 |
} |
| 12 | 13 |
} |
| 14 |
+ catch(e) {
|
|
| 15 |
+ for (el in this) {
|
|
| 16 |
+ if (this.isGroup(this[el])) {
|
|
| 17 |
+ delete this[el]; |
|
| 18 |
+ } |
|
| 19 |
+ } |
|
| 20 |
+ myconfirm('Erreur en chargeant les données locales. On les purges ?',
|
|
| 21 |
+ function(data) {
|
|
| 22 |
+ delete localStorage.groups; |
|
| 23 |
+ location.reload(); |
|
| 24 |
+ } |
|
| 25 |
+ ); |
|
| 26 |
+ } |
|
| 27 |
+ } |
|
| 13 | 28 |
} |
| 14 | 29 |
|
| 15 | 30 |
this.export=function() {
|
| 16 | 31 |