Conjunto de métodos de matriz
Angela.array = {//# Método da Array // Índice, Retorno Posição! Se não existir, retorna -1; ÍNDICE: function (t, arr) {//# Retorna a posição da matriz em que o valor atual está localizado se (arr.IndexOF) {return arr.IndexOf (t); } para (var i = arr.length; i--;) {if (arr [i] === t) {return i * 1; }}; retornar -1; } // Retorna o valor -chave do objeto! O tipo de valor de retorno é uma matriz. , getKey: function (dados) {//# retorna todos os valores -chave do objeto var arr = [], k; para (k em dados) {arr.push (k); }; retornar arr; } // extraia aleatoriamente um valor da matriz, Random: function (matrizes) {//# extraia aleatoriamente um valor das matrizes Matriz = Matrizes || []; var len = Arrays.length, index = tydic.math.randint (0, len - 1); Retornar matrizes [índice] || ''; } // Deduplicação unidimensional da matriz, exclusiva: function (Array) {//## Array unidimensional Array Array = Array || []; para (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--; }}} retornar a matriz; } // max, o maior termo da matriz, max: function (array) {//#encontre o maior termo na matriz retornar math.max.apply (null, matriz); } // min, o menor termo da matriz, min: function (matriz) {//#Encontre o menor item da matriz retornar math.minmin.apply (null, matriz); } // Remova, remova, remova: function (matriz, valor) {//#remova um valor na matriz var comprimento = array.length; while (comprimento--) {if (value === Array [comprimento]) {Array.splice (comprimento, 1); }} retornar a matriz; } // Limpe a matriz, vazio: function (array) {//# limpe a matriz (matriz || []). Comprimento = 0; matriz de retorno; } // Removeat, exclua o valor da posição especificada //@índice, índice. Se o índice não for passado, o primeiro será excluído, removeat: function (matriz, index) {//#exclua o valor da posição especificada na matriz Array.splice (index, 1); matriz de retorno; } // Descobra a classificação da matriz, Shuffle: function (arr) {//#descarte a matriz VAR Array = (arr || []). Concat (), length = array.length, i = comprimento // viagens, tmp = null // temporário, rand = tydic.math.randint // posição, poss 0; while (i--) {pos = rand (0, comprimento); // Troque a posição aleatória tmp = matriz [POS]; Array [POS] = Array [i]; matriz [i] = tmp; } retornar a matriz; }};Conjunto de métodos de cookie
Angela.cookie = {//# cookie // O navegador suporta cookies o suficiente. enable: !! navegator.cookieenabled // leia cookie, get: function (nome) {//#leia cookie var reg = new regexp ("(^|)" + name + "(?: = ([^;]*))? (; | $)"), val = document.cookie.match (reg); retornar Val? (Val [2]? UNESCAPE (VAL [2]): ""): ''; } // Escreva cookies, set: function (nome, valor, expira, caminho, domínio, seguro) {//# write cookie var exp = new Date (), expires = argumentos [2] || nulo, caminho = argumentos [3] || "/", domínio = argumentos [4] || nulo, seguro = argumentos [5] || falso; expira? Exp.SetMinutes (Exp.getMinutes () + parseint (expira)): ""; document.cookie = nome + '=' + escape (valor) + (expira? '; expire =' + exp.togmtString (): '') + (path? '; path =' + path: '') + (domain? '; domain =' + domain: ') + (seguro?'; seguro: ''); } // excluir cookies, del: function (nome, caminho, domínio, seguro) {//#excluir cookies var valor = $ getCookie (nome); if (value! = null) {var exp = new Date (); Exp.SetMinutes (Exp.getMinutes () - 1000); caminho = caminho || "/"; document.cookie = nome + '=; expires =' + exp.togmtString () + (path? '; path =' + path: '') + (domain? '; domain =' + domain: '') + (seguro? '; seguro': ''); }}};URL Method Set
Angela.url = {//#url // Artigos: Nome da variável, se o URL estiver vazio, a tabela receberá o GetQuery do URL da página atual: function (nome, url) {var u = argumentos [1] || window.Location.Search, reg = new REGEXP ("(^| &)" + nome + "= ([^&]*) (& | $)"), r = U.substr (u.IndexOF ("?") + 1) .match (reg); retornar r! = nulo? r [2]: ""; }, gethash: function (nome, url) {//# obtenha o valor do hash var u = argumentos [1] || location.hash; var reg = novo regexp ("(^| &)" + nome + "= ([^&]*) (& | $)"); var r = u.substr (u.IndexOF ("#") + 1) .Match (reg); if (r! = null) {return r [2]; } retornar ""; }, parse: function (url) {//# parse url var a = document.createElement ('a'); url = url || document.location.href; a.href = url; Return {fonte: url, protocolo: a.protocol.replace (':', ''), host: a.hostname, port: a.port, consulta: a.search, arquivo: (a.pathname.match (/([^//? A.PathName.Rplace (/^([^//])/, '/$ 1'), relativo: (a.href.match (/tps?: //// [^//]+(.+)/) || [, '']) [1], segmentos: a.pathname.place (/^////, ''). }};Conjunto de métodos de expressão regular
Angela.Regexp = {//# String Match // Seja um número! número inteiro, número do ponto flutuante isnum: function (num) {//# é um retorno de matriz! isnan (num); }, ISEMAIL: function (Mail) {//# é uma caixa de correio retornar /^(a-z0-9 ]++. }, ISIDCARD: function (Card) {//# É um cartão de identificação retornar /^(/d {14 }|/d {17 « }, ismobile: function (móvel) {//# é um telefone retornar /^0*1/d {10 }$/.test(mobile); }, isqq: function (qq) {//# é um qq return /^-9-9by/d {4,10 }$/.test(qq); }, istel: function (tel) {//# é um telefone return /^/d {3,4a }-/d {7,8 }(-/d {1,6a Únia :?$/.text(tel); }, isurl: function (url) {//# é um url return /https?:////hea-z0-9/./--] {1,255 }/. }, iscolor: function (color) {//# se é uma cor hexadecimal retornar /#(/da-f] {3a) {1,2a }$/i.test(Color); } // @ID: cartão de identificação, // @Now: horário atual, como: new Date ('2013/12/12'), '2013/12/12' // @age: idade permitida, isadult: function (id, permitir, agora) {//# se é adulto var idade = 0 // ano, dia, dia, dia, agora, agora; allowage = parsefloat (allowage) || 18; agora = tipo de agora == 'string'? nova data (agora): (agora || new date ()); if (! this.isidcard (id)) {return false; } // cartão de identificação de 15 bits if (15 == id.length) {Age = '19' + id.slice (6, 6); } else {Age = id.slice (6, 14); } // Digite a idade inteira de conversão = ~~ Age; NowDate = ~~ (tydic.date.format ('yyyymmdd', agora)); // Compare a idade se (agora date - idade <allowage * 1e4) {return false; } retornar true; } // float, isfloat: function (num) {//# é um ponto flutuante retornar /^([.1-9 ]/d*)|(/d+/./d+)|0)$/.test(num); } // Inteiro positivo, ISINT: function (num) {//# se é um número inteiro positivo /^1-9 ]/d*$/.test(num); } // são todos os caracteres chineses, isquineses: function (str) {//# são todos os caracteres chineses retornam /^(/u4e00-/u9fa5]. }};Conjunto de métodos de sequência
Angela.String = {//# String codehtml: function (content) {//# Escape HTML Os caracteres retornam this.replace (content, {'&': "&", '"": "," "" ":", "," ":" <",">: "", "" "": ",'/t '/t'/t '/t'": "", "," ":", "" ":", "," "," ":" <" "*", '+': "+", ',': ",", '-': "-", '.': " } // Repita a sequência, repita: function (word, comprimento, extremidade) {//# repeat string end = end || ''; // Adicione ao último comprimento = ~~ Comprimento; Retornar nova matriz (comprimento * 1 + 1) .JOIN (Word) + '' + end; } // Adicione prefixo, addPre: function (pre, word, size) {//# maquiagem. Se você preceder 0 pré = pré || '0'; tamanho = parseint (tamanho) || 0; word = string (word || ''); var comprimento = math.max (0, tamanho - word.length); retornar this.RePeat (pré, comprimento, palavra); } // Remova os espaços de ambos os lados, TRIM: function (text) {//# Remova os espaços de ambos os lados retornam (texto || '') .place (/^/s+|/s $/, ''); } // String Substacement, substitua: function (str, re) {//# String Substacement str = str || ''; para (tecla var em re) {substituir (chave, re [key]); }; função substitua (a, b) {var arr = str.split (a); str = arr.Join (b); }; retornar str; }, xss: function (str, tipo) {//# xss escape // filtro vazio if (! str) {return str === 0? "0": ""; } switch (type) {case "html": // filtra xss em html string return str.replace (/[& '"<> //////-/x00-/x09/x0b-/x0c/x1f/x80-/xff]/g, função (r) {return "") .Place (// r/n/g ", <r />").replace(/n/g", <r />").replace(/r/g, "<r/>"); str.Replace (/[& '"<> ////-/x00-/x1f/x80-/xff]/g, function (r) {return" &#" + r.charcodeat (0) +"; "}); quebrar; case "url": // filtre o URL Return escape (str) .plique (//+/g, "%2b"); quebrar; case "miniurl": retornar str.preplace (/%/g, "%25"); quebrar; case "script": retorne str.Replace (/[// "']/g, function (r) {return" // " + r;}). substituir (/%/g", //x25").replace(//n/g, "//n").replace(//g," //r"). str.Replace (/////^/$/*/+/? (R) {Retorne "&#" + R.Charcodeat (0) + ";"}). Substitua (//G, "") .replace (// r/n/g ", <r />").replace(/n/g". "<Br />" />").replace(//r/g ", <r />"); quebrar;}} // badword, filtrar palavras sensíveis //@text: texto a ser filtrado, tipo: string //@palavras: palavras sensíveis, tipos, matriz, como: ['sua irmã', 'eu perdi', 'i DAMN'] // , Badword: function (texto, palavras) {//# text de filtragem de palavras sensíveis = string (texto || ''); var reg = novo regexp (words.join ('|'), 'g'), _self = this; Return text.Replace (reg, função ($ 0) {var comprimento = string ($ 0 || '') .Length; return _self.Repeat ('*', comprimento);}); }};Conjunto de métodos de criptografia
Angela.Encrypt = {//# CRIPTIÇÃO MD5: function (palavras) {//# md5 hash algorithmo/ * * Crypto-js 3.1.2 * http://code.google.com/p/crypto-js */var cryptojs = M.ls.l = p) {vars m. {vars M. {var = {{var m.l = {scrypto {scripto- js */var cyrpthon = {sl = {scode {scrypTo- j) = scrybrogh/scrypto (scrypto {scryprogh/crypto-js */var cryptoJS = m.l.l = p) {var m m.l = {vars m.l = {scrypto-js */varstojs = m.l = p). {}, r = l.base = {estend: function (b) {n.prototype = this; var h = novo n; b && h.mixin (b); H.HasownProperty ("init") || (h.init = function () {h. $ super.init.apply (this, argumentos)}); h.init.prototype = h; h. $ super = this; retornar h}, criar: function () {var b = this.extend (); B.Init.Apply (B, argumentos); retornar b}, init: function () {}, mixin: function (b) {for (var 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.wordArray = r.extend ({init: function: b, h) {b = this.s = b | 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) e 255) << 24 - 8 * (J + G) % 4); }, clamp: function () {var = this.words, h = this.sigbytes; Random: function (b) {for (var h = [], a = 0; a <b; a += 4) h.push (4294967296 * s.random () | 0); retornar novo q.init (h, b)}}), v = m.enc = {}, t = v.hex = {stringify: function (b) {var a = b.words; b = B.Sigbytes; for (var g = [], j = 0; j <b; j ++) {var k = a [j >>> 2] >>> 24 - 8 * (j % 4) e 255; g.push ((k >>> 4) .ToString (16)); G.Push ((K & 15) .ToString (16))} retorna 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) <<1) <<1/8) <<,8) < *, 16; Retornar novo 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) e 255)); Retorne g.join ("")}, parse: function (b) {for (var a = b.Length, g = [], j = 0; j <a; j ++) g [j >>> 2] | = (b.charcodeat (j) e 255) << 24 - 8 * (j % 4); Retorne novo q.init (g, a)}}, u = v.utf8 = {stringify: function (b) {tente {return decodeuricomponent (escape (a.stringify (b)))} catch (g) {tiro erro ("Data malformada utf-8"); }}, parse: function (b) {return a.parse (unescape (codeuricomponent (b)))}}, g = l.bufferedblockalgorithm = r.extend ({reset: function () {this._data = new q.init; this.ndatabytes =} (B = U.Parse (B); S.Max (M | clone: function () {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 ()}, atualize: function: function (b) (b) (b) (b); }, finalize: function (b) {b && this._append (b); k.hmac.init (b, g)). finalize (a)}}}); var k = m.algo = {}; retornar m} (matemática); (função (s) {função p (a, k, b, h, l, j, m) {a = a + (k & b | ~ k & h) + l + m; retorna (a << j | a >>> 32 - j) + k} função m (a, k, h, h, l, j, m) {a = a + (k & h | J) + K} função L (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m; + k} função n (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m; } para (var r = criptografia, q = r.lib, v = q.wordArray, t = q.hasher, q = r.algo, a = [], u = 0; this._hash = new V.init ([1732584193, 4023233417, 2562383102, 271733878])}, _doprocessblock: function (g, k) {para (var = 0; g [h] = (W << 8 | W >>> 24) e 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] 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, 22, A [3]), C = P (C, D, E, F, R, 7, A [4], [3]), C = P (C, C, E, F, R, 7, A [4], 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, d, d, e, x, 12, a [9]), e = p (e, f, c, d, 17, 12, 12, a [9]), e = p (e, f, c, d, 17, 12, 12, a [9]), e = p (e, f, c, d, 17, 12, 12, a [9]), e = p (e, f, c, d, 17, 12, 12, a [9]). 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, e, y, 9, a[21]), e = m(e, f, 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, 5, a[20]), f = m(f, c, d, e, y, 9, a[21]), e = m(e, f, c, c, c, d = m(d, e, f, c, 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, e, f, B, 5, a[28]), f = 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, c, f, a, 20, a [27]), c = m (c, d, e, c, f, a, 20, a [31]), c = c = c, c, d, e, c, f, a, 20, a [27]), c = c = m (c, d, e, c, f, a, 20, a. 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, z, 16, a[34]), d = l(d, e, f, c, C, 23, a[35]), c = l(c, d, e, f, w, 4, a[36]), f = l(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, d, d, q, 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[47]), c = n(c, d, e, f, h, 6, a[48]), f = n(f, c, d, e, u, 10, a[49]), e = n(e, f, c, d, e, u, 10, a[49]), e = n(e, f, c, c, c, c, d = n(d, e, f, c, s, 21, a[51]), c = n(c, d, e, f, A, 6, a[52]), f = n(f, c, d, e, q, 10, a[53]), e = n(e, f, c, d, y, 15, a[54]), d = n(d, e, f, c, w, 21, a[55]), c = n(c, d, e, f, v, 6, a[56]), f = n (f, c, d, e, 10, a [57]), e = n (e, f, c, d, t, 15, a [58]), d = n (d, e, f, c, b, b, 21, a [59]), c = n (c, d, e, e, e 6, a [a [59]), n (n (c, d, e, e, e 6, a [59]), n (c, c, e, e, r, 6, a [59]), n (n), n (c, e, e, e n, e n (d), n (e 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) e 4278255360; k [(h + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) e 16711935 | (b << 24 | l >>> 8) e 4278255360; k [(h + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) e 16711935 | (b << 24 | b >>> 9 << 4) + 14] = (b << 8 | b >>> 24) e 16711935 | (b << 24 | b >>> 8) e 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) e 16711935 | (h << 24 | h >>> 8) e 4278255360; retornar a}, clone: function () {var a = t.clone.call (this); a._hash = this._hash.clone (); retornar um}}); r.md5 = t._createHelper (q); r.hmacmd5 = t._createhmachelper (q)}) (matemática); return cryptojs.md5 (palavras) .toString (); } // sha1, sha1: function (palavras) {//# sha1 hashing algoritmo var cryptojs = function (e, m) {var p = {}, j = p.lib = {}, l = function () {}, f = j.base = {exTEND: function (a) {l.Prot; var c = novo l; a && c.mixin (a); C.HasownProperty ("init") || (c.init = function () {c. $ super.init.apply (this, argumentos)}); c.init.prototype = c; c. $ super = this; retornar C}, Criar: function () {var a = this.extend (); a.init.Apply (A, argumentos); retornar a}, init: function () {}, mixin: function (a) {for (var c em 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.wordArray = f.extend ({init: a, a, c) {a = this.ss = a. 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) e 255) << 24 - 8 * (d + b) % 4); }, clamp: 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); retornar novo n.init (c, a)}}), b = p.enc = {}, h = b.hex = {stringify: function (a) {var c = a.words; a = a.sigbytes; for (var b = [], d = 0; d <a; d ++) {var f = c [d >>> 2] >>> 24 - 8 * (d % 4) e 255; b.push ((f >>> 4) .ToString (16)); b.push ((f & 15) .ToString (16))} Retorne B.Join ("")}, parse: function (a) {for (var c = a.Length, b = [], d = 0; d <c; d += 2) b [d >>> 3] | Retornar novo n.init (b, c / 2)}}, g = b.latin1 = {stringify: function (a) {var c = a.words; a = a.sigbytes; for (var b = [], d = 0; d <a; d ++) b.push (string.fromCharcode (c [d >>> 2] >>> 24 - 8 * (d % 4) e 255)); retornar b.join ("")}, parse: function (a) {for (var c = a.Length, b = [], d = 0; d <c; d ++) b [d >>> 2] | = (a.charcodeat (d) e 255) << 24 - 8 * (d % 4); Retornar novo n.init (b, c)}}, r = b.utf8 = {stringify: function (a) {try {return decodeuricomponent (escape (g.Stringify (a)))} catch (c) {tiro erro ("Data malformada utf-8"); } }, parse: function (a) { return g.parse(unescape(encodeURIComponent(a))) } }, k = j.BufferedBlockAlgorithm = f.extend({ reset: function () { this._data = new n.init; this._nDataBytes = 0 }, _append: function (a) { "string" == typeof a && (A = R.Parse (a)); E.Max (H | 0) - this._minBuffersize, 0); clone: function () {var a = 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 ()}, atualize: function: function: (a) (a) (this); this; }, finalize: function (a) {a && this._append (a); s.hmac.init (a, f)). finalize (b)}}}); var s = p.algo = {}; retornar p} (matemática); (function () {var e = criptojs, m = e.lib, p = m.wordArray, j = m.hasher, l = [], m = e.algo.sha1 = j.extend ({_doreSet: function () {this._hash = new p.init ([1732584193, 402333333333333333333232332323332333233332333232323232323232332323013, 27332332332323232332323323323233232332333013. 3285377520])}, _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] C = L [a - 3] ^ L [a - 8] ^ L [a - 14] ^ L [a - 16]; 1859775393): ] + G | << 24 - H % 32; e [(h + 64 >>> 9 << 4) + 15] = b; f.Sigbytes = 4 * E.Length; this._process (); Retorne this._hash}, clone: function () {var e = j.clone.call (this); e._hash = this._hash.clone (); retornar e}}); e.sha1 = j._createHelper (m); e.hmacsha1 = j._createhmachelper (m)}) (); retornar Cryptojs.sha1 (palavras) .ToString (); } // time33 hash, time33: function (palavras) {//# time33 hash algoritmo palavras = palavras || ''; // hash time33 algoritmo para (var i = 0, len = words.length, hash = 5381; i <len; ++ i) {hash += (hash << 5) +words.charat (i) .charcodeat (); }; retornar hash & 0x7ffffffff; }}Método de data definido
Angela.date = {//# Data Hora //@S: Iniciar hora //@e: Hora de término //@n: hora atual, n isinarea: function (s, e, n) {//# Judge time Area var start = this.parse (s), end = this.parse (e), agora = parsefloat (n) || new Date (); start = math.min (start, fim); end = math.max (start, end); retornar agora> = Iniciar && agora <= end? Verdadeiro: falso; } // Converta caracteres em milissegundos //@Data: 2013-03-02 1: 2: 2, parse: function (date) {//# Format Hora retorna data.parse (data); //. 'corda' ? this.parse (tempo): (tempo || new Date ()); pré = pré || 'Semana'; // semanas nums = 'dia um, dois, três, quatro, cinco, seis'; retornar pre + nums [time.getday ()]; } //@formattype: yyyy, yy, mm //@time: new Date ('2013/11/12') //@Weeks: Day, duas, três, quatro, cinco, seis, formato: função: função (formattype, tempo, semanas) {// formato tempo de saída var = '0';; formattype = formattype || 'AAAA-MM-DD' Weeks = Weeks || 'Dia um, dois, três, quatro, cinco, seis'; tempo = tempo || new Date (); //FormatTyp.com Return (formattype || '') .replace (/yyyy | yyyy/g, time.getlyear (). time.getMonth () + 1, 2)) .Place (/m | m/g, time.getmonth () + 1) .place (/dd | dd/g, tydic.string.addpre (pre, time.getdate (), 2)) .replace (/d | d/g, time.getDate (). Tydic.string.addpre (pre, time.gethours (), 2)) .place (/h | h/g, time.gethours (). Tydic.string.addpre (pre, time.getSeconds (), 2)) .place (/s | s/g, time.getSeconds ()) .Place (/w/g, time.getday ()) .replace (/w/g, weeks [time.getday ()]); } // contagem regressiva, contagem regressiva: function (opt) {//# countdown var option = {nowimeTime: 0 // horário atual, 2013/02/01/01 18:30:30, final: 0 // Deadline, 2013/02/01/01 18:30, intervalo: 1 // intervalos de retorno, segundos, chamados: function (função (funcionários (dia) (intervalo, 1 // //) tempo de chamada para todos os dias (tempo}/ {} // retorno de chamada após conclusão}, opts = {}, timer = null; opts = tydic.extend (opção, opt); // horário atual if (! Opts.nowtime) {opts.nowtime = (new Date ()). GetTime (); } else {opts.nowtime = this.parse (opts.nowtime); } // horário atual if (! Opts.endtime) {opts.endtime = (new Date ()). GetTime (); } else {opts.endtime = this.parse (opts.endtime); } timer = setInterval (loop, opts.interval * 1e3); // loop função loop () {var ts = opts.endtime - opts.nowtime // Calcule os milissegundos restantes, dd = parseint (ts/ 8.64e7) // calcula as dias restantes, HH = parseint (ts/ 3,6e7 % 24) // calcula as horas restantes, mm = parserinhas (ts/ 3.6e7 % 24) // calcula as horas restantes, = parseint (ts/ 1e3 % 60) // calcule os segundos restantes; // O horário atual é decrementado opts. -wtime += opts.Interval * 1E3; if (ts <= 0) {clearInterval (timer); opts.Finaled (); } else {opts.called (dd, hh, mm, ss); }}}};Conjunto de métodos de detecção do navegador
Angela.browser = {//# navegador de navegador: {//# Categoria do kernel do navegador weixin: /micromessengion(///d/d/.l+)*/ // weChat Build Browser, mqq: /mqqbrowser(//w/d/.comer // // // //mqqbrowser(//w/d/.comser. /ucbrowser(///d/. ]+)*/ // UC navegador, Chrome: /(?:chrome|crios)(///d/d.+-+)*/ // Chrome Browse, Firefox: /firefox(//d/d/./20) // Open navegador, sougou: /sogoumobilebrowser(///d/.lemonest: /safari(//pon/d/. ]+)*/ // navegador seguro, ou seja: /sie/s(/d/. ]+)*/ // ie navegador} //@errcall: erro de chamada de erro, addfav: function (url, title, errcall) {//#add para os favoritos Try { } catch (e) {try {window.sidebar.addpanel (title, url, ''); } catch (e) {errcall (); }}}, // versão do navegador coreInit: function () {//#noadd var i = null, navegador = this.browSers, ua = window.navigator.userAgent.tolowerCase (), navegador = '', pos = 1; para (i em navegadores) {if (Brower = ua.match (navegadores [i])) {if (i == 'Opera') {pos = 2; } else {pos = 1; } this.version = (Brower [POS] || '') .replace (/[/// S]+/, ''); this.core = i; retornar i; }}} // detecta a versão do IE! Somente suportado IE: versão 5,6,7,8,9, ou seja: (function () {//# detecte a versão do ie! Somente suporte: IE5,6,7,8,9 var v = 3, div = document.createElement ('div.inner), all = div.getElementsByTagName (' i '); while (Div.inner), ']> <i> </i> <! [endif]->', todos [0]);Método JSON
Angela.json = {//# JSON Object // String torna -se JSON objeto Parse: function (data) {//# String de format, torne -se JSON Object var // json regexp rvalidchars =/^[/] ,: {}/s]*$/, rvalbraces =/(?:^|: |:: {}/S]*$/, rvalbraces =/(?:^|: |:) (?:/[ /// (?: ["//// bfnrt] | u [/da-fA-f] {4})/g, rvalidtokens = /"[^"//r/n ]*" pressado. if (window.json && window.json.parse) {return window.json.parse (dados); } if (data === null) {retornar dados; } if (typeof data === "string") {data = data.replace (/^/s+|/s+$/g, ''); if (data && rvalidchars.test (data.replace (rvalidescape, "@") .replace (rvalidtokens, "]") .replace (rvalidbraces, ""))) {return (new function ("return data)) (); } } retornar ''; }};Método estender
Angela.Extend = function () {//# Extensão de objeto var Target = Argumentos [0] || {}, i = 1, comprimento = argumentos.length, opções; if (typeof destino! = "objeto" && typeof alvo! = "function") alvo = {}; para (; i <length; i ++) {if ((opções = argumentos [i])! = null) {for (var nome em opções) {var copy = options [nome]; if (target === cópia) {continue; } if (copy! == indefinido) {target [nome] = cópia; }}}} retornar o destino;};Métodos do julgamento do tipo
/** Julgue se a variável Val é um tipo inteiro*/função isNumber (val) {retorna tipo de val === 'número' && isfinite (val);}/** julga se a variável val é um tipo boolean **/** juiz se o tipo de retorno {return typeof val === '{** ** ** ** JULKEAN (Val) {Return Typeof Val ==' ''; === 'String';}/** julgue se a variável val é indefinida*/função isundefined (val) {return typeof val ==== 'String';}/** julgue se a variável val é indefinida*/function/** Judge (val) {return typeof val === ''}/** Judge, se o objeto*** {Val) {Return Typeof ===== ''; (str === null || typeof str === 'indefinido') {return false; } retornar tipo de str === 'objeto';}/** julgue se a variável val é nula*/função isnull (val) {return val === null;}/** julga se a variável Arra é uma matriz*»}}}» »/function isarray1 (Arr) {return object.prototype.ToSTring.Apply (Arr) = [Arr) {Return Object.ProType.ToSTring.Apply (ARR) uma matriz*método 2*/função isarray2 (arr) {if (arr === null || typeof arr === 'indefinido') {return false; } retornar arr.Constructor === Array;}