(function(window){ var wt = window.wt = function(selector,parameter){ return new wt.fn.init(selector,parameter); }; wt.fn=wt.prototype={ init:function(selector,parameter){ this.el=selector; return this; }, //input鍏夋爣灞呬腑 inputcenter:function(){ return false; $(this.el).each(function(index, element) { var el=$(this).get(0); if(!el.parameter){el.parameter={}}; el.parameter.height=el.offsetheight; var padding=el.parameter.height/5; el.style.paddingtop=padding+"px"; el.style.lineheight=el.parameter.height-padding; }); }, //input--placeholder鏁堟灉 placeholder:function(){ $(this.el).each(function(index, element) { var el=$(this).get(0); if(!el.parameter){el.parameter={}}; el.parameter.value=el.value; el.parameter.color=el.style.color||"#000"; $(this).css({"color":"#999999"}); el.onmousedown=function(){ if(this.value==this.parameter.value){ this.value=""; this.style.color=this.parameter.color; } } el.onblur=function(){ if(this.value==""||this.value==this.parameter.value){ this.value=this.parameter.value; this.style.color="#999999"; }else{ this.style.color=this.parameter.color; } } }); }, //鍥剧墖鍒楄〃宸﹀彸鍒囨崲鏁堟灉 //class="imageslist" data-base="{auto:false,spacing:20,arrow:['.left','.right']}" imageslistspeed:function(){ $(this.el).each(function(index, element) { new imageslistanimation($(this).get(0),$(this).get(0).getattribute("data-base")); }); }, //鍔犺浇鍥剧墖(images) //class="xx" loadingimages:function(callback){ new loadingall(this.el,{complete:callback}); }, //class="xx" data-base={round:['.bannernav','cur','det'],arrow:['.prev','.next'],width:980} //鍗曞紶鍥剧墖鍒囨崲鏁堟灉 imagesspeed:function(){ $(this.el).each(function(index, element) { new imagesanimation($(this).get(0),$(this).get(0).getattribute("data-base")); }); }, //鑷畾涔塻elect //class="selectinfo" select:function(){ $(this.el).each(function(index, element) { $(this).get(0).data=new creatselect($(this).get(0)); }); }, //瑙嗛鍒楄〃 videolist:function(){ $(this.el).each(function(index, element) { var _database=$(this).get(0).getattribute("data-base"); var _par=eval("("+_database+")"); var _show=_$.checkobj(_par,"show")?_par.show:false; if(_show){show($(this),$(this).index(),_database);} $(this).click(function(){ show($(this),$(this).index(),$(this).get(0).getattribute("data-base")); }); }); function show(obj,index,par){ obj.siblings().removeclass("cur"); obj.addclass("cur") var _par=eval("("+par+")") var content=_$.checkobj(_par,"content")?_par.content:null; var img=_$.checkobj(_par,"bgimg")?_par.bgimg:""; $(content).find("img").attr("src",img); $(content).find("div").html(""); new creatvideo($(content).find("div").get(0),par); } }, //瑙嗛鎾斁 // class="videoinfo" data-base="{flv:'mov_bbb_clip.flv',mp4:'video/mov_bbb.mp4',tips:true,width:640}" onclick="this.data.show();" video:function(){ $(this.el).each(function(index, element) { var par=eval("("+$(this).get(0).getattribute("data-base")+")"); var _tips=_$.checkobj(par,"tips")?par.tips:false; if(!_tips){ $(this).get(0).data=new creatvideo($(this).get(0),$(this).get(0).getattribute("data-base")); }else{ $(this).click(function(){ $(this).get(0).data=new creatvideo($(this).get(0),$(this).get(0).getattribute("data-base")); }); } }); }, popup:function(){ $(this.el).each(function(index, element) { $(this).get(0).data=new creatpopup($(this).get(0)); $(this).click(function(){ $(this).get(0).data.add(); }); }); } }; wt.fn.init.prototype = wt.fn; })(window) //===============================================================妗嗘灦======================================================= function replacehtml(){} replacehtml.prototype = { run:function(){this.searchweb();}, showlbifile:function(obj,url){ new loadajax(obj,url); }, searchweb:function(){ var self=this; $("[data-lbifile]").each(function(index, element) { self.showlbifile($(this),$(this).attr("data-lbifile")); }); } } function loadajax(obj,url){ $.get(url,function(data,status,xhr){ obj.replacewith(data); }) } new replacehtml().run(); //===============================================================touch====================================================== function touch(){ this._angle=""; } touch.prototype={ run: function() { if (this.istouch) { this.bindevent(); } }, testtouch:function(e){ if (e.type == 'touchstart') { this.touch = true; } else if (this.touch) { this.touch = false; return false; } return true; }, getcoord:function(e,c){ return /touch/.test(e.type) ? (e.originalevent || e).changedtouches[0]['page' + c] : e['page' + c]; }, bindevent:function(){ var touch,action,diffx,diffy,endx,endy,scroll,sort,startx,starty,swipe,sorttimer; var self = this; this.$element.on('touchstart', onstart); this.$element.on('touchmove', onmove); this.$element.on('touchend touchcancel', onend); function onstart(ev){ if (self.testtouch(ev) && !action) { action = true; startx = self.getcoord(ev, 'x'); starty = self.getcoord(ev, 'y'); diffx = 0; diffy = 0; sorttimer = settimeout(function () { sort = true; }, 200); self.touchstart(); } } function onmove(ev){ if (action) { endx = self.getcoord(ev, 'x'); endy = self.getcoord(ev, 'y'); diffx = endx - startx; diffy = endy - starty; if (!sort && !swipe && !scroll) { if (math.abs(diffy) > 10) { // it's a scroll scroll = true; // android 4.0 will not fire touchend event $(this).trigger('touchend'); } else if (math.abs(diffx) > 7) { // it's a swipe swipe = true; } } if (swipe) { ev.preventdefault(); // kill page scroll } if (sort) { ev.preventdefault(); // kill page scroll } if (math.abs(diffx) > 5 || math.abs(diffy) > 5) { cleartimeout(sorttimer); } } } function onend(ev){ if (action) { action = false; if (swipe) { } else if (sort) { } else if (!scroll && math.abs(diffx) > 5 && math.abs(diffy) > 5) { // tap if (ev.type === 'touchend') { // prevent phantom clicks ev.preventdefault(); } } swipe = false; sort = false; scroll = false; cleartimeout(sorttimer); var x=math.abs(startx-endx); var y=math.abs(starty-endy); if(x>y||self._angle=="all"){ if(startx>endx){ self.touchmoveleft(); }else if(startxendy){ self.touchmovedown(); }else if(starty'; this._flv_video=''; this._videotips=null; this._videotipsclose=null; this.show(); } creatvideo.prototype={ show:function(){ var self=this; if(this._img!=""){ this._html5_video=''+this._html5_video; } if(this._isautoplay){ this._html5_video=this._html5_video.replace("鑷姩",'autoplay="autoplay"').replace("鏄剧ず",''); }else{ this._html5_video=this._html5_video.replace("鑷姩","").replace("鏄剧ず",'display:none'); this._html5_video=this._html5_video+''; } this.judgevideo(); if(this._tips==true){ $(window).bind('resize', function (e) { self.scale(); }); } }, judgevideo:function(){ if(this._type){ if(this._type=="flv"){ this.showvideo(false); }else if(this._type=="mp4"){ this.showvideo(true); } } else { if(_$.isflash()||!_$.understands_video()){ this.showvideo(false); }else{ this.showvideo(true); } } }, showvideo:function(ishtml5){ var self=this; var _newel; if(this._tips){ this.tips(); _newel=this._videotips.getelementsbytagname("div")[1]; }else{ this.nottips(); _newel=this._el.getelementsbytagname("div")[0]; } if(ishtml5){ _newel.innerhtml=this._html5_video; if(this._isautoplay){ _newel.getelementsbytagname("img")[0].style.display="none"; }else{ var _video_icon=this._img?_newel.getelementsbytagname("img")[1]:_newel.getelementsbytagname("img")[0]; _video_icon.onclick=function (){ self.html5videoplay(this); } } }else{ _newel.innerhtml=this._flv_video; } }, nottips:function(){ this._el.style.position="relative"; var _div=document.createelement("div"); _div.style.position="relative"; _div.style.width=this._width+"px"; _div.style.height=this._height+"px"; _div.style.overflow="hidden"; this._el.appendchild(_div); }, tips:function(){ var self=this; this._videotips=document.createelement("div"); this._videotips.classname="newtips"; var _videotipsbg=document.createelement("div"); _videotipsbg.classname="newtipsbg"; _videotipsbg.onclick=function(){ self.deleteel(); } var _div=document.createelement("div"); _div.style.background="#484848"; _div.style.position="absolute"; _div.style.width=this._width+"px"; _div.style.height=this._height+"px"; this._videotipsclose=document.createelement("div"); this._videotipsclose.classname="newtipsclose"; this._videotipsclose.style.zindex=1; new touch().bindtouch({ $element:$(self._videotipsclose), touchstart: function(){ self.deleteel(); } }); this._videotipsclose.onclick=function(){ self.deleteel(); } this._videotips.appendchild(_videotipsbg); this._videotips.appendchild(_div); this._videotips.appendchild(this._videotipsclose); document.body.appendchild(this._videotips); this.scale(); }, deleteel:function(){ if(this._videotips){ document.body.removechild(this._videotips); this._videotips=null; this._el.data=null; } }, scale:function(){ if (!this._tips) return false; if (!this._videotips) return false; var _height=document.body.scrollheight<=$(window).height()?$(window).height():document.body.scrollheight; var _bg=this._videotips.getelementsbytagname("div")[0]; var _div=this._videotips.getelementsbytagname("div")[1]; _bg.style.width=$(window).width()+"px"; _bg.style.height=_height+"px"; _div.style.left=($(window).width()-this._width)/2+"px"; _div.style.top=($(window).height()-this._height)/2+"px"; this._videotipsclose.style.top=($(window).height()-this._height)/2+"px"; var closeleft=_div.offsetleft+_div.offsetwidth+20; if(closeleft+40<$(window).width()){ this._videotipsclose.style.left=closeleft+"px"; }else{ var top=($(window).height()-this._height)/2-40; top=top<=0?0:top; var left=_div.offsetleft+_div.offsetwidth-40; left=left>$(window).width()-40?$(window).width()-40:left; this._videotipsclose.style.top=top+"px"; this._videotipsclose.style.left=left+"px"; } this._videotipsclose.style.display="block"; }, html5videoplay:function(e){ e.style.display="none"; e.parentnode.getelementsbytagname("img")[0].style.display="none"; e.parentnode.getelementsbytagname("video")[0].style.display="block"; e.parentnode.getelementsbytagname("video")[0].play(); } } //======================================================================鍒涘缓select鎻掍欢============================================== function creatselect(obj){ this._el=obj; this._divselectall=document.createelement("div"); this._divselectall.classname="selectdivcontentall"; this._divselectscroll=document.createelement("div"); this._divselectscroll.classname="selectscroll"; this._divselect=document.createelement("div"); this._divselect.classname="selectdivcontent"; if(ishandle.any()){this.mobile();return false;}; //---娣诲姞鏂扮殑div-select this._el.appendchild(this._divselectall); this._divselectall.appendchild(this._divselectscroll); this._divselectscroll.appendchild(this._divselect); this.add(); } creatselect.prototype={ mobile:function(newselect){ if(newselect){ var addsetlect=$(newselect).clone().get(0); this._el.appendchild(addsetlect); } var _select=$(this._el).find("select"); _select.css({"opacity":"0","display":"block","position":"absolute","top":0,"left":0,"width":"100%","height":$(this._el).find(".selecttitleinfo").outerheight()}); var _icon=$(this._el).find(".selecticon"); var _title=$(this._el).find(".selecttitleinfo").get(0); _title.getelementsbytagname("div")[0].innerhtml = this.checkselect(_select); _title.getelementsbytagname("div")[0].setattribute("value", _select.value); _select.get(0).checked=false; _select.click(function(){ _select.get(0).checked=!_select.get(0).checked; if(_select.get(0).checked){ _icon.addclass("det"); }else{ _icon.removeclass("det"); } }); _select.change(function(){ _title.getelementsbytagname("div")[0].innerhtml = $(_select).children(":selected").text(); _title.getelementsbytagname("div")[0].setattribute("value", _select.value); _icon.removeclass("det"); }); _select.focus(function(){ _icon.addclass("det"); }); _select.blur(function(){ _select.get(0).checked=false; _icon.removeclass("det"); }); }, add:function(newselect){ if(ishandle.any()){this.mobile(newselect);return false;}; if(this._divselect.innerhtml!="") return false; var self=this; if(newselect){ var addsetlect=$(newselect).clone().get(0); this._el.appendchild(addsetlect); } //----鍒濆鍖栧師濮媠elect var _select=addsetlect||$(this._el).find("select").get(0); var _option=_select.getelementsbytagname("option"); //----鍒濆鍖杢itle var _title=$(this._el).find(".selecttitleinfo").get(0); _title.checked=false; //----鍒涘缓鏂扮殑option for(var i=0;i<_option.length;i++){ var _span=document.createelement("span"); _span.index=i; // _span.innerhtml=_option[i].value; _span.innerhtml = _option[i].innerhtml; _span.setattribute("value", _option[i].value); this._divselect.appendchild(_span); _span.onclick=function(e){ _title.checked=false; showselect(_title.flag,_title) _title.getelementsbytagname("div")[0].innerhtml = this.innerhtml; _title.getelementsbytagname("div")[0].setattribute("value", this.getattribute("value")); // _select.value=this.innerhtml; _select.value = this.getattribute("value"); try{eval(selectclick(this.innerhtml))();}catch(e){}; if (!window.event) { e.stoppropagation(); } else if (window.event) { // this code is for ie window.event.cancelbubble = true; } _select.click(); } _span.onmousedown=function(e){ if (!window.event) { e.stoppropagation(); } else if (window.event) { // this code is for ie window.event.cancelbubble = true; }} } if(_option.length>5){ this._divselectscroll.style.height="148px"; try{$(this._divselectscroll).jscrollpane({autoreinitialise: true})}catch(e){}; }else{ var selectheight=$(this._divselect).find("span").eq(0).outerheight()==0?28:$(this._divselect).find("span").eq(0).outerheight(); this._divselectscroll.style.height=selectheight*_option.length+"px"; } //----鍒濆鍖杢itle鏁版嵁 // _title.getelementsbytagname("div")[0].innerhtml=_option[0].value; if(_option.length>0){ _title.getelementsbytagname("div")[0].innerhtml = this.checkselect(_select); _title.getelementsbytagname("div")[0].setattribute("value", _select.value); _select.value=_option[0].value; } //-----鍒ゆ柇鍚戜笂鎴栧悜涓? var flag=false; //icon鏍峰紡澶勭悊 var _icon=$(this._el).find(".selecticon"); //-----title鐐瑰嚮浜嬩欢 _title.onmousedown=function(e){ //if(self._divselectall.offsetheight!=0){return false;} this.checked=!this.checked; //this.checked=true; var bodyheight=$("html").height()<$(window).height()?$(window).height():$("html").height(); if(ishandle.lowerie()){ flag=false; }else{ if($(self._el).offset().top + self._divselectscroll.offsetheight+_title.offsetheight+1 > bodyheight){ flag=true; } } showselect(this.checked,this); } function showselect(angle,obj){ if($(self._el).find("select").size()==0){return false;} if(angle){ _icon.addclass("det"); if(!flag){ self._divselectall.style.top=obj.offsetheight+1+"px"; tweenmax.to(self._divselectall,.3,{css:{height:self._divselectscroll.offsetheight}}); }else{ self._divselectall.style.top="0px"; tweenmax.to(self._divselectall,.3,{css:{height:self._divselectscroll.offsetheight,top:-1-self._divselectscroll.offsetheight}}); } }else{ _icon.removeclass("det"); if(!flag){ tweenmax.to(self._divselectall,.3,{css:{height:0}}); }else{ tweenmax.to(self._divselectall,.3,{css:{height:0,top:0}}); } } } //-------妗岄潰浜嬩欢----- $(document).bind("touchstart",function(event){ //console.log(event.target) }); $(document).mousedown(function(event){ //console.log(event.target,$(self._el).find(".selecttitle").get(0),event.target==$(".selecttitle").get(0)) if(event.target==$(".jspdrag").get(0)||event.target==$(".jspdrag.jsphover").get(0)||event.target==$(self._el).find(".selecticon").get(0)||event.target==$(self._el).find(".selecttitle").get(0)||event.target==$(self._el).find(".selecticon.det").get(0)){return false;} if(_title.checked){ _title.checked=false; showselect(_title.checked,_title); } }); }, checkselect:function(select){ var _innerhtml=$(select).find("option").eq(0).text(); $(select).find("option").each(function(index, element) { if($(this).attr("selected")=="selected"){ _innerhtml=$(this).text(); return false; } }); return _innerhtml; }, deleteel:function(id){ var _select=$(this._el).find("select").get(0); this._el.removechild(_select); this._divselect.innerhtml=""; this._divselectall.style.height="auto"; } } //===================================================================鍥剧墖鍒楄〃鏁堟灉============================================== function imageslistanimation(obj,parameter){ this._arr=[]; this._isspeed=false; this._setnum; this._div=obj; var parameter=eval("("+parameter+")")||eval("("+this._div.getattribute("data-base")+")"); var type=_$.checkobj(parameter,"type")?parameter.type:"li"; this._el=this._div.getelementsbytagname(type); this._auto=_$.checkobj(parameter,"auto")?parameter.auto:true; this._time=_$.checkobj(parameter,"time")?parameter.time:4000; this._maxwidth=math.max(_$.checkobj(parameter,"maxwidth")?parameter.maxwidth:0,this._div.offsetwidth); this._minwidth=math.max(_$.checkobj(parameter,"minwidth")?parameter.minwidth:0,this._el[0].offsetwidth); this._spacing=_$.checkobj(parameter,"spacing")?parameter.spacing:0; this._speed=_$.checkobj(parameter,"speed")?parameter.speed:.4; this._movenum=_$.checkobj(parameter,"movenum")?parameter.movenum:1; this._callback=_$.checkobj(parameter,"callback")?parameter.callback:null; this._arrowarr=_$.checkobj(parameter,"arrow")?parameter.arrow:null; this._round=_$.checkobj(parameter,"round")?parameter.round:null; this._nowpage=1; this._roundarr=[]; this._pagenum=math.floor(this._maxwidth/this._minwidth); this._totalpage=math.ceil(this._el.length/this._movenum); //alert(this._totalpage+"--"+this._pagenum) if(this._movenum!=1&&this._movenum!=this._pagenum){ this._movenum=1; } this.init(); } imageslistanimation.prototype={ init:function (){ this._div.style.position="relative"; for(var i=0;iself._nowpage); } } } this.roundstyle(this._nowpage); }, roundstyle:function (index){ for(var i=0;ithis._totalpage){ this._nowpage=this._totalpage; return false; } }else{ this._nowpage--; if(this._nowpage<1){ this._nowpage=1; return false; } } this.showimages(this._nowpage,isright); } } //===========================================================================鍗曞紶鍥剧墖鍒囨崲=========================================== function imagesanimation(obj,parameter){ this._arr=[]; this._roundarr=[]; this._thumarr=[]; this._preobj=null; this._isspeed=false; this._setnum; this._div=obj; var parameter=eval("("+parameter+")")||eval("("+this._div.getattribute("data-base")+")"); var type=_$.checkobj(parameter,"type")?parameter.type:"li"; this._el=this._div.getelementsbytagname(type); this._show=_$.checkobj(parameter,"show")?parameter.show:true; this._now=_$.checkobj(parameter,"now")?parameter.now:0; this._auto=_$.checkobj(parameter,"auto")?parameter.auto:true; this._time=_$.checkobj(parameter,"time")?parameter.time:4000; this._loop=_$.checkobj(parameter,"loop")?parameter.loop:true; this._round=_$.checkobj(parameter,"round")?parameter.round:null; this._thum=_$.checkobj(parameter,"thum")?parameter.thum:null; this._thum_arrow=_$.checkobj(parameter,"thumarrow")?parameter.thumarrow:null; this._speed=_$.checkobj(parameter,"speed")?parameter.speed:.4; this._ani=_$.checkobj(parameter,"ani")?parameter.ani:"move";//鐩墠灏变袱绉嶅舰寮忥紝 move鍜宎lpha this._callback=_$.checkobj(parameter,"callback")?parameter.callback:null; this._num=_$.checkobj(parameter,"num")?parameter.num:null; this._maxwidth=math.max(_$.checkobj(parameter,"width")?parameter.width:0,this._div.offsetwidth); this._arrowarr=_$.checkobj(parameter,"arrow")?parameter.arrow:null; if(this._el.length==0){ return false; } if(this._num){ this._total=math.ceil(this._el.length/this._num); }else{ this._total=this._el.length; } if(this._show==true) this.init(); } imagesanimation.prototype={ init:function (){ for(var i=0;i1) this.openauto();}//鍒ゆ柇鏄惁鑷姩鎾斁 if(this._arrowarr) this.arrowevent();//鍒ゆ柇鏄惁鏈夌澶? if(this._round) this.roundevent();//鍒ゆ柇鏄惁鏈夊師鐐? if(this._thum) this.thumevent();//鍒ゆ柇鏄惁鏈夌缉鐣ュ浘 if(this._thum_arrow){ if(!this._thum){alert("娌℃湁鎵惧埌缂╃暐鍥?);}else{ this.thumarrowevent(); } } }, showimages:function(num,isright){ var _isright=isright||false; if(this._isspeed==true) return false; this._isspeed=true; this._now=num; this.arrowstyle(this._now); if(this._round)this.roundstyle(this._now); if(this._thum)this.thummove(this._now); if(this._callback) this._callback(num); switch(this._ani){ case "move": this.moveimages(num,_isright); break; case "alpha": this.alphaimages(num); break; case "single": this.singleimages(); break; default: this.moveimages(num,_isright); break; } }, singleimages:function(){ //this._div.style.display="block"; for(var i=0;iself._now); } } } this.roundstyle(this._now); }, roundstyle:function (index){ for(var i=0;iself._now); } } } this.thummove(this._now); }, thummove:function(index){ var _parameter=this._thumarr[0].parameter; for(var i=0;ithis._thumarr.length-_parameter.center){ tweenmax.to(this._thumarr[i],this._speed,{css:{top:(_parameter.width+_parameter.spacing)*(i-(this._thumarr.length-_parameter.pagenum))}}); }else{ tweenmax.to(this._thumarr[i],this._speed,{css:{top:(_parameter.width+_parameter.spacing)*(i-(this._now-_parameter.center))}}); } } } }, thumarrowevent:function (){ var self=this; var _parameter=this._thumarr[0].parameter; var _left=$(this._thum_arrow[0]).get(0); var _right=$(this._thum_arrow[1]).get(0); /*if(_parameter.pagenum>=this._thumarr.length) { //_left.style.display="none"; //_right.style.display="none"; return false; }*/ if(_parameter.pagenum-(this._thumarr.length-_parameter.pagenum)){ tweenmax.to(this._thumarr[i],this._speed,{css:{top:(_parameter.width+_parameter.spacing)*(i+_num-1)}}); } }else{ if(_num<0){ tweenmax.to(this._thumarr[i],this._speed,{css:{top:(_parameter.width+_parameter.spacing)*(i+_num+1)}}); } } } }, getthumleft:function (width){ return math.floor(this._thumarr[0].offsettop/width); }, openauto:function (){ var self=this; this._setnum=setinterval(function (){self.count(true);},self._time); }, closeauto:function (){ clearinterval(this._setnum); }, count:function (isright){ if(this._el.length<=1) return false; if(this._isspeed==true) return false; if(isright==true){ this._now++; if(this._now>=this._total){ if(!this._loop||this._loop!=true) {this._now=this._total-1;return false}; this._now=0; } }else{ this._now--; if(this._now<0){ if(!this._loop||this._loop!=true) {this._now=0;return false}; this._now=this._total-1; } } this.showimages(this._now,isright); } } //===========================================================================loading鍔犺浇=========================================== function loadingall($el,parameter){ this._$el=$el; this.imgnum=0; this.bitmaparr=[]; this.loading_num=0; this.imgarr=[]; this._parameter=parameter; this._loading_el=_$.checkobj(parameter,"loadingel")?parameter.loadingel:".laodingbox"; this._type=_$.checkobj(parameter,"type")?parameter.type:"data_src"; this._complete=_$.checkobj(parameter,"complete")?parameter.complete:null; this._progress=_$.checkobj(parameter,"progress")?parameter.progress:null; this._num=_$.checkobj(parameter,"num")?parameter.num:0; this.start(); } loadingall.prototype={ start:function(){ var _el=$(this._$el).get(0).getelementsbytagname("img"); for(var i=0;i<_el.length;i++){ if(_el[i].getattribute(this._type)){ this.imgarr.push(_el[i].getattribute(this._type)); } } this.loadstartimg(); }, loadstartimg:function (){ var self=this; if(this.imgarr.length==0){ if(self._complete){ self._complete(); } return false; } this.imgnum=0; for(var i=0;i value2){ return 1; }else{ return 0; } }; } } //===========================================================================灏忓伐鍏?============================================== var _$={ checkobj:function(obj,str){ for(var i in obj){ if(i==str) return true; } return false; }, isflash:function(){ var i_flash; var v_flash; if (navigator.plugins) { for (var i = 0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.tolowercase().indexof("shockwave flash") >= 0) { i_flash = true; v_flash = navigator.plugins[i].description.substring(navigator.plugins[i].description.tolowercase().lastindexof("flash ") + 6, navigator.plugins[i].description.length); } } } if(!i_flash&&navigator.useragent.search('msie 8.0')>-1||!i_flash&&navigator.useragent.search('msie 7.0')>-1||!i_flash&&navigator.useragent.search('msie 9.0')>-1){ return true; } if (i_flash) { if (v_flash) { if(parsefloat(v_flash.substring(0,2))>=8){ return true; }else{ return false; } }else{ return false; } } else { return false; } }, understands_video:function(){ return !!document.createelement('video').canplaytype; } } //============================================================================娴忚鍣ㄥ垽鏂?=========================================== var ishandle = { android: function() { return navigator.useragent.match(/android/i) ? true : false; }, isie8: function() { return navigator.useragent.tolowercase().indexof("msie 8") > -1; }, isie9: function() { return navigator.useragent.tolowercase().indexof("msie 9") > -1; }, blackberry: function() { return navigator.useragent.match(/blackberry/i) ? true : false; }, ios: function() { return navigator.useragent.match(/iphone|ipad|ipod/i) ? true : false; }, windows: function() { return navigator.useragent.match(/iemobile/i) ? true : false; }, any: function() { return (ishandle.android() || ishandle.blackberry() || ishandle.ios() || ishandle.windows()); }, ipad: function() { return navigator.useragent.match(/ipad/i) ? true : false; }, status: function() { return checklayout(); }, isless640px: function() { return document.documentelement.clientwidth <= this.clinetsize; }, micromsg: function() { var ua = window.navigator.useragent.tolowercase(); return (ua.match(/micromessenger/i) == 'micromessenger') ? true : false; }, clinetsize: 640, ismiui: function() { return navigator.useragent.match(/miuibrowser/i) ? true : false; }, lowerie: function () { return navigator.useragent.tolowercase().indexof("msie") >0; }, lowerie8: function () { var agent=navigator.useragent.tolowercase(); if(agent.indexof("msie")<0) return false; var ieagent=agent.split("msie"); return parseint(ieagent[1].split(";")[0]) < 8; } }; //===========================================================================鎵嬫満缂╂斁----ort.js==================================== var adaptuilayout = (function () { var regulatescreen = (function () { var cache = {}; var defsize = {width: window.screen.width,height: window.screen.height}; var ver = window.navigator.appversion; var s = window.orientation; var _ = null; var check = function (key) {return key.constructor == string ? ver.indexof(key) > -1 : ver.test(key);}; var add = function (name, key, size) {if (name && key)cache[name] = {key: key,size: size};}; var del = function (name) {if (cache[name])delete cache[name];}; var cal = function () { if (_ != null)return _; for (var name in cache) {if (check(cache[name].key)) { _ = cache[name].size;break;}} if (_ == null)_ = defsize; return _; }; return {add: add,del: del,cal: cal,s: s}; })(); var adapt = function (uiwidth) { var devicewidth,devicepixelratio,targetdensitydpi,initialcontent,head,viewport,ua; ua = navigator.useragent.tolowercase(); isios = ua.indexof('ipad') > -1 || ua.indexof('iphone') > -1; devicepixelratio = window.devicepixelratio; devicepixelratio < 1.5 ? 2 : devicepixelratio; if (window.orientation == 0 || window.orientation == 180) { if (regulatescreen.s != 0) { if (regulatescreen.cal().width < regulatescreen.cal().height) { devicewidth = regulatescreen.cal().width; } else { devicewidth = regulatescreen.cal().height; } } else { devicewidth = regulatescreen.cal().width; } } else { if (regulatescreen.s != 0) { if (regulatescreen.cal().width > regulatescreen.cal().height) { devicewidth = regulatescreen.cal().width; } else { devicewidth = regulatescreen.cal().height; } } else { devicewidth = regulatescreen.cal().height; } } if (devicepixelratio == 2 && (devicewidth == 320 || devicewidth == 360 || devicewidth == 592 || devicewidth == 640)) { devicewidth *= 2;}; if (devicepixelratio == 1.5 && (devicewidth == 320)) {devicewidth *= 2;devicepixelratio = 2;}; if (devicepixelratio == 1.5 && (devicewidth == 640)) {devicepixelratio = 2;}; targetdensitydpi = uiwidth / devicewidth * devicepixelratio * 160; initialcontent = isios ? 'width=' + uiwidth + 'px, user-scalable=no' : 'target-densitydpi=' + targetdensitydpi + ', width=' + uiwidth + ', user-scalable=no'; $("#viewport").remove(); head = document.getelementsbytagname('head'); viewport = document.createelement('meta'); viewport.name = 'viewport'; viewport.id = 'viewport'; viewport.content = initialcontent; if (isios && window.orientation != 0 && window.orientation != 180) { viewport.content = 'width=640'; head.length > 0 && head[head.length - 1].appendchild(viewport); } else { head.length > 0 && head[head.length - 1].appendchild(viewport); } //document.body.style.display="block"; $("body").show(); }; return { regulatescreen: regulatescreen, adapt: adapt }; })(); if(ishandle.isless640px()){ adaptuilayout.adapt(640); } $(window).bind('orientationchange', function (e) { //adaptuilayout.adapt(640); }); //=============================================================寮鸿浆============================== function orien(){ var _horiprompt=document.createelement("div"); _horiprompt.id="horiprompt"; document.body.appendchild(_horiprompt); this.initialize(); } orien.prototype={ initialize:function () { if(ishandle.any()){ this.run(); }else{ $("#horiprompt").remove(); } }, run: function () { if(ishandle.any() && ishandle.isless640px()){ this.phonehori(); }else if(ishandle.ipad()){ this.ipadhori(); } }, ipadhori: function(){ orientationchange(); function orientationchange(){ if (window.orientation == 0 || window.orientation == 180) { $("#horiprompt").show(); } else { $("#horiprompt").hide(); } } window.onorientationchange = function() { orientationchange(); }; }, phonehori:function(){ orientationchange(); function orientationchange(){ if (window.orientation == 0 || window.orientation == 180) { $("#horiprompt").hide(); } else { $("#horiprompt").show(); } } window.onorientationchange = function() { orientationchange(); }; } } if(window.location.tostring().indexof("buytools")<0)new orien();