perf(web): save hyous to localStorage
This commit is contained in:
parent
ee787dab18
commit
6cd7bb73fe
@ -1,43 +1,66 @@
|
|||||||
var sasahyou = null, sappyou = null, shoppyou = null;
|
var sasahyou = JSON.parse(localStorage["sasahyou"]),
|
||||||
|
sappyou = JSON.parse(localStorage["sappyou"]),
|
||||||
|
shoppyou = JSON.parse(localStorage["shoppyou"]);
|
||||||
|
var sasahyou_mts = parseInt(localStorage["sasahyou_mts"]),
|
||||||
|
sappyou_mts = parseInt(localStorage["sappyou_mts"]),
|
||||||
|
shoppyou_mts = parseInt(localStorage["shoppyou_mts"]);
|
||||||
var current_sasa = null, current_tanzaku = null;
|
var current_sasa = null, current_tanzaku = null;
|
||||||
|
|
||||||
function sasahyou_load() {
|
function sasahyou_load() {
|
||||||
resp = tdb_query("$TFM", 16, "");
|
let db_info = tdb_query("$TFM", 0, "");
|
||||||
if (resp == null) {
|
if (db_info == null || !db_info.status) {
|
||||||
$(location).attr("href", "/auth");
|
alert("Failed to fetch TFM database");
|
||||||
throw new Error("Unauthorized");
|
throw new Error("Failed to fetch TFM database");
|
||||||
}
|
}
|
||||||
if (!resp.status) {
|
if (sasahyou == null || sasahyou_mts !== db_info.data[0].sasahyou_mts) {
|
||||||
alert("Something went wrong");
|
let resp = tdb_query("$TFM", 16, "");
|
||||||
return;
|
if (resp == null || !resp.status) {
|
||||||
|
alert("Failed to get sasahyou");
|
||||||
|
throw new Error("Failed to get sasahyou");
|
||||||
|
}
|
||||||
|
sasahyou = resp.data;
|
||||||
|
sasahyou_mts = db_info.data[0].sasahyou_mts;
|
||||||
|
localStorage["sasahyou"] = JSON.stringify(sasahyou);
|
||||||
|
localStorage["sasahyou_mts"] = sasahyou_mts;
|
||||||
}
|
}
|
||||||
sasahyou = resp.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sappyou_load() {
|
function sappyou_load() {
|
||||||
resp = tdb_query("$TFM", 32, "");
|
let db_info = tdb_query("$TFM", 0, "");
|
||||||
if (resp == null) {
|
if (db_info == null || !db_info.status) {
|
||||||
$(location).attr("href", "/auth");
|
alert("Failed to fetch TFM database");
|
||||||
throw new Error("Unauthorized");
|
throw new Error("Failed to fetch TFM database");
|
||||||
}
|
}
|
||||||
if (!resp.status) {
|
if (sappyou == null || sappyou_mts !== db_info.data[0].sappyou_mts) {
|
||||||
alert("Something went wrong");
|
let resp = tdb_query("$TFM", 32, "");
|
||||||
return;
|
if (resp == null || !resp.status) {
|
||||||
|
alert("Failed to get sappyou");
|
||||||
|
throw new Error("Failed to get sappyou");
|
||||||
|
}
|
||||||
|
sappyou = resp.data;
|
||||||
|
sappyou_mts = db_info.data[0].sappyou_mts;
|
||||||
|
localStorage["sappyou"] = JSON.stringify(sappyou);
|
||||||
|
localStorage["sappyou_mts"] = sappyou_mts;
|
||||||
}
|
}
|
||||||
sappyou = resp.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function shoppyou_load() {
|
function shoppyou_load() {
|
||||||
resp = tdb_query("$TFM", 8, "");
|
let db_info = tdb_query("$TFM", 0, "");
|
||||||
if (resp == null) {
|
if (db_info == null || !db_info.status) {
|
||||||
$(location).attr("href", "/auth");
|
alert("Failed to fetch TFM database");
|
||||||
throw new Error("Unauthorized");
|
throw new Error("Failed to fetch TFM database");
|
||||||
}
|
}
|
||||||
if (!resp.status) {
|
if (shoppyou == null || shoppyou_mts !== db_info.data[0].shoppyou_mts) {
|
||||||
alert("Something went wrong");
|
let resp = tdb_query("$TFM", 8, "");
|
||||||
return;
|
if (resp == null || !resp.status) {
|
||||||
|
alert("Failed to get shoppyou");
|
||||||
|
throw new Error("Failed to get shoppyou");
|
||||||
|
}
|
||||||
|
shoppyou = resp.data;
|
||||||
|
shoppyou_mts = db_info.data[0].shoppyou_mts;
|
||||||
|
localStorage["shoppyou"] = JSON.stringify(shoppyou);
|
||||||
|
localStorage["shoppyou_mts"] = shoppyou_mts;
|
||||||
}
|
}
|
||||||
shoppyou = resp.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).keyup(function (e) {
|
$(document).keyup(function (e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user