diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d2a4e17..87c948a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,9 +3,12 @@
## In progress release 1.4.3
* FEATURE: (Experimental) PWA is paritcipating in File Handling API origin trial
+* FEATURE: Search with wildcards '.*', '.+' or regex syntax '(?:my_regular_expression)' so long as search begins with normal alphanumeric string
* FIX: Bug which failed to detect images correctly in a new tab
* FIX: Touch-zoom of contents of iframe no longer blanks part of the display
* FIX: Broken zoom of contents of iframe (with UI buttons) in Internet Explorer
+* FIX: Bug setting up backlinks which caused some pages not to load
+* FIX: Unhandled exception when cite ref was not found
## Release 1.4.2
diff --git a/pwabuilder-sw.js b/pwabuilder-sw.js
index b1e13373..d6373389 100644
--- a/pwabuilder-sw.js
+++ b/pwabuilder-sw.js
@@ -4,7 +4,7 @@
// App version number - ENSURE IT MATCHES VALUE IN init.js
// DEV: Changing this will cause the browser to recognize that the Service Worker has changed, and it will download and
// install a new copy
-const appVersion = '1.4.3-rc3';
+const appVersion = '1.4.3-rc4';
// Kiwix ZIM Archive Download Server in regex form
// DEV: The server URL is defined in init.js, but is not available to us in SW
diff --git a/www/index.html b/www/index.html
index e40a8804..6143d957 100644
--- a/www/index.html
+++ b/www/index.html
@@ -127,6 +127,8 @@
Fix bug which failed to detect images correctly in new tab
Touch-zoom of contents of iframe no longer blanks part of the display
Fixed broken zoom of contents of iframe (with UI buttons) in Internet Explorer
+ Enabled search with wildcards '.*', '.+' or regex syntax '(?:my_regular_expression)': NB search must begin with normal alphanumeric string
+ Fixed bug setting up backlinks which caused some pages not to load
Full changelog...
diff --git a/www/js/app.js b/www/js/app.js
index 1b35b64a..39edd179 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -3588,9 +3588,14 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
//Setup endnote backlinks if the ZIM doesn't have any
htmlArticle = htmlArticle.replace(/]+id=["']cite[-_]note[-_]([^"']+)[^>]+>(?![^/]+?[↑^])/ig, function (match, id) {
- var fnSearchRegxp = new RegExp('id=["' + "'](cite[-_]ref[-_]" + id.replace(/[-_()+]/g, "[-_()]+") + '[^"' + "']*)", 'i');
- var fnReturnMatch = htmlArticle.match(fnSearchRegxp);
- var fnReturnID = fnReturnMatch ? fnReturnMatch[1] : "";
+ var fnReturnMatch = '';
+ try {
+ var fnSearchRegxp = new RegExp('id=["' + "'](cite[-_]ref[-_]" + id.replace(/[-_()+?]/g, "[-_()]+?") + '[^"' + "']*)", 'i');
+ fnReturnMatch = htmlArticle.match(fnSearchRegxp);
+ } catch (err) {
+ console.error('Error constructiong regular expression in app.js', err);
+ }
+ var fnReturnID = fnReturnMatch ? fnReturnMatch[1] : '';
return match + '\r\n^ ';
});
@@ -3823,8 +3828,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
reference.addEventListener("click", function (obj) {
var refID = obj.target.hash || obj.target.parentNode.hash;
if (!refID) return;
- refID = refID.replace(/#/, "");
- var refLocation = articleDocument.getElementById(refID);
+ var refLocation = docBody.querySelector(refID);
+ if (!refLocation) return;
// In some ZIMs the id is in the parent node or in the parent of the parent
var returnID = obj.target.id || obj.target.parentNode.id || obj.target.parentNode.parentNode.id;
// Add backlink to refLocation if missing
diff --git a/www/js/init.js b/www/js/init.js
index bfdf7593..25334d6c 100644
--- a/www/js/init.js
+++ b/www/js/init.js
@@ -49,7 +49,7 @@ var params = {};
*/
var appstate = {};
/******** UPDATE VERSION IN pwabuilder-sw.js TO MATCH VERSION AND CHECK PWASERVER BELOW!!!!!!! *******/
-params['version'] = "1.4.3-rc3"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js
+params['version'] = "1.4.3-rc4"; //DEV: Manually update this version when there is a new release: it is compared to the Settings Store "version" in order to show first-time info, and the cookie is updated in app.js
/******* UPDATE THIS ^^^^^^ IN service worker AND PWA-SERVER BELOW !! ********************/
params['packagedFile'] = getSetting('packagedFile') || "wikipedia_en_100_maxi_2021-05.zim"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
params['archivePath'] = "archives"; //The directory containing the packaged archive(s) (relative to app's root directory)
diff --git a/www/js/lib/zimArchive.js b/www/js/lib/zimArchive.js
index 0be505a7..29c0e26b 100644
--- a/www/js/lib/zimArchive.js
+++ b/www/js/lib/zimArchive.js
@@ -230,7 +230,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
prefixVariants = prefixVariants.slice(1);
search.resultSize = resultSize - dirEntries.length;
// Search window sets an upper limit on how many matching dirEntries will be scanned in a full index search
- var searchWindow = search.rgxPrefix ? 250000 : resultSize;
+ var searchWindow = search.rgxPrefix ? 10000 * resultSize : resultSize;
that.findDirEntriesWithPrefixCaseSensitive(prefix, searchWindow, search,
function (newDirEntries, idx, interim) {
if (search.status === 'cancelled') return callback([], search.status);