aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-04-21 20:09:08 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-04-21 20:12:05 +0200
commitd24fc0472883cfdc3842fbacba9d084a7198ba43 (patch)
treeb40a43ca0dc16396aec4a3337a00be3accc0416e
parenteadc172dda09c5966eb5846f48f08de390083273 (diff)
downloadhesla-d24fc0472883cfdc3842fbacba9d084a7198ba43.tar.gz
Another day, another attempt to use more mobile friendly bible reader.
This time, it is https://www.stepbible.org/ Fixes: gb#ec904f8
-rw-r--r--hesla.ts19
-rw-r--r--sworker.js2
-rw-r--r--templates/czech.html2
3 files changed, 18 insertions, 5 deletions
diff --git a/hesla.ts b/hesla.ts
index aee251a..921b442 100644
--- a/hesla.ts
+++ b/hesla.ts
@@ -99,9 +99,22 @@ export class Hesla extends ActivePage {
super.display();
console.log("cur_watchword = " + toISODateString(this.cur_watchword));
- document.getElementById(toISODateString(this.cur_watchword)).
- classList.add("visible");
-
+ var disp_watchword = document.getElementById(toISODateString(this.cur_watchword));
+ disp_watchword.classList.add("visible");
+
+ // Complete mobile device identification /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/
+ if (/Android/i.test(navigator.userAgent)) {
+ // true for mobile device
+ var href_attr = "";
+ Array.prototype.forEach.call(disp_watchword.getElementsByTagName("a"), a_elem => {
+ href_attr = a_elem.getAttribute("href");
+ console.log("before replacement: href_attr = " + href_attr);
+ href_attr = href_attr.replace(/http:\/\/www\.crosswire\.org\/study\/passagestudy\.jsp\?key=([^&]+)&mod=([a-zA-Z]+)/,
+ "https://www.stepbible.org/?q=version=$2|reference=$1");
+ console.log("after replacement: href_attr = " + href_attr);
+ a_elem.setAttribute("href", href_attr);
+ });
+ }
window.scroll(0, 0);
}
diff --git a/sworker.js b/sworker.js
index c465e1b..bcb8541 100644
--- a/sworker.js
+++ b/sworker.js
@@ -1,4 +1,4 @@
-var VERSION = 'v65 - 2024-04-17';
+var VERSION = 'v67 - 2024-04-21';
var toCache = [
'/',
'activePage.js',
diff --git a/templates/czech.html b/templates/czech.html
index a76b052..5474888 100644
--- a/templates/czech.html
+++ b/templates/czech.html
@@ -2,7 +2,7 @@
{% set title = 'Hesla Jednoty bratrské pro tento den' %}
{% set noscript_message =
'Omlouvám se, ale tato aplikace opravdu nefunguje bez funkčního JavaScriptu' %}
-{% set bibMod = 'CzeCEP' %}
+{% set bibMod = 'CzeCSP' %}
{% block acknowledgment %}Děkuji za poskytnuté texty
<a href="http://hesla.dulos.cz/" target="_blank">Petru Heřmanovi</a>{% endblock %}
<!-- vi:ft=htmljinja