var _oct_movie_rectangle = _oct_movie_rectangle === undefined ? new Array : _oct_movie_rectangle; var __oct_movie_rectangle = function(id_number){ var ua = navigator.userAgent; if ((document.cookie.indexOf('aaac_mr_ima=true') != -1) || (navigator.userAgent.indexOf('Mobile') != -1 && navigator.userAgent.indexOf('Firefox') != -1)) { return; } var wrap, iframe, iframe_set_flag; document.write('
'); var wrap = document.getElementById('_oct_movie_rectangle_' + id_number); wrap.style.textAlign = 'center'; wrap.style.height = '250px'; var aaa_xhr_success = function (data, link_url, view_url, vt_url, vt_time) { if (typeof data == 'string') { data = JSON.parse(data); } if ( !((Math.random() * 100) < data['rate']) || (!data['article']['movie']) || (!data['prop']['movie']) ) { return; } var link_url_a = data['click']; var view_url_a = data['imp']; var vt_url_a = data['view']; var movie_width = data['prop']['movie'].match(/^\d+/)[0]; var movie_height = data['prop']['movie'].match(/\d+$/)[0]; var movie_url = data['article']['movie']; var endcard_url = data['article']['endcard']; if (typeof endcard_url === 'undefined') { endcard_url = false; } var button_type = data['button_type']; var cookie_time = data['cookie']; iframe = document.createElement('iframe'); iframe.id = 'iframe_movie_mr_ad_' + id_number; iframe_set_flag = false; iframe.style.height = '250px'; iframe.style.width = '300px'; iframe.style.border = 'none'; var from_time = new Date().getTime(); var iframe_windows = parent.document.querySelectorAll('iframe'); for(var i = 0; i < iframe_windows.length; i++){ if (iframe_windows[i].contentWindow == window){ var iframe_window = iframe_windows[i]; } } var set_timer = setInterval(function() { var rect = iframe_window.getBoundingClientRect(); var now_time = new Date().getTime(); if( (!iframe_set_flag) && (0 <= rect.bottom && (parent.window.innerHeight - rect.top) >= 0) && (0 <= rect.right && (parent.window.innerWidth - rect.left) >= 0) ){ if ((now_time - from_time) >= 100){ wrap.appendChild(iframe); iframe.contentWindow.document.write( '