From 9da225984b7e3bd2cfa3d942fc1cb4dc35ebb997 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Mon, 19 Mar 2018 23:26:29 +0100 Subject: [PATCH] fixed audioplayer timertohide bug --- .../figli/edlp_corpus/assets/dist/scripts/corpus.min.js | 6 +++--- .../modules/figli/edlp_corpus/assets/scripts/corpus.js | 6 +++--- .../modules/figli/edlp_search/assets/js/edlp_search.js | 4 ++-- .../custom/edlptheme/assets/dist/scripts/main.min.js | 9 +++++++-- sites/all/themes/custom/edlptheme/assets/scripts/main.js | 9 +++++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js index b657e1f36..2cdddd92c 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js +++ b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js @@ -593,10 +593,10 @@ }; // show opened audio node function openNodeByNid(nid){ - console.log('Corpus openNode()', nid); + // console.log('Corpus openNode()', nid); closeNode(); if(typeof _nodes_Nid_Id[nid] != 'undefined'){ - console.log('node exists'); + // console.log('node exists'); _node_opened_id = _nodes_Nid_Id[nid]; _nodes[_nodes_Nid_Id[nid]].open(); } @@ -806,7 +806,7 @@ } }) .on('audio-node-opened', function(e){ - console.log('Corpus audio-node-opened', e); + // console.log('Corpus audio-node-opened', e); openNodeByNid(e.nid); }) .on('audio-node-closed', function(e){ diff --git a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js index b657e1f36..2cdddd92c 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js +++ b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js @@ -593,10 +593,10 @@ }; // show opened audio node function openNodeByNid(nid){ - console.log('Corpus openNode()', nid); + // console.log('Corpus openNode()', nid); closeNode(); if(typeof _nodes_Nid_Id[nid] != 'undefined'){ - console.log('node exists'); + // console.log('node exists'); _node_opened_id = _nodes_Nid_Id[nid]; _nodes[_nodes_Nid_Id[nid]].open(); } @@ -806,7 +806,7 @@ } }) .on('audio-node-opened', function(e){ - console.log('Corpus audio-node-opened', e); + // console.log('Corpus audio-node-opened', e); openNodeByNid(e.nid); }) .on('audio-node-closed', function(e){ diff --git a/sites/all/modules/figli/edlp_search/assets/js/edlp_search.js b/sites/all/modules/figli/edlp_search/assets/js/edlp_search.js index 384255e77..2b3e91f01 100644 --- a/sites/all/modules/figli/edlp_search/assets/js/edlp_search.js +++ b/sites/all/modules/figli/edlp_search/assets/js/edlp_search.js @@ -71,7 +71,7 @@ }; function onResultsLoaded(data){ - console.log('EdlpSearch onResultsLoaded()', data); + // console.log('EdlpSearch onResultsLoaded()', data); _$form.removeClass('ajax-loading'); _$body.removeClass('ajax-loading'); @@ -96,7 +96,7 @@ }; function onSearchClosed(e){ - console.log('Edlp Search onSearchClosed()', e); + // console.log('Edlp Search onSearchClosed()'); $('div[theme="edlp_search_results"]').remove(); // trigger event _$body.trigger({'type':'search-closed'}); diff --git a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js index 0eb7fb790..644030983 100644 --- a/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js +++ b/sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js @@ -143,6 +143,7 @@ this.launch(); }, launch(){ + this.clearTimeOutToHide(); this.setSRC(this.historic[this.currentHistoricIndex].audio_url); this.loadNode(this.historic[this.currentHistoricIndex].nid); // emmit new playing doc (e.g.: corpus map nowing that audio played from RandomPlayer) @@ -157,7 +158,6 @@ // audio functions setSRC(url){ // console.log('AudioPlayer setSRC : url', url); - this.clearTimeOutToHide(); this.audio.src = url; }, onLoadedmetadata(){ @@ -207,6 +207,7 @@ } }, stop(){ + console.log('AudioPlayer stop()'); this.audio.pause(); this.timeOutToHide(); }, @@ -268,15 +269,19 @@ } }, timeOutToHide(){ + console.log('AudioPlayer timeOutToHide()'); this.clearTimeOutToHide(); this.hideTimer = setTimeout(this.hide.bind(this), this.hideTimeMS); }, clearTimeOutToHide(){ + console.log('AudioPlayer clearTimeOutToHide()',this.hideTimer); if(this.hideTimer){ clearTimeout(this.hideTimer); + this.hideTimer = false; } }, hide(){ + console.log('AudioPlayer hide()'); this.$container.removeClass('visible'); // trigger highlighted node remove on corpus map _$corpus_canvas.trigger('audio-node-closed'); @@ -578,7 +583,7 @@ this.active = _audio_player.shuffle_is_active = false; this.$btn.removeClass('is-active'); // stop audio player - _audio_player.stop(); + // _audio_player.stop(); }, next(){ if(this.active && this.shuffledPlaylist.length > 0) diff --git a/sites/all/themes/custom/edlptheme/assets/scripts/main.js b/sites/all/themes/custom/edlptheme/assets/scripts/main.js index 0eb7fb790..644030983 100644 --- a/sites/all/themes/custom/edlptheme/assets/scripts/main.js +++ b/sites/all/themes/custom/edlptheme/assets/scripts/main.js @@ -143,6 +143,7 @@ this.launch(); }, launch(){ + this.clearTimeOutToHide(); this.setSRC(this.historic[this.currentHistoricIndex].audio_url); this.loadNode(this.historic[this.currentHistoricIndex].nid); // emmit new playing doc (e.g.: corpus map nowing that audio played from RandomPlayer) @@ -157,7 +158,6 @@ // audio functions setSRC(url){ // console.log('AudioPlayer setSRC : url', url); - this.clearTimeOutToHide(); this.audio.src = url; }, onLoadedmetadata(){ @@ -207,6 +207,7 @@ } }, stop(){ + console.log('AudioPlayer stop()'); this.audio.pause(); this.timeOutToHide(); }, @@ -268,15 +269,19 @@ } }, timeOutToHide(){ + console.log('AudioPlayer timeOutToHide()'); this.clearTimeOutToHide(); this.hideTimer = setTimeout(this.hide.bind(this), this.hideTimeMS); }, clearTimeOutToHide(){ + console.log('AudioPlayer clearTimeOutToHide()',this.hideTimer); if(this.hideTimer){ clearTimeout(this.hideTimer); + this.hideTimer = false; } }, hide(){ + console.log('AudioPlayer hide()'); this.$container.removeClass('visible'); // trigger highlighted node remove on corpus map _$corpus_canvas.trigger('audio-node-closed'); @@ -578,7 +583,7 @@ this.active = _audio_player.shuffle_is_active = false; this.$btn.removeClass('is-active'); // stop audio player - _audio_player.stop(); + // _audio_player.stop(); }, next(){ if(this.active && this.shuffledPlaylist.length > 0)