From d9fb485717722cb33a68d640b3593e518b46e69f Mon Sep 17 00:00:00 2001 From: relikd Date: Tue, 27 Feb 2024 20:26:36 +0100 Subject: [PATCH] feat: restore previous search button --- script.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/script.js b/script.js index 5c7b2cc7..56e9beaa 100644 --- a/script.js +++ b/script.js @@ -2,6 +2,7 @@ var DB = []; var DB_result = []; var baseUrls = {}; var PER_PAGE = 30; +var previousSearch = ''; var plistGeneratorUrl = ''; // will append ?d= NodeList.prototype.forEach = Array.prototype.forEach; // fix for < iOS 9.3 @@ -125,8 +126,16 @@ function applySearch() { delete uniqueBundleIds; // free up memory } -function searchByBundleId(sender) { - document.getElementById('bundleid').value = sender.innerText; +function restoreSearch() { + location.hash = previousSearch; + loadConfig(false); + previousSearch = ''; + searchIPA(true); +} + +function searchBundle(idx) { + previousSearch = location.hash; + document.getElementById('bundleid').value = DB[idx][4]; document.getElementById('search').value = ''; document.getElementById('page').value = null; document.getElementById('unique').checked = false; @@ -224,7 +233,11 @@ function printIPA(offset) { if (!offset) { offset = 0; } const total = DB_result.length; - var content = '

Results: ' + total + '

'; + var content = '

Results: ' + total; + if (previousSearch) { + content += ' -- Go to: previous search'; + } + content += '

'; const page = Math.floor(offset / PER_PAGE); const pages = Math.ceil(total / PER_PAGE); if (pages > 1) {