Conjunto de métodos de matriz
Angela.array = {//# Método de matriz // índice, posición de retorno! Si no existe, devuelve -1; índice: función (t, arr) {//# Devuelve la posición de la matriz donde el valor actual se encuentra si (arr.indexof) {return arr.indexof (t); } for (var i = arr.length; i--;) {if (arr [i] === t) {return i * 1; }}; regreso -1; } // Devuelve el valor clave del objeto! El tipo de valor de retorno es una matriz. , getKey: function (data) {//# return todos los valores de clave del objeto var arr = [], k; para (k en datos) {arr.push (k); }; regresar arr; } // Extraiga aleatoriamente un valor de la matriz, aleatoria: function (matrices) {//# extrae aleatoriamente un valor de las matrices de matriz = matrices || []; var len = arrays.length, index = tydic.math.randint (0, len - 1); Matrices de retorno [índice] || ''; } // Deduplicación de matriz individual, único: function (array) {//# matriz de matriz Única Array = Array || []; for (var i = 0, len = array.length; i <len; i ++) {for (var j = i+1; j <array.length; j ++) {if (array [i] === array [j]) {array.splice (j, 1); J--; }}} matriz de retorno; } // max, el término más grande en la matriz, max: function (array) {//#encontrar el término más grande en la matriz return math.max.apply (null, array); } // min, el término más pequeño en la matriz, min: function (array) {//#encontrar el elemento más pequeño en la matriz return math.min.apply (null, matriz); } // Eliminar, eliminar, eliminar: function (array, valor) {//#eliminar un valor en la longitud var de la matriz = array.length; while (longitud--) {if (value === array [longitud]) {array.splice (longitud, 1); }} matriz de retorno; } // borrar la matriz, vacía: function (array) {//# borrar la matriz (matriz || []). Longitud = 0; matriz de devolución; } // Eliminar, eliminar el valor de la posición especificada //@index, índice. Si no se pasa el índice, el primero se eliminará, eliminará: function (array, index) {//#eliminar el valor de la posición especificada en la matriz matriz.splice (índice, 1); matriz de devolución; } // deseche el sort de matriz, shuffle: function (arr) {//#deseche la matriz sort var array = (arr || []). Concat (), longitud = array.length, i = longitud // viajar, tmp = null // temporal, rand = tydic.math.Randint // posicion, pos = 0; while (i--) {pos = rand (0, longitud); // intercambia la posición aleatoria tmp = array [pos]; matriz [pos] = array [i]; matriz [i] = tmp; } matriz de retorno; }};Conjunto de métodos de cookie
Angela.cookie = {//# Cookie // El navegador admite las cookies lo suficiente. enable: !! navigator.cookieEnabled // lea cookie, get: function (nombre) {//#lea cookie var reg = new Regexp ("(^|)" + nombre + "(?: = ([^;]*))? (; | $)"), val = document.cookie.match (reg); ¿Valor de devolución? (Val [2]? Unescape (Val [2]): ""): ''; } // Escribir cookies, establecer: función (nombre, valor, expirada, ruta, dominio, seguro) {//# escribir cookie var exp = new Date (), expires = argumentos [2] || nulo, ruta = argumentos [3] || "/", dominio = argumentos [4] || nulo, seguro = argumentos [5] || FALSO ; vence? exp.setMinutes (exp.getminutes () + parseInt (expires)): ""; document.cookie = name + '=' + escape (value) + (expires? '; expires =' + exp.togmtString (): '' ') + (ruta?'; ruta = ' + ruta:' ') + (dominio?'; Domain = ' + dominio:' ') + (seguro?'; seguro ':' '); } // Eliminar cookies, del: function (nombre, ruta, dominio, seguro) {//#Eliminar cookies var value = $ getcookie (nombre); if (value! = null) {var exp = new Date (); exp.SetMinutes (exp.getminutes () - 1000); ruta = ruta || "/"; document.cookie = name + '=; expires =' + exp.togmtString () + (ruta? '; Path =' + Path: '' ') + (Domain?'; Domain = ' + Domain:' ') + (Secure?'; Secure ':' '); }}};Conjunto de métodos de URL
Angela.url = {//#url // artículos: nombre de variable, si la URL está vacía, la tabla tomará GetQuery de la URL de la página actual: function (nombre, url) {var u = argumentos [1] || Window.location.search, reg = new Regexp ("(^| &)" + nombre + "= ([^&]*) (& | $)"), r = U.Substr (U.Indexof ("?") + 1) .match (reg); return r! = null? r [2]: ""; }, gethash: function (nombre, url) {//# obtener el valor hash var u = argumentos [1] || ubicación.hash; var reg = new Regexp ("(^| &)" + nombre + "= ([^&]*) (& | $)"); var r = U.Substr (U.Indexof ("#") + 1) .match (reg); if (r! = null) {return r [2]; } devolver ""; }, parse: function (url) {//# parse url var a = document.createElement ('a'); URL = URL || document.location.href; a.href = url; return { source: url , protocol: a.protocol.replace(':', '') , host: a.hostname , port: a.port , query: a.search , file: (a.pathname.match(/([^//?#]+)$/i) || [, ''])[1] , hash: a.hash.replace('#', '') , path: a.pathname.replace (/^([^//])/, '/$ 1'), relativo: (a.href.match (/tps?: //// [^//]+(.+)/) || [, ']) [1], segmentos: a.pathname.replace (/^///////////////; }};Conjunto de métodos de expresión regulares
Angela.regexp = {//# String Match // ¡Si es un número! entero, número de punto flotante isnum: function (num) {//# es un retorno de matriz! Isnan (num); }, isEmail: function (mail) {//# ¿Es un buzón de devolución /^(bar-Z0-9font>+igar_/-/.font>)*! }, isIDcard: function (tarjeta) {//# ¿Es una tarjeta de identificación return /^(/d /14hmhy? }, isMobile: function (mobile) {//# ¿Es un teléfono return /^0*1/d /110 }$/.test(mobile); }, ISQQ: function (qq) {//# es un return Qq /^fice1-9font>/d{4,10ht10 °/.test(qq); }, istel: function (Tel) {//# ¿Es un retorno de teléfono /^/d] {3,4h}-/d /7,8}(-/d /1,6') ??$/.text(tel); }, isUrl: function (url) {//# es un return de url /https?:////ima-z0-9/./-font> =1,255h}/.ima-9a-z/-font> =1,255h}/i.test(url); }, ISColor: function (color) {//# si es un color hexadecimal return /#(acar } // @ID: ID Card, // @Now: hora actual como: nueva fecha ('2013/12/12'), '2013/12/12' // @age: Age permitido, isadult: function (id, peaTage, ahora) {//# si la edad es la variedad de adultos = 0 // año de usuario, mes, día, ahora date] PeaTage = parsefloat (permitido) || 18; ahora = typeof Now == 'String'? nueva fecha (ahora): (ahora || nueva fecha ()); if (! this.isidCard (id)) {return false; } // tarjeta de identificación de 15 bits if (15 == id.length) {age = '19' + id.slice (6, 6); } else {age = id.slice (6, 14); } // escribe la edad del entero de conversión = ~~ edad; NowDate = ~~ (tydic.date.format ('yyyymmdd', ahora)); // Compare la edad if (NowDate - Age <Peakage * 1e4) {return false; } return verdadero; } // float, isfloat: function (num) {//# ¿Es un retorno de punto flotante /^((ículo1-9font>/d*)|(/d+/./d+)|0)$/.test(num); } // Integer positivo, iSInt: function (num) {//# si es un retorno entero positivo /^fic1-9font>/d*$/.test(num); } // ¿Es todos los caracteres chinos, ischinese: function (str) {//# es todos los caracteres chinos regresan /^([/u4e00-/u9fa5font>|`/ufe30-/uffa0font>)+$$/gi.test(str); }};Conjunto de métodos de cadena
Angela.String = {//# String CodeHtml: function (content) {//# Escape Html Los caracteres Devuelve esto.replace (content, {'&': "&", '":", ","' ": '', '<' ':" <",'> ':"> ",' ':", ",'/:" "", "," ("(", ",") '*': "*", '+': "+", ',': ", '--':"-", '.':". " } // Repita la cadena, repite: function (word, longitud, end) {//# repita string end = end || ''; // Agregar a la última longitud = ~~ Longitud; devolver una nueva matriz (longitud * 1 + 1) .Join (palabra) + '' + end; } // Agregar prefijo, addPre: function (pre, word, size) {//# maquillaje. Si precede 0 pre = pre || '0'; tamaño = parseint (tamaño) || 0; word = string (palabra || ''); Var longitud = Math.max (0, size - word.length); devuelve esto.repeat (pre, longitud, palabra); } // Eliminar espacios en ambos lados, TRIM: function (text) {//# Eliminar espacios en ambos lados return (text || '') .replace (/^/s+|/s $/, ''); } // reemplazo de cadena, reemplazar: function (str, re) {//# reemplazo de cadena str = str || ''; for (varilla var en re) {reemplazar (clave, re [clave]); }; Función reemplazar (a, b) {var arr = str.split (a); str = arr.join (b); }; regresar str; }, xss: function (str, type) {//# xssss escapar // filtro vacío if (! str) {return str === 0? "0": ""; } switch (type) {case "html": // filtro xss en html string return str.replace (/[& '"<> /////-/x00-/x09/x0b-/x0c/x1f/x80-/xff]/g, function (r) {return" &#" + r.charcodeat (0) +"; "}//////gern "). str.replace (/[& '"<> /////-/x00-/x1f/x80-/xff]/g, function (r) {return" &#" + r.charcodeat (0) +"; "}); romper; Caso "url": // Filtrar el escape de retorno de URL (str). replace (//+/g, "%2b"); romper; caso "miniurl": return str.replace (/%/g, "%25"); romper; caso "script": return str.replace (/[// "']/g, function (r) {return" // " + r;}). reemplazar (/%/g," //x25").replace(//n/g ", //n").replace(//r/g," //r °. "Reg": return str.replace (/fice///^/$/*/+/?//]/./(/)/+fontado/ g, function (a) {return "//" + a;}); Escape (str) .replace (/[[& '"<> /////////-/x00-/x09/x0b-/x0c/x1f/x80-/xff]/g, function (r) {return" />"). //@text: se filtrará, escriba: String //@palabras: palabras sensibles, matriz, como: ['tu hermana', 'perdo', 'maldito'] // var reg = new Regexp (words.Join ('|'), 'g'), _self = this; return text.replace (reg, function ($ 0) {var longitud = string ($ 0 || '' ') .length; return _Self.repeat ('*', longitud);}); }};Conjunto de métodos de cifrado
Angela.enCrypt = {//# CiCryption md5: function (words) {//# md5 hash algorithm/ * * crypto-js 3.1.2 * http://code.google.com/p/crypto-js */var cryptojs = function (s, p) {var m =}, l = M. = {}, n =} (} {} { }, r = l.base = {extender: function (b) {n.prototype = this; var h = nuevo n; b && h.mixin (b); H.HasownProperty ("init") || (h.init = function () {h. $ super.init.apply (this, argumentos)}); h.init.prototype = h; h. $ super = esto; return h}, create: function () {var b = this.extend (); B.Init.Apply (B, argumentos); return b}, init: function () {}, mixin: function (b) {for (var h h in b) b.hasownproperty (h) && (this [h] = b [h]); B.HasownProperty ("ToString") && (this.ToString = B.ToString)}, clone: function () {return this.init.prototype.extend (this)}}, q = l.wordwordenArray = r.extend ({init: function (b, h) {b = this.words = b || []; this.sigbytes b.length}, toString: function (b) {return (b || t) .Stringify (this)}, concat: function (b) {var h = this.words, a = b.words, j = this.sigbytes (a [g >>> 2] >>> 24 - 8 * (g % 4) y 255) << 24 - 8 * ((j + g) % 4); }, suplente: function () {var b = this.words, h = this.sigbytes; Random: function (b) {for (var h = [], a = 0; a <b; a += 4) h.push (4294967296 * s.random () | 0); return new Q.init (h, b)}}), v = m.enc = {}, t = v.hex = {Stringify: function (b) {var a = b.words; b = B.Sigbytes; para (var g = [], j = 0; j <b; j ++) {var k = a [j >>> 2] >>> 24 - 8 * (j % 4) y 255; g.push ((k >>> 4) .tostring (16)); g.push ((k & 15) .ToString (16))} return g.Join ("")}, parse: function (b) {for (var a = b.length, g = [], j = 0; j <a; j += 2) g [j >>> 3] | = parseint (b.substr (j, 2), 16) << 24 - 4 * (j); return new Q.init (g, a / 2)}}, a = v.latin1 = {stringify: function (b) {var a = b.words; b = B.Sigbytes; for (var g = [], j = 0; j <b; j ++) g.push (string.fromcharcode (a [j >>> 2] >>> 24 - 8 * (j % 4) y 255)); return g.Join ("")}, Parse: function (b) {for (var a = b.length, g = [], j = 0; j <a; j ++) g [j >>> 2] | = (b.charcodeat (j) y 255) << 24 - 8 * (j % 4); return new Q.init (g, a)}}, u = v.utf8 = {Stringify: function (b) {try {return decodeUnicOponent (escudo (a.stringify (b)))} catch (g) {Error de lanzamiento ("datos de UTF-8 malformados"); }}, parse: function (b) {return a.parse (unescape (encodeReRiCoMponent (b)))}}, g = l.bufferedBlockAlgorithm = r.extend ({reset: function () {this._data = new Q.init; this._ndataBytes = 0}, _append: function (b) {"" "" (b = U.Parse (b)); | {var b = r.clone.call (this); l.hasher = g.extend ({cfg: r.extend (), init: function (b) {this.cfg = this.cfg.extend (b); this.reset ()}, reset: function () {g.reset.call (this); this._doreset ()}, actualización: funcional }, finalizar: function (b) {b && this._append (b); k.hmac.init (b, g)). Finalize (a)}}}); var k = m.algo = {}; return m} (matemáticas); (función (s) {function p (a, k, b, h, l, j, m) {a = a + (k & b | ~ k & h) + l + m; return (a << j | a >>> 32 - j) + k} function m (a, k, b, h, j, m) {a = a + (k & h | b & ~ h) + l + m; regreso (A << A <ost J) + K} Función L (A, K, B, H, L, J, M) {a = A + (B ^ (K | ~ H)) + L + M; + k} función n (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m; } para (var r = cryptojs, q = r.lib, v = Q.wordArray, t = Q.hasher, Q = R.algo, a = [], u = 0; 64> u; u ++) a [u] = 4294967296 * s.abs (s.sin (u+1) | this._hash = new V.init ([1732584193, 4023233417, 2562383102, 2717333878])}, _doprocessblock: function (g, k) {for (var b = 0; 16> b; b ++) {var h = k+b, w = g [h]; G [H] = (W << 8 | W >>> 24) y 16711935 | (w << 24 | w >>> 8) & 4278255360 } var b = this._hash.words, h = g[k + 0], w = g[k + 1], j = g[k + 2], q = g[k + 3], r = g[k + 4], s = g[k + 5], t = g[k + 6], u = g[k + 7], v = g[k + 8], x = g[k + 9], y = g[k + 10], z = g[k + 11], A = g[k + 12], B = g[k + 13], C = g[k + 14], D = g[k + 15], c = b[0], d = b[1], e = b[2], f = b[3], c = p(c, d, e, f, h, 7, a[0]), f = P (F, C, D, E, W, 12, A [1]), E = P (E, F, C, D, J, 17, A [2]), D = P (D, E, F, C, Q, 2, 2, A [3]), C = P (C, D, E, F, R, 7, A [4]), F = P (F, C, D, E, S, S, 12, A [5]) d, t, 17, a[6]), d = p(d, e, f, c, u, 22, a[7]), c = p(c, d, e, f, v, 7, a[8]), f = p(f, c, d, e, x, 12, a[9]), e = p(e, f, c, d, y, 17, a[10]), d = p(d, e, f, c, z, 22, a[11]), c = p(c, d, e, f, A, 7, a[12]), f = p(f, c, d, e, B, 12, a[13]), e = p(e, f, c, d, C, 17, a[14]), d = p(d, e, f, c, D, 22, a[15]), c = m(c, d, e, f, w, 5, a[16]), f = M (F, C, D, E, T, 9, A [17]), E = M (E, F, C, D, D, Z, 14, A [18]), D = M (D, E, F, C, H, 20, A [19]), C = M (C, D, E, F, S, 5, A [20]), F = M (F, C, D, D, E, Y, 9, A [21], E = M (), E = M (M C, D, E, Y, 9, A [21]), E = M (E, F, C, C, C, H, 20, A [19]), C = M (C, D, E, F, S, S, 5, A [20]), F = M (F, C, D, E, Y, 9, A [21]), E = M (E, F, C, C, C, C, D = M (D, E, C, R, R, R, 20, R, 20 A [23]), C = M (C, D, E, F, X, 5, A [24]), F = M (F, C, D, E, C, 9, A [25]), E = M (E, F, C, D, Q, 14, A [26]), D = M (D, E, F, C, V, 20, A [27]), C = M (C, D, D M (F, C, D, E, J, 9, A [29]), E = M (E, F, C, D, U, 14, A [30]), D = M (D, E, F, C, A, 20, A [27]), C = M (C, D, E, F, C, A, 20, A [31]), C = L (C, D, E, F, S, 4, A [32] C, D, E, V, 11, A [33]), E = L (E, F, C, D, D, Z, 16, A [34]), D = L (D, E, F, C, D, D, Z, 16, A [34]), D = L (D, E, F, C, C, 23, A [35]), C = L (C, D, E, F, W, 4, 4, F, F, 2, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F, F. C, D, E, R, 11, A [37]), E = L (E, F, C, D, U, 16, A [38]), D = L (D, E, F, C, Y, 23, A [39]), C = L (C, D, E, F, B, 4, A [40]), F = 1, A [41]), E = L (E, F, C, C, D, D, 16, D, 16, D, 16, D, 16 a[42]), d = l(d, e, f, c, t, 23, a[43]), c = l(c, d, e, f, x, 4, a[44]), f = l(f, c, d, e, A, 11, a[45]), e = l(e, f, c, d, D, 16, a[46]), d = l(d, e, f, c, j, 23, a [4 47]), c = n (c, d, d, e, f, h, h, 6, a [48]), f = n (f, c, d, d, e, u, u, 10, 10, a [49]), e = n (e, f, c, d, e, u, u, 10, a [49]), e = n (e, c, c, c, c, c, c, d = n (d, e, f, c, c, c, C, 2, 2, 2, 2, a [51]) ] n (F, C, D, E, D, 10, A [57]), E = N (E, F, C, D, T, 15, A [58]), D = N (D, E, F, C, C, B, 21, A [59]), C = N (C, D, E, F, R, 6, A [60]), F = N (F, C, C, D, Z, 10, A [61], E = F, C, D, J, 15, A [62]), D = N (D, E, F, C, X, 21, A [63]); B [0] = B [0] + C | 0; B [1] = B [1] + D | 0; B [2] = B [2] + E | 0; B [3] = B [3] + F | 0}, _dofinalize: function () {var a = this._data, k = a.words, b = 8 * 16711935 | (l << 24 | l >>> 8) y 4278255360; K [(H + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) y 16711935 | (b << 24 | l >>> 8) y 4278255360; K [(H + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) y 16711935 | (b << 24 | b >>> 9 << 4) + 14] = (b << 8 | b >>> 24) y 16711935 | (b << 24 | b >>> 8) y 4278255360; a.sigbytes = 4 * (k.length + 1); this._process (); a = this._hash; k = A.Words; para (b = 0; 4> b; b ++) h = k [b], k [b] = (h << 8 | h >>> 24) y 16711935 | (H << 24 | H >>> 8) y 4278255360; return a}, clone: function () {var a = t.clone.call (this); a._hash = this._hash.clone (); devolver a}}); r.md5 = t._createhelper (q); r.hmacmd5 = t._createhmachelper (q)}) (matemáticas); return cryptojs.md5 (palabras) .ToString (); } // sha1, sha1: function (words) {//# sha1 algoritmo de algoritmo var cryptojs = function (e, m) {var p = {}, j = p.lib = {}, l = function () {}, f = j.base = {extend: function (a) {l.pototype = this; var c = nuevo l; a && c.mixin (a); C.HasownProperty ("init") || (c.init = function () {c. $ super.init.apply (this, argumentos)}); c.init.prototype = c; c. $ super = esto; return c}, create: function () {var a = this.extend (); a.init.apply (a, argumentos); return a}, init: function () {}, mixin: function (a) {for (var c en a) a.hasownproperty (c) && (this [c] = a [c]); A.HASOWNProperty ("ToString") && (this.ToString = A.ToString)}, clone: function () {return this.init.prototype.extend (this)}}, n = J.wastirArray = f.extend ({init: function (a, c) {a = this.words = a || []; this.sigbyty A.length}, toString: function (a) {return (a || h) .Stringify (this)}, concat: function (a) {var c = this.words, q = a.words, d = this.sigbytes (Q [b >>> 2] >>> 24 - 8 * (b % 4) y 255) << 24 - 8 * ((d + b) % 4); }, suplicar: function () {var a = this.words, c = this.sigbytes; Random: function (a) {for (var c = [], b = 0; b <a; b += 4) c.push (4294967296 * e.random () | 0); return new n.init (c, a)}}), b = p.enc = {}, h = b.hex = {stringify: function (a) {var c = a.words; a = a.sigbytes; para (var b = [], d = 0; d <a; d ++) {var f = c [d >>> 2] >>> 24 - 8 * (d % 4) y 255; b.push ((f >>> 4) .tostring (16)); b.push ((f & 15) .ToString (16))} return B.Join ("")}, Parse: function (a) {for (var c = a.length, b = [], d = 0; d <c; d += 2) b [d >>> 3] | = parseint (a.substr (d, 2), 16) << 24 - 4 * (d % 8); return new n.init (b, c / 2)}}, g = b.latin1 = {stringify: function (a) {var c = a.words; a = a.sigbytes; para (var b = [], d = 0; d <a; d ++) b.push (string.fromcharcode (c [d >>> 2] >>> 24 - 8 * (d % 4) y 255)); return b.Join ("")}, analiza: función (a) {for (var c = a.length, b = [], d = 0; d <c; d ++) b [d >>> 2] | = (a.charcodeat (d) y 255) << 24 - 8 * (d % 4); return new n.init (b, c)}}, r = b.utf8 = {stringify: function (a) {try {return decodeuricOponent (escudo (g.stringify (a)))} catch (c) {lanzar error ("datos de utf-8 malformados"); }}, Parse: function (a) {return g.parse (unescape (codeDoRiCoMponent (a)))}}, k = J.BufferedBlockalgorithm = f.extend ({reset: function () {this._data = nuevo n.init; this._ndataBytes = 0}, _append: function (a) (a = R.Parse (a)); 0) - this._MinBufferize, 0); = f.clone.call (this); j.hasher = k.extend ({cfg: f.extend (), init: function (a) {this.cfg = this.cfg.extend (a); this.reset ()}, reset: function () {k.reset.call (this); this._doreset ()}, actualización: function (a) {this._append (a); this (); }, finalizar: function (a) {a && this._append (a); s.hmac.init (a, f)). finalizar (b)}}}); var s = p.algo = {}; return p} (matemáticas); (function () {var e = cryptojs, m = e.lib, p = m.wasteArray, j = m.hasher, l = [], m = e.algo.sha1 = J.Extend ({_doreset: function () {this._hash = nuevo p.init ([1732584193, 4023233417, 2562383102, 271733333333333333333333333333333333RÁ 328537520])}, _DoprocessBlock: function (f, n) {for (var b = this._hash.words, h = b [0], g = b [1], e = b [2], k = b [3], j = b [4], a = 0; 80> a; a ++) {if (16> a) C = L [A - 3] ^ L [A - 8] ^ L [A - 14] ^ L [A - 16]; 1859775393): 60> A? ] + G | 24 - H % 32; E [(H + 64 >>> 9 << 4) + 15] = B; F.Sigbytes = 4 * E.Length; this._process (); return this._hash}, clone: function () {var e = j.clone.call (this); e._hash = this._hash.clone (); return e}}); E.SHA1 = J._CreateHelper (M); e.hmacsha1 = J._createhmachelper (m)}) (); return cryptojs.sha1 (palabras) .ToString (); } // TIME33 Hash, Time33: function (Words) {//# Time33 Hash Algorithm Words = Words || ''; // Hash Time33 Algoritmo para (var i = 0, len = words.length, hash = 5381; i <len; ++ i) {hash += (hash << 5) +words.charat (i) .charCodeat (); }; return hash & 0x7ffffffff; }}Conjunto de métodos de fecha
Angela.date = {//# hora de fecha //@s: hora de inicio //@e: final de final nueva fecha (); start = Math.min (inicio, final); end = Math.max (inicio, final); return ahora> = inicio && ahora <= end? verdadero: falso; } // Convertir caracteres a milisegundos //@fecha: 2013-03-02 1: 2: 2, parse: function (date) {//# hora de formato de retorno date.parse (fecha); //.replace(/-/g, '/')} //@hora, hora, como nueva fecha ('2013/11/10 0:12:12') //@pre, el prefijo de la semana, como: semana, semana //@nums, tales como: uno, dos, tres, cuatro y seis días, Getreek: function (tiempo, pre, nums) {//## obtenga el día 'cadena' ? this.parse (hora): (hora || nueva fecha ()); pre = pre || 'Semana'; // semanas nums = 'día uno, dos, tres, cuatro, cinco, seis'; return pre + nums [time.getday ()]; } //@formattype: aaa yyy, yy, mm //@hora: nueva fecha ('2013/11/12') //@semanas: día, dos, tres, cuatro, cinco, seis, format: function (formatType, tiempo, semanas) {// Formato Tiempo de salida var = '0'; FormatType = FormatType || 'Aaa-mm-dd' semanas = semanas || 'Día uno, dos, tres, cuatro, cinco, seis'; Tiempo = Tiempo || nueva fecha (); //Formattyp.com return (formatType || '') .replace (/yyyy | yyyy/g, time.getblyear ()) .replace (/yy | yy/g, tydic.string.addpre (pre, time.getblyear () % 100), 2) .Replace (/mm | mm/g, g, gel, Tydic.string.addpre (pre, time.getmonth () + 1, 2)) .replace (/m | m/g, time.getmonth () + 1) .replace (/dd | dd/g, tydic.string.addpre (pre, time.getDate (), 2). .replace (/hh | h/g, tydic.string.addpre (pre, time.gethours (), 2)) .replace (/h | h/g, time.gethours ()) .replace (/ii | ii/g, tydic.string.addpre (pre, time.getmines (), 2))). Time.getMinutes ()) .replace (/ss | ss/g, tydic.string.addpre (pre, time.getSeconds (), 2)) .replace (/s | s/g, tiempo.getSeconds ()) .replace (/w/g, g, g, g, getay (). } // Countdown, Countdown: function (opt) {//# Countdown var option = {NowTime: 0 // actual hora, 2013/02/01 18:30:30, endtime: 0 // fecha límite, 2013/02/01 18:30:30:30, interval: 1 // tiempo de devolución de intervalo, segundos, llamado: función (día, hora, segundo, minuto) {{{} /////wonalt, final de la devolución, finalización, finalización, finalizada (final). {} // devolución de llamada después de completar}, opts = {}, timer = null; opts = tydic.extend (opción, opt); // hora actual if (! Opts.nowtime) {opts.nowtime = (new date ()). Gettime (); } else {opts.nowtime = this.parse (opts.nowtime); } // hora actual if (! Opts.endtime) {opts.endtime = (new date ()). Gettime (); } else {opts.endtime = this.parse (opts.endtime); } timer = setInterval (loop, opts.interval * 1e3); // bucle function loop () {var ts = opts.endtime - opts.nowtime // calcule los milisegundos restantes, dd = parseint (ts/ 8.64e7) // Calcule los días restantes, hh = parseint (ts/ 3.6e7 % 24) // calcula las horas restantes, mm = parseint (TS/ 6E4 % 60) Parseint (TS/ 1E3 % 60) // Calcule los segundos restantes; // El tiempo actual es opts disminuidos. if (ts <= 0) {ClearInterval (temporizador); opts.finaled (); } else {opts.called (dd, hh, mm, ss); }}}};Método de detección del navegador establecido
Angela.browser = {//# navegadores de navegador: {//# Browser Kernel Category weixin: /micromessenger(//che/d/.font>)*/ // wechat browser incorporado, mqq: /mqqbrowser(/che/d/font>+)*// // mobile QQ Browser, UC: UC: UC:: UC:: UC:: UC:: UC:: UC:: /ucbrowser(//che/d/.font>+)*/ // uce browser, chrome: /(?:Chrome|crios)(//che/d/.font>)*)*/ // chrome browser, firefox:/firefox(//che/.font>)*)*/////firefox browser, opera: /perm Browser, Sougu: /SoGoUmobileBrowser(//§/d/.font>)*)*/ // Sogou Mobile Browser, Baidu: /Baidubrowser(/–/–/..nfont>+)*/ // Baidu Mobile Browser, 360: /360browser(bar(bar(ículo/ /Safari(//■/d/.font>)*/ // Safe Browser, es decir: /msie/s(umar } catch (e) {try {window.sidebar.addpanel (título, url, ''); } catch (e) {errcall (); }}}, // Versión de navegador coreInit: function () {//#noadd var i = null, browsers = this.browsers, ua = window.navigator.useragent.tolowercase (), browser = '', pos = 1; para (i en navegadores) {if (brower = ua.match (navegadores [i])) {if (i == 'ópera') {pos = 2; } else {pos = 1; } this.version = (brower [pos] || '') .replace (/[/// s]+/, ''); this.core = i; regresar i; }}} // ¡Detectar la versión IE! Solo es compatible con el IE: Versión 5,6,7,8,9, es decir: (function () {//### Versión de IE Versión solo: IE5,6,7,8,9 var v = 3, div = document.createElement ('div'), todos = div.getElementsBytagName ('i'); while (div.innerhtml = '<<!-[[gti +( +v) +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +( +) ( +( +( +( +( +( +( +( +( +( +) ( +( +( +( +( +( +( +( +( +( +( +( +( +( +) ( +( +( +( +( +( +( +( +) +( +( +( +( +( +( +) +( +( +( +) ']> <i> </i> <! [endif]->', todo [0]);Método JSON
Angela.json = {//# Json Object // String se convierte en JSON Object parse: function (data) {//# format string, convertirse en el objeto JSON var // json regexp rvalidchars =/^[/],:: {}/s]*$/, rvalidbross =/(?:^|: |,) (::/S*/[)+/g, rvalides /// (?: ["//// bfnrt] | u [/da-fa-f] {4})/g, rvalidTokens =//"–^"//r/nfontense*"|Truefalse|null|-?(?:/d+/.|)/d+(?:epciónfont>eptfontENniados?/d+|)/g; if (window.json && window.json.parse) {return window.json.parse (datos); } if (data === null) {return data; } if (typeof data === "String") {data = data.replace (/^/s+|/s+$/g, ''); if (data && rvalidchars.test (data.replace (rvalidScape, "@") .replace (rvalidTokens, "]") .replace (rvalidbraces, ""))) {return (nueva función ("return" + data)) ();); } } devolver ''; }};extender el método
Angela.extend = function () {//# Object Extension var Target = Arguments [0] || {}, i = 1, longitud = argumentos.length, opciones; if (typeof Target! = "Object" && typeof Target! = "function") Target = {}; for (; i <longitud; i ++) {if ((options = argumentos [i])! = null) {for (nombre var en opciones) {var copy = options [name]; if (target === Copy) {continuar; } if (copy! == Undefined) {Target [name] = copy; }}}} objetivo de retorno;};Métodos de juicio de tipo
/** Juzgue si la variable Val es un tipo de entero*/function isNumber (val) {return typeOf val === 'number' && isfinite (val);}/** juzga si la variable val es un tipo boolean*/function isboolean (val) {return typeOf val === 'boolean';}/** juzga si el Val Vale es un tipo de cadena*/function isst) === 'string';}/** juzgar si la variable val está indefinida*/function isundeFined (val) {return typeOf val ====== 'string';}/** juzga si la variable val es indefinida*/function isundefined (val) {return typeOf val ==== 'invasado';}/** JUEG (str === null || typeof str === 'undefined') {return false; } return typeOf str === 'objeto';}/** juzga si la variable val es null*/function isnull (val) {return val === null;}/** juzga si la variable arrray*método 1*/function isarray1 (arr) {return.prototype.ToString.apply (ARR) ==== '[Object]';};} una matriz*método 2*/function isArray2 (arr) {if (arr === null || typeof arr === 'undefined') {return false; } return arr.constructor === Array;}