配列メソッドセット
Angela.Array = {//#array method //インデックス、戻り位置!存在しない場合、-1を返します。 index:function(t、arr){//#現在の値が配置されている配列の位置を返します(arr.indexof){return arr.indexof(t); } for(var i = arr.length; i--;){if(arr [i] === t){return i * 1; }}; return -1; } //オブジェクトのキー値を返します!返品値タイプは配列です。 、getKey:function(data){//#オブジェクトのすべてのキー値を返しますvar arr = []、k; for(k in data){arr.push(k); }; arrを返します。 } //配列から値をランダムに抽出します、ランダム:function(array){//#配列配列から値をランダムに抽出= array || []; var len = arrays.length、index = tydic.math.randint(0、len -1); return arrays [index] || ''; } // 1次元配列延長、一意:function(array){//#one-dimensional array deduplication 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、配列の最大の用語、max:function(array){//#配列return math.max.apply(null、array)で最大の用語を見つけます。 } // min、配列で最小の用語、min:function(array){//#配列return math.min.apply(null、array)で最小のアイテムを見つけます。 } //削除、削除、削除、削除:function(array、value){//#array var length = array.lengthの値を削除します。 while(length-){if(value === array [length]){array.splice(length、1); }} return array; } // arrayをクリアします、empty:function(array){//#array(array || [])。length = 0;返品配列; } // removeat、指定された位置の値を削除//@index、index。インデックスが渡されない場合、最初のものは削除されます。返品配列; } //配列のsortをスクラップし、shuffle:function(arr){//#scraps array sort var array =(arr || [])。concat()、length = array.length、i = length // tmp = null //一時的、rand = tydic.math.randint // pose、pos = 0; while(i-){pos = rand(0、length); //ランダム位置tmp = array [pos]; array [pos] = array [i];配列[i] = tmp; } return array; }};Cookieメソッドセット
Angela.cookie = {//#cookie //ブラウザはCookieを十分にサポートしています。 enable:!! navigator.cookieEnabled // cookie、get:function(name){//#read cookie var reg = new regexp( "(^|)" + name + "(?:=([^;]*)?(; | $)")、val = document.cookie.match(reg); valを返しますか? (val [2]?unescape(val [2]): ""): ''; } // cookie、set:function(name、value、expires、path、domain、secure){//#write cookie var exp = new date()、expires = arguments [2] || null、path = arguments [3] || "/"、domain = arguments [4] || null、secure = arguments [5] ||間違い ;期限切れ? exp.setminutes(exp.getMinutes() + parseint(expires)): ""; document.cookie = name + '=' + escape(value) +(expires? '; expires =' + exp.togmtstring(): '') +(path? '; path =' + path: '') +(domain? '; domain =' + domain: '') +(secure? '; secure': ''); } // delete cookie、del:function(name、path、domain、secure){//#delete cookies var value = $ getcookie(name); if(value!= null){var exp = new date(); exp.setminutes(exp.getMinutes()-1000);パス=パス|| "/"; document.cookie = name + '=; expires =' + exp.togmtstring() +(path? '; path =' + path: '') +(domain? '; domain =' + domain: '') +(secure? '; secure': ''); }}};URLメソッドセット
Angela.url = {//#url //記事:変数名、URLが空の場合、テーブルは現在のページのURLから取得します:function(name、url){var u = jormuments [1] || window.location.search、reg = new regexp( "(^|&)" + name + "=([^&]*)(&| $)")、r = U.Substr(u.Indexof( "?") + 1).match(reg); r!= nullを返しますか? r [2]: ""; }、gethash:function(name、url){//#get hash value var u = arguments [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: A.pathname.replace(/^([^//])/、 '/$ 1')、相対:(a.href.match(/tps?://// [^//]+(。+)/)|| [、 ''])[1]、Segments:a.pathname.replace(/^/////、 ').split('/')。 }};正規表現方法セット
Angela.Regexp = {//#String Match //それが番号かどうか! integer、floating point number isnum:function(num){//#return!isnan(num); }、isemail:function(mail){//#mailbox return /^( [a-z0-/-/.] ?)* [a-z0-9]+[_/.] ?? (2,5,5,5,5} $/i.test(mail); }、isidcard:function(card){//#id card return /^(/d {14} |/d {17} )(/d| [xx])$/.test(card); }、ismobile:function(mobile){//#電話のreturn/^0*1/d {10 }$/.test(mobile); }、isqq:function(qq){//#それはqq return /^ [1-9]/d {4,10 }$/.test(qq); }、istel:function(tel){//#電話のreturn /^/d {3,4} --/d {7,8} (--/d {1,6})?$/.text(tel); }、isurl:function(url){//#それはurl return /https?:////////////a-255 }/. [0-9a-z/-] {1,255 }/i.test(url); }、iscolor:function(color){//#それが16進数のreturn /#( [3da-f] {3} (1,2 }$/i.test(color); } // @id:id card、// @now:new Date( '2013/12/12')、 '2013/12/12'などの現在の時刻: Allowage = Parsefloat(Allageage)|| 18; now = typeof now == 'string'? new Date(Now):(現在|| 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); } //変換整数年齢= ~~ age; nowdate = ~~(tydic.date.format( 'yyyymmdd'、now)); //年齢を比較するif(nowdate -age <lockage * 1e4){return false; } trueを返します。 } // float、isfloat:function(num){//#それはフローティングポイントリターン/^(([1-9]/d*)|」 } // positive integer、isint:function(num){//#それが正の整数return /^ [1-9]/d*$/.test(num); } //それはすべて漢字ですか、inschinese:function(str){//#すべての漢字がreturn /^(] return /^(]/u4e00-/u9fa5 }};文字列メソッドセット
Angela.String = {//#文字列codehtml:function(content){//#escape html文字はthis.replace(content、{'&': "&"、 '":" "、"' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '': "" ": '*': "、 '+':"+"、 ':"、 " - ':"、 '。': "/"、 '?': ""、 '/n' } //文字列を繰り返し、繰り返し:function(word、length、end){//#repeat string end = end || ''; //最後の長さに追加= ~~長さ;新しい配列(長さ * 1 + 1)を返します。Join(word) + '' + end; } //プレフィックス、addpre:function(pre、word、size){//#make upを追加します。あなたが0の前にpre = pre ||の前に'0'; size = parseint(size)|| 0; word = string(word || ''); var length = math.max(0、size -word.length); this.repeat(pre、length、word)を返します。 } //両側のスペースを削除する、trim:function(text){//#両側のスペースを削除してください(text || '').replace(/^/s+|/s $/、 ''); } //文字列交換、交換:function(str、re){//#文字列交換str = str || ''; for(reのvar key){置換(key、re [key]); };関数置換(a、b){var arr = str.split(a); str = arr.join(b); }; strを返します。 }、xss:function(str、type){//#xss escase //空のフィルターif(!str){return str === 0? "0": ""; } switch(type){case "html":// html string return str.replace(/[& '"<> ///////-/x00-/x09/x0b-/x0c/x1f/x80-/xff]/g、g、function(r){return"&# " + r.charcodeat(///prent(////")。 "").replace(// r/n/g、 "(//n/g、" (//r/g、 "<br/>"); 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;}) "reg":return replace(/funly ////pord/+/ {/} Escape(str).replace(/[& '"<> //////-/x00-/x09/x0b-/x0c/x1f/x80--/xff]、function(r){return"&# " + r.charcodeat(0) +"; ";"; "})。 /> "。//n/g、"()leplace(//n/g、((br//>]、 " //テキストはフィルタリングされます:string //@sight、type、arrayなど:「私は 'I nume'] //テキストの長さは100万です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 = {//#encryption 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. {}、r = l.base = {extend:function(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 = this; 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)}}、l.wordarray = r.extend({init:hing(b、b、h){b = b | | thiswords B.length}、function(b){return(b || t)}、concat(b){this.words、j = this.sigbytes; (g >>> 24-8 *(g%4)&24-8 *((j + g)%4); }、function(){var b = this.sigbytes;ランダム:function(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).tosttring(16))} return g.join( "")}、parse:function(b){for(var a = b.length、g = []、j = 0; j += 2)g [j >> 3] | = parseint(j、2)、16)<4-4 *(j%8);新しい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; j <a; j ++)g [j >>> 2] | =(b.charcodeat(j)&255)<< 24-8 *(j%4);新しいq.init(g、a)}}、u = v.utf8 = {stringify:function(b){try {return decodeuricomponent(escaid(a.stringify(b)))} catch(g){shrow error( "誤ったUTF-8データ"); }}、parse:function(b){return a.parse(unescape(encodeuricomponent(b)))}}}}}}}}}} = r.extend({reset:function(){this._data = new q.init; this._ndatabytes = find = 0 "" &&(b = u.parse(b)); S.max(m | 0) - b = m * k; 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()}、upters(this(b) }、finalize:function(b){b && this._append(b); k.hmac.init(b、g))。ファイナライズ(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}関数m(a、k、b、h、l、j、m){a = a +(k&h | b&〜h) + m; j) + k}関数l(k、b、h、j、m){a = a +(k | 〜h) + l + m; + k}関数n(a、k、h、l、j、m){a = a +(k | 〜h) + l + m; } for(var r = cryptojs、q = r.lib、v = q.hasher、q = r.algo、a = 0; 64> u; u ++)a [u] = 4294967296 * s.abs(s.sin(u+1)| this._hash = new V.init([1732584193、40232333417、2562383102、271733878])}、_doprocessblock:function(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]、t = g [k + 6]、u = g [k + 5]、 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、f、 P(f、c、d、e、w、12、a [1])、e = p(e、f、c、d、j、j、j、j、17、a [2])、d = p(d、e、f、c、q、22、a [3])、c = p(c、d、e、f、r、7、a [4])、f = p(f、c、d、e、e、e、e、e、e、e、e、e、e、e、e、e、e、e、e、e、e、e、f、e、f、 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、e、f、c、c、d、22、a [15]、c = m(c、f、f、f、f、f、f、f、 m(f、c、d、e、t、9、a [17])、e = m(e、f、c、d、d、d、d、z、z、14、a [18])、d = m(d、e、f、c、h、h、20、a [19])、c = m(c、d、e、f、s、5、a [20])、f = m(f、c、d、e、y、y、y、y、y、y、9、 c、d、e、y、9、a [21])、e = m(e、f、c、c、c、h、h、h、20、a [19])、c = m(c、d、e、f、s、s、s、5、a [20])、f = m(f、c、d、e、y、y、9、a [21])、e = m 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、e、f、c、c、v、20、a [27]、c = m(c、f、f、f、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、f、c、a、20、a [31])、c = l c、d、e、v、11、a [33])、e = l(e、f、c、d、d、d、z、z、16、a [34])、d = l(d、e、f、c、d、z、16、a [34])、d = l(d、e、f、c、c、c、23、a [35])、c = l(c、d、e、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、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 [42])、d = l(d、e、f、c、t、23、a [43])、c = l(c、d、e、f、x、x、4、a [44])、f = l(f、c、d、e、a、11、a [45])、e = l(e、f、c、d、d、d、d、d = d、d、d、d、d、d、d、d、d、d、d、d、d、d、d、d、d、 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、d、e、u、10、a [49])、e = n(e、f、c、c、c、d = n(d = e、c、c、d = n(d、c、c)、c、c、d = n(d、c、c、c、c、d = n) = 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、y、15、a [54])、d = n(d、e、f、c、w、w、21、a [55])、c = n(c、d、e、f、f、f、 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、d、e z、e、z、e、z、 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; return 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)})(Math); 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.protype = 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、引数); return 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:function(){return this.init.prototype.extend(this)}}、n = j.wordarray = f.extend({init:a、c){a | c! A.length}、function(a){return(a || h)}、concat(a){this.words、d = this.sigbytes; (Q >>> 24-8 *(B%4)&24-8 *((D + B)%4); }、function(){var a = this.sigbytes; }、ランダム: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))} 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)新しい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); new n.init(b、c)}}、r = b.utf8 = {stringify:function(a){try {return decodeuricomponent(essase(g.stringify(a)))} catch(c){shrow error( "誤ったUTF-8データ"); }}、parse:function(a){return g.parse(unescape(encodeuricomponent(a)))}}}}}}}}、j.bufferedblockalgorithm = f.extend({reset:function(){this._data = new n.init; this._ndatabytes = 0 {a)= 0} finded = 0 _ &&(a = r.parse(a)); e.max(h | 0) - a = h * f; 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()}、upters(a){a) }、finalize:function(a){a && this._append(a); s.hmac.init(a、f))。ファイナライズ(b)}}}); var s = p.algo = {}; return p}(math); (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、402323333417、2562383102、2562383102、2738383102、2738383102、2738383102 3285377520]}、_doprocessblock:function(f、n){for(this._hash.words、h = b [1]、e = b [2]、k = b [3]、j = b [4]、a = 0; 80> var c = l [a -8] ^ l [a -16] = c >> 185975393:a | g&k | e&k -c +(g ^ e ^ k) 1] + g | = 128 << 24 -H%32; e [(h + 64 >>> 9 << 4) + 15] = b; f.sigbytes = 4 * e.length; this._process(); 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(words).toString(); } // time33 hash、time33:function(words){//#time33 hash algorithm words = words || ''; //(var i = 0、len = words.length、hash = 5381; i <len; ++ i){hash +=(hash << 5) +words.charat(i).charcodeat(); };ハッシュ&0x7ffffffffを返します。 }}日付メソッドセット
Angela.date = {//#date time //@s:start time //@e:end time //@n:現在の時間、n isinarea:function(s、e、n){// new Date(); start = math.min(start、end); end = math.max(start、end);今すぐ返す> = start && now <= end? True:false; } //文字をmillisecondsに変換します//.Replace(--/g、 '/')} //@@@time、 'new Dateなどの時間(' 2013/11/10 0:12:12 ')//@pre、週のプレフィックス、週など: '弦' ? this.parse(time):( time || new date()); pre = pre || '週'; //週nums = '初日、2、3、4、5、6'; pre + nums [time.getDay()]を返します。 } //@formattype:yyyy、yy、mm //@time:new date( '2013/11/12')//@@@@@@week:day、2、4、6、format:function(formattype、time、weeks){//形式出力時間var pre = '0'; formattype = formattype || 'yyy-mm-dd'週=週|| 「1日目、2、3、4、5、6」。時間=時間|| new Date(); //formattyp.com return(formattype || '').replace(/yyyy | yyyy/g、time.get.fullyear()).replace(/yy | yy/g、tydic.string.addpre(pre、time.geterial()%100)、2).replace(/mm | mm/g 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.getminutes()、2)。 time.getMinutes()).replace(/ss | ss/g、tydic.string.addpre(pre、time.getseconds()、2)).replace(/s | s/g、time.getseconds()).replace()replace(/w/g、time.getday()。 } // countdown、countdown:countdown:function(opt){//#countdown var option = {nowtime:0 //現在の時間、2013/02/01 18:30:30、終了:0 //締め切り、2013/02/01 18:30:30、インターバル:1 //インターバルコールバック時間、 } //完了後のコールバック}、opts = {}、timer = null; opts = tydic.extend(option、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(){var ts = opts.endtime -opts.nowtime //残りのミリ秒、dd = parseint(ts/ 8.64e7)//残りの日を計算する、hh = parseint(ts/ 3.6e7%24)// parseint(ts/ 1e3%60)//残りの秒を計算します。 //現在の時刻はopts.nowtime += opts.interval * 1e3; if(ts <= 0){clearInterval(Timer); opts.finaled(); } else {opts.called(dd、hh、mm、ss); }}}};ブラウザ検出方法セット
Angela.Browser = {//#Browser Browsers:{//#Browser Kernelカテゴリweixin:/micromessenger(//d/。 /ucbrowser (///d/.] //オープンブラウザー、sougou:/sogoumobilebrowser(///d/.] /safari(///d/.] } catch(e){try {window.sidebar.addpanel(title、url、 ''); } catch(e){errcall(); }}}、// browserバージョンcoreinit:function(){//#noadd var i = null、browsers = this.browsers、ua = window.navigator.useragent.tolowercase()、browser = ''、pos = 1; for(i i in browsers){if(brower = ua.match(browsers [i])){if(i == 'opera'){pos = 2; } else {pos = 1; } this.version =(brower [pos] || '').replace(/[/// s]+/、 ''); this.core = i;私を返します。 }}} // IEバージョンを検出!サポートされるIEのみ:バージョン5,6,7,8,9、IE:(function(){//#IEバージョン!のみサポート:IE5,6,7,8,9 var v = 3、document.createelement( 'div')、all = div.getelementsbytagname( 'i'); ']> <i> </i> <>'、すべて[0]);JSONメソッド
Angela.json = {//#json Object //文字列はjsonオブジェクトになります。 ///(?:["//// bfnrt] | u [/da-fa-f] {4})/g、rvalidtokens = /"///ro/true|false|null | ??:/d+/. |)/d+(? if(window.json && window.json.parse){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)))(); } } 戻る ''; }};メソッドを拡張します
Angela.extend = function(){//#オブジェクト拡張機能varターゲット=引数[0] || {}、i = 1、length = arguments.length、options; if(typeof target!= "object" && typeof target!= "function")ターゲット= {}; for(; i <length; i ++){if((options = arguments [i])!= null){for(var name in options){var copy = options [name]; if(target === copy){続行; } if(copy!== undefined){target [name] = copy; }}}}ターゲットを返します;};型判断の方法
/**可変valが整数タイプであるかどうかを判断します*/function is number(val){return typeof val === 'number' && isfinite(val);}/**変数valはブールタイプ*/function isboolean(val){return typeof val === 'boolean';}/** unting thepof*/val(val)を返します。 === 'string';}/**可変valが未定義であるかどうかを判断*/function isundefined(val){return typeof val ==== 'string';}/**変数valが未定義*/fucture isundefined(val){return typeof val ==== 'undefined';}/** valiable valはvaliable val is obult is object bal isobjであるかどうかを判断します。 (str === null || typeof str === '未定義'){return false; } return typeof str === 'object';}/**Judge whether the variable val is null*/function isNull(val) { return val === null;}/**Judge whether the variable arr is an array*Method 1*/function isArray1(arr) { return Object.prototype.toString.apply(arr) === '[object Array]';}/**Just determine whether the variable arr Array*Method 2*/function isArray2(arr){if(arr === null || typeof arr === '未定義'){return false; } return arr.constructor === array;}