(function(){ var device = (function(){ var ua = navigator.userAgent; if(ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0){ return 'sp'; }else if(ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0){ return 'tab'; }else{ return 'other'; } })(); 'use strict'; // 目印のaタグからパラメータとってきたら消す var divtag = document.querySelectorAll('.aprico-widget-count'); divtag[0].style.display = 'none'; // 高さ var height = 470; if( device == 'sp' ) { height = 480; } var wrap = document.createElement('div'); wrap.id = 'aprico-widget-wrap'; wrap.setAttribute("style","position: relative; width: 100%; height: 0; padding-top: "+height+"px;") var iframe = document.createElement('iframe'); iframe.setAttribute("style", "position: absolute; top: 0; left: 0; width: 100%; height: 100%"); iframe.scrolling = 'no'; iframe.frameBorder = 0; iframe.marginWidth = 0; iframe.marginHeight = 0; iframe.width = '100%'; iframe.height = '100%'; iframe.id = ''; wrap.appendChild(iframe); divtag[0].parentNode.insertBefore(wrap,divtag[0]); // widgetの中身 var widget = ""; widget += (function(){/*
*/}).toString().replace(/(\n)/g, '').split('/*')[1].split('*/')[0]; // iframeにウィジェットの内容 var doc = iframe.contentWindow.document; doc.open(); doc.write(widget); doc.close(); })();