diff --git a/dist/js/sth-select.js b/dist/js/sth-select.js
index 5c86579..e64c04e 100644
--- a/dist/js/sth-select.js
+++ b/dist/js/sth-select.js
@@ -11,6 +11,7 @@
function SthOverlay() {
var _$overlay = null;
+ var FADE_ANIMATION_TIME = 500;
/**
* Constructor.
@@ -40,20 +41,17 @@
* Shows the overlay.
*/
function show() {
- _$overlay.fadeIn(500);
+ _$overlay.fadeIn(FADE_ANIMATION_TIME);
}
/**
* Hides the overlay.
*/
function hide() {
- _$overlay.fadeOut(500);
+ _$overlay.fadeOut(FADE_ANIMATION_TIME);
}
- return {
- show: show,
- hide: hide
- };
+ return { show: show, hide: hide };
}
window.SthOverlay = window.SthOverlay || SthOverlay;
@@ -185,15 +183,11 @@
/**
* Add an item.
*/
- function _addItem(item, autoRender) {
- autoRender = autoRender || true;
-
+ function _addItem(item) {
var text = item.text;
var $listItem = $('
' + text + '
');
$listItem.data('item', item);
-
- if (autoRender) _$content.append($listItem);
-
+ _$content.append($listItem);
return $listItem;
}
@@ -203,14 +197,13 @@
function _renderList(caseSensitive) {
_clear();
- var rerenderOnEachItem = false;
var $listItems = $([]);
var textFilter = _formatText(caseSensitive, _$filter.val());
_items.forEach(function (item) {
var text = _formatText(caseSensitive, item.text);
- if (text.indexOf(textFilter) != -1) {
- var $listItem = _addItem(item, rerenderOnEachItem);
+ if (~text.indexOf(textFilter)) {
+ var $listItem = _addItem(item);
$listItems = $listItems.add($listItem);
}
});
@@ -263,11 +256,7 @@
/**
* Public available methods.
*/
- return {
- show: show,
- hide: hide,
- onSelect: onSelect
- };
+ return { show: show, hide: hide, onSelect: onSelect };
}
window.SthSelect = window.SthSelect || {};
diff --git a/src/js/_overlay.js b/src/js/_overlay.js
index ecd604e..f2649b3 100644
--- a/src/js/_overlay.js
+++ b/src/js/_overlay.js
@@ -10,6 +10,7 @@
function SthOverlay(){
var _$overlay = null;
+ const FADE_ANIMATION_TIME = 500;
/**
* Constructor.
@@ -39,20 +40,17 @@
* Shows the overlay.
*/
function show(){
- _$overlay.fadeIn(500);
+ _$overlay.fadeIn(FADE_ANIMATION_TIME);
}
/**
* Hides the overlay.
*/
function hide(){
- _$overlay.fadeOut(500);
+ _$overlay.fadeOut(FADE_ANIMATION_TIME);
}
- return {
- show: show,
- hide: hide
- };
+ return { show, hide };
}
window.SthOverlay = window.SthOverlay || SthOverlay;
diff --git a/src/js/_popup.js b/src/js/_popup.js
index c39ffd2..1dbbc52 100644
--- a/src/js/_popup.js
+++ b/src/js/_popup.js
@@ -135,16 +135,11 @@
/**
* Add an item.
*/
- function _addItem(item, autoRender){
- autoRender = autoRender || true;
-
+ function _addItem(item){
let text = item.text;
let $listItem = $('' + text + '
');
$listItem.data('item', item);
-
- if( autoRender )
- _$content.append( $listItem );
-
+ _$content.append($listItem);
return $listItem;
}
@@ -154,14 +149,13 @@
function _renderList(caseSensitive){
_clear();
- let rerenderOnEachItem = false;
let $listItems = $([]);
const textFilter = _formatText(caseSensitive, _$filter.val())
_items.forEach( item => {
const text = _formatText(caseSensitive, item.text)
- if(text.indexOf(textFilter) != -1){
- let $listItem = _addItem(item, rerenderOnEachItem);
+ if(~text.indexOf(textFilter)){
+ let $listItem = _addItem(item);
$listItems = $listItems.add( $listItem );
}
});
@@ -214,11 +208,7 @@
/**
* Public available methods.
*/
- return {
- show: show,
- hide: hide,
- onSelect: onSelect
- };
+ return { show, hide, onSelect };
}
window.SthSelect = window.SthSelect || {};