PageSourceSearch

https://www.ritsumeikan-trust.jp/common/js_t/functions.js/

js ritsumeikan-trust.jp collected 2026-09-30 06:35:54 UTC 16,306 bytes, 592 lines download raw bytes

1(function($){
2	var init = function(){
3		// アンカースクロール
4		setScroll();
5		// ページトップ制御
6		$.pageTop();
7		// 高さ調整
8		if ($('.link-section').length>0) {
9			$('.link-section').setHeight({
10				'item' : 'li a',
11				'sp_set_count': 2,
12				'inner': true
13			});
14		}
15		if ($('.list-sec1').length>0) {
16			$('.list-sec1').setHeight({
17				'item' : 'li a',
18				'sp_set_count': 2,
19				'inner': true
20			});
21		}
22		if ($('.list-sec2').length>0) {
23			$('.list-sec2').setHeight({
24				'item' : 'li a',
25				'sp_set_count': 2,
26				'inner': true
27			});
28		}
29		if ($('.list-sec3').length>0) {
30			$('.list-sec3').setHeight({
31				'item' : 'li a',
32				'sp_set_count': 2,
33				'inner': true
34			});
35		}
36		if ($('.other-list-area').length>0) {
37			$('.other-list-area').setHeight({
38				'item' : 'li a',
39				'sp_set_count': 2,
40				'inner': true
41			});
42		}
43		// ヘッダー設定
44		$.pcMenuCtrl();
45		$.spMenuCtrl();
46		// メニューアコーディオン
47		var acc_btn = $('.acc-btn');
48		if (acc_btn.length>0) {
49			acc_btn.menuAccordion();
50		}
51		// ファイルアイコン設定
52		$.fileIconSet();
53	};
54	$(init);
55})(jQuery);
56;(function($){
57	var defaults = {
58		'is_next'  : true,
59		'btn'      : '.acc-btn',
60		'body'     : '.acc-body',
61		'btn_up'   : 'btn-up',
62		'btn_down' : 'btn-down',
63		'speed'    : {
64			'up'   : 200,
65			'down' : 300
66		}
67	};
68
69	$.fn.menuAccordion = function(options){
70		var opts = $.extend({}, defaults, options);
71		var acc_btn = $(this);
72		var body_cls = opts.body;
73		var btn_cls = opts.btn;
74		var btn_up = opts.btn_up;
75		var btn_down = opts.btn_down;
76		var speed = opts.speed;
77		var is_next = opts.is_next;
78		var plugin_elm = this;
79
80		var init = function(){
81			acc_btn.children('a').on('click.menu_acc', menuToggle);
82		};
83
84		var menuToggle = function(){
85			var elm = $(this);
86			var target_btn = elm.parent(btn_cls);
87			var acc_body;
88			if (is_next) {
89				acc_body = elm.next(body_cls);
90			} else {
91				acc_body = target_btn.prev(body_cls);
92			}
93			if (target_btn.hasClass(btn_up)) {
94				target_btn.removeClass(btn_up).addClass(btn_down);
95				acc_body.stop().slideUp(speed.up,chkSideContents);
96			} else {
97				target_btn.removeClass(btn_down).addClass(btn_up);
98				acc_body.hide().stop().slideDown(speed.down,chkSideContents);
99			}
100			return false;
101		};
102
103		var chkSideContents = function() {
104			var side_content = $(this).parents('.side-contents');
105			if ($.onResizeFunc.size == 'S' || side_content.length == 0) {
106				return false;
107			}
108			$.sideContentsCtrl.set();
109		}
110		plugin_elm.accReset = function() {
111			acc_btn.children('a').off('click.menu_acc');
112		}
113		plugin_elm.accReStart = function() {
114			init();
115		}
116		init();
117		return this;
118	}
119})(jQuery);
120
121// グロナビ制御
122;(function($){
123	var defaults = {
124		'head': '.fixed-area',
125		'nav_main': '.global-nav > ul',
126		'nav_1st': 'li',
127		'nav_2nd': '.nav-details',
128		'cls_show': 'is-show',
129		'cls_hover': 'is-hover'
130	};
131	$('header.global .global-nav .nav01 > a,header.global .global-nav .nav02 > a,header.global .global-nav .nav03 > a').click(function(e){
132		e.preventDefault();
133	});
134	
135	$.pcMenuCtrl = function(options){
136		var name = 'pc_menu';
137		var opts = $.extend({}, defaults, options);
138		var head = $(opts.head);
139		var nav_main = $(opts.nav_main);
140		var win = $(window);
141		var cls_show = opts.cls_show;
142		var cls_hover = opts.cls_hover;
143		var speed = {
144			show: 300,
145			hide: 200
146		};
147		var init = function(){
148			$.onReadyFunc('L',menuCtrl);
149			$.onResizeFunc('S2L',menuCtrl);
150			$.onResizeFunc('L2S',menuReset);
151		};
152		var menuCtrl = function() {
153			nav_main.find(opts.nav_1st).on({
154				'mouseenter.pc_menu': mainNavShow2nd,
155				'mouseleave.pc_menu': mainNavHide2nd,
156			});
157		};
158		var mainNavShow2nd = function(ev) {
159			var elm = $(this);
160			var nav_2nd = elm.find(opts.nav_2nd);
161			var chk_height;
162			nav_2nd.stop().fadeIn(speed.show, function() {
163				nav_2nd.addClass(cls_show).removeAttr('style');
164			});
165		}
166		var mainNavHide2nd = function(ev) {
167			var elm = $(this);
168			var nav_2nd = elm.find(opts.nav_2nd);
169			nav_2nd.stop().fadeOut(speed.hide, function() {
170				nav_2nd.removeClass(cls_show).removeAttr('style');
171			});
172		}
173		var menuReset = function() {
174			nav_main.find(opts.nav_1st).off({
175				'mouseenter.pc_menu': mainNavShow2nd,
176				'mouseleave.pc_menu': mainNavHide2nd,
177				'click.pc_menu'     : function() {}
178			})
179			.find(opts.nav_2nd).removeClass(cls_show).removeAttr('style');
180		}
181		init();
182	}
183})(jQuery);
184// グロナビ制御
185;(function($){
186	var defaults = {
187		'nav_close': '.sp-menu-wrap .close-btn',
188		'sp_nav': '.sp-menu-list',
189		'btn_close': 'is-close',
190		'speed': 300
191	};
192	
193	$.spMenuCtrl = function(options){
194		var opts = $.extend({}, defaults, options);
195		var sp_nav  = $(opts.sp_nav);
196		var btn_close = opts.btn_close;
197		var nav_close = $(opts.nav_close);
198		var acc_cls  = '.parent-menu'
199		var cls_open = 'menu-open';
200		var win = $(window);
201		var parent_menu;
202
203		var init = function(){
204			$.onReadyFunc('S',menuInit);
205			$.onResizeFunc('L2S',menuInit);
206			$.onResizeFunc('S2L',menuReset);
207		};
208		var menuInit = function() {
209			if (typeof(parent_menu) == 'undefined') {
210				parent_menu = $(acc_cls).menuAccordion({
211					'btn' : acc_cls
212				});
213			} else {
214				parent_menu.accReStart();
215			}
216			sp_nav.find('li').each(function(){
217				var chk_btn = $(this);
218				chk_btn.data('crnt','false');
219				chk_btn.find('a').removeClass(btn_close);
220			}).on('click',menuCtrl);
221
222			nav_close.on('click',function(){
223				var nav_btn = $('.' + $(this).data('button'));
224				nav_btn.trigger('click');
225				return false;
226			});
227		}
228		var menuCtrl = function() {
229			var frame = sp_nav.find('ul');
230			var btn = $(this);
231			var get_cls = btn.data('target');
232			var target_menu = $('.'+ get_cls);
233			var is_open = false;
234			
235			frame.removeClass();
236			if (btn.data('crnt') == 'true') {
237				btn.data('crnt','false');
238				btn.find('a').removeClass(btn_close);
239			} else {
240				sp_nav.find('li').data('crnt','false');
241				btn.data('crnt','true');
242				btn.find('a').addClass(btn_close);
243				frame.addClass('is-'+btn.attr('class')+'-crnt');
244			}
245			sp_nav.find('li').each(function(){
246				var chk_btn = $(this);
247				var chk_data = chk_btn.data('crnt');
248				var chk_cls = chk_btn.data('target');
249				var ctrl_menu = $('.'+ chk_cls);
250				var win_height = win.height() - $('header.global .fixed-area').height();
251				var chk_height, set_height;
252				if (chk_data == 'true') {
253					is_open = true;
254					chk_height = parseInt(ctrl_menu.css('visibility','hidden').height());
255					set_height = (chk_height>=win_height) ? win_height : chk_height;
256					ctrl_menu.removeAttr('style').css('height',set_height).stop().fadeIn(opts.speed);
257				} else {
258					chk_btn.find('a').removeClass(btn_close);
259					ctrl_menu.removeAttr('style').stop().fadeOut(opts.speed);
260				}
261			});
262			if (is_open) {
263				page_top = (parseInt(win.scrollTop()) * -1);
264				$('body').addClass(cls_open).css({'top': page_top});
265			} else {
266				page_top = Math.abs(page_top);
267				$('body').removeClass(cls_open).removeAttr('style').scrollTop(page_top);
268			}
269			return false;
270		};
271		var menuReset = function() {
272			parent_menu.accReset();
273			sp_nav.find('li').each(function(){
274				var chk_btn = $(this);
275				var chk_cls = chk_btn.data('target');
276				var ctrl_menu = $('.'+ chk_cls);
277				chk_btn.data('crnt','false');
278				chk_btn.find('a').removeClass(btn_close);
279				ctrl_menu.removeAttr('style');
280			}).off('click');
281			nav_close.off('click');
282			$('body').removeClass(cls_open).removeAttr('style');
283		}
284		init();
285	}
286})(jQuery);
287// アンカースクロール
288var setScroll = function(){
289	var url = $(location).attr('href');
290	var url_arr;
291	var hash;
292	if (url.indexOf("?id=") != -1) {
293		url_arr = url.split("?id=");
294		hash = '#' + url_arr[url_arr.length - 1];
295		$(window).on('load',function(){targetScroll(hash);});
296	}
297	$('a[href^="#"]').on('click',function() {
298		var elm = $(this);
299		var href= elm.attr("href");
300		var hash = (href == "#" || href) == "" ? 'html' : href;
301		if (!elm.hasClass('no-scroll') && !elm.parents().hasClass('ignore') && href != "#" ) {
302			targetScroll(hash);
303			return false;
304		}
305	});
306};
307var targetScroll = function(hash) {
308	var speed = 500;
309	var distance = 0;
310	var target = $(hash);
311	var set_top;
312	if (target.length==0) {
313		return false;
314	}
315	set_top = target.offset().top;
316	if ($.onResizeFunc.size == 'L') {
317		set_top = set_top - distance;
318	}
319	$('body,html').animate({scrollTop:set_top}, speed, "easeOutQuint");
320};
321
322;(function($){
323	var defaults = {
324		'distance': 200,
325		'cls'     : 'is-show',
326		'pagetop': '#pagetop'
327	};
328	$.pageTop = function(options){
329		var opts = $.extend({}, defaults, options);
330		var win, cls, pagetop, distance;
331		var init = function(){
332			win = $(window);
333			pagetop = $(opts.pagetop);
334			distance = opts.distance;
335			cls = opts.cls;
336			win.on('scroll', fixAcrion);
337		};
338		var fixAcrion = function(){
339			var top = win.scrollTop();
340			if (distance <= top && !pagetop.hasClass(cls) ) {
341				pagetop.addClass(cls).fadeIn(300);
342			}
343			if (distance > top && pagetop.hasClass(cls) ) {
344				pagetop.removeClass(cls).fadeOut(300,function(){
345					$(this).removeClass(cls);
346				})
347			}
348		};
349		init();
350	}
351})(jQuery);
352// レスポンシブ監視
353;(function($){
354	/*
355	 * execFunc
356	 *	実行したいファンクション
357	 * change
358	 *		L2S: LサイズからSサイズへスイッチ
359	 *		S2L: SサイズからLサイズへスイッチ
360	 */
361	var break_point = 768;
362	var onResizeFunc = function(chage,execFunc) {
363		var before_width, now_width,win;
364		var win = $(window);
365		before_width = win.width();
366		win.on('resize', function(ev){
367			now_width = win.width();
368			if ((before_width >= (break_point + 1)) && (now_width <= break_point)) {
369				// pc → sp
370				if (chage == 'L2S') {
371					execFunc();
372				}
373			}
374			if ((before_width <= (break_point)) && (now_width >= break_point + 1)) {
375				// sp → pc
376				if (chage == 'S2L') {
377					execFunc();
378				}
379			}
380			before_width = now_width;
381		});
382	};
383
384	onResizeFunc.watch = function() {
385		checkSize();
386		$(window).on('resize', function() {
387			checkSize();
388		});
389	};
390	checkSize = function() {
391		var win = $(window);
392		if (break_point>=win.width()) {
393			onResizeFunc.size = 'S';
394		} else {
395			onResizeFunc.size = 'L';
396		}
397	}
398	$.onResizeFunc = onResizeFunc;
399	$.onResizeFunc.watch();
400
401	/*
402	 * execFunc
403	 *	実行したいファンクション
404	 * size
405	 *		S: ロード時のサイズがスマホ
406	 *		L: ロード時のサイズがPC
407	 */
408	var onReadyFunc = function(size,execFunc) {
409		var win = $(window);
410		now_width = win.width();
411		if ((now_width <= break_point)) {
412			// pc → sp
413			if (size == 'S') {
414				execFunc();
415			}
416		}
417		if ((now_width >= break_point + 1)) {
418			// pc
419			if (size == 'L') {
420				execFunc();
421			}
422		}
423		before_width = now_width;
424	}
425	$.onReadyFunc = onReadyFunc;
426})(jQuery);
427;(function($){
428	var defaults = {
429		'item': '',
430		'group': '',
431		'pc_set_count': 0,
432		'sp_set_count': 0,
433		'pc': true,
434		'sp': true,
435		'inner': true,
436	};
437
438	$.fn.setHeight = function(options){
439		var opts = $.extend({}, defaults, options);
440		var area = $(this);
441		var group = opts.group;
442		var win = $(window);
443		var set_count = 0;
444
445		var init = function(){
446			$(window).on('resize.setHeight load', initHeight);
447		};
448
449		var initHeight = function() {
450			var now_size = $.onResizeFunc.size;
451			var item = area.find(opts.item);
452			item.css('height','auto');
453			if (!opts.sp && now_size == 'S') {
454				return false;
455			}
456			if (!opts.pc && now_size == 'L') {
457				return false;
458			}
459			if (opts.sp_set_count != 0 && now_size == 'S') {
460				set_count = opts.sp_set_count;
461			}
462			if (opts.pc_set_count != 0 && now_size == 'L') {
463				set_count = opts.pc_set_count;
464			}
465			if (group != '') {
466				area.find(group).each(function(){
467					itemSetHeight($(this).find(opts.item));
468				});
469			} else if(set_count != 0) {
470				var item_arr = [];
471				item.each(function(i){
472					if((i+1) % set_count != 0) {
473						item_arr.push($(this));
474					} else {
475						item_arr.push($(this));
476						colSetHeight(item_arr);
477						item_arr = [];
478					}
479				});
480				if (item_arr.length>0) {
481					colSetHeight(item_arr);
482					item_arr = [];
483				}
484			} else {
485				itemSetHeight(item);
486			}
487		};
488		var itemSetHeight = function(item) {
489			var height_arr = [];
490			var set_height;
491			item.each(function(){
492				var elm = $(this);
493				if (opts.inner) {
494					height_arr.push(elm.innerHeight());
495				} else {
496					height_arr.push(elm.outerHeight() - parseInt(elm.css('padding-top')) - parseInt(elm.css('padding-bottom')));
497				}
498			});
499			set_height = Math.max.apply(null, height_arr);
500			item.css('height', set_height + 1);
501		};
502		var colSetHeight = function(item_arr) {
503			var height_arr = [];
504			var set_height;
505			for(var i=0; i<= item_arr.length-1; i++) {
506				var elm = item_arr[i];
507				if (opts.inner) {
508					height_arr.push(elm.innerHeight());
509				} else {
510					height_arr.push(elm.outerHeight() - parseInt(elm.css('padding-top')) - parseInt(elm.css('padding-bottom')));
511				}
512			}
513			set_height = Math.max.apply(null, height_arr);
514			for(var i=0; i<= item_arr.length-1; i++) {
515				var elm = item_arr[i];
516				elm.css('height', set_height + 1);
517			}
518		};
519
520		init();
521	}
522
523})(jQuery);
524;(function($){
525	var defaults = {
526		'add_chk' : ':not(.no_icon):not(:has(img))',
527		'blank_icon' : '<img src="/common/images_t/common/icon_blank_x2.png" alt="外部ファイル">',
528		'blank_icon_white' : '<img src="/common/images_t/common/icon_blank_white_x2.png" alt="外部ファイル">',
529		'pdf_icon' : '<img src="/common/images_t/common/icon_pdf_x2.png" alt="PDF">',
530		'excel_icon' : '<img src="/common/images_t/common/icon_excel_x2.png" alt="EXCEL">',
531		'word_icon' : '<img src="/common/images_t/common/icon_word_x2.png" alt="WORD">'
532	};
533
534	$.fileIconSet = function(options){
535		var opts = $.extend({}, defaults, options);
536		var add_chk = opts.add_chk;
537		var blank_icon = opts.blank_icon;
538		var blank_icon_white = opts.blank_icon_white;
539		var pdf_icon = opts.pdf_icon;
540		var excel_icon = opts.excel_icon;
541		var word_icon = opts.word_icon;
542		var init = function(){
543			$('.main-contents').each(function(){
544				var $src = $(this);
545				icon($src);
546				iconAddClass($src);
547			})
548			if($('.main-top-area').length) {
549				$('.link-list-area li').each(function(){
550					var $src = $(this);
551					iconAddClass($src);
552				});
553				$('.other-list-area li').each(function(){
554					var $src = $(this);
555					iconAddClass($src);
556				});
557			}
558			
559		};
560		function icon(src) {
561			var $src =src;
562			$src.find(add_chk+':not(.pdf, .excel, .word, .blank, .teacher-set .picture a)a[target$=blank]').append(blank_icon).addClass("blank");
563			$src.find('.teacher-set .picture a[target$=blank]').append(blank_icon_white).addClass("blank");
564			$src.find(add_chk+'a[href$=pdf]').append(pdf_icon).addClass("pdf").attr({target:"_blank"});
565			$src.find(add_chk+'a[href$=xls], a[href$=xlsx]').append(excel_icon).addClass("excel").attr({target:"_blank"});
566			$src.find(add_chk+'a[href$=doc], a[href$=docx]').append(word_icon).addClass("word").attr({target:"_blank"});
567		}
568		function iconAddClass(src) {
569			var $src =src;
570			$src.find('a[target$=blank]:not(.pdf, .excel, .word, .blank, .teacher-set .picture a)a[target$=blank]').addClass("blank");
571			$src.find('a[href$=pdf]').addClass("pdf").attr({target:"_blank"});
572			$src.find('a[href$=xls], a[href$=xlsx]').addClass("excel").attr({target:"_blank"});
573			$src.find('a[href$=doc], a[href$=docx]').addClass("word").attr({target:"_blank"});
574		}
575		init();
576	}
577})(jQuery);
578
579;(function(){
580	var editViewPort = function() {
581		var breakPoint = 640;
582		var win = $(window);
583		var ie8 = ($.support.opacity == true) ? false : true;
584		var isTouchDevice = (typeof window.ontouchstart) !== 'undefined';
585		var vp = $('#vp');
586		if (breakPoint < win.width() && isTouchDevice) {
587			vp.attr('content', 'width=1080');
588		}
589	}
590	$.editViewPort = editViewPort;
591})();
592$.editViewPort();

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.