init
This commit is contained in:
8
include/javascript/yui3/build/imageloader/imageloader-min.js
vendored
Normal file
8
include/javascript/yui3/build/imageloader/imageloader-min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add("imageloader",function(B){B.ImgLoadGroup=function(){this._init();B.ImgLoadGroup.superclass.constructor.apply(this,arguments);};B.ImgLoadGroup.NAME="imgLoadGroup";B.ImgLoadGroup.ATTRS={name:{value:""},timeLimit:{value:null},foldDistance:{validator:B.Lang.isNumber,setter:function(D){this._setFoldTriggers();return D;},lazyAdd:false},className:{value:null,setter:function(D){this._className=D;return D;},lazyAdd:false}};var C={_init:function(){this._triggers=[];this._imgObjs={};this._timeout=null;this._classImageEls=null;this._className=null;this._areFoldTriggersSet=false;this._maxKnownHLimit=0;B.on("domready",this._onloadTasks,this);},addTrigger:function(F,E){if(!F||!E){return this;}var D=function(){this.fetch();};this._triggers.push(B.on(E,D,F,this));return this;},addCustomTrigger:function(D,F){if(!D){return this;}var E=function(){this.fetch();};if(B.Lang.isUndefined(F)){this._triggers.push(B.on(D,E,this));}else{this._triggers.push(F.on(D,E,this));}return this;},_setFoldTriggers:function(){if(this._areFoldTriggersSet){return;}var D=function(){this._foldCheck();};this._triggers.push(B.on("scroll",D,window,this));this._triggers.push(B.on("resize",D,window,this));this._areFoldTriggersSet=true;},_onloadTasks:function(){var D=this.get("timeLimit");if(D&&D>0){this._timeout=setTimeout(this._getFetchTimeout(),D*1000);}if(!B.Lang.isUndefined(this.get("foldDistance"))){this._foldCheck();}},_getFetchTimeout:function(){var D=this;return function(){D.fetch();};},registerImage:function(){var D=arguments[0].domId;if(!D){return null;}this._imgObjs[D]=new B.ImgLoadImgObj(arguments[0]);return this._imgObjs[D];},fetch:function(){this._clearTriggers();this._fetchByClass();for(var D in this._imgObjs){if(this._imgObjs.hasOwnProperty(D)){this._imgObjs[D].fetch();}}},_clearTriggers:function(){clearTimeout(this._timeout);for(var E=0,D=this._triggers.length;E<D;E++){this._triggers[E].detach();}},_foldCheck:function(){var I=true,J=B.DOM.viewportRegion(),H=J.bottom+this.get("foldDistance"),K,E,G,F,D;if(H<=this._maxKnownHLimit){return;}this._maxKnownHLimit=H;for(K in this._imgObjs){if(this._imgObjs.hasOwnProperty(K)){E=this._imgObjs[K].fetch(H);I=I&&E;}}if(this._className){if(this._classImageEls===null){this._classImageEls=[];G=B.all("."+this._className);G.each(function(L){this._classImageEls.push({el:L,y:L.getY(),fetched:false});},this);}G=this._classImageEls;for(F=0,D=G.length;F<D;F++){if(G[F].fetched){continue;}if(G[F].y&&G[F].y<=H){G[F].el.removeClass(this._className);G[F].fetched=true;}else{I=false;}}}if(I){this._clearTriggers();}},_fetchByClass:function(){if(!this._className){return;}B.all("."+this._className).removeClass(this._className);}};B.extend(B.ImgLoadGroup,B.Base,C);B.ImgLoadImgObj=function(){B.ImgLoadImgObj.superclass.constructor.apply(this,arguments);this._init();};B.ImgLoadImgObj.NAME="imgLoadImgObj";B.ImgLoadImgObj.ATTRS={domId:{value:null,writeOnce:true},bgUrl:{value:null},srcUrl:{value:null},width:{value:null},height:{value:null},setVisible:{value:false},isPng:{value:false},sizingMethod:{value:"scale"},enabled:{value:"true"}};var A={_init:function(){this._fetched=false;this._imgEl=null;this._yPos=null;},fetch:function(F){if(this._fetched){return true;}var D=this._getImgEl(),E;if(!D){return false;}if(F){E=this._getYPos();if(!E||E>F){return false;}}if(this.get("bgUrl")!==null){if(this.get("isPng")&&B.UA.ie&&B.UA.ie<=6){D.setStyle("filter",'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.get("url")+'", sizingMethod="'+this.get("sizingMethod")+'", enabled="'+this.get("enabled")+'")');}else{D.setStyle("backgroundImage","url('"+this.get("bgUrl")+"')");}}else{if(this.get("srcUrl")!==null){D.setAttribute("src",this.get("srcUrl"));}}if(this.get("setVisible")){D.setStyle("visibility","visible");}if(this.get("width")){D.setAttribute("width",this.get("width"));}if(this.get("height")){D.setAttribute("height",this.get("height"));}this._fetched=true;return true;},_getImgEl:function(){if(this._imgEl===null){this._imgEl=B.get("#"+this.get("domId"));}return this._imgEl;},_getYPos:function(){if(this._yPos===null){this._yPos=this._getImgEl().getY();}return this._yPos;}};B.extend(B.ImgLoadImgObj,B.Base,A);},"3.0.0",{requires:["base-base","node-style","node-screen"]});
|
||||
33
include/javascript/yui3/build/imageloader/imageloader.js
vendored
Normal file
33
include/javascript/yui3/build/imageloader/imageloader.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.net/yui/license.txt
|
||||
version: 3.0.0
|
||||
build: 1549
|
||||
*/
|
||||
YUI.add('imageloader',function(Y){Y.ImgLoadGroup=function(){this._init();Y.ImgLoadGroup.superclass.constructor.apply(this,arguments);};Y.ImgLoadGroup.NAME='imgLoadGroup';Y.ImgLoadGroup.ATTRS={name:{value:''},timeLimit:{value:null},foldDistance:{validator:Y.Lang.isNumber,setter:function(val){this._setFoldTriggers();return val;},lazyAdd:false},className:{value:null,setter:function(name){this._className=name;return name;},lazyAdd:false}};var groupProto={_init:function(){this._triggers=[];this._imgObjs={};this._timeout=null;this._classImageEls=null;this._className=null;this._areFoldTriggersSet=false;this._maxKnownHLimit=0;Y.on('domready',this._onloadTasks,this);},addTrigger:function(obj,type){if(!obj||!type){return this;}
|
||||
var wrappedFetch=function(){this.fetch();};this._triggers.push(Y.on(type,wrappedFetch,obj,this));return this;},addCustomTrigger:function(name,obj){if(!name){return this;}
|
||||
var wrappedFetch=function(){this.fetch();};if(Y.Lang.isUndefined(obj)){this._triggers.push(Y.on(name,wrappedFetch,this));}
|
||||
else{this._triggers.push(obj.on(name,wrappedFetch,this));}
|
||||
return this;},_setFoldTriggers:function(){if(this._areFoldTriggersSet){return;}
|
||||
var wrappedFoldCheck=function(){this._foldCheck();};this._triggers.push(Y.on('scroll',wrappedFoldCheck,window,this));this._triggers.push(Y.on('resize',wrappedFoldCheck,window,this));this._areFoldTriggersSet=true;},_onloadTasks:function(){var timeLim=this.get('timeLimit');if(timeLim&&timeLim>0){this._timeout=setTimeout(this._getFetchTimeout(),timeLim*1000);}
|
||||
if(!Y.Lang.isUndefined(this.get('foldDistance'))){this._foldCheck();}},_getFetchTimeout:function(){var self=this;return function(){self.fetch();};},registerImage:function(){var domId=arguments[0].domId;if(!domId){return null;}
|
||||
this._imgObjs[domId]=new Y.ImgLoadImgObj(arguments[0]);return this._imgObjs[domId];},fetch:function(){this._clearTriggers();this._fetchByClass();for(var id in this._imgObjs){if(this._imgObjs.hasOwnProperty(id)){this._imgObjs[id].fetch();}}},_clearTriggers:function(){clearTimeout(this._timeout);for(var i=0,len=this._triggers.length;i<len;i++){this._triggers[i].detach();}},_foldCheck:function(){var allFetched=true,viewReg=Y.DOM.viewportRegion(),hLimit=viewReg.bottom+this.get('foldDistance'),id,imgFetched,els,i,len;if(hLimit<=this._maxKnownHLimit){return;}
|
||||
this._maxKnownHLimit=hLimit;for(id in this._imgObjs){if(this._imgObjs.hasOwnProperty(id)){imgFetched=this._imgObjs[id].fetch(hLimit);allFetched=allFetched&&imgFetched;}}
|
||||
if(this._className){if(this._classImageEls===null){this._classImageEls=[];els=Y.all('.'+this._className);els.each(function(node){this._classImageEls.push({el:node,y:node.getY(),fetched:false});},this);}
|
||||
els=this._classImageEls;for(i=0,len=els.length;i<len;i++){if(els[i].fetched){continue;}
|
||||
if(els[i].y&&els[i].y<=hLimit){els[i].el.removeClass(this._className);els[i].fetched=true;}
|
||||
else{allFetched=false;}}}
|
||||
if(allFetched){this._clearTriggers();}},_fetchByClass:function(){if(!this._className){return;}
|
||||
Y.all('.'+this._className).removeClass(this._className);}};Y.extend(Y.ImgLoadGroup,Y.Base,groupProto);Y.ImgLoadImgObj=function(){Y.ImgLoadImgObj.superclass.constructor.apply(this,arguments);this._init();};Y.ImgLoadImgObj.NAME='imgLoadImgObj';Y.ImgLoadImgObj.ATTRS={domId:{value:null,writeOnce:true},bgUrl:{value:null},srcUrl:{value:null},width:{value:null},height:{value:null},setVisible:{value:false},isPng:{value:false},sizingMethod:{value:'scale'},enabled:{value:'true'}};var imgProto={_init:function(){this._fetched=false;this._imgEl=null;this._yPos=null;},fetch:function(withinY){if(this._fetched){return true;}
|
||||
var el=this._getImgEl(),yPos;if(!el){return false;}
|
||||
if(withinY){yPos=this._getYPos();if(!yPos||yPos>withinY){return false;}}
|
||||
if(this.get('bgUrl')!==null){if(this.get('isPng')&&Y.UA.ie&&Y.UA.ie<=6){el.setStyle('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.get('url')+'", sizingMethod="'+this.get('sizingMethod')+'", enabled="'+this.get('enabled')+'")');}
|
||||
else{el.setStyle('backgroundImage',"url('"+this.get('bgUrl')+"')");}}
|
||||
else if(this.get('srcUrl')!==null){el.setAttribute('src',this.get('srcUrl'));}
|
||||
if(this.get('setVisible')){el.setStyle('visibility','visible');}
|
||||
if(this.get('width')){el.setAttribute('width',this.get('width'));}
|
||||
if(this.get('height')){el.setAttribute('height',this.get('height'));}
|
||||
this._fetched=true;return true;},_getImgEl:function(){if(this._imgEl===null){this._imgEl=Y.get('#'+this.get('domId'));}
|
||||
return this._imgEl;},_getYPos:function(){if(this._yPos===null){this._yPos=this._getImgEl().getY();}
|
||||
return this._yPos;}};Y.extend(Y.ImgLoadImgObj,Y.Base,imgProto);},'3.0.0',{requires:['base-base','node-style','node-screen']});
|
||||
Reference in New Issue
Block a user