diff --git a/README.md b/README.md index fa20d18..529fa1b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Wide -Projeto open source desenvolvido para criação de sistemas de busca \ No newline at end of file +# WideJS +Projeto open source em JavaScript desenvolvido para criação de sistemas de busca \ No newline at end of file diff --git a/example/simple/css/style.css b/assets/css/style.css similarity index 100% rename from example/simple/css/style.css rename to assets/css/style.css diff --git a/database.js b/assets/db/database.js similarity index 100% rename from database.js rename to assets/db/database.js diff --git a/example/simple/img/favicon.png b/assets/img/favicon.png similarity index 100% rename from example/simple/img/favicon.png rename to assets/img/favicon.png diff --git a/example/simple/img/logo.png b/assets/img/logo.png similarity index 100% rename from example/simple/img/logo.png rename to assets/img/logo.png diff --git a/wide.js b/assets/js/wide.js similarity index 82% rename from wide.js rename to assets/js/wide.js index c081993..a9f0192 100644 --- a/wide.js +++ b/assets/js/wide.js @@ -1,5 +1,5 @@ /* -* Wide 1.1 +* Wide 1.2 * https://github.com/gmasson/wide/ * License MIT */ @@ -92,16 +92,23 @@ function wClearItems() { wContent.innerHTML = ''; } -/* Busca itens quando o input for modificado */ -wSearchInput.addEventListener('input', function(e) { - const value = e.target.value.toLowerCase(); - wClearItems(); - wShowItems(value); - /* Oculta os resultados quando o campo estiver vazio */ - if (value == '') { - wClearItems(); - //wHidden('id'); - } else { - //wShow('id'); +function wideStart(wShowAll = '') { + /* Com o parametro 'all', é exibido todos cadastros, mesmo que o campo esteja vazio */ + /* Busca itens quando o input for modificado */ + wSearchInput.addEventListener('input', function(e) { + const value = e.target.value.toLowerCase(); + if (value == '') { + wClearItems(); + if (wShowAll == 'all') { + wShowItems(); + } + } else { + wClearItems(); + wShowItems(value); + } + }); + + if (wShowAll == 'all') { + wShowItems(); } -}); \ No newline at end of file +} \ No newline at end of file diff --git a/example/simple/index.html b/index.html similarity index 68% rename from example/simple/index.html rename to index.html index 2a54bc4..e98362f 100644 --- a/example/simple/index.html +++ b/index.html @@ -6,19 +6,19 @@ Wide Example - + - +
- Logo Wide + Logo Wide

Projeto open source desenvolvido para criação de sistemas de busca

@@ -34,11 +34,11 @@