📄 libs.js
字号:
/** * @author mooring * mysite: www.jcpan.com .still in process * please keep these comments if you want to use it addtionally. */function _getObj(id){ if ( document.getElementById ) { return document.getElementById(id); } else if ( document.all ) { return document.all[id]; } else if ( document.layers ) { return document.layers[id]; } else { return eval( id ); }}function _setCookie( key , value , day ){ var d = new Date(); d.setDate(d.getDate() + day); document.cookie = key + "=" + value + "; expires=" + d.toGMTString();}function _getCookie(key){ var cook = document.cookie; var pair = cook.split("; "); for(var i=0; i<pair.length; i++) { var tmp = pair[i].split("="); if(key == tmp[0]) { return tmp[1]; break; } } return false;}function xhr( method, url, para, callfunction ){ if ( method == null || method == undefined ||method == "undefined") { method = "get"; } if (url == null || url == undefined || url == "undefined" || url.length < 4) { return false; } if (sycho == null || sycho == undefined || sycho == "undefined") { sycho = true; } var ajax = null; var err = false; var sycho = true; try { if ( typeof XMLHttpRequest != "undefined" ) { ajax = new XMLHttpRequest(); } } catch (e) { if ( typeof ActiveXObject != "undefined" ) { try { ajax = new ActiveXObject("MSXML2.XMLHTTP.6.0"); } catch (e) { try { ajax = new ActiveXObject("MSXML2.XMLHTTP.3.0"); } catch (e) { try { ajax = new ActiveXObject("MSXML.XMLHTTP") } catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { err = true; throw new Error("Your Browser does not support Ajax"); } } } } } } if (!err) { if (callfunction == null || callfunction == undefined || callfunction == "undefined") { alert("Please input check your process function of the xhr() fourth prameter "); return false; } else { ajax.onreadystatechange = function() { if(ajax.readyState ==4 && ajax.status == 200) { callfunction(ajax.responseText); } }; } if (method.toString().toLowerCase() == "post") { ajax.open("POST", url, sycho); ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8"); ajax.send(para); } else { ajax.open("GET", url + "?" + para, sycho); ajax.send(null); } } else { alert("Error Occours"); return false; }}function PageCount(){ var x = window.location.pathname; var file = x.substr(x.lastIndexOf("/")+1,x.length); var proto = window.location.protocol; var pra = 'url=' + file ; this.Url = ""; this.Method = ""; this.setRequest = function(method,url) { this.Url = url; this.Method = method; }; this.Function = ""; this.SendRequest = function() { var tmp = _getCookie(file); if (file == tmp) { pra += "&visited=1"; } else { _setCookie(file, file, 1); pra += "&visited=0"; } if(navigator.cookieEnabled) { pra += "&cookie=1"; } else { pra += "&cookie=0"; } //alert(pra); xhr(this.Method, this.Url, pra, this.Function); };}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -