(function($) { /** * This function is to display in an animation a part which was out of a window of the floating side banner at the time of mouse over. * @global * @param {Object} elm - jQuery Object. * @param {number} move - Value of numbers to move the floating side banner. * @see baseScrollSide * @example * hoverAnimate($("#side"), -200); */ var hoverAnimate = function(elm, move) { if (move < 0) { elm.find("a").on({ "mouseenter": function() { $(this).stop().animate({marginLeft: move + "px"}, 200); }, "mouseleave": function() { $(this).stop().animate({marginLeft: 0}, 200); } }); } }; /** * This function determines if the value is "NaN". It if value is "NaN", then return "true", else return "false". * @global * @param {string|number} - Value to be determined.. */ var isNotNumber = function(x) { return x !== x; }; /** * This function Makes an object, that has the current page's filename and directory information. * @global * @see baseNavAccordion * @example * pathInfo() */ var pathInfo = function(){ var info = location.pathname.split("/"); var result = {}; result.filename = info.pop(); result.hierarchy = info.length; result.dirname = info.join("/"); return result; }; /** * Fix the floating side banner on a screen or stop it on normal position for an element, at the time of scrolled. Set the below class to the HTML Element. * * @global * @see hoverAnimate * @example * baseScrollSide(); */ var baseScrollSide = function() { var window_w = $(window).width(); var $target = $(".js_floating"); if (!$target.length) return; var target_w = $target.width(); var target_h = $target.height(); var target_init_top = parseInt($target.css("top")); var max_width = $target.offset().left + target_w; var init_move = window_w - max_width; var target_class_arr = $target.attr("class").split(" "); var margin_bottom = parseInt($target.css("marginBottom")) || 0; var margin_top; $.each(target_class_arr, function () { if (this.search(/js_floating_top_*/) !== -1) { var this_number = parseInt(this.replace("js_floating_top_", "")); margin_top = !isNotNumber(this_number) ? this_number : 60; } else { margin_top = 60; } }); if (window_w < max_width) { hoverAnimate($target, init_move); } $(window).on("scroll resize", function() { var scroll_top = $(window).scrollTop(); var this_window_w = $(this).width(); var resize_max = target_w + $target.offset().left; var start = target_init_top - margin_top; var scroll_end = $("body").height() - ($("#footer").height() + target_h + margin_top + margin_bottom); window.setTimeout(function() { var move = this_window_w - ($target.offset().left + target_w); if (this_window_w > resize_max) { $target.find("a").stop().animate({marginLeft: 0}, 200); $target.find("a").off("mouseenter mouseleave"); } else { hoverAnimate($target, move); } }, 300); var not_scroll_area = !$("#cv_contact").length ? $("#cv_contact").offset().top : $("#footer").offset().top; var target_area = target_h + margin_bottom + target_init_top; if (not_scroll_area <= target_area) { $target.removeAttr("style"); return; } if (scroll_top >= scroll_end) { $target.css({position: "absolute", top: scroll_end + margin_top}); } else if (scroll_top > start) { $target.css({position: "fixed", top: margin_top}); } else { $target.css({position: "absolute", top: target_init_top}); } }); }; /** * Fix the header navigation on a screen top, or stop it on normal position for an element, at the time of scrolled. Please set 'js_navi_fixtop' class to the HTML Element. * @global */ var baseScrollHeader = function() { var scroll_top = $(window).scrollTop(); var $terminate = $(".js_navi_fixtop"); if (!$terminate.length) return; var terminate_offset_top = $terminate.offset().top; if (scroll_top > terminate_offset_top && !$terminate.hasClass("fixed")) { $terminate.addClass("fixed"); } else if (scroll_top <= terminate_offset_top && $terminate.hasClass("fixed")) { $terminate.removeClass("fixed"); } }; /** * Fix the footer CV area on a screen, or stop it on normal position for an element, at the time of scrolled. When smartphone view, fix the page top button only. * @global * @example * baseScrollBottom(); */ var baseScrollBottom = function() { var scroll_top = $(window).scrollTop(); var $contact_area = $("#cv_contact"); var $terminate; var $fixed; var terminate_offset_bottom; var window_bottom; if(!$contact_area.length) return; if ($contact_area.offset().top <= $(window).height()) { $contact_area.removeClass("fixed"); $contact_area.find(".fixed_wrapper, #pagetop a").removeAttr("style"); return; } var is_sp = $(window).width() <= 640; if (window.matchMedia){ is_sp = window.matchMedia("(max-width: 640px)").matches; } if (!is_sp) { $fixed = $contact_area.find(".fixed_wrapper"); terminate_offset_bottom = $contact_area.offset().top + $contact_area.outerHeight(); window_bottom = scroll_top + $(window).height(); $("#pagetop a").css({opacity: 1}); } else { $terminate = $("#pagetop"); $fixed = $terminate.find("a"); terminate_offset_bottom = $terminate.offset().top + $terminate.outerHeight() - parseInt($terminate.css("padding-bottom")); window_bottom = scroll_top + $(window).height() - parseInt($fixed.css("bottom")); $(".fixed_wrapper").css({opacity: 1}); } if (scroll_top > 0) { if (window_bottom < terminate_offset_bottom && !$contact_area.hasClass("fixed")) { $contact_area.addClass("fixed"); } else if(window_bottom >= terminate_offset_bottom && $contact_area.hasClass("fixed")) { $contact_area.removeClass("fixed"); } if ($contact_area.hasClass("hidden")) { $contact_area.removeClass("hidden"); $fixed.stop().animate({opacity: 1}, 200); } } else if (!$contact_area.hasClass("hidden")) { $fixed.stop().animate({opacity: 0}, 200, function(){ $contact_area.addClass("hidden"); }); } }; /** * Header navigation displays to drop down. Please set the "js_navi_dropdown" class to an element. * @global * @example * baseDropDownHeader(); */ var baseDropDownHeader = function () { var current_page = window.location.pathname; var $target = $(".js_navi_dropdown").find("li"); if (!$target.length) return; $target.on("click", function(){ if ($(this).hasClass("on")){ $(this).removeClass("on"); } else { $target.removeClass("on"); $(this).addClass("on"); } }); $target.find("a").each(function() { var target_url = $(this).attr("href"); if (target_url == current_page) { $(this).closest("li").addClass("current"); } }); window.onclick = function(e) { if (!(e.target.className == "btn_li on" || e.target.className == "btn_li" || e.target.className == "btn_li current on" || e.target.className == "btn_ttl")) { $target.removeClass("on"); } }; }; /** * Applicant accordion features on the side navigation. * @global * @example * baseSideNaviAccordion(); */ var baseSideNaviAccordion = function () { var current_page = window.location.pathname; var $target = $(".side_nav > ul > li"); if (!$target.length) return; $target.find(".ac_btn").on("click", function(e) { e.preventDefault(); if ($(this).hasClass("open")) { $(this).removeClass("open"); } else { $(this).addClass("open"); } $(this).parent().siblings(".nav_list").stop().slideToggle(300); }); $target.find(".nav_list a").each(function() { if ($(this).attr("href") == current_page) { $(this).closest(".nav_item").addClass("current"); $(this).closest(".nav_list").siblings(".ttl_nav").find(".ac_btn").addClass("open"); $(this).addClass("active"); } }); $target.each(function() { if ($(this).hasClass("current")) { $(this).find(".nav_list").css({display: "block"}); } }); }; /** * Handle accordion feature. Set the below classes to HTML Elements. * * If you want to use accordion on only display in Smartphone size, then set "js_accnav_only_sp" class to the ".js_accnav" or its parent element.
* And, you can set "show" or "hide" with "data-accnav-pc-default" and "data-accnav-smp-default" as a data attribute, If you want to set initial display. * @global * @see pathInfo * @example * baseNavAccordion(); */ var baseNavAccordion = function(){ var $current; var breakpoint = 641; var isPC = function(){ return window.matchMedia ? window.matchMedia("(min-width: " + breakpoint + "px)").matches : $(window).width() >= breakpoint; }; var initDisplay = function(key){ return function(){ var init_display = $(this).data(key); if (init_display === "hide") { $(this).removeClass("opened").find(".js_accnav_cont").hide(); } else if (init_display === "show") { $(this).addClass("opened").find(".js_accnav_cont").show(); } }; }; $(".js_accnav").on("click", ".js_accnav_switch", function(e){ if ($(this).parents(".js_accnav_only_sp").length && isPC()) return; e.preventDefault(); $(this).parents(".js_accnav_item").toggleClass("opened") .find(".js_accnav_cont").stop(true, true).slideToggle(300); }).on("click", ".js_accnav_switch a", function(e){ e.stopPropagation(); }); if (!$(".index_nav").length) { if (pathInfo().filename === "" || pathInfo().filename.match(/index\.[a-z]+/)) { if (pathInfo().dirname + "/" === $(".js_accnav a[href='" + window.location.pathname + "']").attr("href")) { $current = $(".js_accnav a[href='" + window.location.pathname + "']").addClass("active").eq(0); } else { $current = $(".js_accnav a[href^='" + pathInfo().dirname + "']").eq(0); } } else { if ($(".js_accnav a[href='" + window.location.pathname + "']").length) { $current = $(".js_accnav a[href='" + window.location.pathname + "']").addClass("active").eq(0); } else if(pathInfo().hierarchy > 5) { $current = $(".js_accnav a[href^='" + pathInfo().dirname + "']").eq(0); } } if (typeof $current != "undefined") { $current.parents(".js_accnav_item").addClass("current").addClass("opened") .find(".js_accnav_cont").css({display: "block"}); } } if (isPC()) { $(".js_accnav_item[data-accnav-pc-default]").each(initDisplay("accnavPcDefault")); } else { $(".js_accnav_item[data-accnav-smp-default]").each(initDisplay("accnavSmpDefault")); } }; /** * Call function for the deqwas slider (horizontal direction). Note: case of used the "jquery.bxslider.js". * @global * @see $.recommendInner * @example * $.recommend01(); */ $.recommend01 = function () { $(".box_recommend_01").find(".Section").wrapAll("
"); if ($(".js-recomend_01.long").size()) { $(".js-recomend_01.long .js-recomend-item ul").bxSlider({ slideWidth : 125, minSlides : 6, maxSlides : 7, slideMargin : 10 }); } }; /** * Generate a contents of the deqwas. * @global * @see $.recommend01 * @example * $.recommend01(); */ $.recommendInner = function () { if(typeof(tkt_deqwas) !== "undefined" && $(".box_recommend").length) { if(typeof(tkt_deqwas) !== "undefined" && $(".box_recommend_01").length) { $.ajax({ url: "/data/deqwas-assets-recommend-bottom.jsp", type: "POST", dataType: "html", data: tkt_deqwas, success : function(data) { $(".box_recommend_01 .Section").html(data); $.recommend01(); } }); } } }; /** * Comparison a page URL and navigation's URL, if it matches, then grant the "current" class to the parent element. * @global * @example * baseCurrentNav(); */ var baseCurrentNav = function () { var $target = $(".js_current_nav"); if (!$target.length) return; var current_page = window.location.pathname; var normaliz_current_page = current_page.replace(current_page.split(/.*\/(.*)$/i, 2)[1], ""); $target.find("a").each(function() { var target_url = $(this).attr("href"); var normaliz_target_url = target_url.replace(target_url.split(/.*\/(.*)$/i, 2)[1], ""); if(normaliz_target_url == normaliz_current_page) { $(this).closest(".js_current_nav > li").addClass("current"); } }); }; /** * Give the current class to the a element whose URL matches the value. * @global * @example * baseContentCurrentNav(); */ var baseContentCurrentNav = function () { var $target = $(".js_content_current"); if (!$target.length) return; if ($(".js_content_current a[href^='" + window.location.pathname + "']").length) { $(".js_content_current a[href^='" + window.location.pathname + "']").addClass("current"); } }; /** * Compare the set date with the current date. * @global * @see baseTimeLimitter * @param {Date} date * @return {boolean} */ var isPeriodDate = function(date) { var now = new Date(); var today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); return today.getTime() <= date.getTime(); }; /** * Check leap year * @global * @see baseTimeLimitter * @param {Number} year * @return {Number} if current year is leap year then, return 1, else return 0. */ var isUru = function(year) { return Math.floor((1 / (year % 4 + 1)) * (1 - 1 / (year % 100 + 1)) + (1 / (year % 400 + 1))); }; /** * New Icon * @global * @see isPeriodDate * @see isUru * @see isNotNumber * @example * baseTimeLimitter(); */ var baseTimeLimitter = function() { $("[data-new-icon-public]").each(function() { if ($(this).closest(".js_new_icon_off").length) return; var date = $(this).data("new-icon-public").split("-").map(function(elm) { return parseInt(elm, 10); }); if (date.length === 3) { var start_date = new Date(date[0], date[1]-1, date[2]); var year = start_date.getFullYear(); var month = start_date.getMonth() + 1; var endday = 365; if ((isUru(year) && month <= 2) || (isUru(year+1) && !(month <= 2))) { endday = 366; } if ($(this).data("new-icon-period")) { endday = parseInt($(this).data("new-icon-period"), 10); if (isNotNumber(endday)) { endday = 365; } } var set_date = new Date(date[0], date[1]-1, date[2] + endday); if (isPeriodDate(set_date)) { $(this).addClass("js_new_icon"); } } }); }; /** * Fix the recommendation area on the left side menu to the screen when scrolling. To use it, specify the following class for the html element. * * @global * @example * baseScrollLeft(); */ var baseScrollLeft = function () { if (!$(".js_floating_left").length) return; $(window).on("scroll resize" ,function() { var scroll_top = $(this).scrollTop(); var $target = $(".js_floating_item"); var $container = $("#main"); var side_height = $("#side").height(); var _target_property = { height: $(".js_floating_item").outerHeight(), top: $target.data("floating_margin_top") || 0, all_height: function () { return this.height + this.top; } }; var _container_property = { height: $container.height(), offsetTop: $container.offset().top }; var start = $(".js_floating_left").offset().top - _target_property.top; var end = _container_property.height - _target_property.all_height(); var end_pos = end + _target_property.top + _container_property.offsetTop; var scroll_exec = scroll_top - _container_property.offsetTop; var is_sp = $(this).width() <= 640; if (window.matchMedia) { is_sp = window.matchMedia("(max-width: 640px)").matches; } if (!is_sp && side_height < _container_property.height) { if (end >= scroll_exec && start <= scroll_top) { $target.css({position: "fixed", top: _target_property.top}); } else if (end <= scroll_exec) { $target.css({position: "absolute", top: end_pos}); } else { $target.css({position: "static", top: 0}); } } else { $target.css({position: "static", top: 0}); } }); }; var HighlightWords = function(){ return this.init(); }; HighlightWords.prototype = { init: function(){ this.QUERY_NAME = "gl_keywords"; this.WRAPPER_CLASSNAME = "js_highlight_words"; this.NOWRAP_WORDS = ".prt_header_01,.prt_header_02,.prt_header_03,.prt_header_04,.prt_header_05,.prt_caption_01,.prt_anchor_list,.pager,.back_index,."+this.WRAPPER_CLASSNAME; this.query = this.getQuery(); return this; }, executeOn: function(selector){ var $elem = $(selector); $elem.length && this.query && this.forEachTextNode($elem); return this; }, forEachTextNode: function($elem){ var not = this.NOWRAP_WORDS; var forEachTextNode = this.forEachTextNode.bind(this); var iterator = this.iterator.bind(this); var callback = this.highlight.bind(this); var selector = not ? "> *:not("+not+")" : "> *"; var $contents = $elem.find(selector); $contents.each(function(i){ iterator(this, this.childNodes[0], callback); $(this).find(selector).length && forEachTextNode($(this), callback, not); }); return this; }, iterator: function(elem, node){ if(!node) return; var iterator = this.iterator.bind(this); var callback = this.highlight.bind(this); this.isTextNode(node) && typeof callback==="function" && callback(elem, node); node.nextSibling && iterator(elem, node.nextSibling, callback); }, highlight: function(elem, node){ var query = this.query; var classname = this.WRAPPER_CLASSNAME; var s, len = query.length; if((s = node.data.toLowerCase().indexOf(query.toLowerCase()))!==-1){ var matches = node.splitText(s); var span = document.createElement("span"); if(classname) span.classList.add(classname); span.appendChild(document.createTextNode(matches.data.substr(0, len))); matches.splitText(len); elem.replaceChild(span, matches); } return this; }, isTextNode: function(node){ return node.nodeType===3; }, getQuery: function(){ var key = this.QUERY_NAME; var search = window.location.search; if(!search) return ""; var res = ""; search.replace(/^\?/, "").split("&").forEach(function(q){ q = q.split("="); if(q.length<2) return; if(q[0]===key) res = decodeURIComponent(q[1]); }); return res; } }; /** * Modal display on smartphone when there are two or more phone numbers * @global */ var telModalLink = function () { $('.js-tel-booth').each(function () { var $booth = $(this); var $button = $booth.find('.js-tel-button'); var $modal = $booth.find('.js-tel-modal'); var $telLinks = $modal.find('a[href^=\'tel:\']'); if ($telLinks.length > 1) { $booth.on('click', '.js-tel-button', function (e) { e.preventDefault(); $modal.addClass('opened'); }); $modal.on('click', '.js-tel-modal-bg', function () { $modal.removeClass('opened'); }); $(window).on('keyup', function (e) { if ($modal.hasClass('opened') && e.keyCode == 27) $modal.removeClass('opened'); }); } else if ($telLinks.length) { $telLinks.html($button.html()); $button.replaceWith($telLinks); } }); }; $(window).on("scroll resize.baseResize", function() { baseScrollHeader(); baseScrollBottom(); }).one("load", function () { baseSideNaviAccordion(); baseNavAccordion(); }).on("load", function() { baseDropDownHeader(); baseScrollSide(); baseCurrentNav(); baseContentCurrentNav(); baseTimeLimitter(); baseScrollLeft(); if(typeof $.fn.bxSlider !== "undefined") { $(".js_bxslider").bxSlider({ auto: true, useCSS: false }); $(".js_bxslider_fade").bxSlider({mode: "fade", auto: true}); } if (typeof $.fn.matchHeight !== "undefined") { var mh_target_list = []; $("[class*=js_match_height_]").each(function () { var reg = /^js_match_height_+/; var class_list = $(this).attr("class").split(/\s+/); var str = ""; for (var i = 0; i < class_list.length; i++) { if (reg.test(class_list[i])) { str = class_list[i]; } } if (str) { mh_target_list.push(str); } }); if (mh_target_list) { var mh_exec_classes = mh_target_list.filter(function(elm, index, arr) { return arr.indexOf(elm) === index; }); for (var j = 0; j < mh_exec_classes.length; j++) { $("." + mh_exec_classes[j]).matchHeight(); } } } }).trigger("resize.baseResize"); $(function() { var $body = $("body"); var scrlpos = $(window).scrollTop(); /** * Menu button for Smartphone */ var $sp_menu = $("#footer .js_sp_menu"); var $sp_menu_btn = $("#footer .js_menu_button"); if($sp_menu.length){ $sp_menu_btn.css("z-index", -1).on("click", function(e){ e.preventDefault(); if(!$(this).hasClass("pagein")) return; if(!$body.hasClass("menu-opened")){ scrlpos = $(window).scrollTop(); $body.css({top: -scrlpos}).addClass("menu-opened"); }else{ $body.css("top", "").removeClass("menu-opened"); $(window).scrollTop(scrlpos); } }); $(window).on("scroll.ss_spmenu", function(){ var scrltop = $(window).scrollTop(); var showed = $sp_menu_btn.hasClass("pagein"); if((scrltop>0 && showed) || (scrltop<1 && !showed)) return; if(scrltop>0 && !showed){ $sp_menu_btn.css("z-index", "").addClass("pagein"); }else if(scrltop<1 && showed && !$body.hasClass("menu-opened")){ $sp_menu_btn.removeClass("pagein").on("transitionend.ss_spmenu", function(){ $sp_menu_btn.css("z-index", -1).off("transitionend.ss_spmenu"); }); } }); if(window.matchMedia){ $(window).on("resize.ss_spmenu", function(){ if(window.matchMedia("(max-width: 640px)").matches){ $body.addClass("view-mode-sp"); }else{ $body.removeClass("view-mode-sp").css("top", ""); } }).trigger("resize.ss_spmenu"); } } /** * Go back to the top of the page, or got to some contents top by an in-page links href. */ $("a[href^='#']").on("click", function(e) { var navHight = 0; var scroll_poseed = 500; var url = $(location).attr("href"); var href= $(this).attr("href"); var $target = $(href == "#" || href == "" ? "html" : href); var position = $target.offset().top - navHight; if (url.indexOf("?id=") !== -1) { var url_scroll_pos = url.scroll_poslit("?id="); var hash = "#" + url_scroll_pos[url_scroll_pos.length - 1]; var $target2 = $(hash); var position2 = $target2.offset().top - navHight; $("html, body").animate({scrollTop: position2}, scroll_poseed, "swing"); } else { e.preventDefault(); $("html, body").animate({scrollTop: position}, scroll_poseed, "swing"); } }); /** * Call function of modal window. Set the "js_modal" class to an HTML Element. Note: case of use the "jQuery.colorbox". */ if (typeof $.fn.colorbox !== "undefined") { var scroll_event = "onwheel" in document ? "wheel" : "onmousewheel" in document ? "mousewheel" : "DOMMouseScroll"; $(".js_modal").colorbox({ current: "{current}/{total}", maxWidth: "90%", maxHeight: "90%", onOpen: function() { $(document).on(scroll_event, function(e) { e.preventDefault(); }); $(document).on("touchmove.noScroll", function(e) { e.preventDefault(); }); }, onClosed: function() { $(document).off(scroll_event); $(document).off(".noScroll"); } }); } /** * Disable a Tel link with others than smartphone. */ if(!/i(phone|pod|pad)|android|windows.*phone/i.test(navigator.userAgent)){ $(document).on("click", "a[href^='tel:']", function(e){ e.preventDefault(); }); } /** * Call function of deqwas. */ $.recommendInner(); /** * Call function of highlight words. */ var hlwords = new HighlightWords(); hlwords.executeOn("#main"); /** * Call function of telModalLink. */ telModalLink(); }); /** * Applicate HTML5 Elements for a browser of not handle HTML5 (for example IE8). */ if(!/*@cc_on!@*/0) return; var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video,main".split(","); for(var i = 0; i < e.length; i++) { document.createElement(e[i]); } })(jQuery);