Comparing version 0.8.0 to 0.8.1
@@ -125,4 +125,4 @@ /******/ (function(modules) { // webpackBootstrap | ||
this._element = (0, _jquery2.default)(element); | ||
this._options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
this.$element = (0, _jquery2.default)(element); | ||
this.options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
@@ -137,3 +137,3 @@ this.bindListeners(); | ||
value: function bindListeners() { | ||
(0, _jquery2.default)(document).on(this._options.events, this._options.selectors, this.onFieldChange.bind(this)); | ||
(0, _jquery2.default)(document).on(this.options.events, this.options.selectors, this.onFieldChange.bind(this)); | ||
} | ||
@@ -148,3 +148,3 @@ }, { | ||
value: function shouldInputBeActive(input) { | ||
return !!(input.value || input.placeholder); | ||
return !!input.value; | ||
} | ||
@@ -172,3 +172,3 @@ }, { | ||
value: function toggleFieldsActiveClass() { | ||
Array.prototype.forEach.call((0, _jquery2.default)(document).find(this._options.selectors), this.toggleActiveClass.bind(this)); | ||
Array.prototype.forEach.call((0, _jquery2.default)(document).find(this.options.selectors), this.toggleActiveClass.bind(this)); | ||
} | ||
@@ -240,4 +240,4 @@ }]); | ||
this._element = (0, _jquery2.default)(element); | ||
this._options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
this.$element = (0, _jquery2.default)(element); | ||
this.options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
} | ||
@@ -256,3 +256,3 @@ | ||
value: function bindListeners() { | ||
this.onScrollHandler = (0, _throttle2.default)(this.onScroll.bind(this), this._options.throttle); | ||
this.onScrollHandler = (0, _throttle2.default)(this.onScroll.bind(this), this.options.throttle); | ||
(0, _jquery2.default)(window).on('scroll', this.onScrollHandler); | ||
@@ -263,3 +263,3 @@ } | ||
value: function onScroll() { | ||
return this._element.length ? this.checkVisiblePlaceholders() : (0, _jquery2.default)(window).off('scroll', this.onScrollHandler); | ||
return this.$element.length ? this.checkVisiblePlaceholders() : (0, _jquery2.default)(window).off('scroll', this.onScrollHandler); | ||
} | ||
@@ -272,3 +272,3 @@ }, { | ||
Array.prototype.forEach.call(this._element, this.checkPlaceholder.bind(this)); | ||
Array.prototype.forEach.call(this.$element, this.checkPlaceholder.bind(this)); | ||
} | ||
@@ -280,3 +280,3 @@ }, { | ||
this.renderImage(placeholder); | ||
(0, _removeArrayLike2.default)(this._element, placeholder); | ||
(0, _removeArrayLike2.default)(this.$element, placeholder); | ||
} | ||
@@ -287,3 +287,3 @@ } | ||
value: function isPlaceholderVisible(placeholder) { | ||
return placeholder.getBoundingClientRect().top <= this.windowHeight + this._options.offset; | ||
return placeholder.getBoundingClientRect().top <= this.windowHeight + this.options.offset; | ||
} | ||
@@ -320,3 +320,3 @@ }, { | ||
Array.prototype.forEach.call(attributes, function (attr) { | ||
if (attr.name !== _this._options.selector || attr.name !== 'data-srcset' || attr.name !== 'data-src') { | ||
if (attr.name !== _this.options.selector || attr.name !== 'data-srcset' || attr.name !== 'data-src') { | ||
image.setAttribute(attr.name, attr.value); | ||
@@ -461,4 +461,4 @@ } | ||
this._element = element instanceof _jquery2.default ? element : (0, _jquery2.default)(element); | ||
this._options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
this.$element = element instanceof _jquery2.default ? element : (0, _jquery2.default)(element); | ||
this.options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
} | ||
@@ -488,4 +488,4 @@ | ||
value: function destroy() { | ||
this._element.removeData(NAME); | ||
this.modal.remove(); | ||
this.$element.removeData(NAME); | ||
this.$modal.remove(); | ||
} | ||
@@ -497,7 +497,7 @@ }, { | ||
if (this._options.triggerClose) { | ||
this.modal.on('click', this._options.triggerClose, this.hide.bind(this)); | ||
if (this.options.triggerClose) { | ||
this.$modal.on('click', this.options.triggerClose, this.hide.bind(this)); | ||
} | ||
this.close.on('click', this.hide.bind(this)); | ||
this.$close.on('click', this.hide.bind(this)); | ||
@@ -513,7 +513,7 @@ (0, _jquery2.default)(window).on('keyup', this.handler = function (e) { | ||
value: function unbindListeners() { | ||
if (this._options.triggerClose) { | ||
this.modal.off('click', this._options.triggerClose, this.hide.bind(this)); | ||
if (this.options.triggerClose) { | ||
this.$modal.off('click', this.options.triggerClose, this.hide.bind(this)); | ||
} | ||
this.close.off('click'); | ||
this.$close.off('click'); | ||
(0, _jquery2.default)(window).off('keyup', this.handler); | ||
@@ -526,8 +526,8 @@ } | ||
this.modal.addClass('modal-enter'); | ||
this.content.addClass('modal-content-enter'); | ||
this.$modal.addClass('modal-enter'); | ||
this.$content.addClass('modal-content-enter'); | ||
window.setTimeout(function () { | ||
_this2.modal.addClass('modal-show'); | ||
_this2.content.addClass('modal-content-show'); | ||
_this2.$modal.addClass('modal-show'); | ||
_this2.$content.addClass('modal-content-show'); | ||
}, 200); | ||
@@ -540,9 +540,9 @@ } | ||
this.content.removeClass('modal-content-show').addClass('modal-content-leave'); | ||
this.$content.removeClass('modal-content-show').addClass('modal-content-leave'); | ||
this.modal.removeClass('modal-show').addClass('modal-leave'); | ||
this.$modal.removeClass('modal-show').addClass('modal-leave'); | ||
window.setTimeout(function () { | ||
_this3.modal.removeClass('modal-enter modal-leave'); | ||
_this3.content.removeClass('modal-content-enter modal-content-leave'); | ||
_this3.$modal.removeClass('modal-enter modal-leave'); | ||
_this3.$content.removeClass('modal-content-enter modal-content-leave'); | ||
}, 200); | ||
@@ -553,3 +553,3 @@ } | ||
value: function _fillModal() { | ||
this.content.find('.modal-body').append(this._element.html()); | ||
this.$content.find('.modal-body').append(this.$element.html()); | ||
} | ||
@@ -559,10 +559,10 @@ }, { | ||
value: function _createModal() { | ||
this.modal = (0, _jquery2.default)(templates.modal); | ||
this.content = (0, _jquery2.default)(templates.content); | ||
this.close = (0, _jquery2.default)(templates.close); | ||
this.$modal = (0, _jquery2.default)(templates.modal); | ||
this.$content = (0, _jquery2.default)(templates.content); | ||
this.$close = (0, _jquery2.default)(templates.close); | ||
this.content.append(this.close); | ||
this.modal.append(this.content); | ||
this.$content.append(this.$close); | ||
this.$modal.append(this.$content); | ||
(0, _jquery2.default)(this._options.container).append(this.modal); | ||
(0, _jquery2.default)(this.options.container).append(this.$modal); | ||
@@ -645,3 +645,3 @@ this._fillModal(); | ||
this.$element = element instanceof _jquery2.default ? element : (0, _jquery2.default)(element); | ||
this._options = _jquery2.default.extend({}, DEFAULTS, options); | ||
this.options = _jquery2.default.extend({}, DEFAULTS, options); | ||
} | ||
@@ -663,3 +663,3 @@ | ||
if (!this._options.dynamic) { | ||
if (!this.options.dynamic) { | ||
return this; | ||
@@ -670,3 +670,3 @@ } | ||
_this.show(); | ||
}, this._options.showIn); | ||
}, this.options.showIn); | ||
@@ -685,7 +685,7 @@ return this; | ||
this.closeHandler = function () { | ||
this.$closeHandler = function () { | ||
_this2.hide(); | ||
}; | ||
this.close.on('click', this.closeHandler); | ||
this.$close.on('click', this.$closeHandler); | ||
} | ||
@@ -702,8 +702,8 @@ | ||
this.box.addClass(classNames.show).removeClass(classNames.hide); | ||
this.$box.addClass(classNames.show).removeClass(classNames.hide); | ||
if (this._options.autoHide) { | ||
if (this.options.autoHide) { | ||
window.setTimeout(function () { | ||
_this3.hide(); | ||
}, this._options.hideIn); | ||
}, this.options.hideIn); | ||
} | ||
@@ -721,6 +721,6 @@ } | ||
this.box.removeClass(classNames.show).addClass(classNames.leave); | ||
this.$box.removeClass(classNames.show).addClass(classNames.leave); | ||
this.box.on((0, _transitionend2.default)(), function () { | ||
_this4.box.addClass(classNames.hide).removeClass(classNames.enter).removeClass(classNames.leave); | ||
this.$box.on((0, _transitionend2.default)(), function () { | ||
_this4.$box.addClass(classNames.hide).removeClass(classNames.enter).removeClass(classNames.leave); | ||
}); | ||
@@ -737,4 +737,4 @@ } | ||
this.$element.removeData(NAME); | ||
this.close.off('click', this.closeHandler); | ||
this.box.remove(); | ||
this.$close.off('click', this.$closeHandler); | ||
this.$box.remove(); | ||
} | ||
@@ -750,4 +750,4 @@ | ||
if (!this._options.dynamic) { | ||
this.box = this.$element; | ||
if (!this.options.dynamic) { | ||
this.$box = this.$element; | ||
this._createCloseButton(); | ||
@@ -758,12 +758,12 @@ | ||
if (!this._options.message) { | ||
if (!this.options.message) { | ||
return; | ||
} | ||
this.box = (0, _jquery2.default)(templates.box); | ||
this.box.addClass(NAME + '-' + this._options.type); | ||
this.box.html(this._options.message); | ||
this.$box = (0, _jquery2.default)(templates.box); | ||
this.$box.addClass(NAME + '-' + this.options.type); | ||
this.$box.html(this.options.message); | ||
this._createCloseButton(); | ||
this.$element.append(this.box); | ||
this.$element.append(this.$box); | ||
} | ||
@@ -773,8 +773,8 @@ }, { | ||
value: function _createCloseButton() { | ||
if (!this._options.dynamic) { | ||
return this.close = this.box.find(this._options.closeButton); | ||
if (!this.options.dynamic) { | ||
return this.$close = this.$box.find(this.options.closeButton); | ||
} | ||
this.close = (0, _jquery2.default)(templates.close); | ||
this.box.append(this.close); | ||
this.$close = (0, _jquery2.default)(templates.close); | ||
this.$box.append(this.$close); | ||
} | ||
@@ -867,4 +867,4 @@ }]); | ||
this._element = (0, _jquery2.default)(element); | ||
this._options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
this.$element = (0, _jquery2.default)(element); | ||
this.options = _jquery2.default.extend({}, DEFAULTS, options || {}); | ||
} | ||
@@ -875,3 +875,3 @@ | ||
value: function init() { | ||
this._fields = this._element.find(this._options.selector); | ||
this._fields = this.$element.find(this.options.selector); | ||
@@ -891,4 +891,4 @@ this.bindListeners(); | ||
this._element.off(this._options.events, this._options.selector, this.handler); | ||
this._element.on(this._options.events, this._options.selector, this.handler); | ||
this.$element.off(this.options.events, this.options.selector, this.handler); | ||
this.$element.on(this.options.events, this.options.selector, this.handler); | ||
} | ||
@@ -907,3 +907,3 @@ }, { | ||
rules = rules.split(' ').reduce(function (errors, rule) { | ||
if (!_this2.rules[rule].call(_this2, field, _this2._element)) { | ||
if (!_this2.rules[rule].call(_this2, field, _this2.$element)) { | ||
errors.push(rule); | ||
@@ -922,3 +922,3 @@ } | ||
value: function validateAll() { | ||
return Array.prototype.map.call(this._element.find(this._options.selector), this.validate, this).every(function (validation) { | ||
return Array.prototype.map.call(this.$element.find(this.options.selector), this.validate, this).every(function (validation) { | ||
return validation; | ||
@@ -925,0 +925,0 @@ }); |
{ | ||
"name": "garden", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "A styleguide based on Leroy Merlin needs", | ||
@@ -5,0 +5,0 @@ "main": "dist/js/garden.min.js", |
@@ -31,3 +31,3 @@ import $ from 'jquery'; | ||
shouldInputBeActive(input) { | ||
return !!(input.value || input.placeholder); | ||
return !!(input.value); | ||
} | ||
@@ -34,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
183502
86
2594