fixed cartel autoswitch

This commit is contained in:
2018-10-23 12:46:32 +02:00
parent cc9fe30fc5
commit 8a854a45ab
2 changed files with 12 additions and 4 deletions
@@ -1166,14 +1166,19 @@
.fail(this.onNodeLoadFail.bind(this));
},
onNodeLoaded(data){
// console.log('AudioPlayer node loaded');
console.log('AudioPlayer node loaded', data);
this.$cartel.html(data.rendered).removeClass('loading');
_$body.trigger({'type':'new-audio-cartel-loaded'});
initAjaxLinks();
// init cartel auto switch
// cartel autoswitch
this.scndCartel_visible = 0;
this.$cartel.removeClass('second-visible');
this.cartelSwitchInterval = setInterval(this.switchCartel.bind(this), this.cartelSwitchIntervalMS);
// if second cartel has special info ?
if (this.$cartel.find('.second-cartel .col-left').children().length > 1
|| this.$cartel.find('.second-cartel').children('.col-right').length){
// init cartel auto switch
this.cartelSwitchInterval = setInterval(this.switchCartel.bind(this), this.cartelSwitchIntervalMS);
}
// call drupal behaviours (for addtoany)
Drupal.attachBehaviors(this.$cartel);
// open automaticly tha article if needed
@@ -1228,6 +1233,8 @@
// return to first cartel
this.$cartel.removeClass('second-visible');
this.scndCartel_visible = 0;
// kill the auto switch after one rotation
this.clearIntervalAutoCartelSwitch();
}else{
// switch to 2nd cartel
this.$cartel.addClass('second-visible');