jquery-adaptText
Advanced tools
Comparing version 1.3.1 to 1.3.2
/** | ||
* jQuery AdaptText v1.3.1 | ||
* jQuery AdaptText v1.3.2 | ||
* https://github.com/amazingSurge/jquery-adaptText | ||
@@ -154,3 +154,3 @@ * | ||
_trigger(eventType, ...params) { | ||
let data = [this].concat(...params); | ||
let data = [this].concat(params); | ||
@@ -167,3 +167,3 @@ // event | ||
if (typeof this.options[onFunction] === 'function') { | ||
this.options[onFunction].apply(this, ...params); | ||
this.options[onFunction].apply(this, params); | ||
} | ||
@@ -197,3 +197,3 @@ } | ||
var info = { | ||
version:'1.3.1' | ||
version:'1.3.2' | ||
}; | ||
@@ -200,0 +200,0 @@ |
/** | ||
* jQuery AdaptText v1.3.1 | ||
* jQuery AdaptText v1.3.2 | ||
* https://github.com/amazingSurge/jquery-adaptText | ||
@@ -255,4 +255,2 @@ * | ||
value: function _trigger(eventType) { | ||
var _ref; | ||
for (var _len2 = arguments.length, params = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
@@ -262,3 +260,3 @@ params[_key2 - 1] = arguments[_key2]; | ||
var data = (_ref = [this]).concat.apply(_ref, params); | ||
var data = [this].concat(params); | ||
@@ -278,5 +276,3 @@ // event | ||
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); | ||
} | ||
@@ -319,3 +315,3 @@ } | ||
var info = { | ||
version: '1.3.1' | ||
version: '1.3.2' | ||
}; | ||
@@ -322,0 +318,0 @@ |
/** | ||
* jQuery AdaptText v1.3.1 | ||
* jQuery AdaptText v1.3.2 | ||
* https://github.com/amazingSurge/jquery-adaptText | ||
@@ -8,2 +8,2 @@ * | ||
*/ | ||
!function(e,t){if("function"==typeof define&&define.amd)define(["jquery"],t);else if("undefined"!=typeof exports)t(require("jquery"));else{var n={exports:{}};t(e.jQuery),e.jqueryAdaptTextEs=n.exports}}(this,function(e){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){var n=this,i=Date.now||function(){return(new Date).getTime()},o=void 0,s=void 0,r=void 0,a=void 0,l=0,u=function(){l=i(),o=null,a=e.apply(s,r),o||(s=r=null)};return function(){for(var f=arguments.length,d=Array(f),c=0;c<f;c++)d[c]=arguments[c];var h=i(),p=t-(h-l);return s=n,r=d,p<=0||p>t?(o&&(clearTimeout(o),o=null),l=h,a=e.apply(s,r),o||(s=r=null)):o||(o=setTimeout(u,p)),a}}var o=t(e),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a={compression:10,max:Number.POSITIVE_INFINITY,min:Number.NEGATIVE_INFINITY,scrollable:!1,scrollSpeed:1e3,scrollResetSpeed:300,onResizeEvent:!0},l="adaptText",u=[],f=(0,o.default)(window).width(),d=function(){function e(t,i){n(this,e),this.element=t,this.$element=(0,o.default)(t),this.options=o.default.extend(!0,{},a,i,this.$element.data()),this.width=this.$element.width(),this.isDisabled=!1,this._init()}return r(e,[{key:"_init",value:function(){this.resize(),this.options.scrollable&&this._scrollOnHover(),u.push(this),this._trigger("ready")}},{key:"_scrollOnHover",value:function(){var e=this;this.$element.css({overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),this.$element.hover(function(){var t=e.element.scrollWidth-e.$element.width();if(t>0){var n=Math.sqrt(t/e.width)*e.options.scrollSpeed;return e.$element.css("cursor","e-resize"),e.$element.stop().animate({"text-indent":-t},n,function(){return e.$element.css("cursor","text")})}},function(){return e.$element.stop().animate({"text-indent":0},e.options.scrollResetSpeed)})}},{key:"resize",value:function(){this.isDisabled!==!0&&(this.width=this.$element.width(),0!==this.width&&this.$element.css("font-size",Math.floor(Math.max(Math.min(this.width/this.options.compression,parseFloat(this.options.max)),parseFloat(this.options.min)))))}},{key:"enable",value:function(){this.isDisabled===!0&&(this.isDisabled=!1),this._trigger("enable")}},{key:"disable",value:function(){this.isDisabled===!1&&(this.isDisabled=!0),this._trigger("disable")}},{key:"_trigger",value:function(e){for(var t,n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var s=(t=[this]).concat.apply(t,i);this.$element.trigger(l+"::"+e,s),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)});var r="on"+e;if("function"==typeof this.options[r]){var a;(a=this.options[r]).apply.apply(a,[this].concat(i))}}}],[{key:"resize",value:function(e){(e||(0,o.default)(window).width()!==f)&&(f=(0,o.default)(window).width(),o.default.each(u,function(){this.options.onResizeEvent&&this.resize()}))}},{key:"setDefaults",value:function(e){o.default.extend(a,o.default.isPlainObject(e)&&e)}}]),e}();window.addEventListener?window.addEventListener("resize",i(d.resize,200),!1):window.attachEvent&&window.attachEvent("onresize",i(d.resize,200));var c={version:"1.3.1"},h="adaptText",p=o.default.fn.adaptText,v=function(e){for(var t=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if("string"==typeof e){var a=function(){var n=e;if(/^_/.test(n))return{v:!1};if(!/^(get)/.test(n))return{v:t.each(function(){var e=o.default.data(this,h);e&&"function"==typeof e[n]&&e[n].apply(e,i)})};var s=t.first().data(h);return s&&"function"==typeof s[n]?{v:s[n].apply(s,i)}:void 0}();if("object"===("undefined"==typeof a?"undefined":s(a)))return a.v}return this.each(function(){(0,o.default)(this).data(h)||(0,o.default)(this).data(h,new d(this,e))})};o.default.fn.adaptText=v,o.default.adaptText=o.default.extend({setDefaults:d.setDefaults,noConflict:function(){return o.default.fn.adaptText=p,v}},c)}); | ||
!function(e,t){if("function"==typeof define&&define.amd)define(["jquery"],t);else if("undefined"!=typeof exports)t(require("jquery"));else{var n={exports:{}};t(e.jQuery),e.jqueryAdaptTextEs=n.exports}}(this,function(e){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){var n=this,i=Date.now||function(){return(new Date).getTime()},o=void 0,s=void 0,r=void 0,a=void 0,l=0,u=function(){l=i(),o=null,a=e.apply(s,r),o||(s=r=null)};return function(){for(var f=arguments.length,d=Array(f),c=0;c<f;c++)d[c]=arguments[c];var h=i(),p=t-(h-l);return s=n,r=d,p<=0||p>t?(o&&(clearTimeout(o),o=null),l=h,a=e.apply(s,r),o||(s=r=null)):o||(o=setTimeout(u,p)),a}}var o=t(e),s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a={compression:10,max:Number.POSITIVE_INFINITY,min:Number.NEGATIVE_INFINITY,scrollable:!1,scrollSpeed:1e3,scrollResetSpeed:300,onResizeEvent:!0},l="adaptText",u=[],f=(0,o.default)(window).width(),d=function(){function e(t,i){n(this,e),this.element=t,this.$element=(0,o.default)(t),this.options=o.default.extend(!0,{},a,i,this.$element.data()),this.width=this.$element.width(),this.isDisabled=!1,this._init()}return r(e,[{key:"_init",value:function(){this.resize(),this.options.scrollable&&this._scrollOnHover(),u.push(this),this._trigger("ready")}},{key:"_scrollOnHover",value:function(){var e=this;this.$element.css({overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),this.$element.hover(function(){var t=e.element.scrollWidth-e.$element.width();if(t>0){var n=Math.sqrt(t/e.width)*e.options.scrollSpeed;return e.$element.css("cursor","e-resize"),e.$element.stop().animate({"text-indent":-t},n,function(){return e.$element.css("cursor","text")})}},function(){return e.$element.stop().animate({"text-indent":0},e.options.scrollResetSpeed)})}},{key:"resize",value:function(){this.isDisabled!==!0&&(this.width=this.$element.width(),0!==this.width&&this.$element.css("font-size",Math.floor(Math.max(Math.min(this.width/this.options.compression,parseFloat(this.options.max)),parseFloat(this.options.min)))))}},{key:"enable",value:function(){this.isDisabled===!0&&(this.isDisabled=!1),this._trigger("enable")}},{key:"disable",value:function(){this.isDisabled===!1&&(this.isDisabled=!0),this._trigger("disable")}},{key:"_trigger",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var o=[this].concat(n);this.$element.trigger(l+"::"+e,o),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)});var s="on"+e;"function"==typeof this.options[s]&&this.options[s].apply(this,n)}}],[{key:"resize",value:function(e){(e||(0,o.default)(window).width()!==f)&&(f=(0,o.default)(window).width(),o.default.each(u,function(){this.options.onResizeEvent&&this.resize()}))}},{key:"setDefaults",value:function(e){o.default.extend(a,o.default.isPlainObject(e)&&e)}}]),e}();window.addEventListener?window.addEventListener("resize",i(d.resize,200),!1):window.attachEvent&&window.attachEvent("onresize",i(d.resize,200));var c={version:"1.3.2"},h="adaptText",p=o.default.fn.adaptText,v=function(e){for(var t=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if("string"==typeof e){var a=function(){var n=e;if(/^_/.test(n))return{v:!1};if(!/^(get)/.test(n))return{v:t.each(function(){var e=o.default.data(this,h);e&&"function"==typeof e[n]&&e[n].apply(e,i)})};var s=t.first().data(h);return s&&"function"==typeof s[n]?{v:s[n].apply(s,i)}:void 0}();if("object"===("undefined"==typeof a?"undefined":s(a)))return a.v}return this.each(function(){(0,o.default)(this).data(h)||(0,o.default)(this).data(h,new d(this,e))})};o.default.fn.adaptText=v,o.default.adaptText=o.default.extend({setDefaults:d.setDefaults,noConflict:function(){return o.default.fn.adaptText=p,v}},c)}); |
@@ -5,3 +5,3 @@ { | ||
"description": "A jQuery plugin that help rescale text depending on it's container width.", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"homepage": "https://github.com/amazingSurge/jquery-adaptText", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -47,2 +47,7 @@ # [jQuery adaptText](https://github.com/amazingSurge/jquery-adaptText) ![bower][bower-image] [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![prs-welcome]](#contributing) | ||
#### Install From Yarn | ||
```sh | ||
yarn add jquery-adaptText | ||
``` | ||
#### Build From Source | ||
@@ -49,0 +54,0 @@ If you want build from source: |
@@ -97,3 +97,3 @@ import $ from 'jquery'; | ||
_trigger(eventType, ...params) { | ||
let data = [this].concat(...params); | ||
let data = [this].concat(params); | ||
@@ -110,3 +110,3 @@ // event | ||
if (typeof this.options[onFunction] === 'function') { | ||
this.options[onFunction].apply(this, ...params); | ||
this.options[onFunction].apply(this, params); | ||
} | ||
@@ -113,0 +113,0 @@ } |
export default { | ||
version:'1.3.1' | ||
version:'1.3.2' | ||
}; |
232
42881
11
706