PageSourceSearch

https://www.heben.com.tw/js/public.js?v=120260914

js heben.com.tw collected 2026-10-05 21:50:18 UTC 7,998 bytes, 270 lines download raw bytes

1/*一張一張圖載入*/
2function fn_loadIMGs(ww,wh,extcss,css,fnname){
3  if ($(extcss).size() ==0) return false;
4  var nowimg = $(extcss).eq(0).find('IMG');
5  $(extcss).eq(0).addClass('loading');
6  var url = $(nowimg).attr("src");
7  var str = new Date().getTime();
8  $(nowimg).attr("src", url + "?" + str);
9  //調整圖片以符合螢幕視窗大小
10  var oh = parseInt($(nowimg).attr("data-oh"),10);//img.height;
11  var ow = parseInt($(nowimg).attr("data-ow"),10);//img.width;
12  if (oh == 0) oh = img.height;
13  if (ow == 0) ow = img.width;
14  var scalex = 1;
15  var scaley = 1;
16
17  if (oh > ow){//圖是直的,以高為主
18    nh = wh;
19    scalex = ( wh / oh );
20    nw = Math.round(ow * scalex);
21    if (nw < ww){
22      nw = ww;
23      scaley = ( ww / ow );
24      nh = Math.round(oh * scaley);
25    }
26  }else{
27    nw = ww;
28    scaley = ( ww / ow );
29    nh = Math.round(oh * scaley);
30    if (nh < wh){
31      nh = wh;
32      scalex = ( wh / oh );
33      nw = Math.round(ow * scalex);
34    }
35  }
36
37  var fx = nw / ww;
38  var fh = nh / wh;
39  var fix_h = (wh - nh )/2;
40  var fix_x = (ww - nw)/2;
41  if (fix_h>0) fix_h=0;
42  $(nowimg).css({'width':nw+'px','height':nh+'px','margin-top':fix_h+'px','margin-left':fix_x+'px'});
43
44  function ImageLoading() {
45    //setTimeout(function(){
46    $(nowimg).fadeIn(800,function(){
47      //有需要啟動function
48      if (fnname != null && typeof fnname == 'function'){
49        if ($(nowimg).parent().hasClass('startfn')){
50          fnname();
51        }
52      }
53      $(nowimg).parent().removeClass('loading');
54    });
55
56    $(extcss).eq(0).addClass('loading').removeClass(css);
57
58    //載入下一張
59    setTimeout(function(){
60      fn_loadIMGs(ww,wh,extcss,css,fnname);
61    }, 10);
62  }
63  if ($(nowimg).complete) {
64     imageLoaded.call(this);
65  } else {
66    $(nowimg).one('load',function(){
67      ImageLoading();
68    });
69  }
70}
71function formsubmit(acturl){
72	var ff = $("<form name='_f' method='post' action='"+acturl+"'></form>");
73	var parent = $("body");
74	parent.append(ff);
75	ff.submit();
76}
77function formsubmit(acturl,parames){
78  //alert(parames);
79  var fname = "_form_"+getTimeRndString();
80	var ff = $("<form name='"+fname+"' id='"+fname+"' method='post' action='"+acturl+"'><div id='appendcolumn'></div></form>");
81	var parent = $("body");
82	parent.append(ff);
83  for(var key in parames){
84    $("#appendcolumn").append($("<input type='hidden' name='"+key+"' value='"+parames[key]+"'>"));
85    //alert(key+","+parames[key]);
86  }
87	ff.submit();
88}
89function getTimeRndString() {
90   var tm=new Date();
91   var str=tm.getMilliseconds()+tm.getSeconds()*60+tm.getMinutes()*3600+tm.getHours()*60*3600+tm.getDay()*3600*24+tm.getMonth()*3600*24*31+tm.getYear()*3600*24*31*12;
92   return str;
93};
94function isNumber(val){
95  var re = /^\d+$/;
96  return re.test(val);
97}
98function isPhone(fData)
99{
100    var str;
101    var fDatastr="";
102    if (fData==null || fData=="")
103        return true
104    for (var i=0;i<fData.length;i++)
105    {
106        str=fData.substring(i,i+1);
107        if (str!="(" && str!=")" && str!="(" && str!=")" && str!="+" && str!="-" && str!="#" && str!=" ")
108           fDatastr=fDatastr+str;
109    }
110    if (isNaN(fDatastr))
111        return false
112    return true
113}
114
115function isEmail(email){
116  if (email=="") return true;
117  reEmail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/
118  return reEmail.test(email);
119}
120function wait_msg() {
121  $.blockUI({ message: '<div>請稍等...</div>'});
122  return true;
123}
124function warning_msg(text) {
125  $.prompt(text);
126}
127String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
128function isDate(val){
129  try{
130    var dd = new Date(Date.parse(val.replace("-", "/")));
131    return true;
132  }catch(ee){return false;}
133}
134function compareDate(val1, val2) {
135  return new Date(Date.parse(val1.replace("-", "/"))) <= new Date(Date.parse(val2.replace("-", "/")));
136}
137function checkMaxlength(key){
138  try{
139    if (document.getElementById(key) && document.getElementById(key).getAttribute("data-maxlength")){
140      var maxlength = parseInt(document.getElementById(key).getAttribute("data-maxlength"));
141      if (document.getElementById(key).value.length >maxlength){
142        return false;
143      }
144      return true;
145    }
146    return false;
147  }catch(ee){return false;}
148}
149
150function loadTown(cityid,townid,columnid,path,excludeIsland){
151  $('#'+columnid).val('');
152  $('#'+townid).html('<option value="">請選擇</option>');
153  var citycode = $('#'+cityid).val();
154  if(citycode=='') return false;
155
156  var postData = 'type=town&citycode=' + citycode;
157  if(excludeIsland) postData += '&exclude_island=1';
158
159  $.ajax({
160      url:path+'include/county_json.php',
161      type:'POST',
162      data: postData,
163      dataType: 'json',
164      contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
165      success: function( json ) {
166          $.each(json.datas, function(i, value) {
167              $('#'+townid).append($('<option>').text(value.zipcode+' '+value.name).attr('value', value.zipcode+' '+value.name));
168          });
169      }
170  });
171}
172
173
174(function($){
175
176  $.fn.ctrlCmd = function(key) {
177
178    var allowDefault = true;
179
180    if (!$.isArray(key)) {
181       key = [key];
182    }
183
184    return this.keydown(function(e) {
185        for (var i = 0, l = key.length; i < l; i++) {
186            if(e.keyCode === key[i].toUpperCase().charCodeAt(0) && e.metaKey) {
187                allowDefault = false;
188            }
189        };
190        return allowDefault;
191    });
192};
193
194
195$.fn.disableSelection = function() {
196
197    this.ctrlCmd(['a', 'c']);
198    return this.attr('unselectable', 'on')
199               .css({'-moz-user-select':'-moz-none',
200                     '-moz-user-select':'none',
201                     '-o-user-select':'none',
202                     '-khtml-user-select':'none',
203                     '-webkit-user-select':'none',
204                     '-ms-user-select':'none',
205                     'user-select':'none'})
206               .bind('selectstart', false);
207};
208
209})(jQuery);
210function jQuery_isTagName(e, whitelists) {
211      e = $.event.fix(e);
212      var target = e.target || e.srcElement;
213      if (whitelists && $.inArray(target.tagName.toString().toUpperCase(), whitelists) == -1) {
214        return false;
215      }
216      return true;
217}
218
219function noF12(){
220  document.onkeydown=function(e){e=e||window.event;if(e.keyCode==123||e.keyCode==18){return false}}
221}
222
223function noSelect(){
224    $(document).ready(function(){
225      if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)){
226        $('img').css({'user-select':'none','-webkit-user-drag': 'none'});
227      }
228    });
229    $(':not(input,select,textarea)').disableSelection().on('mousedown', function(e) {
230        // 排除 Swiper 元件,避免阻擋滑動與點擊切換
231        if ($(e.target).closest('.swiper-wrapper').length > 0) {
232            return true;
233        }
234        if (!jQuery_isTagName(e, ['INPUT', 'TEXTAREA', 'SELECT'])) {
235            e.preventDefault();
236            return false;
237        }
238        return true;
239    });
240}
241
242function noRightMenu(){
243    $(document).ready(function(){
244      if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)){
245        $('html,body').attr('style','-webkit-touch-callout:none;');
246      }
247    });
248    $(document).bind("contextmenu",function(e){
249        if (!jQuery_isTagName(e, ['INPUT', 'TEXTAREA', 'SELECT'])) {
250            e.preventDefault();
251            return false;
252        }
253        return true;
254    });
255}
256// var miracle = {
257//   showError: function(message,parames) {
258
259//     // 僅支援 title, text, footer 參數
260//     // 定義參數
261//     var _cfgs = parames || {};
262//     _cfgs.text = message;
263
264//     Swal.fire(_cfgs);
265//   },
266//   showSuccess: function(message) {
267//       // 在這裡插入你的成功處理程式碼
268//       console.log(message);
269//   }
270// };

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.