window.addEventListener('DOMContentLoaded', function () { var ua = navigator.userAgent; if ((localStorage.getItem('aaac_i_ima') != undefined && localStorage.getItem('aaac_i_ima') > (new Date().getTime())) || (location.hostname !== document.referrer.match(/https?:\/\/([^\/]+)(?:\/|$)/)[1])) { return; } var aaa_xhr_success = function (data, link_url, view_url) { if (typeof data == 'string') { data = JSON.parse(data); } if ( !((Math.random() * 100) < data['rate']) || (!data['article']['movie']) || (!data['prop']['movie']) ) { return; } localStorage.setItem('aaac_i_ima', new Date().getTime() + (data['cookie'] * 1000)); var wrap = document.createElement('div'); wrap.style.setProperty('margin', '0', 'important'); wrap.style.setProperty('border', 'none', 'important'); wrap.style.setProperty('padding', '0', 'important'); wrap.style.setProperty('position', 'fixed', 'important'); wrap.style.setProperty('min-width', 'auto', 'important'); wrap.style.setProperty('max-width', 'none', 'important'); wrap.style.setProperty('min-height', 'auto', 'important'); wrap.style.setProperty('max-height', 'none', 'important'); wrap.style.setProperty('z-index', '1000000000000', 'important'); wrap.style.setProperty('left', '0', 'important'); wrap.style.setProperty('top', '0', 'important'); wrap.style.setProperty('right', '0', 'important'); wrap.style.setProperty('bottom', '0', 'important'); wrap.innerHTML = '
' + '' + '
' + '

広告

' + '
' + '
' + '
閉じる
' + '
開く
' + '
' + '
' + '
'; document.body.appendChild(wrap); document.querySelector('#ima_i_close').addEventListener('click', function (event) { event.stopPropagation(); document.body.removeChild(wrap); }); document.querySelector('#ima_i_open').addEventListener('click', function (event) { var XHR = new XMLHttpRequest(); XHR.open('POST', data['click'], true); XHR.send(''); window.open(link_url); }); document.querySelector('#ima_i_muted_switch').addEventListener('click', function (event) { event.stopPropagation(); var video = document.querySelector('#ima_i_video'); if (video.muted == true){ video.muted = false; $('#ima_i_muted_switch').attr('src', 'https://srv1.aaacompany.net/om/i_sp/s_on.png'); } else{ video.muted = true; $('#ima_i_muted_switch').attr('src', 'https://srv1.aaacompany.net/om/i_sp/s_off.png'); } }); } var oct_xhr_success = function (json_data) { if (typeof json_data == 'string') { json_data = JSON.parse(json_data); } if ( typeof json_data['click_url'] === "undefined" || json_data['click_url'] == '' || typeof json_data['view_url'] === "undefined" || json_data['view_url'] == '' || (!/(\?|&)_article=\d+($|&)/.test(json_data['click_url'])) ) { return; } var article_id = json_data['click_url'].match(/(\?|&)_article=(\d+)($|&)/)[2]; var json_url = 'https://srv1.aaacompany.net/om_res.php?spot=68337&article=' + article_id + '&_=' + new Date().getTime(); var xhr = new XMLHttpRequest(); xhr.ontimeout = function () { console.error("The aaacompany request timed out."); }; xhr.onload = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { aaa_xhr_success(xhr.response, json_data['click_url'], json_data['view_url'] ); } else { console.error(xhr.statusText); } } }; xhr.open("GET", json_url, true); xhr.timeout = 3000; xhr.responseType = 'json'; xhr.send(null); }; (function () { var isIos = function () { var b, c, d; b = window.navigator.userAgent.toLowerCase(); c = 0 <= b.indexOf('iphone'); d = 0 <= b.indexOf('ipod'); b = 0 <= b.indexOf('ipad'); return c || d || b ? !0 : !1 }; var iPhoneModels = { 479: "iphone3", 480: "iphone4", 568: "iphone5", 667: "iphone6", 736: "iphone6p", 737: "iphone6" }; var displayMinSize = 479; var displayMaxSize = 737; var getModelName = function (b) { return !1 === isIos() ? '' : iPhoneModels[displayMinSize > b ? displayMinSize : displayMaxSize < b ? displayMaxSize : b] }; var i_type = getModelName(window.screen.height); var json_url = 'https://ap.octopuspop.com/deliver/?_spot=68337&_iphone_type=' + i_type + '&_ver=' + new Date().getTime(); var xhr = new XMLHttpRequest(); xhr.ontimeout = function () { console.error("The octopus request timed out."); }; xhr.onload = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { oct_xhr_success(xhr.response); } else { console.error(xhr.statusText); } } }; xhr.open("GET", json_url, true); xhr.timeout = 3000; xhr.responseType = 'json'; xhr.send(null); })(); });