diff --git a/index.html b/index.html
index bfb12c6c..ef720726 100644
--- a/index.html
+++ b/index.html
@@ -78,7 +78,7 @@
Rating: $RATING
Advisory: $ADVISORY
- Current Version: $VERSION (last update: $DATE)
+ Current Version: $VERSION (last update: $DATE)
Price: $PRICE
$IMG
diff --git a/script.js b/script.js
index d884306e..0e559855 100644
--- a/script.js
+++ b/script.js
@@ -76,7 +76,9 @@ function saveConfig() {
data.push(e.id + '=' + encodeURIComponent(value));
}
});
+ const prev = location.hash;
location.hash = '#' + data.join('&');
+ return prev !== location.hash;
}
/*
@@ -166,7 +168,15 @@ function urlsToImgs(list) {
}
function randomIPA() {
- const idx = DB_result[Math.floor(Math.random() * DB_result.length)];
+ if (saveConfig()) {
+ applySearch();
+ }
+ var idx = 0;
+ if (DB_result.length > 0) {
+ idx = DB_result[Math.floor(Math.random() * DB_result.length)];
+ } else {
+ idx = Math.floor(Math.random() * DB.length);
+ }
const entry = entryToDict(DB[idx]);
const output = document.getElementById('content');
output.innerHTML = entriesToStr('.single', [idx]);