PageSourceSearch

https://www.maruchan-yakisoba.jp/assets_v2/js/common.js?231215

js maruchan-yakisoba.jp collected 2026-10-05 00:56:37 UTC 5,716 bytes, 183 lines download raw bytes

1;(function($, window, document, undefined){
2'use strict';
3
4window.COMMON = new Object();
5
6$(function(){
7  
8  var win7 = navigator.userAgent.match(/Win(dows )?NT 6\.1/);
9  var checkWin7 = win7 && Shared.ua.isIE;
10  var noZoomAnime = Shared.ua.isIElt10 || checkWin7;
11  
12  COMMON.$window = $(window);
13  COMMON.$html_body = $('html, body');
14  
15  
16  //IE11 object-fit
17  if( 'undefined' != typeof objectFitImages ){
18    objectFitImages();
19  }
20
21  //IE11 stickyfill
22  if( 'undefined' != typeof Stickyfill ){
23    var $sticky = $('.sticky');
24    if( $sticky.length ){
25      $(window).load(function(){
26        Stickyfill.add($sticky);
27      });
28    }
29  }
30
31  if(noZoomAnime){
32    $('html').addClass('no-zoom-anime');
33  }
34
35  if(Shared.ua.isIElt10){
36    $('html').addClass('ie9');
37  }
38  
39  //smooth scroll
40  var scrolling = false;
41  $('.js-scroll').click(function(e){
42    e.preventDefault();
43    var href = $(this).attr('href');
44    var target = $(href == '#' || href == '' || href == '#top' ? $('.v2-gheader') : $(href));
45    var top = (href == '#' || href == '' || href == '#top') ? 0 : target.offset().top;
46    var dur = Math.abs(top - (document.body.scrollTop || document.documentElement.scrollTop));
47    if(dur > 880) dur = 880;
48    $('html,body').stop().animate({scrollTop:top}, {duration:dur, easing:'ioX4', always:function(){
49      scrolling = false;
50    }});
51  });
52  
53  //ページ初回読み込み時のアンカー位置調整
54  //COMMON.$window.on('load', COMMON.anchorFix);
55  COMMON.anchorFix = function(){
56    console.count('COMMON.anchorFix');
57    console.log(location.hash, typeof location.hash, !location.hash);
58    if( !location.hash ) return;
59    if( '#*' === location.hash ) return;
60    const $hash = $(location.hash);
61    if( 1 > $hash.length ) return;
62    setTimeout(function(){
63      let pos = $hash.offset().top;
64      console.log('pos', pos);
65      COMMON.$html_body.animate({
66        scrollTop: $hash.offset().top
67      }, 1);
68    }, 100);
69  }
70  COMMON.$window.on('load', function(){
71    COMMON.anchorFix();
72  });
73  
74  
75  /*
76  ## modal
77  */
78  
79  $('.js-modal').magnificPopup({
80    type: 'inline',
81    preloader: false,
82    modal: true
83  });
84
85  $('.js-modal-youtube').magnificPopup({
86    type: 'iframe',
87    preloader: false,
88    fixedContentPos: true
89  });
90
91  $(document).on('click', '.modal-close-btn', function (e) {
92    e.preventDefault();
93    $.magnificPopup.close();
94  });
95  
96  
97  //シャッフル
98  $('[data-shuffle]').each(function(){
99    const $container = $(this);
100    let $children = $container.children();
101    $children.each(function(){
102      $children.eq(Math.floor(Math.random()*$children.length)).prependTo($container);
103    });
104    $children = $container.children();
105    $container.append($children).append($children.clone()).show();
106    //$container.append($children.clone());
107    /*
108    $container
109      .append($children.clone())
110      .append($children.clone());
111    */
112  });
113  
114  
115  //
116  $('[data-addRandomClass]').each(function(){
117    const $me = $(this),
118          val = $me.attr('data-addRandomClass').split(','),
119          rdm = Number(val[1]) + Math.floor(Math.random() * Number(val[2]));
120    console.log(val, rdm);
121    $me.addClass(val[0] + rdm);
122  });
123  
124  
125  //
126  header_3();
127  
128  
129});
130
131
132//シャッフル
133function shuffle(arr){
134  var i, j, tmp, length;
135  for (length = arr.length, i = length - 1; i > 0; i--) {
136    j = Math.floor(Math.random() * (i + 1));
137    tmp = arr[i];
138    arr[i] = arr[j];
139    arr[j] = tmp;
140  }
141  return arr;
142}
143
144
145//
146function header_3(){
147  const recipes = [
148    'https://www.maruchan.co.jp/recipe/2019/04/post_362.html'//あさりと青梗菜と焼ねぎの中華焼そば(中華)
149   ,'https://www.maruchan.co.jp/recipe/2018/02/post_306.html'//アスパラ、にんじん、ちくわの焼そば(ソース)
150   ,'https://www.maruchan.co.jp/recipe/2014/05/post_235.html'//アボカドと豚肉の塩焼そば(塩)
151   ,'https://www.maruchan.co.jp/recipe/2019/04/post_357.html'//えびとリボンにんじんのたらこ焼そば(ã
151Ÿã‚‰ã“)
152   ,'https://www.maruchan.co.jp/recipe/2019/04/post_344.html'//お餅と青ねぎの焼そば(お好みソース)
153   ,'https://www.maruchan.co.jp/recipe/2019/04/post_356.html'//ごろごろミートソースの焼そば(ソース)
154   ,'https://www.maruchan.co.jp/recipe/2010/09/post_131.html'//スプラウトのさっぱり塩焼そば(塩)
155   ,'https://www.maruchan.co.jp/recipe/2018/04/post_312.html'//ビーフガーリック焼そば(ソース)
156   ,'https://www.maruchan.co.jp/recipe/2011/02/post_154.html'//まんまるマルちゃんオムレツ(お好みソース)
157   ,'https://www.maruchan.co.jp/recipe/2008/01/post_83.html'//高菜焼そば(たらこ)
158  ];
159  const num = Number( getParam('header_3') );
160  //console.log('num', num);
161  $('.header_3.is_keyvisual').each(function(){
162    const $me = $(this),
163          $bg = $me.find('.header_3__bg'),
164          $a = $me.find('.header_3__more a'),
165          random = (0 < num)? num : 1 + Math.floor(Math.random() * recipes.length);
166    $bg.css('background-image', 'url("/static/dummy/keyvisual-3-' + random + '.jpg")');
167    $a.attr('href', recipes[random - 1]);
168  });
169}
170
171
172//
173function getParam(name, url) {
174  if (!url) url = window.location.href;
175  name = name.replace(/[\[\]]/g, "\\$&");
176  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
177      results = regex.exec(url);
178  if (!results) return null;
179  if (!results[2]) return '';
180  return decodeURIComponent(results[2].replace(/\+/g, " "));
181}
182
183})(jQuery, this, this.document);

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.