PageSourceSearch

https://www.toyo.ac.jp/js/common.js

js toyo.ac.jp collected 2026-10-01 10:33:33 UTC 8,402 bytes, 253 lines download raw bytes

1( function( d, w, $ ) {
2	'use strict';
3
4	var _ua = window.navigator.userAgent.toLowerCase();
5	let _ms = false;
6	// ---------------------------------------------
7	// IE11の場合bodyにクラスを付与
8	// ---------------------------------------------
9	if( _ua.indexOf( 'trident' ) > -1 ) {
10		document.body.classList.add( 'ie11' );
11		_ms = true;
12	} else
13	if( _ua.indexOf( 'edge' ) > -1 ) {
14		_ms = true;
15	}
16	// ---------------------------------------------
17	// viewportの切り替え
18	// ---------------------------------------------
19	$("#viewport").remove();
20	var _maxMatch = matchMedia('(max-width: 1240px)');
21	var _minMatch = matchMedia('(min-width: 768px)');
22	var _maxMatchForSp = matchMedia('(max-width: 375px)');
23	if( ( _ua.indexOf( 'iphone' ) > 0 ) || _ua.indexOf( 'ipod' ) > 0 || _ua.indexOf( 'ipad' ) > 0 || ( _ua.indexOf( 'android' ) > 0 && _ua.indexOf( 'mobile' ) > 0 ) ) {
24		// console.log( 'mobile' );
25		if(_maxMatchForSp.matches) {
26			// <-375
27			$( 'head' ).prepend( '<meta name="viewport" id="viewport" content="width=375">' );
28		} else if(_maxMatch.matches && _minMatch.matches) {
29			// 768 <-> 1199
30			$( 'head' ).prepend( '<meta name="viewport" id="viewport" content="width=1280">' );
31		} else {
32			$( 'head' ).prepend( '<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1">' );
33		}
34	} else {
35		// PC
36		$( 'head' ).prepend( '<meta name="viewport" id="viewport" content="width=1280">' );
37	}
38
39	var _hash = location.hash;
40
41	$( function() {
42		// ---------------------------------------------
43		// matchHeight
44		// ---------------------------------------------
45		$( '.mh' ).matchHeight();
46		$( '.mh2' ).matchHeight();
47		$( '.mh3' ).matchHeight();
48		// ---------------------------------------------
49		// Magnificpopup
50		// ---------------------------------------------
51		//$( '.mfp-image' ).magnificPopup( {
52		//	type: 'image'
53		//} );
54		//$( '.mfp-inline' ).magnificPopup( {
55		//	type: 'inline'
56		//} );
57		// ---------------------------------------------
58		//responsive Imagemap link
59		// ---------------------------------------------
60		$( 'img[usemap]' ).rwdImageMaps();
61		//move2hash
62		// var _m2h = new move2hash();
63		// _m2h.init();
64		// $( w ).on( 'load', function() {
65		// 	_m2h.start();
66		// } );
67		// ---------------------------------------------
68		// ページ内ナビのレスポンシブ対応
69		// ---------------------------------------------
70		$( '.pageanchor' ).each( function( i, elm ) {
71				var _select = $( '<div class="selecton"><select><option value="" selected>MENU</option></select></div>' );
72				$( this ).find( '.nav-item' ).each( function( i, elm ) {
73					let _anchor = $( this ).find( '.nav-link' ).data( 'anchor' );
74					let _type = "scroll";
75					if( !_anchor ) {
76						_anchor = $( this ).find( '.nav-link' ).attr( 'href' );
77						_type = "link";
78						if( $( this ).find( '.nav-link' ).attr( 'target' ) === "_blank" ) {
79							_type = "blank";
80						}
81					}
82					var _option = $( '<option/>' ).text( $( this ).find( '.nav-link' ).text() ).val( _anchor ).data( 'type', _type );
83					_select.find( 'select' ).append( _option );
84				} );
85				$( this ).append( _select );
86			} )
87			.on( 'change', 'select', function() {
88				var _v = $( this ).val();
89				if( _v.length < 1 ) return false;
90
91				var _tar = $( this ).find( 'option:selected' );
92				if( _tar.data( 'type' ) === "scroll" ) {
93					_m2h.move( _v );
94				} else
95				if( _tar.data( 'type' ) === "link" ) {
96					location.href = _v;
97				} else
98				if( _tar.data( 'type' ) === "blank" ) {
99					window.open( _v );
100				}
101			} );
102		// ---------------------------------------------
103		// タブのレスポンシブ対応
104		// ---------------------------------------------
105		$( '.tabnav' ).each( function( i, elm ) {
106				var _select = $( '<div class="selecton"><select/></div>' );
107				$( this ).find( '.nav-item' ).each( function( i, elm ) {
108					var _a = $( this ).find( '.nav-link' );
109					var _option = $( '<option/>' ).text( _a.text() ).val( i );
110					if( _a.attr( 'href' ) === _hash ) {
111						_a.click();
112						_option.attr( 'selected', true );
113					}
114					_select.find( 'select' ).append( _option );
115				} );
116				$( this ).find( '.inner' ).append( _select );
117			} )
118			.on( 'change', 'select', function() {
119				// console.log($(this).val());
120				$( this ).closest( '.tabnav' ).find( '.nav-tabs' ).find( '.nav-link' ).eq( $( this ).val() ).tab( '
120show' );
121			} );
122		// ---------------------------------------------
123		// アコーディオンの開閉イベント補完
124		// ---------------------------------------------
125		$( '.panel' ).find( '.panel-heading' ).find( 'a' ).append( '<span class="icon"/>' );
126		$( '.panel-collapse' ).on( 'show.bs.collapse hidden.bs.collapse', function( e ) {
127			// console.log(e);
128			// var _id = e.target.id;
129			if( e.type === 'show' ) {
130				$( this ).closest( '.panel' ).addClass( 'collapse_show' );
131			} else {
132				$( this ).closest( '.panel' ).removeClass( 'collapse_show' );
133				$( this ).find( '.panel-collapse' ).collapse( 'hide' );
134			}
135		} );
136		$( '.panel-title' ).each( function() {
137			var _a = $( this ).find( 'a' );
138			if( _a.attr( 'href' ) === _hash ) {
139				_a.click();
140				if( $( this ).parents( '.panel' ).length > 0 ) {
141					$( this ).parents( '.panel' ).find( '.panel-title > a' ).click();
142				}
143			}
144		} );
145		// ----------------------------------------------
146		// Windows resize Event
147		// ----------------------------------------------
148		let _resizeTimer = false;
149		let _size = w.innerWidth;
150		$( w ).on( 'resize', function() {
151			if( _resizeTimer ) {
152				clearTimeout( _resizeTimer );
153			}
154			_resizeTimer = setTimeout( function() {
155				if( _size !== w.innerWidth ) {
156					_size = w.innerWidth;
157					$( d ).trigger( "hoge::resized", [ _size ] );
158				}
159			}, 60 );
160		} );
161		// ----------------------------------------------
162		// スクロールイベント
163		// ----------------------------------------------
164		//$( d ).on( 'hoge::scroll', function() {
165		//	var _top = document.body.getBoundingClientRect().top;
166		//	if( _top < -200 ) {
167		//		$( '.pagetop' ).fadeIn();
168		//	} else {
169		//		$( '.pagetop' ).fadeOut();
170		//	}
171		//} );
172
173		let _scrollTimer = false;
174		$( w ).on( 'scroll', function() {
175			if( _scrollTimer ) {
176				clearTimeout( _scrollTimer )
177			}
178			_scrollTimer = setTimeout( function() {
179				$( d ).trigger( "hoge::scroll" );
180			}, 60 );
181		} );
182	} );
183
184	// ----------------------------------------------
185	// ページ内リンク
186	// ----------------------------------------------
187
188	// var move2hash = function() {};
189	// //pagetop
190	// move2hash.prototype.init = function() {
191	// 	var _this = this;
192	// 	$( 'a[href^="#"], area[href^="#"]' ).filter( '.scroll' ).each( function() {
193	// 		var $this = $( this );
194	// 		var _href = $this.attr( 'href' );
195	// 		$this
196	// 			.attr( {
197	// 				href: 'javascript:void(0);',
198	// 				rel: _href
199	// 			} )
200	// 			.on( 'click', function( e ) {
201	// 				e.preventDefault();
202	// 				var _target;
203	// 				if( $this.parent().hasClass( 'pagetop' ) ) {
204	// 					// _target = 0;
205	// 					_target = $( 'body' );
206	// 				} else {
207	// 					_target = $( $this.attr( 'rel' ) );
208	// 				}
209	// 				_this.move( _target );
210	// 				return false;
211	// 			} );
212	// 	} );
213
214	// 	$( w ).on( 'hashchange', function( e ) {
215	// 		e.preventDefault();
216	// 		var _hash = location.hash;
217	// 		if( $( _hash ).length > 0 ) {
218	// 			_this.move( _hash );
219	// 		}
220	// 		return false;
221	// 	} );
222	// };
223	// move2hash.prototype.start = function() {
224	// 	var _url = d.URL;
225	// 	var _url_split = _url.split( "#" );
226	// 	var _hash = _url_split[ 1 ];
227	// 	if( _hash ) {
228	// 		var _start = this.get_target( "#" + _hash );
229	// 		this.move( "#" + _hash );
230	// 	}
231	// };
232	// move2hash.prototype.get_target = function( _elmId ) {
233	// 	let _result = 0;
234	// 	if( $( _elmId ).length ) {
235	// 		_result = $( _elmId ).offset().top;
236	// 	} else {
237	// 		_result = 0;
238	// 	}
239	// 	_result = _result - 100 > -1 ? _result -= 100 : 0;
240	// 	return Math.floor( _result );
241	// };
242	// move2hash.prototype.move = function( _elmId ) {
243	// 	// var _current = $( d ).scrollTop();
244	// 	// var _speed = 5000 / 1000; // 秒速 5000px
245	// 	// var _duration = Math.floor( Math.abs( _pos - _current ) / _speed );
246	// 	var _pos = this.get_target( _elmId );
247	// 	var _gap = parseInt( $( 'body' ).css( 'padding-top' ) );
248	// 	$( _elmId ).velocity( 'scroll', {
249	// 		duration: 1000,
250	// 		offset: _gap * -1
251	// 	} );
252	// };
253} )( document, 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.