/*! * JavaScript Cookie v2.2.0 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ ;(function (factory) { var registeredInModuleLoader; if (typeof define === 'function' && define.amd) { define(factory); registeredInModuleLoader = true; } if (typeof exports === 'object') { module.exports = factory(); registeredInModuleLoader = true; } if (!registeredInModuleLoader) { var OldCookies = window.Cookies; var api = window.Cookies = factory(); api.noConflict = function () { window.Cookies = OldCookies; return api; }; } }(function () { function extend () { var i = 0; var result = {}; for (; i < arguments.length; i++) { var attributes = arguments[ i ]; for (var key in attributes) { result[key] = attributes[key]; } } return result; } function decode (s) { return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); } function init (converter) { function api() {} function set (key, value, attributes) { if (typeof document === 'undefined') { return; } attributes = extend({ path: '/' }, api.defaults, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); } // We're using "expires" because "max-age" is not supported by IE attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; try { var result = JSON.stringify(value); if (/^[\{\[]/.test(result)) { value = result; } } catch (e) {} value = converter.write ? converter.write(value, key) : encodeURIComponent(String(value)) .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); key = encodeURIComponent(String(key)) .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) .replace(/[\(\)]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue; } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue; } // Considers RFC 6265 section 5.2: // ... // 3. If the remaining unparsed-attributes contains a %x3B (";") // character: // Consume the characters of the unparsed-attributes up to, // not including, the first %x3B (";") character. // ... stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = key + '=' + value + stringifiedAttributes); } function get (key, json) { if (typeof document === 'undefined') { return; } var jar = {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. var cookies = document.cookie ? document.cookie.split('; ') : []; var i = 0; for (; i < cookies.length; i++) { var parts = cookies[i].split('='); var cookie = parts.slice(1).join('='); if (!json && cookie.charAt(0) === '"') { cookie = cookie.slice(1, -1); } try { var name = decode(parts[0]); cookie = (converter.read || converter)(cookie, name) || decode(cookie); if (json) { try { cookie = JSON.parse(cookie); } catch (e) {} } jar[name] = cookie; if (key === name) { break; } } catch (e) {} } return key ? jar[key] : jar; } api.set = set; api.get = function (key) { return get(key, false /* read as raw */); }; api.getJSON = function (key) { return get(key, true /* read as json */); }; api.remove = function (key, attributes) { set(key, '', extend(attributes, { expires: -1 })); }; api.defaults = {}; api.withConverter = init; return api; } return init(function () {}); })); $(document).ready(function(){ // flooat-box var popupflg_name = $('#right-float-box .right-float-in > *').attr('data-name') || 'all'; var popupflg_value = $('#right-float-box .right-float-in > *').attr('data-value') || 'hidden'; $(document).on("click", "#right-float-box .btn-close", function(){ $('#right-float-box').fadeOut(200); }); var wjs_scroll_check = function(){ var popupflg = Cookies.get('wjsfloat_'+popupflg_name) || null; if(popupflg != popupflg_value){ if($(window).scrollTop() > $('body header').outerHeight()){ $('#right-float-box').addClass('scroll-start'); } } }; $(window).scroll(wjs_scroll_check); $(window).resize(wjs_scroll_check); setTimeout(wjs_scroll_check,100); $(document).on("click", "#right-float-box .btn-hide", function(){ if($(this).find('input[type="checkbox"]').prop('checked')){ Cookies.set('wjsfloat_'+popupflg_name, popupflg_value, {expires:30}); }else{ Cookies.remove('wjsfloat_'+popupflg_name); } }); // menu var wjs_header_height = null; var wjs_header_scroll_check = function(){ var head = $('header'); var hero = $('.l-hero-wrapper'); if(head.length > 0){ if(!wjs_header_height){ wjs_header_height = head.height(); } if($(window).scrollTop() > wjs_header_height){ if(!head.hasClass('is-scroll')){ head.addClass('is-scroll'); } }else{ if(head.hasClass('is-scroll')){ head.removeClass('is-scroll'); } } } if(hero.length > 0 && head.length > 0){ var top = $('.l-hero-wrapper').offset().top + $('.l-hero-wrapper').height(); var head = $('#head'); if(!head.hasClass('is-hero-scroll') && ($(window).scrollTop() >= top)){ head.addClass('is-hero-scroll'); $('body').addClass('is-hero-scroll'); } if(head.hasClass('is-hero-scroll') && ($(window).scrollTop() < (top - 10))){ head.removeClass('is-hero-scroll'); $('body').removeClass('is-hero-scroll'); } } }; $(window).scroll(wjs_header_scroll_check); $(window).resize(wjs_header_scroll_check); wjs_header_scroll_check(); // Toggle header navigation menu $(document).on("click", "#btn-menu .p-menu-def-icon", function(){ const body = document.getElementsByTagName("body"); body[0].classList.toggle("is-gmenu-active"); $(window).scrollTop(0); }); // Close nav when top-link/btn-link is clicked function closeNav() { const body = document.getElementsByTagName("body"); if (body[0].classList.contains("is-gmenu-active")) { body[0].classList.toggle("is-gmenu-active"); } } $(document).on("click", "#btn-menu .p-menu-active-icon", closeNav); $(document).on("click", "a.p-gmenu-main-item", closeNav); // Avoid for non-menu display // let mql = window.matchMedia('(max-width: 1023px)'); // function testScreen(e){ // if (e.matches) { // const links = document.getElementById("btn-link"); // links.addEventListener("click", closeNav, false); // } // } // testScreen(mql); // mql.addListener(testScreen); }); var url = new URL(window.location.href); url.searchParams.delete('_wcms_mcc'); url.searchParams.delete('_wcms_uid'); history.replaceState('', '', url.href); // 外部リンクチェック jQuery(function() { $('a[href^=http]').attr('target', '_blank').attr('rel', 'noopener'); $('a[href^=http]:not(:has(img))').addClass("externalLinkIcon"); });