PageSourceSearch

http://medi-eight.jp/app/webroot/themed/logical/js/common.js

js medi-eight.jp collected 2026-10-06 08:45:15 UTC 4,938 bytes, 204 lines download raw bytes

1/* =======================================
2
3	Common JS
4
5========================================== */
6
7(function($){ // start jquery
8
9/* scrollFix
10========================================== */
11
12$.fn.wsScrollFix = function(options){
13	if(window.innerHeight) {
14		var Ch = window.innerHeight;
15	} else {
16		var Ch = document.documentElement.clientHeight;
17	}
18	var defaults = {
19		Ih : Ch
20	};
21	var settings = $.extend({}, defaults, options);
22
23	return this.each(function(i){
24		var St = $($.browser.safari ? 'body' : 'html').scrollTop();
25		var Sb = St + settings.Ih;
26		var Oh = $(this).height();
27		var Top = Sb - Oh - 64;
28
29		$(this).css({
30			position: 'absolute',
31			top: Top,
32			right: '0',
33			zIndex: 99,
34		});
35	});
36};
37
38var wsUA = function() {
39	var ua = navigator.userAgent.toLowerCase();
40	$.browser.iphone = /iphone/.test(ua);
41	$.browser.ipod = /ipod/.test(ua);
42	$.browser.ipad = /ipad/.test(ua);
43	$.browser.android = /android/.test(ua);
44	$.browser.iemobile = /iemobile/.test(ua);
45	if($.browser.iphone || $.browser.ipod || $.browser.ipad || $.browser.android || $.browser.iemobile) {
46		return 'sp';
47	} else {
48		return 'full';
49	}
50};
51
52
53$(window).ready(function() {
54
55	/* UA
56	========================================== */
57	wsBrowser = wsUA();
58	if(wsBrowser == 'sp'){
59		$('#main #commentFb, #footer .backToTop, #main .socialS, #main #contentsWrapper .socialW').remove();
60	} else {
61		$('#footer').append('<p class="backToTop"><a href="#document" class="up">ページ先頭</a><a href="#footer" class="down">ページ末尾</a></p>');
62		$('#footer .backToTop').wsScrollFix();
63	}
64
65});
66
67$(window).scroll(function() {
68	if(wsBrowser != 'sp'){
69		$('#footer .backToTop').wsScrollFix();
70	}
71});
72
73$(window).resize(function() {
74	if(wsBrowser != 'sp'){
75		$('#footer .backToTop').wsScrollFix();
76	}
77});
78
79
80$(function(){
81
82	/* UA
83	========================================== */
84	if(wsBrowser == 'sp'){
85		$('body').addClass('sp');
86	} else {
87		$('body').addClass('full');
88	}
89
90	/* win/mac
91	========================================== */
92	var UA = navigator.userAgent;
93	if(UA.match(/[Ww]in/)) {
94		$('body').addClass('win');
95	} else if(UA.match(/[Mm]ac/)) {
96		$('body').addClass('mac');
97	}
98
99	/* globalNav
100	========================================== */
101	if(wsBrowser == 'sp'){
102		$('#globalNav > ul > li > ul').remove();
103	} else {
104		var LEN = $('#globalNav > ul > li').length;
105		$('#globalNav > ul').addClass('gnav' + LEN);
106		$('#globalNav > ul > li > ul').css({display: 'none'});
107		$('#globalNav > ul > li')
108			.live('mouseover', function(){
109				$(this).find('ul').eq(0)
110					.stop()
111					.slideDown('fast', 'easeInOutQuart');
112			})
113			.live('mouseout', function(){
114				$(this).find('ul').eq(0)
115					.stop()
116					.slideUp('fast', 'easeInOutQuart');
117			});
118	}
119
120	/* Smooth Scroll
121	========================================== */
122	$('a[href^=#]:not(a[href$=#])').click(function(){
123		var href= this.hash;
124		var $target = $(href == '#_top' ? 'body' : href);
125
126		// アンカーリンクがあるページでだけ以下を実行
127		if($target.size()){
128			var top = $target.offset().top;
129			$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
130		}
131		return false;
132	});
133
134	/* Form Focus
135	========================================== */
136
137	$('input[type="text"].inputTxt, textarea.inputTxt, select.inputSelect').each(function() {
138		$(this).bind('focus', function(){
139			$(this).addClass('inputFocus');
140		});
141		$(this).bind('blur', function(){
142			$(this).removeClass('inputFocus');
143		});
144	});
145
146	$('.submitBtn').each(function() {
147		$(this).bind('mouseover', function(){
148			$(this).addClass('submitBtnHover');
149		});
150		$(this).bind('mouseout', function(){
151			$(this).removeClass('submitBtnHover');
152		});
153	});
154
155	/* Icon
156	========================================== */
157
158	$('#main .freetxt a').each(function() {
159		var HREF = $(this).attr('href');
160		if(HREF.match(/.+\.pdf$/)) {
161			$(this).addClass('pdf');
162		}
163		if(HREF.match(/.+\.doc[x]*$/)) {
164			$(this).addClass('doc');
165		}
166		if(HREF.match(/.+\.xls[x]*$/)) {
167			$(this).addClass('xls');
168		}
169	});
170
171
172	/* zebra
173	========================================== */
174
175	$('#main .headline').each(function() {
176		$('.post:nth-child(even)', this).addClass('even');
177	});
178
179
180
181	/* biggerLink
182	========================================== */
183	if(wsBrowser != 'sp'){
184		$('#Home #pickup .post, #Home #topHeadline .post').hover(
185		function() {
186			$(this).addClass('postHover');
187		},function() {
188			$(this).removeClass('postHover');
189		});
190	}
191	$('#Home #pickup .post, #Home #topHeadline .post').css({
192		cursor: 'pointer'
193	});
194	$('#Home #pickup .post, #Home #topHeadline .post').click(function() {
195		HREF = $(this).find('a').eq(0).attr('href');
196		window.location.href = HREF;
197		return false;
198	});
199
200
201}); // end $(function
202
203
204})(jQuery); // end 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.