/********************************************* * point_use.js --------------------------------------------- @constructor @init @plugin *********************************************/ /* ------------------------------------------- * @constructor ------------------------------------------- */ var u = new EPOS_CARD.Util(); // u インスタンスを作成 /* ------------------------------------------- * @init ------------------------------------------- */ j$(function(){ u.$win.on("load",function(){ j$.itemChange(); j$.modal(); }); }); /* ------------------------------------------- * @plugin ------------------------------------------- */ (function(j$){ /* * @plugin earn_accordion */ j$.itemChange = function(){ var c = { elm: ".js-faqItem", trigger: ".js-faqLink" }; var u = new EPOS_CARD.Util(); // u インスタンスを作成 // vars var $elm = j$(c.elm), $trg = j$(c.trigger), speed = 300, openClass = 'is-open'; if($elm.length === 0){ return false; } // trigger $trg.on('click', function() { var self = $(this), href = self.attr('href').replace('#', ''); $elm.each(function() { var self = $(this), id = self.attr('id'); if(id.match(href) && !self.hasClass(openClass)) { $elm.hide().removeClass(openClass); self.addClass(openClass); self.show(); setTimeout(function() { var position = self.offset().top; $("html, body").animate({ scrollTop: position }, speed); },100) } }) return false; }); // ハッシュタグでセクションを開く var hash = window.location.hash.replace('#', ''); if (hash) { $elm.each(function() { var self = $(this), id = self.attr('id'); if (id === hash) { $elm.hide().removeClass(openClass); self.addClass(openClass); self.show(); setTimeout(function() { var position = self.offset().top; $("html, body").animate({ scrollTop: position }, speed); }, 100); return false; } }); } }; /* * @method modal */ $.modal = function(config){ var u = new EPOS_CARD.Util(); var c = $.extend({ elm: ".js-ownerModal" },config); // vars var $elm = $(c.elm); if($elm.length === 0){ return false; } // trigger if(!u.isRangeSP()){ $elm.colorbox({ inline: true, width: "auto", maxWidth: "1100px", maxHeight: "92%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); }, onClosed: function() { } }); } else { $elm.colorbox({ inline: true, height: "", maxWidth: "100%", maxHeight: "100%", fixed: true, onComplete: function(){ EPOS_CARD.module.equalHeight(true, true); EPOS_CARD.module.sizeFix(); } }); } } })(jQuery); // 「エポスオーナーアプリ」押下後、申込環境ごとにアプリDLページ出しわけ j$(function() { var iosUrl = "https://apps.apple.com/jp/app/id1664020456"; var androidUrl = "https://play.google.com/store/apps/details?id=jp.co.eposcard.ownerapp"; function isIOSDevice(u) { if (u.isiPhone()) { return true; } if (u.ua.indexOf("ipad") !== -1) { return true; } var uaData = navigator.userAgentData; if (uaData && typeof uaData.platform === "string") { var hintPlat = uaData.platform; if (hintPlat === "iOS" || hintPlat === "iPhone" || hintPlat === "iPad") { return true; } } if (navigator.maxTouchPoints > 1 && /macintosh|mac os x/i.test(navigator.userAgent)) { return true; } return false; } function isAndroidDevice(u) { return u.isAndroid(); } function isLikelyTouchMobile(u) { if (!u.isRangeSP()) { return false; } if (navigator.maxTouchPoints > 0) { return true; } return "ontouchstart" in window; } j$(".js-applyButton").on("click", function(e) { e.preventDefault(); e.stopImmediatePropagation(); var u = new EPOS_CARD.Util(); if (isIOSDevice(u)) { window.location.href = iosUrl; return; } if (isAndroidDevice(u)) { window.location.href = androidUrl; return; } if (isLikelyTouchMobile(u)) { if (u.ua.indexOf("linux") !== -1) { window.location.href = androidUrl; } else { window.location.href = iosUrl; } return; } j$("#modalPcOnly").css("display", "block"); j$.colorbox({ inline: true, href: "#modalPcOnly", maxWidth: "90%", maxHeight: "90%", opacity: 0.7, fixed: true, onOpen: function() { var scrollY = j$(window).scrollTop(); j$("#colorbox").data("ycoord", scrollY); j$("body").css({ position: "fixed", top: (scrollY * -1) + "px", left: "0", right: "0", overflow: "hidden" }); }, onComplete: function() { j$("#cboxLoadedContent").css("overflow", "visible"); }, onClosed: function() { j$("#modalPcOnly").css("display", "none"); j$("body").css({ position: "", top: "", left: "", right: "", overflow: "" }); j$(window).scrollTop(j$("#colorbox").data("ycoord")); } }); }); });