replaced localstorage cache with ram cache
This commit is contained in:
@ -49,14 +49,14 @@
|
||||
<label for="obj_height"><%= lang("height") %> </label>
|
||||
<div id="obj_height_value">100см</div>
|
||||
</div>
|
||||
<input style="width: 100%;" type="range" step="0.5" min="1" max="100" id="obj_height" value="100" oninput="obj_size_change('height')">
|
||||
<input style="width: 100%;" type="range" step="1" min="1" max="100" id="obj_height" value="100" oninput="obj_size_change('height')">
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex;width: 100%;justify-content: space-between;">
|
||||
<label for="obj_width"><%= lang("width") %></label>
|
||||
<div id="obj_width_value">100см</div>
|
||||
</div>
|
||||
<input style="width: 100%;" type="range" step="0.5" min="1" max="100" id="obj_width" value="100" oninput="obj_size_change('width')">
|
||||
<input style="width: 100%;" type="range" step="1" min="1" max="100" id="obj_width" value="100" oninput="obj_size_change('width')">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@ -162,6 +162,9 @@
|
||||
setTimeout(()=>{
|
||||
edit_get_objs();
|
||||
},1000)
|
||||
setTimeout(()=>{
|
||||
document.getElementById("obj_resp").innerHTML = "";
|
||||
},3000)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -42,27 +42,11 @@
|
||||
document.getElementById("objs_in_group").innerHTML = "";
|
||||
edit_load_objs((data)=>{
|
||||
data.forEach(value => {
|
||||
console.log(value);
|
||||
// console.log(value);
|
||||
// // console.log($.cookie("cache"));
|
||||
// console.log(localStorage.getItem(`${value["name"]}`));
|
||||
if ($.cookie("cache") == "true"){
|
||||
if (localStorage.getItem(`${value["name"]}`) == null){
|
||||
edit_load_obj(value["name"],"`img`",(odata)=>{
|
||||
localStorage.setItem(value["name"],odata["img"]);
|
||||
make(odata["img"]);
|
||||
})
|
||||
}
|
||||
else{
|
||||
make(localStorage.getItem(value["name"]))
|
||||
}
|
||||
}
|
||||
else{
|
||||
$.cookie("cache","true",{path:"/;SameSite=Strict"})
|
||||
edit_load_obj(value["name"],"`img`",(odata)=>{
|
||||
localStorage.setItem(value["name"],odata["img"]);
|
||||
edit_load_obj(value["name"],"`img`",(odata)=>{
|
||||
make(odata["img"]);
|
||||
})
|
||||
}
|
||||
})
|
||||
function make(img){
|
||||
let obj_list = document.getElementById("objs_in_group");
|
||||
let obj = document.createElement('div');
|
||||
@ -107,7 +91,6 @@
|
||||
img : document.querySelector('#img_prev').src
|
||||
}
|
||||
let changes = {}
|
||||
localStorage.removeItem((cur_atts["name"]+"/g/"+select.options[select.selectedIndex].value).replace(" ","$"));
|
||||
attributes.forEach(element => {
|
||||
// console.log(cur_atts[element],menu.getAttribute(`obj_${element}`));
|
||||
if(element != attributes.at(-1)){
|
||||
@ -145,6 +128,9 @@
|
||||
document.getElementById("obj_resp").innerHTML = ("name was not changed because its taken");
|
||||
}
|
||||
},1000)
|
||||
setTimeout(()=>{
|
||||
document.getElementById("obj_resp").innerHTML = "";
|
||||
},3000)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user