Ensemble de méthodes de tableau
Angela.array = {// # Méthode du tableau // index, position de retour! S'il n'existe pas, il renvoie -1; Index: fonction (t, arr) {// # Renvoie la position du tableau où la valeur actuelle est située if (arr.indexof) {return arr.indexof (t); } pour (var i = arr.length; i--;) {if (arr [i] === t) {return i * 1; }}; retour -1; } // Renvoie la valeur clé de l'objet! Le type de valeur de retour est un tableau. , getKey: function (data) {// # renvoie toutes les valeurs de clé de l'objet var arr = [], k; pour (k en données) {arr.push (k); }; retour arr; } // Extraire au hasard une valeur du tableau, aléatoire: fonction (tableaux) {// # Extraire au hasard une valeur des tableaux de tableau = arrays || []; var len = arrays.length, index = tydic.math.randint (0, len - 1); return tableaux [index] || ''; } // Deduplication de tableau unique en une dimension, unique: fonction (array) {// # Array array a dimensional array 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-; }}} Return Array; } // max, le plus grand terme du tableau, max: fonction (array) {// # trouvez le terme le plus grand dans le tableau de retour math.max.apply (null, array); } // min, le plus petit terme du tableau, min: function (array) {// # trouvez le plus petit élément du tableau return math.min.apply (null, array); } // supprime, supprimer, supprimer: fonction (array, valeur) {// # supprimez une valeur dans le tableau var longueur = array.length; while (longueur--) {if (value === array [longueur]) {array.splice (longueur, 1); }} Return Array; } // Effacer le tableau, vide: fonction (array) {// # effacer le tableau (array || []). Length = 0; Tableau de retour; } // Supprimer, supprimer la valeur de la position spécifiée // @ index, index. Si l'index n'est pas passé, le premier sera supprimé, supprimez: fonction (tableau, index) {// # supprimer la valeur de la position spécifiée dans le tableau array.splice (index, 1); Tableau de retour; } // Scrap le tri du tableau, shuffle: function (arr) {// # Scrap le tri de tableau var array = (arr || []). Concat (), longueur = array.length, i = longueur // voyage, tmp = null // temporaire, rand = tydic.math.randint // position, pos = 0; while (i--) {pos = rand (0, longueur); // échange la position aléatoire tmp = array [pos]; array [pos] = array [i]; array [i] = tmp; } Return Array; }};Ensemble de méthodes de cookie
Angela.cookie = {// # cookie // Le navigateur prend suffisamment de cookies. activer: !! Navigator.cookieEenabled // Lire cookie, get: function (name) {// # read cookie var reg = new regexp ("(^ |)" + name + "(?: = ([^;] *))? (; | $)"), val = document.cookie.match (reg); Retour Val? (val [2]? Unescape (val [2]): ""): ''; } // Écrivez des cookies, set: function (nom, valeur, expire, chemin, domaine, sécurisé) {// # écriture cookie var exp = new Date (), expires = arguments [2] || NULL, PATH = Arguments [3] || "/", domaine = arguments [4] || null, sécurisé = arguments [5] || FAUX ; expire? exp.setMinutes (exp.getMinutes () + parseInt (expire)): ""; document.cookie = name + '=' + Escape (valeur) + (expire? '; expires =' + exp.togmtString (): '') + (path? '; path =' + path: '') + (domain? '; domain =' + domaine: '') + (sécurisé? '; Secure': '); } // Supprimer les cookies, del: fonction (nom, chemin, domaine, sécurisé) {// # delete cookies var value = $ getcookie (name); if (valeur! = null) {var exp = new Date (); exp.setMinutes (exp.getMinutes () - 1000); chemin = chemin || "/"; document.cookie = name + '=; expires =' + exp.togmtString () + (path? '; path =' + path: '') + (domain? '; domain =' + domaine: '') + (sécurisé? '; Secure': ''); }}};Ensemble de méthode d'URL
Angela.url = {// # URL // Articles: Nom de la variable, si l'URL est vide, le tableau prendra GetQuery à partir de l'URL de la page actuelle: fonction (nom, URL) {var u = arguments [1] || window.location.search, reg = new regexp ("(^ | &)" + name + "= ([^ &] *) (& | $)"), r = u.substr (U.Indexof ("?") + 1) .match (reg); Retour R! = NULL? r [2]: ""; }, gethash: function (nom, url) {// # get la valeur de hachage var u = arguments [1] || emplacement.hash; var reg = new regexp ("(^ | &)" + name + "= ([^ &] *) (& | $)"); var r = U.Substr (U.Indexof ("#") + 1) .match (reg); if (r! = null) {return r [2]; } retour ""; }, parse: function (url) {// # parse url var a = document.createelement ('a'); url = url || document.location.href; a.href = url; return {source: url, protocole: a.protocol.replace (':', ''), hôte: a.hostname, port: a.port, query: a.search, fichier: (a.pathname.match (/ [^ //? #] +) $ / i) || [, '']) [1], hash: a.hash.replace ('#' '') a.pathname.replace (/ ^ ([^ //]) /, '/ $ 1'), relatif: (a.href.match (/ tps?: //// [^ //] + (. +) /) || [, ']) [1], segments: a.pathname.replace (/ ^///' '). }};Ensemble de méthodes d'expression régulière
Angela.Regexp = {// # String Match // Si c'est un nombre! entier, numéro de point flottant isNum: fonction (num) {// # est-ce un return de tableau! Isnan (num); }, iSemail: fonction (mail) {// # est-ce un retour de boîte aux lettres /^(atua-z0-9. }, iSidCard: fonction (carte) {// # est-ce une carte d'identité return /^(/d{14 }|/d{17 })(/dersx }, Ismobile: fonction (mobile) {// # est-ce un téléphone return /^0*1/d{10 }$/.Test(Mobile); }, ISQQ: fonction (qq) {// # est-ce un qq return /^@1-9 /d/d{4,10 }$/.Test(qq); }, iStel: function (tel) {// # est-ce un téléphone return /^/d{3,4 }-/d{7,8 }(-/d{1,6 })?$/.Text(Tel); }, ISURL: fonction (url) {// # est-ce un retour d'URL /https?:////[a-z0-9/./- }, isColor: function (couleur) {// # si c'est une couleur hexadécimale return /#(@/da-f } // @ id: carte d'identité, // @Now: Heure actuelle telle que: new Date ('2013/12/12'), '2013/12/12' // @age: âge autorisé, Isadult: fonction (id, allocation, maintenant) {// # si l'âge est adulte var âge = 0 // day, jour, jour, jour, maintenant = 0 // allocation = parsefloat (allocation) || 18 maintenant = typeof maintenant == 'String'? Nouvelle date (maintenant): (maintenant || new Date ()); if (! this.isidcard (id)) {return false; } // carte d'identification 15 bits if (15 == id.length) {age = '19' + id.slice (6, 6); } else {age = id.slice (6, 14); } // Type de conversion entier Âge = ~~ Age; NowDate = ~~ (tydic.date.format ('yyyymmdd', maintenant)); // Comparez l'âge if (NowDate - Age <Autorité * 1E4) {return false; } return true; } // float, isfloat: function (num) {// # est-ce un point flottant return /^((@1-9. } // entier positif, isInt: function (num) {// # si c'est un rendement entier positif /^^1-9 } // Est-ce que c'est tous des caractères chinois, Ischinese: fonction (str) {// # est-ce que tout est return des caractères chinois /^(@/U4E00-/U9FA5. }};Défini des méthodes de chaîne
Angela.string = {// # String code CodeHtml: fonction (contenu) {// # les caractères html Escape return this.replace (contenu, {'&': "&", '' ': "", "'": "','," "", '(":" "") "*", '+': "+", ',': ",", '-': "-", '.': ".". } // répéter la chaîne, répéter: fonction (mot, longueur, end) {// # répéter la chaîne end = end || ''; // ajouter à la dernière longueur = ~~ la longueur; Renvoie un nouveau tableau (longueur * 1 + 1) .join (mot) + '' + end; } // Ajouter le préfixe, addpre: fonction (pre, word, taille) {// # maquillage. Si vous précédez 0 pre = pre || '0'; size = paSeInt (taille) || 0; word = string (word || ''); var longueur = math.max (0, size - word.length); Renvoie ce.Repeat (pré, longueur, mot); } // Supprime les espaces des deux côtés, TRIM: fonction (texte) {// # Supprimer les espaces des deux côtés return (texte || '') .replace (/ ^ / s + | / s $ /, ''); } // Remplacement de chaîne, remplacer: fonction (str, re) {// # remplacement de chaîne str = str || ''; for (var key in re) {Remplace (key, re [key]); }; Fonction Remplace (a, b) {var arr = str.split (a); str = arr.join (b); }; retour STR; }, XSS: fonction (str, type) {// # xss Escape // Filtre vide if (! str) {return str === 0? "0": ""; } commutateur (type) {case "html": // filtre xSS dans la chaîne html return str.replace (/ [& '"<> ///// - / x00- / x09 / x0b- / x0c / x1f / x80- / xff] / g, function (r) {return" & # "+ r.charcodeat (0) +"; "}). "") .replace (// r / n / g, "<br />": str.replace (/ [& '"<> /////// - / x00- / x1f / x80- / xff] / g, fonction (r) {return" & # "+ r.charcodeat (0) +"; "}); casser; case "URL": // Filtrez la fuite de retour d'URL (str) .replace (// + / g, "% 2b"); casser; cas "miniurl": retour str.replace (/% / g, "% 25"); casser; Case "Script": return str.replace (/ [// "'] / g, fonction (r) {return" / "+ r;}). Remplacer (/% / g," //x25").replace(/n/g, "//n").replace(//r/g," //r"... Str.replace (/*///^/$/*/+/?/ // }/./(/)/[/ (r) {return "& #" + r.Charcodeat (0) + ";"}). Remplacer (/ / g, "") .replace (// r / n / g, "<br />").replace(/n/g," <br />").replace(/n/g, "<Br />".replace(/n/g" "<br />" />").replace (//r/g, "<br />"); pause;}} // badword, filtre des mots sensibles // @ text: texte à filtrer, type: string // @ words: mots sensibles, type, tableau, tel que: [`` votre sœur '', `` je perds ',' i dmn '] // si vous utilisez la correspondance régulière, la longueur du texte est 1 million, et les mots, qui prennent 4 secondes!, Badword: Fonction (Texte, mots) {// # Word Filtrage Text = String (Texte || ''); var reg = new regexp (word.join ('|'), 'g'), _self = this; return text.replace (reg, fonction (0 0) {var longueur = string (0 || '') .length; return _self.repeat ('*', longueur);}); }};Ensemble de méthodes de chiffrement
Angela.Encrypt = {// # Encryption MD5: fonction (mots) {// # md5 algorithme de hachage / * * crypto-js 3.1.2 * http://code.google.com/p/crypto-js * / var cryptojs = function (s, p) {var m = {}, l = M.Lib = {}, n = funde }, r = l.base = {extension: fonction (b) {n.prototype = this; var h = new n; b && h.mixin (b); H.HasownProperty ("init") || (h.init = function () {h. $ super.init.apply (this, arguments)}); h.init.prototype = h; h. $ super = ceci; return h}, create: function () {var b = this.extend (); B.Init.Apply (B, arguments); return 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.word = b || []; this. * B.Length}, toString: fonction (b) {return (b || t) .stringify (this)}, concat: function (b) {var h = this.words, a = b.words, j = this.sigbytes; b = b.sigbytes; (G >>> 2] >>> 24 - 8 * (g% 4) & 255) << 24 - 8 * (J + G) }, CLAMP: fonction () {var b = ce. Random: fonction (b) {pour (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; pour (var g = [], j = 0; j <b; j ++) {var k = a [j >>> 2] >>> 24 - 8 * (j% 4) & 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; pour (var g = [], j = 0; j <b; j ++) g.push (String.fromCharcode (a [j >>> 2] >>> 24 - 8 * (j% 4) & 255)); return g.join ("")}, parse: function (b) {for (var a = b.length, g = [], j = 0; j <a; j ++) g [j >>> 2] | = (b.charcodeat (j) & 255) << 24 - 8 * (j% 4); return new q.init (g, a)}}, u = v.utf8 = {stringify: function (b) {try {return decodeuriComponent (Escape (a.stringify (b)))} catch (g) {throw error ("malformed utf-8 data"); }}, parse: function (b) {return a.Parse (unEscape (encodeuriComponent (b))))}}, g = l.bufferedblockalgorithm = r.extend ({reset: function () {this._data = new (b = u.parse (b)); S.Max (m | 0) - this._minbuffersize, 0); b = m * k; j = s.min (4 * b, j); clone: function () {var b = r.clone.call (this); b._data = this._data.clone (); 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 ()}, update (b) {this._append (b); this}, finalize: function (b) {b && this._append (b); k.hmac.init (b, g)). finaliser (a)}}}); var k = m.algo = {}; return m} (math); (function (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, l, j, m) { a = a + (k & h | b & ~h) + l + m; return (a << j | a >>> 32 - J) + K} Fonction L (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m; + k} fonction n (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m; } pour (var r = cryptojs, q = r.lib, v = q.wordarray, t = q.hasher, q = r.algo, a = [], u = 0; 64> u; u ++) a [u] = 4294967296 * this._hash = new v.init ([1732584193, 4023233417, 2562383102, 271733878])}, _doprocessBlock: fonction (g, k) {for (var b = 0; 16> b; b ++) {var h = k + b, w = g [h]; g [h] = (w << 8 | w >>> 24) & 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 +, v = g [k], uc 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) P (F, C, D, E, W, 12, A [1]), E = P (E, F, C, D, J, 17, A [2]), D = P (D, E, F, F, C, Q, 22, A [3]), C = P (C, D, E, F, R, 7, A [4]), F = P (F, C, D, E, S, S, 12, A [5]), E = F, C, D, E, S, 12, A [5]), E = F, C, D, E, S, 12, A [5]), E = F, C, D, E, S, 12, A [5]), E) 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, a 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]), c = m (c, d, e, f, w, 5, a) 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 [ 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, C, C, 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, f, b, 5, a) m (f, c, d, e, j, 9, a [29]), e = m (e, f, c, d, u, 14, a [30]), d = m (d, e, f, f, c, a, 20, a [27]), c = m (c, d, e, f, f, c, a, 20, a [31]), c = l (c, d, e, f, s, s, 4, a [31 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, F, C, C, 23, A [35]), C = l (C, D, 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, 16, 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, 2, a, c, d = n (d, e, f, c, s, 2, a [51] = 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 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, b, 21, a [59]), c = n (c, d, e, f, r, 6, a [60]), f = n (f, c, d, e, z, 10, a [61]) 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) & 4278255360; k [(h + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | l >>> 8) & 4278255360; k [(h + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | b >>> 9 << 4) + 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | b >>> 8) & 4278255360; a.sigbytes = 4 * (k.length + 1); this._process (); a = this._hash; k = a.words; pour (b = 0; 4> b; b ++) h = k [b], k [b] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360; return a}, clone: function () {var a = t.clone.call (this); a._hash = this._hash.clone (); retourner un}}); R.MD5 = T._CreateHelper (Q); R.HMACMD5 = T._CREATEHMACHELPER (Q)}) (MATH); return cryptojs.md5 (mots) .toString (); } // sha1, sha1: fonction (mots) {// # algorithme de hachage sha1 var cryptojs = fonction (e, m) {var p = {}, j = p.lib = {}, l = function () {}, f = j.base = {extend: function (a) {l.prototype = this; var c = new L; a && c.mixin (a); C.HasownProperty ("init") || (c.init = function () {c. $ super.init.apply (this, arguments)}); c.init.prototype = c; c. $ super = this; return c}, create: function () {var a = this.extend (); a.init.apply (a, arguments); return a}, init: function () {}, mixin: function (a) {for (var c dans 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: function (a, c) {a = this.word = a || []; this. * 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) & 255) << 24 - 8 * (d + b)% 4); }, CLAMP: fonction () {var a = this.words, c = this.sigbytes; a [c >>> 2] & = 4294967295 }, aléatoire: fonction (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; pour (var b = [], d = 0; d <a; d ++) {var f = c [d >>> 2] >>> 24 - 8 * (d% 4) & 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; pour (var b = [], d = 0; d <a; d ++) b.push (String.fromCharcode (c [d >>> 2] >>> 24 - 8 * (d% 4) & 255)); return b.join ("")}, parse: function (a) {for (var c = a.length, b = [], d = 0; d <c; d ++) b [d >>> 2] | = (a.Carcodeat (d) & 255) << 24 - 8 * (d% 4); return new n.init (b, c)}}, r = b.utf8 = {stringify: function (a) {try {return decodeuriComponent (Escape (g.stringify (a)))} catch (c) {throw error ("malformed utf-8 data"); }}, analyse: fonction (a) {return g.parse (UnEscape (EncodeuriComponent (a))))}}, k = j.bufferedblockalgorithm = f.extend ({reset: function () {this._data = new n.init; this._ndatabytes = 0}, _ension: function: fure (a) {"== == && (a = r.parse (a)); E.Max (H | 0) - This._Minbuffersize, 0); clone: function () {var a = f.clone.call (this); a._data = this._data.clone (); 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 ()}, update (a) {this._append (a); this}, finalize: function (a) {a && this._append (a); s.hmac.init (a, f)). finaliser (b)}}}); var s = p.algo = {}; retour p} (mathématiques); (function () {var e = cryptojs, m = e.lib, p = m.wordarray, j = m.hasher, l = [], m = e.algo.sha1 = j.extend ({_Doreset: function () {this._hash = new p.init ([1732584193, 402333417, 2562383102, 27173878, 3285377520])}, _doprocessBlock: fonction (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; C = l [a - 3] ^ l [a - 8] ^ l [a - 14] ^ l [a - 16]; l [a] = c << 1 | c >>> 31} c = (h << 5 | h >>> 27) + J + l [a]; 1859775393): 60> A? ] + g | 0; B [3] < 24 - H% 32; E [(H + 64 >>> 9 << 4) + 14] = Math.floor (b / 4294967296); 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 (mots) .toString (); } // TIME33 Hash, time33: fonction (mots) {// # Time33 Algorithme de hachage Words = mots || ''; // Algorithme de hash time33 pour (var i = 0, len = words.length, hash = 5381; i <len; ++ i) {hash + = (hash << 5) + words.charat (i) .Charcodeat (); }; return hash & 0x7ffffffff; }}Ensemble de méthode de date
Angela.date = {// # date heure // @ s: heure de début // @ e: heure finale // @ n: heure actuelle, n isinarea: function (s, e, n) {// # juge aire de temps var start = this.parse (s), end = this.parse (e), maintenant = parsefloat (n) || Nouvelle date (); start = math.min (start, fin); end = math.max (start, end); return maintenant> = start && maintenant <= end? vrai: false; } // Convertir les caractères en millisecondes // @ date: 2013-03-02 1: 2: 2, Parse: Fonction (date) {// # Format HEUN RETOUR DATE.PARSE (DATE); //.replace (/-/g, '/')} // @ time, heure, comme la nouvelle date ('2013/11/10 0:12:12') // @ pre, le préfixe de la semaine, tel que: semaine, semaine // @ nums, tels que: one, deux, trois, quatre, cinq et six jours, Getweek: Time, pre, pré, nums) { 'chaîne' ? this.parse (heure): (heure || new Date ()); pre = pre || 'Semaine'; // semaines nums = 'jour un, deux, trois, quatre, cinq, six'; return pre + nums [time.getDay ()]; } // @ formatType: Yyyy, yy, mm // @ time: new Date ('2013/11/12') // @ semaines: jour, deux, trois, quatre, cinq, six, format: fonction (formatType, heure, semaines) {// Format de sortie Time var pre = '0'; formatType = formatType || «Yyy-mm-dd» semaines = semaines || «Jour un, deux, trois, quatre, cinq, six»; Time = heure || Nouvelle date (); //Formattyp.com return (formatType || '') .replace (/ yyyy | yyyy / g, time.getlyear ()) .replace (/ yy | yy / g, tydic.string.addpre (pré, time.getlyar ()% 100), 2) .replace (/ mm | mm / g, tydic.string.addbre (prélasse Time.getMonth () + 1, 2)) .replace (/ m | m / g, time.getMonth () + 1) .replace (/ dd | dd / g, tydic.string.addpre (pre, time.getDate (), 2)) .replace (/ d | d / g, time.getDate ()) .replace (/ hh | h / g, Tydic.string.addpre (pré, time.Gethours (), 2)) .replace (/ h | h / g, time.gethours ()) .replace (/ ii | ii / g, tydic.string.addpre (pré, time.getMinutes (), 2)) .replace (/ i | i / g, time.getMinUtes (). Tydic.string.addpre (pré, time.getSeconds (), 2)) .replace (/ s | s / g, time.getSeconds ()) .replace (/ w / g, time.getDay ()) .replace (/ w / g, weeks [Time.getDay ()]); } // Compte à rebours, compte à rebours: fonction (opt) {// # compte à rebours var option = {nowtime: 0 // time actuel ,, 2013/02/01 18:30:30, intervalle: 1 // de la date limite, 2013/02/01 {} // rappel après l'achèvement}, opts = {}, tempor = null; opts = tydic.Extend (option, opt); // Heure actuelle if (! Opts.NowTime) {opts.NowTime = (new Date ()). GetTime (); } else {opts.nowtime = this.parse (opts.nowtime); } // Heure actuelle if (! Opts.endTime) {opts.endTime = (new Date ()). GetTime (); } else {opts.endtime = this.parse (opts.endtime); } timer = setInterval (Loop, opts.interval * 1e3); // Loop Fonction Loop () {var ts = opts.endtime - opts.nowtime // Calculez les millisecondes restantes, dd = parseInt (ts / 8.64e7) // calculer les jours restants, HH = ParseInt (TS / 3,6E7% 24) // Calcule les heures de respect, MM = Parseint (TS / 6E4% 60) // Calcule le Remaining, MM = SUSEINT (TS / 6E4% 60) = parseInt (TS / 1E3% 60) // Calculez les secondes restantes; // Calculez la décrémentation de l'heure actuelle Opts.NowTime + = Opts.Interval * 1E3; if (ts <= 0) {ClearInterval (Timer); Opts.Finaled (); } else {opts.called (dd, hh, mm, ss); }}}};Ensemble de méthode de détection du navigateur
Angela.browser = {// # Browsers de navigateur: {// # Catégorie de noyau de navigateur Weixin: /micromesger (// |/d/. /UCBrowser (//*/d/. // Open Browser, Sougou: /sogouMobileBrowser (// |/d/. /safari(//[/d/. Lodra+)*/ // safari, ie: /msie/s(@/d/. Lodra+)*/ // IE Browser} // @ errcall: Error Callback, addfav: function (url, title, errcall) {// # add to favoris try {window.external.adddfavavory (url, title); } catch (e) {try {window.sidebar.addpanel (title, url, ''); } catch (e) {errCall (); }}}}, // Version du navigateur CoreInit: function () {// # noadd var i = null, Browsers = this.browsers, ua = window.navigator.useragent.tolowercase (), navigateur = '', pos = 1; for (i in Browsers) {if (Brower = ua.match (Browsers [i])) {if (i == 'opéra') {pos = 2; } else {pos = 1; } this.version = (Brower [pos] || '') .replace (/ [/// s] + /, ''); this.core = i; retour i; }}} // détecter la version IE! Seule pris en charge IE: version 5,6,7,8,9, ie: (function () {// # détection ie version! Seule support: ie5,6,7,8,9 var v = 3, div = document.CreateElement ('div'), all = div.getElementsByTagname ('i'); while (div.innerhtml = '<! ']> <i> </i> <! [endif] ->', tout [0]);Méthode JSON
Angela.json = {// # json objet // chaîne devient json objet parse: fonction (data) {// # format chaîne, devenir json objet var // json regexp rvalidchars = / ^ [/] ,: {} / s] * $ /, rvalidbraces = / (?: ^: |,) (?: / S * / [) + / g, rValidescape = /// (?: ["//// bfnrt] | u [/ da-fa-f] {4}) / g, rvalidtokens = /"@^^"//r/n diplomatel*"|True|false|null|-?(?:/d+/g; if (window.json && window.json.parse) {return window.json.parse (data); } if (data === null) {return data; } 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))) (); } } retour ''; }};étendre la méthode
Angela.Extend = function () {// # Extension d'objet var cible = arguments [0] || {}, i = 1, longueur = arguments.length, options; if (typeof Target! = "Object" && typeof cible! = "function") Target = {}; for (; i <length; i ++) {if ((options = arguments [i])! = null) {for (var name in options) {var copy = options [name]; if (cible === copy) {continuant; } if (copy! == Undefined) {cible [name] = copy; }}}} return cible;};Méthodes de jugement de type
/ ** juger si la variable val est un type entier * / fonction isNumber (val) {return typeof val == '' nombre '&& isfinite (val);} / ** juger si la variable val est un type booléen * / fonction isboolean (val) {return typeof Val ===' booléen ';} / ** juge la variable === 'String';} / ** juger si la variable val n'est pas définie * / fonction isUnDefined (val) {return typeof val === 'string';} / ** jugez si la variable val est indéfinie * / fonction isUnDefined (val) {return typeof Val ==== 'Undefined';} / ** juge la variable (str === null || typeof str === 'Undefined') {return false; } return typeof str === 'objet';} / ** juger si la variable val est null * / fonction isNull (val) {return val === null;} / ** juge si la variable arr est une mode * méthode 1 * / function isarray1 (arr) {return objet.prototype.tostring.apply (arr) === '[Array d'objets]'; Une méthode du tableau * 2 * / fonction isArray2 (arr) {if (arr === null || typeof arr === 'undefined') {return false; } return arr.constructor === Array;}