mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-24 03:40:19 +00:00
22 lines
779 B
PHP
Executable File
22 lines
779 B
PHP
Executable File
<script>
|
|
function isArray(obj) {
|
|
return typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == '[object array]' && typeof obj.length == "number";
|
|
}
|
|
|
|
function isJson(obj) {
|
|
return typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && typeof obj.length == "undefined";
|
|
}
|
|
|
|
let storages = {!! $value !!};
|
|
if (isArray(storages)) {
|
|
storages.forEach(storage => {
|
|
window.localStorage.setItem(`__system:${storage.key}__`, storage.value);
|
|
})
|
|
} else if (isJson(storages)) {
|
|
for (let key in storages) {
|
|
let value = storages[key];
|
|
window.localStorage.setItem(`__system:${key}__`, value);
|
|
}
|
|
}
|
|
</script>
|