PageSourceSearch

https://shop.mdnkids.com/products_info/1911020145/scripts/base.js

js mdnkids.com collected 2026-09-24 09:20:52 UTC 9,567 bytes, 310 lines download raw bytes

1$(window).on('load',function(){
2	chPageHeight();
3	$(window).resize(function(){
4		chPageHeight();
5	});
6});
7
8/* 判斷頁面高度定位Footer */
9$('head').append($('<style>').html('html.fixedFooter body footer{position: fixed; bottom: 0; width: 100%;}'));
10function chPageHeight(){
11	var tempH=0;
12	tempH+=$('header').height();
13	tempH+=parseInt($('header').css('padding-top'));
14	tempH+=parseInt($('header').css('padding-bottom'));
15	tempH+=parseInt($('header').css('margin-top'));
16	tempH+=parseInt($('header').css('margin-bottom'));
17	tempH+=$('.wrapper').height();
18	tempH+=$('footer').height();
19	tempH+=parseInt($('footer').css('padding-top'));
20	tempH+=parseInt($('footer').css('padding-bottom'));
21	tempH+=parseInt($('footer').css('margin-top'));
22	tempH+=parseInt($('footer').css('margin-bottom'));
23	
24	if(tempH<window.innerHeight){
25		$('html').addClass('fixedFooter');
26	}else{
27		$('html').removeClass('fixedFooter');
28	}
29}
30
31//取得URL的Parameter
32function getParameterByName(name, url) {
33	if (!url) url = window.location.href;
34	name = name.replace(/[\[\]]/g, "\\$&");
35	var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
36		results = regex.exec(url);
37	if (!results) return null;
38	if (!results[2]) return '';
39	return decodeURIComponent(results[2].replace(/\+/g, " "));
40}
41
42//開光箱不能點背景、Close Button
43function openFancyboxByCloseClickFalse(url,width,height){
44  var vH;
45  if(typeof height == 'undefined'){
46    vH = 'auto';
47  }else{
48    vH = parseInt(height,10);
49  }
50  $.fancybox({
51      autoSize        : false, 
52            padding           : 0,
53      margin        : 0,
54      scrolling     : 'no',
55            title             : this.title,
56            width           : parseInt(width,10),
57      maxWidth      : '95%',
58            height          : vH,
59            href              : url,
60            type              : 'iframe',
61      'closeBtn'      : false,
62      helpers   : { 
63         overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox 
64      }
65  });
66    return false;
67}
68
69//開光箱不能點背景,能點選Close Button
70function openFancyboxByCloseClickTure(url,width,height){
71  var vH;
72  if(typeof height == 'undefined'){
73    vH = 'auto';
74  }else{
75    vH = parseInt(height,10);
76  }
77  $.fancybox({
78      autoSize        : false, 
79            padding           : 0,
80      margin        : 0,
81      scrolling     : 'no',
82            title             : this.title,
83            width           : parseInt(width,10),
84      maxWidth      : '95%',
85            height          : vH,
86            href              : url,
87            type              : 'iframe',
88      'closeBtn'      : true,
89      helpers   : { 
90         overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox 
91      }
92  });
93    return false;
94}
95//向左補0
96function paddingLeft(str,len){
97  var qq = Trim(str.toString());
98  if(qq.length >= len){
99    return qq;
100  }else{
101    return paddingLeft("0" +qq,len);
102  }
103}
104//向右補0
105function paddingRight(str,lenght){
106  var qq = Trim(str.toString());
107  if(qq.length >= lenght){
108    return qq;
109  }else{
110    return paddingRight(qq+"0",lenght);
111  }
112}
113/**** 去除空格 ****/
114function LTrim(str) {
115  return str.replace(/^[ \t\n\r]+/g, "");
116}
117function RTrim(str) {
118  return str.replace(/[ \t\n\r]+$/g, "");
119}
120function Trim(str){
121  return LTrim(RTrim(str));
122}
123
124//確認是否為數值
125function checkNumber(number) {
126  a = number;
127  date = a.match(/[^0-9]/g);
128  if(date || !a){ 
129    return false;
130  }else{
131    return true;
132  }
133}
134//確認是否為數字或小數後兩位內(123 或 123.12)
135function checkNumberFloat(number){
136  a = number;
137  date = a.match(/^\d+(\.{1}[0-9]{1,2})*$/);
138  if(date || !a){ 
139    return false;
140  }else{
141    return true;
142  }
143}
144//確認是否為小數(格式為123.123或0.23456)
145function checkFloat(floatNumber){
146  a = floatNumber;
147    re = /^-?\d+\.\d+$/;
148  if(!re.test(a)){
149    return false
150  } 
151  return true;
152}
153//確認是否為Email
154function checkEmail(strEmail) {
155  emailRule = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9_-]+((\.|-)[A-Za-z0-9_-]+)*\.[A-Za-z_-]+$/; 
156  if(strEmail.search(emailRule)!= -1){
157    return true;
158  }else{
159    return false; 
160  }
161}
162
163//確認聯絡電話(市話)
164function checkTel(strTel){  
165  if (strTel.search(/^([0][1-9]{1,3}-([0-9]{5,8}))+((#([0-9]){1,5}){0,1})$/)!=-1) {
166    return true;
167  }else {
168     return false;
169  } 
170}
171
172//確認手機號碼
173function checkMobile(strMobile){  
174  if (strMobile.search(/^09[0-9]{8}$/)!=-1) {
175    return true;
176  }else {
177    return false;
178  }
179}
180
181//判斷身份證字號
182function checkIdNumber(id_number){
183  
184  if(id_number.length > 0){
185    var data = id_number;
186    if(data.length != 10){return false;}
187    
188    data1=data.substr(0,1);
189    data1=data1.match(/[a-zA-Z]{1}/);
190    if(data1 == null){return false;}
191    
192    data2=data.substr(1,9);
193    data3=data2.match(/\d{9}/);
194    if(data3 == null){return false;}  
195  }
196
197  //驗證格式  
198  var acc = 0,d0 = id_number.charAt(0),d1 = id_number.charAt(1),d2 = id_number.charAt(2),d3 = id_number.charAt(3),d4 = id_number.charAt(4),
199  d5 = id_number.charAt(5),d6 = id_number.charAt(6),d7 = id_number.charAt(7),d8 = id_number.charAt(8),d9 = id_number.charAt(9);
200  if ((d0 == "A") || (d0 == "a")) { acc = 10; }else if ((d0 == "B") || (d0 == "b")) { acc = 11; }else if ((d0 == "C") || (d0 == "c")) { acc = 12; }
201  else if ((d0 == "D") || (d0 == "d")) { acc = 13; }else if ((d0 == "E") || (d0 == "e")) { acc = 14; }else if ((d0 == "F") || (d0 == "f")) { acc = 15; }
202  else if ((d0 == "G") || (d0 == "g")) { acc = 16; }else if ((d0 == "H") || (d0 == "h")) { acc = 17; }else if ((d0 == "J") || (d0 == "j")) { acc = 18; }
203  else if ((d0 == "K") || (d0 == "k")) { acc = 19; }else if ((d0 == "L") || (d0 == "l")) { acc = 20; }else if ((d0 == "M") || (d0 == "m")) { acc = 21; }
204  else if ((d0 == "N") || (d0 == "n")) { acc = 22; }else if ((d0 == "P") || (d0 == "p")) { acc = 23; }else if ((d0 == "Q") || (d0 == "q")) { acc = 24; }
205  else if ((d0 == "R") || (d0 == "r")) { acc = 25; }else if ((d0 == "S") || (d0 == "s")) { acc = 26; }else if ((d0 == "T") || (d0 == "t")) { acc = 27; }
206  else if ((d0 == "U") || (d0 == "u")) { acc = 28; }else if ((d0 == "V") || (d0 == "v")) { acc = 29; }else if ((d0 == "X") || (d0 == "x")) { acc = 30; }
207  else if ((d0 == "Y") || (d0 == "y")) { acc = 31; }else if ((d0 == "W") || (d0 == "w")) { acc = 32; }else if ((d0 == "Z") || (d0 == "z")) { acc = 33; }
208  else if ((d0 == "I") || (d0 == "i")) { acc = 34; }else if ((d0 == "O") || (d0 == "o")) { acc = 35; }
209  
210  if (acc == 0) {
211    return false;
212  } else {
213    accstr = new String(acc);
214    acc_1 = (accstr).charAt(0);
215    acc_2 = (accstr).charAt(1);
216    certsum = 1*acc_1 + 9*acc_2 + 8*d1 + 7*d2 + 6*d3 + 5*d4 + 4*d5 + 3*d6 + 2*d7 + 1*d8;
217    certsum_2 = parseInt(certsum%10);
218    certsum_3 = 10 - certsum_2;
219    if(certsum_2 == 0){
220      certsum_3 = 0;
221    }
222
223    if (certsum_3 != d9) {
224         return false;
225    }else{
226         return true;
227    }
228  }
229}
230//確認日期格式
231function checkDate(strDate){
232  var re = /^\d{4}[-]\d{1,2}[-]\d{1,2}$/;
233  if(re.test(strDate)) {
234    return true;
235  }else{
236    return false;
237  }
238}
239
240
241//===============================================================================================================================================
242//取得鄉鎮市區
243function changeAreaCantonForAjax(cityName,cantonName,select_canton){
244  var cityId = document.getElementById(cityName).value;
245   $.ajax({
246        type: "GET",
247        url: "ajax/ajax_area_canton.php",
248        data: {'cityId': cityId},
249        dataType: "json",
250        cache: false,
251        success: function(data) {
252      var courseObj = document.getElementById(cantonName);
253      //Remove目前選擇的鄉鎮市區選單內容
254      $("#"+cantonName+" option").remove();
255    
256      courseObj.options.length = 0;
257      courseObj.options[0] = new Option ("鄉鎮市區","");
258      for (var i = 0; i < data.length; i++){
259        courseObj.options[(i+1)] = new Option (data[i]['name'],data[i]['id']);
260      }
261      //預選
262      if(typeof select_canton != '' && typeof select_canton != 'undefined'){
263        if(select_canton.length>0){$(courseObj).val(select_canton);}
264      }
265        }
266    }); 
267}
268
269//取得郵遞區號
270function changeAreaCantonZipForAjax(cantonName,zipName){
271  var cantonId = document.getElementById(cantonName).value;
272   $.ajax({
273        type: "GET",
274        url: "ajax/ajax_area_zip.php",
275        data: {'cantonId': cantonId},
276        dataType: "json",
277        cache: false,
278        success: function(data) {
279      //將郵遞區號回填至表單中
280      $("#"+zipName).val(data);
281        }
282    });
283}
284
285//重新取得驗證碼
286function reSIImage(){
287  var d1 = new Date();
288  var when=d1.getTime();
289  document.getElementById('siimage').src = "system_info/plugin/code/securimage_show.php?sid="+when;
290}
291
292//=======================================================
293//登出
294function sendLogout()
295{
296  var showMsg ="是否要登出國語小舖?";
297
298  if(confirm(showMsg)){
299    $.ajax({
300          type: "POST",
301          url: "ajax/send_logout.php",       
302          dataType: "json",
303          cache: false,
304          success: function(data) {     
305              // alert(data['url']);       
306              location.replace(data['url']);
307          }
308    });
309  }
310}

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.