Skip to content

Commit

Permalink
Merge pull request #378 from be-fe/2.X
Browse files Browse the repository at this point in the history
2.1.8
  • Loading branch information
xieyu33333 committed Jun 2, 2016
2 parents 6100566 + 65614b2 commit 43ec956
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 25 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,22 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE
### Event callbacks

- `{Function}`
- Incomming at initialization, it can also registrat event by way of living example with method "on".
- As the initialization parameter it's needed to beginning with **on** and it would to be lowercase, Camel-Case would be used for binding.
- Due to the different scenes,callback method should be different , there will be different between the incoming parameters.
- Incomming at initialization, it's needed to beginning with **on** and it would to be Camel-Case
- OR all **lowercase** **!! Will be discarded, If the Camel-Case or All-Lower-Case coexist, the Camel-Case will be used.**
- Binding with method "on" at living example, please use the Camel-Case, refer to the following list.
- *Due to the different scenes,callback method should be different , there will be different between the incoming parameters.

Example:

```
var S = new iSlider({..., onslidechanged: callBack, ...});
```javascript
var S = new iSlider({
...,
onSlideChange: callback
onSlideChanged: callback
onslidechanged: callBack, // !!All lower case will be abandoned, and now, it will be covered camelCasing
...
});

// OR
S.on('slideChanged', callBack);
```
Expand Down
20 changes: 14 additions & 6 deletions README_Chinese.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ var data = [{
- 场景内屏蔽原生事件的触发,如:滚动、拖拽、缩放等
- "A"元素,阻止,移动端建议使用自定义的tap(touch系事件联合判断)
- 对表单类元素"SELECT"、"INPUT"、"TEXTAREA"、"BUTTON"、"LABEL",任何情况下均不进行阻止
- *排除策略:若参数类型为字符串(规则,querySelector选择器字符串)或数组(多个规则),此选项为开启状态(true)并排除复合规则的元素,与`iSlider.FIX_PAGE_TAGS`相同对待
- *排除策略:若参数类型为字符串(规则,querySelector选择器字符串)或数组(多个规则),此选项为开启状态(true)并排除符合规则的元素,与`iSlider.FIX_PAGE_TAGS`相同对待
- 默认:true(开启)


Expand All @@ -382,14 +382,22 @@ var data = [{
### 事件回调

- `{Function}`
- 在初始化时传入,也可通过实例方法"on"进行事件注册。
- 作为初始化参数时需要以**on**开头且全为小写,绑定时为驼峰命名。
- 不同的回调方法由于所处场景不同,传入的参数会存在区别。
- 在初始化时作为参数传入,需要以**on**开头,回调方法名改为**首字母大写(驼峰命名)**
- 或者全为**小写** **!!即将废弃,如果同时设置了驼峰及全小写,则采纳驼峰**
- 通过实例方法"on"进行事件注册,驼峰命名,与下列列表中的名称一致即可。
- *不同的回调方法由于所处场景不同,传入的参数会存在区别。

示例:

```
var S = new iSlider({..., onslidechanged: callBack, ...});
```javascript
var S = new iSlider({
...,
onSlideChange: callback
onSlideChanged: callback
onslidechanged: callBack, // !!全小写即将废弃,优先级低于驼峰命名
...
});

// 或者
S.on('slideChanged', callBack);
```
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
"index.html",
"gulp"
],
"version": "2.1.7"
"version": "2.1.8"
}
11 changes: 8 additions & 3 deletions build/iSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
/**
* @constructor
*
* iSlicer([[{HTMLElement} container,] {Array} datalist,] {Object} options)
* iSlider([[{HTMLElement} container,] {Array} datalist,] {Object} options)
*
* @param {HTMLElement} container
* @param {Array} datalist
Expand Down Expand Up @@ -167,7 +167,7 @@
* version
* @type {string}
*/
iSlider.VERSION = '2.1.7';
iSlider.VERSION = '2.1.8';

/**
* Event white list
Expand Down Expand Up @@ -737,7 +737,10 @@
// --------------------------------

iSlider.EVENTS.forEach(function (eventName) {
var fn = opts['on' + eventName.toLowerCase()];
// TODO callback name of All-Lower-Case will be discarded
var fn = opts['on' + eventName.replace(/^\w{1}/, function (m) {
return m.toUpperCase();
})] || opts['on' + eventName.toLowerCase()];
typeof fn === 'function' && self.on(eventName, fn, 1);
});

Expand Down Expand Up @@ -1629,6 +1632,7 @@
* Register event callback
* @param {String} eventName
* @param {Function} func
* @returns {Object} return this instance of iSlider
* @public
*/
iSliderPrototype.on = function (eventName, func, force) {
Expand All @@ -1640,6 +1644,7 @@
this.events[eventName].unshift(func);
}
}
return this;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion build/iSlider.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions change_log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### iSlider 2.1.8
- [Optimization]Compatible the callback parameter camelCasing on initialization. All-Lower-Case nomenclature will be discarded. Currently coexistence, Camel-Case priority.

