PageSourceSearch

https://online.euglena.jp/js/usr/common.js

js euglena.jp collected 2026-09-24 18:01:54 UTC 20,810 bytes, 671 lines download raw bytes

1jQuery(function ($) {
2
3	var PR_JS = {};
4
5	/* ヘッダー調整 */
6	PR_JS.headerFixedTopPadding = function () {
7		var header_padding = function () {
8			if ($('.Header, .pr_eug-header').css('position') == 'fixed') {
9				if ($('body').css('padding-top') == '0px' || ($('body').attr('style') && $('body').attr('style').indexOf('padding-top') != -1)) {
10					$('body').css({
11						'padding-top': $('.Header, .pr_eug-header').outerHeight()
12					});
13				}
14				else {
15					$('body').css({
16						'padding-top': ''
17					});
18				}
19			}
20		}
21		header_padding();
22		$(window).on('resize', function () {
23			header_padding();
24		});
25
26		// 上下スクロール時の処理
27		var scroll = 0;
28		$(window).on('scroll', function() {
29			if((!$('.js-noscroll_pc').length && $(window).width() > 767) || (!$('.js-noscroll_sp').length && $(window).width() <= 767)) {
30				if(($(this).scrollTop() < scroll || $(this).scrollTop() < $(window).outerHeight() / 3) && !$('.js-scrolling').length) {
31					// 上スクロール時
32					$('.Header, .GlobalNav, .GlobalNav-Shopping, #Tags').removeClass('js-hide');
33				}
34				else {
35					// 下スクロール時
36					$('.Header, .GlobalNav, .GlobalNav-Shopping, #Tags').addClass('js-hide');
37					$('html, body').removeClass('js-noscroll_pc js-noscroll_sp');
38					$('.GlobalNav .Accordion + *').attr('style', '');
39					$('.GlobalNav-Block-Title.js-active, .Header-Menu, .GlobalNav').removeClass('js-active');
40				}
41				scroll = $(this).scrollTop();
42			}
43		});
44	}
45
46
47	/* ハンバーガー&メガメニュー */
48	PR_JS.headerMenu = function () {
49		// ハンバーガーメニュー
50		$('.Header-Menu').on('click', function () {
51			if($(this).hasClass('js-active')) {
52				$(this).removeClass('js-active');
53				$('html, body').removeClass('js-noscroll_sp');
54				$('#GlobalNav').removeClass('js-active');
55			$('.Header-Link-Search .js-gnav').removeClass('js-active').next().removeClass('js-active').slideUp(0).css('z-index','-1');
56			}
57			else {
58				$(this).addClass('js-active');
59				$('html, body').addClass('js-noscroll_sp').removeClass('js-noscroll_pc');
60				$('#GlobalNav').addClass('js-active');
61				$('.Header-Link-Search .js-gnav').removeClass('js-active').next().removeClass('js-active').slideUp(300).css('z-index','-1');
62			}
63		});
64		// メガメニュー
65		$('.js-gnav').on('click', function () {
66			if($(window).width() > 767) {
67				$('html, body').addClass('js-noscroll_pc');
68				if($(this).next().is(':hidden')) {
69					$('.js-gnav').removeClass('js-active').next().removeClass('js-active').slideUp(300).css('z-index','-1');
70					$(this).next().css('z-index','');
71				}
72				else {
73					$('html, body').removeClass('js-noscroll_pc');
74					$('.js-gnav').next().css('z-index','');
75				}
76			}
77			else {
78				if($(this).next().is(':hidden')) {
79					$('html, body').addClass('js-noscroll_pc');
80				}
81				else {
82					$('html, body').removeClass('js-noscroll_pc');
83				}
84			}
85			// 商品検索
86			if($(this).parent().hasClass('Header-Link-Search')) {
87				$('html, body').addClass('js-noscroll_sp');
88				if(!$(this).next().is(':hidden') && !$('.GlobalNav').hasClass('js-active')) {
89					$('html, body').removeClass('js-noscroll_sp');
90					$('#search_suggest_area_').remove();
91				}
92			}
93		});
94		$(document).on('click', function (event) {
95			if (!$(event.target).closest('.Header, .GlobalNav').length) {
96				// if($(window).width() > 767) {
97					$('.js-gnav').removeClass('js-active').next().removeClass('js-active').slideUp(300).css('z-index','');
98					$('html, body').removeClass('js-noscroll_pc js-noscroll_sp');
99				// }
100			}
101		});
102		// タブ切替
103		// $('.js-gnavTab').on('click', function () {
104		//   if($(window).width() > 767) {
105		//     $(this).closest('.GlobalNav-List').find('.js-gnavTab').removeClass('js-action');
106		//     $(this).addClass('js-action');
107		//     return false;
108		//   }
109		// });
110		$('.js-gnavTab').hover(function () {
111			if($(window).width() > 767) {
112				$(this).closest('.GlobalNav-List').find('.js-gnavTab').removeClass('js-action');
113				$(this).addClass('js-action');
114			}
115		});
116
117		// アンカーリンク対応
118		$('.GlobalNav a[href*=#]:not(a[href=#], .js-pagetop, .pr_eug-footer-pageTop)').on('click', function () {
119			const currentUrl = location.href.match(/(.[^#?]+)/)[0];
120			const targetUrl = $(this).prop('href').match(/(.[^#?]+)/)[0];
121			if( currentUrl == targetUrl ) {
122				$('.Header, .GlobalNav, #Tags').addClass('js-hide');
123				$('html, body').removeClass('js-noscroll_pc js-noscroll_sp');
124				$('.GlobalNav .Accordion + *').attr('style', '');
125				$('.GlobalNav-Block-Title.js-active, .Header-Menu, .GlobalNav').removeClass('js-active');
126			}
127		});
128
129
130		/* ============================================= */
131		/* 旧スクリプト(使用中ページがあるかものため、以下に残しておく) */
132		/* ============================================= */
133		/* SP */
134		$('.pr_eug-header-menuBtn').on('click', function () {
135			$('.pr_eug-header-menuBar').toggleClass('pr_js-active');
136			$('.MegaMenu-bdy').removeClass('close');
137			$('body').css({'overflow':'hidden'});
138
139			$('#Gnav').addClass('pr_js-active');
140			if (!$('.pr_eug-header-menuBar').hasClass('pr_js-active')) {
141				$('.pr_eug-header-menuBar, #Gnav').removeClass('pr_js-active');
142				$('body').css({'overflow':'visible'});
143				$('.MegaMenu-bdy').addClass('close');
144			}
145		});
146		$('.MegaMenu-trigger').on('click', function () {
147			if($(window).width() <= 768) {
148				$('#Gnav').addClass('act');
149				$(this).parent().find('.MegaMenu-bdy').addClass('act');
150				return false;
151			}
152		});
153		$('.NavSub-return').on('click', function () {
154			if($(window).width() <= 768) {
155				$('#Gnav').removeClass('act');
156				$(this).closest('.MegaMenu-bdy').removeClass('act');
157				return false;
158			}
159		});
160		$('.Gnav-listCont .Acc-trigger').on('click', function () {
161			if($(this).next().is(':hidden') && $(window).width() > 767) {
162				$('.Gnav-listCont .Acc-trigger').removeClass('act').next().removeClass('act').slideUp(250);
163			}
164		});
165		$(document).on('click', function (event) {
166			if (!$(event.target).closest('.pr_eug-header-menuBtn, .Gnav-listCont').length && $('.pr_eug-header-menuBtn').length) {
167				if($(window).width() > 767) {
168					$('.Gnav-listCont .Acc-trigger').removeClass('act').next().removeClass('act').slideUp(250);
169				}
170				$('.pr_eug-header-menuBar, #Gnav').removeClass('pr_js-active');
171				$('body').css({'overflow':'visible'});
172				$('.MegaMenu-bdy').addClass('close');
173			}
174		});
175	}
176
177
178	/* スクロール関連 */
179	PR_JS.smoothScroll = function () {
180		// ページの先頭へ戻る
181		$('a[href=#], .js-pagetop, .pr_eug-footer-pageTop').on('click', function () {
182			$('html, body').animate({
183				scrollTop: 0
184			}, 800, 'swing');
185			return false;
186		});
187
188		/* スムーススクロール */
189		$.fn.scroll = function(options){
190			//引数受取
191			options = $.extend({
192				'href': "#",
193				'header_top_h': 0
194			}, options);
195
196			var speed = 500; // ミリ秒
197			var target = $(options.href == "#" || options.href == "" ? 'html' : options.href);
198			var position = target.offset().top;
199			$('body').addClass('js-scrolling');
200			$.when(
201				 this.animate({
202					scrollTop: position - options.header_top_h
203				}, speed, 'swing')
204			).done(function(){
205				if($('.Header').length) {
206					setTimeout(function(){
207						$('body').removeClass('js-scrolling');
208					}, 100);
209				}
210			});
211		}
212		// ヘッダー分の調整
213		var smooth_scroll = function () {
214			return $('.pr_eug-header').outerHeight();
215		}
216		var header_top_h = smooth_scroll();
217		$(window).on('resize', function () {
218			header_top_h = smooth_scroll();
219		});
220		// イベント発火
221		$('a[href*=#]:not(a[href=#], .js-pagetop, .pr_eug-footer-pageTop)').on('click', function () {
222			var href = $(this).attr("href");
223			if(!href.match(/^#/) && href.match(location.pathname)) {
224				href = href.match(/#(.[^&=]+)/)[0];
225			}
226			if(href.match(/^#/) && $(href).length) {
227				$('html, body').scroll({'href': href, 'header_top_h': header_top_h});
228				return false;
229			}
230		});
231		// 追加要素に対してイベント発火
232		$(document).on('click', '.js-add_element', function () {
233			if($(this).attr('href').indexOf('#') != -1) {
234				$('html, body').scroll({'href': $(this).attr("href"), 'header_top_h': header_top_h});
235				return false;
236			}
237		});
238		// 別ページからの遷移に対してイベント発火
239		if (location.hash) {
240			if (location.hash.indexOf('=') == -1) {
241				$('html, body').stop().scrollTop(0);
242				$('html, body').scroll({'href': location.hash, 'header_top_h': header_top_h});
243			}
244			return false;
245		}
246
247		// モーダル用
248		$('*[onclick^="ecblib.ui.dialog"]').on('click', function () {
249			if($('.modal-dialog').length){
250				$('.wrapper').css('margin-top', header_top_h);
251			}
252		});
253		$(document).on('click', '.js-modal-close, .modal-overlay', function () {
254			$('.wrapper').css('margin-top', '');
255		});
256		$(document).on('keyup', function(e) {
257			if ($('.modal-dialog').length && e.keyCode === 27) {
258				$('.wrapper').css('margin-top', '');
259			}
260		});
261
262
263		/* ============================================= */
264		/* 旧スクリプト(使用中ページがあるかものため、以下に残しておく) */
265		/* ============================================= */
266		/* pageTop */
267		$('.pr_eug-footer-pageTop').on('click', function () {
268			$('html, body').animate({
269				scrollTop: 0
270			}, 800);
271			return false;
272		});
273	}
274
275
276	/* スライダー関連 */
277	PR_JS.topSlider = function () {
278
279		/* 汎用 */
280		const swiper = new Swiper('.js-swiper', {
281			navigation: {
282				nextEl: '.swiper-button-next',
283				prevEl: '.swiper-button-prev'
284			},
285			pagination: {
286				el: '.swiper-pagination', // ページネーションのクラス名を指定
287				type: 'fraction', // ページネーションのtypeを指定
288			},
289			slidesPerView: 'auto',
290			centeredSlides: false,
291			breakpoints: {
292				768: {
293
294				},
295			}
296		});
297
298		/* TOPメインビジュアル */
299		var topSwiper = new Swiper('.js-topSwiper', {
300			pagination: {
301				el: '.topSwiper-pagination', // ページネーションのクラス名を指定
302				clickable: 'clickable',
303				type: 'bullets', // ページネーションのtypeを指定
304			},
305			autoplay: {
306				delay: 6000,
307				disableOnInteraction: false
308			},
309			loop: true,
310			speed: 1000,
311			slidesPerView: 'auto',
312			centeredSlides: true,
313			centeredSlidesBounds: true,
314			breakpoints: {
315				768: {
316
317				},
318			}
319		});
320		$('.js-topSwiper .swiper-wrapper').mouseenter(function(){
321			topSwiper.autoplay.stop();
322		});
323		$('.js-topSwiper .swiper-wrapper').mouseleave(function(){
324			topSwiper.autoplay.start();
325		});
326
327		/* 最近チェックした商品 */
328		$(window).on('load', function () {
329			setTimeout(function(){
330				if($('.History .js-tile-frame').length) {
331					$('.History .js-tile-frame').removeClass('block-goods-list-c--items').addClass('swiper js-swiper');
332					$('.History .js-tile-frame > li').addClass('swiper-wrapper');
333					$('.History .js-enhanced-ecommerce-item').removeClass('block-goods-list-c--item-body').addClass('Common-List-Item swiper-slide');
334					$('.History .js-tile-frame').append('<div class="swiper-button-prev swiper-button-disabled"></div><div class="swiper-button-next"></div>');
335				}
336				const historySwiper = new Swiper('.History .js-swiper', {
337					navigation: {
338						nextEl: '.swiper-button-next',
339						prevEl: '.swiper-button-prev'
340					},
341					slidesPerView: 'auto',
342					centeredSlides: false,
343				});
344				/* ============================================= */
345				/* 旧スクリプト(使用中ページがあるかものため、以下に残しておく) */
346				/* ============================================= */
347				$('.block-goods-list-c--items li').slick({
348					arrows: true,
349					dots: false,
350					swipeToSlide: true,
351					slidesToShow: 6,
352					responsive: [
353						{
354							breakpoint: 768,
355							settings: {
356								arrows: false,
357								slidesToShow: 2
358							}
359						}
360					]
361				});
362				$('.History').addClass('js-show');
363			},300);
364		});
365
366
367		/* ============================================= */
368		/* 旧スクリプト(使用中ページがあるかものため、以下に残しておく) */
369		/* ============================================= */
370		/* MV */
371		$('.pr_eug-top-mvbnrSlide').slick({
372			speed: 1000,
373			autoplay: true,
374			autoplaySpeed: 5000,
375			arrows: true,
376			dots: true,
377			slidesToShow: 1
378		});
379		/* 特集 */
380		$('.Bnr-list_Slide').slick({
381			speed: 1000,
382			// autoplay: true,
383			autoplaySpeed: 5000,
384			arrows: false,
385			dots: false,
386			swipeToSlide: true,
387			slidesToShow: 5,
388			responsive: [
389				{
390					breakpoint: 768,
391					settings: {
392						slidesToShow: 1,
393						centerMode: true,
394						centerPadding: '19vw'
395					}
396				}
397			]
398		});
399		/* ユーグレナのサステナブる */
400		$('.pr_eug-top-stbArea-listBox').slick({
401				adaptiveHeight: true,
402				arrows: true,
403				infinite: false,
404				swipeToSlide: true,
405				slidesToShow: 3,
406				responsive: [
407					{
408						breakpoint: 768,
409						settings: {
410							arrows: false,
411							slidesToShow: 2
412						}
413					}
414				],
415		});
416		/* ランキング */
417		$(window).on('load', function () {
418			setTimeout(function(){
419				$('#ranking ul').slick({
420					arrows: false,
421					dots: false,
422					slidesToShow: 5,
423					responsive: [
424						{
425							breakpoint: 768,
426							settings: {
427								dots: true,
428								swipeToSlide: true,
429								infinite: false,
430								slidesToShow: 2
431							}
432						}
433					]
434				});
435			},500);
436		});
437		/* 関連コンテンツ(カテゴリページ等) */
438		if ($(window).width() <= 768) {
439			$('.pr_eug-top-catList-secList').not('.slick-initialized').slick({
440				responsive: [
441					{
442						breakpoint: 768,
443						settings: {
444							infinite: false,
445							arrows: false,
446							dots: false,
447							variableWidth: true,
448							swipeToSlide: true,
449							// centerMode: true,
450						}
451					}
452				],
453			});
454		}
455		else {
456			$('.pr_eug-top-catList-secList.slick-initialized').slick('unslick');
457		}
458	}
459
460
461	/* 商品詳細サムネイル */
462	PR_JS.detItemSlider = function () {
463		var slider = ".pr_eug-det-itemList";
464		var thumbnailItem = ".pr_eug-det-itemList-nav li";
465
466		// サムネイル画像アイテムに data-index でindex番号を付与
467		$(thumbnailItem).each(function () {
468			var index = $(thumbnailItem).index(this);
469			$(this).attr("data-index", index);
470		});
471
472		// スライダー初期化後、カレントのサムネイル画像にクラス「thumbnail-current」を付ける
473		// 「slickスライダー作成」の前にこの記述は書いてください。
474		$(slider).on('init', function (slick) {
475			var index = $(".slide-item.slick-slide.slick-current").attr("data-slick-index");
476			$(thumbnailItem + '[data-index="' + index + '"]').addClass("thumbnail-current");
477		});
478
479		// slickスライダー初期化
480		$(slider).slick({
481			autoplay: false,
482			arrows: false,
483			fade: true,
484			infinite: false
485		});
486		// サムネイル画像アイテムをクリックしたときにスライダー切り替え
487		$(thumbnailItem).on('click', function () {
488			var index = $(this).attr("data-index");
489			$(slider).slick("slickGoTo", index, false);
490		});
491
492		// サムネイル画像のカレントを切り替え
493		$(slider).on('beforeChange', function (event, slick, currentSlide, nextSlide) {
494			$(thumbnailItem).each(function () {
495				$(this).removeClass("thumbnail-current");
496			});
497			$(thumbnailItem + '[data-index="' + nextSlide + '"]').addClass("thumbnail-current");
498		});
499	}
500
501
502	// ページ全体で実行
503	PR_JS.headerFixedTopPadding();
504	PR_JS.headerMenu();
505	PR_JS.smoothScroll();
506	PR_JS.topSlider();
507
508	// 商品詳細ページ
509	PR_JS.detItemSlider();
510
511
512
513	// 汎用アコーディオン
514	$('.Accordion').on('click', function(){
515		if ( ($(window).width() > 767 && !$(this).hasClass('js-ignore_pc')) || ($(window).width() <= 767 && !$(this).hasClass('js-ignore_sp')) ) {
516			$(this).toggleClass('js-active');
517			$(this).next().slideToggle(300, 'swing');
518			return false;
519		}
520	});
521
522	// 汎用タブ
523	if($('.Tab').length) {
524		$('.Tab').each(function(){
525			var btn = $(this).find('.Tab-Button');
526			var cont = $(this).find('.Tab-Contents');
527			// inputで制御してる場合
528			if(btn.prev('input').length) {
529				$(window).on('load', function(){
530					btn.prev('input').each(function(){
531						if($(this).prop('checked')) {
532							cont.removeClass('js-show');
533							cont.eq(btn.prev('input').index(this)).addClass('js-show');
534						}
535					});
536				});
537			}
538			btn.on('click', function(){
539				$(this).removeClass('js-show');
540				cont.removeClass('js-show');
541				$(this).addClass('js-show');
542				cont.eq(btn.index(this)).addClass('js-show');
543				if($(this).get(0).tagName == 'A') {
544					return false;
545				}
546			});
547		});
548	}
549
550	// 汎用selectリンク
551	if($('.js-ChangeURL').length) {
552		$('.js-ChangeURL').on('change', function(){
553			$(this).val() ? location.href = $(this).val() : '';
554		});
555	}
556	if($('.js-SelectedURL').length) {
557		$('.js-SelectedURL option').each(function(){
558			if(location.href.indexOf($(this).val()) > -1) {
559				$(this).prop('selected', true);
560			}
561		});
562	}
563
564	// 汎用スクロールエフェクト
565	$(window).on('load resize scroll', function(){
566		$('.js-fadeIn, .js-fadeOut').each(function(i){
567			$(this).clearQueue();
568			var imgPos = $(this).offset().top;
569			var scroll = $(window).scrollTop();
570			var windowHeight = $(window).height();
571			var interval = 100;
572			if (scroll > windowHeight/2) {
573				i = 1;
574			}
575			if (scroll > imgPos - windowHeight) {
576				$(this).delay(i*interval).queue(function() {
577					$(this).addClass('js-fade');
578				});
579			}
580			else if($(this).hasClass('js-fade-initial')) {
581				$(this).removeClass('js-fade');
582			}
583		});
584	});
585
586
587	// チェックボックス
588	$('label[for*="loginstatesaving"]').addClass('Common-Checkbox');
589	$('.page-sales_landingpage .block-login--snslogin-body + .form-group label').attr('for', 'loginstatesaving_sns');
590	$('.page-sales_landingpage .block-login--snslogin-body + .form-group input').attr('id', 'loginstatesaving_sns');
591	$('.Common-Checkbox').each(function(){
592		if($(this).find('input[type="checkbox"]').prop('checked')) {
593			$(this).addClass('js-active');
594		}
595		else {
596			$(this).removeClass('js-active');
597		}
598	});
599	$('.Common-Checkbox').on('click', function(){
600		if($(this).find('input[type="checkbox"]').prop('checked')) {
601			$(this).addClass('js-active');
602		}
603		else {
604			$(this).removeClass('js-active');
605		}
606	});
607
608	// 表示切替(確認用)
609	$('.js-changeView').on('click', function(){
610		$(this).closest('.MainVisual-Sub').toggleClass('Thumbnail');
611	});
612	
613	
614/* 商品詳細もっと見る */
615const readmore = document.querySelectorAll('.readMoreInner');
616
617Array.from(readmore).forEach(function(more){
618
619  const btn = more.querySelector('.readMoreBtn');
620  const content = more.querySelector('.readMoreContainer');
621
622  // ボタンクリックでイベント処理
623  btn.addEventListener('click', () => {
624    if(!content.classList.contains('show')){
625      content.style.maxHeight = content.scrollHeight + 'px';
626      content.classList.add('show');
627      btn.innerText = '閉じる';
628    } else {
629      content.style.maxHeight = '250px';
630      content.classList.remove('show');
631      btn.innerText = 'もっと見る';
632    }
633  });
634});
635
636	/* ============================================= */
637	/* 旧スクリプト(使用中ページがあるかものため、以下に残しておく) */
638	/* ============================================= */
639
640	// タブ(one)
641	if($('.Step-list').length) {
642		$(".Step-list").each(function(){
643			var ttl = $(this).find('.list-Tab');
644			var bdy = $(this).find('.list-Img');
645			ttl.find('a').on('click', function(){
646				ttl.removeClass('act');
647				$(this).closest('.list-Tab').addClass('act');
648				bdy.removeClass('act');
649				bdy.eq(ttl.find('a').index(this)).addClass('act');
650				return false;
651			});
652		});
653	}
654
655	// アコーディオン
656	$('.Acc-trigger').on('click', function(){
657		if ( ($(window).width() > 767 && !$(this).hasClass('pc-ignore')) || ($(window).width() <= 767 && !$(this).hasClass('sp-ignore')) )  {
658			$(this).toggleClass('act');
659			$(this).next().slideToggle(300);
660		}
661	});
662
663	// 外部HTMLのインクルード
664	if($('.cmnInclude').length) {
665		$('.cmnInclude').each(function(){
666			$(this).load($(this).attr('data-url'));
667		});
668	}
669
670
671});

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.