PageSourceSearch

https://sailsdining-osaka.com/js/common.js

js sailsdining-osaka.com collected 2026-10-10 00:01:38 UTC 10,559 bytes, 343 lines download raw bytes

1// JavaScript Document
2"use strict";
3
4var TweenMax = TweenMax || null;
5var Power0 = Power0 || null ;
6var Power1 = Power1 || null ;
7var Power2 = Power2 || null ;
8var Power3 = Power3 || null ;
9var Power4 = Power4 || null ;
10var Sine = Sine || null ;
11var Circ = Circ || null ;
12var Expo = Expo || null ;
13var Back = Back || null ;
14var Bounce = Bounce || null ;
15var Elastic = Elastic || null ;
16
17var RENOCA = RENOCA || {};
18
19RENOCA.common = (function($) {
20
21	/* private const */
22	var TWEEN = TweenMax,
23	SP_W = 768, PC = 'pc', SP = 'sp',
24
25	UA = (function() {
26		var ua = window.navigator.userAgent.toLowerCase(),
27		appVer = window.navigator.appVersion.toLowerCase();
28
29		return {
30			IE:Boolean((ua.indexOf('msie') >= 0 || ua.indexOf('trident') >= 0)),
31			lteIE8:Boolean(appVer.indexOf("msie 8.") > -1) || Boolean(appVer.indexOf("msie 7.") > -1) || Boolean(appVer.indexOf("msie 6.") > -1),
32			gtIE10:Boolean(document.uniqueID && window.matchMedia),
33			chrome:Boolean(window.chrome),
34			safiri:typeof window.chrome === "undefined" && 'WebkitAppearance' in document.documentElement.style,
35			firefox:'MozAppearance' in document.documentElement.style,
36			opera:Boolean(window.opera),
37			mobile:/android|iphone|ipod|ipad/i.test(ua),
38			android:/android/i.test(ua),
39			androidVer:(/android/i.test(ua)) ? parseFloat(ua.slice(ua.indexOf('android') + 8)) : 0,
40			ios:/iphone|ipod|ipad/i.test(ua),
41			iphone:/iphone|ipod/i.test(ua),
42			ipad:/ipad/i.test(ua)
43		};
44	})(),
45	TOUCH = UA.mobile,
46
47	// events
48	TOUCH_START = 'touchstart',
49	TOUCH_MOVE = 'touchmove',
50	TOUCH_END = 'touchend',
51	DRAG_START = TOUCH ? 'touchstart' : 'mousedown',
52	DRAG_MOVE = TOUCH ? 'touchmove' : 'mousemove',
53	DRAG_END = TOUCH ? 'touchend' : 'mouseup',
54	ON_SCROLL_IN = 'onScrollIn';
55
56	/* private vars */
57	var _$self, _$window, _$body, _$header, _$lp_header,
58	_state, _w, _h, _st, _stBefore,
59	_$swipeTarget, _ts, _tm, _obj,
60	_$stock, _stockObj = {leng:0, pos:0, x:0, drag:true, isAnime:false}, _stockPage, _stockDsiplay;
61
62	var onResize = function() {
63		_w = _$window.width();
64		_h = _$window.height();
65
66		if(_w > SP_W) {
67			if(_state != PC) {
68				_state = PC;
69				$('header').removeClass('open');
70				$('a, span', 'header nav .gnav li').css('transform', 'translate(0,0)');
71				$('header nav').show();
72				TWEEN.set($('#btn_menu div:eq(0)'), {rotation:0, top:4});
73				TWEEN.set($('#btn_menu div:eq(1)'), {rotation:'-180deg', top:14});
74				_stockDsiplay = 5;
75			}
76		} else {
77			if(_state != SP) {
78				_state = SP;
79				$('header nav').hide();
80				_self.openMenu(false);
81				_stockDsiplay = 2;
82			}
83		}
84
85		_stockPage = Math.ceil(_stockObj.leng / _stockDsiplay);
86		_stockObj.pos = Math.min(_stockPage - 1, _stockObj.pos);
87		_stockObj.x = _stockObj.$item.outerWidth(true) * -(_stockObj.pos * _stockDsiplay);
88		var padding = parseInt(_stockObj.$item.css('padding-left').replace('px', '')) * 2;
89		_stockObj.$item.width((_$stock.parent().width() + padding) / _stockDsiplay - padding);
90		_$stock.width(_stockObj.$item.outerWidth(true) * _stockObj.leng + 100);
91		_stockObj.setPos();
92	};
93
94	var onScroll = function() {
95		_h = _$window.height();
96		_st = _$window.scrollTop();
97
98		if(_st > _h) {
99			_$header.addClass('min');
100			_$lp_header.addClass('min');
101		} else {
102			_$header.removeClass('min');
103			_$lp_header.removeClass('min');
104		}
105
106		var $e;
107		$('.anime:not(.on)').each(function(i, e) {
108			$e = $(e);
109			if((_st + _h) > $e.offset().top + (_h * 0.20)) {
110				$e.addClass('on');
111				if($e.data('scrollin')) {
112					_$self.trigger(ON_SCROLL_IN, {data:$e.data('scrollin')});
113				}
114			}
115		});
116	};
117
118	var _self = {
119		ua:UA, pc:PC, sp:SP, spW:SP_W,
120		touch:TOUCH,
121		touchStart:TOUCH_START, touchMove:TOUCH_MOVE, touchEnd:TOUCH_END,
122		dargStart:DRAG_START, dragMove:DRAG_MOVE, dragEnd:DRAG_END,
123		onScrollIn:ON_SCROLL_IN,
124
125		init:function() {
126			_$window = $(window);
127			_$body = $('body');
128			_$header = $('header');
129			_$lp_header = $('.lp-header');
130
131			$('header nav .gnav li a, header nav .gnav li span, .breadcrumbs li a').hover(
132					function(){ $(this).removeClass('out').addClass('over'); },
133					function(){ $(this).removeClass('over').addClass('out'); }
134				);
135
136
137
138			$('header nav .pull').hover(
139				function() {
140					$(this).children('ul').stop().slideDown(200);
141				},
142				function() {
143					$(this).children('ul').stop().slideUp(100);
144				}
145			);
146
147			$('#btn_menu').on('click', function(){
148				_self.openMenu(!_$header.hasClass('open'));
149			});
150			TWEEN.set($('#btn_menu div:eq(1)'), {rotation:'-180deg'});
151
152
153			_$stock = $('#stocklist .carousel_inner ul').data('obj', _stockObj
153);
154			_stockObj.$item = $('#stocklist .carousel_inner li');
155			_stockObj.$prev = $('#stocklist .carousel .btn_prev');
156			_stockObj.$next = $('#stocklist .carousel .btn_next');
157			_stockObj.leng = _stockObj.$item.length;
158			_stockObj.setPos = function(){
159				_stockObj.x = _stockObj.$item.outerWidth(true) * -(_stockObj.pos * _stockDsiplay);
160				TWEEN.to(_$stock, 0.3, {left:_stockObj.x, ease:Power1.easeOut});
161				$('#stocklist .carousel .pageing ol li').removeClass('act');
162				$('#stocklist .carousel .pageing ol li:eq(' + _stockObj.pos + ')').addClass('act');
163			};
164			if (_stockObj.leng > 0) {
165				var li = '';
166				for(var i = 0; i < Math.ceil(_stockObj.leng / 2); i++) { li += '<li></li>'; }
167				$('#stocklist .carousel .pageing ol').html(li);
168				$('#stocklist .carousel .pageing ol li:gt(' + (Math.ceil(_stockObj.leng / 5) - 1) + ')').addClass('sp');
169			}
170			_stockObj.$prev.on('click', function(){
171				if(_stockObj.pos) { --_stockObj.pos; }
172				_stockObj.setPos();
173			});
174			_stockObj.$next.on('click', function(){
175				if(_stockObj.pos < _stockPage - 1) { ++_stockObj.pos; }
176				_stockObj.setPos();
177			});
178			_$stock.on(TOUCH_START, _self.swipe);
179
180
181			$('.pagetop').on('click', function(){
182				_self.smoothScroll(0);
183				return false;
184			});
185			if (_stockObj.leng > 0) {
186				_$window.on('resize', onResize).trigger('resize');
187			}
188			_$window.on('scroll', onScroll).trigger('scroll');
189
190		},
191		swipe:function(event) {
192			switch(event.type) {
193				case TOUCH_START :
194					_tm = 0;
195					_ts = event.originalEvent.touches[0].clientX;
196					_$body.on(TOUCH_MOVE, _self.swipe).on(TOUCH_END, _self.swipe);
197					_$swipeTarget = $(this);
198					_obj = _$swipeTarget.data('obj');
199					break;
200				case TOUCH_MOVE :
201					_tm = event.originalEvent.touches[0].clientX - _ts;
202					if(Math.abs(_tm) > 5) { event.preventDefault(); }
203					if(_obj.drag) { TWEEN.set(_$swipeTarget, {left:_obj.x + _tm}); }
204					break;
205				case TOUCH_END :
206					if(Math.abs(_tm) > 5) { event.preventDefault(); }
207					if(_tm < -50) {
208						_obj.$next.trigger('click');
209					} else if(_tm > 50) {
210						_obj.$prev.trigger('click');
211					} else {
212						_obj.setPos();
213					}
214					_$body.off(TOUCH_MOVE, _self.swipe).off(TOUCH_END, _self.swipe);
215					break;
216			}
217		},
218		openMenu:function(bool){
219			if(_$header.hasClass('open') === bool) { return; }
220
221			if(bool) {
222				_stBefore = _st;
223				$('html').addClass('noscroll');
224				_$header.addClass('open');
225				$('header nav').show();
226				$('header #navbg div span').each(function(i, e) {
227					TWEEN.fromTo($(e), 0.3, {css:{opacity:0, y:'100%'}}, {css:{opacity:1, y:'-1%'}, delay:0.02 * i, ease:Power1.easeOut});
228				});
229				$('> a, > span', 'header nav .gnav > li').each(function(i, e) {
230					TWEEN.fromTo($(e), 0.3, {css:{y:'100%'}}, {css:{y:'0%'}, delay:0.02 * i + 0.3, ease:Power1.easeOut});
231				});
232				TWEEN.to($('#btn_menu div:eq(0)'), 0.3, {top:7, rotation:'45deg', ease:Power1.easeOut});
233				TWEEN.to($('#btn_menu div:eq(1)'), 0.3, {top:7, rotation:'-225deg', ease:Power1.easeOut});
234				TWEEN.fromTo($('.lines, .cnav, .sns, .copy', 'header nav'), 0.3, {opacity:0}, {opacity:1, delay:0.6, ease:Power1.easeOut});
235			} else {
236				$('html').removeClass('noscroll');
237				_$window.scrollTop(_stBefore);
238				_$header.removeClass('open');
239				TWEEN.to($('header #navbg div span'), 0.3, {css:{opacity:0, y:'-100%'}, ease:Power1.easeOut});
240				TWEEN.to($('> a, > span', 'header nav .gnav li'), 0.3, {css:{y:'-100%'}, ease:Power1.easeOut});
241				TWEEN.to($('#btn_menu div:eq(0)'), 0.3, {rotation:0, top:4, ease:Power1.easeOut});
242				TWEEN.to($('#btn_menu div:eq(1)'), 0.3, {rotation:'-180deg', top:14, ease:Power1.easeOut, onComplete:function(){
243					$('header nav').hide();
244				}});
245
246				TweenMax.killTweensOf($('.lines, .cnav, .sns, .copy', 'header nav'));
247				TWEEN.to($('.lines, .cnav, .sns, .copy', 'header nav'), 0.3, {opacity:0, ease:Power1.easeOut});
248			}
249		},
250		smoothScroll:function(pos) {
251			$('html, body').stop().animate({scrollTop:pos}, {duration:500, queue:false});
252		},
253		resize:onResize
254	};
255
256	_$self = $(_self);
257
258	return _self;
259}(jQuery));
260
261$(RENOCA.common.init);
262
263
264
265/**
266 * jQuery heightFix - v1.1.0
267 * Depends: jQuery
268 */
269(function(jQuery) {
270	jQuery.fn.heightFix = function(groupNum) {
271		var group;
272		var maxH;
273		var leng = this.length;
274
275		if(!groupNum) {
276			groupNum = leng;
277		}
278
279		this.css('height', 'auto');
280		if(groupNum < 0) { return this; }
281
282		this.each(function(i) {
283			var j = i % groupNum;
284			if(j === 0) {
285				group = [];
286				maxH = 0;
287			}
288
289			maxH = Math.max(jQuery(this).height(), maxH);
290			group.push(jQuery(this));
291
292			if(i === leng - 1 || j === groupNum - 1) {
293				jQuery.each(group, function() { this.height(maxH); });
294			}
295		});
296
297		return this;
298	};
299})(jQuery);
300
301$(function() {
302	  var $elem = $('.js-image-switch');
303	  var sp = '_sp';
304	  var pc = '_pc';
305	  var replaceWidth = 960;//ブレイクポイント指定
306
307	  function imageSwitch() {
308	    var windowWidth = window.innerWidth; //ウィンドウサイズ取得
309
310	    $elem.each(function() {
311	      var $this = $(this);
312	      if(windowWidth >= replaceWidth) {
313	        $this.attr('src', $this.attr('src').replace(sp, pc));
314
315	      } else {
316	        $this.attr('src', $this.attr('src').replace(pc, sp));
317	      }
318	    });
319	  }
320	  imageSwitch();
321	// リサイズの実行タイミング設定
322	  var resizeTimer;
323	  $(window).on('resize', function() {
324	    clearTimeout(resizeTimer);
325	    resizeTimer = setTimeout(function() {
326	      imageSwitch();
327	    }, 200);
328	  });
329	});
330
331	    // アコーディオンの制御
332        document.querySelectorAll('.faq-question').forEach(button => {
333            button.addEventListener('click', () => {
334                const faqItem = button.parentElement;
335                
336                // 他のアイテムを閉じたい場合は以下を有効化
337                // document.querySelectorAll('.faq-item').forEach(item => {
338                //     if (item !== faqItem) item.classList.remove('active');
339                // });
340
341                faqItem.classList.toggle('active');
342            });
343        });

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.