PageSourceSearch

https://www.softbankselection.jp/assets/js/common.js

js softbankselection.jp collected 2026-09-24 17:42:17 UTC 16,302 bytes, 348 lines download raw bytes

1/* -----------------------------------------------
2Table of Contents (common js)
3--------------------------------------------------
41. userAgent”»•Ê
52. URL”»•Ê
63. Ý’è
74. JSƒtƒ@ƒCƒ‹“ǂݍž‚ÝŽž‘¦ŽÀs(Execute JavaScript when the page loaded.)
85. DOM\’zŒãŽÀs(Execute JavaScript when the DOM is fully loaded.)
96. ‰æ‘œ‚ȂNJ܂߂ăy[ƒW“Ǎž‚ÝŠ®—¹Œã‚ÉŽÀs(Execute JavaScript when the Window Object is fully loaded.)
107. “®“IƒRƒ“ƒeƒ“ƒc‚ɑ΂µ‚ăCƒxƒ“ƒg‚ðÝ’è
118. ‚»‚Ì‘¼‚̃Cƒxƒ“ƒg‚ðÝ’è
129. ŠÖ”(ƒvƒ‰ƒOƒCƒ“)•¡”
13
14require jQuery JavaScript Library v1.9.1
15-------------------------------------------------- */
16//'use strict';
17
18/* ------------------------------------------------------------
19   1. userAgent”»•Ê
20   http://www.useragentstring.com/pages/useragentstring.php
21 * ------------------------------------------------------------ */
22var ua                   = window.navigator.userAgent;
23var appVer               = window.navigator.appVersion;
24
25//PC
26var isIE                 = ua.indexOf('MSIE') != -1 || ua.indexOf('Trident') != -1;
27var isIE6                = isIE && appVer.indexOf('MSIE 6') != -1;
28var isIE7                = isIE && appVer.indexOf('MSIE 7.') != -1;
29var isIE8                = isIE && ua.indexOf('Trident/4.') != -1  || appVer.indexOf('MSIE 8.') != -1;
30var isIE9                = isIE && ua.indexOf('Trident/5.') != -1;
31var isIE10               = isIE && ua.indexOf('Trident/6.') != -1;
32var isIE11               = ua.indexOf('Trident/7.') != -1;
33var isMicrosoftEdge      = ua.indexOf('Windows NT') != -1;
34var isOldIE              = isIE8 || isIE7 || isIE6;
35
36var isFirefox            = ua.indexOf('Firefox') != -1;
37var isChrome             = ua.indexOf('Chrome') != -1;
38var isSafari             = ua.indexOf('Safari') != -1;
39
40//Mobile (smartphone + tablet)
41var isMobileSafari       = ua.match(/iPhone|iPad|iPod/i) ? true : false;
42var isMobileSafariTypeT  = ua.match(/ipad/i) ? true : false;
43var isMobileSafariTypeS  = ua.match(/iphone|ipod/i) ? true : false;
44var isAndroid            = ua.indexOf('Android') != -1;
45var isMobileAndroidTypeT = isAndroid && ua.indexOf('Mobile') == -1;
46var isMobileAndroidTypeS = isAndroid && ua.indexOf('Mobile') != -1;
47var isAndroidChrome      = isChrome && isAndroid;
48var isAndroidFirefox     = isFirefox && isAndroid;
49var isMobileFirefox      = isFirefox && ua.indexOf('Mobile') != -1;
50var isTabletFirefox      = isFirefox && ua.indexOf('Tablet') != -1;
51
52//PC or Mobile
53var isTablet             = isMobileSafariTypeT || isMobileAndroidTypeT || isTabletFirefox;
54var isSmartPhone         = isMobileSafariTypeS || isMobileAndroidTypeS || isMobileFirefox;
55var isMobile             = isTablet && isSmartPhone && isAndroidChrome;
56var isPC                 = !isMobile;
57
58//APP
59var isFacebookAPP        = ua.indexOf('FBAN') != -1;
60
61
62/* ------------------------------------------------------------
63   2. URL”»•Ê
64 * ------------------------------------------------------------ */
65var locationHref     = window.location.href;     // http://www.google.com:80/search?q=demo#test
66var locationProtocol = window.location.protocol; // http:
67var locationHostname = window.location.hostname; // www.google.com
68var locationHost     = window.location.host;     // www.google.com:80
69var locationPort     = window.location.port;     // 80
70var locationPath     = window.location.pathname; // /search
71var locationSearch   = window.location.search;   // ?q=demo
72var locationHash     = window.location.hash;     // #test
73var locationReplace  = window.location.replace;
74var lHash      = location.hash;     // #demo3,b=demo4
75
76var filename = location.href.substring(location.href.lastIndexOf("/")+1, location.href.length);
77
78/* ------------------------------------------------------------
79   3. Ý’è
80 * ------------------------------------------------------------ */
81
82/* ------------------------------------------------------------
83   4. JSƒtƒ@ƒCƒ‹“ǂݍž‚ÝŽž‘¦ŽÀs(Execute JavaScript when the page loaded.)
84 * ------------------------------------------------------------ */
85
86/* ------------------------------------------------------------
87   5. DOM\’zŒãŽÀs(Execute JavaScript when the DOM is fully loaded.)
88 * ------------------------------------------------------------ */
89$(document).on('ready', function() {
90
91/* 5-1. Global•ϐ”
92-------------------------------------------------- */
93var $window         = $(window);
94var isWindowWidth   = $window.width();
95var documentHeight  = $(document).height();
96
97/* ------------------------------------------------------------
98 * [ “d˜b”ԍ† ]
99 * ------------------------------------------------------------ */
100if (!(isMobile)){
101	$('a[href^=tel]').each(function(){
102		var $this = $(this);
103		$this.replaceWith('<span class="txt-telNumber">' + $this.text() + '</span>');
104	});
105}
106
107ieTag();
108
109var boxSearch = $('.header').find('.header__searchbox');
110$('.js-menu-search').on('click', function(){
111	if(boxSearch.hasClass('is-active')){
112		boxSearch.removeClass('is-active').slideUp(300);
113	} else {
114		boxSearch.addClass('is-active').slideDown(300);
115	}
116})
117if (isPC) {$('.nav_global li').hover(function(){
118		if($window.width() > 1050){
119			$(this).addClass('active');
120			$(this).children('ul').stop().slideDown(125)
121		}
122	},
123	function(){
124		if($window.width() > 1050){
125			$(this).removeClass('active');
126			$(this).children('ul').stop().slideUp(125);
127		}
128	});
129}else{
130	$('.nav_global__sub').removeAttr('style');
131}
132var headerDropdown = $('.header').find('.header__dropdown');
133$('.js-menu-global').on('click', function(e){
134	var topOffset = $(window).scrollTop();
135	if(!$('#l_header').hasClass('is-open')){
136		$(this).addClass('is-active');
137		headerDropdown.addClass('is-active');
138		$('#l_header').addClass('is-open');
139		$('body').css({
140			top: -topOffset,
141			position: 'fixed'
142		});
143	} else {
144		$(this).removeClass('is-active');
145		$('#l_header').removeClass('is-open');
146		headerDropdown.removeClass('is-active');
147		var topOffset = parseInt($('body').css('top')) * -1;
148		$('body').attr('style', '');
149		$(window).scrollTop(topOffset);
150	}
151});
152/* ------------------------------------------------------------
153 * [ smoothScroll ]
154 * ------------------------------------------------------------ */
155// ƒCƒxƒ“ƒg‚ð’ljÁ‚·‚éŠÖ”
156function addEvent(eventTarget, eventName, func){
157	if(eventTarget.addEventListener){
158		eventTarget.addEventListener(eventName, func, false);
159	}else if(window.attachEvent){
160		eventTarget.attachEvent('on'+eventName, function(){func.apply(eventTarget);});
161	}
162}
163var smoothScroll = function() {
164	$('a[href*=\\#]').not('.noScroll').off('click');
165	var time  = 500,
166		easing  = 'easeInOutQuad',
167		pageTopID1 = '#document',
168		pageTopID2 = '#l_header';
169	$('a[href*=\\#]').not('.noScroll').on('click', function() {
170		var hash  = this.hash,
171		target  = $(hash),
172		position  = target.offset().top;
173
174		var $menu = $('.js-menu-global');
175		if($menu.hasClass('is-active')){
176			$menu.removeClass('is-active');
177			$('#l_header').removeClass('is-open');
178			var headerDropdown = $('.header').find('.header__dropdown');
179			if(headerDropdown.hasClass('is-active')){
180				headerDropdown.removeClass('is-active');
181				var topOffset = parseInt($('body').css('top')) * -1;
182				$('body').attr('style', '');
183				$(window).scrollTop(topOffset);
184				position  = target.offset().top;
185				setTimeout(function(){
186					$('html, body').animate({scrollTop:position}, time, easing, function() {
187						if( (hash != pageTopID1) && (hash != pageTopID2) ) location.hash = hash;
188					});
189				},100);
190			}
191		} else{
192			$('html, body').animate({scrollTop:position}, time, easing, function() {
193				if( (hash != pageTopID1) && (hash != pageTopID2) ) location.hash = hash;
194			});
195		}
196		return false;
197	});
198	var scrollOnLoad = function(){
199		if (lHash != '') {
200			setTimeout(function() {
201				if($(lHash).length){
202					var target  = $(lHash),
203						position  = target.offset().top - $('#l_header').outerHeight();
204					$('html, body').animate({scrollTop: position}, time, easing);
205				}
206			}, 500);
207		}
208	}
209	addEvent(window, 'load', scrollOnLoad);
210	$(window).mousewheel(function() { $('html, body').stop(); });
211	$(document).on('touchmove', function() { $('html, body').stop(); });
212}
213smoothScroll();
214
215});//End -> ready method
216
217
218
219
220/* ------------------------------------------------------------
221   6. ‰æ‘œ‚ȂNJ܂߂ăy[ƒW“Ǎž‚ÝŠ®—¹Œã‚ÉŽÀs(Execute JavaScript when the Window Object is fully loaded.)
222 * ------------------------------------------------------------ */
223
224
225/* ------------------------------------------------------------
226@@7. “®“IƒRƒ“ƒeƒ“ƒc‚ɑ΂µ‚ăCƒxƒ“ƒg‚ðÝ’è
227@@(Attach an event handler function for one or more events to the selected elements.)
228 * ------------------------------------------------------------ */
229
230
231
232
233/* ------------------------------------------------------------
234@@8. ‚»‚Ì‘¼‚̃Cƒxƒ“ƒg‚ðÝ’è
235 * ------------------------------------------------------------ */
236
237
238
239
240/* ------------------------------------------------------------
241   9. ŠÖ”(ƒvƒ‰ƒOƒCƒ“)•¡”
242 * ------------------------------------------------------------ */
243
244
245function ieTag() {
246	if (isIE == true) {
247		$('body').addClass('ie');
248	}
249}
250
251/* ------------------------------------------------------------
252* [ menu ]
253* ------------------------------------------------------------ */
254/*
255 * jquery-menu.js
256 * Licensed under MIT Lisence:
257 * http://www.opensource.org/licenses/mit-license.php
258 * http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license
259 *
260 * Since:   2016-08-17
261 * version: 0.01
262 * Comment:
263 *
264 * jQuery 1.2 <-> 2.x
265 *
266 */
267$.fn.menuInit = function(opt) {
268	var opt       = opt || {},
269	menuParentClass   = opt.menuParentClass === undefined ? '.js-menu-parent' : opt.menuParentClass, //Wrapper class of each accordion
270	menuContentClass  = opt.menuContentClass  === undefined ? '.js-menu-content' : opt.menuContentClass, //Content class of subcontent
271	triggerClass    = opt.triggerClass  === undefined ? '.js-menu-trigger' : opt.triggerClass, //Trigger class
272	collapse      = opt.collapse  === undefined ? true : opt.collapse, //Collapse or not
273	animateSpeed    = opt.animateSpeed  === undefined ? 300 : opt.animateSpeed, //Animate speed,  default: 300ms
274	sync        = opt.sync  === undefined ? true : opt.sync, //Toggle at same time or not
275	toggleIcon      = opt.toggleIcon  === undefined ? '.js-toggle-icn' : opt.toggleIcon, //Change icon
276	openIcon      = opt.openIcon  === undefined ? 'fa-times' : opt.openIcon, //Change icon with specified class
277	closeIcon       = opt.closeIcon === undefined ? 'fa-bars' : opt.closeIcon, // Name of close class
278	openFirstMenu     = opt.openFirstMenu === undefined ? false : opt.openFirstMenu; // open on first menu item
279	function slideMenu($menuElement, forceOpen){
280		var href      = $menuElement.attr("href") == undefined ? $menuElement.next(menuContentClass) : $menuElement.attr("href");
281		var $href     = $(href);
282		var $menuParent   = $href.closest(menuParentClass);
283		var $trigger    = $menuElement.closest(triggerClass).siblings(triggerClass);
284		if($trigger.length == 0) $trigger= $menuParent.find(triggerClass);
285
286		if (!$href.hasClass('is_opened') || forceOpen === true){
287			if(collapse) {
288				if(sync == false){
289					$menuParent.find(menuContentClass).not(href).slideUp(animateSpeed, function(){
290						$href.slideDown(animateSpeed);
291					}).removeClass('is_opened');
292				} else{
293					$menuParent.find(menuContentClass).not(href).slideUp(animateSpeed).removeClass('is_opened');
294					$href.slideDown(animateSpeed);
295				}
296				$trigger.removeClass('is_active');
297				$menuParent.find(toggleIcon).addClass(closeIcon).removeClass(openIcon);
298			} else{
299				$href.slideDown(animateSpeed);
300			}
301			$href.addClass('is_opened');
302			$menuElement.find(toggleIcon).addClass(openIcon).removeClass(closeIcon);
303			$menuElement.closest(triggerClass).addClass('is_active');
304		} else {
305			$href.slideUp(animateSpeed);
306			$href.removeClass('is_opened');
307			$menuElement.closest(triggerClass).removeClass('is_active');
308			$menuElement.find(toggleIcon).addClass(closeIcon).removeClass(openIcon);
309		}
310	}
311	//open the first menu item
312	var $menuParent = $(menuParentClass);
313	var $menuContentClass = $(menuContentClass);
314	$menuContentClass.hide();
315	if(openFirstMenu){
316		$menuParent.each(function(){
317			slideMenu($(this).find(triggerClass).first(), true);
318		})
319	}
320	return this.each(function() {
321		var $menuElement = $(this);
322		//Open when loaded if set class .is-active to trigger button
323		if($menuElement.hasClass('is-active')){
324			slideMenu($menuElement, true);
325		}
326		//click event
327		$menuElement.on('click', function(e) {
328			e.preventDefault();
329			if(!$(this).hasClass('is-disable')){
330				slideMenu($(this));
331			}
332			return false;
333		});
334	});
335};
336
337/*
338* jquery-match-height 0.7.2 by @liabru
339* http://brm.io/jquery-match-height/
340* License MIT
341*/
342!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=-1,o=-1,n=function(t){return parseFloat(t)||0},a=function(e){var o=1,a=t(e),i=null,r=[];return a.each(function(){var e=t(this),a=e.offset().top-n(e.css("margin-top")),s=r.length>0?r[r.length-1]:null;null===s?r.push(e):Math.floor(Math.abs(i-a))<=o?r[r.length-1]=s.add(e):r.push(e),i=a}),r},i=function(e){var o={
343  byRow:!0,property:"height",target:null,remove:!1};return"object"==typeof e?t.extend(o,e):("boolean"==typeof e?o.byRow=e:"remove"===e&&(o.remove=!0),o)},r=t.fn.matchHeight=function(e){var o=i(e);if(o.remove){var n=this;return this.css(o.property,""),t.each(r._groups,function(t,e){e.elements=e.elements.not(n)}),this}return this.length<=1&&!o.target?this:(r._groups.push({elements:this,options:o}),r._apply(this,o),this)};r.version="0.7.2",r._groups=[],r._throttle=80,r._maintainScroll=!1,r._beforeUpdate=null,
344  r._afterUpdate=null,r._rows=a,r._parse=n,r._parseOptions=i,r._apply=function(e,o){var s=i(o),h=t(e),l=[h],c=t(window).scrollTop(),p=t("html").outerHeight(!0),u=h.parents().filter(":hidden");return u.each(function(){var e=t(this);e.data("style-cache",e.attr("style"))}),u.css("display","block"),s.byRow&&!s.target&&(h.each(function(){var e=t(this),o=e.css("display");"inline-block"!==o&&"flex"!==o&&"inline-flex"!==o&&(o="block"),e.data("style-cache",e.attr("style")),e.css({display:o,"padding-top":"0",
345	"padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),l=a(h),h.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||"")})),t.each(l,function(e,o){var a=t(o),i=0;if(s.target)i=s.target.outerHeight(!1);else{if(s.byRow&&a.length<=1)return void a.css(s.property,"");a.each(function(){var e=t(this),o=e.attr("style"),n=e.css("display");"inline-block"!==n&&"flex"!==n&&"inline-flex"!==n&&(n="block");var a={
346	display:n};a[s.property]="",e.css(a),e.outerHeight(!1)>i&&(i=e.outerHeight(!1)),o?e.attr("style",o):e.css("display","")})}a.each(function(){var e=t(this),o=0;s.target&&e.is(s.target)||("border-box"!==e.css("box-sizing")&&(o+=n(e.css("border-top-width"))+n(e.css("border-bottom-width")),o+=n(e.css("padding-top"))+n(e.css("padding-bottom"))),e.css(s.property,i-o+"px"))})}),u.each(function(){var e=t(this);e.attr("style",e.data("style-cache")||null)}),r._maintainScroll&&t(window).scrollTop(c/p*t("html").outerHeight(!0)),
347	this},r._applyDataApi=function(){var e={};t("[data-match-height], [data-mh]").each(function(){var o=t(this),n=o.attr("data-mh")||o.attr("data-match-height");n in e?e[n]=e[n].add(o):e[n]=o}),t.each(e,function(){this.matchHeight(!0)})};var s=function(e){r._beforeUpdate&&r._beforeUpdate(e,r._groups),t.each(r._groups,function(){r._apply(this.elements,this.options)}),r._afterUpdate&&r._afterUpdate(e,r._groups)};r._update=function(n,a){if(a&&"resize"===a.type){var i=t(window).width();if(i===e)return;e=i;
348	}n?o===-1&&(o=setTimeout(function(){s(a),o=-1},r._throttle)):s(a)},t(r._applyDataApi);var h=t.fn.on?"on":"bind";t(window)[h]("load",function(t){r._update(!1,t)}),t(window)[h]("resize orientationchange",function(t){r._update(!0,t)})});

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.