From 1cd5db249f3188b8f11818cdc98bb8f20d8c3a44 Mon Sep 17 00:00:00 2001 From: Mark Boas Date: Tue, 11 Oct 2022 17:11:14 +0200 Subject: [PATCH 1/2] play-on-click as a parameter (124) --- index.html | 3 ++- js/hyperaudio-lite.js | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 61b4031..ee5deba 100644 --- a/index.html +++ b/index.html @@ -1000,8 +1000,9 @@
What kind of help is available for people to manage their ow let autoScroll = true; let doubleClick = false; let webMonetization = true; + let playOnClick = false; - new HyperaudioLite("hypertranscript", "hyperplayer", minimizedMode, autoScroll, doubleClick, webMonetization); + new HyperaudioLite("hypertranscript", "hyperplayer", minimizedMode, autoScroll, doubleClick, webMonetization, playOnClick); // Override scroll parameters //ht1.setScrollParameters(, , , ); diff --git a/js/hyperaudio-lite.js b/js/hyperaudio-lite.js index cb10a35..fe2fc51 100644 --- a/js/hyperaudio-lite.js +++ b/js/hyperaudio-lite.js @@ -1,5 +1,5 @@ /*! (C) The Hyperaudio Project. MIT @license: en.wikipedia.org/wiki/MIT_License. */ -/*! Version 2.0.18 */ +/*! Version 2.0.19 */ 'use strict'; @@ -143,12 +143,12 @@ function hyperaudioPlayer(playerType, instance) { } class HyperaudioLite { - constructor(transcriptId, mediaElementId, minimizedMode, autoscroll, doubleClick, webMonetization) { + constructor(transcriptId, mediaElementId, minimizedMode, autoscroll, doubleClick, webMonetization, playOnClick) { this.transcript = document.getElementById(transcriptId); - this.init(mediaElementId, minimizedMode, autoscroll, doubleClick, webMonetization); + this.init(mediaElementId, minimizedMode, autoscroll, doubleClick, webMonetization, playOnClick); } - init = (mediaElementId, m, a, d, w) => { + init = (mediaElementId, minimizedMode, autoscroll, doubleClick, webMonetization, playOnClick) => { const windowHash = window.location.hash; const hashVar = windowHash.substring(1, windowHash.indexOf('=')); @@ -170,18 +170,19 @@ class HyperaudioLite { false, ); - this.minimizedMode = m; + this.minimizedMode = minimizedMode; this.textShot = ''; this.wordIndex = 0; - this.autoscroll = a; + this.autoscroll = autoscroll; this.scrollerContainer = this.transcript; this.scrollerOffset = 0; this.scrollerDuration = 800; this.scrollerDelay = 0; - this.doubleClick = d; - this.webMonetization = w; + this.doubleClick = doubleClick; + this.webMonetization = webMonetization; + this.playOnClick = playOnClick; this.highlightedText = false; this.start = null; @@ -365,6 +366,9 @@ class HyperaudioLite { if (!isNaN(parseFloat(timeSecs))) { this.end = null; this.myPlayer.setTime(timeSecs); + if (this.playOnClick === true) { + this.myPlayer.play(); + } } }; @@ -373,6 +377,7 @@ class HyperaudioLite { }; checkPlayHead = () => { + this.clearTimer(); (async (instance) => { @@ -383,6 +388,7 @@ class HyperaudioLite { instance.myPlayer.setTime(instance.currentTime); instance.highlightedText = false; } + instance.checkStatus(); })(this); } From b985b950a19b9ced7fda6253e20622c31930c69e Mon Sep 17 00:00:00 2001 From: Mark Boas Date: Tue, 11 Oct 2022 17:16:31 +0200 Subject: [PATCH 2/2] bump version of index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ee5deba..961406f 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - +