moevideo.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. */
  5. $this->registerJsFile("//s.clickiocdn.com/t/202435/360.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
  6. $this->registerJsFile("//s.luxupadva.com/t/common_403.js",['position'=>\yii\web\View::POS_HEAD, 'async'=>true]);
  7. $controller = Yii::$app->controller->id;
  8. $action = Yii::$app->controller->action->id;
  9. if(($controller!="site" && $action!="index") && Yii::$app->deviceDetect->isMobile()):?>
  10. <div id="vi_105778" class="moevideo_inject"></div>
  11. <script type="text/javascript">
  12. function moevideo() {
  13. let flag = false;
  14. const scrollDelay = 200;
  15. console.log("Загрузка моевидео, ожидание прокрутки "+scrollDelay+"px")
  16. if(window.scrollY>scrollDelay && !flag)
  17. {
  18. console.log("Подключение моёвидео, скролл достигнул "+scrollDelay+"px")
  19. flag = true;
  20. window.removeEventListener("scroll", moevideo);
  21. (
  22. () => {
  23. const script = document.createElement("script");
  24. script.defer = true,
  25. script.src = "https://cdn1.moe.video/player/mvplayer.min.js";
  26. script.onload = () => {
  27. addContentRoll({
  28. width: '100%',
  29. placement: 10167,
  30. promo: true,
  31. advertCount: 10,
  32. slot: 'page',
  33. sound: 'onclick',
  34. fly:{
  35. mode: 'stick',
  36. animation: 'fly',
  37. width: 450,
  38. closeSecOffset: 3,
  39. position: 'bottom-right',
  40. },
  41. adEmpty: () => {
  42. var i = document.createElement("script");
  43. i.src = "https://player.codes/tag/load.js?sid=105778&tag_id=vi_105778";
  44. document.head.append(i); },
  45. });
  46. }
  47. document.body.append(script);
  48. }
  49. )()
  50. }
  51. }
  52. setTimeout((function (){
  53. // let flag = false;
  54. window.addEventListener('scroll',moevideo);
  55. }), 7000);
  56. </script>
  57. <?php endif;?>