Слияние кода завершено, страница обновится автоматически
var videoUI=function(){};videoUI.startup=function(o){o.root=o.root?o.root:"";var closePngPath=o.root+"res/close.png";if(!$("#videoWin").is("div")){var videoUrl=o.root+"video.html?"+util.objToStr(o);$("body").append("<div id='videoShade'><a href='javascript:void(0);' id='videoClose'><img id='closePng'src='"+closePngPath+"' width='40px' height='40px' />Close</a></div>");$("body").append("<div id='videoWin'><iframe width='100%' height='100%' scrolling='no' frameborder=0 src='"+videoUrl+"' ></iframe></div>");$("#videoShade").css({position:"absolute","background-color":"black",opacity:"0.6",width:$(window).width(),height:$(window).height(),"z-index":10,top:0});$("#videoClose").css({position:"absolute","right":"20px","top":"10px","color":"white","z-index":15});var closeCss=document.getElementById("videoClose");var closePng=document.getElementById("closePng");closeCss.onmouseover=function(){closeCss.style.color="yellow";closePng.style["z-index"]="100";closePng.style.width="45px";closePng.style.height="45px"};closeCss.onmouseout=function(){closeCss.style.color="white";closePng.style["z-index"]="15";closePng.style.width="40px";closePng.style.height="40px"};var width=$(window).width()*0.8;var height=(width*768)/1280;var left=($(window).width()-width)/2;var top=($(window).height()-height)/2;$("#videoWin").css({left:left,top:top,width:width,height:height,"z-index":11,position:"absolute"});$("#videoClose").click(function(){$("#videoWin").remove();$("#videoShade").remove()})}};videoUI.options={"root":"",};videoUI.handler=function(options){options=util.mergeOptions(VideoCanvasPlayer.options,util.mergeOptions(videoUI.options,options));if(options.url==""){options.url="./demo.json"}var drawContainerName="drawContainer";var canvasContainerName="canvasDiv";var progressName="progress";var progressBtnName="progressBtn";var playerName="player";var playPauseName="play-pause";var playBtnName="play";var pauseBtnName="pause";var infoName="info";var mainContainerName="mainContainer";var progressLock=0;
var playerShowLock=0;var timeShowLock=0;var btnMouseDown=0;var timePlayedName="time_played";var timeDurationName="time_duration";var parseLoadingName="parseLoading";var volumeControlName="volume-scrubber";var volumeProgressName="volume-progress";var loadPath="res/loading.gif";var message={load_success:"Loading Success",load_fail:"Loading Failure",play:"Play",pause:"Pause",end:"The End"};$("<canvas id='canvas' style='z-index:3000;'></canvas>").prependTo("#"+canvasContainerName);$("#"+mainContainerName).css({width:options.vw,height:options.vh+64});$("#"+drawContainerName).css({width:options.vw,height:options.vh});$("#"+playerName).css({width:options.vw+2,top:options.vh});var myUI=new VideoCanvasPlayerUI();options.UI=myUI;var myPlayer=new VideoCanvasPlayer(options);myUI.notifyUI=function(act,ctx){if(act==myUI.VIDEO_FRAME){timeShowUI.update(ctx.nowTp,ctx.videoDuration);progressUI.setWidth(ctx.videoDuration<=0?0:(ctx.nowTp/ctx.videoDuration)*100,true);util.log("VIDEO_FRAME lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_END){timeShowUI.update(ctx.videoDuration,ctx.videoDuration);progressUI.setWidth(100,true);playPauseUI.pauseDraw();playPauseUI.showOverMsg();util.log("VIDEO_END lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_RESET){timeShowUI.update(ctx.nowTp,ctx.videoDuration);util.log("VIDEO_RESET lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_END_RESET){timeShowUI.update(ctx.nowTp,ctx.videoDuration);progressUI.setWidth(ctx.videoDuration<=0?0:Math.floor(ctx.nowTp/1000)/(ctx.videoDuration/100000),true);util.log("VIDEO_RESET lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_PLAY){util.log("VIDEO_PLAY lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_PAUSE){util.log("VIDEO_PAUSE lastftp:"+ctx.lastftp+" nowTp:"+ctx.nowTp)}if(act==myUI.VIDEO_LOAD_DATA_SUCCESS){playPauseUI.hideDrawLoading();audioUI.setVolume(ctx.getVolume());msgShow.show(message.load_success);timeShowUI.update(ctx.nowTp,ctx.videoDuration)}if(act==myUI.VIDEO_LOAD_DATA_FAILURE){playPauseUI.hideDrawLoading();
msgShow.show(message.load_fail);progressUI.lock();timeShowUI.lock()}};var eventUI={init:function(){$("."+playPauseName).bind("click",function(e){e.preventDefault();if(!myPlayer.isLoaded()){return true}if($("#"+playBtnName).css("display")=="none"){playPauseUI.pauseDraw();myPlayer.onPause()}else{if($("#"+pauseBtnName).css("display")=="none"){playPauseUI.playDraw();myPlayer.onPlay()}}return true});$("#"+progressBtnName).bind("mousedown",function(e){e.preventDefault();if(progressUI.isLocked()){return false}btnMouseDown=1;progressUI.lock();playPauseUI.pauseDraw();myPlayer.onPause();return false});$("#"+progressBtnName).bind("mousemove",function(e){e.preventDefault();if(btnMouseDown!=1){return false}var pageX=e.pageX;var progressOffsetX=$("#"+progressName).offset().left;var progressBtnOffsetX=$("#"+progressBtnName).parent().offset().left;var progressTotalW=$("#"+progressName).parent().width();var progressBtnTotalW=$("#"+progressBtnName).parent().width();var progresswidth=eval(((pageX-progressOffsetX)/progressTotalW)*100);progresswidth=util.boundary(parseFloat(progresswidth),0,100);processBtnLeftNum=(pageX-progressBtnOffsetX)/progressBtnTotalW;var progressBtnwidth=eval(processBtnLeftNum*100);progressBtnwidth=util.boundary(parseFloat(progressBtnwidth),0,100);$("#"+progressName).css({width:progresswidth+"%"});$("#"+progressBtnName).css({left:progressBtnwidth+"%"});myPlayer.timePoint(progresswidth);return false});$("#"+progressBtnName).bind("mouseout",function(e){if(btnMouseDown==1){btnMouseDown=0;progressUI.unLock();myPlayer.notifyUI(myUI.VIDEO_END_RESET)}return false});$("#"+progressBtnName).bind("mouseup",function(e){if(btnMouseDown==1){btnMouseDown=0;progressUI.unLock();myPlayer.notifyUI(myUI.VIDEO_END_RESET)}return false});$("#"+volumeControlName).bind("click",function(e){e.preventDefault();var volumeDistance=e.pageX-$("#"+volumeControlName).offset().left;var volume=volumeDistance/$("#"+volumeControlName).width();var progressWdith=eval(volume*100);if(parseFloat(progressWdith)>100){progressWdith="100"
}audioUI.setVolume(progressWdith);myPlayer.setVolume(progressWdith);return false});playPauseUI.showParseLoading();myPlayer.load()}};var progressUI={setWidth:function(width,flag){if(!progressUI.isLocked()||flag){$("#"+progressName).css({width:width+"%"});$("#"+progressBtnName).css({left:width+"%"})}},isLocked:function(){return progressLock},lock:function(){progressLock=1},unLock:function(){progressLock=0}};var timeShowUI={isLocked:function(){return timeShowLock},lock:function(){timeShowLock=1},unLock:function(){timeShowLock=0},update:function(current,total){$("#"+timePlayedName).html(util.timeFormat(current));$("#"+timeDurationName).html(util.timeFormat(total))}};var playPauseUI={showParseLoading:function(){var left=$("#"+drawContainerName).attr("width")/2;var top=$("#"+drawContainerName).attr("height")/2;$("<img id='"+parseLoadingName+"' src="+loadPath+" style='position:absolute;z-index:110;left:"+left+"px;top:"+top+"px' />").insertAfter("#"+drawContainerName)},hideDrawLoading:function(){$("#"+parseLoadingName).remove()},showPlayBtn:function(){$("#"+pauseBtnName).hide();$("#"+playBtnName).show()},showPauseBtn:function(){this.hidePauseMsg();$("#"+playBtnName).hide();$("#"+pauseBtnName).show()},showPauseMsg:function(){msgShow.show(message.pause)},hidePauseMsg:function(){msgShow.hide()},showOverMsg:function(){msgShow.show(message.end)},hideOverMsg:function(){msgShow.hide()},setPlayerShowLock:function(){playerShowLock=1},setPlayerShowUnLock:function(){playerShowLock=0},checkPlayerShowLock:function(){return playerShowLock},pauseDraw:function(){this.showPauseMsg();this.showPlayBtn()},playDraw:function(){this.hidePauseMsg();this.showPauseBtn()}};var audioUI={setVolume:function(w){$("#"+volumeProgressName).css({width:w+"%"})}};var msgShow={show:function(msg){$("#"+infoName+" p").css({opacity:1});$("#"+infoName+" p").html(msg)},hide:function(){$("#"+infoName+" p").css({opacity:0})}};eventUI.init()};
var vcp=function(o){if(typeof o==="object"){o=util.mergeOptions(util.copy(vcp.options),o)}this.playCanvas=document.getElementById(o.cID);this.playContext=this.playCanvas.getContext("2d");this.playCanvas.width=o.vw;this.playCanvas.height=o.vh;this.videoCanvas=new vc(o);this.view=this.videoCanvas.getView(0,0);this.pause=true;this.lastftp=0;this.nowTp=0;this.videoDuration=0;this.lastPauseTp=0;this.lastPlayTp=0;this.wr=0;this.hr=0;if(o.UI instanceof vcpUI){this.UI=o.UI}this.vcdpr=new vcdpr();this.vcdpr.Url=o.url;this.vcdpr.vcpObj=this;this.audio=new pAudio(this);this.setVolume(o.volume)};var vcpUI=function(){};vcpUI.prototype={VIDEO_PLAY:1,VIDEO_PAUSE:2,VIDEO_END:3,VIDEO_FRAME:4,VIDEO_RESET:5,VIDEO_LOAD_DATA_SUCCESS:6,VIDEO_LOAD_DATA_FAILURE:7,VIDEO_END_RESET:8,VIDEO_VOLUME:9,notifyUI:function(action,context){console.log("action?"+action)}};vcp.options={"vw":1080,"vh":600,"cw":1080,"ch":600*8,"lineWidth":1,"lineColor":"red","cID":"canvas","FPS":60,"UI":new vcpUI(),"url":"","volume":50,};var VideoCanvasPlayer=vcp;var VideoCanvasPlayerUI=vcpUI;window.VideoCanvasPlayer=window.vcp=vcp;window.VideoCanvasPlayerUI=window.vcpUI=vcpUI;var vcppt=vcp.prototype;vcppt.handletime=function(time){if(typeof time=="undefined"){return}if(time>this.lastftp){this.nowTp=this.nowTp+(time-this.lastftp)}this.lastftp=time;util.log("lastftp:"+time+" nowTp:"+this.nowTp)};vcppt.playback=function(time){do{if(this.pause){return false}var drawdate=this.vcdpr.getTimestampFromJson(this.nowTp);if(drawdate===false&&this.vcdpr.isEnd()&&this.nowTp<this.vcdpr.getDuration()){break}if(drawdate===false){return false}var s=this.vcdpr.getScreen();this.wr=this.view.W/s.w;this.hr=this.view.H/s.h;util.each(drawdate,function(k,v){if(!v.action){return}if(v.action==0){if(!!v.pointX&&!!v.pointY){this.videoCanvas.penDown(v.pointX*this.wr,v.pointY*this.hr)}return}if(v.action==2){if(!!v.pointX&&!!v.pointY){this.videoCanvas.penMove(v.pointX*this.wr,v.pointY*this.hr)}return}if(v.action==1){if(!!v.pointX&&!!v.pointY){this.videoCanvas.penUp(v.pointX*this.wr,v.pointY*this.hr)
}return}if(v.action==5){if(!!v.screenOffset){this.videoCanvas.viewMove(0,v.screenOffset/100*this.view.H,this.view);var pageLineH=Math.ceil(v.screenOffset/100)*this.view.H;this.videoCanvas.drawLine(0,pageLineH-2,this.view.W,pageLineH-10);this.videoCanvas.drawText(Math.ceil(v.screenOffset/100)+"p",this.view.W-50,pageLineH)}return}if(v.action==9){if(!v.imgName||!v.screenIndex){return}var img=this.vcdpr.getImg(v.imgName);if(!(img instanceof Image)){return}var x=0,y=v.screenIndex*this.view.H;if(v.mode==0){this.videoCanvas.drawImage(img,x,y,this.view.W,this.view.H);return}var ivwr=img.width==0||this.view.W==0?0:img.width/this.view.W,ivhr=img.height==0||this.view.H==0?0:img.height/this.view.H;if(img.width>=this.view.W&&ivwr>ivhr){var w=this.view.W,h=img.height*(this.view.W/img.width);this.videoCanvas.drawImage(img,x,y,w,h);return}if(img.height>=this.view.H&&(ivhr>ivwr)){var w=img.width*(this.view.H/img.height),h=this.view.H;this.videoCanvas.drawImage(img,x,y,w,h);return}this.videoCanvas.drawImage(img,x,y)}},this)}while(false);this.view.drawViewTo(this.playContext);return true};vcppt.playing=function(time){time=+new Date();var vcpHandle=this;if(this.vcdpr.isEnd()&&this.nowTp>=this.vcdpr.getDuration()){this.onPause();this.notifyUI(this.UI.VIDEO_END);return}this.handletime(time);if(!this.vcdpr.isEnd()){vcpHandle.playback(time)}window.requestNextAnimationFrame(function(t){vcpHandle.playing(t)});this.notifyUI(this.UI.VIDEO_FRAME)};vcppt.onPause=function(){this.pause=true;this.audio.pause();this.lastPauseTp=+new Date();this.notifyUI(this.UI.VIDEO_PAUSE)};vcppt.onPlay=function(){if(!this.isLoaded()||this.nowTp>=this.vcdpr.getDuration()){return}this.pause=false;this.lastftp=this.lastPlayTp=+new Date();this.videoDuration=this.vcdpr.getDuration();this.audio.play();this.playing(this.nowTp);this.notifyUI(this.UI.VIDEO_PLAY)};vcppt.timePoint=function(tp){if(!this.isLoaded()){return}if(typeof tp=="number"&&(tp>=0&&tp<=100)){this.nowTp=Math.floor(tp*this.vcdpr.getDuration()/100000)*1000;this.vcdpr.resetLastIndex(0);
this.videoCanvas.clearCanvas();this.audio.setCurTime(Math.floor(this.nowTp/1000));this.notifyUI(this.UI.VIDEO_RESET)}util.log("timepoint:"+tp)};vcppt.initAudio=function(s,i){this.audio.setSrc(s);this.audio.ignore(i?i:false);this.audio.setVolume(this.audioVolume/100)};vcppt.setVolume=function(v){if(typeof v!=="number"){return}this.audio.setVolume(v/100);this.notifyUI(this.UI.VIDEO_VOLUME)};vcppt.getVolume=function(){this.audio.getVolume()*100};vcppt.notifyUI=function(action,context){if(action==this.UI.VIDEO_LOAD_DATA_SUCCESS&&!this.isLoaded()){return}if(typeof this.UI.notifyUI=="function"){if(typeof context=="undefined"){context=this}if(action==this.UI.VIDEO_LOAD_DATA_SUCCESS){this.videoDuration=this.vcdpr.getDuration()}this.UI.notifyUI(action,context)}};vcppt.isLoaded=function(){return this.vcdpr.isReadied()&&this.audio.isReadied()};vcppt.load=function(){this.vcdpr.getJsonData()};var vcdpr=function(){this.Url="";this.JsonData={screenSize:{w:0,h:0},"traceData":[],"duration":0};this.loadOk=false;this.lastIndex=0;this.vcpObj=null;this.imgCache={};this.imgLoadedCount=0;this.imgIsLoaded=false};vcdpr.prototype={getJsonData:function(){var own=this,http=$.ajax?$:util.http;http.ajax({type:"get",url:this.Url,dataType:"json",success:function(d){if(typeof d!="object"){d=JSON.parse(d)}if(typeof d=="object"&&d.hasOwnProperty("responseNo")&&d.responseNo==0&&d.hasOwnProperty("videoData")&&d.videoData.hasOwnProperty("traceData")&&d.videoData.hasOwnProperty("duration")&&d.videoData.hasOwnProperty("screenSize")){own.JsonData=d.videoData;own.preProcessor();own.loadOk=true;own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_SUCCESS);return}own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_FAILURE)},error:function(d){util.log(d);own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_FAILURE)}})},preProcessor:function(){var traceData=this.JsonData.traceData;for(var ti=0;ti<this.JsonData.traceData.length;ti++){traceData[ti].timestamp=Number(traceData[ti].timestamp);for(var dj=0;dj<traceData[ti].data.length;dj++){var action=traceData[ti].data[dj];
if(action.length<=0){continue}if(action.action in [0,1,2]){action.pointX=Number(action.pointX);action.pointY=Number(action.pointY);action.screenOffset=Number(action.screenOffset);if(typeof action.screenOffset=="undefined"||action.screenOffset==0){continue}action.pointY=action.pointY+(action.screenOffset/100)*parseInt(this.JsonData.screenSize.h);continue}if(action.action==5){continue}if(action.action==9){this.imgCache[action.imgName]="";continue}}}if(this.JsonData.audioUrl&&(/(.mp3)|(.wav)|(.ogg)$/i).test(this.JsonData.audioUrl)){this.vcpObj.initAudio(this.JsonData.audioUrl)}else{this.vcpObj.initAudio("",true)}this.imgsLoad()},imgsLoad:function(){var own=this;if(util.empty(this.imgCache)){own.imgIsLoaded=true;own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_SUCCESS);return}var http=this.JsonData.imgPath;for(var imgName in this.imgCache){var imgID=new Image();imgID.src=http+imgName;imgID.onload=function(){own.imgLoadedCount++;imgID.loaded=true;if(own.imgLoadedCount==util.len(own.imgCache)){own.imgIsLoaded=true;own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_SUCCESS)}};imgID.onerror=function(){util.log("load picture fail");own.toUI(own.vcpObj.UI.VIDEO_LOAD_DATA_FAILURE)};this.imgCache[imgName]=imgID}},toUI:function(type){if(type==this.vcpObj.UI.VIDEO_LOAD_DATA_SUCCESS&&(!this.loadOk||!this.imgIsLoaded)){return}this.vcpObj.notifyUI(type)},getTimestampFromJson:function(timestamp,flat){var data=[];if(!this.loadOk||this.lastIndex>=this.JsonData.traceData.length||timestamp>this.JsonData.duration){return false}if(flat){return}for(;this.lastIndex<this.JsonData.traceData.length&&this.JsonData.traceData[this.lastIndex].timestamp<=timestamp;this.lastIndex++){for(var i=0;i<=this.JsonData.traceData[this.lastIndex].data.length;i++){if(this.JsonData.traceData[this.lastIndex].data[i]){data.push(this.JsonData.traceData[this.lastIndex].data[i])}}}console.dir(data);return data},getDuration:function(){return Number(this.JsonData.duration)},getScreen:function(){return this.JsonData.screenSize},hasImg:function(){return this.imgCache.hasOwnProperty(imgName)
},getImg:function(imgName){return this.imgCache.hasOwnProperty(imgName)?this.imgCache[imgName]:""},resetLastIndex:function(i){this.lastIndex=0;if(typeof i=="number"&&i>=0&&i<=this.JsonData.traceData.length){this.lastIndex=i}},isEnd:function(){return this.lastIndex>=this.JsonData.traceData.length},isReadied:function(){return this.loadOk&&this.imgIsLoaded}};var viewObj=function(x,y,w,h,ctx){this.X=x;this.Y=y;this.W=w;this.H=h;this.CTX=ctx;this.moveTo=function(x,y){this.X=x;this.Y=y};this.getViewImage=function(){return this.CTX.getImageData(this.X,this.Y,this.W,this.H)};this.drawViewTo=function(ctx){if(ctx instanceof CanvasRenderingContext2D){ctx.save();ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);ctx.drawImage(this.CTX.canvas,this.X,this.Y,this.W,this.H,0,0,ctx.canvas.width,ctx.canvas.height);ctx.restore()}}};var vc=function(o){this.op={};if(typeof o==="object"){this.op=util.mergeOptions(util.copy(vc.options),o)}this.canvas=document.createElement("canvas");this.canvas.width=this.op.cw;this.canvas.height=this.op.ch;this.width=this.canvas.width;this.height=this.canvas.height;this.context=this.canvas.getContext("2d");this.context.strokeStyle=this.op.strokeStyle;this.context.lineWidth=this.op.lineWidth;this.context.font=this.op.font;this.drawingSurfaceImageData=null};var vcpt=vc.prototype;vc.options={"vw":150,"vh":100,"cw":150,"ch":800,"font":"18pt Arial","fillStyle":"red","lineColor":"red","lineWidth":1};vcpt.saveDrawingSurface=function(){this.drawingSurfaceImageData=this.context.getImageData(0,0,this.canvas.width,this.canvas.height)};vcpt.restoreDrawingSurface=function(){if(null!=this.drawingSurfaceImageData){this.context.putImageData(this.drawingSurfaceImageData,0,0)}};vcpt.getView=function(x,y,w,h){return new viewObj(x?x:0,y?y:0,w?w:this.op.vw,h?h:this.op.vh,this.context)};vcpt.penDown=function(x,y){this.context.beginPath();this.context.moveTo(x,y)};vcpt.penUp=function(x,y){this.context.lineTo(x,y);this.context.stroke()};vcpt.penMove=function(x,y){this.context.lineTo(x,y);
this.context.stroke()};vcpt.viewMove=function(x,y,v){if(v instanceof viewObj){v.moveTo(x,y)}};vcpt.drawText=function(s,x,y){this.context.fillText(s,x,y)};vcpt.drawLine=function(sx,sy,ex,ey){this.context.beginPath();this.context.moveTo(sx,sy);this.context.lineTo(ex,ey);this.context.stroke()};vcpt.clearCanvas=function(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height)};vcpt.drawImage=function(img,x,y,w,h){if(img instanceof Image){this.context.drawImage(img,x,y,w,h)}};vcpt.notice=function(vc){};var pAudio=function(h){this.audio=document.createElement("audio");this.vcpObj=h;this.ignored=false;own=this;var ele=new util.ele(this.audio,"audio");var canplaythrough=function(){own.vcpObj.notifyUI(own.vcpObj.UI.VIDEO_LOAD_DATA_SUCCESS);ele.unbind("canplaythrough",canplaythrough)};var error=function(){util.log("load audio fail");own.vcpObj.notifyUI(own.vcpObj.UI.VIDEO_LOAD_DATA_FAILURE)};ele.bind("canplaythrough",canplaythrough);ele.bind("error",error)};pAudio.prototype={play:function(s){if(this.ignored||!this.isReadied()){return}if(s){this.setCurTime(s)}this.audio.paused&&this.audio.play&&this.audio.play()},pause:function(){!this.ignored&&this.isReadied()&&this.audio.pause&&this.audio.pause()},ignore:function(b){if(typeof b=="boolean"){this.ignored=b}else{this.ignored=true}},setVolume:function(v){if(v>0&&v<1){this.audio.volume=v}},getVolume:function(){return this.audio.volume},setSrc:function(s){if(typeof s!=="string"&&!(/(.mp3)|(.wav)|(.ogg)$/i).test(s)){util.log("This audio format is not supported ");return}this.audio.src=s},isReadied:function(){return this.ignored||this.audio.readyState==4},setCurTime:function(s){if(!this.ignored&&typeof s==="number"&&this.audio.currentTime){this.audio.currentTime=s}}};window.requestNextAnimationFrame=(function(){var originalWebkitRequestAnimationFrame=undefined,wrapper=undefined,callback=undefined,geckoVersion=0,userAgent=navigator.userAgent,index=0,self=this;if(window.webkitRequestAnimationFrame){wrapper=function(time){if(time===undefined){time=+new Date()
}self.callback(time)};originalWebkitRequestAnimationFrame=window.webkitRequestAnimationFrame;window.webkitRequestAnimationFrame=function(callback,element){self.callback=callback;originalWebkitRequestAnimationFrame(wrapper,element)}}if(window.mozRequestAnimationFrame){index=userAgent.indexOf("rv:");if(userAgent.indexOf("Gecko")!=-1){geckoVersion=userAgent.substr(index+3,3);if(geckoVersion==="2.0"){window.mozRequestAnimationFrame=undefined}}}return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback,element){var start,finish;window.setTimeout(function(){start=+new Date();callback(start);finish=+new Date();self.timeout=1000/60-(finish-start)},self.timeout)}})();
var util={};var hasOwnProp=Object.prototype.hasOwnProperty;util.logOn=true;util.mergeOptions=function(obj1,obj2){if(!obj2){return obj1}for(var key in obj2){if(hasOwnProp.call(obj2,key)){obj1[key]=obj2[key]}}return obj1};util.deepMerge=function(obj1,obj2){var key,val1,val2;obj1=util.copy(obj1);for(key in obj2){if(hasOwnProp.call(obj2,key)){val1=obj1[key];val2=obj2[key];if(util.isPlain(val1)&&util.isPlain(val2)){obj1[key]=util.deepMerge(val1,val2)}else{obj1[key]=obj2[key]}}}return obj1};util.copy=function(obj){return util.mergeOptions({},obj)};util.isPlain=function(obj){return !!obj&&typeof obj==="object"&&obj.toString()==="[object Object]"&&obj.constructor===Object};util.each=function(obj,fn,context){for(var key in obj){if(hasOwnProp.call(obj,key)){fn.call(context||this,key,obj[key])}}};util.objToStr=function(obj){var str=[];if(typeof obj==="object"){for(var k in obj){str.push(k+"="+encodeURIComponent(obj[k]))}}return str.join("&")};util.strToObj=function(str){var obj={};if(typeof str==="string"){var arr=str.split("&");for(var key in arr){var prop=arr[key].split("=");obj[prop[0]]=decodeURIComponent(prop[1])}}return obj};util.log=function(msg){util.logOn&&console&&console.log(msg)};util.error=function(msg){console&&console.error(msg)};util.timeFormat=function(tt){var min="00";var sec="00";if(typeof tt=="number"){min=Math.floor((tt/1000)/60);sec=Math.floor(tt/1000)-min*60;if(sec<10){sec="0"+sec}}return min+":"+sec};util.boundary=function(v,min,max){if(!min){min=0}if(!max){max=100}if(v<min){return 0}if(v>max){return 100}return v};util.empty=function(o){if(typeof o==="object"&&o instanceof Array){return o.length<=0?true:false}if(typeof o==="object"){for(var p in o){return false}}return true};util.len=function(o){if(typeof o==="object"&&o instanceof Array){return o.length}var len=0;if(typeof o==="object"){for(var p in o){len++}}return len};String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")};util.http={options:{url:"",data:{},dataType:"html",method:"GET",success:function(t){},error:function(s,t){}},ajax:function(_options){_options=util.mergeOptions(this.options,_options);
var _xmlHttp=this.createXMLHttpRequest();_xmlHttp.open(_options.method,_options.url,true);_xmlHttp.setRequestHeader("cache-control","no-cache");if(_options.method.toUpperCase()=="POST"){_xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}_xmlHttp.onreadystatechange=function(){if(_xmlHttp.readyState==4&&_xmlHttp.status==200){var response=null;switch(_options.dataType.toUpperCase()){case"json":response=eval(_xmlHttp.responseText);break;case"xml":response=_xmlHttp.responseXML;break;case"html":response=_xmlHttp.responseText;break;default:response=_xmlHttp.responseText;break}if(typeof(_options.success)!="undefined"){_options.success(_xmlHttp.responseText)}}else{if(_xmlHttp.readyState==4){var codes=["500","501","502","503","504","505","404"];if(codes.join(",").indexOf(_xmlHttp.status.toString())>=0&&typeof(_options.error)!="undefined"){_options.error(_xmlHttp.status,_xmlHttp.responseText)}}}};var query=[],data;for(var key in _options.data){query[query.length]=encodeURI(key)+"="+encodeURIComponent(_options.data[key])}data=query.join("&");_xmlHttp.send(data)},get:function(_u,_s,_e){this.ajax({url:_u,success:_s,error:_e})},createXMLHttpRequest:function(){if(window.ActiveXObject){var aVersions=["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];for(var i=0;i<aVersions.length;i++){try{return new ActiveXObject(aVersions[i])}catch(oError){continue}}}else{if(window.XMLHttpRequest){return new XMLHttpRequest()}}throw new Error("XMLHttp object could not be created.")}};var doc=document;util.ele=function(e,s){this.e=e;this.s=s};util.ele.prototype={html:function(h){this.e&&(this.e.innerHTML=h)},css:function(o){if(this.e&&o&&typeof o=="object"){for(var k in o){if(hasOwnProp.call(o,k)){this.e.style.setProperty(k,o[k],"")}}}else{if(this.e&&typeof o=="string"){return this.e.style.getPropertyValue(o)}}},hide:function(){if(!this.e){return}this.e.setAttribute("olddisplay",this.e.style.display=="none"?"":this.e.style.display);
this.e.style.display="none";util.log("hide:"+this.e.style.display)},show:function(){var old=this.e?this.e.hasAttribute("olddisplay")?this.e.getAttribute("olddisplay"):"":"";this.e&&"none"==this.e.style.display&&(this.e.style.display=old);util.log("show:"+this.e.style.display)},remove:function(){this.e&&this.e.parentNode&&this.e.parentNode.removeChild(this.e)},insertAfter:function(s){var div=doc.createElement("div");div.innerHTML=this.s;var a=div.firstChild;var e=doc.querySelector(s);a&&e&&e.parentNode&&e.parentNode.insertBefore(a,e.nextSibling)},prependTo:function(s){var div=doc.createElement("div");div.innerHTML=this.s;var a=div.firstChild;var e=doc.querySelector(s);a&&e&&e.insertBefore(a,e.firstChild)},append:function(s){var div=doc.createElement("div");div.innerHTML=s;var a=div.firstChild;var e=this.e;a&&e&&e.appendChild(a)},ready:function(fn){if(typeof fn=="function"){window.onload=fn}},attr:function(s){return this.e?this.e.getAttribute(s):""},bind:function(s,fn){this.e&&(this.e.addEventListener?this.e.addEventListener(s,fn):this.e.attachEvent&&this.e.attachEvent("on"+s,fn))},unbind:function(s,fn){this.e&&(this.e.removeEventListener?this.e.removeEventListener(s,fn):this.e.detachEvent&&this.e.detachEvent("on"+s,fn))},offset:function(){var b,c,f=this.e&&this.e.ownerDocument,e=this.e,w=f&&(f.defaultView||f.parentWindow),d={top:0,left:0};return e&&typeof e.getBoundingClientRect!=="undefined"?((d=e.getBoundingClientRect()),b=f.documentElement,c=w,{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},width:function(){return this.e&&this.e!==doc&&this.e!==doc.parentWindow&&1==this.e.nodeType?this.e.offsetWidth:0},height:function(){return this.e&&this.e!==doc&&this.e!==doc.parentWindow&&1==this.e.nodeType?this.e.offsetHeight:0},parent:function(){if(this.e&&this.e.parentNode){return new util.ele(this.e.parentNode,this.e.parentNode.nodeName)}}};util.$$=function(a){var node=null;try{node=a instanceof Node?a:document.querySelector(a)
}catch(e){node=null;util.log(e.message)}return new util.ele(node,typeof a=="string"?a:"")};var $=("undefined"!=typeof jQuery?jQuery:util.$$);window.$=$;
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )