/** * @cookie */ var HERALBONYcontentsName = HERALBONYcontentsName || {}; (function($) { HERALBONYcontentsName.cookie = (function(){ /** * domain * @type String * @return {String} */ var COOKIE_DOMAIN = /eposcard\.co\.jp/.test(location.hostname) ? '.eposcard.co.jp' : '', /* */ COOKIE_NAME_CARD_SELECTED = 'HERALBONY_contentsName_SELECTEDNO', /* */ COOKIE_NAME_LOGIN = 'login', /* */ LOGIN_URL = 'cardchange', //2017.7.20カード再発行申込用 REISSUE_URL = 'cardreissue', //2022.2.10 ウェブチャネル遷移用追加修正 VOI_URL = 'webchannel', // アフィリエイト用 AFLT_URL = 'aflt', /* * */ 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:"/"}); } } 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; } }; }()); HERALBONYcontentsName.cookie.isLogin(); })(jQuery); /** * @applyBtn */ (function ($){ "use strict"; $(function(){ /** * @applyBtn * - btnSwitch * - cookie set */ var on = $.isFunction($.on) ? 'on' : 'bind'; var btnElms = { 'register' : $('.applyBtnEntry'), 'change' : $('.applyBtnChange') }; //2017.7.20カード再発行申込用追加修正 var reissue_URL_BASE = "/memberservice/pc/cardreissue/cardreissue_design_select.do?cardreissue=heralbony&dsn="; var reissueSwicth = function(e){ var _name = e.attr("name"); var reissue_href = reissue_URL_BASE + _name e.attr("href",reissue_href); }; if (!(typeof HERALBONYcontentsName !== 'undefined' && typeof HERALBONYcontentsName.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'); HERALBONYcontentsName.cookie.setSelectedDesignNo(designId); }); }); /* cookie Judgement */ var $sideMenuList = $('.heral-sideMenuList'); var $boxChange = $('.box-change'); var $anc06 = $('#anc06'); var $designCardLinkButton = $('.heral-cardApplyButton:has(.js-designCardLink)'); var $headerMenuList = $('.headerMenuList'); var $headerMenuImage = $('.headerMenu-Image'); // SELECTセクション(#anc03)内のボタン(js-designCardLinkを含むボタンは除外) var $selectSectionButtons = $('#anc03 .heral-cardWrap .heral-cardApplyButton'); var $selectSectionRegister = $('#anc03 .heral-cardWrap .applyBtnEntry'); var $selectSectionChange = $('#anc03 .heral-cardWrap .applyBtnChange'); var isSpecialMode = false; // 開発環境かどうかを判定(本番環境: eposcard.co.jp) var isDevEnvironment = !/eposcard\.co\.jp/.test(location.hostname); // URLパラメータを取得(開発環境用) var urlParams = HERALBONYcontentsName.cookie.queryString(location.href); if($.cookie("webchannel") && $.cookie("webchannel") === "true" ){ btnElms.register.show().each(function(){ voiSwicth($(this).find("a")); }); btnElms.change.hide(); isSpecialMode = true; } else if($.cookie("cardchange") && $.cookie("cardchange") === "true" && $.cookie("login") === "1" ){ // 切替えボタン btnElms.register.hide(); btnElms.change.show(); isSpecialMode = true; } 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(); isSpecialMode = true; } else if ( $.cookie("aflt") && $.cookie("aflt") === "true" ) { // アフィリエイト btnElms.register.show(); btnElms.change.hide(); isSpecialMode = true; } else { // 通常ボタン btnElms.register.show(); btnElms.change.hide(); } // 通常以外の条件時にサイドメニューとbox-changeを非表示 var shouldHide = false; if(isSpecialMode){ shouldHide = true; } else if (isDevEnvironment) { // 開発環境: URLパラメータがある場合のみ非表示にする // 通常モード(URLパラメータなし)の時は、cookieがあっても非表示にしない if( urlParams['cardreissue'] && urlParams['cardreissue'] === "true" ){ shouldHide = true; } else if( urlParams['cardchange'] && urlParams['cardchange'] === "true" ){ shouldHide = true; } else if( urlParams['from'] && urlParams['from'] === 'voi0101' ){ shouldHide = true; } else if( urlParams['aflt'] && urlParams['aflt'] === 'gmo' ){ shouldHide = true; } // 開発環境でcookieのみの場合(URLパラメータがない)は非表示にしない // これにより、通常モードの時はcookieがあっても表示される } // voi0101判定(webchannel cookieまたはURLパラメータ) var isVoi0101 = ($.cookie("webchannel") && $.cookie("webchannel") === "true") || (isDevEnvironment && urlParams['from'] && urlParams['from'] === 'voi0101'); if(shouldHide){ if($sideMenuList.length > 0){ $sideMenuList.hide(); } if($boxChange.length > 0){ $boxChange.hide(); } if($anc06.length > 0){ if(isVoi0101){ // voi0101の時は#anc06が非表示なので、次のdivにmargin-top: 0を適用 $anc06.next().css('margin-top', '0'); } else { // それ以外は#anc06が表示されているので、#anc06自体にmargin-top: 0を適用 $anc06.css('margin-top', '0'); } } if($designCardLinkButton.length > 0){ $designCardLinkButton.hide(); } if($headerMenuList.length > 0){ $headerMenuList.hide(); } if($headerMenuImage.length > 0){ $headerMenuImage.addClass('pc-paramPosition'); } } // SELECTセクション(#anc03)内のボタンの表示/非表示制御 var selectButtonMode = 'normal'; // normal, change, register if(isSpecialMode){ if($.cookie("webchannel") && $.cookie("webchannel") === "true" ){ // ウェブチャ入会:applyBtnEntryを表示 selectButtonMode = 'register'; } else if($.cookie("cardchange") && $.cookie("cardchange") === "true" && $.cookie("login") === "1" ){ // 切り替え:applyBtnChangeを表示 selectButtonMode = 'change'; } else if ( $.cookie("cardreissue") && $.cookie("cardreissue") === "true" && $.cookie("login") === "1" ) { // 再発行:applyBtnEntryを表示 selectButtonMode = 'register'; } else if ( $.cookie("aflt") && $.cookie("aflt") === "true" ) { // アフィリエイト:applyBtnEntryを表示 selectButtonMode = 'register'; } } else if (isDevEnvironment) { // 開発環境: URLパラメータで判定 if( urlParams['from'] && urlParams['from'] === 'voi0101' ){ // ウェブチャ入会:applyBtnEntryを表示 selectButtonMode = 'register'; } else if( urlParams['cardchange'] && urlParams['cardchange'] === "true" ){ // 切り替え:applyBtnChangeを表示 selectButtonMode = 'change'; } else if( urlParams['cardreissue'] && urlParams['cardreissue'] === "true" ){ // 再発行:applyBtnEntryを表示 selectButtonMode = 'register'; } else if( urlParams['aflt'] && urlParams['aflt'] === 'gmo' ){ // アフィリエイト:applyBtnEntryを表示 selectButtonMode = 'register'; } } // SELECTセクションのボタンを制御 if(selectButtonMode === 'normal'){ // 通常:非表示 if($selectSectionButtons.length > 0){ $selectSectionButtons.hide(); } } else if(selectButtonMode === 'change'){ // 切り替え:applyBtnChangeを表示 if($selectSectionButtons.length > 0){ $selectSectionButtons.show(); } if($selectSectionRegister.length > 0){ $selectSectionRegister.hide(); } if($selectSectionChange.length > 0){ $selectSectionChange.show(); } } else if(selectButtonMode === 'register'){ // ウェブチャ入会/再発行/アフィリエイト:applyBtnEntryを表示 if($selectSectionButtons.length > 0){ $selectSectionButtons.show(); } if($selectSectionRegister.length > 0){ $selectSectionRegister.show(); } if($selectSectionChange.length > 0){ $selectSectionChange.hide(); } } }); }(jQuery)); /** * @voiContentChange */ (function ($){ $(function(){ /** * @voiContentChange * - read URL parameter */ var voiElms = { 'voiContent' : $('.voiContent'), 'voiNoContent' : $('.no_voiContent') }; var boxTokuen = $('.box-tokuen'); var boxWeb = $('.box-web'); // box-web内の「ご請求時割引について」リンクの親要素 var boxWebWaribikiLink = $('.box-web .heral-waribikiLinkList').closest('.heral-boxExampleInnerNoteItem'); // ご請求時割引についてセクション(#anc06) var $anc06Section = $('#anc06'); var isVoiMode = location.search.indexOf('from=voi0101') !== -1 || $.cookie("webchannel") === "true"; if(voiElms.voiContent.length > 0 || voiElms.voiNoContent.length > 0) { if(isVoiMode){ voiElms.voiNoContent.hide(); voiElms.voiContent.show(); }else{ voiElms.voiContent.hide(); voiElms.voiNoContent.show(); } } // voi0101の場合、#anc06(ご請求時割引について)を非表示 if(isVoiMode){ if($anc06Section.length > 0){ $anc06Section.hide(); } } // box-tokuenとbox-webの制御(voiContentの有無に関係なく実行) if(boxTokuen.length > 0 || boxWeb.length > 0){ if(isVoiMode){ if(boxTokuen.length > 0){ boxTokuen.css('display', 'none'); } if(boxWeb.length > 0){ boxWeb.css('display', 'block'); } // voi0101の場合、box-web内の「ご請求時割引について」リンクを非表示 if(boxWebWaribikiLink.length > 0){ boxWebWaribikiLink.hide(); } }else{ if(boxTokuen.length > 0){ boxTokuen.css('display', 'block'); } if(boxWeb.length > 0){ boxWeb.css('display', 'none'); } } } }); }(jQuery));