PageSourceSearch

https://bouken.co.jp/_js/init.js

js bouken.co.jp collected 2026-10-04 07:34:58 UTC 6,808 bytes, 248 lines download raw bytes

1var lastInnerWidth = window.innerWidth;
2var fbTimer = false;
3var hash = location.hash;
4
5$(function() {
6    lazy();
7
8    $('article .fb-page').attr('data-width', Math.floor($('#sec-4 article:nth-child(2)').width()));
9
10    if ( hash != "" ){
11        $('body,html').stop().scrollTop(0);
12        setTimeout( function(){
13            smoothScroll(hash);
14            scrollToggle();
15        }, 100);
16    }else{
17        scrollStyle();
18    }
19
20    $(window).on('resize', function(){
21        if ( window.innerWidth > 1000 ){
22            $('main').css('margin-top', $('body > header').height());
23        }else{
24            $('main').not('body#index main').css('margin-top', $('body > header').height());
25        }
26
27        if ( window.innerWidth > 640 ){
28            setPC();
29        }else{
30            setSP();
31        }
32
33        if ( lastInnerWidth != window.innerWidth ) {
34            lastInnerWidth = window.innerWidth;
35
36            lazy();
37            navReset();
38
39            if (fbTimer !== false) {
40                clearTimeout(fbTimer);
41            }
42
43            $('article .fb-page').attr('data-width', Math.floor($('#sec-4 article:nth-child(2)').width()));
44
45            fbTimer = setTimeout(function() {
46                window.FB.XFBML.parse();
47            }, 200);
48        }
49    });
50
51
52    // Menu open
53	$('#menu-trigger , #nav-cover').on('click', function(){
54        var scrollBar = window.innerWidth - $(window).width();
55        $('body').css('paddingRight', scrollBar);
56        $('body > header').css('paddingRight', scrollBar);
57		$('body').toggleClass('open');
58        $('#nav-cover').fadeToggle();
59
60        if ( $('body').hasClass('open') ){
61            $('body > header nav').css({overflowY:'scroll'});
62        }else{
63            $('body').css('paddingRight', 0);
64            $('body > header').css('paddingRight', 0);
65            $('body > header nav').css({overflowY:'auto'});
66        }
67	});
68
69    // Header background toggle
70    $(window).on('scroll', function (){
71        lazy();
72        scrollStyle();
73    });
74
75    // Smooth scroll
76	$('a[href^="#"]').not('a.modal').on('click', function(){
77        if ( window.innerWidth <= 1000 ){
78            $('html').removeClass('open');
79            $('body > header nav').css({overflowY:'auto', height:'auto'});
80            $('body > header nav ul').slideUp();
81            $('#nav-cover').fadeOut();
82        }
83
84		var href = $(this).attr("href");
85		var hash = $(href == "#" || href == "" ? 'html' : href);
86        smoothScroll(hash);
87        return false;
88	});
89 
90    // Auto Link
91    $('main a[href ^="http"]').attr("target", "_blank").attr('rel', 'noopener');
92    $('main a[href ^="http"]:not(:has(img))').not('.button').addClass("external-link");
93
94
95    // FAQ
96    $('dl.faq dt').on('click', function(){
97        $(this).siblings('dd').slideToggle();
98        $(this).parent('dl').toggleClass('open');
99    });
100
101    // Map Flag
102    $('#facility aside a').on({
103        'mouseenter': function() {
104            $('#facility aside div.'+$(this).attr('href').replace('#','')).fadeIn('fast');
105        },
106        'mouseleave': function() {
107            $('#facility aside div.'+$(this).attr('href').replace('#','')).fadeOut('fast');
108        }
109    });
110
111    if ( window.innerWidth > 1000 ){
112        $('main').css('margin-top', $('body > header').height());
113    }else{
114        $('main').not('body#index main').css('margin-top', $('body > header').height());
115    }
116    if ( window.innerWidth > 640 ){
117        setPC();
118    }else{
119        setSP();
120    }
121
122    // Share button fade
123    $("body > footer > ul li a").hover(function () {
124    	  $("img" , this).stop().animate({opacity:0}
124,"fast");
125    },function () {
126    	   $("img" , this).stop().animate({opacity:1},"fast");
127    });
128
129    // index Tab
130    $('#search .tab li').on('click', function(){
131        $('#search .tab li').removeClass('active');
132        $(this).addClass('active');
133        $('#search ul.tab-content').hide();
134        $('#search ul.'+$(this).attr('data-class')).show();
135    });
136
137});
138
139if ( lastInnerWidth != window.innerWidth ) {
140    lastInnerWidth = window.innerWidth;
141
142    lazy();
143    navReset();
144
145}
146
147
148// SP setup
149function setSP(){
150    $('body > header > ul').show();
151
152    if ( window.innerWidth <= 640 ){
153		$('ul.pageing li').hide();
154        $('ul.pageing li em').parent('li').show();
155        $('ul.pageing li').eq(0).show();
156        $('ul.pageing li').eq(8).show();
157//		$('ul.pageing li').eq(1).show();
158//		$('ul.pageing li').eq(7).show();
159    }else{
160
161    }
162}
163
164// PC setup
165function setPC(){
166    $('body > header > ul').show();
167    $('body > nav').show();
168    $('.pageing li').show();
169}
170
171// SmoothScroll func
172function smoothScroll(hash){
173    var position = $(hash).offset().top - $('body > header').outerHeight();
174	$('body,html').animate({scrollTop:position}, 1000, 'easeOutCubic');
175}
176
177// Scroll style
178function scrollStyle(){
179    if ( $(window).scrollTop() >= 120 ){
180        $('body').addClass('scrolled');
181    }else{
182        $('body').removeClass('scrolled');
183    }
184
185    if ( $(document).height() - $(window).scrollTop() <= $(window).height() ) {
186        $('#float-button').addClass('bottom');
187    }else{
188        $('#float-button').removeClass('bottom');
189    }
190}
191
192// navReset
193function navReset(){
194    var scrollBar = window.innerWidth - $(window).width();
195    $('body').css('paddingRight', 0);
196    $('body > header').css('paddingRight', 0);
197	$('body').removeClass('open');
198    $('#nav-cover').fadeOut();
199    if ( window.innerWidth <= 920 ){
200        $('body > nav').slideUp();
201    }
202}
203
204function lazy(){
205    var pos = $(window).scrollTop() + ($(window).innerHeight() / 1.2);
206
207    $('main h1, main h2, main h3, main h4, main p, main article').not('article *, #bouken-lab #lab-header.new-lab > p').each(function(){
208        if ( pos >= $(this).offset().top  ){
209            $(this).css({
210                opacity: 1
211            });
212        }else{
213            $(this).css({
214                opacity: 0
215            });
216        }
217    });
218
219    $('.fadeup').each(function(){
220        if ( $(this).hasClass('fadeup10') ){
221            var delay = 100;
222        }else if ( $(this).hasClass('fadeup20') ){
223            var delay = 200;
224        }else if ( $(this).hasClass('fadeup30') ){
225            var delay = 300;
226        }else if ( $(this).hasClass('fadeup40') ){
227            var delay = 400;
228        }else if ( $(this).hasClass('fadeup50') ){
229            var delay = 500;
230        }else {
231            var delay = 0;
232        }
233        if ( pos >= $(this).offset().top  ){
234            $(this).delay(delay).css({
235                opacity: 1,
236                transform: 'translateY(0)',
237                transition: '800ms'
238            });
239        }else{
240            $(this).css({
241                opacity: 0,
242                transform: 'translateY(40px)',
243                transition: '800ms'
244            });
245        }
246    });
247}
248

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.