### iSlider 2.1.7
- [New]Add method "[unshiftData](https://github.com/BE-FE/iSlider/blob/master/README.md#unshiftdata)", now you can append data dynamically into head.
- [Optimization]remove extra _unWatchTransitionEnd
Expand Down
4 changes: 2 additions & 2 deletions demo/animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
<canvas id="loadc" height="96" width="96"></canvas>
<ul id="MAIN"></ul>
<script type="text/javascript" src="./public/js/queue.js"></script>
<script type="text/javascript" src="./public/js/iSlider.js"></script>
<script type="text/javascript" src="./public/js/iSlider.animate.js"></script>
<script type="text/javascript" src="./public/js/iSlider.min.js"></script>
<script type="text/javascript" src="./public/js/iSlider.animate.min.js"></script>
<script>
var LOADC = document.getElementById('loadc');
var ctx = LOADC.getContext('2d');
Expand Down
1 change: 1 addition & 0 deletions demo/public/js/iSlider.animate.min.js

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

11 changes: 8 additions & 3 deletions demo/public/js/iSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
/**
* @constructor
*
* iSlicer([[{HTMLElement} container,] {Array} datalist,] {Object} options)
* iSlider([[{HTMLElement} container,] {Array} datalist,] {Object} options)
*
* @param {HTMLElement} container
* @param {Array} datalist
Expand Down Expand Up @@ -167,7 +167,7 @@
* version
* @type {string}
*/
iSlider.VERSION = '2.1.7';
iSlider.VERSION = '2.1.8';

/**
* Event white list
Expand Down Expand Up @@ -737,7 +737,10 @@
// --------------------------------

iSlider.EVENTS.forEach(function (eventName) {
var fn = opts['on' + eventName.toLowerCase()];
// TODO callback name of All-Lower-Case will be discarded
var fn = opts['on' + eventName.replace(/^\w{1}/, function (m) {
return m.toUpperCase();
})] || opts['on' + eventName.toLowerCase()];
typeof fn === 'function' && self.on(eventName, fn, 1);
});

Expand Down Expand Up @@ -1629,6 +1632,7 @@
* Register event callback
* @param {String} eventName
* @param {Function} func
* @returns {Object} return this instance of iSlider
* @public
*/
iSliderPrototype.on = function (eventName, func, force) {
Expand All @@ -1640,6 +1644,7 @@
this.events[eventName].unshift(func);
}
}
return this;
};

/**
Expand Down
1 change: 1 addition & 0 deletions demo/public/js/iSlider.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions demo/public/js/iSlider.plugin.BIZone.min.js

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

1 change: 1 addition & 0 deletions demo/public/js/iSlider.plugin.button.min.js

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

1 change: 1 addition & 0 deletions demo/public/js/iSlider.plugin.dot.min.js

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

1 change: 1 addition & 0 deletions demo/public/js/iSlider.plugin.zoompic.min.js

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

1 change: 1 addition & 0 deletions gulp/tasks/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = function (gulp, PLUGIN, CONF) {
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(CONF.demo + '/js'))
.pipe(gulp.dest(CONF.build));
});
};
1 change: 1 addition & 0 deletions gulp/tasks/iSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = function (gulp, PLUGIN, CONF) {
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(CONF.demo + '/js'))
.pipe(gulp.dest(CONF.build));
});
};
1 change: 1 addition & 0 deletions gulp/tasks/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = function (gulp, PLUGIN, CONF) {
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(CONF.demo + '/js'))
.pipe(gulp.dest(CONF.build));
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "islider.js",
"version": "2.1.7",
"version": "2.1.8",
"author": "EUX team",
"main": "build/iSlider.min.js",
"description": "Smooth and high-performance slide web framework. Suitable for PC, Mobile WebApp, HTML5 App, Hybrid App",
Expand Down
6 changes: 5 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@
// onslidechange: function () {
// console.debug(arguments, 'Change~ juse one time');
// this.off('slideChange', arguments.callee);
// }
// },
onSlideChange: function () {
console.debug(arguments, 'Came-case');
this.off('slideChange', arguments.callee);
},
_: null
});

Expand Down
7 changes: 5 additions & 2 deletions src/js/iSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
* version
* @type {string}
*/
iSlider.VERSION = '2.1.7';
iSlider.VERSION = '2.1.8';

/**
* Event white list
Expand Down Expand Up @@ -737,7 +737,10 @@
// --------------------------------

iSlider.EVENTS.forEach(function (eventName) {
var fn = opts['on' + eventName.toLowerCase()];
// TODO callback name of All-Lower-Case will be discarded
var fn = opts['on' + eventName.replace(/^\w{1}/, function (m) {
return m.toUpperCase();
})] || opts['on' + eventName.toLowerCase()];
typeof fn === 'function' && self.on(eventName, fn, 1);
});

Expand Down

0 comments on commit 43ec956

Please sign in to comment.