summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2015-09-23 18:59:56 +0200
committerMatěj Cepl <mcepl@cepl.eu>2015-09-23 18:59:56 +0200
commit3546023b7e8d57020685bf3556e41a76e4df7ec1 (patch)
tree3d3958f68ae6b9de7907043bcdd87014afe2d9ea
parent07351654b6747eba4e9d7800a425d1026d7d8440 (diff)
downloadzalmy-3546023b7e8d57020685bf3556e41a76e4df7ec1.tar.gz
Refactor out some zalmy.display() to ActivePage.display()
-rw-r--r--activePage.es16
-rw-r--r--zalmy.appcache2
-rw-r--r--zalmy.es8
3 files changed, 18 insertions, 8 deletions
diff --git a/activePage.es b/activePage.es
index d93ad4f..09f5ef0 100644
--- a/activePage.es
+++ b/activePage.es
@@ -107,7 +107,23 @@ export class ActivePage {
this.display();
}
+ /**
+ * Display current item
+ *
+ * @param new_date String with ISO formatted date (optional)
+ * or Number with the relative distance of the day from the date
+ * currently displayed.
+ *
+ * Displays the Losungen for the given date (or today if not defined)
+ */
display() {
+ // first scroll then switch to avoid blinking of the page
+ window.scroll(0, 0);
+
+ var visibleElems = document.getElementsByClassName("visible");
+ Array.prototype.forEach.call(visibleElems, function(e) {
+ e.classList.remove("visible");
+ });
}
/**
diff --git a/zalmy.appcache b/zalmy.appcache
index d2a3b96..ffc5cb8 100644
--- a/zalmy.appcache
+++ b/zalmy.appcache
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# v27 - 2015-09-12
+# v28 - 2015-09-23
index.html
activePage.js
activePage.js.map
diff --git a/zalmy.es b/zalmy.es
index aa433c1..a40a0c2 100644
--- a/zalmy.es
+++ b/zalmy.es
@@ -55,15 +55,9 @@ export class Psalm extends ActivePage
* Displays the particular Psalm
*/
display() {
- // first scroll then switch to avoid blinking of the page
- window.scroll(0, 0);
+ super.display();
- var visibleElems = document.getElementsByClassName("visible");
- Array.prototype.forEach.call(visibleElems, function(e) {
- e.classList.remove("visible");
- });
console.log("cur_psalm = " + this.cur_psalm);
-
let psalm_id = `Ps.${this.cur_psalm}`;
console.log(`psalm_id = ${psalm_id}`);
document.getElementById(psalm_id).parentElement.