Explorar el Código

fix bottom banners4

amic hace 1 mes
padre
commit
61df8bb0a3
Se han modificado 1 ficheros con 64 adiciones y 3 borrados
  1. 64 3
      views/_etc/banners/moevideo.php

+ 64 - 3
views/_etc/banners/moevideo.php

@@ -3,17 +3,77 @@
 /**
  * @var $this \yii\web\View
  */
-$this->registerJsFile("//s.clickiocdn.com/t/202435/360.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
-$this->registerJsFile("//s.luxupadva.com/t/common_403.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
 
 $controller = Yii::$app->controller->id;
 $action = Yii::$app->controller->action->id;
 
 if(($controller!="site" && $action!="index") && Yii::$app->deviceDetect->isMobile() ):?>
 <?
-	if( rand(0,100) > 66 ){
+
+switch (rand(1,3)) {
+    case 1:
+		$this->registerJsFile("//s.clickiocdn.com/t/202435/360.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
+		$this->registerJsFile("//s.luxupadva.com/t/common_403.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
 ?>
         <div id="vi_105778" class="moevideo_inject"></div>
+<?
+        break;
+    case 2:
+?>
+<script>function moevideo() {
+            let flag = false;
+            const scrollDelay = 200;
+            console.log("Загрузка моевидео, ожидание прокрутки "+scrollDelay+"px")
+            if(window.scrollY>scrollDelay && !flag)
+            {
+                console.log("Подключение моёвидео, скролл достигнул "+scrollDelay+"px")
+                flag = true;
+                window.removeEventListener("scroll", moevideo);
+                (
+                    () => {
+                        const script = document.createElement("script");
+                        script.defer = true,
+                        script.src = "https://cdn1.moe.video/player/mvplayer.min.js";
+                        script.onload = () => {
+                            addContentRoll({
+                                width: '100%',
+                                placement: 10167,
+                                promo: true,
+                                advertCount: 10,
+                                slot: 'page',
+                                sound: 'onclick',
+                                fly:{
+                                    mode: 'stick',
+                                    animation: 'fly',
+                                    width: 450,
+                                    closeSecOffset: 3,
+                                    position: 'bottom-right',
+                                },
+                                adEmpty: () => {
+                                    var i = document.createElement("script");
+                                    i.src = "https://player.codes/tag/load.js?sid=105778&tag_id=vi_105778";
+                                    document.head.append(i);                     },
+                            });
+                        }
+                        document.body.append(script);
+                    }
+                )()
+            }
+        }
+    setTimeout((function (){
+//        let flag = false;
+        window.addEventListener('scroll',moevideo);
+    }), 7000);</script>
+<?
+        break;
+    case 3:
+?>
+	<script src="https://ru.viadata.store/v2/comm_min.js?sid=103506" async></script>
+<?
+	break;
+}
+
+/*
         <script type="text/javascript">
         //  function moevideo() {
         //             let flag = false;
@@ -88,5 +148,6 @@ if(($controller!="site" && $action!="index") && Yii::$app->deviceDetect->isMobil
         </script>
 <?
 	}
+	*/
 ?>
 <?php endif;?>