1window.onload = function(){ 2 //ç¨äºå¤çajaxè¯·æ±æ¶å¦æåå°ç»å½å¤±æè¢«æ¦æªäºï¼ç¶å302æ æ³è·³è½¬ç»å½é®é¢ 3 $.ajaxSetup({ 4 contentType: "application/x-www-form-urlencoded;charset=utf-8", 5 complete: function(XMLHttpRequest, textStatus) { 6 if(XMLHttpRequest && XMLHttpRequest.responseJSON){ 7 var response = XMLHttpRequest.responseJSON; 8 if(response.errCode && response.errCode == 206302){ 9 window.location.reload(); 10 } 11 } 12 } 13 }); 14}; 15 16$(function(){ 17 // 7.2.1.SP4ä»window.onloadç§»å ¥ éè¦å¨è¯¥æä»¶å è½½åå è½½toastr.js 18 // åå§å totast 19 // ä½¿ç¨æ¹å¼ï¼toastr.success('Hello world!', 'Toastr fun!'); 20 //success ã errorãinfoãwarning 第äºä¸ªåæ°ä¸ºæ é¢å¯ä»¥çç¥ 21 if(typeof(toastr) != 'undefined'){ 22 toastr.options = { 23 closeButton: false, 24 debug: false, 25 progressBar: false, 26 positionClass: 'toast-top-center', 27 onclick: null, 28 showDuration: '300', 29 hideDuration: '1000', 30 timeOut: '4000', 31 extendedTimeOut: '1000', 32 showEasing: 'swing', 33 hideEasing: 'linear', 34 showMethod: 'fadeIn', 35 hideMethod: 'fadeOut' 36 }; 37 } 38 //å å 容è¿é¿ä¼æªåï¼æä»¥é设置titleç¨äºæ¾ç¤ºå®æå 容(åªè½æ¾ç¤ºä¸è¡) 39 $(".lang_text_ellipsis").each(function(index){ 40 $(this).attr("title", $(this).text()); 41 var ellipsis_css = "text-overflow:ellipsis;" + 42 "overflow:hidden;" + 43 "white-space:nowrap;" + 44 "display:-moz-inline-box;" + 45 "word-wrap:break-word;" 46 var display = $(this).css("display"); 47 if(display && display == 'none'){ 48 ellipsis_css = ellipsis_css +"display:none;" 49 }else{ 50 ellipsis_css = ellipsis_css +"display:inline-block;" 51 } 52 utils.addCss(this, ellipsis_css); 53 }); 54 55 //å å 容è¿é¿ä¼æªåï¼æä»¥é设置titleç¨äºæ¾ç¤ºå®æå 容(éè¿å颿°åæ¾ç¤ºå¤å°è¡ï¼ä¾æ¾ç¤º5è¡num-text-ellipsis-5) 56 $("*[class*=num-text-ellipsis]").each(function(index){ 57 var webkitLine = 1; 58 var className = $(this)[0].className; 59 $.each(className.split(" "), function(index, obj){ 60 if(obj.indexOf("num-text-ellipsis-") >= 0){ 61 webkitLine = obj.replace("num-text-ellipsis-", ""); 62 } 63 }); 64 $(this).attr("title", $(this).text()); 65 var ellipsis_css = "text-overflow:ellipsis;" + 66 "overflow:hidden;" + 67 "white-space:inherit;" + 68 "word-wrap:break-word;" + 69 "display:-webkit-box;" + 70 "-webkit-line-clamp:"+webkitLine+";" + 71 "-webkit-box-orient:vertical;"; 72 var display = $(this).css("display"); 73 if(display && display == "none"){ 74 ellipsis_css = ellipsis_css + "display:none"; 75 }else{ 76 ellipsis_css = ellipsis_css + "display:-webkit-box"; 77 } 78 utils.addCss(this, ellipsis_css); 79 }); 80 81 //inputæ¡åªè½è¾å ¥æ°åï¼å¦ææºå· 82 $(".only-input-number").each(function(){ 83 $(this).keyup(function(){ 84 $(this).val($(this).val().replace(/[^\d]/g,'')); 85 }) 86 }); 87}); 88 89//æ¸ é¤å¸å·æ¿æ´»åæ¾åå¯ç åå ¥localStorageçä¸´æ¶æ°æ®service 90localStorage.removeItem("accountActivation"); 91localStorage.removeItem("retrievePassword"); 92 93//ç¦æ¢é¡µé¢è¾å ¥æ¡èªå¨å¡«å ¥ 94function reloadInput(){ 95 $(".no-auto-input").each(function(index){ 96 // $(this).val(''); 97 //å IE对autocompleteå ¼å®¹æ§ä¸æ¯æï¼ä¼åºç°è¾å ¥æ¡ç¹å»2次æè½è¾å ¥ï¼æä»¥å¦æIEå°±ä¸å è¯¥å±æ§ 98 if (!(window.ActiveXObject || "ActiveXObject" in window)){ 99 $(this).attr('readonly','readonly'); 100 $(this).attr('autocomplete','off'); 101 } 102 }); 103 setTimeout(function(){ 104 $(".no-auto-input").each(function(index){ 105 // $(this).val(''); 106 $(this).removeAttr("readonly"); 107 }); 108 },1500); 109} 110 111var utils = { 112 disabledBtnCss: {}, 113 //å ¨å±æç¤ºä¿¡æ¯æ¾ç¤ºæ¶é¿ 114 defaultShowMsgTime: 4000, 115 //å ¨å±æç¤ºä¿¡æ¯æ¾ç¤ºé¿åº¦(鲿¢å符è¿é¿æ¾ç¤ºä¸ç¾è§) 116 defaultShowMsgLength: 100, 117 // æ£æ¥å¯¹è±¡å ç´ æ¯å¦åå¨ 118 isNull: function(data) { 119 if (data == null || data == undefined || $(data).length <= 0) { 120 return true; 121 } 122 return false; 123 }, 124 125 // æ£æ¥å符串æ¯å¦ä¸ºç©ºï¼å æ¬ç©ºæ ¼åç¬¦ä¸²ï¼ 126 isEmptyStr: function(data) { 127 if (data == null || data == undefined || data == "" || $.trim(data) == "") { 128 return true; 129 } 130 return false; 131 }, 132 isNotEmptyStr: function(data) { 133 return !this.isEmptyStr(data); 134 }, 135 subStr: function(data, num) { 136 if(!num || num==0){ 137 num = this.defaultShowMsgLength; 138 } 139 var locale = this.getCookie("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"); 140 if(this.isNotEmptyStr(locale) && locale.indexOf("en") != -1){ 141 num = 2 * num;//è±æåç¬¦å°±å¤æªå 142 } 143 if(this.isEmptyStr(data) || num<=0 || data.length<=num){ 144 return data; 145 } 146 return data.substring(0,num)+"..."; 147 }, 148 // nullådefined转为"",defaultVal为é»è®¤å¼ 149 toStr: function(data, defaultVal) { 150 if (this.isEmptyStr(defaultVal)) { 151 return this.isEmptyStr(data) ? "" : data; 152 } else { 153 return this.isEmptyStr(data) ? defaultVal : data; 154 } 155 }, 156 157 //ç»Aæ ç¾href屿§urlæ¼æ¥åæ°ï¼æ³¨æparamNameåæ°ç¬¦å· & or ?ï¼ 158 setUrlParam: function(id, paramName, paramValue){ 159 var eltObj = document.getElementById(id); 160 if(!eltObj || this.isEmptyStr(paramName) || this.isEmptyStr(paramValue)){ 161 return; 162 } 163 if(eltObj.nodeName == "A" || eltObj.nodeName == "a"){ 164 //aæ ç¾ 165 eltObj.href = eltObj.href+paramName+"="+paramValue; 166 }else if(eltObj.nodeName == "FORM" || eltObj.nodeName == "form"){ 167 //formæ ç¾ 168 eltObj.action = eltObj.action+paramName+"="+paramValue; 169 } 170 }, 171 172 //ç»ä¸inputè¾å ¥æ ¡éªæç¤º 173 requireInput: function(that, minLength, maxLength, msgThat, errorMsg, requireObj,needFocus){ 174 var isRequire = false; 175 if(this.isNull(that)){ 176 this.alertBox("代ç é误ï¼", 3000); 177 return true; 178 } 179 180 if(!requireObj){ 181 requireObj = that; 182 } 183 //页é¢è¾å ¥æ¡æ ¡éª 184 var thatVal = $(that).val(); 185 if(thatVal != undefined){ 186 thatVal = thatVal.replace(/(^\s*)|(\s*$)/g, "");//æ£åå»ç©ºæ ¼ 187 $(that).val(thatVal); 188 if(thatVal.length <= minLength || thatVal.length > maxLength){ 189 isRequire = true; 190 this.addClass(requireObj, "required"); 191 this.showMsg(msgThat,errorMsg); 192 if(needFocus==undefined||needFocus=="true"){ 193 $(that).focus(); 194 } 195 $(msgThat).show(); 196 }else{ 197 isRequire = false; 198 this.removeClass(requireObj, "required"); 199 this.showMsg(msgThat,""); 200 } 201 } 202 return isRequire; 203 }, 204 //æ¸ é¤requrieæ ·å¼ 205 cleanRequire: function(requireObj, showErrorObj){ 206 $(requireObj).find(".required").each(function(){ 207 utils.removeClass($(this), "required"); 208 }); 209 $(showErrorObj).empty(); 210 }, 211 212 //ç»ä¸inputè¾å ¥æ ¡éªæä»¶å¼¹æ¡æç¤º 213 toastRequireInput: function(that, minLength, maxLength, errorMsg){ 214 var isRequire = false; 215 if(this.isNull(that)){ 216 this.alertBox("代ç é误ï¼", 3000); 217 return true; 218 } 219 //页é¢è¾å ¥æ¡æ ¡éª 220 var thatVal = $(that).val(); 221 if(thatVal != undefined){ 222 thatVal = thatVal.replace(/(^\s*)|(\s*$)/g, "");//æ£åå»ç©ºæ ¼ 223 $(that).val(thatVal); 224 if(thatVal.length <= minLength || thatVal.length > maxLength){ 225 isRequire = true; 226 this.addClass(that, "required"); 227 this.alertBox(errorMsg); 228 }else{ 229 isRequire = false; 230 this.removeClass(that, "required"); 231 } 232 } 233 return isRequire; 234 }, 235 236 //å¼¹çªæ¾ç¤ºæç¤ºä¿¡æ¯ 237 alertBox: function(msg, mTime, mLength) { 238 if(!mTime || mTime<=0){ 239 //é»è®¤æ¾ç¤ºæ¶é¿ 240 mTime = this.defaultShowMsgTime; 241 } 242 if(msg){ 243 msg = msg.replace(/(^\s*)|(\s*$)/g, "");//æ£åå»ç©ºæ ¼ 244 }else{ 245 return false; 246 } 247 //鲿¢æç¤ºä¿¡æ¯è¿é¿ 248 var mssg = this.subStr(msg, mLength); 249 // 鲿¢è¿ç»ç¹å»é æçå¤ä¸ªæç¤ºæ¡ 250 if (document.querySelector("#alert-box")) { 251 document.body.removeChild(document.querySelector("#alert-box")); 252 } 253 var alertBox = document.createElement("div"); 254 alertBox.id = "alert-box"; 255 alertBox.title = msg; 256 257 var clientWidth = document.body.clientWidth; 258 if(clientWidth > 1000){ 259 //PC端 260 clientWidth = clientWidth * 0.3; 261 }else{ 262 //ç§»å¨ç«¯ 263 clientWidth = clientWidth * 0.6; 264 } 265 alertBox.style.cssText = "" + 266 "min-width:120px;" + 267 "max-width:"+clientWidth+"px;" + 268 "min-height:120px;" + 269 "background:#121212;" + 270 "color:#FFFFFF;" + 271 "font-size:16px;" + 272 "text-align:center;" + 273 "border-radius:5px;" + 274 "opacity: 0.8;" + 275 "z-index:999;" + 276 "padding:21px 14px;" + 277 "-webkit-box-sizing: border-box;" + 278 "-moz-box-sizing: border-box;" + 279 "box-sizing: border-box;" + 280 "display:inline-block;" + 281 "word-wrap: break-word;" + 282 "overflow: hidden;" + 283 "text-overflow:ellipsis;" + 284 "position:absolute;" + 285 "top:35%;" + 286 "left:50%;" + 287 "transform: translate(-50%, -50%);"; 288 289 //è®¾ç½®å¼¹æ¡æç¤ºå¾æ 290 var img = document.createElement("img"); 291 img.src = "/authserver/default/static/common/images/error-tip.png"; 292 img.style.cssText = "width: 48px;
292height: 48px;margin: 0px 0px 8px 0px;"; 293 alertBox.appendChild(img) 294 //设置æç¤ºè¯ 295 var msgDiv = document.createElement("div"); 296 msgDiv.style.cssText = "width: 100%;" + 297 "text-overflow: ellipsis;" + 298 "overflow: hidden;" + 299 "white-space: inherit;" + 300 "overflow-wrap: break-word;" + 301 "-webkit-line-clamp: 3;" + 302 "-webkit-box-orient: vertical;" + 303 "display: -webkit-box;"; 304 msgDiv.innerHTML = mssg; 305 alertBox.appendChild(msgDiv) 306 document.body.appendChild(alertBox); 307 var bhAlertBox = document.querySelector("#alert-box"); 308 setTimeout(function () { 309 // 鲿¢åé¢æç¤ºæ¡ä¸¢å¼ä¹å导è´jsæ¥é 310 if (bhAlertBox.parentNode != null) { 311 document.body.removeChild(bhAlertBox); 312 } 313 }, mTime) 314 }, 315 316 //æå®é¡µé¢ä½ç½®å±ç¤ºæç¤ºä¿¡æ¯ 317 showMsg: function(msgObj, msg, msTime, mLength){ 318 if(this.isNull(msgObj)){ 319 return; 320 } 321 if(this.isEmptyStr(msg)){ 322 return; 323 } 324 msg = msg.replace(/(^\s*)|(\s*$)/g, "");//æ£åå»ç©ºæ ¼ 325 $(msgObj)[0].title=msg; 326 $(msgObj)[0].innerHTML=this.subStr(msg, mLength); 327 //æç¤ºä¿¡æ¯å¤ä¹ æ¶é´åæ¶å¤± 328 if(msTime != undefined){ 329 if(msTime <= 0){ 330 msTime = this.defaultShowMsgTime; 331 } 332 $(msgObj).show().delay(msTime).hide("slow") 333 } 334 return; 335 }, 336 337 //æå®é¡µé¢ä½ç½®å±ç¤ºæç¤ºä¿¡æ¯ 338 showDelayMsg: function(msgObj, msg, msTime, mLength){ 339 if(this.isNull(msgObj)){ 340 return; 341 } 342 if(this.isEmptyStr(msg)){ 343 return; 344 } 345 msg = msg.replace(/(^\s*)|(\s*$)/g, "");//æ£åå»ç©ºæ ¼ 346 $(msgObj)[0].innerHTML=this.subStr(msg, mLength); 347 //æç¤ºä¿¡æ¯å¤ä¹ æ¶é´åæ¶å¤± 348 if(msTime != undefined){ 349 if(msTime <= 0){ 350 msTime = this.defaultShowMsgTime; 351 } 352 $(msgObj).show().delay(msTime).hide("slow") 353 } 354 return; 355 }, 356 357 //JSåçæ¹å¼-æ·»å å ç´ æå®æ ·å¼ 358 addCss: function(that, cssJson){ 359 if(this.isNull(that)){ 360 return; 361 } 362 //$(that).css(cssJson); 363 //var obj = document.getElementById("btnB"); 364 $(that)[0].style.cssText += ";"+cssJson; 365 }, 366 //JSåçæ¹å¼-æ·»å å ç´ æå®æ ·å¼ 367 addClass: function(that, cls){ 368 if(this.isNull(that)){ 369 return; 370 } 371 //$(that).addClass("required");//IE䏿¯æjquery.addClass()æ¹æ³ 372 $(that)[0].className += " "+cls; 373 }, 374 375 //JSåçæ¹å¼-å é¤å ç´ æå®æ ·å¼ 376 removeClass: function removeClass(that, cls){ 377 if(this.isNull(that)){ 378 return; 379 } 380 var obj = $(that)[0]; 381 removed = obj.className.replace(new RegExp(cls,"gm"), ''); 382 removed = removed.replace(/(^\s+)|(\s+$)/g, '');//廿é¦å°¾ç©ºæ ¼ 383 obj.className = removed;//æ¿æ¢åæ¥ç class. 384 }, 385 386 //设置æµè§å¨cookie 387 setCookie: function(_3a,_3b){ 388 var secure = window.location.protocol; 389 if (secure == 'https:') { 390 document.cookie=_3a+"="+escape(_3b)+";path=/"+";secure;SameSite=None;expires="+(new Date(2099,12,31)).toGMTString(); 391 }else { 392 document.cookie=_3a+"="+escape(_3b)+";path=/"+";expires="+(new Date(2099,12,31)).toGMTString(); 393 } 394 }, 395 396 //è·åæµè§å¨cookie 397 getCookie: function(cookie_name) { 398 var allcookies = document.cookie; 399 var cookie_pos = allcookies.indexOf(cookie_name); 400 if (cookie_pos != -1) { 401 cookie_pos += cookie_name.length + 1; 402 var cookie_end = allcookies.indexOf(";", cookie_pos); 403 if (cookie_end == -1) { 404 cookie_end = allcookies.length; 405 } 406 var value = unescape(allcookies.substring(cookie_pos, cookie_end)); 407 } 408 return value; 409 }, 410 411 //ç»ä¸æé®ç¹å»ç½®ç° 412 disabledBtn: function(that, flag){ 413 if(flag){ 414 //æé®ç½®ç°ä¸å¯ç¹å» 415 this.disabledBtnCss[$(that).attr("class")] = $(that).css("background-color"); 416 $(that).attr("disabled",true); 417 $(that).css("background-color","#cccfd2"); 418 $(that).css("cursor","not-allowed"); 419 $(that).css("pointer-events","none"); 420 }else{ 421 $(that).attr("disabled",false); 422 $(that).css("background-color",this.disabledBtnCss[$(that).attr("class")]); 423 $(that).css("pointer-events",""); 424 $(that).css("cursor","pointer"); 425 } 426 } 427}
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.