PageSourceSearch

https://mothers-ind.com/wpapp/wp-content/themes/mothersindustry/js/scripts.js

js mothers-ind.com collected 2026-10-02 05:00:48 UTC 13,949 bytes, 387 lines download raw bytes

1jQuery(function($){
2    'use strict';
3
4    //画像置換
5    $('[data-imechen]').imechen({
6        type: 'toggle',
7        duration: 20
8    });
9
10    //スムーズスクロール起動
11    $('a[href^="#"], area[href^="#"]').not('[data-bbss-none]').bbSmoothScroll({
12        padding: 80,
13        pushHash: false
14    });
15
16    //ミニヘッダーの設定
17    (function(){
18        // 要素複製 クラス書き換え
19        var $siteLogo = $('.l-header__sitelogo').clone().removeClass('l-header__sitelogo').addClass('l-miniheader__sitelogo'); // サイトロゴ
20        var $gnav = $('.p-gnav').clone().removeClass('p-gnav').addClass('p-gnav--miniheader'); // グロナビ
21        // 要素生成
22        var $miniheader = $('<div class="l-miniheader"></div>'); // ミニヘッダー
23        var $frame = $('<div class="l-frame"></div>'); // コンテンツフレーム
24        var $miniheaderInner = $('<div class="l-miniheader__inner"></div>'); // ミニヘッダー コンテンツラッパー
25        // 要素移動
26        $frame.appendTo($miniheader);
27        $miniheaderInner.appendTo($frame);
28        $siteLogo.appendTo($miniheaderInner);
29        $gnav.appendTo($miniheaderInner);
30        $miniheader.insertAfter('.l-header');
31        
32        var displayPoint = 300; //出現位置
33        function switchMiniheaderFixed() {
34            //スクロールしてミニヘッダー出現
35            if ($(document).scrollTop() > displayPoint) {
36                $miniheader.addClass('is-opened');
37            } else {
38                $miniheader.removeClass('is-opened');
39            }
40        }
41        $(window).on('scroll', $.throttle(100, function() {
42            switchMiniheaderFixed($miniheader);
43        }));
44        switchMiniheaderFixed($miniheader);
45    })();
46
47    //グロナビの開閉
48    (function(){
49        $('[data-gnav-menu]').on({
50            'mouseenter':function(){
51                var $this = $(this);
52                var timer = $this.data('timer') || 0;
53                var timer2 = $this.data('timer2') || 0;
54                clearTimeout(timer);
55                clearTimeout(timer2);
56                timer = setTimeout(function() {
57                    $this.addClass('is-opened');
58                }, 300);
59                $this.data('timer', timer);
60            },
61            'mouseleave':function(){
62                var $this = $(this);
63                var timer = $this.data('timer') || 0;
64                var timer2 = $this.data('timer2') || 0;
65                clearTimeout(timer);
66                clearTimeout(timer2);
67                timer2 = setTimeout(function() {
68                    $this.removeClass('is-opened');
69                }, 300);
70                $this.data('timer2', timer2);
71            }
72        });
73    })();
74
75    //インフィニットスクロール
76    (function() {
77        $('.p-posts-list').infinitescroll({
78            navSelector : '.p-infinitescroll-pager',
79            nextSelector : '.p-infinitescroll-pager__next a',
80            itemSelector : '.p-post',
81            loading: {
82                finishedMsg: "No more posts",
83                msgText: "Loading",
84                bufferPx: 100,
85                img: '/wpapp/wp-content/themes/mothersindustry/img/parts/ajax-loader.gif'
86            }
87        },function(elm){
88            $(elm).hide().delay(100).fadeIn(500);
89        });
90    })();
91
92    //インビュー
93    $('[data-inview]').on('inview', function(event, isInView) {
94        if (isInView) {
95            $(this).addClass('is-inview');
96        } else {
97            $(this).removeClass('is-inview');
98        }
99    });
100
101    //イメージフィル
102    $('[data-imagefill]').imagefill();
103
104    //SHOP言語切替
105    (function() {
106        var urlHash = location.hash;
107        if(urlHash){
108            if (urlHash == '#en') {
109                $('[data-content-lang="jp"]').hide();
110                $('[data-content-lang="en"]').show();
111            } else {
112                $('[data-content-lang="en"]').hide();
113                $('[data-content-lang="jp"]').show();
114            }
115        } else {
116            $('[data-content-lang="en"]').hide();
117            $('[data-content-lang="jp"]').show();
118        }
119        $('[data-switch-lang]').on('click', function() {
120            var target = $(this).data('switch-lang');
121            $(this).addClass('p-menuitem-anchor-active');
122            if (target == 'jp') {
123                $('[data-switch-lang="en"]').removeClass('p-menuitem-anchor-active');
124                $('[data-content-lang]').hide();
125                $('[data-content-lang="jp"]').fadeIn();
126            } else if (target == 'en') {
127                $('[data-switch-lang="jp"]').removeClass('p-menuitem-anchor-active');
128                $('[data-content-lang]').hide();
129                $('[data-content-lang="en"]').fadeIn();
130            }
131        });
132        return false;
133    })();
134
135    //ファンシーボックス YouTube
136    $('[data-fancybox-movie]')
137        .fancybox({
138            type: 'iframe',
139            width : 960,
140            height : 540,
141            padding : 0,
142            fitToView: false,
143            autoSize : false,
144            helpers : {
145                media : {},
146                buttons : {}
147            }
148        });
149
150    //ファンシーボックス ギャラリー
151    $('[data-fancybox-group]').fancybox();
152
153});
154
155
156/*
157 * jQuery throttle / debounce - v1.1 - 3/7/2010
158 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
159 * 
160 * Copyright (c) 2010 "Cowboy" Ben Alman
161 * Dual licensed under the MIT and GPL licenses.
162 * http://benalman.com/about/license/
163 */
164(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
165
166
167/*
168 * スムーズスクロールプラグイン
169 */
170;(function($){
171    'use strict';
172    
173    $.fn.bbSmoothScroll = function(options) {
174        var settings = $.extend({
175            duration: 800,
176            padding: 0,
177            pushHash: true
178        }, options);
179        
180        var $page = $('html, body');
181        var events = "scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove";
182        function scrollStop() {
183            $page.stop();
184        }
185        this.on('click', function(e){
186            var $this = $(this);
187            e.preventDefault();
188            var $target = $(this.hash);
189            if (!$target.length) {
190                return;
191            }
192            var hashOffset = $target.offset().top;
193            var duration = $this.data('bbss-duration') || settings.duration;
194            var padding = $this.data('bbss-padding') || settings.padding;
195            $page.on(events, scrollStop);
196            $page.not(':animated').animate({
197                scrollTop: hashOffset - padding
198            }, duration, 'swing', function() {
199                $page.off(events, scrollStop);
200            });
201            var pushHash = (function() {
202                if ($this.data('bbss-push-hash') === 1) return true;
203                if ($this.data('bbss-push-hash') === 0) return false;
204                return settings.pushHash;
205            })();
206            if (pushHash !== false) {
207                window.history.pushState(null, null, this.hash);
208            }
209        });
210        
211        return this;
212    };
213}(jQuery));
214
215
216/*
217 * 高さ揃えプラグイン
218 */
219;(function($){
220    'use strict';
221    
222    $.fn.bbFlatHeight = function(options) {
223        var settings = $.extend({
224            col: false
225        }, options);
226        
227        var $this = this;
228        $this.css('height', 'auto');
229        var max = 0;
230        var col = settings.col || $this.length;
231        var row = 0;
232        
233        $this.each(function(i) {
234            var h = ($(this).css('box-sizing') == 'border-box') ? $(this).outerHeight() : $(this).height();
235            if (h > max) max = h;
236            if ((i+1) % col === 0) {
237                var lt = row * col;
238                var gt = lt + (col-1);
239                for (var j=lt; j<=gt; j++) {
240                    $($this[j]).css('height', max);
241                }
242                max = 0;
243                row++;
244            }
245        });
246        for (var i=$this.length-($this.length % col); i<$this.length; i++) {
247            $($this[i]).css('height', max);
248        }
249        
250        return this;
251    };
252}(jQuery));
253
254
255/**
256 * IMECHEN is Image Changer.
257 * Copyright (c) 2016 troussier
258 * GPL licenses
259 * http://www.gnu.org/licenses/gpl.html
260 * @author: troussier (https://github.com/troussier/imechen)
261 * @version: 0.1
262 */
263;(function($){
264    'use strict';
265    
266    $.fn.imechen = function(options) {
267        var settings = $.extend({
268            type: 'transparent',
269            duration: 200,
270            opacity: '.6',
271            suffix: '_on',
272            mode: 'direct',
273            groupParent: '[data-ic-group]'
274        }, options);
275        
276        return this.each(function() {
277            var $ic = $(this);
278            var mode = $ic.data('ic-mode') || settings.mode;
279            var type = $ic.data('ic-type') || settings.type;
280            var $trigger;
281            var $wrap = $ic.wrap($('<span class="ic-wrap"></span>')).closest($('.ic-wrap'));
282            
283            switch (type) {
284                
285                case 'transparent':
286                    var originalOpacity;
287                    $trigger = (mode === 'indirect') ? $ic.closest(settings.groupParent) : $ic;
288                    $trigger.on({
289                        'mouseenter': function() {
290                            var $target = (mode === 'indirect') ? $(this).find($ic) : $(this);
291                            $target.stop(true, true);
292                            originalOpacity = $target.css('opacity');
293                            var duration = typeof $ic.data('ic-duration') === 'number' ? $ic.data('ic-duration') : settings.duration;
294                            var opacity = typeof $ic.data('ic-opacity') === 'number' ? $ic.data('ic-opacity') : settings.opacity;
295                            $target.fadeTo(duration, opacity);
296                        },
297                        'mouseleave': function() {
298                            var $target = (mode === 'indirect') ? $(this).find($ic) : $(this);
299                            var duration = typeof $ic.data('ic-duration') === 'number' ? $ic.data('ic-duration') : settings.duration;
300                            $target.stop(true, false).fadeTo(duration, originalOpacity);
301                        }
302                    });
303                    break;
304                    
305                case 'toggle':
306                    var src = $ic.attr('src');
307                    var src_on = src.substr(0, src.lastIndexOf('.')) + settings.suffix + src.substring(src.lastIndexOf('.'));
308                    
309                    $ic.each(function() {
310                        $(this).addClass('ic-off')
311                            .css('display', 'block')
312                            .clone()
313                            .attr('src', src_on)
314                            .insertAfter($(this))
315                            .removeClass('ic-off')
316                            .addClass('ic-on');
317                    });
318                    
319                    var wrapStyle = {
320                        'display': 'inline-block',
321                        'position': 'relative',
322                        'vertical-align': $ic.css('vertical-align')
323                    };
324                    var onStyle = {
325                        'position': 'absolute',
326                        'top': 0,
327                        'left': 0,
328                        'opacity': 0
329                    };
330                    
331                    $ic.closest($wrap).css(wrapStyle)
332                        .children('.ic-on').css(onStyle);
333                        
334                    $trigger = (mode === 'indirect') ? $ic.closest(settings.groupParent) : $ic.closest($wrap);
335                    $trigger.on({
336                        'mouseenter': function() {
337                            var duration = typeof $ic.data('ic-duration') === 'number' ? $ic.data('ic-duration') : settings.duration;
338                            $ic.siblings('.ic-on').stop(true, true).fadeTo(duration, 1, function() {
339                                $ic.stop(true, true).fadeTo(0, 0);
340                            });
341                        },
342                        'mouseleave': function() {
343                            var duration = typeof $ic.data('ic-duration') === 'number' ? $ic.data('ic-duration') : settings.duration;
344                            $ic.stop(true, false).fadeTo(0, 1);
345                            $ic.siblings('.ic-on').stop(true, false).fadeTo(duration, 0);
346                        }
347                    });
348                    break;
349                    
350                default:
351                    console.log('"' + type + '" is no longer available.');
352                    break;
353            }
354        });
355    };
356}(jQuery));
357
358
359/*
360 * onLoadAllImagesプラグイン
361 */
362;(function($){
363    'use strict';
364    
365    $.fn.onLoadAllImages = function(callback) {
366        if (!callback) {
367            callback = function () {
368                console.log('callback require');
369            };
370        }
371        
372        var $this = this;
373        var len = $this.length;
374        var cnt = 0;
375            
376        return this.each(function() {
377            var $img = $('<img>');
378            $img.on('load', function() {
379                cnt++;
380                if (cnt === len) {
381                    callback($this);
382                }
383            });
384            $img.attr('src', $(this).attr('src'));
385        });
386    };
387}(jQuery));

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.