//返回给定长度的随机字符串
function rans(a) {
var b, c, d;if (localStorage.getItem("rans")) return localStorage.getItem("rans");
for (a = a || 32, b = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678", c = b.length, d = "", i = 0; a > i; i++) d += b.charAt(Math.floor(Math.random() * c));
return localStorage.setItem("rans", d),
d
}
//获取cookie
function getCookie(a) {
var b = document.cookie,
c = b.indexOf("" + a + "=");
return - 1 == c && (c = b.indexOf(a + "=")),
-1 == c ? b = null: (c = b.indexOf("=", c) + 1, cookieEndAt = b.indexOf(";", c), -1 == cookieEndAt && (cookieEndAt = b.length), b = unescape(b.substring(c, cookieEndAt))),
b
}
//保存cookie 默认保存到根 ‘/’下
function writeCookie(a, b, c) {
var d = "";
null != c && (d = new Date((new Date).getTime() + 36e5 * c), d = "; expires=" + d.toGMTString()),
document.cookie = a + "=" + escape(b) + d + ";path=/"
}
//判断是否是微信
function isWeiXin() {
var a = window.navigator.userAgent.toLowerCase();
return "micromessenger" == a.match(/MicroMessenger/i) ? !0 : !1
}
//获取url参数
function getParams(a) {
function c() {
var a, b, f, c = /\+/g,
d = /([^&=]+)=?([^&]*)/g,
e = function(a) {
return decodeURIComponent(a.replace(c, " "))
};
for (f = window.location.hash.substring() ? window.location.hash.substring().split("?")[1] : window.location.search.substring(1), a = {}; b = d.exec(f);) a[e(b[1])] = e(b[2]);
return a
}
var b = c();
return b[a]
}
//判断手机是否是IphoneX
function isIphoneX() {
return navigator.userAgent.indexOf("iPhone") > -1 && 812 == screen.height && 375 == screen.width
}