123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598 |
- var array_mask_Box = [];
- $.touchEvents = {
- start: $.support.touch ? "touchstart" : "mousedown",
- move: $.support.touch ? "touchmove" : "mousemove",
- end: $.support.touch ? "touchend" : "mouseup"
- },
- function (e) {
- e.extend({
- trimValue: function (e) {
- return e.replace(/(^\s*)|(\s*$)/g, "")
- },
- getReverse: function (e) {
- return e.split("").reverse().join("")
- },
- goTop: function (e) {
- e = e || 0,
- document.documentElement.scrollTop = document.body.scrollTop = e
- },
- isRegExp: function (e, t) {
- var n = "";
- switch (e) {
- case "isStr":
- n = /^[A-Za-z0-9_]+$/;
- break;
- case "isStr2":
- n = /^[A-Za-z0-9_\u4E00-\u9FA5\uF900-\uFA2D]+$/;
- break;
- case "isNumber":
- n = /^[-\+]?\d+(\.\d+)?$/;
- break;
- case "isNumber2":
- n = /^\d+(\.{0,1}\d+){0,1}$/;
- break;
- case "isInt":
- n = /^[-\+]?\d+$/;
- break;
- case "isInt2":
- n = /^[1-9]*[1-9][0-9]*$/;
- break;
- case "isInt3":
- n = /^[0-9]*[0-9][0-9]*$/;
- break;
- case "isEmail":
- n = /([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)/;
- break;
- case "isPhone":
- n = /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/;
- break;
- case "isMobile":
- n = /^[1]\d{10}$/;
- break;
- case "isIdCard":
- n = /(^\d{15}$)|(^\d{17}[0-9Xx]$)/;
- break;
- case "isMoney":
- n = /^\d+(\.\d+)?$/;
- break;
- case "isZip":
- n = /^[1-9]\d{5}$/;
- break;
- case "isQQ":
- n = /^[1-9]\d{4,10}$/;
- break;
- case "isEnglish":
- n = /^[A-Za-z]+$/;
- break;
- case "isChinese":
- n = /^[\u0391-\uFFE5]+$/;
- break;
- case "isUrl":
- n = /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
- break;
- case "isDate":
- n = /^\d{4}-\d{1,2}-\d{1,2}$/;
- break;
- case "isDatetime":
- n = /^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}$/;
- break;
- case "isPw":
- n = /^[a-zA-Z]\w{5,17}$/;
- break;
- case "isChina":
- n = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
- break;
- case "isIP":
- n = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
- break;
- default:
- n = ""
- }
- if ("" == n)
- return !1;
- var i = new RegExp(n);
- return i.test(t)
- },
- isAjaxLoad: !1,
- getAjaxData: function (t) {
- e.isAjaxLoad || (e.isAjaxLoad = 1 == t.isAjaxLoad,
- t = e.extend({
- url: "#",
- type: "POST",
- async: !0,
- cache: !0,
- data: {},
- callBack: function () { },
- errorBack: function () { }
- }, t),
- e.ajax({
- url: t.url,
- type: t.type,
- async: t.async,
- cache: t.cache,
- data: t.data,
- success: function (n) {
- if (e.isAjaxLoad = !1,
- 1 == n.status) {
- var i = n;
- i.params = t.params,
- t.callBack(i)
- } else
- t.errorBack(n)
- }
- }))
- },
- arryIndexOf: function (e, t) {
- for (var n in e)
- if (e[n] == t)
- return !0;
- return !1
- },
- replaceAll: function (e) {
- var t = e.strData
- , n = e.list;
- for (var i in n) {
- var r = ""
- , s = "";
- for (var a in n[i])
- r = a,
- s = n[i][a];
- r = r.replace("[", "\\[").replace("]", "\\]").replace("(", "\\(").replace(")", "\\)");
- var o = new RegExp(r, "g");
- t = t.replace(o, s)
- }
- return t
- },
- maxlenght: function (e, t) {
- return e.length > t && (e = e.substring(0, t) + "..."),
- e
- },
- inputMaxlenght: function (e, t) {
- var n = e.value;
- n.length > t && (e.value = n.substring(0, t))
- },
- getParameter: function (e) {
- var t = location.search;
- if (0 == t.length)
- return null;
- if ("?" != t.charAt(0))
- return null;
- if (t = unescape(t),
- t = t.substring(1),
- 0 == t.length)
- return null;
- for (var n = t.split("&"), i = 0; i < n.length; i++) {
- var r = n[i].split("=", 2);
- if (r[0] == e)
- return r.length < 2 || void 0 === r[1] || "undefined" == r[1] || "null" == r[1] ? "" : r[1]
- }
- return null
- },
- transWan: function (e, t) {
- var n = Number(e)
- , i = n / 1e4;
- if (i > 1) {
- i = i.toFixed(1);
- var r = i.split(".");
- n = 0 == r[1] ? r[0] + (t || langObj.transWan) : i + (t || langObj.transWan)
- }
- return n
- },
- setCookie: function (t, n, i) {
- var r = new Date
- , s = new Date;
- null == i && (i = 864e5),
- s.setTime(r.getTime() + i);
- var a = location.host;
- e.isRegExp("isIP", a.split(":")[0]) ? a = a.split(":")[0] : (a = a.split("."),
- a = 2 === a.length ? a.join(".") : a.slice(1).join(".")),
- document.cookie = encodeURIComponent(t) + "=" + encodeURIComponent(n) + "; expires=" + s.toGMTString() + ";path=/; domain=" + a + ";"
- },
- getCookie: function (e) {
- var t = encodeURIComponent(e) + "=";
- return document.cookie.length > 0 ? (offset = document.cookie.indexOf(t),
- -1 != offset ? (offset += t.length,
- end = document.cookie.indexOf(";", offset),
- -1 == end && (end = document.cookie.length),
- decodeURI(document.cookie.substring(offset, end))) : "") : ""
- },
- browserRedirect: function () {
- var e = navigator.userAgent.toLowerCase()
- , t = "ipad" == e.match(/ipad/i)
- , n = "iphone os" == e.match(/iphone os/i)
- , i = "midp" == e.match(/midp/i)
- , r = "rv:1.2.3.4" == e.match(/rv:1.2.3.4/i)
- , s = "ucweb" == e.match(/ucweb/i)
- , a = "android" == e.match(/android/i)
- , o = "windows ce" == e.match(/windows ce/i)
- , c = "windows mobile" == e.match(/windows mobile/i);
- return t || n || i || r || s || a || o || c ? "phone" : "pc"
- },
- isPhone: function () {
- var e = navigator.userAgent
- , t = (navigator.appVersion,
- !!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/));
- if (t)
- return "ios";
- var n = e.indexOf("Android") > -1 || e.indexOf("Linux") > -1;
- return n ? "android" : "other"
- },
- isWeiXinClient: function () {
- var e = window.navigator.userAgent.toLowerCase();
- return "micromessenger" == e.match(/MicroMessenger/i)
- },
- resUrl: function () {
- var e = location.search
- , t = [];
- if (-1 != e.indexOf("?")) {
- var n = e.substr(1);
- list = n.split("&");
- for (var i = 0; i < list.length; i++) {
- var r = list[i].split("=")
- , s = {};
- s[r[0]] = r[1],
- t.push(s)
- }
- var a = "";
- for (var o in t)
- for (var c in t[o])
- "" != c && "order_id" != c && (a += "&" + c + "=" + t[o][c]);
- e = a.substring(1)
- }
- return e
- },
- resetUrlParameter: function (e) {
- var t = location.search
- , n = [];
- if (-1 != t.indexOf("?")) {
- var i = t.substr(1);
- list = i.split("&");
- for (var r = 0; r < list.length; r++) {
- var s = list[r].split("=")
- , a = {};
- a[s[0]] = s[1],
- n.push(a)
- }
- var o = "";
- for (var c in n)
- for (var l in n[c])
- if ("" != l)
- if (e) {
- var h = "";
- for (var d in e)
- if (e[d] == l) {
- h = e[d];
- break
- }
- "" == h && (o += "&" + l + "=" + n[c][l])
- } else
- o += "&" + l + "=" + n[c][l];
- t = o.substring(1)
- }
- return t
- },
- changeUrlParameter: function (e, t) {
- if ("" == t) {
- var n = [];
- return arguments.length > 2 && (n = arguments[2]),
- "" != e && n.push(e),
- this.resetUrlParameter(n)
- }
- var i;
- arguments.length > 2 && (n = arguments[2]);
- var r = window.location.search;
- if (null != r && r.length > 1) {
- var s = r.substr(1)
- , a = s.split("&");
- if (s.indexOf(e) < 0)
- s += "&" + e + "=" + t;
- else
- for (var o = 0; o < a.length; o++) {
- var c = a[o].split("=");
- if (c[0] == e) {
- s = s.replace(a[o], e + "=" + t);
- break
- }
- }
- if (null != n && n.length > 0) {
- var l = n.split("&");
- for (o = 0; o < l.length; o++) {
- for (var h = !1, d = l[o].split("="), u = 0; u < a.length; u++) {
- c = a[u].split("=");
- if (c[0] == d[0]) {
- h = !0,
- s = s.replace(a[u], l[o]);
- break
- }
- }
- h || (s += "&" + l[o])
- }
- }
- i = location.pathname + "?" + s
- } else
- i = location.href + "?" + e + "=" + t,
- null != n && n.length > 0 && (i += n);
- return i
- },
- minedomainName: function (e) {
- var t = "://"
- , n = e.indexOf(t);
- n >= 0 && (n += t.length,
- e = e.slice(n)),
- e = e.split("/")[0];
- var i = e.split(".");
- return len = i.length,
- i[len - 2] + "." + i[len - 1]
- },
- isminiprogram: function (t) {
- if ("miniprogram" === window.__wxjs_environment) {
- var n = [".720think.com", ".wasee.com", ".v123.cn", ".sh0100.com", ".sh0001.com", ".sh0010.com", ".sh1001.com", ".sh0111.com", ".sh0110.com", ".sh1011.com", ".yy0010.com", ".yy0100.com", ".yy1101.com"]
- , i = (t = e.minedomainName(t),
- !1);
- for (key in n)
- if (1 == n[key].indexOf(t)) {
- i = !0;
- break
- }
- return !!i || (e.toast("小程序不支持打开非业务域名", "text"),
- !1)
- }
- return !0
- },
- timeModule: {
- formatTime: function (e) {
- var t = e.split(" ")
- , n = t[0].split("-");
- if (1 == n.length)
- n = t[0].split("/");
- var i = parseInt(n[0], 10)
- , r = parseInt(n[1], 10) - 1
- , s = parseInt(n[2], 10)
- , a = 0
- , o = 0
- , c = 0;
- if (t[1]) {
- var l = t[1].split(":");
- a = parseInt(l[0], 10),
- o = parseInt(l[1], 10),
- c = parseInt(l[2], 10)
- }
- var h = new Date(i, r, s, a, o, c);
- return h
- },
- compareTime: function (e, t) {
- var n = this
- , i = n.formatTime(e)
- , r = n.formatTime(t)
- , s = i.getTime() - r.getTime();
- return s
- }
- },
- fullScreen: function () {
- var e = document.documentElement
- , t = e.requestFullScreen || e.webkitRequestFullScreen || e.mozRequestFullScreen || e.msRequestFullscreen;
- void 0 !== t && t && t.call(e)
- },
- exitScreen: function () {
- document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen()
- },
- syRunHorseLight: function (t, n, i) {
- t || (t = "syNoticeUlNew"),
- n || (n = 1),
- "undefined" != typeof syTimer && clearInterval(syTimer);
- var r = document.getElementById(t);
- if (null != r) {
- i || (i = "li");
- for (var s = r.getElementsByTagName(i), a = 0, o = 0; o < s.length; o++)
- a += s[o].offsetWidth + 16;
- var c = document.getElementsByClassName("syNoticeUlbody")[0].offsetWidth;
- r.style.paddingLeft = c + "px",
- r.style.paddingRight = c + "px",
- r.style.width = a + 2 * c + "px",
- a = r.offsetWidth - c;
- var l = 0;
- syTimer = setInterval(function () {
- l -= n,
- l <= -a && (l = 0),
- r.style.left = l + "px"
- }, 20),
- "pc" == e.browserRedirect() && e("#syNoticeUlNew").hover(function () {
- clearInterval(syTimer)
- }, function () {
- clearInterval(syTimer),
- syTimer = setInterval(function () {
- l -= n,
- l <= -a && (l = 0),
- r.style.left = l + "px"
- }, 20)
- })
- }
- },
- isJSONstr: function (e) {
- if ("string" != typeof e)
- return !1;
- try {
- var t = JSON.parse(e);
- return !("object" != typeof t || !t)
- } catch (e) {
- return !1
- }
- },
- addJavascript: function (t) {
- e.ajax({
- url: t.src,
- dataType: "script",
- cache: !0
- }).done(function () {
- "function" == typeof t.callBack && t.callBack()
- })
- }
- }),
- e(document).on("click", ".mask_Box_overlay", function () {
- console.log("array_mask_Box.length=" + array_mask_Box.length),
- e(this).removeClass("on"),
- array_mask_Box.length > 0 ? (e(array_mask_Box[array_mask_Box.length - 1]).removeClass("on"),
- array_mask_Box.pop(),
- console.log("pop后array_mask_Box=" + JSON.stringify(array_mask_Box))) : e(".mask_Box.on:last").removeClass("on"),
- e("body,html").removeClass("ov__hidden")
- }).on("click", ".weui-mask", function () {
- e(".weui-dialog__btn.default").length > 0 && e(".weui-dialog__btn.default").click()
- }).on(e.support.touch ? "touchend" : "click", ".mBoxbg", function () {
- "false" != e(this).attr("data-close") && (e(".windowBody.on:last,.mBoxbg.on:last").removeClass("on"),
- e(this).hasClass("remove") && setTimeout(function () {
- e(".windowBody:last,.mBoxbg:last").remove()
- }, 300))
- })
- }(jQuery),
- $.support = function () {
- var e = {
- touch: !!("ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch)
- };
- return e
- }(),
- $.getTouchPosition = function (e) {
- return e = e.originalEvent || e,
- "touchstart" === e.type || "touchmove" === e.type || "touchend" === e.type ? {
- x: e.targetTouches[0].pageX,
- y: e.targetTouches[0].pageY
- } : {
- x: e.pageX,
- y: e.pageY
- }
- }
- ;
- var timeModule = {
- formatTime: function (e) {
- var t = e.split(" ")
- , n = t[0].split("-");
- if (1 == n.length)
- n = t[0].split("/");
- var i = parseInt(n[0], 10)
- , r = parseInt(n[1], 10) - 1
- , s = parseInt(n[2], 10)
- , a = 0
- , o = 0
- , c = 0;
- if (t[1]) {
- var l = t[1].split(":");
- a = parseInt(l[0], 10),
- o = parseInt(l[1], 10),
- c = parseInt(l[2], 10)
- }
- var h = new Date(i, r, s, a, o, c);
- return h
- },
- compareTime: function (e, t) {
- var n = this
- , i = n.formatTime(e)
- , r = n.formatTime(t)
- , s = i.getTime() - r.getTime();
- return s
- }
- };
- Date.prototype.Format = function (e) {
- var t = {
- "M+": this.getMonth() + 1,
- "d+": this.getDate(),
- "h+": this.getHours(),
- "m+": this.getMinutes(),
- "s+": this.getSeconds(),
- "q+": Math.floor((this.getMonth() + 3) / 3),
- S: this.getMilliseconds()
- };
- for (var n in /(y+)/.test(e) && (e = e.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))),
- t)
- new RegExp("(" + n + ")").test(e) && (e = e.replace(RegExp.$1, 1 == RegExp.$1.length ? t[n] : ("00" + t[n]).substr(("" + t[n]).length)));
- return e
- }
- !function (e) {
- "use strict";
- var t = function (t, n) {
- this.container = e(t),
- this.handler = this.container.find(".slider__handler"),
- this.track = this.container.find(".slider__track"),
- this.track__checked = this.container.find(".track__checked"),
- this.style__type = e(t).attr("type"),
- this.maxmin = e(t).attr("maxmin"),
- this.bind(),
- "function" == typeof n && (this.callback = n)
- };
- t.prototype.bind = function () {
- this.container.on(e.touchEvents.start, e.proxy(this.touchStart, this)).on(e.touchEvents.end, e.proxy(this.touchEnd, this)),
- e(document.body).on(e.touchEvents.move, e.proxy(this.touchMove, this)).on(e.touchEvents.end, e.proxy(this.touchEnd, this))
- }
- ,
- t.prototype.touchStart = function (t) {
- t.preventDefault(),
- this.handler = this.container.find(window.slider__handler ? window.slider__handler : ".slider__handler"),
- this.start = e.getTouchPosition(t),
- this.width = this.track.width(),
- this.height = this.track.height(),
- this.left = Number(this.handler.css("left").split("px")[0]),
- this.bottom = Number(this.handler.css("bottom").split("px")[0]),
- this.touching = !0
- }
- ,
- t.prototype.touchMove = function (t) {
- if (!this.touching || this.container.find(".slider__handler").length > 1 && !window.slider__handler)
- return !0;
- var n = e.getTouchPosition(t);
- if ("1" == this.style__type) {
- var i = this.start.y - n.y
- , r = i + this.bottom
- , s = r / this.height * 100;
- this.width = this.height;
- var a = "bottom"
- } else
- i = n.x - this.start.x,
- r = i + this.left,
- s = r / this.width * 100,
- a = "left";
- if (s < 0 && (s = 0),
- s > 100 && (s = 100),
- window.slider__handler && window.slider__handler.indexOf(".slider__handler.left") > -1) {
- var o = this.container.find(".slider__handler.center").length > 0 ? Number(this.container.find(".slider__handler.center").css(a).split("px")[0]) / this.width * 100 : this.container.find(".slider__handler.right").length > 0 ? Number(this.container.find(".slider__handler.right").css(a).split("px")[0]) / this.width * 100 : 100;
- "1" == this.style__type ? ("no" != this.maxmin && s > o && (s = o),
- this.handler.css("bottom", s + "%"),
- this.track__checked.css("bottom", s + "%")) : ("no" != this.maxmin && s > o && (s = o),
- this.handler.css("left", s + "%"),
- this.track__checked.css("left", s + "%"))
- } else if (window.slider__handler && window.slider__handler.indexOf(".slider__handler.right") > -1) {
- var c = this.container.find(".slider__handler.center").length > 0 ? Number(this.container.find(".slider__handler.center").css(a).split("px")[0]) / this.width * 100 : this.container.find(".slider__handler.left").length > 0 ? Number(this.container.find(".slider__handler.left").css(a).split("px")[0]) / this.width * 100 : 0;
- "1" == this.style__type ? ("no" != this.maxmin && s < c && (s = c),
- this.handler.css("bottom", s + "%"),
- this.track__checked.css("top", 100 - s + "%")) : ("no" != this.maxmin && s < c && (s = c),
- this.handler.css("left", s + "%"),
- this.track__checked.css("right", 100 - s + "%"))
- } else if (window.slider__handler && window.slider__handler.indexOf(".slider__handler.center") > -1) {
- c = this.container.find(".slider__handler.left").length > 0 ? Number(this.container.find(".slider__handler.left").css(a).split("px")[0]) / this.width * 100 : 0,
- o = this.container.find(".slider__handler.right").length > 0 ? Number(this.container.find(".slider__handler.right").css(a).split("px")[0]) / this.width * 100 : 100;
- s < c ? s = c : s > o && (s = o),
- "1" == this.style__type ? this.handler.css("bottom", s + "%") : this.handler.css("left", s + "%")
- } else
- "1" == this.style__type ? (this.handler.css("top", s + "%"),
- this.track__checked.css("height", s + "%")) : (this.handler.css("left", s + "%"),
- this.track__checked.css("width", s + "%"));
- this.callback && this.callback.call(this, s),
- this.container.trigger("change", s)
- }
- ,
- t.prototype.touchEnd = function (e) {
- window.slider__handler && setTimeout(function () {
- delete window.slider__handler
- }, 100),
- this.touching && (this.touching = !1)
- }
- ,
- e.fn.setslider = function (n) {
- this.each(function () {
- var i = e(this)
- , r = "setslider"
- , s = i.data(r);
- if (s)
- return s;
- i.data(r, new t(this, n))
- })
- }
- }($);
|