1var main = {}; 2 3//éªè¯ 4(function ($) { 5 $.fn.clearError = function () { 6 $(this).find(".validation-msg").html(""); 7 } 8 $.fn.textIsEmpty = function (msg, p) { 9 var v = $(this).val(); 10 if (v == "") { 11 if (p) { 12 $(this).parent().next("span").html(msg); 13 } else { 14 $(this).next("span").html(msg); 15 } 16 return false; 17 } 18 return true; 19 } 20 $.fn.isNumber = function (msg, p) { 21 var v = $(this).val(); 22 if (v == "") return true; 23 v = v.replace("+", ""); 24 var pattern = /^[0-9]*$/; 25 var res = pattern.test(v); 26 if (!res) { 27 if (p) { 28 $(this).parent().next("span").html(msg); 29 } else { 30 $(this).next("span").html(msg); 31 } 32 return false; 33 } 34 return true; 35 } 36 $.fn.isFloat = function (msg, p) { 37 var v = $(this).val(); 38 if (v == "") return true; 39 var pattern = /^\d+(\.\d+)?$/; 40 var res = pattern.test(v); 41 if (!res) { 42 if (p) { 43 $(this).parent().next("span").html(msg); 44 } else { 45 $(this).next("span").html(msg); 46 } 47 return false; 48 } 49 return true; 50 } 51 $.fn.isChinese = function (msg, p) { 52 var v = $(this).val(); 53 if (v == "") return true; 54 var pattern = /^[\u4E00-\u9FA5]+$/; 55 var res = pattern.test(v); 56 if (!res) { 57 if (p) { 58 $(this).parent().next("span").html(msg); 59 } else { 60 $(this).next("span").html(msg); 61 } 62 return false; 63 } 64 return true; 65 } 66 $.fn.isEnglish = function (msg, p) { 67 var v = $(this).val(); 68 if (v == "") return true; 69 var pattern = /[\u4E00-\u9FA5]/g; 70 var res = pattern.test(v); 71 if (res) { 72 if (p) { 73 $(this).parent().next("span").html(msg); 74 } else { 75 $(this).next("span").html(msg); 76 } 77 return false; 78 } 79 return true; 80 } 81 $.fn.isMobile = function (msg, p) { 82 var v = $(this).val(); 83 if (v == "") return true; 84 var pattern = /^[1][1-9]{1}[0-9]{9}$/; 85 var res = pattern.test(v); 86 if (!res) { 87 if (p) { 88 $(this).parent().next("span").html(msg); 89 } else { 90 $(this).next("span").html(msg); 91 } 92 return false; 93 } 94 return true; 95 } 96 $.fn.isTelephone = function (msg, p) { 97 var v = $(this).val(); 98 if (v == "") return true; 99 var pattern = /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^[0â9]3,4[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/; 100 var res = pattern.test(v); 101 if (!res) { 102 if (p) { 103 $(this).parent().next("span").html(msg); 104 } else { 105 $(this).next("span").html(msg); 106 } 107 return false; 108 } 109 return true; 110 } 111 $.fn.isPhone = function (msg, p) { 112 var v = $(this).val(); 113 if (v == "") return true; 114 v = v.replace("+", ""); 115 if (v.startsWith("1")) { 116 return $(this).isMobile(msg, p); 117 } else { 118 return $(this).isNumber(msg, p); 119 } 120 } 121 $.fn.isEmail = function (msg, p) { 122 var v = $(this).val(); 123 if (v == "") return true; 124 var pattern = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;///^([a-zA-Z\d])((\w|-)+\.?)+@([a-zA-Z\d]+\.)+[a-zA-Z]{2,6}$/; 125 var res = pattern.test(v); 126 if (!res) { 127 if (p) { 128 $(this).parent().next("span").html(msg); 129 } else { 130 $(this).next("span").html(msg); 131 } 132 return false; 133 } 134 return true; 135 } 136 $.fn.selectIsEmpty = function (msg, p) { 137 var v = $(this).find("option:selected").val(); 138 if (v == "") { 139 if (p) { 140 $(this).parent().next("span").html(msg); 141 } else { 142 $(this).next("span").html(msg); 143 } 144 return false;
145 } 146 return true; 147 } 148 main.isDate = function (y, m, d) { 149 var year = Number(y); 150 var month = Number(m); 151 var date = Number(d); 152 var dateObj = new Date(year, month - 1, date), 153 nYear = dateObj.getFullYear(), 154 nMonth = dateObj.getMonth() + 1, 155 nDate = dateObj.getDate(); 156 157 if (year === nYear && month === nMonth && date === nDate) { 158 return true; 159 } else { 160 return false; 161 } 162 } 163 $.fn.textIsCorrect = function (msg, p) { 164 if (p) { 165 $(this).parent().next("span").html(msg); 166 return false; 167 } else { 168 $(this).next("span").html(msg); 169 return false; 170 } 171 return true; 172 } 173})(jQuery); 174//bootboxå¼¹æ¡ 175(function ($) { 176 "use strict"; 177 main.alert = function (message, option) { 178 if (!option) option = {}; 179 if (!option.title) { 180 option.title = "温馨æç¤º"; 181 } 182 bootbox.alert({ 183 size: 'small', 184 closeButton: false, 185 title: option.title, 186 message: message, 187 callback: option.callback 188 }); 189 //bootbox.dialog({ 190 // title: option.title, 191 // message: message, 192 // buttons: { 193 // confirm: { 194 // label: "ç¡®å®", 195 // className: 'gauto-theme-btn btn-width-120', 196 // callback: option.callback 197 // } 198 // } 199 //}) 200 } 201 main.confirm = function (message, option) { 202 if (!option) option = {}; 203 if (!option.title) { 204 option.title = "温馨æç¤º"; 205 } 206 bootbox.confirm({ 207 size: 'small', 208 //locale: 'zh_CN', 209 closeButton: false, 210 title: option.title, 211 message: message, 212 callback: option.callback 213 }); 214 } 215 main.prompt = function (title, callback) { 216 bootbox.prompt({ 217 size: 'small', 218 //locale: 'zh_TW', 219 title: title, 220 callback: callback 221 }); 222 } 223 main.showToast = function (message, type = 'info', duration = 3000) { 224 const icons = { 225 success: 'â', 226 error: 'â', 227 warning: 'â ', 228 info: 'â¹' 229 }; 230 231 // ç¡®ä¿ætoastå®¹å¨ 232 if ($('#toast-container').length === 0) { 233 $('body').append('<div id="toast-container"></div>'); 234 } 235 236 // åå»ºå¸¦å¾æ çtoastå ç´ 237 const $toast = $(` 238 <div class="toast ${type}"> 239 <div class="toast-content"> 240 <span class="toast-icon">${icons[type] || icons.info}</span> 241 <span class="toast-message">${message}</span> 242 </div> 243 <span class="toast-close">×</span> 244 </div> 245 `); 246 247 //æ¸ ç©ºå®¹å¨å ç´ ï¼é¿å é夿¾ç¤º 248 $('#toast-container').empty(); 249 // æ·»å å°å®¹å¨ 250 $('#toast-container').append($toast); 251 252 // 触åéæä»¥ç¡®ä¿è¿æ¸¡ææçæ 253 $toast[0].offsetHeight; 254 255 // æ¾ç¤ºtoast 256 setTimeout(function () { 257 $toast.addClass('show'); 258 }, 10); 259 260 // ç¹å»å ³éæé®å ³étoast 261 $toast.find('.toast-close').on('click', function () { 262 main.hideToast($toast); 263 }); 264 265 // èªå¨å ³é 266 if (duration > 0) { 267 setTimeout(function () { 268 main.hideToast($toast); 269 }, duration); 270 } 271 272 return $toast; 273 } 274 main.hideToast = function ($toast) { 275 if (!$toast || $toast.length === 0) return; 276 277 $toast.removeClass('show'); 278 279 // çå¾ è¿æ¸¡ææå®æåç§»é¤å ç´ 280 setTimeout(function () { 281 $toast.remove(); 282 }, 300); 283 } 284 main.hideAllToast = function () { 285 var container = $('#toast-container'); 286 if (container.length > 0) { 287 $('#toast-container').each(function () { 288 setTimeout(function () { 289 $(this).empty(); 290 }, 300); 291 }) 292 } 293 } 294})(jQuery); 295//éç¨æ¹æ³ 296(function ($) { 297 var isLoading = false, 298 loading_wait = null, 299 loading_waitModel = null; 300 301 main.reload = function () { 302 if (window.localStorage.href) { 303 main.getHtml(window.localStorage.href); 304 } 305 } 306 main.postData = function (url, data, callback) { 307 main.request({ 308 url: url, 309 method: "POST", 310 data: data 311 }, callback); 312 }; 313 main.getData = function (url, data, callback) { 314 main.request({ 315 url: url, 316 method: "GET", 317 data: data 318 }, callback); 319 }; 320 main.request = function (option, callback) { 321 if (isLoading) return; 322 isLoading = true; 323 var url = option.url; 324 var data = option.data == null ? {} : option.data; 325 var async = option.async == null ? true : option.async; 326 var method = option.method == null ? "POST" : option.method; 327 var cache = option.cache == null ? false : option.cache; 328 var dataType = option.dataType == null ? "json" : option.dataType; 329 $.ajax({ 330 url: url, 331 data: data, 332 type: method, 333 cache: cache, 334 async: async, 335 dataType: dataType, 336 success: function (res) { 337 isLoading = false;
338 if (callback) { 339 callback(res); 340 return; 341 } 342 if (!res.success) { 343 main.showToast(res.message, 'warning'); 344 return; 345 } 346 main.showToast('æäº¤æå', 'success'); 347 }, 348 error: function (error) { 349 isLoading = false; 350 console.log(error) 351 main.showToast('ç³»ç»ç¹å¿ï¼è¯·ç¨åéè¯ï¼', 'error'); 352 } 353 }); 354 }; 355 main.isNullOrEmpty = function (obj) { 356 if (obj == undefined || obj == null || (typeof obj == "string") && $.trim(obj) == "") { 357 return true; 358 } 359 return false; 360 } 361 main.loading = function (container) { 362 if (!container) { 363 container = $(document); 364 } 365 var img = document.createElement("img"); 366 img.src = "/Content/images/load.gif"; 367 var wait = $("<div style=\"z-index:10001; position:absolute;\"></div>").appendTo($(container)); 368 $(wait).append(img); 369 var waitModel = $("<div style=\"position:absolute;filter:alpha(opacity=30);-moz-opacity:0.3;opacity:0.3;background-color:silver\"></div>").appendTo($(container)); 370 var offset = $(container).offset(); 371 var left = offset ? offset.left : 0; 372 var top = offset ? offset.top : 0; 373 var width = $(container).width(); 374 var height = $(container).height(); 375 $(wait).css("left", left + width / 2); 376 $(wait).css("top", top + height / 2); 377 $(waitModel).css("width", width * 5); 378 $(waitModel).css("height", height + 20); 379 $(waitModel).css("left", left); 380 $(waitModel).css("top", top); 381 loading_wait = wait; 382 loading_waitModel = waitModel; 383 } 384 main.hideLoading = function (wait, waitModel) { 385 if (wait && waitModel) { 386 $(wait).remove(); 387 $(waitModel).remove(); 388 } else { 389 $(loading_wait).remove(); 390 $(loading_waitModel).remove(); 391 } 392 } 393 main.QueryString = function (name) { 394 var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i")); 395 if (result == null || result.length < 1) { 396 return ""; 397 } 398 return result[1]; 399 } 400 401})(jQuery);
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.