1window.Joe.scrollTo = (selector) => { 2 const $comment = document.querySelector(selector); 3 const $header = document.querySelector('.joe_header'); 4 if (!$comment || !$header) return; 5 const top = $comment.offsetTop - $header.offsetHeight - 15; 6 window.scrollTo({ top, behavior: 'smooth' }); 7} 8 9function loadJS(url, callback = function () { }) { 10 window.loadJSList = window.loadJSList ? window.loadJSList : {}; 11 if (!loadJSList[url]) { 12 var script = document.createElement('script'); 13 script.type = 'text/javascript'; 14 script.addEventListener('load', callback); 15 script.src = url; 16 document.getElementsByTagName('head')[0].appendChild(script); 17 loadJSList[url] = script; 18 } else { 19 var script = loadJSList[url]; 20 script.addEventListener('load', callback); 21 } 22 // æ£æ¥å ç´ æ¯å¦åå¨ï¼å¦æåå¨ï¼åå é¤ï¼æµè§å¨ä¸ä¼éå¤è½½å ¥ 23 // const existingScript = document.querySelector(`script[src="${url}"]`); 24 // if (existingScript) existingScript.remove(); 25} 26 27/** 28 * 鲿彿° 29 * @param {*} fn 30 * @param {*} delay 31 * @returns 32 */ 33function throttle(fn, delay = 100) { 34 let valid = true; 35 return function (...args) { 36 if (!valid) { 37 //伿¯æ¶é´ æä¸æ¥å®¢ 38 return false; 39 } 40 // 工使¶é´ï¼æ§è¡å½æ°å¹¶ä¸å¨é´éæå æç¶æä½è®¾ä¸ºæ æ 41 valid = false; 42 setTimeout(function () { 43 fn.apply(this, args); 44 valid = true; 45 }, delay); 46 }; 47} 48 49 50/** 51 * @description: èæµå½æ° 52 * @param {*} callback 彿° 53 * @param {*} delay æ¶é´ 54 * @param {*} immediate æ¯å¦ç«å³æ§è¡ 为trueå计æ¶å¼å§å°±å°±æ§è¡ 55 * @return {*} 56 */ 57// å®ä¹ä¸ä¸ªdebounce彿°ï¼ç¨äºå½æ°é²æ 58function debounce(callback, delay, immediate) { 59 // å®ä¹ä¸ä¸ªåéï¼ç¨äºåæ¾å®æ¶å¨ 60 var timeout; 61 // è¿åä¸ä¸ªå½æ° 62 return function () { 63 // å®ä¹ä¸ä¸ªåéï¼ç¨äºåæ¾this 64 var context = this, 65 // å®ä¹ä¸ä¸ªåéï¼ç¨äºåæ¾åæ° 66 args = arguments; 67 // å®ä¹ä¸ä¸ªå½æ°ï¼ç¨äºæ¸ é¤å®æ¶å¨ 68 var later = function () { 69 // å°å®æ¶å¨ç½®ä¸ºnull 70 timeout = null; 71 // 妿䏿¯ç«å³æ§è¡ï¼åæ§è¡åè°å½æ° 72 if (!immediate) { 73 callback.apply(context, args); 74 } 75 }; 76 // 妿æ¯ç«å³æ§è¡ï¼ä¸å®æ¶å¨ä¸åå¨ï¼åç«å³æ§è¡åè°å½æ° 77 var callNow = immediate && !timeout; 78 // æ¸ é¤å®æ¶å¨ 79 clearTimeout(timeout); 80 // éæ°è®¾ç½®å®æ¶å¨ 81 timeout = setTimeout(later, delay); 82 // 妿æ¯ç«å³æ§è¡ï¼åç«å³æ§è¡åè°å½æ° 83 if (callNow) { 84 callback.apply(context, args); 85 } 86 }; 87} 88 89/** 90 * @description: ajax请æ±å°è£ 91 * @param {*} _this æé®çjquery对象 92 * @param {*} data ä¼ éçæ°æ® 93 * @param {*} success æååçåè°å½æ° 94 * @param {*} noty æç¤ºä¿¡æ¯ 95 * @param {*} no_loading æ¯å¦ä¸æ¾ç¤ºå è½½å¨ç» 96 * @return {*} 97 */ 98function zib_ajax(_this, data, success, noty, no_loading) { 99 if (_this.attr('disabled')) { 100 return !1; 101 } 102 if (!data) { 103 var _data = _this.attr('form-data'); 104 if (_data) { 105 try { 106 data = $.parseJSON(_data); 107 } catch (e) { } 108 } 109 if (!data) { 110 var form = _this.parents('form'); 111 data = form.serializeObject(); 112 } 113 } 114 115 var _action = _this.attr('form-action'); 116 if (_action) { 117 data.action = _action; 118 } 119 120 //人æºéªè¯ 121 if (data.captcha_mode && is_captcha(data.captcha_mode)) { 122 tbquire(['captcha'], function () { 123 CaptchaOpen(_this, data.captcha_mode); 124 }); 125 return !1; 126 } 127 128 if (window.captcha) { 129 data.captcha = JSON.parse(JSON.stringify(window.captcha)); 130 data.captcha._this && delete data.captcha._this; 131 window.captcha = {}; //åªè½ä½¿ç¨ä¸æ¬¡ 132 } 133 134 var _text = _this.html(); 135 var _loading = no_loading ? _text : '<i class="loading mr6"></i><text>请ç¨å</text>'; 136 noty != 'stop' && Qmsg.warning(noty || 'æ£å¨å¤ç请ç¨å...', 'load', '', 'wp_ajax'); 137 _this.attr('disabled', true).html(_loading); 138 var _url = _this.attr('ajax-href') || window.Joe.BASE_API; 139 140 $.ajax({ 141 type: 'POST', 142 url: _url, 143 data: data, 144 dataType: 'json', 145 error: function (n) { 146 var _msg = 'æä½å¤±è´¥ ' + n.status + ' ' + n.statusText + 'ï¼è¯·å·æ°é¡µé¢åéè¯'; 147 if (n.responseText && n.responseText.indexOf('è´å½é误') > -1) { 148 _msg = 'ç½ç«éå°è´å½é误ï¼è¯·æ£æ¥æä»¶å²çªæéè¿é误æ¥å¿æé¤é误'; 149 } 150 console.error('ajax请æ±é误ï¼é误信æ¯å¦ä¸ï¼', n); 151 Qmsg.error(_msg, 'danger', '', noty != 'stop' ? 'wp_ajax' : ''); 152 _this.attr('disabled', false).html(_text); 153 }, 154 success: function (n) { 155 var ys = n.ys ? n.ys : n.error ? 'danger' : ''; 156 if (n.error) { 157 // _win.slidercaptcha = false;
158 data.tcaptcha_ticket && (tcaptcha = {}); 159 } 160 if (noty != 'stop') { 161 Qmsg.success(n.msg || 'å¤ç宿', ys, '', 'wp_ajax'); 162 } else if (n.msg) { 163 Qmsg.success(n.msg, ys); 164 } 165 166 _this.attr('disabled', false).html(_text).trigger('zib_ajax.success', n); //宿 167 $.isFunction(success) && success(n, _this, data); 168 169 if (n.hide_modal) { 170 _this.closest('.modal').modal('hide'); 171 } 172 if (n.reload) { 173 if (n.goto) { 174 window.location.href = n.goto; 175 window.location.reload; 176 } else { 177 window.location.reload(); 178 } 179 } 180 }, 181 }); 182} 183 184//AJAXæ§è¡å®æåèªå¨åæ¢å°ä¸ä¸ä¸ªtab 185$('body').on('zib_ajax.success', '[next-tab]', function (e, n) { 186 var _next = $(this).attr('next-tab'); 187 if (_next && n && !n.error) { 188 $('a[href="#' + _next + '"]').tab('show'); 189 } 190}); 191 192// æ»å¨æå¿minitouch 193$.fn.minitouch = function (options) { 194 var is_on = 'minitouch-isload'; 195 var _e = $(this); 196 if (_e.data(is_on)) { 197 return; 198 } 199 200 options = $.extend( 201 { 202 direction: 'bottom', 203 selector: '', 204 start_selector: '', 205 depreciation: 50, 206 stop: false, 207 onStart: false, 208 onIng: false, 209 onEnd: false, 210 inEnd: false, 211 }, 212 options 213 ); 214 var is_stop = false; 215 var dep = options.depreciation; 216 var startX = 0; 217 var startY = 0; 218 var endX = 0; 219 var endY = 0; 220 var angle = 0; 221 var distanceX = 0; 222 var distanceY = 0; 223 var dragging = false; 224 225 var cssTransition = function (a, b, c, d, s) { 226 var e, f, g; 227 d && ((b += 'px'), (c += 'px'), (e = 'translate3D(' + b + ',' + c + ' , 0)'), (f = {}), (g = cssT_Support()), (f[g + 'transform'] = e), (f[g + 'transition'] = g + 'transform 0s linear'), (f['cursor'] = s), 'null' == d && ((f[g + 'transform'] = ''), (f[g + 'transition'] = '')), a.css(f)); 228 }; 229 var cssT_Support = function () { 230 var a = document.body || document.documentElement; 231 a = a.style; 232 return '' == a.WebkitTransition ? '-webkit-' : '' == a.MozTransition ? '-moz-' : '' == a.OTransition ? '-o-' : '' == a.transition ? '' : void 0; 233 }; 234 235 var touch_selector = options.start_selector || options.selector; 236 _e.on('touchstart pointerdown MSPointerDown', touch_selector, function (e) { 237 startX = startY = endX = endY = angle = distanceX = distanceY = 0; 238 startX = e.originalEvent.pageX || e.originalEvent.touches[0].pageX; 239 startY = e.originalEvent.pageY || e.originalEvent.touches[0].pageY; 240 dragging = !0; 241 //å ¼å®¹swiper 242 if ($(e.target).parentsUntil(touch_selector, '.swiper-container,.scroll-x').length) { 243 dragging = !1; 244 } 245 }) 246 .on('touchmove pointermove MSPointerMove', touch_selector, function (a) { 247 var _move = options.start_selector ? (options.selector ? _e.find(options.selector) : _e.find(options.start_selector)) : $(this); 248 if ($.isFunction(options.stop)) { 249 is_stop = options.stop(_e, _move, startX, startY); 250 } 251 if (dragging && !is_stop) { 252 endX = a.originalEvent.pageX || a.originalEvent.touches[0].pageX; 253 endY = a.originalEvent.pageY || a.originalEvent.touches[0].pageY; 254 distanceX = endX - startX; 255 distanceY = endY - startY; 256 angle = (180 * Math.atan2(distanceY, distanceX)) / Math.PI; 257 'right' == options.direction && ((distanceY = 0), (distanceX = angle > -40 && angle < 40 && distanceX > 0 ? distanceX : 0)); 258 'left' == options.direction && ((distanceY = 0), (distanceX = (angle > 150 || angle < -150) && 0 > distanceX ? distanceX : 0)); 259 'top' == options.direction && ((distanceX = 0), (distanceY = angle > -130 && angle < -50 && 0 > distanceY ? distanceY : 0)); 260 'bottom' == options.direction && ((distanceX = 0), (distanceY = angle > 50 && angle < 130 && distanceY > 0 ? distanceY : 0)); 261 if (distanceX !== 0 || distanceY !== 0) { 262 a.preventDefault ? a.preventDefault() : (a.returnValue = !1); 263 cssTransition(_move, distanceX, distanceY, dragging, 'grab'); 264 $.isFunction(options.onIng) && options.onIng(_e, _move, distanceX, distanceY); 265 } 266 } 267 }) 268 .on('touchend touchcancel pointerup MSPointerUp', touch_selector, function () { 269 var _move = options.start_selector ? (options.selector ? _e.find(options.selector) : _e.find(options.start_selector)) : $(this); 270 if (dragging && !is_stop) { 271 cssTransition(_move, 0, 0, 'null', ''); 272 $.isFunction(options.inEnd) && options.inEnd(_e, _move, distanceX, distanceY); 273 if (Math.abs(distanceX) > dep || Math.abs(distanceY) > dep) { 274 $.isFunction(options.onEnd) && options.onEnd(_e, _move, distanceX, distanceY); 275 } 276 startX = startY = endX = endY = angle = distanceX = distanceY = 0; 277 dragging = !1; 278 } 279 }) 280 .data(is_on, true); 281}; 282 283$.fn.serializeObject = function () { 284 var t = {} 285 , e = this.serializeArray(); 286 return $.each(e, function () { 287 void 0 !== t[this.name] ? (t[this.name].push || (t[this.name] = [t[this.name]]), 288 t[this.name].push(this.value || "")) : t[this.name] = this.value || "" 289 }), 290 t 291}
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.