Skip to content

Commit

Permalink
1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gmasson committed Feb 20, 2020
1 parent 866190f commit d265ae3
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Wide
Projeto open source desenvolvido para criação de sistemas de busca
# WideJS
Projeto open source em JavaScript desenvolvido para criação de sistemas de busca
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
33 changes: 20 additions & 13 deletions wide.js → assets/js/wide.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Wide 1.1
* Wide 1.2
* https://github.com/gmasson/wide/
* License MIT
*/
Expand Down Expand Up @@ -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();
}
});
}
19 changes: 11 additions & 8 deletions example/simple/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
<title>Wide Example</title>

<!-- Favicon -->
<link href="img/favicon.png" rel="shortcut icon" type="image/x-icon">
<link href="assets/img/favicon.png" rel="shortcut icon" type="image/x-icon">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Style -->
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="assets/css/style.css" type="text/css">
</head>
<body>

<header>
<div class="container">
<img src="img/logo.png" alt="Logo Wide">
<img src="assets/img/logo.png" alt="Logo Wide">
<p>Projeto open source desenvolvido para criação de sistemas de busca</p>
<input type="text" placeholder="Faça sua pesquisa" id="search-input" class="text-center form-control" autofocus>
</div>
Expand All @@ -34,11 +34,11 @@
<template id="result-template">
<div class="col-sm-2 col-md-4">
<article class="card">
<!--<img class="card-img-top" id="resultImg" src="" alt="">-->
<!--<img class="card-img-top" id="resultImg" src="test.png" alt="...">-->
<div class="card-body" id="result-content">
<h5 class="card-title" id="result-title"></h5>
<p class="card-text" id="result-descr"></p>
<a href="" class="btn btn-primary" id="result-link" target="_blank"></a>
<a href="#" class="btn btn-primary" id="result-link" target="_blank"></a>
</div>
</article>
</div>
Expand All @@ -49,12 +49,15 @@ <h5 class="card-title" id="result-title"></h5>

<footer>
<div class="container">
Projeto Wide - <a href="https://github.com/gmasson/wide" target="_blank">Colabore no Github</a>
Projeto Wide 1.2 - <a href="https://github.com/gmasson/widejs" target="_blank">Colabore no Github</a>
</div>
</footer>

<!-- Scripts -->
<script src="../../database.js"></script>
<script src="../../wide.js"></script>
<script src="assets/db/database.js"></script>
<script src="assets/js/wide.js"></script>
<script type="text/javascript">
wideStart('all');
</script>
</body>
</html>

0 comments on commit d265ae3

Please sign in to comment.