PageSourceSearch

https://www.yakiniku-nikuichi.com/shared_new/js/shared.js

js yakiniku-nikuichi.com collected 2026-10-08 10:41:05 UTC 10,343 bytes, 307 lines download raw bytes

1/*!
2 * ScriptName: shared.js
3 *
4 * FoodConnection
5 * http://foodconnection.jp/
6 * http://foodconnection.vn/
7 *
8 */
9
10// $(document).ready(function () {
11//   $(".slick-auto").on("touchstart", function (e) {
12//     $(this).slick("slickPlay");
13//   });
14// });
15
16$(function () {
17  $("body").removeClass("navOpen");
18  $(".hamburger").click(function () {
19    if ($("body").hasClass("navOpen")) {
20      $("body").addClass("navClose");
21      $("body").removeClass("navOpen");
22      // $('body').css('position', 'static');
23      //$(window).scrollTop(offsetZ);
24      $(".hamburger").removeClass("is-active");
25    } else {
26      $("body").addClass("navOpen");
27      $("body").removeClass("navClose");
28      /* offsetZ = window.pageYOffset;
29	   
30		$('body').css({
31		  position: 'fixed',
32		  width: '100%',
33		  'top': -offsetZ + 'px'
34		});
35		*/
36      $(".hamburger").addClass("is-active");
37      return false;
38    }
39  });
40
41  $("#navigation a, .menu-close").click(function () {
42    $("body").removeClass("navOpen");
43    $("body").addClass("navClose");
44    $(".hamburger").removeClass("is-active");
45    // $('body').css('position', 'static');
46  });
47
48  $(".btn-copy").click(function () {
49    $(".btn-copy").addClass("hs-copie");
50  });
51});
52
53$(document).ready(function () {
54  $(window).scroll(function () {
55    var TargetPos = $("section").offset().top;
56    var ScrollPos = $(window).scrollTop();
57
58    if (ScrollPos > TargetPos) {
59      $("body").addClass("has_nav");
60    } else {
61      $("body").removeClass("has_nav");
62    }
63  });
64});
65
66function objectFitPolyfill() {
67  // Internet Explorer 6-11
68  var isIE = /*@cc_on!@*/ false || !!document.documentMode;
69  // Edge 20+
70  var isEdge = !isIE && !!window.StyleMedia;
71  if (isIE === true || isEdge === true) {
72    $(".object-fit-cover").each(function (index, element) {
73      let src = $(element).attr("data-src");
74      if (src === undefined) {
75        src = $(element).attr("src");
76      }
77      $(element).css("display", "none");
78      $(element)
79        .parent()
80        .css({
81          "background-image": "url('" + src + "')",
82          "background-repear": "no-repeat",
83          "background-size": "cover",
84          "background-position": "center center",
85        });
86    });
87  }
88}
89$(document).ready(function () {
90  objectFitPolyfill();
91});
92/*--------------------------------LANG-PAGE--------------------------------*/
93// $('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true"
94$(document).ready(function () {
95  if ($("#lang-page").length) $(document).on("scroll", onScroll);
96  $('.nav-fixed a[href*="#"]').on("click", function () {
97    var e = $(this).attr("href");
98    var h = $(".nav-fixed").outerHeight();
99    var b = $(e).length ? $(e).offset().top : 0;
100    $("html, body").animate(
101      {
102        scrollTop: b + 1 - h,
103      },
104      1000
105    );
106  });
107});
108function onScroll() {
109  var scroll = $(window).scrollTop();
110  var header = $(".nav-fixed").outerHeight();
111  $('.nav-fixed a[href^="#"]').each(function () {
112    var el = $(this).attr("href");
113    var offset = $(el).length ? $(el).offset().top : 0;
114    if (
115      scroll + header >= offset &&
116      $(el).outerHeight() + offset > scroll + header
117    ) {
118      $('.nav-fixed a[href^="#"]').removeClass("active");
119      $(this).addClass("active");
120    }
121  });
122}
123var lastScrollTop = 0;
124/*--------------------------------END-LANG-PAGE--------------------------------*/
125// /*====================*__ACTIVE-2NAV__*====================*/
126// $(document).ready(function() {
127//     if ($('.nav-fixed[scroll-active]').length && $('.nav-fixed').attr('scroll-active') === "true")
128//         $(document).on('scroll', onScroll)
129//     $('.nav-fixed a[href*="#"] , #menu_toggle nav a[href^="#"]').on('click', function() {
130//         // console.log(1)
131//         var e = $(this).attr('href')
132//         var h = $(window).width() > 1000 ? $('.nav-fixed').outerHeight() : 0
133//         var b = $(e).length ? $(e).offset().top : 0
134//         $('html, body').animate({
135//             scrollTop: (b + 1 - h)
136//         }, 500)
137//         if ($('body').hasClass('navOpen')) {
138//             $("body").removeClass("navClose");
139//             $("body").addClass("has_nav");
140//             $(".hamburger").removeClass("is-active");
141//             //     // Clear ALL
142//             //     bodyScrollLock.clearAllBodyScrollLocks();
143//         }
144//         return false;
145//     })
146// });
147
148// function onScroll() {
149//     var scroll = $(window).scrollTop()
150//     var header = $('.nav-fixed').outerHeight()
151//     var element = $(window).width() > 1000 ? '.nav-fixed nav a[href^="#"]' : '#menu_toggle nav a[href^="#"]'
152//     $(element).each(function() {
153//         var el = $(this).attr('href')
154//         var offset = $(el).length ? $(el).offset().top : 0
155//             // if ($(this).find('img').length) {
156//             //     var _src_ = $(this).find('img').attr("src");
157//             //     _src_ = _src_.replace(/^(.*?)_on\.(.*)$/, "$1.$2");
158//             //     $(this).find('img').attr("src", _src_)
159//             // }
160//         if ((scroll + header) >= offset && ($(el).outerHeight() + offset) > (scroll + header)) {
161//             $(element).removeClass('active')
162//             $(this).addClass('active')
163//             if ($(this).find('img').length) {
164//                 // $(element + ' img').addClass('btn')
165//                 // $(this).find('img').removeClass('btn')
166//                 $(element + ' img').each(function() {
167//                     var src = $(this).attr('src')
168//                     var newSrc = src.replace('_on', '')
169//                     $(this).attr('src', newSrc)
170//                 })
171//                 $(this).find('img').attr("src").match(/^(.*)(\.{1}.*)/g);
172//                 var newSrc = RegExp.$1 + "_on" + RegExp.$2;
173//                 $(this).find('img').attr("src", newSrc); // update src
174
175//             }
176//             // $(this).find('img').trigger('mouseout').trigger('mouseover')
177//         }
178//     })
179// }
180// var lastScrollTop = 0;
181 //fix scroll ios
182 var overflowIsHidden = function(node) {
183  var style = getComputedStyle(node);
184  return style.overflow === "hidden" || style.overflowX === "hidden" || style.overflowY === "hidden";
185}
186var isItScrollableWithoutVisibleScrollbars = function(el) {
187  if (el === null) return false;
188  var isScrollable = false,
189    hasScrollbars = false;
190  isScrollable = el.scrollHeight > el.offsetHeight ? true : false; // first, lets find out if it has scrollable content
191  // isScrollable = el.scrollHeight + 1 > el.clientHeight ? true : false; // first, lets find out if it has scrollable content
192  if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth) ? true : false; // if it's scrollable, let's see if it likely has scrollbars
193  // if (isScrollable) hasScrollbars = (el.offsetWidth > el.scrollWidth - 1) ? true : false; // if it's scrollable, let's see if it likely has scrollbars
194  if (isScrollable && !hasScrollbars && !overflowIsHidden(el)) return true;
195  else return false;
196};
197document.addEventListener("touchmove", function(e) {
198  if (document.body.classList.contains("navOpen") && !isItScrollableWithoutVisibleScrollbars(document.getElementById("navigation"))) e.preventDefault();
199}, {
200  passive: false
201});
202// BEGIN: scroll to top
203$(".pagetop").click(function () {
204  $("html, body").animate({ scrollTop: 0 }, 1000);
205});
206
207// Set time out is run when slick initialized
208setTimeout(function () {
209  // Enable Slick Play when Focus or Touch On Slider
210  $('.slick-initialized.slick-slider').on(
211    'touchend touchcancel touchmove touchstart',
212    function () {
213      $(this).slick('slickPlay')
214    }
215  )
216}, 0)
217
218$(window).on('resize load', function () {
219  $('.slick-initialized.slick-slider').each(function () {
220    $(this).slick('resize')
221  })
222})
223
224// Slick slider auto play when in viewport
225function sliderAutoPlayInViewPort() {
226  var settings = {
227    selector: '.slide-auto-play-in-view',
228    debug: false,
229  }
230
231  // Add option autoplay: false
232  if ($(settings.selector).hasClass('slick-initialized')) {
233    $(settings.selector).slick('slickSetOption', 'autoplay', false)
234  }
235
236  // Detect Browser support observer
237  if (
238    'IntersectionObserver' in window &&
239    'IntersectionObserverEntry' in window &&
240    'intersectionRatio' in window.IntersectionObserverEntry.prototype
241  ) {
242    // Create observer
243    var observer = new IntersectionObserver(
244      function (entries) {
245        entries.forEach(function (entry) {
246          // Check element is Slick Initialized
247          if ($(entry.target).hasClass('slick-initialized')) {
248            if (entry.isIntersecting) {
249              $(entry.target).slick('slickPlay')
250              settings.debug ? console.log(entry.target.id + ' play') : null
251            } else {
252              $(entry.target).slick('slickPause')
253              settings.debug ? console.log(entry.target.id + ' pause') : null
254            }
255          } else {
256            console.log('not slick')
257          }
258        })
259      },
260      {
261        threshold: 0,
262      }
263    )
264
265    // Add observer to each slide
266    $(settings.selector).each(function () {
267      observer.observe(this)
268    })
269
270    // Remove observer
271    $(settings.selector).on('destroy', function () {
272      observer.unobserve(this)
273    })
274  } else {
275    // If browser not support observer
276
277    function isElementInViewport(el) {
278      var elementTop = $(el).offset().top - 100 //fix top 100px
279      var elementBottom = elementTop + $(el).outerHeight() - 100 //fix bottom 100px
280
281      var viewportTop = $(window).scrollTop()
282      var viewportBottom = viewportTop + $(window).height()
283
284      return elementBottom > viewportTop && elementTop < viewportBottom
285    }
286
287    // Add event scroll to check if slide in viewport
288    $(window).on('load scroll', function () {
289      $(settings.selector).each(function () {
290        if ($(this).hasClass('slick-initialized')) {
291          if (isElementInViewport(this)) {
292            settings.debug ? console.log($(this).attr('id') + ' play') : null
293            $(this).slick('slickPlay')
294          } else {
295            settings.debug ? console.log($(this).attr('id') + ' pause') : null
296            $(this).slick('slickPause')
297          }
298        } else {
299          console.log('not slick')
300        }
301      })
302    })
303  }
304}
305// Run function after all slick initialized
306setTimeout(sliderAutoPlayInViewPort, 0)
307

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.