PageSourceSearch

https://www.tokyobikenyc.com/static/ta/5093f258e4b0979eac7cb197/3237/scripts/site.js

js tokyobikenyc.com collected 2026-10-04 16:25:33 UTC 11,572 bytes, 354 lines download raw bytes

1Y.use('event-hover', 'transition', 'node', 'node-event-simulate', function(Y) {
2
3  Y.on('domready', function() {
4
5    // Handle lightbox zooming
6     if (navigator.userAgent.match(/iPhone|iPad/i) && Y.one('body.mobile-style-available')) {
7      var fixedViewport = 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1',
8          zoomViewport = 'width=device-width, initial-scale=1',
9          viewport = Y.one('meta[name="viewport"]');
10      viewport && viewport.setAttribute('content', fixedViewport);
11      viewport && Y.one('body').on('touchstart', function(e) {
12        if (e.touches.length > 1) {
13          viewport.setAttribute('content', zoomViewport);
14        }
15      });
16    }
17
18    var debounce = function(callback, timer, context) {
19      timer = timer || 100;
20      context = context || this;
21
22      if (callback) {
23        this._timeout && this._timeout.cancel();
24        this._timeout = Y.later(timer, context, callback);
25        console.log(this._timeout);
26      }
27
28    };
29
30    var forceRepaint = function(el) {
31      var elDisplay = Y.one(el).getComputedStyle('display');
32      var elTempDisplay;
33
34      if (elDisplay === 'block') {
35        elTempDisplay = 'inline-block'
36      } else {
37        elTempDisplay = 'none'
38      }
39
40      Y.one(el) && Y.one(el).setStyle('display', elTempDisplay);
41      Y.later(10, this, function() {
42        Y.one(el) && Y.one(el).setStyle('display', elDisplay);
43      });
44    };
45
46    Y.Global.on(['tweak:aftershow', 'tweak:afterclose'], function (f) {
47      forceRepaint('#header');
48      forceRepaint('.main-image-wrapper');
49    });
50
51    var header = Y.one('#header');
52    var contactWrapper = Y.one('#contactBlock');
53    var announcementBar = Y.one('.sqs-announcement-bar');
54    var headerHeight = 0;
55
56    var getVariables = function () {
57
58      if (header) {
59        headerHeight = header.get('offsetHeight');
60      }
61
62      this.contactBlockHeight = contactWrapper.get('offsetHeight');
63
64      if (Y.one('.main-image-wrapper')) {
65        this.mainImageHeight = parseInt(Y.one('.main-image-wrapper').getComputedStyle('height'), 10);
66      }
67
68      if (announcementBar) {
69        headerHeight = headerHeight + announcementBar.get('offsetHeight');
70      }
71    };
72
73    getVariables();
74    Y.one(window).on('resize', getVariables, Y.config.win);
75
76    if (Y.one('.main-image-wrapper')) {
77      Y.one(window).on('resize', function() {ImageLoader.load(Y.one('.main-image img'));}, Y.config.win);
78    }
79
80    if (Y.Lang.isUndefined(window.orientation)) {
81      Y.one('html').addClass('no-window-orientation');
82    } else {
83      Y.one('html').addClass('window-orientation');
84    }
85
86    // tests for IE10 metro touch (surface)
87    var hasTouch = navigator.msMaxTouchPoints > 0;
88
89    // set width of site title wrapper based on whether icons or text
90    var emailWidth = Y.one('#email').get('offsetWidth');
91    var infoWidth = Y.one('#info').get('offsetWidth');
92
93    // hide #content until everything loaded to avoid jump
94    Y.one('#content').addClass('show');
95   
96    var setContactPadding = function() {
97      if (Y.one('.contact-inner-wrapper')) {
98        Y.all('.contact-inner-wrapper').setStyle('marginTop', (headerHeight + 5));
99      }
100    };
101    setContactPadding();
102
103    Y.one(window).on('resize', setContactPadding, Y.config.win);
104
105    // check for nav, hide menu icon if none
106    if (Y.one('.nav-wrapper')) {
107      Y.one('body').addClass('has-nav');
108    }
109
110    var setTopPadding = function () {
111      if ( ( Y.one('.no-window-orientation .main-image-wrapper') || Y.one('body:not(.mobile-style-available) .main-image-wrapper') ) && Y.one('body:not(.collection-type-gallery)') && Y.one('body').get('clientWidth') > 640) {
112        Y.one('.main-image-wrapper').setStyle('paddingTop', headerHeight);
113        if (Y.one('#folderNav')) {
114          Y.one('#folderNav').setStyle('marginTop', (headerHeight + this.mainImageHeight));
115        } else if (Y.one('.show-category-navigation #categoryNav')) {
116          Y.one('#categoryNav').setStyle('marginTop', (headerHeight + this.mainImageHeight));
117        } else {
118          Y.one('.content-inner-wrapper').setStyle('marginTop', (headerHeight + this.mainImageHeight));
119        }
120        // }  
121      } else if ( ( Y.one('.no-window-orientation') || Y.one('body:not(.mobile-style-available)') ) && Y.one('body').get('clientWidth') > 640) {
122        if (Y.one('#folderNav')) {
123          Y.one('#folderNav').setStyle('marginTop', (headerHeight));
124          Y.one('#folderNav ul').setStyle('borderTopWidth', 0);
125        } else if (Y.one('.show-category-navigation #categoryNav')) {
126          Y.one('#categoryNav').setStyle('marginTop', (headerHeight));
127        } else {
128          Y.one('.content-inner-wrapper').setStyle('marginTop', (headerHeight));
129        }
130      }
131    };
132
133    setTopPadding();
134    Y.one(window).on('resize', setTopPadding, Y.config.win);
135
136
137    // Main Nav
138    if (!hasTouch) {
139      var fadeTimer, fadeLater = function() {
140        fadeTimer && fadeTimer.cancel();
141
142        fadeTimer = Y.later(1000, this, function() {
143          Y.one('.outer-wrapper').removeClass('nav-open');
144        });
145      };
146
147      Y.one('#header').on('mouseleave', function() {
148        fadeLater();
149      });
150
151      Y.one('#header').on('mousemove', function() {
152        fadeTimer && fadeTimer.cancel();
153      });
154
155      Y.all('.no-window-orientation #desktopMenu, .no-window-orientation .site-title-wrapper').on('mouseenter', function() {
156          setMenu(!Y.one('.outer-wrapper').hasClass('nav-open'));
157      });
158    }
159
160    if (hasTouch || Y.one('.touch')) {
161      Y.one('#desktopMenu').on('click', function() {
162        setMenu(!Y.one('.outer-wrapper').hasClass('nav-open'));
163      });
164    }
165
166    if (Y.one('#email')) {
167      Y.one('#email').on('click', function() {
168        Y.one('.outer-wrapper').removeClass('nav-open');
169        setDesc(false);
170        setEmail(!Y.one('body').hasClass('email-open'));
171      });
172    }
173
174    if (Y.one('#email-mobile')) {
175      Y.one('#email-mobile').on('click', function() {
176        Y.one('.outer-wrapper').removeClass('nav-open');
177        setDesc(false);
178        setEmail(!Y.one('body').hasClass('email-open'));
179      });
180    }
181
182    if (Y.one('#info')) {
183      Y.one('#info').on('click', function() {
184        Y.one('.outer-wrapper').removeClass('nav-open');
185        setEmail(false);
186        setDesc(!Y.one('body').hasClass('desc-open'));
187      });
188    }
189
190    if (Y.one('#info-mobile')) {
191      Y.one('#info-mobile').on('click', function() {
192        Y.one('.outer-wrapper').removeClass('nav-open');
193        setEmail(false);
194        setDesc(!Y.one('body').hasClass('desc-open'));
195      });
196    }
197
198    var setMenu = function(enable) {
199      if (enable) {
200        Y.one('.outer-wrapper').addClass('nav-open');
201        if (Y.one('.outer-wrapper').hasClass('desc-open')) {
202          Y.one('.outer-wrapper').removeClass('desc-open');
203        }
204      }
205    };
206
207    var setEmail = function(enable) {
208      if (enable) {
209        Y.one('body').addClass('email-open');
210      } else {
211        Y.one('body').removeClass('email-open');
212      }
213    };
214
215    var setDesc = function(enable) {
216      if (enable) {
217        Y.one('body').addClass('desc-open');
218      } else {
219        Y.one('body').removeClass('desc-open');
220      }
221    };
222
223    var setMobileNav = function(enable) {
224      if (enable) {
225        Y.one('body').addClass('mobile-nav-open');
226        if (Y.one('body.email-open')) {
227          Y.one('body').removeClass('email-open');
228        }
229        if (Y.one('body.desc-open')) {
230          Y.one('body').removeClass('desc-open');
231        }
232      } else {
233        Y.one('body').removeClass('mobile-nav-open');
234      }
235    };
236
237    if (Y.one('body').get('clientWidth') <= 640) {
238      Y.one('#mobileMenu').on('click', function() {
239        setMobileNav(!Y.one('body').hasClass('mobile-nav-open'));
240      });
241    }
242
243    // folders in mobile
244    Y.all('#mobile-navigation li.folder, .footer-nav li.folder').each(function(elem) {
245      elem.on('click', function() {
246        toggleFolder(elem.siblings('li.folder.dropdown-open').item(0));
247        toggleFolder(elem);
248      });
249    });
250    var toggleFolder = function(elem) {
251      if (elem) {
252        elem.toggleClass('dropdown-open');
253      }
254    };
255
256    // End Main Nav
257
258    // hiding pagination when hovering
259    if (!Y.one('.no-window-orientation')) {
260      Y.all('.pagination div:not(.none).right').on('mouseenter', function () {
261        Y.all('.pagination .left').addClass('hide');
262      });
263
264      Y.all('.pagination .right').on('mouseleave', function () {
265        Y.all('.pagination .left').removeClass('hide');
266      });
267
268      Y.all('.pagination div:not(.none).left').on('mouseenter', function () {
269        Y.all('.pagination .right').addClass('hide');
270      });
271
272      Y.all('.pagination .left').on('mouseleave', function () {
273        Y.all('.pagination .right').removeClass('hide');
274      });
275    }
276
277    // end
278
279    if (Y.one('html.no-window-orientation')) {
280      var scrollStates = function () {
281        if (Y.one('.main-image-wrapper')) {
282          // 80 is main content padding
283          if ( (window.pageYOffset > (this.mainImageHeight + 80)) ) {
284            Y.one('body').addClass('header-hidden');
285            headerHeight = header.get('offsetHeight');
286            if (Y.one('.contact-inner-wrapper')) {
287              Y.all('.contact-inner-wrapper').setStyle('marginTop', (headerHeight + 5));
288            }
289          } else {
290            Y.one('body').removeClass('header-hidden');
291            headerHeight = header.get('offsetHeight');
292            if (Y.one('.contact-inner-wrapper')) {
293              Y.all('.contact-inner-wrapper').setStyle('marginTop', (headerHeight + 5));
294            }
295          }
296          Y.one('.main-image-wrapper').setStyle('opacity', (1 - (window.pageYOffset / parseInt(Y.Squarespace.Template.getTweakValue('bannerImageHeight'), 10))));
297          Y.one('.main-image-wrapper').setStyle('top', -(window.pageYOffset / 3));
298        } else {
299          if ( (window.pageYOffset >= 80) ) {
300            Y.one('body').addClass('header-hidden');
301            headerHeight = header.get('offsetHeight');
302            if (Y.one('.contact-inner-wrapper')) {
303              Y.all('.contact-inner-wrapper').setStyle('marginTop', (headerHeight + 5));
304            }
305          } else {
306            Y.one('body').removeClass('header-hidden');
307            headerHeight = header.get('offsetHeight');
308            if (Y.one('.contact-inner-wrapper')) {
309              Y.all('.contact-inner-wrapper').setStyle('marginTop', (headerHeight + 5));
310            }
311          } 
312        }
313      };
314
315      scrollStates();
316      Y.one(window).on('scroll', function() {
317        scrollStates();
318      });
319    }
320
321    var textShrink = function (element, ancestor) {
322      if(Y.one(element) && Y.one(element).ancestor(ancestor)){
323        Y.all(element).each(function(item){
324          item.plug(Y.Squarespace.TextShrink, {
325            parentEl: item.ancestor(ancestor)
326          });
327        });
328      }
329    };
330
331    // textShrink('.site-title', '.site-title-wrapper');
332
333    // Fixing position of Announcement bar and offsetting the Header
334    var announcementBar = Y.one('.sqs-announcement-bar');
335
336    if (announcementBar) {
337
338      var offset = announcementBar.get('clientHeight');
339      var announcementBarClose = Y.one('.sqs-announcement-bar-close');
340      var header = Y.one('#header');
341
342      if (header && announcementBarClose) {
343
344        header.setStyle('top', offset);
345
346        announcementBarClose.on('click', function(){
347          header.setStyle('top', '0');
348        });
349
350      }
351    }
352
353  });
354});

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.