PageSourceSearch

https://www.baigolf.com/templates/js/global.js?ver=202609

js baigolf.com collected 2026-09-25 02:44:11 UTC 12,305 bytes, 447 lines download raw bytes

1$(function(){
2	//经过效果
3	$('ul.hover_list li').hover(
4		function(){
5			$(this).addClass('hover');
6			if($(this).hasClass("son")){
7				$(this).find('.son_box').show();
8			}
9		},function(){
10			$(this).removeClass('hover');
11			if($(this).hasClass("son")){
12				$(this).find('.son_box').hide();
13			}
14	});
15	//最后一个li
16	$('ul.last_list').each(function() {
17		$(this).children('li:last').addClass('last');
18	});
19	//文本框
20	$("input.input_text").focus(function(){         // 地址框获得鼠标焦点
21		if($(this).val()==this.defaultValue){
22			$(this).val("");
23		}
24	});
25	$("input.input_text").blur(function(){		  // 地址框失去鼠标焦点
26		if($(this).val()==""){
27            $(this).val(this.defaultValue);
28		}
29	});
30	//点击高亮,选中
31	$('.click_list li').click(function(){
32		$(this).addClass('light').siblings().removeClass('light');
33	});
34	//开始标签,需点击才有变化的
35	var $tab_dd = $("div.tab_c_nav .dd");
36	$tab_dd.click(function(){
37		$(this).parent().addClass("tab_light").siblings().removeClass("tab_light");
38		var index = $(this).parent().index();
39		$("div.tab_c_box > div").eq(index).show().siblings().hide();
40		$("div.tab_c_nav > div").children().removeClass('nori');
41		$("div.tab_c_nav > div").eq(index-1).children().addClass('nori');
42	}).hover(
43		function(){
44			$(this).addClass("tab_hover");
45		},function(){
46			$(this).removeClass("tab_hover");
47	});
48	//开始标签,需点击才有变化的
49	var $tab_dds = $("div.tab_s_nav dl dd");
50	$tab_dds.click(function(){
51		$(this).addClass("tab_light").siblings().removeClass("tab_light");
52		var index = $tab_dds.index(this);
53		$("div.tab_s_box > div").eq(index).show().siblings().hide();
54	}).hover(
55		function(){
56			$(this).addClass("tab_hover");
57		},function(){
58			$(this).removeClass("tab_hover");
59	});
60	//选择语言
61	/*
62	$('ul.header_r li:has(div)').click(function(){
63		$(this).children('div').toggle();
64	});
65	$('.chg_lan').click(function(e){
66		e.stopPropagation();
67		if( $('.chg_lan_div').is(':hidden') ){
68			$('.chg_lan_div').show();
69		}else{
70			$('.chg_lan_div').hide();
71		}
72	})
73	$(document).click(function(){
74		$('.chg_lan_div').hide();
75	})*/
76
77	//登录后
78	$('ul.header_r li:has(dl)').hover(
79		function(){
80			$(this).children('dl').show();
81		},function(){
82			$(this).children('dl').hide();
83	});
84	//开始表单下拉框
85	/*$('.search_select').each(function(index,domEle){
86		if ($(this).hasClass('custom_select')) {
87			return true;
88		}
89		$(domEle).selectbox({
90			onChangeCallback: myFunction
91		});
92	});
93	function myFunction(args){
94		//alert(args.selectedVal);
95	}*/
96
97	// tab切换
98	// $(".tab .ibd").eq($(".tab .hd .on").index()).show().siblings(".ibd").hide();
99	$(".tab .hd li").click(function(){
100		$(this).addClass("on").siblings().removeClass("on");
101		$(".tab .ibd").eq($(this).index()).fadeIn().siblings(".ibd").hide();
102	});
103
104	// 优惠旅游套餐
105	$(".site_detail .pic_110").each(function(){
106		$(this).find("li:gt(0)").hide();
107	});
108
109
110	// 旅游订单明细
111	$(".day_detail dt").click(function(){
112		$(this).siblings("dd").slideToggle().parent(".day_detail").toggleClass("open_day_detail");
113	});
114
115	//经过效果
116	$('div.site_detail').hover(
117		function(){
118			$(this).addClass('detail_hover');
119		},function(){
120			$(this).removeClass('detail_hover');
121	});
122
123
124	// 删除
125	$(".r_close").click(function(){
126		$(this).parent().remove();
127	});
128
129	// 积分列表切换
130	$('.point-list li').click(function() {
131		for (var i = 0;i < $('.point-list li').length;i++) {
132			$('.point-list li').eq(i).children().removeClass('on');
133			$('table').eq(i).css('display','none');
134			$('#tab'+$(".point-list li").index(this)).css('display','table');
135
136			//积分列表隔行变色
137			$('#tab'+i+' tr:odd').css('background','#fff');
138			$('#tab'+i+' tr:even').css('background','#eee');
139		}
140		$(this).children().addClass('on');
141	});
142
143	// 积分列表隔行变色
144	for (var i = 0;i < $('.point-list li').length;i++) {
145		$('#tab'+i+' tr:odd').css('background','#fff');
146		$('#tab'+i+' tr:even').css('background','#eee');
147	}
148
149	// 个人中心侧边菜单栏展开与收起控制
150	$('.order_nav_tit').click(function(){
151		var objStr = sessionStorage.getItem('list_status') || {};
152		var index = $(this).index('.order_nav_tit');
153		var obj;
154
155		if(typeof objStr == 'string'){
156			obj = JSON.parse(objStr);
157		}else{
158			obj = objStr;
159		}
160
161		if($(this).next().css('display') == 'none'){
162			delete obj[index];
163			$(this).removeClass('blue-down-arrow').addClass('blue-up-arrow');
164		}else{
165			obj[index] = index;
166			$(this).removeClass('blue-up-arrow').addClass('blue-down-arrow');
167		}
168
169		sessionStorage.setItem('list_status', JSON.stringify(obj));
170		$(this).next().slideToggle('fast');
171	});
172
173	// 保存返回首页时的搜索类型
174	$('.dynamic-link').bind('click', function(){
175		var type = $(this).data('type');
176
177		localStorage.setItem('indexType', type);
178	});
179
180	if(sessionStorage.getItem('list_status')){
181		var status = JSON.parse(sessionStorage.getItem('list_status'));
182
183		$('.order_nav_tit').each(function(idx1){
184			var $this = $(this);
185
186			$.each(status, function(idx2, value){
187				if(idx1 == idx2){
188					var oUl = $this.next('ul');
189
190					if(!oUl.children('.on').length){
191						$this.removeClass('blue-up-arrow').addClass('blue-down-arrow');
192						oUl.hide();
193					}
194				}
195			});
196		});
197	}
198});
199
200function addZero(num){
201	return num > 9 ? num : '0' + num;
202}
203// 限制文本框字数
204function checkLengtho(which) {
205        var maxChars = 2000;
206        if (which.value.length > maxChars)
207        which.value = which.value.substring(0,maxChars);
208        var curr = maxChars - which.value.length;
209        if(curr==0){
210            var smallAlert = '<div class="smallAlert"><span></span><em>最多只能输入2000字</em></div>';
211            $('body').append(smallAlert);
212            setTimeout(function(){
213            	$('.smallAlert').remove();
214            },2000);
215        }
216    }
217
218
219function checkLengthp(which,num) {
220        var maxChars = num;
221        if (which.value.length > maxChars)
222        which.value = which.value.substring(0,maxChars);
223        var curr = maxChars - which.value.length;
224        if(curr==0){
225            var smallAlert = '<div class="smallAlert"><span></span><em>最多只能输入'+num+'字</em></div>';
226            $('body').append(smallAlert);
227            setTimeout(function(){
228                $('.smallAlert').remove();
229            },2000);
230        }
231    }
232
233// 写cookies
234function setCookie(name,value)
235{
236	var Days = 1;
237	var exp = new Date();
238	exp.setTime(exp.getTime() + Days*24*60*60*1000);
239//	exp.setTime(exp.getTime() + 20000);
240	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
241}
242
243function getCookie(name)
244{
245	var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
246	if(arr=document.cookie.match(reg))
247		return unescape(arr[2]);
248	else
249		return null;
250}
251
252function delCookie(name)
253{
254	var exp = new Date();
255	exp.setTime(exp.getTime() - 1);
256	var cval=getCookie(name);
257	if(cval!=null)
258		document.cookie= name + "="+cval+";expires="+exp.toGMTString();
259}
260
261function jump_bcc_combo_after_check(datas){
262    $.ajax({
263        url:'bcc_combo.php?act=checkBccLimitBeforeDetail' + datas,
264        type:'post',
265        dataType:'json',
266        success:function(ret){
267            if(ret.status){
268               window.location.href = 'bcc_combo.php?act=bccCombo' + datas;
269           }else{
270                var _html = '<div class="mytoast">'+
271                                '<div class="toastbg" onclick="hideToast();"></div>'+
272                                '<div class="toastin">'+
273                                    '<h2>'+ret.msg+'</h2>'+
274                                    '<div onclick="hideToast();"></div>'+
275                                '</div>'+
276                            '</div>';
277                $('body').append(_html);
278           }
279
280        }
281    });
282}
283
284function hideToast(){
285    $('.mytoast').remove();
286}
287
288/** 省略号代替超出范围的文本 */
289function limitWordLength(oElem, worldLen){
290	var oldStr = '';
291	var newStr = '';
292
293	oElem.each(function(index){
294		oldStr = $(this).text();
295
296		if(oldStr.length > worldLen){
297			newStr = oldStr.substr(0, worldLen) + '...';
298
299			$(this).text(newStr);
300		}
301	});
302}
303
304/** 移除字符串中多余的空格和标点 */
305function getProperName(string) {
306	var finalString = string.replace(/[!$%\^\*=_`~{}\!\?\·\~\、\¥\×\『\』\《\》]/g,"");
307
308	finalString = finalString.replace(/\s{2,}/g," ");
309	finalString = $.trim(finalString);
310	return finalString;
311}
312
313/** 热门球场和热门旅游的幻灯片 */
314var Carousel = (function(){
315	function Slider(oSlider){
316		this.oUl = oSlider.find('ul');
317		this.oLis = this.oUl.children('li');
318		this.liLength = this.oLis.length;
319		this.liWidth = this.oLis.eq(0).outerWidth();
320		this.arrows = oSlider.find('.direction-arrow');
321		this.flag = true;
322	}
323
324	Slider.prototype.init = function(){
325		this.oUl.css('width', this.liLength * this.liWidth);
326		this.controlArrow(this.oUl.position().left);
327		this.bindEvent();
328	};
329
330	Slider.prototype.move = function(distance){
331		var L = this.oUl.position().left;
332		var This = this;
333
334		this.controlArrow(L + distance);
335		this.flag = false;
336		this.oUl.animate({left: L + distance}, 400, function(){
337			This.flag = true;
338		});
339	};
340
341	Slider.prototype.bindEvent = function(){
342		var This = this;
343
344		This.arrows.bind('click', function(e){
345			if(This.flag){
346				if($(this).hasClass('dir-left')){
347					This.move(This.liWidth);
348				}else{
349					This.move(-This.liWidth);
350				}
351			}
352		});
353	};
354
355	Slider.prototype.controlArrow = function(target){
356		if(this.liLength > 3){
357			if(Math.abs(target) == this.oUl.width() - 1098){
358				this.arrows.eq(1).hide();
359			}else{
360				this.arrows.eq(1).show();
361			}
362
363			if(target == 0){
364				this.arrows.eq(0).hide();
365			}else{
366				this.arrows.eq(0).show();
367			}
368		}else{
369			this.arrows.hide();
370		}
371	};
372
373	return Slider;
374}());
375
376/**
377 * 全局工具方法
378 * */
379var Utils = {
380	/** 渲染模板 */
381	setTemplate: function (id, data) {
382		var temp = doT.template($('#' + id).text());
383
384		return temp(data);
385    },
386
387	/** 格式化年月日 */
388	formatDate: function (oDate, style) {
389		var year = oDate.getFullYear(),
390			month = oDate.getMonth() + 1,
391			date = oDate.getDate();
392
393		style = style || '-';
394		month = month > 9 ? month : '0' + month;
395		date = date > 9  ? date : '0' + date;
396
397		return year + style + month + style + date;
398    },
399
400    /** 计算两个日期间的天数,包括开始日期 */
401	calcDays: function (start, end) {
402        var subTimes = Number(end) - Number(start);
403
404        if(subTimes === 0){
405            subTimes = 1;
406        }else{
407            subTimes = subTimes / 1000 / 3600 / 24 + 1;
408        }
409
410        return subTimes;
411    },
412
413	/** 获取当前日期是星期几 */
414	getWeekDay: function (dateStr) {
415		return new Date(dateStr).getDay();
416    },
417
418	/** 显示今天和明天 */
419	checkTodayOrTomorrow: function (lanType, date) {
420		var oToday = new Date();
421		var oTarget = new Date(date);
422        var startTimestamp = +(new Date(oToday.getFullYear(), oToday.getMonth(), oToday.getDate()).getTime());
423        var endTimestamp = +(new Date(oTarget.getFullYear(), oTarget.getMonth(), oTarget.getDate()).getTime());
424        var isTomorrow = (endTimestamp - startTimestamp) / 1000 / 3600 / 24;
425
426        if(isTomorrow === 0){
427            return lanType === 'zh_cn' || lanType === 'zh_hk' ? '今天' : '';
428        }else if(isTomorrow === 1){
429            return lanType === 'zh_cn' || lanType === 'zh_hk' ? '明天' : '';
430        }
431    },
432};
433
434$.fn.countdown = function (callback, duration, beforeMsg, afterMsg) {
435    beforeMsg = beforeMsg || '';
436    afterMsg = afterMsg || '';
437
438    var container = $(this[0]).html(beforeMsg + duration + afterMsg);
439    var countdown = setInterval(function () {
440        if (--duration) {
441            container.html(beforeMsg + duration + afterMsg);
442        } else {
443            clearInterval(countdown);
444            callback.call(container);
445        }
446    }, 1000);
447}

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.