From d24fc0472883cfdc3842fbacba9d084a7198ba43 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 21 Apr 2024 20:09:08 +0200 Subject: Another day, another attempt to use more mobile friendly bible reader. This time, it is https://www.stepbible.org/ Fixes: gb#ec904f8 --- hesla.ts | 19 ++++++++++++++++--- sworker.js | 2 +- templates/czech.html | 2 +- 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 Petru Heřmanovi{% endblock %}