PageSourceSearch

https://www1.niu.ac.jp/tea-room/wp-content/themes/tea-room/js/share.js

js niu.ac.jp collected 2026-10-02 14:42:09 UTC 9,185 bytes, 297 lines download raw bytes

1
2/* pageTop */
3$(document).ready(function(){
4    $("#gotoTop").hide();
5    $(function () {
6        $(window).scroll(function () {
7            if ($(this).scrollTop() > 20) {
8                $('#gotoTop').fadeIn();
9            } else {
10                $('#gotoTop').fadeOut();
11            }
12        });
13    });
14});
15
16
17/* facebox  */
18jQuery(document).ready(
19	function($) {
20		$('a[href$=".jpg"], a[href$=".gif"], a[href$=".png"], a[rel*=facebox]').facebox();
21		}
22);
23/*
24 * yuga.js 0.7.1 - 優雅なWeb制作のためのJS
25 *
26 * Copyright (c) 2009 Kyosuke Nakamura (kyosuke.jp)
27 * Licensed under the MIT License:
28 * http://www.opensource.org/licenses/mit-license.php
29 *
30 * Since:     2006-10-30
31 * Modified:  2009-01-27
32 *
33 * Custmized: 2011-02-15
34 * jQuery 1.4.2
35 */
36
37(function($) {
38
39	$(function() {
40		$.yuga.selflink();
41		$.yuga.rollover();
42		$.yuga.externalLink();
43		$.yuga.scroll();
44		//$.yuga.tab();
45		$.yuga.css3class();
46	});
47
48	//---------------------------------------------------------------------
49
50	$.yuga = {
51		// URIを解析したオブジェクトを返すfunction
52		Uri: function(path){
53			var self = this;
54			this.originalPath = path;
55			//絶対パスを取得
56			this.absolutePath = (function(){
57				var e = document.createElement('span');
58				e.innerHTML = '<a href="' + path + '" />';
59				return e.firstChild.href;
60			})();
61			//絶対パスを分解
62			var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11};
63			var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath);
64			for (var field in fields) {
65				this[field] = r[fields[field]];
66			}
67			this.querys = {};
68			if(this.query){
69				$.each(self.query.split('&'), function(){
70					var a = this.split('=');
71					if (a.length == 2) self.querys[a[0]] = a[1];
72				});
73			}
74		},
75		//現在のページと親ディレクトリへのリンク
76		selflink: function (options) {
77			var c = $.extend({
78				selfLinkAreaSelector:'body',
79				selfLinkClass:'current',
80				parentsLinkClass:'parentsLink',
81				postfix: '',
82				changeImgSelf:false,
83				changeImgParents:false
84			}, options);
85			$(c.selfLinkAreaSelector+((c.selfLinkAreaSelector)?' ':'')+'a[href]').each(function(){
86				var href = new $.yuga.Uri(this.getAttribute('href'));
87				var setImgFlg = false;
88				if ((href.absolutePath == location.href) && !href.fragment) {
89					//同じ文書にリンク
90					$(this).addClass(c.selfLinkClass);
91					setImgFlg = c.changeImgSelf;
92				} else if (0 <= location.href.search(href.absolutePath)) {
93					//親ディレクトリリンク
94					$(this).addClass(c.parentsLinkClass);
95					setImgFlg = c.changeImgParents;
96				}
97				if (setImgFlg){
98					//img要素が含まれていたら現在用画像(_cr)に設定
99					$(this).find('img').each(function(){
100						this.originalSrc = $(this).attr('src');
101						this.currentSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2");
102						$(this).attr('src',this.currentSrc);
103					});
104				}
105			});
106		},
107		//ロールオーバー
108		rollover: function(options) {
109			var c = $.extend({
110				hoverSelector: '.btn, .allbtn img',
111				groupSelector: '.btngroup',
112				postfix: '_r'
113			}, options);
114			//ロールオーバーするノードの初期化
115			var rolloverImgs = $(c.hoverSelector).filter(isNotCurrent);
116			rolloverImgs.each(function(){
117				this.originalSrc = $(this).attr('src');
118				this.rolloverSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2");
119				this.rolloverImg = new Image;
120				this.rolloverImg.src = this.rolloverSrc;
121			});
122			//グループ内のimg要素を指定するセレクタ生成
123			var groupingImgs = $(c.groupSelector).find('img').filter(isRolloverImg);
124
125			//通常ロールオーバー
126			rolloverImgs.not(groupingImgs).hover(function(){
127				$(this).attr('src',this.rolloverSrc);
128			},function(){
129				$(this).attr('src',this.originalSrc);
130			});
131			//グループ化されたロールオーバー
132			$(c.groupSelector).hover(function(){
133				$(this).find('img').filter(isRolloverImg).each(function(){
134					$(this).attr('src',this.rolloverSrc);
135				});
136			},function(){
137				$(this).find('img').filter(isRolloverImg).each(function(){
138					$(this).attr('src',this.originalSrc);
139				});
140			});
141			//フィルタ用function
142			function isNotCurrent(i){
143				return Boolean(!this.currentSrc);
144			}
145			function isRolloverImg(i){
146				return Boolean(this.rolloverSrc);
147			}
148
149		},
150		//外部リンクは別ウインドウを設定
151		externalLink: function(options) {
152			var c = $.extend({
153				windowOpen:false,
154				externalClass: 'externalLink',
155				addIconSrc: ''
156			}, options);
157			var uri = new $.yuga.Uri(location.href);
158			var e = $('a[href^="http://"]').not('a[href^="' + uri.schema + '://' + uri.host + '/' + '"]');
159			if (c.windowOpen) {
160				e.click(function(){
161					window.open(this.href, '_blank');
162					return false;
163				});
164			}
165			if (c.addIconSrc) e.not(':has(img)').after($('<img src="'+c.addIconSrc+'" class="externalIcon" />'));
166			e.addClass(c.externalClass);
167		},
168		//ページ内リンクはするするスクロール
169		scroll: function(options) {
170			//ドキュメントのスクロールを制御するオブジェクト
171			var scroller = (function() {
172				var c = $.extend({
173					easing:100,
174					step:30,
175					fps:60,
176					fragment:''
177				}, options);
178				c.ms = Math.floor(1000/c.fps);
179				var timerId;
180				var param = {
181					stepCount:0,
182					startY:0,
183					endY:0,
184					lastY:0
185				};
186				//スクロール中に実行されるfunction
187				function move() {
188					if (param.stepCount == c.step) {
189						//スクロール終了時
190						setFragment(param.hrefdata.absolutePath);
191						window.scrollTo(getCurrentX(), param.endY);
192					} else if (param.lastY == getCurrentY()) {
193						//通常スクロール時
194						param.stepCount++;
195						window.scrollTo(getCurrentX(), getEasingY());
196						param.lastY = getEasingY();
197						timerId = setTimeout(move, c.ms); 
198					} else {
199						//キャンセル発生
200						if (getCurrentY()+getViewportHeight() == getDocumentHeight()) {
201							//画面下のためスクロール終了
202							setFragment(param.hrefdata.absolutePath);
203						}
204					}
205				}
206				function setFragment(path){
207					location.href = path
208				}
209				function getCurrentY() {
210					return document.body.scrollTop  || document.documentElement.scrollTop;
211				}
212				function getCurrentX() {
213					return document.body.scrollLeft  || document.documentElement.scrollLeft;
214				}
215				function getDocumentHeight(){
216					return document.documentElement.scrollHeight || document.body.scrollHeight;
217				}
218				function getViewportHeight(){
219					return (!$.browser.safari && !$.browser.opera) ? document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight : window.innerHeight;
220				}
221				function getEasingY() {
222					return Math.floor(getEasing(param.startY, param.endY, param.stepCount, c.step, c.easing));
223				}
224				function getEasing(start, end, stepCount, step, easing) {
225					var s = stepCount / step;
226					return (end - start) * (s + easing / (100 * Math.PI) * Math.sin(Math.PI * s)) + start;
227				}
228				return {
229					set: function(options) {
230						this.stop();
231						if (options.startY == undefined) options.startY = getCurrentY();
232						param = $.extend(param, options);
233						param.lastY = param.startY;
234						timerId = setTimeout(move, c.ms); 
235					},
236					stop: function(){
237						clearTimeout(timerId);
238						param.stepCount = 0;
239					}
240				};
241			})();
242			$('a[href^=#], area[href^=#]').not('a[href=#], area[href=#]').each(function(){
243				this.hrefdata = new $.yuga.Uri(this.getAttribute('href'));
244			}).click(function(){
245				var target = $('#'+this.hrefdata.fragment);
246				if (target.length == 0) target = $('a[name='+this.hrefdata.fragment+']');
247				if (target.length) {
248					scroller.set({
249						endY: target.offset().top,
250						hrefdata: this.hrefdata
251					});
252					return false;
253				}
254			});
255		},
256		//タブ機能
257		/*
258		tab: function(options) {
259			var c = $.extend({
260				tabNavSelector:'.tabNav',
261				activeTabClass:'active'
262			}, options);
263			$(c.tabNavSelector).each(function(){
264				var tabNavList = $(this).find('a[href^=#], area[href^=#]');
265				var tabBodyList;
266				tabNavList.each(function(){
267					this.hrefdata = new $.yuga.Uri(this.getAttribute('href'));
268					var selecter = '#'+this.hrefdata.fragment;
269					if (tabBodyList) {
270						tabBodyList = tabBodyList.add(selecter);
271					} else {
272						tabBodyList = $(selecter);
273					}
274					$(this).unbind('click');
275					$(this).click(function(){
276						tabNavList.removeClass(c.activeTabClass);
277						$(this).addClass(c.activeTabClass);
278						tabBodyList.hide();
279						$(selecter).show();
280						return false;
281					});
282				});
283				tabBodyList.hide()
284				tabNavList.filter(':first').trigger('click');
285			});
286		},
287		*/
288		//css3のクラスを追加
289		css3class: function() {
290			//:first-child, :last-childをクラスとして追加
291			$('body :first-child').addClass('firstChild');
292			$('body :last-child').addClass('lastChild');
293			//css3の:emptyをクラスとして追加
294			$('body :empty').addClass('empty');
295		}
296	};
297})(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.