Spaces:
Running
Running
Update history.html
Browse files- history.html +25 -12
history.html
CHANGED
|
@@ -288,19 +288,32 @@
|
|
| 288 |
};
|
| 289 |
|
| 290 |
window.triggerSessionRestoreEngine = function(type, id) {
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
|
| 305 |
window.deleteSingleItemEngine = function(id) {
|
| 306 |
if (confirm("Permanently wipe this message?")) {
|
|
|
|
| 288 |
};
|
| 289 |
|
| 290 |
window.triggerSessionRestoreEngine = function(type, id) {
|
| 291 |
+
// 1. Locate the item to check its internal structure
|
| 292 |
+
let item = localHistoryArray.find(i => String(i.id) === String(id));
|
| 293 |
+
|
| 294 |
+
// 2. Force 'search' type routing if it features an internal text interaction array list
|
| 295 |
+
let trueType = type;
|
| 296 |
+
if (!trueType || trueType === 'undefined' || trueType === 'Search Mode' || trueType === 'Cloudflare Image') {
|
| 297 |
+
if (item && item.interactions) {
|
| 298 |
+
trueType = 'search';
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
const subRoutes = {
|
| 303 |
+
'math': 'maths.html',
|
| 304 |
+
'search': 'search.html',
|
| 305 |
+
'youtube': 'youtube.html',
|
| 306 |
+
'create': 'create.html',
|
| 307 |
+
'translation': 'translator.html',
|
| 308 |
+
'image_translation': 'image.html',
|
| 309 |
+
'qa': 'qa.html',
|
| 310 |
+
'quiz': 'quiz.html'
|
| 311 |
};
|
| 312 |
+
|
| 313 |
+
// 3. Fallback safely to search.html if unsure, instead of kicking to the dashboard index
|
| 314 |
+
const destFile = subRoutes[trueType] || 'search.html';
|
| 315 |
+
window.location.href = `${destFile}?restore=${id}`;
|
| 316 |
+
};
|
| 317 |
|
| 318 |
window.deleteSingleItemEngine = function(id) {
|
| 319 |
if (confirm("Permanently wipe this message?")) {
|