This commit is contained in:
TheGiddyLimit
2024-01-06 14:47:30 +00:00
parent 0a4253c9f0
commit e3bf75f42a
48 changed files with 14038 additions and 524 deletions

View File

@@ -170,7 +170,7 @@ class NavBar {
NavBar._CAT_CACHE,
{
html: "Preload Adventure Text <small>(50MB+)</small>",
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, /data\/adventure/),
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, {route: /data\/adventure/}),
title: "Preload adventure text for offline use.",
},
);
@@ -178,7 +178,7 @@ class NavBar {
NavBar._CAT_CACHE,
{
html: "Preload Book Images <small>(1GB+)</small>",
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, /img\/book/),
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, {route: /img\/book/, isRequireImages: true}),
title: "Preload book images offline use. Note that book text is preloaded automatically.",
},
);
@@ -186,7 +186,7 @@ class NavBar {
NavBar._CAT_CACHE,
{
html: "Preload Adventure Text and Images <small>(2GB+)</small>",
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, /(?:data|img)\/adventure/),
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, {route: /(?:data|img)\/adventure/, isRequireImages: true}),
title: "Preload adventure text and images for offline use.",
},
);
@@ -194,7 +194,7 @@ class NavBar {
NavBar._CAT_CACHE,
{
html: "Preload All Images <small>(4GB+)</small>",
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, /img/),
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, {route: /img/, isRequireImages: true}),
title: "Preload all images for offline use.",
},
);
@@ -202,7 +202,7 @@ class NavBar {
NavBar._CAT_CACHE,
{
html: "Preload All <small>(5GB+)</small>",
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, /./),
click: (evt) => NavBar.InteractionManager._pOnClick_button_preloadOffline(evt, {route: /./, isRequireImages: true}),
title: "Preload everything for offline use.",
},
);
@@ -811,7 +811,7 @@ NavBar.InteractionManager = class {
}
}
static async _pOnClick_button_preloadOffline (evt, route) {
static async _pOnClick_button_preloadOffline (evt, {route, isRequireImages = false}) {
evt.preventDefault();
if (globalThis.swCacheRoutes === undefined) {
@@ -819,6 +819,14 @@ NavBar.InteractionManager = class {
return;
}
if (isRequireImages && globalThis.DEPLOYED_IMG_ROOT) {
JqueryUtil.doToast({
type: "danger",
content: `The "${evt.currentTarget.innerText.split("(")[0].trim()}" option is not currently supported on this site version. Try again some other time!`,
});
return;
}
globalThis.swCacheRoutes(route);
}