Skip to content

Commit

Permalink
Release v0.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kaptinlin committed Oct 17, 2016
1 parent 2e08ab8 commit 6851454
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rules:
# Best Practices
accessor-pairs: "error"
block-scoped-var: "error"
consistent-return: "error"
consistent-return: "off"
curly: "error"
default-case: "error"
dot-location: "off"
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ bower install jquery-asScrollable --save
npm install jquery-asScrollable --save
```

#### Install From Yarn
```sh
yarn add jquery-asScrollable
```

#### Build From Source
If you want build from source:

Expand Down Expand Up @@ -155,11 +160,11 @@ You can also save the instances to variable for further use.

```javascript
// call directly
$().asScrollable('destory');
$().asScrollable('destroy');

// or
var api = $().data('asScrollable');
api.destory();
api.destroy();
```

#### scrollTo(direction, position)
Expand Down Expand Up @@ -213,8 +218,8 @@ $('.the-element').on('asScrollable::ready', function (e) {
Event | Description
------- | -----------
ready | Fires when the instance is ready for API use.
enable | This event is fired immediately when the `enable` instance method has been called.
disable | This event is fired immediately when the `disable` instance method has been called.
enable | Fired when the `enable` instance method has been called.
disable | Fired when the `disable` instance method has been called.
destroy | Fires when an instance is destroyed.

## No conflict
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-asScrollable",
"version": "0.4.3",
"version": "0.4.4",
"description": "A jquery plugin that make a block element scrollable.",
"main": "dist/jquery-asScrollable.js",
"copyright": "amazingSurge",
Expand Down Expand Up @@ -29,6 +29,6 @@
],
"dependencies": {
"jquery": ">=2.2.0",
"jquery-asScrollbar": "^0.5.3"
"jquery-asScrollbar": "^0.5.4"
}
}
2 changes: 1 addition & 1 deletion dist/css/asScrollable.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* jQuery asScrollable v0.4.3
* jQuery asScrollable v0.4.4
* https://github.com/amazingSurge/jquery-asScrollable
*
* Copyright (c) amazingSurge
Expand Down
2 changes: 1 addition & 1 deletion dist/css/asScrollable.min.css

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

11 changes: 4 additions & 7 deletions dist/jquery-asScrollable.es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* jQuery asScrollable v0.4.3
* jQuery asScrollable v0.4.4
* https://github.com/amazingSurge/jquery-asScrollable
*
* Copyright (c) amazingSurge
Expand Down Expand Up @@ -36,9 +36,6 @@ var DEFAULTS = {
scrollbar: {}
};

/**
* Helper functions
**/
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
Expand Down Expand Up @@ -804,7 +801,7 @@ class AsScrollable {
}
}

destory() {
destroy() {
this.$wrap.removeClass(`${this.classes.wrap}-vertical`)
.removeClass(`${this.classes.wrap}-horizontal`)
.removeClass(this.classes.wrap)
Expand All @@ -828,7 +825,7 @@ class AsScrollable {
}
this.$content.removeClass(this.classes.content);
this.$element.data(NAMESPACE$1, null);
this.trigger('destory');
this.trigger('destroy');
}

static setDefaults(options) {
Expand All @@ -837,7 +834,7 @@ class AsScrollable {
}

var info = {
version:'0.4.3'
version:'0.4.4'
};

const NAMESPACE = 'asScrollable';
Expand Down
14 changes: 5 additions & 9 deletions dist/jquery-asScrollable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* jQuery asScrollable v0.4.3
* jQuery asScrollable v0.4.4
* https://github.com/amazingSurge/jquery-asScrollable
*
* Copyright (c) amazingSurge
Expand Down Expand Up @@ -100,10 +100,6 @@
scrollbar: {}
};

/**
* Helper functions
**/

function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {

Expand Down Expand Up @@ -1000,8 +996,8 @@
}
}
}, {
key: 'destory',
value: function destory() {
key: 'destroy',
value: function destroy() {
this.$wrap.removeClass(this.classes.wrap + '-vertical').removeClass(this.classes.wrap + '-horizontal').removeClass(this.classes.wrap).removeClass(this.options.enabledClass).removeClass(this.classes.disabledClass);
this.unStyle();

Expand All @@ -1022,7 +1018,7 @@
}
this.$content.removeClass(this.classes.content);
this.$element.data(NAMESPACE$1, null);
this.trigger('destory');
this.trigger('destroy');
}
}], [{
key: 'setDefaults',
Expand All @@ -1035,7 +1031,7 @@
}();

var info = {
version: '0.4.3'
version: '0.4.4'
};

var NAMESPACE = 'asScrollable';
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery-asScrollable.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h3>Simple Structure</h3>
<button class="api-init">Init</button>
<button class="api-enable">enable</button>
<button class="api-disable">disable</button>
<button class="api-destory">Destory</button>
<button class="api-destroy">Destroy</button>
</div>
</section>
</div>
Expand Down Expand Up @@ -206,8 +206,8 @@ <h3>Simple Structure</h3>
$('.api-disable').on('click', function() {
$('.simple').asScrollable('disable');
});
$('.api-destory').on('click', function() {
$('.simple').asScrollable('destory');
$('.api-destroy').on('click', function() {
$('.simple').asScrollable('destroy');
});
});
</script>
Expand Down
49 changes: 19 additions & 30 deletions examples/js/jquery-asScrollbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* jQuery asScrollbar v0.5.3
* jQuery asScrollbar v0.5.4
* https://github.com/amazingSurge/jquery-asScrollbar
*
* Copyright (c) amazingSurge
Expand Down Expand Up @@ -215,40 +215,31 @@
})();
}

/**
* Helper functions
**/
var isPercentage = function isPercentage(n) {
'use strict';

function isPercentage(n) {
return typeof n === 'string' && n.indexOf('%') !== -1;
};

var convertPercentageToFloat = function convertPercentageToFloat(n) {
'use strict';
}

function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
};

var convertMatrixToArray = function convertMatrixToArray(value) {
'use strict';
}

function convertMatrixToArray(value) {
if (value && value.substr(0, 6) === 'matrix') {

return value.replace(/^.*\((.*)\)$/g, '$1').replace(/px/g, '').split(/, +/);
}

return false;
};
}

var getTime = function getTime() {
function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {

return window.performance.now();
}

return Date.now();
};
}

/**
* Css features detect
Expand Down Expand Up @@ -379,11 +370,13 @@
**/

var asScrollbar = function() {
function asScrollbar(bar, options) {
function asScrollbar(bar) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

_classCallCheck(this, asScrollbar);

this.$bar = (0, _jquery2.default)(bar);
options = this.options = _jquery2.default.extend({}, DEFAULTS, options || {}, this.$bar.data('options') || {});
options = this.options = _jquery2.default.extend({}, DEFAULTS, options, this.$bar.data('options') || {});
bar.direction = this.options.direction;

this.classes = {
Expand Down Expand Up @@ -464,13 +457,11 @@
}, {
key: 'trigger',
value: function trigger(eventType) {
var _ref;

for (var _len = arguments.length, params = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
params[_key - 1] = arguments[_key];
}

var data = (_ref = [this]).concat.apply(_ref, params);
var data = [this].concat(params);

// event
this.$bar.trigger(NAMESPACE$1 + '::' + eventType, data);
Expand All @@ -485,9 +476,7 @@
var onFunction = 'on' + eventType;

if (typeof this.options[onFunction] === 'function') {
var _options$onFunction;

(_options$onFunction = this.options[onFunction]).apply.apply(_options$onFunction, [this].concat(params));
this.options[onFunction].apply(this, params);
}
}
}, {
Expand Down Expand Up @@ -1173,8 +1162,8 @@
this.trigger('disable');
}
}, {
key: 'destory',
value: function destory() {
key: 'destroy',
value: function destroy() {
this.$handle.removeClass(this.classes.handleClass);
this.$bar.removeClass(this.classes.barClass).removeClass(this.classes.directionClass).attr('draggable', null);

Expand All @@ -1184,7 +1173,7 @@
this.$bar.off(this.eventName());
this.$handle.off(this.eventName());

this.trigger('destory');
this.trigger('destroy');
}
}], [{
key: 'registerEasing',
Expand All @@ -1211,7 +1200,7 @@
}();

var info = {
version: '0.5.3'
version: '0.5.4'
};

var NAMESPACE = 'asScrollbar';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jquery-asScrollable",
"title": "jQuery asScrollable",
"description": "A jquery plugin that make a block element scrollable.",
"version": "0.4.3",
"version": "0.4.4",
"homepage": "https://github.com/amazingSurge/jquery-asScrollable",
"author": {
"name": "amazingSurge",
Expand Down Expand Up @@ -123,6 +123,6 @@
},
"dependencies": {
"jquery": ">=2.2.0",
"jquery-asScrollbar": "^0.5.3"
"jquery-asScrollbar": "^0.5.4"
}
}
4 changes: 2 additions & 2 deletions src/asScrollable.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class AsScrollable {
}
}

destory() {
destroy() {
this.$wrap.removeClass(`${this.classes.wrap}-vertical`)
.removeClass(`${this.classes.wrap}-horizontal`)
.removeClass(this.classes.wrap)
Expand All @@ -751,7 +751,7 @@ class AsScrollable {
}
this.$content.removeClass(this.classes.content);
this.$element.data(NAMESPACE, null);
this.trigger('destory');
this.trigger('destroy');
}

static setDefaults(options) {
Expand Down
2 changes: 1 addition & 1 deletion src/info.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
version:'0.4.3'
version:'0.4.4'
};
39 changes: 39 additions & 0 deletions src/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export function getTime() {
if (typeof window.performance !== 'undefined' && window.performance.now) {
return window.performance.now();
}
return Date.now();
}

export function isPercentage(n) {
return typeof n === 'string' && n.indexOf('%') !== -1;
}

export function conventToPercentage(n) {
if (n < 0) {
n = 0;
} else if (n > 1) {
n = 1;
}
return `${parseFloat(n).toFixed(4) * 100}%`;
}

export function convertPercentageToFloat(n) {
return parseFloat(n.slice(0, -1) / 100, 10);
}

export let isFFLionScrollbar = (() => {
'use strict';

let isOSXFF, ua, version;
ua = window.navigator.userAgent;
isOSXFF = /(?=.+Mac OS X)(?=.+Firefox)/.test(ua);
if (!isOSXFF) {
return false;
}
version = /Firefox\/\d{2}\./.exec(ua);
if (version) {
version = version[0].replace(/\D+/g, '');
}
return isOSXFF && +version > 23;
})();

0 comments on commit 6851454

Please sign in to comment.