<template>
  <div>
    <div class="page-content" :class="className" style="background: url('/jpg/NY2023.png');background-repeat: repeat;background-size: contain; ">
      <Header :adsHeader="ads.header" />
      <Nuxt />
    </div>
    <Footer />
  </div>
</template>
<script>
export default {
  head () {
    return {
      script: [
        {
          innerHTML: `window.Ya || (window.Ya = {});
          window.yaContextCb = window.yaContextCb || [];
          window.Ya.adfoxCode || (window.Ya.adfoxCode = {});
          window.Ya.adfoxCode.hbCallbacks || (window.Ya.adfoxCode.hbCallbacks = []);`
        },
        {
          src: 'https://yandex.ru/ads/system/header-bidding.js'
        },
        {
          src: 'https://cdn.adfinity.pro/foralls/adfinity_1.1.js'
        },
        {
          src: 'https://cdn.adfinity.pro/partners/amic.ru/hbconfig.js'
        },
        {
          src: 'https://yandex.ru/ads/system/context.js',
          async: true
        },
        {
          src: 'https://code.giraff.io/data/widget-amicru.js',
          async: true
        },
        // {
        //   src: 'https://cdn.hunterdelivery.com/scripts/draw_script.js',
        //   async: true,
        //   defer: true,
        //   id: 'delivery-draw-kit',
        //   onload: 'javascript:renderDelivery(\'5e81a17798e06\')'
        // },
        {
          src: '//lkrszr.com/fvb71l912ivl0mp/y30q8h867quv876pkyxce9mj.php',
          async: true
        },
        // {
        //   src: "https://yastatic.net/pcode/adfox/header-bidding.js",
        //   async: true,
        // },
        // {
        //   src: "https://ads.digitalcaramel.com/js/amic.ru.js",
        // },
        // {
        //   src: "https://yastatic.net/pcode/adfox/loader.js",
        //   crossorigin: "anonymous"
        // },
        {
          src: 'https://jsn.24smi.net/smi.js',
          async: true,
        },
        {
          src: 'https://moevideo.biz/embed/js/mvpt.min.js',
          async: true,
        },
      ],
      link: [
        { rel: 'preconnect', href: 'https://ads.betweendigital.com' },
        { rel: 'alternate', href: '/rss', title: 'RSS', type: 'application/rss+xml', crossorigin: true },
        { rel: 'stylesheet', href: 'https://cdn.adfinity.pro/foralls/adfinity_1.1.css' }
      ]
    }
  },
  data () {
    return {
      ads: {
        header: {},
        body: {},
        side: {},
        news: {},
        partners: {}
      }
    }
  },
  computed: {
    className () {
      return this.$route.name
    }
  },
  beforeMount () {
    window.yaContextCb = window.yaContextCb || []
  },
  created () {
    this.$store.dispatch('modules/ads/getAds')
    this.$store.dispatch('modules/menu/getMenu')
  },
  updated () {
    try {
      this.$store.dispatch('modules/ads/getAds')
      // eslint-disable-next-line no-undef
      ga('set', 'page', this.$route.path)
      // eslint-disable-next-line no-undef
      ga('send', 'pageview')
      // eslint-disable-next-line no-undef
      ym(34950850, 'hit', this.$route.path)
      // eslint-disable-next-line no-undef
      _tmr.pageView({ id: '55851', url: this.$route.path })
    } catch (e) {
      console.log(e);
    }
    document.body.style.opacity = 1;
  },
  mounted () {
    window.onpopstate = function () {
      document.body.style.opacity = '0.3'
    }
    if ((this.$route.path !== '/' && this.$nuxt.$device.isMobile)) {
      const video1 = document.createElement('script')
      video1.innerHTML = `var moevideoQueue = moevideoQueue || [];
        moevideoQueue.push(function () {
          moevideo.ContentRoll({
            mode:"manual",
            maxRefresh: 10,
            videoInstream:'https://cdn1.playreplay.me/country.mp4',
            closeInstream: "true",
            instream: true,
            floatCloseTimeout: 10,
            floatPosition:"bottom right",
            ignorePlayers: true,
            floatMode:"full"
          });
       });`
      setTimeout(function () {
        document.body.appendChild(video1)
      }, 8000)
    }
    if (this.$nuxt.$device.isDesktop) {
      const bottomLineScript = document.createElement('script')
      bottomLineScript.innerHTML = `
      window.yaContextCb.push(()=>{
          Ya.adfoxCode.create({
              ownerId: 720777,
              containerId: 'adfox_167049287885775196',
              params: {
                  p1: 'cwoiw',
                  p2: 'hyrh'
              }
          })
      })
    `
      const bottomLineCont = document.createElement('div')
      bottomLineCont.id = 'adfox_167049287885775196'
      document.body.appendChild(bottomLineScript)
      document.body.appendChild(bottomLineCont)
    }
  }
};
</script>
<style lang="less">
html {
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  word-spacing: 1px;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  body{
    opacity: 1;
    transition: 0.3s;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

.button--green {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #3b8070;
  color: #3b8070;
  text-decoration: none;
  padding: 10px 30px;
}

.button--green:hover {
  color: #fff;
  background-color: #3b8070;
}

.button--grey {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #35495e;
  color: #35495e;
  text-decoration: none;
  padding: 10px 30px;
  margin-left: 15px;
}

.button--grey:hover {
  color: #fff;
  background-color: #35495e;
}
</style>
