배열 메소드 세트
Angela.array = {// array method // index, return position! 존재하지 않으면 -1을 반환합니다. 색인 : 함수 (t, arr) {//# 현재 값이 위치한 배열의 위치를 반환합니다 (arr.indexof) {return arr.indexof (t); } for (var i = arr.length; i--;) {if (arr [i] === t) {return i * 1; }}; 반품 -1; } // 객체의 키 값을 반환합니다! 리턴 값 유형은 배열입니다. , getKey : function (data) {//# 객체 var arr = [], k; for (k in data) {arr.push (k); }; 반환 ARR; } // 배열에서 값을 무작위로 추출, random : function (arrays) {//# 배열에서 값을 무작위로 추출 = 배열 || []; var len = arrays.length, index = tydic.math.randint (0, len -1); 반환 배열 [index] || '';; } // 1 차원 배열 중복 제거, 고유 : 함수 (배열) {// 1 차원 배열 중복 제거 배열 = 배열 || []; 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--; }}} 반환 배열; } // 배열에서 가장 큰 용어 인 max : function (array) {//#배열에서 가장 큰 용어를 찾으십시오. } // min, 배열에서 가장 작은 용어, min : function (array) {//#배열에서 가장 작은 항목을 찾으십시오. return math.min.apply (null, array); } // 제거, 제거, 제거 : 함수 (배열, 값) {//#배열에서 값을 제거합니다. var 길이 = array.length; while (length--) {if (value === array [length]) {array.splice (길이, 1); }} 반환 배열; } // 배열을 지우고 비어 있습니다 : function (array) {//# 배열을 지우십시오 (배열 || []). 길이 = 0; 반환 배열; } // removeAt, 지정된 위치 // index, index의 값을 삭제하십시오. 인덱스가 전달되지 않으면 첫 번째는 삭제됩니다. removeAt : function (array, index) {//#배열 배열에서 지정된 위치의 값을 삭제합니다. 반환 배열; } // 배열 정렬, 셔플 : 함수 (ARR) {//#배열 정렬 var array = (arr || []). concat (), longth = array.length, i = length // travel, tmp = null // rand = tydic.math.randint // 위치, pos = 0; while (i-) {pos = rand (0, 길이); // 랜덤 위치를 바꾸는 위치 tmp = array [pos]; 배열 [pos] = 배열 [i]; 배열 [i] = tmp; } 반환 배열; }};쿠키 방법 세트
Angela.cookie = {//# 쿠키 // 브라우저는 쿠키를 충분히 지원합니다. enable : !! navigator.cookieenabled // 쿠키를 읽습니다. val? (Val [2]? unescape (val [2]) : "") : ''; } // 쿠키 쓰기, 세트 : 함수 (이름, 값, 만료, 경로, 도메인, 보안) {//# 쓰기 쿠키 var exp = new date (), 만료 = 인수 [2] || NULL, PATH = 인수 [3] || "/", 도메인 = 인수 [4] || null, secure = 인수 [5] || 거짓 ; 만료 되나요? exp.setminutes (exp.getMinutes () + parseint (expires)) : ""; document.cookie = name + '=' + Escape (value) + (만료? '; 만료 =' + exp.togmtstring () : '') + (path? '; path =' + path : '') + (도메인 = ' + 도메인 :' ') + (Secure?'; Secure ':' '); } // 쿠키 삭제, del : 함수 (이름, 경로, 도메인, 보안) {//#쿠키 var value = $ getCookie (이름); if (value! = null) {var exp = new date (); exp.setminutes (exp.getMinutes () -1000); 경로 = 경로 || "/"; document.cookie = name + '=; fexipes =' + exp.togmtstring () + (path? '; path =' + path : '') + (domain? '; domain =' + domain : '') + (Secure? '; Secure': ''); }}};URL 메소드 세트
angela.url = {//#url // articles : 변수 이름, URL이 비어 있으면 현재 페이지의 URL에서 getQuery를 가져옵니다 : function (name, url) {var u = arguments [1] || wind return r! = null? r [2] : ""; }, gethash : function (name, url) {//# get hash value var u = argument [1] || location.hash; var reg = new regexp ( "(^| &)" + name + "= ([^&]*) (& | $)"); var r = u.substr (u.indexof ( "#") + 1) .match (reg); if (r! = null) {return r [2]; } 반품 ""; }, 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 : hash.replace ('#'', path. a.pathname.replace (/^([^//])/, '/$ 1'), 상대 : (a.href.match? : /// [^//]+(.+)/) || [, '') }};정규 표현 방법 세트
angela.regexp = {//# 문자열 일치 // 숫자 여부! 정수, 부동 소수점 번호 ISNUM : function (num) {//# 배열 반환입니다! isnan (num); }, iseMail : function (mail) {//# 사서함은 /^ (a-z0-9]+9]+9] return/a-z0-9 retmaks입니다. }, isidcard : function (card) {//# ID 카드 반환 /^(/d {14 }|/d {17 }) (/drox ]))$/.test(card); }, ismobile : function (mobile) {//# 전화 반환 /^0*1/d {10 }$/.test (mobile); }, isqq : function (qq) {//# qq return /^ return /^ return/^9]/d {4,10 }$/.test (qq); }, istel : function (tel) {//# 전화 반환/ }, isURL : function (url) {//# url return /https ?:///4//4 ///-] {1,255 }/.=-9a-z/-] {1,255 }/i.test(url); }, iscolor : function (color) {//# 16 진 색상 반환/# 여부에 관계없이/# (/da-f] {3 }) {1,2 }$/i.test(color); } // @id card, // @now : 현재 시간 : 새 날짜 ( '2013/12/12'), '2013/12/12'// @age : 허용 연령, Isadult : 기능 (ID, 허용, 지금) {//## 연령은 성인 var 나이 = 0 // 사용자 연도, 월, 일, 현재 연도, 일, 일, 일, 일, 및 일, 그리고; allowage = parsefloat (허용) || 18; 지금 = typeof now == 'string'? 새 날짜 (지금) : (지금 || new date ()); if (! this.isidcard (id)) {return false; } // 15 비트 ID 카드 if (15 == id.length) {age = '19' + id.slice (6, 6); } else {age = id.slice (6, 14); } // 변환 정수 시대 = ~~ 연령; nowdate = ~~ (tydic.date.format ( 'yyyymmdd', now)); // if (nowdate -Age <celloage * 1e4) {return false; } true를 반환합니다. } // float, isfloat : function (num) {//# 부동 소수점 반환/ } // 긍정적 인 정수, isint : function (num) {//# 긍정적 인 정수 반환 /^ re return/^]/d*$/.test(num); } // 모든 중국어 인 Ischinese : function (str) {//# 모든 중국어가 return /^(................/u4e00-/u9fa5] | /ufe30-/uffa0])) +$/gi.test(str); }};문자열 메서드 세트
angela.string = {//# string codehtml : function (content) {//# Escape Html ar "*", '+': "+", ',': ", '-':"-". } // String을 반복, 반복 : 함수 (Word, Length, End) {//# String End = End || '';; // 마지막 길이에 추가 = ~~ 길이; 새 배열을 반환합니다 (길이 * 1 + 1) .join (Word) + '' + end; } // Prefix 추가, AddPre : 함수 (pre, word, size) {//# 메이크업. 당신이 0 pre = pre ||보다 우선하는 경우 '0'; 크기 = parseint (size) || 0; Word = String (Word || ''); var length = math.max (0, size -word.length); repits.repeat (pre, length, word); } // 양쪽에서 공백을 제거, trim : function (text) {//# 양쪽에서 공백을 제거합니다 (텍스트 || '') .replace (/^/s+|/s $/, ''); } // 문자열 교체, 교체 : function (str, re) {//# 문자열 교체 str = str || '';; for (re in re) {replace (key, re [key]); }; 함수 교체 (a, b) {var arr = str.split (a); str = arr.join (b); }; Return str; }, xss : function (str, type) {//# xss Escape // 빈 필터 if (! str) {return str === 0? "0": ""; } switch (type) {case "html": // html string return return str.replace (/[& ' "<> /////-/x00-/x09/x0b-/x0c/x1f/x80-/xff]/g, function (r) {return"& r.r.charcodeat (0) + " +"). ""). str.replace (/[& ' "<> /////-/x00-/x1f/x80-/xff]/g, function (r) {return"&#" + r.charcodeat (0) +"; "}); 부서지다; 사례 "url": // URL 리턴 탈출 (str) .replace (//+/g, "%2b"); 부서지다; 사례 "miniurl": return str.replace (/%/g, "%25"); 부서지다; case "script": return str.replace (/[// " ']/g, function (r) {return"// " + r;}). 대체 (/%/g,"//x25").replace(//n/g, "//n").replace(//r/g,"//r").replace(//x01/g, "// x01"); str.replace (///^/$/*/+/ ?/ {/ }/.(/)/ 기능 (a) {return "//" + a;}; (r) {return "&#" + R.CharcoDeat (0) + ";" "<br />"/>").replace(//r/g, "<br />"); break;}} // badword, 필터에 민감한 단어 // 텍스트 : 텍스트를 필터링 할 텍스트 : type : string // 단어 : 민감한 단어, 유형, 배열 등 : [ '당신의 자매', 'I Lose', 'I DAMN', 'IN DAMM LEATH,' SECONDS! badword (텍스트, 단어) {# 텍스트 || '; var reg = new regexp (words.join ( '|'), 'g'), _self = this; return text.replace (reg, function ($ 0) {var length = string ($ 0 || '') .length; return _self.repeat ( '*', length);}); }};암호화 방법 세트
angela.encrypt = {//# 암호화 md5 : 함수 (단어) {//# md5 해시 알고리즘/ * * crypto-js 3.1.2 * http://code.google.com/p/crypto-JS */var cryptojs = function (s, p) {var m = {}, n}, n) }, r = l.base = {extend : function (b) {n.prototype = this; var h = 새로운 n; b && h.mixin (b); H. HASOWNPROPERTY ( "init") || (h.init = function () {h. $ super.init.apply (this, arguments)}); h.init.prototype = h; h. $ super = this; return h}, create : function () {var b = this.extend (); B.init.apply (b, 인수); 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 : clone : function () {return this.init.prototype.extend (this)}}, q = l.wordarray = r.extend ({init : b, h) {b = this.words = b | * b.length : function (b) {return (b || t) .Stringify (this)} {var h = a = b.words, j = this.sigbytes; (G >>> 24-8 * (g % 4) << 24-8 * (j + g) % (g = 0; g <b; g + = 4) }, function () {var b = h = sigbytes; 랜덤 : 함수 (b) {for (var h = [], a = 0; a <b; a += 4) h.push (4294967296 * s.random () | 0); 새 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) & 255; g.push ((k >>> 4) .ToString (16)); g.push ((k & 15) .tostring (16))} return g.join ( "")}, parse : parse : function (b) {for (var a = b.length, g = [], j = 0; 새로운 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) & 255); return g.join ( "")}, parse : function (b) {for (var a = b.length, g = [], j = 0; return new q.init (g, a)}}, u = v.utf8 = {stringify : function (b) {try {return decodeUricomponent (exce (acectify (b)))} catch (g) {Throw Error ( "옛날 UTF-8 데이터"); }}, parse : function (b) {return a.parse (unescape (encodeUricomponent (b)))}, g = l.bufferedBlockalGorithm = r.extend ({restet : function () {this._data = new q.init; this._ndatabytes = 0}, _append (b) { "{b) {"{ " (b = u.parse (b); _data.concat (b); | 0) - M * k; {var b = r.clone.call (this); this._data.clone (); l.hasher = g.extend ({cfg : r.extend (), init : init : function (b) {this.cfg = this.cfg.extend (b); this.reset ()}, Reset : function () {g.reset.call (this); this._doreset ()}; 이. (a, g) {return (new k.hmac.init (b, g)). finalize (a)}}); var k = m.algo = {}; 반환 m} (수학); (s) {함수 P (a, k, b, h, l, j, m) {a = a + (k & b | ~ k & h) + l + m; return (a << j | a >>> 32 -j) + k} 함수 m (a, k, b, h, l, j, m) {a = a + (k & h | b & ~ h) + l + m; j) + k} 함수 l (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m (a << j | a >>> 32 -j) + k} (a, k, b, h, l, j, m) {a = a + (k | ~ h)); + k} 기능 n (a, k, b, h, l, j, m) {a = a + (b ^ (k | ~ h)) + l + m (a << j | a >>> 32 -j) + k} (a, k, b, h, l, a = a + (b | ~ h)) + m; } (var r = cryptojs, q = r.lib, v = q.wordarray, t = q.hasher, q = r.algo, a = [u] = 4294967296 * s.abs (s.sin (u+1)); {this._hash = new V.init ([[1732584193, 4023233417, 2562383102, 27173383102, _doprocessBlock : 함수 (g, k) {for (var b = 0; 16> b; b ++) {var h = k+b, W = g; 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], g [k + 7], k + 6], 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, e) p (f, c, d, e, w, a [1]), e = p (e, f, c, d, j, 17, a [2]), d = p (d, e, f, c, q, q, a [3], c = p (c, d, e, f, r, 7, a [4]), f = p (f, c, d, e, 12, a, a) d, t, 17, a [6]), d = p (d, e, f, c, u, 22, a [7]), c = p (c, d, e, v, v, 7, a [8]), f = p (f, c, d, e, x, x, a [9]), e = p (e = p, e, f, c, d, y, 17, a [10], d = p (d, e, c, 2, a [10]) a [11]), c = p (c, d, e, f, a, a, 7, a [12]), f = p (f, c, d, e, b, a [13]), e = p (e, f, c, d, c, 17, a [14]), d = p (d, e, f, c, d, a [15]), c = m (c, d, f m (f, c, d, e, t, 9, a [17]), e = m (e, f, c, d, d, z, z, 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, y, 9, 9, e) 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, E = M (E, F, C, C, C, D) 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, Q, 14, A [26]), D = M (D, E, E, F, C, V, A [27], C = M (C, D, F m (f, c, d, e, j, 9, a [29]), e = m (e, f, c, d, u, a [30]), d = m (d, e, f, c, a, a, a [27]), c = m (c, e, f, c, c, a, 20, a [31]), c = l (c, d, e c, d, e, v, 11, a [33]), e = l (e, f, c, d, d, z, z, a [34]), d = l (d, e, f, c, d, z, a [34]), d = l (d, e, f, c, c, 23, a [35]), c = l (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]), a [41]), e (e = l, f, d, q, q, d, d, q, 1, 1). a [42]), d = l (d, e, f, c, t, 23, a [43]), c = l (c, d, e, e, f, x, x, x, x, x, x, a, a, a, 11, a [45]), e = l (e = l, e, f, c, d, d, 16, a [46]), d = l (d, e, f, f a [47]), C = N (C, D, E, F, H, 6, A [48]), F = N (F, C, D, E, U, 10, [49]), E = N (E, F, C, C, D, E, U, 10, A [49])), E = N (E = N, E, E, F, C, C, C, D = N (D, e) = n (c, d, e, f, a, a, a [52])), f = n (f, c, d, e, e, q, q, q, q, q, a [53]), e = n (e, e, f, c, d, y, a [54]), d = n (d, e, f, c, w, 21, a [55]), c = n (c = n) 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, b, b, b, b, b, b, b, b, b, b, b, b, a [59], c = n (c, d, e, f, r, a [60]), f = n (f, c, d, z, 10, 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) & 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; for (b = 0; 4> b; b ++) h = k [b], k [b] = (h << 8 | h >> 24) & 16711935 | (H << 24 | h >>> 8) & 4278255360; 반환 a}, clone : function () {var a = t.clone.call (this); A._HASH = this._HASH.CLONE (); 반환 a}}); r.md5 = T._createHelper (Q); r.hmacmd5 = t._createhmachelper (q)}) (수학); cryptojs.md5 (단어) .tostring (); } // sha1 : sha1 : function (words) {//# sha1 해싱 알고리즘 var cryptojs = function (e, m) {var p = {}, j = p.lib = {}, l = function (), f = J.base = {extend : function (a) {l.prototypoty = this; var c = 새로운 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, 인수); a}, init : function () {}, mixin : function (a) {for (var c in a) a.hasownproperty (c) && (this [c] = a [c]); A.HasOwnProperty ( "TOSTRING") && (this.TOSTRING = A.TOSTRING)}, CLONE : CLONE : FUNTUCT () {return this.init.prototype.extend (this)}}, n = j.wordArray = F.extend ({init : function (a, c) {a = this.words = a | * a.length} : function (a) {return (a || h) .Stringify (this)} {var c = thewords, q = a.words, d = the.sigbytes; (Q >>> 24-8 * (B % 4) << 24-8 * (D + B) % (65535 <Q.length) (B = 0; B <A; B + = 4) }, function () {var a = this.sigbytes; }, random : function (a) {for (var c = [], b = 0; b <a; b += 4) c.push (4294967296 * e.random () | 0); 새로운 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) & 255; b.push ((f >>> 4) .tostring (16)); b.push ((f & 15) .tostring (16))} 반환 b.join ( "")}, Parse : 함수 (a) {for (var c = a.length, b = 0; d <c; d += 2) b [d >>> 3] | = parseint (a.substr (d, 2), 16) << 24 * (d % 8); 새로운 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) & 255); return b.join ( "")}, parse : function (a) {for (var c = a.length, b = [], d = 0; d <c; d ++) b [d >>> 2] | = (a.charcodeat (d) & 255) << 24-8 * (d % 4); 새로운 n.init (b, c)}}, r = b.utf8 = {stringify : function (a) {try {return decodeUricomponent (excl (g.stringify (a)))} catch (c) {Throw Error ( "ralformed UTF-8 데이터"); }}, parse : function (a) {return g.parse (uncodeUricomponent (a))}}, k = j.bufferedBlockalGorithm = f.extend ({Reset : function () {this._data = new n.init; this._ndatabytes = 0}, function (a) {a). && (a = r.process += a.sigbytes}; e.max (h | 0) - a = e.min; 클론 : function () {var a = f.clone.call (this) = this._data.clone (); j.hasher = k.extend ({cfg : f.extend (), init : function (a) {a) {this.cfg = this.cfg.extend (a); this.reset ()}, Reset : function () {K.reset.call (this); this._doreset ()}, 업데이트 : 기능 (a) {a) {a) this._process (); (b, f) {return (new s.hmac.init (a, f)). finalize (b)}}); var s = p.algo = {}; 반환 p} (수학); (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, 402323417, 25623831022, 271733878, 3285377520])}, _doprocessBlock : 함수 (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; A] | g ^ E ^ K). 1] = B [2] + e > 5] | = 128 << 24 -h % 32; e [(h + 64 >>> 9 << 4) + 15] = b; f.sigbytes = 4 * e.length; this._process (); retract._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 (단어) .toString (); } // time33 HASH, TIME33 : 함수 (단어) {//# time33 해시 알고리즘 단어 = Words || '';; // HASH TIME33 알고리즘 (var i = 0, len = words.length, hash = 5381; i <len; ++ i) {hash += (hash << 5) +words.charat (i) .charcodeat (); }; 반환 해시 & 0x7ffffffff; }}날짜 방법 설정
Angela.date = {//# 날짜 시간 //@s : 시작 시간 //@e : end time //@n : 현재 시간, n isinarea : function (s, e, n) {//# 판사 시간 영역 var start = this. this.parse (s, en), e), now = parsefloat (n) || 새 날짜 (); start = math.min (시작, 끝); end = math.max (시작, 끝); 지금 반환> = 시작 && 지금 <= 종료? 사실 : 거짓; } // 문자를 milliseconds로 변환 //@date : 2013-03-02 1 : 2 : 2, parse : function (date) {//# 형식 시간 반환 날짜 .parse (date); //.replace(/-/g, '/')} //@time, time, 예 : 새로운 날짜 ( '2013/11/10 0:12:12') //@@@the the week, 예를 들어 : 주, 주 //@nums : 1, 2, 3, 4, 5 및 6 일, getweek : function (time, pre) {// '끈' ? this.parse (시간) : (시간 || 새 날짜 ()); pre = pre || '주'; // Weeks Nums = 'Day One, 둘, 3, 4, 5, 6'; pre + nums를 반환합니다 [time.getday ()]; } //@formattype : yyyy, yy, mm //@time : 새 날짜 ( '2013/11/12') //@weeks : day, 둘, 3, 4, 5, 6, format : function (formattype, time, thews) {// format 출력 시간 var = '0'; formattype = formattype || 'yyy-mm-dd'주 = 주 || '1 일, 둘, 셋, 셋, 4, 5, 6'; 시간 = 시간 || 새 날짜 (); //formattyp.com return (formattype || '') .replace (/yyyy | yyyy/g, time.getlyear ()) .replace (/yy | yy/g, tydic.string.addpre (pre, time.get.get. 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 ()). tydic.string.addpre (pre, time.gethours (), 2)) .replace (/h | h/g, time.gethours ()) .replace (/ii | ii/g, tydic.string.addpre (pre, time.getminutes (), 2)) tydic.string.addpre (pre, time.getseconds (), 2)) .replace (/s | s/g, time.getseconds ()) .replace (/w/g, time.getday ()) .replace (/w/g, Weeks [time.getday ()]); } // countdown, countdown : function (opt) {//# countdown var 옵션 = {nowtime : 0 // 현재 시간, 2013/02/01 18:30:30, EndTime : 0 // Deadline, 2013/02/01 18:30:30, 간격 : 1 // 간격 콜백 시간, 초 호출 (Day, Second, Minute)} {} // 완료 후 콜백}, opts = {}, timer = null; opts = tydic.extend (옵션, opt); // 현재 시간 if (! opts.nowtime) {opts.nowtime = (new Date ()). gettime (); } else {opts.nowtime = this.parse (opts.nowtime); } // 현재 시간 if (! opts.endtime) {opts.endtime = (new date ()). gettime (); } else {opts.endtime = this.parse (opts.endtime); } timer = setInterVal (loop, opts.interval * 1e3); // loop function loop () {var ts = opts.endtime-pts.nowtime // 나머지 밀리 초, dd = parseint (ts/ 8.64e7)를 계산합니다. = parseint (ts/ 1e3 % 60) // 나머지 초를 계산합니다. // 현재 시간은 opts.nowtime += opts.interVal * 1e3; if (ts <= 0) {clearinterval (타이머); opts.finaled (); } else {opts.called (dd, hh, mm, ss); }}}};브라우저 감지 방법 세트
angela.browser = {//# 브라우저 브라우저 : {//## 브라우저 커널 카테고리 weixin : /micromessenger(//d/.] +)*/ // wechat 내장 브라우저, mqq : /mqqbrowser(///d/.] // mobile QQ Browser, UC : /ucbrowser(///d/. ]+)* // uc 브라우저, Chrome : /(? : Chrome| Crios)(//d/.] +)*/ // Chrome 브라우저, Firefox :/Firefox(//d/.....odom )* // firefox 브라우저, Opera :/opera (//,////////////opera(//,////). 브라우저, sougou : /sogoumobilebrowser(//d/.]+: // Sogou 모바일 브라우저, Baidu : /baidubrowser(///d/] +)*/ // Baidu Mobile Browser, 360 : /360browser(;/d/ ]* // 360 Browser, Safari : /safari(///d/.] // 안전한 브라우저, IE : /msie/s(............/D/.]+: // IE 브라우저} // errcall : errcall, addfav : function (url, title, errcall) {window.external.aDdffitite (url, winder); } catch (e) {try {window.sidebar.addpanel (title, url, ''); } catch (e) {errcall (); }}}, // 브라우저 버전 CoreInit : function () {//#noadd var i = null, 브라우저 = this.browers, ua = wind for (브라우저에서 i) {if (brower = ua.match (브라우저 [i])) {if (i == 'opera') {pos = 2; } else {pos = 1; } this.version = (Brower [pos] || '') .replace (/[/// s]+/, ''); this.core = i; 반환 i; }}} // IE 버전 감지! 단지 지원되는 IE : 버전 5,6,7,8,9, IE : (function () {//# IE 버전 Detect IE 버전! Only Support : IE5,6,7,9 var v = 3, div = div.createElement ( 'div'), all = div.getEmentmesbyTagName ( 'i'); ']> <i> </i> <! [endif]->'), v> 4?JSON 방법
Angela.json = {//# json 객체 // String은 JSON Object Parse가됩니다 : function (data) {//# format String, JSON Object var // json regexp rvalidchars =/^[/], : {}/s]*$/, rvalidbraces =/(? :^| |,) (? :/s*/[)+/g, rvalidecape /// (? : [ "//// Bfnrt] | u [/da-fa-f] {4})/g, rvalidtokens = /" 있다는 것은 // //r/nom| false|null|-?(?:/d+/, :)/d+(?e]/d +)/d+)/g; if (wind } 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 (새 함수 ( "return" + data)) (); } } 반품 ''; }};확장 방법
Angela.extend = function () {//# 객체 확장 var target = arguments [0] || {}, i = 1, length = arguments.length, 옵션; if (taption! = "object"&& typeof target! = "function") target = {}; for (; i <length; i ++) {if ((옵션 = 인수 [i])! = null) {for (var name in 옵션) {var copy = 옵션 [이름]; if (target === Copy) {계속; } if (copy! == undefined) {target [name] = copy; }}}} 반환 대상;};유형 판단 방법
/** 변수 val이 정수 유형*/function isnumber인지 판단하십시오. ==== 'string';}/** 변수 val이 정의되지 않은지 판단*/function isundefined (val) {return typeof val ===== 'string';}/** judge val이 정의되지 않은지*/함수는 val === 'undefined';}/** 판사가 대상*/function인지 여부는 val === '}/** 판사입니다. (str === null || typeof str === 'undefined') {return false; } return typeof str === '객체';}/** variable val이 null*/function isnull (val) {return val === null;}/** 판단 변수 arr가 배열*/function isArray1 (arr) {return object.prototype.tostring.apply (array) ' 배열*메소드 2*/function isarray2 (arr) {if (arr === null || typeof arr === 'undefined') {return false; } return arr.constructor === 배열;}