PageSourceSearch

https://www.tokyo-tabakoya.com/common/js/common.js

js tokyo-tabakoya.com collected 2026-10-04 07:00:03 UTC 17,196 bytes, 493 lines download raw bytes

1(function(w, $, ROOT){
2    'use strict';
3    if(undefined === ROOT){ ROOT = window.YOZA = {}; }
4    if(undefined === ROOT.COMMON){ ROOT.COMMON = {}; }
5
6
7    ROOT.ID = 'TOKYO-TABAKOYA';
8    ROOT.VERSION = '1.0.0';
9
10    ROOT[ROOT.ID] = {};
11
12    var CO = ROOT.COMMON;
13    var $w, $doc, $body;
14
15    CO._ready = function(){
16        $w = $(window);
17        $doc = $(document);
18        $body = $('body');
19
20        $('a').sr2scroll({
21            addAnchor : false
22        });
23    };
24
25    CO.fn = {
26        getCSS : function(element, pseudo){
27            if(!element){ throw new Error('getCSS : require element'); }
28            return document.defaultView.getComputedStyle(element, (pseudo ? pseudo : '')) || element.currentStyle;
29        }
30    };
31
32    // .paging内要素 .disabled検知でreturn false;
33    CO.DisabledPaging = function(){
34        this._init.apply(this, arguments);
35    };
36    CO.DisabledPaging.prototype = {
37        _init : function(){
38            var self = this;
39            var args = arguments;
40
41            $(function(){
42                self.setup.apply(self, args);
43            });
44        },
45        setup : function(){
46            var $paging = $('.paging');
47
48            if(0 === $paging.length){ return false; }
49
50            $paging.off('tap').on('tap', function(e){
51                if(0 < $(e.target).parents('.disabled').length){
52                    return false;
53                }
54            });
55        }
56    };
57
58    // tweetアイコン
59    CO.TweetIcon = function(){
60        this._init.apply(this, arguments);
61    };
62    CO.TweetIcon.prototype = {
63        _init : function(){
64            var self = this;
65            var args = arguments;
66
67            $(function(){
68                self.setup.apply(self, args);
69            });
70        },
71        setup : function(){
72            var $tw = $('.social .twitter a');
73
74            if(0 === $tw.length){ return false; }
75
76            var format = 'http://twitter.com/share?url=##URL##&text=##TEXT##';
77            var outputURL;
78            var defaults = {
79                url : '',
80                text : ''
81            };
82            try{
83                var url = encodeURIComponent(w.location.href);
84                var text = encodeURIComponent(document.title);
85                outputURL = format
86                .replace('##URL##', url)
87                .replace('##TEXT##', text);
88            }
89            catch(x_x){
90                outputURL = format
91                .replace('##URL##', encodeURIComponent(defaults.url))
92                .replace('##TEXT##', encodeURIComponent(defaults.text));
93            }
94
95            $tw
96            .attr('href', outputURL)
97            .attr('target', '_blank')
98            .on('tap', function(){
99                window.open(encodeURI(decodeURI(outputURL)),'tw_window','width=550, height=450, personalbar=0, toolbar=0, scrollbars=1'); return false;
100            });
101        }
102    };
103
104    // facebookアイコン
105    CO.FaceBookIcon = function(){
106        this._init.apply(this, arguments);
107    };
108    CO.FaceBookIcon.prototype = {
109        _init : function(){
110            var self = this;
111            var args = arguments;
112
113            $(function(){
114                self.setup.apply(self, args);
115            });
116        },
117        setup : function(){
118            var $fb = $('.social .facebook a');
119
120            if(0 === $fb.length){ return false; }
121
122            var format = 'https://www.facebook.com/sharer/sharer.php?u=##URL##';
123            var outputURL;
124            var defaults = {
125                url : '',
126                text : ''
127            };
128            try{
129                var url = encodeURIComponent(w.location.href);
130                var text = encodeURIComponent(document.title);
131                outputURL = format
132                .replace('##URL##', url)
133                .replace('##TEXT##', text);
134            }
135            catch(x_x){
136                outputURL = format
137                .replace('##URL##', encodeURIComponent(defaults.url))
138                .replace('##TEXT##', encodeURIComponent(defaults.text));
139            }
140
141            var el_script = document.createElement('script');
142            el_script.innerHtml = '(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v2.8"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "facebook-jssdk"));';
143
144            $fb.before(el_script);
145            $fb
146            .attr('href', outputURL)
147            .attr('target', '_blank')
148            .on('tap', function(){
149                window.open(outputURL,'fb_window','width=600, height=500, personalbar=0, toolbar=0, scrollbars=1'); return false;
150            });
151        }
152    };
153
154    // グローバルナビSP追従
155    CO.GlobalNavi_SP = function(){
156        this._init.apply(this, arguments);
157    };
158    CO.GlobalNavi_SP.prototype = {
159        _init : function(){
160            var self = this;
161            var args = arguments;
162            $(function(){
163                self.setup.apply(self, args);
164            });
165        },
166        setup : function(){
167            var BREAK_POINT = 545;
168            self.$topper = $('.topper');
169            self.$globalNavi = $('.globalNav');
170            self.$dammy = $('<div class="globalNav__dammy"></div>');
171            self.$globalNavi.after(self.$dammy);
172            self.$dammy.height(0);
173
174            $w.on('resize.GlobalNavi_SP scroll.GlobalNavi_SP', function(){
175                if(BREAK_POINT <= $w.width()){
176                    self.$globalNavi.css({
177                        position : '',
178                        width : 'auto',
179                        top : 'auto'
180                    });
181                    self.$dammy.height(0);
182                    return true;
183                }
184                var th = self.$topper.height();
185                var wst = $w.scrollTop();
186                if(wst > th){
187                    self.$globalNavi.css({
188                        position : 'fixed',
189                        width : '100%',
190                        top : 0
191                    });
192                    self.$dammy.height(45);
193                }
194                else{
195                    self.$globalNavi.css({
196                        position : '',
197                        width : 'auto',
198                        top : 'auto'
199                    });
200                    self.$dammy.height(0);
201                }
202            });
203        }
204    };
205
206    // スリムナビ
207    CO.SlimNavi = function(){
208        this._init.apply(this, arguments);
209    };
210    CO.SlimNavi.prototype = {
211        _init : function(){
212            var self = this;
213            var args = arguments;
214
215            $(function(){
216                self.setup.apply(self, args);
217            });
218        },
219        setup : function(){
220            var self = this;
221
222            self.$globalNavi = $('.globalNav');
223            self.$slimNavi = $('.slimNav');
224
225            self.c();
226
227            new CO.SlimNaviInterlock(self);
228        },
229
230        onError : function(){},
231        onOpen : function(){},
232        onClose : function(){},
233
234        c : function(){
235            var self = this;
236
237            var isSlimNaviOpen = false;
238            var si = undefined;
239            var el_glovalNavi = self.$globalNavi.get(0);
240            var el_slimNavi = self.$slimNavi.get(0);
241
242            if(!el_glovalNavi || !el_slimNavi || 0 === el_glovalNavi.length || 0 === el_slimNavi.length){ return false; }
243
244            $w
245            .on('resize.SlimNavi scroll.SlimNavi', function(e){
246                var gNavCSS = CO.fn.getCSS(el_glovalNavi);
247                var sNavCSS = CO.fn.getCSS(el_slimNavi);
248
249                var gNavLimitTop = el_glovalNavi.offsetTop + parseInt(gNavCSS.height) - parseInt(sNavCSS.height);
250
251                var sTop = $w.scrollTop();
252
253                if(undefined !== si){
254                    clearTimeout(si);
255                    si = undefined;
256                }
257
258                if(isNaN(gNavLimitTop)){
259                   self._onError();
260                   return;
261                }
262
263                if(false === isSlimNaviOpen && gNavLimitTop < sTop){
264                    isSlimNaviOpen = true;
265                    self.$slimNavi.show();
266
267                    si = setTimeout(function(){
268                        $body.addClass('nav');
269                        self._onOpen();
270                    });
271                }
272                else if(true === isSlimNaviOpen && gNavLimitTop >= sTop){
273                    isSlimNaviOpen= false;
274                    $body.removeClass('nav');
275                    self.$slimNavi.show();
276                    self._onClose();
277
278                    si = setTimeout(function(){
279                        self.$slimNavi.hide();
280                    }, 150);
281                }
282            });
283        },
284
285        _onError : function(){
286            var self = this;
287            if(self.onError){ self.onError(); }
288        },
289        _onOpen : function(){
290            var self = this;
291            if(self.onOpen){ self.onOpen(); }
292        },
293        _onClose : function(){
294            var self = this;
295            if(self.onClose){ self.onClose(); }
296        }
297    };
298
299    // スリムナビ連動処理(BackToTopボタン、スクロールガイド)
300    CO.SlimNaviInterlock = function(SlimNaviClass){
301        this._init.apply(this, arguments);
302    };
303    CO.SlimNaviInterlock.prototype = {
304        _init : function(SlimNaviClass){
305            var self = this;
306            var args = arguments;
307
308            $(function(){
309                self.setup.apply(self, args);
310            });
311        },
312        setup : function(SlimNaviClass){
313            var $btt = $('.back_to_top');
314
315            // BackToTopボタン
316            $btt.css({ display: 'none', opacity: 0 });
317
318            // スクロールガイド
319            var wh = $w.height();
320            var onetimeGuide = (750 <= wh && wh <= 1050);
321            var $scrollGuide = $('.scroll_guide');
322            var si = undefined, siShowTime = 2000, siHideTime = 5000;
323            var fn_showGuide = function(){
324                onetimeGuide = false;
325                $scrollGuide.addClass('active');
326                setTimeout(fn_hideGuide, siHideTime);
327            };
328            var fn_hideGuide = function(){
329                if(si){
330                    clearTimeout(si);
331                    si = undefined;
332                }
333                $scrollGuide.removeClass('active');
334                setTimeout(function(){
335                    $scrollGuide.remove();
336                }, 300);
337            };
338            if(0 >= $scrollGuide.length){ onetimeGuide = false; }
339            if(onetimeGuide){
340                si = setTimeout(fn_showGuide, siShowTime);
341            }
342
343            SlimNaviClass.onOpen = function(){
344                // BackToTopボタン
345                $btt.stop(true, true).css({ display: 'block', opacity: 0 }).animate({ opacity: 1 });
346                // スクロールガイド
347                fn_hideGuide();
348            };
349            SlimNaviClass.onClose = function(){
350                // BackToTopボタン
351                $btt.stop().animate({ opacity: 0 }, { complete : function(){ $btt.css({ display: 'none' }); }});
352            };
353
354            SlimNaviClass.onError = function(){
355                $btt.stop(true, true).css({ display: 'block', opacity: 1 });
356            };
357        }
358    };
359
360    // spメニュー アコーディオン
361    CO.spMenu = function(){
362        this._init.apply(this, arguments);
363    };
364    CO.spMenu.prototype = {
365        _init : function(){
366            var self = this;
367            var args = arguments;
368
369            $(function(){
370                self.setup.apply(self, args);
371            });
372        },
373        setup : function(){
374            var self = this;
375
376            self.$btn_menu = $('.globalNav .globalNav__open');
377            self.$slimNavi = $('.globalNav nav');
378
379            self.c();
380        },
381
382        c : function(){
383            var self = this;
384
385            self.$btn_menu.off('click').on('click', function(){
386                if(true === self.$btn_menu.hasClass('active')){
387                    // close
388                    self.$slimNavi.slideUp(180);
389                    self.$btn_menu.removeClass('active');
390                }
391                else{
392                    // open
393                    self.$slimNavi.slideDown(180);
394                    self.$btn_menu.addClass('active');
395                }
396
397            });
398
399        }
400    };
401
402    // BiggerLink
403    CO.BiggerLink = function(){
404        this._init.apply(this, arguments);
405    };
406    CO.BiggerLink.prototype = {
407        _init : function(){
408            var self = this;
409            var args = arguments;
410            $(function(){
411                self.setup.apply(self, args);
412            });
413        },
414        setup : function(){
415            $(document).on('tap', '.extension', function(){
416                var $t = $(this);
417                var $a = $t.find('a:first');
418                if(0 < $a.length){
419                    var href = $a.attr('href');
420                    var target = $a.attr('target');
421                    if(!href || href === ''){ return true; };
422                    if('_blank' === target){
423                        w.open(href);
424                    }
425                    else{
426                        w.location.href = href;
427                    }
428                    return false;
429                }
430            });
431        }
432    };
433
434    // モーダル(data-modal="値" === id="値")
435    CO.DataModal = function(){
436        this._init.apply(this, arguments);
437    };
438    CO.DataModal.prototype = {
439        _init : function(){
440            var self = this;
441            var args = arguments;
442            $(function(){
443                self.setup.apply(self, args);
444            });
445        },
446        setup : function(){
447            $('[data-modal]').on('tap', function(){
448                var $t = $(this);
449                var id = '#'+String($t.attr('data-modal'));
450                var $tar = $(id);
451                if(0 < $tar.length){
452                    $tar.stop(true,true).fadeIn({
453                        duration:200,
454                        start:()=>{$tar.css('display','flex')}
455                    });
456                    return false;
457                }
458            });
459            $('.p-modal_history').on('click', function(e){
460                var $self = $(e.currentTarget);
461                var $t = $(e.target);
462                if(0 === $t.closest('.p-modal_history__body').length){
463                    var id = '#'+String($self.attr('id'));
464                    var $tar = $(id);
465                    if(0 < $tar.length){
466                        $self.stop(true, true).fadeOut({
467                            duration : 200
468                        });
469                        return false;
470                    }
471                }
472            });
473        }
474    };
475
476    $(CO._ready);
477
478    new CO.DisabledPaging;
479    new CO.TweetIcon;
480    new CO.FaceBookIcon;
481    new CO.SlimNavi;
482    new CO.spMenu;
483    new CO.BiggerLink;
484    new CO.GlobalNavi_SP;
485    new CO.DataModal;
486
487}(window, jQuery, window.YOZA));
488
489// plug.in.tap.min.js
490!function(a){"use strict";var b=5,c={touched:!1},d=void 0,e=["click","touchstart","touchmove","touchend"],f={click:function(a){a.target===a.currentTarget&&a.preventDefault()},touchstart:function(a){var b=a.originalEvent;d=b.touches[0],c.touched=!0,c.startX=d.pageX,c.startY=d.pageY},touchmove:function(a){if(c.touched){var e=a.originalEvent;d=e.touches[0],Math.sqrt((d.pageX-c.startX)*(d.pageX-c.startX)+(d.pageY-c.startY)*(d.pageY-c.startY))>b&&(c.touched=!1)}},touchend:function(b){if(c.touched){var e=b.originalEvent;d=e.changedTouches[0],c.touched=!1,a.event.dispatch.call(this,a.Event("tap",{originalEvent:b,target:b.target,pageX:d.pageX,pageY:d.pageY}))}}};a.event.special.tap="ontouchstart"in window?{setup:function(){var b=a(this);a.each(e,function(a,c){b.on(c,f[c])})},teardown:function(){var b=a(this);a.each(e,function(a,c){b.off(c,f[c])})}}:{bindType:"click",delegateType:"click"}}(jQuery);
491
492// plug.in.sr2scroll.js
493!function(a,b){"use strict";b.fn.sr2scroll=function(a){var c={actionStr:"click",exceptClass:"exceptpreset",duration:300,addAnchor:!0,upperY:0};"undefined"==typeof b?a&&YOZA.namespace("private.fn.merge")(c,a):c=b.extend(!0,c,a),c.actionStr+=".sr2scroll";var d=b("html, body");this.off(c.actionStr).each(function(){var a,e,f,g;a=String(this.getAttribute("href")),e=this.getAttribute("class"),f="#"===a.substr(0,1)&&a.length>1,g=e?-1!=String(e).indexOf(c.exceptClass):!1,f&&!g&&b(this).off(c.actionStr).on(c.actionStr,function(){var a,e,f,g,h,i=this;return a=i.getAttribute("href"),h=function(){var a=Number(i.getAttribute("data-sr2offset"));return isNaN(a)&&(a=0),isNaN(c.upperY)||(a+=Number(c.upperY)),Number(a)}(),e=b(a),0==e.length&&(f=a.substr(1),e=b("[name='"+f+"']")),e.length>0&&(g=function(){try{return Number(e.offset().top)}catch(a){return 0}}()-h,b("html").is(":animated")&&b("body").is(":animated")||d.animate({scrollTop:g},{duration:c.duration})),c.addAnchor&&setTimeout(function(){window.location.hash="",window.location.hash=a},c.duration),!1})})}}(window,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.