Skip to content

Commit 7b25b61

Browse files
committed
updated lite
1 parent 9b32482 commit 7b25b61

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

klite.embd

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,9 @@ Current version indicated by LITEVER below.
582582
overflow-y: auto;
583583
white-space: pre-wrap;
584584
}
585+
#gametext, chunk, chunk * {
586+
outline: 0px solid transparent;
587+
}
585588
#gametext img {
586589
max-width: 100%;
587590
height: auto;
@@ -3969,7 +3972,13 @@ initializeInstructUIFunctionality();
39693972
objdatastr = (objdatastr?String(objdatastr):"");
39703973
let fallbackSave = function()
39713974
{
3972-
localStorage.setItem(STORAGE_PREFIX + objkey, objdatastr);
3975+
try {
3976+
localStorage.setItem(STORAGE_PREFIX + objkey, objdatastr);
3977+
}
3978+
catch(error)
3979+
{
3980+
console.log(`Localstorage failed to save!`);
3981+
}
39733982
resolve();
39743983
}
39753984
const isIndexedDBSupported = !!window.indexedDB;
@@ -4010,7 +4019,12 @@ initializeInstructUIFunctionality();
40104019
const storeRequest = store.put({ key: objkey, value: objdatastr });
40114020

40124021
storeRequest.onsuccess = function () {
4013-
localStorage.setItem(STORAGE_PREFIX + objkey, "offload_to_indexeddb"); //indicate its been offloaded
4022+
try {
4023+
localStorage.setItem(STORAGE_PREFIX + objkey, "offload_to_indexeddb"); //indicate its been offloaded
4024+
}
4025+
catch (error) {
4026+
console.log(`Localstorage failed to save!`);
4027+
}
40144028
resolve();
40154029
};
40164030
storeRequest.onerror = function (event) {
@@ -4038,11 +4052,19 @@ initializeInstructUIFunctionality();
40384052

40394053
let fallbackResolveLoad = function() //if indexeddb fails
40404054
{
4041-
let fallbackval = localStorage.getItem(STORAGE_PREFIX + objkey, defaultvalue);
4055+
let fallbackval = null;
4056+
try {
4057+
fallbackval = localStorage.getItem(STORAGE_PREFIX + objkey, defaultvalue);
4058+
} catch (error) {
4059+
console.log(`Localstorage failed to load!`);
4060+
fallbackval = defaultvalue;
4061+
}
40424062
if(fallbackval=="offload_to_indexeddb") //value was offloaded but we cant read it. return default
40434063
{
4044-
resolve(defaultvalue);
4064+
fallbackval = defaultvalue;
40454065
}
4066+
resolve(fallbackval);
4067+
return;
40464068
}
40474069

40484070
const isIndexedDBSupported = !!window.indexedDB;
@@ -4054,7 +4076,14 @@ initializeInstructUIFunctionality();
40544076
}
40554077

40564078
//if value is not offloaded, return it immediately
4057-
let testval = localStorage.getItem(STORAGE_PREFIX + objkey, defaultvalue);
4079+
let testval = null;
4080+
try {
4081+
testval = localStorage.getItem(STORAGE_PREFIX + objkey, defaultvalue);
4082+
} catch (error) {
4083+
console.log(`Localstorage failed to load!`);
4084+
resolve(defaultvalue);
4085+
return;
4086+
}
40584087
if(testval!="offload_to_indexeddb")
40594088
{
40604089
console.log(`Value not offloaded to indexeddb! Fallback to localstorage.`);

0 commit comments

Comments
 (0)