diff --git a/service-worker.js b/service-worker.js
index ee5347d0..75460f3c 100644
--- a/service-worker.js
+++ b/service-worker.js
@@ -102,6 +102,7 @@ let precacheFiles = [
".", // This caches the redirect to www/index.html, in case a user launches the app from its root directory
"manifest.json",
"service-worker.js",
+ "www/favicon.ico",
"www/-/mw/ext.cite.styles.css",
"www/-/mw/ext.cite.ux-enhancements.css",
"www/-/mw/ext.math.scripts.css",
diff --git a/www/favicon.ico b/www/favicon.ico
index 281a01da..3a94fa8e 100644
Binary files a/www/favicon.ico and b/www/favicon.ico differ
diff --git a/www/img/icons/favicon-16x16.png b/www/img/icons/favicon-16x16.png
new file mode 100644
index 00000000..c38c6cd2
Binary files /dev/null and b/www/img/icons/favicon-16x16.png differ
diff --git a/www/img/icons/favicon-192x192.png b/www/img/icons/favicon-192x192.png
new file mode 100644
index 00000000..b6ab778e
Binary files /dev/null and b/www/img/icons/favicon-192x192.png differ
diff --git a/www/img/icons/favicon-270x270.png b/www/img/icons/favicon-270x270.png
new file mode 100644
index 00000000..9e29b8e0
Binary files /dev/null and b/www/img/icons/favicon-270x270.png differ
diff --git a/www/img/icons/favicon-32x32.png b/www/img/icons/favicon-32x32.png
new file mode 100644
index 00000000..461aa5ef
Binary files /dev/null and b/www/img/icons/favicon-32x32.png differ
diff --git a/www/index.html b/www/index.html
index 5ecd9b70..817c8eb0 100644
--- a/www/index.html
+++ b/www/index.html
@@ -38,6 +38,10 @@
-->
+
+
+
+
diff --git a/www/js/app.js b/www/js/app.js
index 4c5b88f1..4065e9c7 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -3817,8 +3817,8 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
// to support to this regex. The "zip" has been added here as an example of how to support further filetypes
var regexpDownloadLinks = /^.*?\.epub($|\?)|^.*?\.pdf($|\?)|^.*?\.zip($|\?)/i;
- // This matches the data-kiwixurl of all tags containing rel="stylesheet" in raw HTML unless commented out
- var regexpSheetHref = /(]*rel\s*=\s*["']stylesheet)[^>]*(?:href|data-kiwixurl)\s*=\s*["'])([^"']+)(["'][^>]*>)(?!\s*--\s*>)/ig;
+ // This matches the data-kiwixurl of all tags containing rel="stylesheet" or "...icon" in raw HTML unless commented out
+ var regexpSheetHref = /(]*rel\s*=\s*["'](?:stylesheet|[^"']*icon))[^>]*(?:href|data-kiwixurl)\s*=\s*["'])([^"']+)(["'][^>]*>)(?!\s*--\s*>)/ig;
// A string to hold any anchor parameter in clicked ZIM URLs (as we must strip these to find the article in the ZIM)
var anchorParameter;
@@ -4163,8 +4163,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett
cache.getItemFromCacheOrZIM(appstate.selectedArchive, cacheKey).then(function (content) {
//DEV: Uncomment line below and break on next to capture cssContent for local filesystem cache
//var cssContent = util.uintToString(content);
+ var mimetype = /\.ico$/i.test(title) ? 'image' : 'text/css';
var cssBlob = new Blob([content], {
- type: 'text/css'
+ type: mimetype
});
var newURL = [title, URL.createObjectURL(cssBlob)];
blobArray.push(newURL);
diff --git a/www/js/lib/cache.js b/www/js/lib/cache.js
index 7df223aa..0e0f3078 100644
--- a/www/js/lib/cache.js
+++ b/www/js/lib/cache.js
@@ -31,7 +31,7 @@ define(['settingsStore', 'uiUtil'], function(settingsStore, uiUtil) {
// DEV: Regex below defines the permitted key types for the cache; add further types as needed
// @TODO: Revise for use with no-namespace ZIMs (maybe this becomes useless?)
// NB: The key type of '.zim', or '.zimaa' (etc.) is used to store a ZIM's last-accessed article
- var regexpKeyTypes = /(?:(?:^|\/)[AC]\/.+|\.[Jj][Ss]|\.[Cc][Ss][Ss]|\.[Zz][Ii][Mm]\w{0,2})$/;
+ var regexpKeyTypes = /(?:(?:^|\/)[AC]\/.+|\.[Jj][Ss]|\.[Cc][Ss][Ss]|\.[Ii][Cc][Oo]|\.[Zz][Ii][Mm]\w{0,2})$/;
/**
* Tests the enviornment's caching capabilities and sets assetsCache.capability to the supported level
@@ -455,9 +455,6 @@ define(['settingsStore', 'uiUtil'], function(settingsStore, uiUtil) {
resolve(result);
return;
}
- // Set the read function to use according to filetype
- var readFile = regexpKeyTypes.test(title) ?
- selectedArchive.readUtf8File : selectedArchive.readBinaryFile;
// Bypass getting dirEntry if we already have it
var getDirEntry = dirEntry ? Promise.resolve() :
selectedArchive.getDirEntryByPath(title);
@@ -476,6 +473,9 @@ define(['settingsStore', 'uiUtil'], function(settingsStore, uiUtil) {
var shortTitle = key.replace(/[^/]+\//g, '').substring(0, 18);
uiUtil.pollSpinner('Getting ' + shortTitle + '...');
}
+ // Set the read function to use according to filetype
+ var readFile = /^text\//i.test(mimetype) ?
+ selectedArchive.readUtf8File : selectedArchive.readBinaryFile;
readFile(resolvedDirEntry, function (fileDirEntry, content) {
if (regexpKeyTypes.test(title)) {
console.log('Cache retrieved ' + title + ' from ZIM');