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(){
|
||||
var keys = [];
|
||||
for(var i = 0; i < localStorage.length; i++){
|
||||
try {
|
||||
if(localStorage.key(i) !== null){
|
||||
keys[i] = parseInt(localStorage.key(i), 10);
|
||||
}
|
||||
for(var i = 0; i < localStorage.length; i++){
|
||||
} catch(e) {}
|
||||
}
|
||||
return keys.sort(zerobin.numOrdA);
|
||||
},
|
||||
@ -222,6 +224,8 @@ window.zerobin = {
|
||||
date = zerobin.getFormatedDate();
|
||||
keys.reverse();
|
||||
|
||||
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 ';
|
||||
@ -230,7 +234,7 @@ window.zerobin = {
|
||||
prefix = 'at ';
|
||||
}
|
||||
pastes.push({displayDate: displayDate, prefix: prefix, link: paste[1]});
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
return pastes;
|
||||
|
Loading…
Reference in New Issue
Block a user