'use strict'; var _gsq = _gsq || []; (function() { var s = document.createelement('script'); s.type = 'text/javascript'; s.async = true; var firstscript = document.getelementsbytagname('script')[0]; firstscript.parentnode.insertbefore(s, firstscript); })(); var _smq = _smq || []; window.url = window.url || window.webkiturl; window.audiocontext = window.audiocontext || window.webkitaudiocontext; document.exitfullscreen = document.exitfullscreen || document.webkitexitfullscreen || document.mozexitfullscreen; navigator.getusermedia = navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia || navigator.msgetusermedia; if(!date.now) { date.now = function() { return new date().gettime(); } } /** * 对date的扩展,将 date 转化为指定格式的string * 月(m)、日(d)、12小时(h)、24小时(h)、分(m)、秒(s)、周(e)、季度(q) 可以用 1-2 个占位符 * 年(y)可以用 1-4 个占位符,毫秒(s)只能用 1 个占位符(是 1-3 位的数字) * eg: * (new date()).format("yyyy-mm-dd hh:mm:ss.s") ==> 2006-07-02 08:09:04.423 * (new date()).format("yyyy-mm-dd e hh:mm:ss") ==> 2009-03-10 二 20:09:04 * (new date()).format("yyyy-mm-dd ee hh:mm:ss") ==> 2009-03-10 周二 08:09:04 * (new date()).format("yyyy-mm-dd eee hh:mm:ss") ==> 2009-03-10 星期二 08:09:04 * (new date()).format("yyyy-m-d h:m:s.s") ==> 2006-7-2 8:9:4.18 */ date.prototype.format = function(fmt) { var o = { "m+": this.getmonth() + 1, //月份 "d+": this.getdate(), //日 "h+": this.gethours() % 12 == 0 ? 12 : this.gethours() % 12, //小时 "h+": this.gethours(), //小时 "m+": this.getminutes(), //分 "s+": this.getseconds(), //秒 "q+": math.floor((this.getmonth() + 3) / 3), //季度 "s": this.getmilliseconds() //毫秒 }; var week = { "0": "日", "1": "一", "2": "二", "3": "三", "4": "四", "5": "五", "6": "六" }; if(/(y+)/.test(fmt)) { fmt = fmt.replace(regexp.$1, (this.getfullyear() + "").substr(4 - regexp.$1.length)); } if(/(e+)/.test(fmt)) { fmt = fmt.replace(regexp.$1, ((regexp.$1.length > 1) ? (regexp.$1.length > 2 ? "星期" : "周") : "") + week[this.getday() + ""]); } for(var k in o) { if(new regexp("(" + k + ")").test(fmt)) { fmt = fmt.replace(regexp.$1, (regexp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); } } return fmt; } if(window.element) { element.prototype.requestfullscreen = element.prototype.requestfullscreen || element.prototype.webkitrequestfullscreen || element.prototype.mozrequestfullscreen; element.prototype.on = element.prototype.addeventlistener; element.prototype.off = element.prototype.removeeventlistener; } ; (function() { var lasttime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestanimationframe; ++x) { window.requestanimationframe = window[vendors[x] + 'requestanimationframe']; window.cancelanimationframe = window[vendors[x] + 'cancelanimationframe'] || window[vendors[x] + 'cancelrequestanimationframe']; } if(!window.requestanimationframe) window.requestanimationframe = function(callback, element) { var currtime = new date().gettime(); var timetocall = math.max(0, 16 - (currtime - lasttime)); var id = window.settimeout(function() { callback(currtime + timetocall); }, timetocall); lasttime = currtime + timetocall; return id; }; if(!window.cancelanimationframe) window.cancelanimationframe = function(id) { cleartimeout(id); }; }()); if(! function() {}.bind) { function.prototype.bind = function(context) { var self = this, args = array.prototype.slice.call(arguments); return function() { return self.apply(context, args.slice(1)); } }; }