├── .gitignore
├── LICENSE
├── README.md
├── build
├── LICENSE
├── README.md
├── css
│ └── pullload.css
├── index.html
├── index2.html
├── index3.html
└── js
│ ├── pullload.js
│ ├── require-config.js
│ ├── require.js
│ └── zepto.min.js
├── css
└── pullload.less
├── fis-conf.js
├── index.html
├── index2.html
├── index3.html
└── js
├── pullload.js
├── require-config.js
├── require.js
└── zepto.min.js
/.gitignore:
--------------------------------------------------------------------------------
1 | output/*
2 | output
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 dainli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # pullLoad
2 | 移动端 html5 插件,实现下拉刷新,加载更多等功能,支持require.js
3 |
4 | react 版本 [react-pullLoad](https://github.com/react-ld/react-pullLoad)
5 |
6 | #### 示例
7 | https://lidianhao123.github.io/pullLoad/
8 |
9 | # 基本思路
10 | 1. 不依赖第三方库
11 | 2. 固定DOM结构
12 | 3. 支持 body 或者固定高度的 DOM 块级元素作为外部容器 contianer(即可视区域大小)
13 | 4. 普通版本和 react 版本核心代码一致,即抽离出核心代码层和具体实现层
14 |
15 | 经过实际开发发现抽离核心代码使逻辑更加的复杂,直接复用核心逻辑完成具体实现。
16 |
17 | 5. 触摸事件绑定在内容块 content(即高度为 auto 的DOM )
18 |
19 | # 功能点
20 | 1. 下拉刷新
21 | 2. 滚动到距底部距离小于阈值加载更多
22 | 3. 上拉加载更多 TODO
23 | 4. 通过复写 css 实现自定义样式 TODO
24 | 5. 返回顶部功能 TODO
25 | 6. 所有功能点已扩展的形式进行开发互不影响 TODO
26 |
27 | # 使用说明
28 | #### 添加固定 DOM 结构模板
29 |
30 | ```html
31 |
32 |
33 |
39 |
40 |
41 |
42 |
48 |
49 | ```
50 |
51 | #### 添加 Javascript 文件
52 |
53 | ```html
54 |
55 | ```
56 | 当然也支持 require 模块化方式
57 | ```js
58 | require(["zepto", "pullload"], function($, pullload) {})
59 | ```
60 |
61 | #### 创建 pullload 对象
62 |
63 | 此示例代码为 [domo1](https://lidianhao123.github.io/pullLoad/index.html) 中部分代码节选,详情可直接参考 [domo1](https://lidianhao123.github.io/pullLoad/index.html)
64 | ```js
65 | var installObj = new pullload({
66 | container: document.body,
67 | wrapper: document.getElementById("test_div"),
68 | downEnough: 100,
69 | distanceBottom: 300,
70 | // onRefresh 有两个回调函数,二者必须调用一个
71 | onRefresh: function(success,error){
72 | console.info("实际代码 onRefresh")
73 | setTimeout(function(){
74 | $(".test-ul").html(createAll(data));
75 | success(); //完成刷新调用
76 | },2000);
77 | //error(); //异常调用
78 | },
79 | // onLoadMore 有两个回调函数,二者必须调用一个
80 | onLoadMore: function(success, error){
81 | console.info("实际代码 onLoadMore")
82 | setTimeout(function(){
83 | $(".test-ul").append(createLi(data[loadMoreIndex]));
84 | // if(--loadMoreIndex){
85 | success(false); //加载动作完成
86 | // } else{
87 | // success(true); //加载动作完成 并且传递 true 参数通知组件无更多内容
88 | // }
89 | },500);
90 | //error(); //单词请求异常调用
91 | },
92 | });
93 | ```
94 |
95 | # 参数说明:
96 | - container 可以是 body 或者固定高度的 DOM 块级元素作为外部容器
97 | - wrapper 必须是上述 id="test_div" 元素
98 | - downEnough 下拉满足刷新的距离 默认值为100像素
99 | - distanceBottom 距离底部距离触发加载更多 默认值为100像素
100 | - onRefresh 满足刷新动作回调函数,刷新的具体业务代码在此函数中进行,并且需要 success 或者 error
101 | - onLoadMore 满足加载更多回调函数,加载更多聚义业务代码在此函数中进行,并且需要 success 或者 error。无更多内容时请执行success(true);
102 |
103 | # License
104 | MIT
105 |
--------------------------------------------------------------------------------
/build/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 dainli
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/build/README.md:
--------------------------------------------------------------------------------
1 | # pullLoad
2 | 移动端 html5 插件,实现下拉刷新,加载更多等功能,支持require.js
3 |
4 | #### 示例
5 | http://lidianhao123.github.io/pullLoad/
6 |
7 | # 基本思路
8 | 1. 不依赖第三方库
9 | 2. 固定DOM结构
10 | 3. 支持 body 或者固定高度的 DOM 块级元素作为外部容器 contianer(即可视区域大小)
11 | 4. 普通版本和 react 版本核心代码一致,即抽离出核心代码层和具体实现层
12 |
13 | 经过实际开发发现抽离核心代码使逻辑更加的复杂,直接复用核心逻辑完成具体实现。
14 |
15 | 5. 触摸事件绑定在内容块 content(即高度为 auto 的DOM )
16 |
17 | # 功能点
18 | 1. 下拉刷新
19 | 2. 滚动到距底部距离小于阈值加载更多
20 | 3. 上拉加载更多 TODO
21 | 4. 通过复写 css 实现自定义样式 TODO
22 | 5. 返回顶部功能 TODO
23 | 6. 所有功能点已扩展的形式进行开发互不影响 TODO
24 |
25 | # 使用说明
26 | #### 添加固定 DOM 结构模板
27 |
28 | ```html
29 |
30 |
31 |
37 |
38 |
39 |
40 |
46 |
47 | ```
48 |
49 | #### 添加 Javascript 文件
50 |
51 | ```html
52 |
53 | ```
54 | 当然也支持 require 模块化方式
55 | ```js
56 | require(["zepto", "pullload"], function($, pullload) {})
57 | ```
58 |
59 | #### 创建 pullload 对象
60 |
61 | 此示例代码为 [domo1](http://lidianhao123.github.io/pullLoad/index.html) 中部分代码节选,详情可直接参考 [domo1](http://lidianhao123.github.io/pullLoad/index.html)
62 | ```js
63 | var installObj = new pullload({
64 | container: document.body,
65 | wrapper: document.getElementById("test_div"),
66 | downEnough: 100,
67 | distanceBottom: 300,
68 | // onRefresh 有两个回调函数,二者必须调用一个
69 | onRefresh: function(success,error){
70 | console.info("实际代码 onRefresh")
71 | setTimeout(function(){
72 | $(".test-ul").html(createAll(data));
73 | success(); //完成刷新调用
74 | },2000);
75 | //error(); //异常调用
76 | },
77 | // onLoadMore 有两个回调函数,二者必须调用一个
78 | onLoadMore: function(success, error){
79 | console.info("实际代码 onLoadMore")
80 | setTimeout(function(){
81 | $(".test-ul").append(createLi(data[loadMoreIndex]));
82 | // if(--loadMoreIndex){
83 | success(false); //加载动作完成
84 | // } else{
85 | // success(true); //加载动作完成 并且传递 true 参数通知组件无更多内容
86 | // }
87 | },500);
88 | //error(); //单词请求异常调用
89 | },
90 | });
91 | ```
92 |
93 | # 参数说明:
94 | - container 可以是 body 或者固定高度的 DOM 块级元素作为外部容器
95 | - wrapper 必须是上述 id="test_div" 元素
96 | - downEnough 下拉满足刷新的距离 默认值为100像素
97 | - distanceBottom 距离底部距离触发加载更多 默认值为100像素
98 | - onRefresh 满足刷新动作回调函数,刷新的具体业务代码在此函数中进行,并且需要 success 或者 error
99 | - onLoadMore 满足加载更多回调函数,加载更多聚义业务代码在此函数中进行,并且需要 success 或者 error。无更多内容时请执行success(true);
--------------------------------------------------------------------------------
/build/css/pullload.css:
--------------------------------------------------------------------------------
1 | .state-pulling .tloader-msg:after{content:'下拉刷新'}.state-pulling.enough .tloader-msg:after{content:'松开刷新'}.state-refreshed .tloader-msg:after{content:'刷新成功'}.tloader-loading:after{content:'正在加载...'}.tloader-symbol .tloader-loading:after{content:'正在刷新...'}.tloader-btn:after{content:'没有更多'}.tloader{position:relative}.tloader-symbol{position:absolute;top:0;left:0;right:0;color:#7676a1;text-align:center;height:3rem;overflow:hidden}.state- .tloader-symbol,.state-reset .tloader-symbol{height:0}.state-reset .tloader-symbol{-webkit-transition:height 0s .2s;transition:height 0s .2s}.tloader-msg{line-height:3rem;font-size:11px;opacity:0}.state-pulling .tloader-msg{opacity:1}.state-pulling .tloader-msg i{display:inline-block;font-size:2em;margin-right:.6em;vertical-align:middle;height:1em;border-left:1px solid;position:relative;-webkit-transition:-webkit-transform .3s ease;transition:transform .3s ease}.state-pulling .tloader-msg i:before,.state-pulling .tloader-msg i:after{content:'';position:absolute;font-size:.5em;width:1em;bottom:0;border-top:1px solid}.state-pulling .tloader-msg i:before{right:1px;-webkit-transform:rotate(50deg);transform:rotate(50deg);-webkit-transform-origin:right;transform-origin:right}.state-pulling .tloader-msg i:after{left:0;-webkit-transform:rotate(-50deg);transform:rotate(-50deg);-webkit-transform-origin:left;transform-origin:left}.state-pulling.enough .tloader-msg i{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.state-refreshed .tloader-msg{opacity:1;-webkit-transition:opacity 1s;transition:opacity 1s}.state-refreshed .tloader-msg i{display:inline-block;-webkit-box-sizing:content-box;box-sizing:content-box;vertical-align:middle;margin-right:10px;font-size:20px;height:1em;width:1em;border:1px solid;border-radius:100%;position:relative}.state-refreshed .tloader-msg i:before{content:'';position:absolute;top:3px;left:7px;height:11px;width:5px;border:solid;border-width:0 1px 1px 0;-webkit-transform:rotate(40deg);transform:rotate(40deg)}.state-refreshing .tloader-body{-webkit-transform:translate3d(0,3rem,0);transform:translate3d(0,3rem,0);-webkit-transition:-webkit-transform .2s;transition:transform .2s}.state-refreshed .tloader-body{-webkit-animation:refreshed 1s;animation:refreshed 1s}.state-reset .tloader-body{-webkit-transition:-webkit-transform .2s;transition:transform .2s}@-webkit-keyframes refreshed{0%{-webkit-transform:translate3d(0,3rem,0);transform:translate3d(0,3rem,0)}50%{-webkit-transform:translate3d(0,3rem,0);transform:translate3d(0,3rem,0)}}@keyframes refreshed{0%{-webkit-transform:translate3d(0,3rem,0);transform:translate3d(0,3rem,0)}50%{-webkit-transform:translate3d(0,3rem,0);transform:translate3d(0,3rem,0)}}.state-refreshing .tloader-footer{display:none}.tloader-footer .tloader-btn{color:#484869;font-size:.9em;text-align:center;line-height:3rem;display:none}.state-loading .tloader-footer .tloader-btn{display:none}.tloader-loading{display:none;text-align:center;line-height:3rem;font-size:11px;color:#7676a1}.tloader-loading .ui-loading{font-size:20px;margin-right:.6rem}.state-refreshing .tloader-symbol .tloader-loading,.state-loading .tloader-footer .tloader-loading{display:block}@-webkit-keyframes circle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes circle{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ui-loading{display:inline-block;vertical-align:middle;font-size:1.5rem;width:1em;height:1em;border:2px solid #9494b6;border-top-color:#fff;border-radius:100%;-webkit-animation:circle .8s infinite linear;animation:circle .8s infinite linear}#ui-waiting .ui-loading{border:2px solid #fff;border-top-color:#9494b6}@-webkit-keyframes tloader-progressing{0%{width:0}10%{width:40%}20%{width:75%}30%{width:95%}}@keyframes tloader-progressing{0%{width:0}10%{width:40%}20%{width:75%}30%{width:95%}}@-webkit-keyframes tloader-progressed{0%{opacity:1}}@keyframes tloader-progressed{0%{opacity:1}}.tloader-progress{position:relative}.tloader-progress:before{content:"";z-index:1000;position:absolute;top:0;left:0;height:2px;background-color:#08BF06;width:99%;-webkit-animation:tloader-progressing 9s ease-out;animation:tloader-progressing 9s ease-out}.ed.tloader-progress:before{opacity:0;width:100%;-webkit-animation:tloader-progressed 1s;animation:tloader-progressed 1s}
--------------------------------------------------------------------------------
/build/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | pullload 以 body 为滚动容器
6 |
7 |
13 |
14 |
15 |
16 |
34 |
35 |
36 |
89 |
90 |
--------------------------------------------------------------------------------
/build/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | pullload 支持 require.js 方式
6 |
7 |
8 |
9 |
15 |
16 |
17 |
18 |
36 |
91 |
92 |
--------------------------------------------------------------------------------
/build/index3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | pullload 以块级元素为滚动容器
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
37 |
92 |
93 |
--------------------------------------------------------------------------------
/build/js/pullload.js:
--------------------------------------------------------------------------------
1 | (function(){
2 |
3 | var defaultConfig = {
4 | container: null, //具有scroll的容器
5 | wrapper: null, //结构外包围元素
6 | downEnough: 100, //下拉满足刷新的距离
7 | offsetScrollTop: 2, //与顶部的距离
8 | distanceBottom: 100, //距离底部距离触发加载更多
9 | onRefresh: function(){},
10 | onLoadMore: function(){}
11 | }
12 |
13 | var STATS = {
14 | init: '',
15 | pulling: 'pulling',
16 | enough: 'pulling enough',
17 | refreshing: 'refreshing',
18 | refreshed: 'refreshed',
19 | reset: 'reset',
20 | loading: 'loading' // loading more
21 | };
22 |
23 | var pullload = function(opts){
24 | this.config = {};
25 | this.container = null; //具有scroll的容器
26 | this.wrapper = null; //结构外包围元素
27 | this.loaderBody = null; //DOM 对象
28 | this.loaderSymbol = null; //DOM 对象
29 | this.loaderBtn = null; //DOM 对象
30 | this.loaderState = STATS.init;
31 | this.hasMore = true; //是否有加载更多
32 | this.startX = 0; //用于保存touchstart时初始位置
33 | this.startY = 0;//用于保存touchstart时初始位置
34 | this.init(opts);
35 | }
36 |
37 | pullload.prototype = {
38 | init: function(opts){
39 | this.config = extend(defaultConfig, opts || {});
40 |
41 | this.container = opts.container;
42 | this.wrapper = opts.wrapper;
43 |
44 | this.loaderBody = this.wrapper.querySelector(".tloader-body");
45 | this.loaderSymbol = this.wrapper.querySelector(".tloader-symbol");
46 | this.loaderBtn = this.wrapper.querySelector(".tloader-btn");
47 |
48 | //将函数 'onTouchStart','onTouchMove','onTouchEnd' 进行 this 绑定。
49 | bindAll(['onTouchStart','onTouchMove','onTouchEnd'], this);
50 |
51 | addEvent(this.wrapper, "touchstart", this.onTouchStart);
52 | addEvent(this.wrapper, "touchmove", this.onTouchMove);
53 | addEvent(this.wrapper, "touchend", this.onTouchEnd);
54 | },
55 | destory: function(){
56 | removeEvent(this.wrapper, "touchstart", this.onTouchStart);
57 | removeEvent(this.wrapper, "touchmove", this.onTouchMove);
58 | removeEvent(this.wrapper, "touchend", this.onTouchEnd);
59 | this.config = {};
60 | this.container = null; //具有scroll的容器
61 | this.wrapper = null; //结构外包围元素
62 | this.loaderBody = null; //DOM 对象
63 | this.loaderSymbol = null; //DOM 对象
64 | this.loaderBtn = null; //DOM 对象
65 | this.loaderState = STATS.init;
66 | this.hasMore = true; //是否有加载更多
67 | this.startX = 0; //用于保存touchstart时初始位置
68 | this.startY = 0;//用于保存touchstart时初始位置
69 | },
70 | onTouchStart: function(event){
71 | var targetEvent = event.changedTouches[0];
72 | this.startX = targetEvent.clientX;
73 | this.startY = targetEvent.clientY;
74 | },
75 | onTouchMove: function(event){
76 | var targetEvent = event.changedTouches[0],
77 | x = targetEvent.clientX,
78 | y = targetEvent.clientY,
79 | scrollTop = this.container.scrollTop,
80 | scrollH = this.container.scrollHeight,
81 | conH = this.container === document.body ? document.documentElement.clientHeight : this.container.offsetHeight;
82 | diffX = x - this.startX,
83 | diffY = y - this.startY;
84 |
85 | //判断垂直移动距离是否大于5 && 横向移动距离小于纵向移动距离
86 | if(Math.abs(diffY) > 5 && Math.abs(diffY) > Math.abs(diffX)){
87 | //滚动距离小于设定值 &&回调onPullDownMove 函数,并且回传位置值
88 | if(diffY > 5 && scrollTop < this.config.offsetScrollTop ){
89 | // //阻止执行浏览器默认动作
90 | // event.preventDefault();
91 | this.onPullDownMove(this.startY, y);
92 | } //滚动距离距离底部小于设定值
93 | else if(diffY < 0 && (scrollH - scrollTop - conH) < this.config.distanceBottom ){
94 | //阻止执行浏览器默认动作
95 | // event.preventDefault();
96 | this.onPullUpMove(this.startY, y);
97 | }
98 | }
99 | },
100 | onTouchEnd: function(event){
101 | var targetEvent = event.changedTouches[0],
102 | x = targetEvent.clientX,
103 | y = targetEvent.clientY,
104 | scrollTop = this.container.scrollTop,
105 | scrollH = this.container.scrollHeight,
106 | conH = this.container === document.body ? document.documentElement.clientHeight : this.container.offsetHeight;
107 | diffX = x - this.startX,
108 | diffY = y - this.startY;
109 |
110 | //判断垂直移动距离是否大于5 && 横向移动距离小于纵向移动距离
111 | if(Math.abs(diffY) > 5 && Math.abs(diffY) > Math.abs(diffX)){
112 | if(diffY > 5 && scrollTop < this.config.offsetScrollTop ){
113 | //回调onPullDownRefresh 函数,即满足刷新条件
114 | this.onPullDownRefresh();
115 | }
116 | }
117 | },
118 | onPullDownMove: function(startY, y){
119 | if(this.loaderState === STATS.refreshing){
120 | return false;
121 | }
122 | event.preventDefault();
123 |
124 | var diff = y - startY, loaderState;
125 | if (diff < 0) {
126 | diff = 0;
127 | }
128 |
129 | diff = this.easing(diff);
130 | if (diff > this.config.downEnough) {
131 | loaderState = STATS.enough;
132 | } else {
133 | loaderState = STATS.pulling;
134 | }
135 | this.setChange(diff, loaderState);
136 | },
137 | onPullDownRefresh: function(){
138 | if(this.loaderState === STATS.refreshing){
139 | return false;
140 | }
141 | else if (this.loaderState === STATS.pulling) {
142 | this.setEndState();
143 | } else {
144 | this.setChange(0, STATS.refreshing);
145 | this.resetLoadMore();
146 | if (typeof this.config.onRefresh === "function") {
147 | this.config.onRefresh(
148 | bind(function(){
149 | this.setChange(0, STATS.refreshed);
150 | setTimeout(bind(function(){this.setChange(0, STATS.init);}, this), 1000);
151 | }, this),
152 | bind(function(){
153 | this.setEndState();
154 | }, this)
155 | )
156 | }
157 | }
158 | },
159 | onPullUpMove: function(staartY, y){
160 | if(!this.hasMore || this.loaderState === STATS.loading){
161 | return false;
162 | }
163 | if (typeof this.config.onLoadMore === "function") {
164 | this.setChange(0, STATS.loading);
165 | // console.info(this.state);
166 | this.config.onLoadMore(bind(function(isNoMore){
167 | this.setEndState();
168 | if(isNoMore){
169 | this.setNoMoreState();
170 | }
171 | }, this));
172 | }
173 | },
174 | // 拖拽的缓动公式 - easeOutSine
175 | easing: function(distance) {
176 | // t: current time, b: begInnIng value, c: change In value, d: duration
177 | var t = distance;
178 | var b = 0;
179 | var d = screen.availHeight; // 允许拖拽的最大距离
180 | var c = d / 2.5; // 提示标签最大有效拖拽距离
181 |
182 | return c * Math.sin(t / d * (Math.PI / 2)) + b;
183 | },
184 | setChange: function(pullHeight, state){
185 | var lbodyTop = pullHeight !== 0 ? 'translate3d(0, ' + pullHeight + 'px, 0)' : "",
186 | symbolTop = pullHeight - 50 > 0 ? pullHeight - 50 : 0;
187 | lSymbol = symbolTop !== 0 ? 'translate3d(0, ' + symbolTop + 'px, 0)' : "";
188 |
189 | this.setClassName(state);
190 | this.loaderBody.style.WebkitTransform = lbodyTop;
191 | this.loaderBody.style.transform = lbodyTop;
192 | this.loaderSymbol.style.WebkitTransform = lSymbol;
193 | this.loaderSymbol.style.transform = lSymbol;
194 | },
195 | //设置 wrapper DOM class 值
196 | setClassName: function(state){
197 | this.loaderState = state;
198 | this.wrapper.className = 'tloader state-' + state;
199 | },
200 | //设置动作结束状态
201 | setEndState: function(){
202 | this.setChange(0, STATS.reset);
203 | },
204 | setNoMoreState:function(){
205 | this.loaderBtn.style.display = "block";
206 | this.hasMore = false;
207 | },
208 | resetLoadMore: function(){
209 | this.loaderBtn.style.display = "none";
210 | this.hasMore = true;
211 | }
212 | }
213 |
214 | function extendArrProps(arr, obj1, obj2){
215 | var index = 0, len = arr.length;
216 | for(index; index < len; index++){
217 | var value = arr[index];
218 | if(typeof obj2[value] !== "undefined"){
219 | obj1[value] = obj2[value];
220 | }
221 | }
222 | return obj1;
223 | }
224 |
225 | //copy obj2 props to obj1 no deepClone
226 | function extend(obj1, obj2){
227 | var newObj = {};
228 | for(var s in obj1){
229 | newObj[s] = obj1[s]
230 | }
231 | for(var s in obj2){
232 | newObj[s] = obj2[s]
233 | }
234 | return newObj;
235 | }
236 |
237 | function addEvent(obj, type, fn) {
238 | if (obj.attachEvent) {
239 | obj['e' + type + fn] = fn;
240 | obj[type + fn] = function () { obj['e' + type + fn](window.event); }
241 | obj.attachEvent('on' + type, obj[type + fn]);
242 | } else
243 | obj.addEventListener(type, fn, false);
244 | }
245 | function removeEvent(obj, type, fn) {
246 | if (obj.detachEvent) {
247 | obj.detachEvent('on' + type, obj[type + fn]);
248 | obj[type + fn] = null;
249 | } else
250 | obj.removeEventListener(type, fn, false);
251 | }
252 |
253 | function asArray(quasiArray, start) {
254 | var result = [],
255 | i = (start || 0);
256 | for (; i < quasiArray.length; i++) {
257 | result.push(quasiArray[i]);
258 | }
259 | return result;
260 | }
261 |
262 | function bind(func, context) {
263 | if (arguments.length < 2 && typeof arguments[0] === "undefined") {
264 | return func;
265 | }
266 |
267 | var __method = func;
268 | var args = asArray(arguments, 2);
269 |
270 | return function() {
271 | var array = args.concat(asArray(arguments, 0));
272 | return __method.apply(context, array);
273 | };
274 | }
275 | /* bindAll 批量绑定
276 | * @param fns 待绑定的函数名称
277 | * @param obj 待绑定的实例对象
278 | * @param context 用于绑定的上下文对象
279 | * @describe 如果 context 为 undefined 则context = obj
280 | */
281 | function bindAll(fns, obj, context){
282 | var index = 0, len = fns.length;
283 | if(context === undefined){
284 | context = obj;
285 | }
286 |
287 | for(index; index < len; index++){
288 | var key = fns[index];
289 | if(typeof obj[key] === 'function'){
290 | obj[key] = b(obj[key], context);
291 | }
292 | }
293 | function b(func, context){
294 | return function(){
295 | return func.apply(context, asArray(arguments, 0));
296 | }
297 | }
298 | }
299 |
300 | window.pullload = pullload;
301 | //增加 require 支持
302 | if ( typeof define === "function" && define.amd ) {
303 | define( "pullload", [], function () { return pullload; });
304 | }
305 |
306 | })();
--------------------------------------------------------------------------------
/build/js/require-config.js:
--------------------------------------------------------------------------------
1 | var config = {
2 | baseUrl: "js/", //依赖相对路径
3 | paths: { //如果某个前缀的依赖不是按照baseUrl拼接这么简单,就需要在这里指出
4 | zepto: 'zepto.min',
5 | jquery: 'jquery-2.2.2.min'
6 | },
7 | shim: { //引入没有使用requirejs模块写法的类库。backbone依赖underscore
8 | 'zepto': {
9 | exports: '$'
10 | },
11 | 'jquery': {
12 | exports: '$'
13 | }
14 | }
15 | };
16 |
17 | require.config(config);
18 |
--------------------------------------------------------------------------------
/build/js/zepto.min.js:
--------------------------------------------------------------------------------
1 | /* Zepto 1.1.6 - zepto event ajax form detect fx fx_methods data deferred callbacks selector touch gesture - zeptojs.com/license */
2 | var Zepto=function(){function A(t){return null==t?String(t):S[j.call(t)]||"object"}function D(t){return"function"==A(t)}function Z(t){return null!=t&&t==t.window}function L(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function F(t){return"object"==A(t)}function $(t){return F(t)&&!Z(t)&&Object.getPrototypeOf(t)==Object.prototype}function _(t){return"number"==typeof t.length}function R(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function q(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function I(t){return t in c?c[t]:c[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function W(t,e){return"number"!=typeof e||l[q(t)]?e:e+"px"}function B(t){var e,n;return f[t]||(e=u.createElement(t),u.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),f[t]=n),f[t]}function V(t){return"children"in t?a.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function H(t,e){var n,i=t?t.length:0;for(n=0;i>n;n++)this[n]=t[n];this.length=i,this.selector=e||""}function U(n,i,r){for(e in i)r&&($(i[e])||k(i[e]))?($(i[e])&&!$(n[e])&&(n[e]={}),k(i[e])&&!k(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function X(t,e){return null==e?n(t):n(t).filter(e)}function Y(t,e,n,i){return D(e)?e.call(t,n,i):e}function J(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function G(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function K(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function Q(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)Q(t.childNodes[n],e)}var t,e,n,i,P,O,r=[],o=r.concat,s=r.filter,a=r.slice,u=window.document,f={},c={},l={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},h=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,d=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,g=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],y=["after","prepend","before","append"],b=u.createElement("table"),w=u.createElement("tr"),x={tr:u.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:w,th:w,"*":u.createElement("div")},E=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},j=S.toString,C={},N=u.createElement("div"),M={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},k=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=N).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&N.removeChild(t),i},P=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},O=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(e,i,r){var o,s,f;return p.test(e)&&(o=n(u.createElement(RegExp.$1))),o||(e.replace&&(e=e.replace(d,"<$1>$2>")),i===t&&(i=h.test(e)&&RegExp.$1),i in x||(i="*"),f=x[i],f.innerHTML=""+e,o=n.each(a.call(f.childNodes),function(){f.removeChild(this)})),$(r)&&(s=n(o),n.each(r,function(t,e){v.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},C.Z=function(t,e){return new H(t,e)},C.isZ=function(t){return t instanceof C.Z},C.init=function(e,i){var r;if(!e)return C.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&h.test(e))r=C.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}else{if(D(e))return n(u).ready(e);if(C.isZ(e))return e;if(k(e))r=R(e);else if(F(e))r=[e],e=null;else if(h.test(e))r=C.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}}return C.Z(r,e)},n=function(t,e){return C.init(t,e)},n.extend=function(t){var e,n=a.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],o=i||r?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&i?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:a.call(s&&!i&&t.getElementsByClassName?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=u.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=A,n.isFunction=D,n.isWindow=Z,n.isArray=k,n.isPlainObject=$,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=P,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.noop=function(){},n.map=function(t,e){var n,r,o,i=[];if(_(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return D(t)?this.not(this.not(t)):n(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return n(O(this.concat(n(t,e))))},is:function(t){return this.length>0&&C.matches(this[0],t)},not:function(e){var i=[];if(D(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):_(e)&&D(e.item)?a.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return F(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!F(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!F(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:C.matches(i,t));)i=i!==e&&!L(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!L(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return X(e,t)},parent:function(t){return X(O(this.pluck("parentNode")),t)},children:function(t){return X(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||a.call(this.childNodes)})},siblings:function(t){return X(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=D(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=D(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(Y(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if(F(n))for(e in n)J(this,e,n[e]);else J(this,n,Y(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){J(this,t)},this)})},prop:function(t,e){return t=M[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(g,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?K(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=Y(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=Y(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;if(!n.contains(u.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[P(t)]||r.getPropertyValue(t);if(k(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[P(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==A(t))i||0===i?a=q(t)+":"+W(t,i):this.each(function(){this.style.removeProperty(q(t))});else for(e in t)t[e]||0===t[e]?a+=q(e)+":"+W(e,t[e])+";":this.each(function(){this.style.removeProperty(q(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(G(t))},I(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=G(this),o=Y(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&G(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return G(this,"");i=G(this),Y(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(I(t)," ")}),G(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=Y(this,e,r,G(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=m.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||u.body;t&&!m.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?Z(s)?s["inner"+i]:L(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,Y(this,r,t,s[e]()))})}}),y.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=A(e),"object"==t||"array"==t||null==e?e:C.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null;var f=n.contains(u.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,a),f&&Q(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),C.Z.prototype=H.prototype=n.fn,C.uniq=O,C.deserializeValue=K,n.zepto=C,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||r.test(t.ns))&&(!n||l(t.fn)===l(n))&&(!i||t.sel==i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=T(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function T(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=b,r&&r.apply(i,arguments)},e[n]=w}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=b)),e}function S(t){var e,i={originalEvent:t};for(e in t)x.test(e)||t[e]===n||(i[e]=t[e]);return T(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var b=function(){return!0},w=function(){return!1},x=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(u===n||a===!1)&&(u=a,a=n),u===!1&&(u=w),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(S(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=w),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):T(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=S(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),T(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),b(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),b(e,n,i)}function b(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function w(){}function x(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function T(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function S(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/
35 |
36 |
89 |