(function(){ var svCookies = {}; var isDevMode = ""; var efocubeJS={ prt: (("https:" == document.location.protocol) ? "https://" : "http://"), domain: "www.lpomax.net", options: "", trim: function(value) { return value.replace(/^\s+|\s+$/g,''); }, cookie: function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = ""; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = this.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }, getCookie: function(name) { var cookieValue = ""; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = this.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; }, param: [], getParam: function () { var query = window.location.search.substring(1); var parms = query.split('&'); for (var i=0; i 0) { var key = parms[i].substring(0,pos); var val = parms[i].substring(pos+1); this.param[key] = val; } } }, exec: function() { var dateObj = new Date(); var dummy = dateObj.getTime(); var tag = document.getElementById("efocube"); var tag_src = tag.src; if(tag_src.indexOf('?') != -1) this.options = tag_src.split('?')[1].split(','); this.getParam(); var ck_key = "efocube_" + this.options[0] + "_" + this.options[1] + "_"; var exec_mode = (this.param["efocube_test"] !== undefined && this.param["efocube_test"] != "") ? "test" : ""; var exclude_mode = (this.param["efocube_exclude"] !== undefined && this.param["efocube_exclude"] != "") ? "test" : ""; if (exec_mode == "") { exec_mode = (ck_key + 'mode' in svCookies)? svCookies[ck_key + 'mode'] : ""; } if (exec_mode == "") { exec_mode = (this.getCookie(ck_key + 'mode') !== undefined && this.getCookie(ck_key + 'mode') != "")? "test" : ""; } if (exec_mode == "") { exec_mode = "prd"; } if (exclude_mode == "") { exclude_mode = (this.getCookie(ck_key + 'excludeMode') !== undefined && this.getCookie(ck_key + 'excludeMode') != "")? "test" : ""; } var moduleName = "efocube"; if (isDevMode == "on") { moduleName = "test_efocube"; } var reqParam = "/?Module=" + moduleName + "&m=" + exec_mode + "&c=" + this.options[0] + "&f=" + this.options[1] + "&p=" + this.options[2]; if (this.options[3] != undefined && this.options[3] != "") { reqParam = reqParam + "&cv=" + this.options[3]; } var ck_key = "efocube_" + this.options[0] + "_" + this.options[1] + "_"; var ck_sessid = this.getCookie(ck_key + 'sessid'); var ck_visitcnt = this.getCookie(ck_key + 'visitcnt'); var ck_onstage = this.getCookie(ck_key + 'onstage'); var ck_abtf = this.getCookie(ck_key + 'abtf'); var ck_abtwillon = this.getCookie(ck_key + 'abtwillon'); reqParam = reqParam + "&s=" + ck_sessid + "&v_cnt=" + ck_visitcnt + "&onstage=" + ck_onstage; if (exec_mode == "test") { var jq_ver = (this.param["efocube_jqver"] !== undefined && this.param["efocube_jqver"] != "") ? this.param["efocube_jqver"] : ""; if (jq_ver == "") { jq_ver = (this.getCookie(ck_key + 'jqver') !== undefined && this.getCookie(ck_key + 'jqver') != "")? this.getCookie(ck_key + 'jqver') : ""; } if (jq_ver != "") { reqParam = reqParam + "&jqv=" + jq_ver; } } if (exclude_mode == "test") { this.cookie(ck_key + 'excludeMode', exclude_mode, {path: "/; SameSite = None",secure:"secure"}); reqParam = reqParam + "&exclude_mode=" + exclude_mode; } if (ck_abtf != "") { reqParam = reqParam + "&abtf=" + ck_abtf; } if (ck_abtwillon != "") { reqParam = reqParam + "&abtwillon=" + ck_abtwillon; } reqParam = reqParam + "&dummy=" + dummy; //タグマネージャー機能導入のため、document.writeを廃止 // var isLoad = tag.getAttribute("data-load") || false; // if (document.write !== undefined && isLoad === false) { // document.write("<\/scr" + "ipt>"); // } else { var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", this.prt + this.domain + reqParam); document.getElementsByTagName("head")[0].appendChild(script); // } var that = this; script.onload = function () { // console.log("loaded! efocube script!"); efocube["tagInfo"] = {}; efocube.tagInfo["svCookies"] = svCookies; efocube.tagInfo["isDevMode"] = isDevMode; efocube.tagInfo["prt"] = that.prt; efocube.tagInfo["domain"] = that.domain; // console.log(efocube.tagInfo); }; } }; efocubeJS.exec(); })();