瀏覽代碼

cartel auto switch

Bachir Soussi Chiadmi 6 年之前
父節點
當前提交
a079425b7f

文件差異過大導致無法顯示
+ 0 - 0
sites/all/themes/custom/edlptheme/assets/dist/scripts/main.min.js


文件差異過大導致無法顯示
+ 0 - 0
sites/all/themes/custom/edlptheme/assets/dist/styles/app.min.css


+ 28 - 1
sites/all/themes/custom/edlptheme/assets/scripts/main.js

@@ -854,6 +854,9 @@
       this.$fav       = $('<div>').addClass('favoris').appendTo(this.$container);
       // cartel
       this.$cartel       = $('<div>').addClass('cartel').appendTo(this.$container);
+      this.scndCartel_visible = 0;
+      this.cartelSwitchIntervalMS = 7000;
+      this.cartelSwitchInterval = false;
 
       // hiding
       this.hideTimer = false;
@@ -971,6 +974,7 @@
       },
       launch(){
         this.clearTimeOutToHide();
+        this.clearIntervalAutoCartelSwitch();
         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)
@@ -1139,8 +1143,12 @@
         this.$cartel.html(data.rendered).removeClass('loading');
         _$body.trigger({'type':'new-audio-cartel-loaded'});
         initAjaxLinks();
-        // and call druapl behaviours
+        // 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
         if(this.auto_open_article){
           this.$cartel.find('a.link-article').trigger('click');
           this.auto_open_article = false;
@@ -1185,6 +1193,25 @@
           this.hideTimer = false;
         }
       },
+      // cartel
+      switchCartel(){
+        // console.log("switchCartel", this.scndCartel_visible);
+        if (this.scndCartel_visible) {
+          // return to first cartel
+          this.$cartel.removeClass('second-visible');
+          this.scndCartel_visible = 0;
+        }else{
+          // switch to 2nd cartel
+          this.$cartel.addClass('second-visible');
+          this.scndCartel_visible = 1;
+        }
+      },
+      clearIntervalAutoCartelSwitch(){
+        if(this.cartelSwitchInterval){
+          clearInterval(this.cartelSwitchInterval);
+          this.cartelSwitchInterval = false;
+        }
+      },
       hide(){
         // console.log('AudioPlayer hide()');
         this.$container_parent.removeClass('audio-player-visible');

+ 5 - 1
sites/all/themes/custom/edlptheme/assets/styles/app.scss

@@ -762,6 +762,10 @@ main[role="main"]{
             font-size: 0.82em;
             font-weight: 600;
           }
+          .addtoany_list > a:first-child{
+            padding-left: 0;
+            margin-left:-4px;
+          }
         }
         .col-right{
           border-left:1px solid #1A1A1A;
@@ -801,7 +805,7 @@ main[role="main"]{
       }
     }
 
-    &:hover{
+    &:hover, &.second-visible{
       .second-cartel{
         opacity: 1;
       }

部分文件因文件數量過多而無法顯示