var frame_style_1 = ""; frame_style_1 = "color: #f00; font-size: 24px; font-weight: bold;text-align:center; margin:0px;"; var get_d_1 = ""; var get_m_1 = ""; var countdowntimerinstance_1 = null; var prms_1 = GetQueryString_1(); if(prms_1 && prms_1['email']){ get_m_1 = prms_1['email']; } if(prms_1 && prms_1['date']){ get_d_1 = prms_1['date']; } cook_m_1 = GetCook_1('em'); if(get_d_1 || ( get_m_1 && get_m_1 != cook_m_1 ) ){ cook_m_1 = get_m_1; SetCook_1("timer_cache_1", ""); } function GetCook_1(key){ if(window.navigator.cookieEnabled){ if (document.cookie) { var cookies = document.cookie.split("; "); for (var i = 0; i < cookies.length; i++) { var str = cookies[i].split("="); if (str[0] == key) { return unescape(str[1]); } } } }else{ return ""; } } function SetCook_1(key, val){ if(window.navigator.cookieEnabled){ var expire = new Date(); expire.setTime( expire.getTime() + 1000 * 3600 * 1 ); document.cookie = key + '=' + escape(val) + '; expires=' + expire.toUTCString() + ';'; } } var global_obj_1 = null; var global_loaded_1 = false; if(window.addEventListener) { window.addEventListener("load", eventOnLoad_1, false); } else if(window.attachEvent){ window.attachEvent("onload", eventOnLoad_1); } if(cook_m_1){ var responseText = GetCook_1("timer_cache_1"); if(responseText){ global_obj_1 = JSON.parse(responseText); AccessSite_1(cook_m_1, get_d_1); }else{ AccessSite_1(cook_m_1, get_d_1); } SetCook_1('em', cook_m_1); } function eventOnLoad_1(){ global_loaded_1 = true; if(global_obj_1){ countdowntimerinstance_1 = new CountdownTimer_1( "timer_cntdwn_1", new Date(global_obj_1.ed), global_obj_1.em, global_obj_1.tu, global_obj_1.bf, global_obj_1.af, global_obj_1.mi, global_obj_1.sl, global_obj_1.st ) ; countdowntimerinstance_1.countDown(); } } function GetQueryString_1() { if (1 < document.location.search.length) { var query = document.location.search.substring(1); var parameters = query.split('&'); var result = new Object(); for (var i = 0; i < parameters.length; i++) { var element = parameters[i].split('='); var paramName = decodeURIComponent(element[0]); var paramValue = decodeURIComponent(element[1]); result[paramName] = decodeURIComponent(paramValue); } return result; } return null; } function AccessSite_1(m, d){ var data = { id: 2030, email: m, action: 'sp_timecounter', num: 1, date: d }; var xmlHttpRequest = new XMLHttpRequest(); xmlHttpRequest.onreadystatechange = function() { var READYSTATE_COMPLETED = 4; var HTTP_STATUS_OK = 200; if( this.readyState == READYSTATE_COMPLETED && this.status == HTTP_STATUS_OK ) { if(!this.responseText) { //setDispStyle_1("none", document.getElementsByClassName("timer_cntdwn_1")); return; } var txt = this.responseText.replace(/\s+/g, ""); if(!txt) { //setDispStyle_1("none", document.getElementsByClassName("timer_cntdwn_1")); return; } global_obj_1 = JSON.parse(this.responseText); if(global_loaded_1){ countdowntimerinstance_1 = new CountdownTimer_1( "timer_cntdwn_1", new Date(global_obj_1.ed), global_obj_1.em, global_obj_1.tu, global_obj_1.bf, global_obj_1.af, global_obj_1.mi, global_obj_1.sl, global_obj_1.st ); countdowntimerinstance_1.countDown(); SetCook_1("timer_cache_1", this.responseText); } } } xmlHttpRequest.open( 'POST', 'https://webinarsystem.jp/wp-admin/admin-ajax.php' ); xmlHttpRequest.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); xmlHttpRequest.send( EncodeHTMLForm_1( data ) ); var elems = document.getElementsByClassName("timer_cntdwn_1"); } function EncodeHTMLForm_1( data ) { var params = []; for( var name in data ) { var value = data[ name ]; var param = encodeURIComponent( name ) + '=' + encodeURIComponent( value ); params.push( param ); } return params.join( '&' ).replace( /%20/g, '+' ); } function CountdownTimer_1( elemID, timeLimit, limitMessage, msgClass ) { if(countdowntimerinstance_1){ countdowntimerinstance_1.tmStop(); countdowntimerinstance_1 = null; } this.initialize.apply( this, arguments ); } function SetCountdownStyle_1(elemName, style){ elems = document.getElementsByClassName(elemName); if (!elems) { return; } var carete_style = (function () { var style = document.createElement('style'); style.setAttribute("type", "text/css"); document.getElementsByTagName('head').item(0).appendChild(style); return function (item, val) { style.sheet.insertRule(item + "{" + val + "}", 0); }; })(); carete_style("." + elemName, style); } CountdownTimer_1.prototype = { initialize: function (elemName, timeLimit, limitMessage, limitUrl, before, after, is_milis, style, sttext) { this.elems = document.getElementsByClassName(elemName); if (!this.elems) { return; } this.dispText = sttext; this.timeLimit = timeLimit; this.countdown = false; this.limitUrl = limitUrl; this.limitMessage = limitMessage; this.before = before; this.after = after; this.is_milis = is_milis; this.disp_type = "block"; this.canTimerRun = true; setDispStyle_1("none", this.elems); SetCountdownStyle_1("timer_cntdwn_1", style); }, tmStop: function () { this.canTimerRun = false; }, countDown: function () { if (!this.elems) { return; } var timer; var today = new Date() var days = Math.floor((this.timeLimit - today) / (24 * 60 * 60 * 1000)); var hours = Math.floor(((this.timeLimit - today) % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)); var mins = Math.floor(((this.timeLimit - today) % (24 * 60 * 60 * 1000)) / (60 * 1000)) % 60; var secs = Math.floor(((this.timeLimit - today) % (24 * 60 * 60 * 1000)) / 1000) % 60 % 60; var milis = Math.floor(((this.timeLimit - today) % (24 * 60 * 60 * 1000)) / 10) % 100; var me = this; if ((this.timeLimit - today) > 0) { this.countdown = true; setDispStyle_1(this.disp_type, this.elems); if (this.dispText) { setInnerHtml_1(this.dispText, this.elems); } else { timer = '' + this.before + '' + 'あと'; timer = timer + '' + days + '' + 'と'; timer = timer + '' + this.addZero(hours) + '' + '時間'; timer = timer + '' + this.addZero(mins) + '' + ''; timer = timer + '' + this.addZero(secs) + '' + ''; if (this.is_milis) { timer = timer + '' + this.addZero(milis) + ''; } timer = timer + '' + this.after + '' setInnerHtml_1(timer, this.elems); } if(this.canTimerRun){ if (this.is_milis) { tid = setTimeout(function () { me.countDown(); }, 40); }else{ tid = setTimeout(function () { me.countDown(); }, 40); } } } else { if (this.limitUrl) { location.href = this.limitUrl; } else if (this.limitMessage) { setInnerHtml_1(this.limitMessage, this.elems); setDispStyle_1(this.disp_type, this.elems); } else { setInnerHtml_1("", this.elems); setDispStyle_1("none", this.elems); } return; } }, addZero: function (num) { num = '00' + num; str = num.substring(num.length - 2, num.length); return str; } } function setDispStyle_1(style, elems) { if (!elems) { return; } for (var i = 0; i < elems.length; i++) { elems[i].style.display = style; } } function setInnerHtml_1(html, elems) { if (!elems) { return; } for (var i = 0; i < elems.length; i++) { elems[i].innerHTML = html; } }