Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Dec 24, 2012
1 parent ad8d891 commit 489b945
Show file tree
Hide file tree
Showing 745 changed files with 594 additions and 523 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Thumbs.db
*.swp
out/
node_modules/
tmp/
tmp/
reports/
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Thumbs.db
*.swp
out/
node_modules/
tmp/
tmp/
reports/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
## Structure

- bin: kissy-nodejs 命令行执行文件
- reports: nodejs 下的单元测试报告
- build: 构建好的发布文件
- docs: API 文档
- docs/api: API 文档
- docs/release-note: 发布文档
- src: 源码、测试等开发资源
- tools: 打包压缩等自动化工具

Expand Down
23 changes: 12 additions & 11 deletions build/datalazyload-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 47 additions & 19 deletions build/datalazyload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Copyright 2012, KISSY UI Library v1.40dev
MIT Licensed
build time: Dec 24 12:56
build time: Dec 24 20:29
*/
/**
* @ignore
Expand Down Expand Up @@ -303,23 +303,12 @@ KISSY.add('datalazyload', function (S, DOM, Event, Base, undefined) {
self._getItemsLength() === 0) {
self.destroy();
}
},
// 加载函数
load = S.buffer(loadItems, DURATION, this);

// scroll 和 resize 时,加载图片
Event.on(win, SCROLL, load);
Event.on(win, TOUCH_MOVE, load);
Event.on(win, RESIZE, load);
};

S.each(self.get("containers"), function (c) {
if (isValidContainer(c)) {
Event.on(c, SCROLL, load);
Event.on(c, TOUCH_MOVE, load);
}
});
// 加载函数
self._loadFn = S.buffer(loadItems, DURATION, this);

self._loadFn = load;
self.resume();

// 需要立即加载一次,以保证第一屏的延迟项可见
if (self._getItemsLength()) {
Expand Down Expand Up @@ -468,6 +457,17 @@ KISSY.add('datalazyload', function (S, DOM, Event, Base, undefined) {
}
},

/**
* get to be lazy loaded elements
* @return {Object} eg: {images:,textareas:}
*/
'getElements': function () {
return {
images: this._images,
textareas: this._areaes
};
},

/**
* Add a array of imgs or textareas to be lazy loaded to monitor list.
* @param {HTMLElement[]|String} els Array of imgs or textareas to be lazy loaded or selector
Expand Down Expand Up @@ -624,10 +624,11 @@ KISSY.add('datalazyload', function (S, DOM, Event, Base, undefined) {
},

/**
* Destroy this component.Will fire destroy event.
* pause lazyload
*/
destroy: function () {
var self = this, load = self._loadFn;
pause: function () {
var self = this,
load = self._loadFn;
Event.remove(win, SCROLL, load);
Event.remove(win, TOUCH_MOVE, load);
Event.remove(win, RESIZE, load);
Expand All @@ -638,6 +639,33 @@ KISSY.add('datalazyload', function (S, DOM, Event, Base, undefined) {
Event.remove(c, TOUCH_MOVE, load);
}
});
},

/**
* resume lazyload
*/
resume: function () {
var self = this,
load = self._loadFn;
// scroll 和 resize 时,加载图片
Event.on(win, SCROLL, load);
Event.on(win, TOUCH_MOVE, load);
Event.on(win, RESIZE, load);

S.each(self.get("containers"), function (c) {
if (isValidContainer(c)) {
Event.on(c, SCROLL, load);
Event.on(c, TOUCH_MOVE, load);
}
});
},

/**
* Destroy this component.Will fire destroy event.
*/
destroy: function () {
var self = this;
self.pause();
self._callbacks = [];
self._images = [];
self._areaes = [];
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 489b945

Please sign in to comment.