PageSourceSearch

https://mikami-naika-clinic.jp/wp-content/themes/grits_theme/js/grits.common.js?ver=6.9.5

js mikami-naika-clinic.jp collected 2026-10-08 17:00:51 UTC 11,485 bytes, 345 lines download raw bytes

1/*
2----------------------------------------------------------------------
3
4A compilation of common javascript for grits project.
5
6VIETRY CO., LTD.
7Lastest update 14/07/2020.
8Author: BaoPD
9
10----------------------------------------------------------------------
11*/
12
13// Common scripts
14
15if (document.body.classList.contains("home_page")) {
16  function setResponsiveVideo() {
17    const video = document.getElementById("myvideo");
18    const source = document.getElementById("source_video");
19    const templateUrl = video.getAttribute("data-template-url");
20    const isPortraitMobile =
21      window.innerWidth <= 768 && window.innerHeight > window.innerWidth;
22
23    const newSrc = isPortraitMobile
24      ? templateUrl + "/video/video_sp.mp4"
25      : templateUrl + "/video/video_pc.mp4";
26
27    if (source.getAttribute("src") !== newSrc) {
28      source.setAttribute("src", newSrc);
29      video.load();
30    }
31  }
32
33  window.addEventListener("load", setResponsiveVideo);
34  window.addEventListener("resize", setResponsiveVideo);
35}
36
37function toggleSlick() {
38  const slider = document.querySelector(".idx_banner .flex");
39  const isMobile = window.innerWidth < 769;
40
41  if (!slider) return;
42
43  if (isMobile && !slider.classList.contains("slick-initialized")) {
44    $(slider).slick({
45      infinite: true,
46      slidesToShow: 2,
47      slidesToScroll: 1,
48      autoplay: true,
49      autoplaySpeed: 4000,
50      centerMode: true,
51      variableWidth: true,
52      dots: true,
53    });
54  } else if (!isMobile && slider.classList.contains("slick-initialized")) {
55    $(slider).slick("unslick");
56  }
57}
58
59document.addEventListener("DOMContentLoaded", toggleSlick);
60window.addEventListener("resize", toggleSlick);
61
62$(function () {
63  "use strict";
64
65$(document).ready(function () {
66    $(".key_close").on("click", function () {
67		$(this).parent().hide();
68		$('#open-chatbot').addClass('bottom');
69    });
70  });
71
72  var isMobile = false;
73  function check_mobile() {
74    var check = false;
75    if (
76      /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(
77        navigator.userAgent
78      ) ||
79      /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
80        navigator.userAgent.substr(0, 4)
81      )
82    ) {
83      check = true;
84    }
85    return check;
86  }
87  check_mobile();
88  isMobile = check_mobile();
89  $(window).resize(function () {
90    check_mobile();
91    isMobile = check_mobile();
92  });
93
94  $(".button-toggle, .menu_toggle a, .menu_toggle .close").on(
95    "click",
96    function () {
97      $(".button-toggle").stop().toggleClass("active");
98      $("#nav-icon").stop().toggleClass("open");
99      $(".menu_toggle").stop().toggleClass("active");
100      $("html, body").stop().toggleClass("ovh");
101
102      var text = $("#menu_btn").text();
103      $("#menu_btn").text(text == "MENU" ? "CLOSE" : "MENU");
104    }
105  );
106
107  function header_mobile() {
108    let y = 0;
109    $(document).on("scroll", function () {
110      y = $(this).scrollTop();
111      if (y > 10) {
112        $("header").addClass("active");
113      } else {
114        $("header").removeClass("active");
115      }
116      switch (isMobile) {
117        case true:
118          if (y > 10) {
119            //$(".fixed_banner").addClass("active");
120          } else {
121            //$(".fixed_banner").removeClass("active");
122          }
123          break;
124        case false:
125          //$(".fixed_banner").removeClass("active");
126          break;
127      }
128    });
129  }
130  header_mobile();
131
132  // To Top
133  var mv_h, win_h;
134  var y = 0;
135  mv_h = $(".key").height();
136  $(document).on("scroll", function () {
137    y = $(this).scrollTop();
138
139    win_h = $(window).height() - 200;
140    if (y > 100 && y > mv_h - win_h) {
141      $(".totop, .key_banner, #open-chatbot, .fixed_banner").addClass("active");
142    } else {
143      $(".totop, .key_banner, #open-chatbot, .fixed_banner").removeClass("active");
144    }
145	
146	var _f = $('footer').offset().top;
147	
148	if (y + 400 > _f) {
149		$("#open-chatbot").addClass('pad');
150	}
151	else {
152		$("#open-chatbot").removeClass('pad');
153	}
154	
155  });
156  $(".totop").on("click", function () {
157    $("html,body").animate({ scrollTop: 0 }, 400);
158  });
159
160  // Navi
161  if ($(".pc_navi").length) {
162    $(".pc_navi > ul > li").on("mouseenter", function () {
163      $(this).find(".subInner").addClass("active");
164    });
165    $(".pc_navi > ul > li").on("mouseleave", function () {
166      $(this).find(".subInner").removeClass("active");
167    });
168  }
169  
170  //
171  	const $modal = jQuery('.modal');
172	const $openButtons = jQuery('.fixed_banner .tel a, .tel_click');
173	const $closeButton = jQuery('.modal_close');
174
175
176	$openButtons.on('click', function (e) {
177		e.preventDefault();
178		$modal.addClass('active');
179		jQuery('html, body').css('overflow', 'hidden');
180	});
181
182
183	$closeButton.on('click', function () {
184		$modal.removeClass('active');
185		jQuery('html, body').css('overflow', '');
186	});
187
188	$modal.on('click', function (e) {
189		if (jQuery(e.target).is($modal)) {
190		  $modal.removeClass('active');
191		  jQuery('html, body').css('overflow', '');
192		}
193	});
194});
195
196/*******************************************************************************************
197 *******************************************************************************************
198 *******************************************************************************************/
199
200// Common Library
201
202$(function () {
203  const lib = new gritsProjectCommonLib();
204});
205
206// Scripts constructor.
207// If not sure please leave this unchange.
208const gritsProjectCommonLib = function () {
209  this.tab = function (Container, Content, Pager) {
210    if ($(Container).length) {
211      $(Container).each(function () {
212        var content = $(this).find(Content);
213        var pager = $(this).find(Pager);
214        var item = content.children();
215        var pagerItem = pager.children();
216        item.first().addClass("active");
217        pagerItem.first().addClass("active");
218
219        var SetHeight = function () {
220          if ($(Pager).hasClass("st2")) {
221            setTimeout(function () {
222              content.height(item.filter(".active").outerHeight(true));
223            }, 0);
224
225            setTimeout(function () {
226              $(".TabContent.st1 > .content").height(
227                $(".TabContent.st1 > .content")
228                  .children()
229                  .filter(".active.tab1")
230                  .outerHeight(true)
231              );
232            }, 350);
233          } else {
234            setTimeout(function () {
235              content.height(item.filter(".active.tab1").outerHeight(true));
236            }, 10);
237          }
238        };
239
240        SetHeight();
241        $(window).resize(function () {
242          SetHeight();
243        });
244
245        pagerItem.on("click", function (e) {
246          e.preventDefault();
247          e.stopPropagation();
248          var index = $(this).attr("data-index");
249          $(this).siblings().removeClass("active");
250          $(this).addClass("active");
251          item.removeClass("active");
252          item.eq(index - 1).addClass("active");
253          SetHeight();
254        });
255      });
256    }
257    /* Usage
258      └── [HTML]
259        <div class="TabContainer">
260          <ul id="Pager" class="TabPager">
261            <li data-index="01" href="" class="active"><p>1</p></li>
262            <li data-index="02" href=""><p>2</p></li>
263            <li data-index="03" href=""><p>3</p></li>
264          </ul>
265          <div class="TabContent">
266            <ul>
267              <li>Tab 01</li>
268              <li>
268Tab 02</li>
269              <li>Tab 03</li>
270            </ul>
271          </div>
272        </div>
273      └── [Script]
274        $.fn.tab(".TabContainer", ".TabContent ul", ".TabPager");
275    */
276  };
277
278  this.accordian = function (Container, Content, Button, TIME) {
279    TIME = TIME ? TIME : 300;
280    $(Container + " " + Content)
281      .not(".active")
282      .hide();
283    $(Container + " " + Button).on("click", function () {
284      $(this).toggleClass("rotate");
285      $(this).closest(Container).find(Content).first().slideToggle(TIME);
286    });
287    /* Usage
288      └── [HTML]
289        <div class="accContainer">
290          <p class="accBtn"></p>
291          <div class="accBlock">
292            <div class="accContainer lv2">
293              ...
294            </div>
295          </div>
296        </div>
297      └── [Script]
298        $.fn.accordian(".accContainer", ".accBlock", ".accBtn", "300");
299    */
300  };
301
302  this.fixedHeight = function (Container, Item) {
303    if ($(Item).length) {
304      function fixedHeight() {
305        $(Item).css({ height: "" });
306        $(Container).each(function () {
307          var h = 0;
308          var item = $(this).find($(Item));
309          item.each(function () {
310            $(this).innerHeight() >= h ? (h = $(this).innerHeight()) : h;
311          });
312          item.innerHeight(h);
313        });
314      }
315      $(window).on("resize", function () {
316        fixedHeight();
317      });
318    }
319  };
320
321  // Initialization
322  this.init = function () {
323    this.tab(
324      ".TabContainer.st1",
325      ".TabContent.st1 > .content",
326      ".TabPager.st1"
327    );
328    this.tab(
329      ".TabContainer.st2",
330      ".TabContent.st2 > .content",
331      ".TabPager.st2"
332    );
333    this.accordian(".accContainer", ".accBlock", ".accBtn");
334    if (window.innerWidth < 769) {
335      this.accordian(".accContainer", "ul", ".ttl");
336    }
337    this.accordian(".menu_toggle .lv2", "ul", ".title", "300");
338    console.log("Initialization common scripts complete.");
339  };
340  this.init();
341};
342
343/*******************************************************************************************
344 *******************************************************************************************
345 *******************************************************************************************/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.