mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
wrapping localStorage.key(n) in try { ... } block to not break in FF
This commit is contained in:
parent
f583d510c1
commit
08f0fbc523
@ -161,10 +161,12 @@ window.zerobin = {
|
|||||||
|
|
||||||
getKeys: function(){
|
getKeys: function(){
|
||||||
var keys = [];
|
var keys = [];
|
||||||
if(localStorage.key(i) !== null){
|
|
||||||
keys[i] = parseInt(localStorage.key(i), 10);
|
|
||||||
}
|
|
||||||
for(var i = 0; i < localStorage.length; i++){
|
for(var i = 0; i < localStorage.length; i++){
|
||||||
|
try {
|
||||||
|
if(localStorage.key(i) !== null){
|
||||||
|
keys[i] = parseInt(localStorage.key(i), 10);
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
return keys.sort(zerobin.numOrdA);
|
return keys.sort(zerobin.numOrdA);
|
||||||
},
|
},
|
||||||
@ -222,15 +224,17 @@ window.zerobin = {
|
|||||||
date = zerobin.getFormatedDate();
|
date = zerobin.getFormatedDate();
|
||||||
keys.reverse();
|
keys.reverse();
|
||||||
|
|
||||||
var paste = localStorage.getItem(keys[i]).split(';');
|
|
||||||
var displayDate = paste[0].split(' ')[0];
|
|
||||||
var prefix = 'the ';
|
|
||||||
if (displayDate === date){
|
|
||||||
displayDate = paste[0].split(' ')[1];
|
|
||||||
prefix = 'at ';
|
|
||||||
}
|
|
||||||
pastes.push({displayDate: displayDate, prefix: prefix, link: paste[1]});
|
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
|
try {
|
||||||
|
var paste = localStorage.getItem(keys[i]).split(';');
|
||||||
|
var displayDate = paste[0].split(' ')[0];
|
||||||
|
var prefix = 'the ';
|
||||||
|
if (displayDate === date){
|
||||||
|
displayDate = paste[0].split(' ')[1];
|
||||||
|
prefix = 'at ';
|
||||||
|
}
|
||||||
|
pastes.push({displayDate: displayDate, prefix: prefix, link: paste[1]});
|
||||||
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pastes;
|
return pastes;
|
||||||
|
Loading…
Reference in New Issue
Block a user