Permalink
Browse files

Adding YAML headers for 1.0

  • Loading branch information...
1 parent 8ecf5e2 commit 689d16ef3a03304353b3fa9d9b83fad11bb658fd @darkwing darkwing committed Nov 26, 2009
Showing with 24 additions and 8 deletions.
  1. +12 −4 Source/LazyLoad-yui-compressed.js
  2. +12 −4 Source/LazyLoad.js
@@ -1,10 +1,18 @@
/*
-Script: LazyLoad
+---
+description: LazyLoad
-License: MIT-style license.
+authors:
+ - David Walsh (http://davidwalsh.name)
-Copyright: Copyright (c) 2007-2009 [David Walsh](http://davidwalsh.name/).
+license:
+ - MIT-style license
-Author: David Walsh (http://davidwalsh.name)
+requires:
+ core/1.2.1: '*'
+
+provides:
+ - LazyLoad
+...
*/
var LazyLoad=new Class({Implements:[Options,Events],options:{range:200,image:"blank.gif",resetDimensions:true,elements:"img",container:window,fireScroll:true},initialize:function(a){this.setOptions(a);this.container=document.id(this.options.container);this.elements=$$(this.options.elements);this.containerHeight=this.container.getSize().y;this.start=0;this.elements=this.elements.filter(function(c){if(c.getPosition(this.container).y>this.containerHeight+this.options.range){c.store("oSRC",c.get("src")).set("src",this.options.image);if(this.options.resetDimensions){c.store("oWidth",c.get("width")).store("oHeight",c.get("height")).set({width:"",height:""});}return true;}},this);var b=function(){var c=this.container.getScroll().y;if(c>this.start){this.elements=this.elements.filter(function(d){if((this.container.getScroll().y+this.options.range+this.containerHeight)>=d.getPosition(this.container).y){if(d.retrieve("oSRC")){d.set("src",d.retrieve("oSRC"));}if(this.options.resetDimensions){d.set({width:d.retrieve("oWidth"),height:d.retrieve("oHeight")});}this.fireEvent("load",[d]);return false;}return true;},this);this.start=c;}this.fireEvent("scroll");if(!this.elements.length){this.container.removeEvent("scroll",b);this.fireEvent("complete");}}.bind(this);this.container.addEvent("scroll",b);if(this.options.fireScroll){this.container.fireEvent("scroll");}}});
View
@@ -1,11 +1,19 @@
/*
-Script: LazyLoad
+---
+description: LazyLoad
-License: MIT-style license.
+authors:
+ - David Walsh (http://davidwalsh.name)
-Copyright: Copyright (c) 2007-2009 [David Walsh](http://davidwalsh.name/).
+license:
+ - MIT-style license
-Author: David Walsh (http://davidwalsh.name)
+requires:
+ core/1.2.1: '*'
+
+provides:
+ - LazyLoad
+...
*/
var LazyLoad = new Class({

0 comments on commit 689d16e

Please sign in to comment.