moevideo.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. <?php if(rand(0,1)==1):?>
  11. <div id="vi_105778" class="moevideo_inject"></div>
  12. <script type="text/javascript">
  13. function moevideo() {
  14. let flag = false;
  15. const scrollDelay = 200;
  16. console.log("Загрузка моевидео, ожидание прокрутки "+scrollDelay+"px")
  17. if(window.scrollY>scrollDelay && !flag)
  18. {
  19. console.log("Подключение моёвидео, скролл достигнул "+scrollDelay+"px")
  20. flag = true;
  21. window.removeEventListener("scroll", moevideo);
  22. (
  23. () => {
  24. const script = document.createElement("script");
  25. script.defer = true,
  26. script.src = "https://cdn1.moe.video/player/mvplayer.min.js";
  27. script.onload = () => {
  28. addContentRoll({
  29. width: '100%',
  30. placement: 10167,
  31. promo: true,
  32. advertCount: 10,
  33. slot: 'page',
  34. sound: 'onclick',
  35. fly:{
  36. mode: 'stick',
  37. animation: 'fly',
  38. width: 450,
  39. closeSecOffset: 3,
  40. position: 'bottom-right',
  41. },
  42. adEmpty: () => {
  43. var i = document.createElement("script");
  44. i.src = "https://player.codes/tag/load.js?sid=105778&tag_id=vi_105778";
  45. document.head.append(i); },
  46. });
  47. }
  48. document.body.append(script);
  49. }
  50. )()
  51. }
  52. }
  53. setTimeout((function (){
  54. // let flag = false;
  55. window.addEventListener('scroll',moevideo);
  56. }), 7000);
  57. </script>
  58. <?php else:?>
  59. <script src="https://ru.viadata.store/v2/comm_min.js?sid=103506" async></script>
  60. <?php endif;?>
  61. <?php endif;?>