/** * @cookie */ var agito = agito || {}; (function($) { agito.cookie = (function(){ /** * domain * @type String * @return {String} */ var COOKIE_DOMAIN = /eposcard\.co\.jp/.test(location.hostname) ? '.eposcard.co.jp' : '', /* */ COOKIE_NAME_CARD_SELECTED = '_agito_SELECTEDNO', /* */ COOKIE_NAME_LOGIN = 'login', /* */ LOGIN_URL = 'cardchange', //2017.7.20カード再発行申込用 REISSUE_URL = 'cardreissue', //2022.2.10 ウェブチャネル遷移用追加修正 VOI_URL = 'webchannel', //2023.7.7 アフィリエイト遷移用追加修正 AFLT_URL = 'affiliate', /* * */ cookieSetting = { domain : COOKIE_DOMAIN, expires : 30, path : '/' }, /* */ _readCookie = function(key) { return $.cookie(key); }, /* */ _writeCookie = function(key, val, opt) { $.cookie(key, val, opt); }; return { /* * */ setSelectedDesignNo : function(no) { _writeCookie(COOKIE_NAME_CARD_SELECTED, jQuery.trim(no + ''), cookieSetting); }, //2017.7.20カード再発行申込用追加修正 isLogin : function() { if(!$.cookie(LOGIN_URL) || $.cookie(LOGIN_URL) !== "true"){ var param = this.queryString(location.href); if(param[LOGIN_URL] && param[LOGIN_URL] === "true"){ $.cookie(LOGIN_URL, "true", {path:"/"}); $.cookie(REISSUE_URL, null, {path:"/"}); $.cookie(VOI_URL, null, {path:"/"}); $.cookie(AFLT_URL, null, {path:"/"}); } } if(!$.cookie(REISSUE_URL) || $.cookie(REISSUE_URL) != "true"){ var param = this.queryString(location.href); if(param[REISSUE_URL] && param[REISSUE_URL] === "true"){ $.cookie(REISSUE_URL, "true", {path:"/"}); $.cookie(LOGIN_URL, null, {path:"/"}); $.cookie(VOI_URL, null, {path:"/"}); $.cookie(AFLT_URL, null, {path:"/"}); } } if(!$.cookie(VOI_URL) || $.cookie(VOI_URL) != "true"){ var param = this.queryString(location.href); if(param['from'] && param['from'] === 'voi0101'){ $.cookie(VOI_URL, "true", {path:"/"}); $.cookie(REISSUE_URL, null, {path:"/"}); $.cookie(LOGIN_URL, null, {path:"/"}); $.cookie(AFLT_URL, null, {path:"/"}); } } if(!$.cookie(AFLT_URL) || $.cookie(AFLT_URL) != "true"){ var param = this.queryString(location.href); if(param['aflt'] && param['aflt'] === 'gmo'){ $.cookie(AFLT_URL, "true", {path:"/"}); $.cookie(REISSUE_URL, null, {path:"/"}); $.cookie(LOGIN_URL, null, {path:"/"}); $.cookie(VOI_URL, null, {path:"/"}); } } var flg = _readCookie(COOKIE_NAME_LOGIN); return ( typeof (flg) === 'string'); }, queryString : function (param) { var strpos = param.indexOf ('?'), results = {}, params, i, j, tmp; if (strpos !== -1) { param = param.substring(strpos + 1); } if ( /&/.test(param) ) { params = param.split(/&/); for (i = 0, j = params.length; i < j; i++) { if ( /=/.test(params[i])) { tmp = params[i].split(/=/); results[tmp[0]] = tmp[1]; } } } else { if ( /=/.test(param)) { tmp = param.split(/=/); results[tmp[0]] = tmp[1]; } } return results; } }; }()); agito.cookie.isLogin(); })(jQuery); /** * @applyBtn */ (function ($){ "use strict"; $(function(){ /** * @applyBtn * - btnSwitch * - cookie set */ var on = $.isFunction($.on) ? 'on' : 'bind'; var $removeElm01 = $('.js-remove01'), $removeElm02 = $('.js-remove02'), $entryChange01 = $('.js-entryChange01'), $entryChange02 = $('.js-entryChange02'), $normalNoBtnChange = $('.js-normalNoBtnChange'), normalClass = 'is-normal'; var btnElms = { 'register' : $('.applyBtnEntry'), 'change' : $('.applyBtnChange'), 'smartphone' : $('.applySmartphoneBtn') }; //2017.7.20カード再発行申込用追加修正 var reissue_URL_agito = "/memberservice/pc/cardreissue/cardreissue_design_select.do?cardreissue=agito&dsn="; var reissueSwicth = function(e){ var card_number = e.attr("name"); var reissue_href = reissue_URL_agito + card_number; e.attr("href",reissue_href); }; if (!(typeof agito !== 'undefined' && typeof agito.cookie !== 'undefined')) { btnElms.register.show(); btnElms.change.hide(); return ; } //2022.2.10 ウェブチャネル遷移用追加修正 var voi_URL_BASE = "/eposnet/cardapplywc.jsp?dsn=06_0"; var voiSwicth = function(e){ var card_number = e.attr("name"); var voi_href = voi_URL_BASE + card_number; e.attr("href",voi_href); }; /* cookie Set */ $.each(btnElms, function() { var $self = $("a", this).addClass('hide'); $self[on]('click', function(){ var designId = $(this).attr('name'); agito.cookie.setSelectedDesignNo(designId); }); }); /* cookie Judgement */ if($.cookie("webchannel") && $.cookie("webchannel") === "true" ){ btnElms.register.show().each(function(){ voiSwicth($(this).find("a")); }); btnElms.change.hide(); $removeElm01.remove(); $entryChange01.remove(); btnElms.smartphone.hide(); $('#pageContainer').css('padding-bottom', 0); } else if($.cookie("affiliate") && $.cookie("affiliate") === "true" ){ btnElms.register.show(); btnElms.change.hide(); $removeElm01.remove(); $entryChange01.remove(); $('#pageContainer').css('padding-bottom', 0); $.cookie("cardreissue", null, {path:"/"}); $.cookie("cardchange", null, {path:"/"}); $.cookie("webchannel", null, {path:"/"}); $.cookie("affiliate", "null", {path:"/"}); } else if($.cookie("cardchange") && $.cookie("cardchange") === "true" && $.cookie("login") === "1" ){ // 切替えボタン btnElms.register.hide(); btnElms.change.show(); $removeElm01.remove(); $entryChange01.remove(); btnElms.smartphone.hide(); $('#pageContainer').css('padding-bottom', 0); } else if ( $.cookie("cardreissue") && $.cookie("cardreissue") === "true" && $.cookie("login") === "1" ) { //2017.7.20カード再発行申込用追加修正 // 再発行ボタン btnElms.register.show().each(function(){ reissueSwicth($(this).find("a")); }); btnElms.change.hide(); $removeElm01.remove(); $entryChange01.remove(); btnElms.smartphone.hide(); $('#pageContainer').css('padding-bottom', 0); } else { // 通常ボタン btnElms.register.show(); btnElms.change.hide(); $removeElm02.remove(); $entryChange02.remove(); $normalNoBtnChange.addClass(normalClass); } }); }(jQuery)); /** * @voiContentChange */ (function ($){ $(function(){ /** * @voiContentChange * - read URL parameter */ var voiElms = { 'voiContent' : $('.voiContent'), 'voiNoContent' : $('.no_voiContent') }; if(voiElms.voiContent.length ===0 && voiElms.voiNoContent.length ===0) {return false} if(location.search.indexOf('from=voi0101') !== -1 || $.cookie("webchannel") === "true"){ voiElms.voiNoContent.hide(); }else{ voiElms.voiContent.hide(); } }); }(jQuery));