PageSourceSearch

https://kawaisugi.com/common/js/kawaisugi_script.js?20230404205116

js kawaisugi.com collected 2026-10-02 05:53:07 UTC 17,558 bytes, 814 lines download raw bytes

1
2
3var slideposfunc = function(){ return false; };
4
5
6
7
8var now_fpstamp_timer = null;
9var now_fpstamp_mode = false;
10
11var get_nextwait = function( mode ){
12
13	var max = 1;
14	var min = 1;
15
16	if ( mode == false ){ // 何もしない期間のほうが長い
17
18		max = 3;
19		min = 2;
20
21	}
22
23	return Math.floor( Math.random() * ( ( max + 1 ) - min ) ) + min;
24
25};
26
27var start_fpstamp = function(){
28
29	var wait = get_nextwait(now_fpstamp_mode);
30
31	//console.log('now_fpstamp_mode: '+now_fpstamp_mode+', wait: '+wait);
32
33	now_fpstamp_timer = setTimeout( change_fpstamp_mode, wait * 1000 );
34
35};
36
37var change_fpstamp_mode = function(){
38
39	if ( now_fpstamp_mode == false ){
40
41		$('.fpstamp_item','#fpstamp_cover').each(function(){
42
43			$(this).remove();
44
45		});
46
47		now_fpstamp_mode = true;
48
49	}else {
50
51		now_fpstamp_mode = false;
52
53	}
54
55	start_fpstamp();
56
57};
58
59var stop_fpstamp = function(){
60
61	if ( now_fpstamp_timer != null ){
62
63		clearTimeout(now_fpstamp_timer);
64
65		now_fpstamp_timer = null;
66
67	}
68
69};
70
71
72$(document).ready(function(){
73
74
75	if ( !( 'console' in window ) ){
76		window.console = {};
77		window.console.log = function(arg){
78			return arg;
79		};
80	}
81
82	//console.log('ready 1.');
83
84
85
86	$('body').each(function(){
87
88		$(this).append('<div id="fpstamp_cover"></div>');
89
90		var _fpstamp_cover = $('#fpstamp_cover');
91
92		var event_count = 0;
93		var fpstamp_visible_time = 500;
94
95		var fpstamp_hide_func = function( stamp_id ){
96
97			$('#'+stamp_id).remove();
98
99		};
100
101		var mouse_prev_x = 0;
102		var mouse_prev_y = 0;
103
104		var sp_trigger_width = 750;
105
106		var fpstamp_execute_func = function( pointer_x, pointer_y ){
107
108			if ( now_fpstamp_mode == true ){
109
110				// Math.sqrt( Math.pow( x2- x1, 2 ) + Math.pow( y2 - y1, 2 ) );
111
112				var dist = Math.sqrt( Math.pow( pointer_x - mouse_prev_x, 2 ) + Math.pow( pointer_y - mouse_prev_y, 2 ) ) ;
113
114				//console.log('clientX: '+pointer_x+', clientY: '+pointer_y+', dist: '+dist);
115
116				if ( dist > 60 ){
117
118					// Math.atan2( y2 - y, x2 - x );
119
120					var radian = Math.atan2( pointer_y - mouse_prev_y, pointer_x - mouse_prev_x );
121
122					var angle = radian * 180 / Math.PI;
123
124					angle = angle + 90;
125
126					//rotate('+radian+'rad);
127					_fpstamp_cover.append('<div class="fpstamp_item" id="'+event_count+'" style="top: '+pointer_y+'px;left: '+pointer_x+'px;transform: rotate('+angle+'deg);"></div>');
128
129					setTimeout( fpstamp_hide_func, fpstamp_visible_time, event_count );
130
131					mouse_prev_x = pointer_x;
132					mouse_prev_y = pointer_y;
133
134				}
135
136				event_count++;
137
138			}else {
139
140				event_count = 0;
141
142			}
143
144		};
145
146		$(window).mousemove(function(e){
147
148			if ( $(window).width() > sp_trigger_width ){
149
150				fpstamp_execute_func( e.clientX, e.clientY );
151
152			}
153
154		});
155
156		var direction, position;
157
158		var touchStart_func = function(e){
159
160			
161
162		};
163
164		function touchMove_func(e){
165
166			var clieantX = e.originalEvent.touches[0].pageX;
167			var clieantY = e.originalEvent.touches[0].pageY;
168
169			//var dist = 0;
170
171			//console.log('clientX: '+clieantX+', clientY: '+clieantY+', dist: '+dist);
172
173			var scrolltop = $(window).scrollTop();
174
175			//fpstamp_execute_func( clieantX, clieantY - scrolltop );
176
177		}
178
179		var spstamp_visible_time = 1000;
180
181		function touchEnd_func(e){
182
183			if ( $(window).width() <= sp_trigger_width ){
184
185				var clieantX = e.changedTouches[0].pageX;
186				var clieantY = e.changedTouches[0].pageY;
187
188				var scrolltop = $(window).scrollTop();
189
190				var css_top = clieantY - scrolltop;
191
192				// 足跡
193				_fpstamp_cover.append('<div class="spstamp_fp" id="'+event_count+'" style="visibility: hidden;"></div>');
194
195				var _add_elem = $('#'+event_count);
196
197				_add_elem.css({
198					'top': ( css_top - ( _add_elem.width() / 2 ) ) + 'px',
199					'left': ( clieantX - ( _add_elem.height() / 2 ) ) + 'px',
200					'visibility': 'visible'
201				});
202
203				_add_elem.addClass('spstamp_fp_fadeout');
204
205				setTimeout( fpstamp_hide_func, spstamp_visible_time, event_count );
206
207				event_count++;
208
209				// 輪
210				_fpstamp_cover.append('<div class="spstamp_fp_circle" id="'+event_count+'" style="visibility: hidden;"></div>');
211
212				_add_elem = $('#'+event_count);
213
214				_add_elem.css({
215					'top': ( css_top - ( _add_elem.width() / 2 ) ) + 'px',
216					'left': ( clieantX - ( _add_elem.height() / 2 ) ) + 'px',
217					'visibility': 'visible'
218				});
219
220				_add_elem.addClass('spstamp_fp_circle_fadeout');
221
222				setTimeout( fpstamp_hide_func, spstamp_visible_time, event_count );
223
224				event_count++;
225
226			}
227
228		}
229
230		$(window).bind( 'touchstart', touchStart_func );
231		$(window).bind( 'touchmove', touchMove_func );
232		$(window).bind( 'touchend', touchEnd_func );
233
234		start_fpstamp();
235
236	});
237
238
239	$('#kwsg_header_nav').each(function(){
240
241		$(this).scroll(function(){
242
243			var body_height = $('#kwsg_header_nav_in').height();
244			var cover_height = $('#kwsg_header_nav').height();
245
246			var _arrow = $('#kwsg_header_nav_arrow');
247
248			if ( body_height > cover_height ){
249
250				if ( $(this).scrollTop() >= ( body_height - cover_height ) ){
251
252					_arrow.css({ 'opacity': 0.0 });
253
254				}else {
255
256					_arrow.css({ 'opacity': 1.0 });
257
258				}
259
260			}else {
261
262				_arrow.css({ 'opacity': 0.0 });
263
264			}
265
266		});
267
268		$(this).trigger('scroll');
269
270		var _this = $('#kwsg_header_nav');
271
272		var _this_in = $('#kwsg_header_nav_in');
273
274		$('#kwsg_header_nav_arrow').css({ 'cursor': 'pointer' }).unbind('click').bind( 'click', function(){
275
276			_this.stop().animate( { scrollTop: ( _this_in.outerHeight() - _this.height() ) + 'px' }, 750, 'easeInOutQuint' );
277
278			return false;
279
280		});
281
282	});
283
284
285	$('#kwsg_backtotop').each(function(){
286
287		$(this).unbind('click').bind( 'click', function(){
288
289			$('body, html').stop().animate( { scrollTop: '0px' }, 1250, 'easeInOutQuint' );
290
291			return false;
292
293		});
294
295	});
296
297
298	$('#kwsg_header_sp_button').each(function(){
299
300		var _cover = $('#kwsg_header');
301		var _main = $('#kwsg_header_in');
302
303		$.data( $(this).get(0), 'is_open', false );
304
305		$.data( $(this).get(0), 'def_height', 0 );
306
307		var _this = $(this);
308
309		$(this).unbind('click').bind( 'click', function(){
310
311			if ( $.data( _this.get(0), 'is_open' ) != false ){
312
313				_cover.stop().animate( { 'opacity': 0.0 }, 500, 'easeOutExpo', function(){
314
315					$(this).hide();
316
317				});
318
319				_this.removeClass('kwsg_header_sp_button_is_open');
320
321				$.data( _this.get(0), 'is_open', false );
322
323			}else {
324
325				_cover.show();
326
327				$('#kwsg_header_nav').trigger('scroll');
328
329				_cover.stop().animate( { 'opacity': 1.0 }, 500, 'easeOutExpo', function(){
330
331					//$(this).css({ height: 'auto' });
332
333				});
334
335				_this.addClass('kwsg_header_sp_button_is_open');
336
337				$.data( _this.get(0), 'is_open', true );
338
339			}
340
341		});
342
343		$(window).unbind('resize.spmenureset').bind( 'resize.spmenureset', function(){
344
345			_cover.stop().css({
346				'opacity': '',
347				'display': ''
348			});
349
350			_this.removeClass('kwsg_header_sp_button_is_open');
351
352			$.data( _this.get(0), 'is_open', false );
353
354		});
355
356		$(window).trigger('resize.spmenureset');
357
358	});
359
360
361	$('.story_thumbs').each(function(){
362
363		var _thumb = $(this);
364
365		var _thumb_items = $('img',_thumb);
366
367		_thumb.before('<p class="story_thumbs_main"></p>')
368
369		var _main = $('.story_thumbs_main',$(this).parent());
370
371		_thumb_items.each(function(){
372
373			_main.append($(this).clone());
374
375		});
376
377		var _main_items = $('img',_main);
378
379		//console.log(_main);
380
381		_thumb_items.each(function(){
382
383			$(this).unbind('click').bind( 'click', function(){
384
385				var _this = $(this);
386
387				_main_items.stop().animate( { 'opacity': '0.0' }, 300, 'linear', function(){} );
388
389				_thumb_items.removeClass('current');
390
391				_main_items.each(function(){
392
393					if ( _this.index() == $(this).index() ){
394
395						$(this).stop().animate( { 'opacity': '1.0' }, 300, 'linear', function(){} );
396
397						_this.addClass('current');
398
399					}else {
400
401					}
402
403				});
404
405				return false;
406
407			});
408
409		});
410
411		if ( _thumb_items.length > 0 ){
412
413			_thumb_items.eq(0).trigger('click');
414
415		}
416
417	});
418
419
420
421
422
423	/*
424	Light Box もどき V2
425	*/
426	$('.modal_trigger').each(function(){
427
428		if ( $('body.sp').length != 0 ) return false;
429
430		if ( $('#overlay').length == 0 ){
431
432			$('body').append('<div id="overlay"><div id="modal_loading"><div id="modal_loading_icon"></div></div></div><div id="modal"><div id="modal_inner"></div><div id="modal_close"></div></div>');
433
434			$.ilight = {};
435			$.ilight.close = function(){
436
437				$('#overlay').trigger('click');
438
439				//return this;
440
441			};
442
443			$.ilight.resize = function( iw, ih ){
444
445				var pd_width = iw;
446				var pd_height = ih;
447
448				var ol_tb_padding = 20;
449				var ol_rl_padding = 20;
450				var ol_tb_img_padding = 2;
451				var ol_rl_img_padding = 2;
452
453				var ol_width = $(window).width() - ( ol_tb_padding * 2 );
454				var ol_height = $(window).outerHeight() - ( ol_rl_padding * 2 );
455
456				var ol_img_width = ol_width - ( ol_tb_img_padding * 2 );
457				var ol_img_height = ol_height - ( ol_rl_img_padding * 2 );
458
459				var ol_img_mt = 0;
460				var ol_img_ml = 0;
461
462				if ( ol_img_width > pd_width && ol_img_height > pd_height ){
463
464					ol_width = pd_width + ( ol_tb_img_padding * 2 );
465					ol_height = pd_height + ( ol_rl_img_padding * 2 );
466					ol_img_width = pd_width;
467					ol_img_height = pd_height;
468
469				}else {
470
471					// DVLPTM5
472
473					var buf_width = parseInt( pd_width * ( ol_img_height / pd_height ) ); // 縦にfitした場合の幅
474					var buf_height = parseInt( pd_height * ( ol_img_width / pd_width ) ); // 横にfitした場合の高さ
475
476					if ( buf_width <= ol_img_width ){ // 縦fitの場合にリサイズした幅がウィンドウ幅よりも小さい場合、画像は画面に収まっている
477
478						ol_img_width = buf_width;
479						ol_width = buf_width;
480
481					}else { // そうでない場合は横fit合わせ
482
483						ol_img_height = buf_height;
484						ol_height = buf_height;
485
486					}
487
488					//console.log('ol_img_width: ' + ol_img_width + ', buf_width: ' + buf_width);
489					//console.log('ol_img_height: ' + ol_img_height + ', buf_height: ' + buf_height);
490
491				}
492
493				$('#modal').css({
494					marginTop: -parseInt( ol_height / 2 ) + 'px',
495					marginLeft: -parseInt( ol_width / 2 ) + 'px',
496					width: ol_img_width + 'px',
497					height: ol_img_height + 'px',
498					cursor: 'pointer'
499				});
500
501				$('#modal_inner').width(ol_img_width).height(ol_img_height);
502
503				$('#overlay').css({ display: 'block', height: $(window).outerHeight() + 'px', width: $(window).width() + 'px' });
504
505			};
506
507			$('#overlay').unbind('click').bind( 'click', function(){
508
509				$('#modal_loading').css({ opacity: 0.0 });
510
511				$.data( $('#modal_inner').get(0), 'owidth', false );
512				$.data( $('#modal_inner').get(0), 'oheight', false );
513
514				$('#modal').stop().animate( { opacity: 0.0 }, 150, 'linear', function(){
515
516					$(this).css({ display: 'none' });
517
518					$('#overlay').stop().animate( { opacity: 0.0 }, 150, 'linear', function(){
519
520						$(this).css({ display: 'none' });
521
522						$('#modal_inner').html('');
523
524						$(document).unbind('mousewheel.stop DOMMouseScroll.stop');
525
526					});
527
528				});
529
530			});
531
532			$(window).unbind('resize.ilight').bind( 'resize.ilight',  function(){
533
534				if ( $.data( $('#modal_inner').get(0), 'owidth' ) && $.data( $('#modal_inner').get(0), 'oheight' ) ){
535
536					$.ilight.resize( $.data( $('#modal_inner').get(0), 'owidth' ), $.data( $('#modal_inner').get(0), 'oheight' ) );
537
538				}
539
540			});
541
542		}
543
544		if ( $(this).attr('data-mode') && $(this).attr('data-mode') == 'iframe' ){
545
546			$(this).unbind('click').bind( 'click', function(){
547
548				$('#modal_inner').html('<iframe src="'+$(this).attr('data-src')+'" width="100%" height="100%" frameborder="0" allowfullscreen></iframe>');
549
550				$.data( $('#modal_inner').get(0), 'owidth', parseInt($(this).attr('data-width')) );
551				$.data( $('#modal_inner').get(0), 'oheight', parseInt($(this).attr('data-height')) );
552
553				$.ilight.resize( parseInt($(this).attr('data-width')), parseInt($(this).attr('data-height')) );
554
555				$('#modal').stop().css({ display: 'block' }).animate( { opacity: 1.0 }, 250, 'linear', function(){} );
556
557				$('#modal').unbind('click').bind( 'click', function(){
558
559					$.ilight.close();
560
561				});
562
563				$('#overlay').css({ display: 'block', height: $(window).outerHeight() + 'px', width: $(window).width() + 'px' });
564
565				$('#overlay').stop().animate( { opacity: 1.0 }, 250, 'linear', function(){} );
566
567				$(document).bind( 'mousewheel.stop DOMMouseScroll.stop', function(e){
568
569					/* IE7, IE8, Chrome, Safari */
570					if ( !e ){
571
572						e = window.event;
573
574					}
575
576					/* Chrome, Safari, Firefox */
577					if ( e.preventDefault ){
578
579						e.preventDefault();
580
581					}
582
583					/* IE7, IE8 */
584					e.returnValue = false;
585
586				});
587
588				return false;
589
590			});
591
592			return true;
593
594		}
595
596		if ( $(this).attr('data-modal-mode') == 'direct' ){ // 要修正
597
598			$(this).each(function(){
599
600				var _this = $(this);
601
602				$(this).unbind('click').bind( 'click', function(){
603
604					var preloader = new Image;
605					preloader.onload = function(){
606
607						$('#modal_loading').css({ opacity: 0.0 });
608
609						//$('#modal_inner').html('<img src="'+preloader.src+'" width="100%" height="100%" style="margin-top: '+ol_img_mt+'px; margin-left: '+ol_img_ml+'px;">');
610						$('#modal_inner').html('<img src="'+preloader.src+'" width="100%" height="100%">');
611
612						$.data( $('#modal_inner').get(0), 'owidth', preloader.width );
613						$.data( $('#modal_inner').get(0), 'oheight', preloader.height );
614
615						$.ilight.resize( preloader.width, preloader.height );
616
617						$('#modal').stop().css({ display: 'block' }).animate( { opacity: 1.0 }, 250, 'linear', function(){} );
618
619						$('#modal').unbind('click').bind( 'click', function(){
620
621							$.ilight.close();
622
623						});
624
625					};
626
627					$('#modal_loading').css({ opacity: 1.0 });
628
629					$('#overlay').css({ display: 'block', height: $(window).outerHeight() + 'px', width: $(window).width() + 'px' });
630
631					$('#overlay').stop().animate( { opacity: 1.0 }, 250, 'linear', function(){} );
632
633					preloader.src = _this.attr('href');
634
635					return false;
636
637				});
638
639			});
640
641		}
642
643		$('img',$(this)).each(function(){
644
645			if ( $(this).parent().attr('href') ){
646
647				var _this = $(this).parent();
648
649				$(this).parent().unbind('click').bind( 'click', function(){
650
651					var preloader = new Image;
652					preloader.onload = function(){
653
654						$('#modal_loading').css({ opacity: 0.0 });
655
656						//$('#modal_inner').html('<img src="'+preloader.src+'" width="100%" height="100%" style="margin-top: '+ol_img_mt+'px; margin-left: '+ol_img_ml+'px;">');
657						$('#modal_inner').html('<img src="'+preloader.src+'" width="100%" height="100%">');
658
659						$.data( $('#modal_inner').get(0), 'owidth', preloader.width );
660						$.data( $('#modal_inner').get(0), 'oheight', preloader.height );
661
662						$.ilight.resize( preloader.width, preloader.height );
663
664						$('#modal').stop().css({ display: 'block' }).animate( { opacity: 1.0 }, 250, 'linear', function(){} );
665
666						$('#modal').unbind('click').bind( 'click', function(){
667
668							$.ilight.close();
669
670						});
671
672					};
673
674					$('#modal_loading').css({ opacity: 1.0 });
675
676					$('#overlay').css({ display: 'block', height: $(window).outerHeight() + 'px', width: $(window).width() + 'px' });
677
678					$('#overlay').stop().animate( { opacity: 1.0 }, 250, 'linear', function(){} );
679
680					preloader.src = _this.attr('href');
681
682					return false;
683
684				});
685
686			}else {
687
688				return true;
689
690			}
691
692		});
693
694	});
695
696
697	$(window).trigger('resize');
698
699	$(window).trigger('scroll');
700
701
702
703	//$(window).trigger('scroll');
704
705
706	//console.log(1);
707
708
709});
710
711
712$(window).bind( 'resize', function(){
713
714
715	//$(window).trigger('scroll');
716
717	$('#kwsg_header_nav').trigger('scroll');
718
719
720
721
722
723
724
725	$('#fv_video01').each(function(){
726
727		var _cover = $('#fv_video01_cover');
728
729		var cover_width = _cover.width() + 2;
730		var cover_height = _cover.height() + 2;
731
732		var _video = $(this);
733
734		var video_width = parseInt(_video.attr('data-width'));
735		var video_height = parseInt(_video.attr('data-height'));
736
737		var fit_height = ( cover_width / video_width ) * video_height;
738
739		var fit_width;
740
741		if ( fit_height >= cover_height ){
742
743			_video.css({
744				'position': 'absolute',
745				'width': cover_width + 'px',
746				'height': fit_height + 'px',
747				'marginTop': -( fit_height / 2 ) + 'px',
748				'marginLeft': -( cover_width / 2 ) + 'px',
749				'top': '50%',
750				'left': '50%'
751			});
752
753		}else {
754
755			fit_width = ( cover_height / video_height ) * video_width;
756
757			_video.css({
758				'position': 'absolute',
759				'width': fit_width + 'px',
760				'height': cover_height + 'px',
761				'marginTop': -( cover_height / 2 ) + 'px',
762				'marginLeft': -( fit_width / 2 ) + 'px',
763				'top': '50%',
764				'left': '50%'
765			});
766
767		}
768
769	});
770
771
772});
773
774
775//jQuery.event.add( window, 'load', function(){
776$(window).on( 'load', function(){
777
778
779	//$(window).trigger('resize');
780
781
782
783	//$(window).trigger('resize');
784
785
786
787	//$(window).trigger('scroll');
788
789	setTimeout( function(){
790
791		$('#loading_overlay').stop().animate( { 'opacity': 0.0 }, 500, 'linear', function(){
792
793			$(this).css({ 'display': 'none' });
794
795		});
796
797	}, 200 );
798
799
800	//console.log('load');
801
802
803
804});
805
806
807$(window).scroll(function(){
808
809
810	//console.log('scroll');
811
812
813
814});

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.