-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84388d6
commit 25cd8ba
Showing
11 changed files
with
173 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
var musics; | ||
fetch("/data/musics.json") | ||
.then(res => res.json()) | ||
.then(data => { | ||
musics = data.musics; | ||
}) | ||
.then(() => { | ||
searchMusic(); | ||
}); | ||
|
||
function searchMusic() { | ||
const searchQuery = document.getElementById('searchInput').value.toLowerCase(); | ||
const resultsContainer = document.getElementById('searchResults'); | ||
resultsContainer.innerHTML = ''; | ||
|
||
let filteredMusics = musics.filter(music => | ||
music.name != "" && | ||
( | ||
music.name.toLowerCase().includes(searchQuery) || | ||
music.artist.toLowerCase().includes(searchQuery) || | ||
music.content.join(" ").toLowerCase().includes(searchQuery) | ||
) | ||
); | ||
|
||
// Ordena os resultados por ordem alfabética pelo nome da música | ||
filteredMusics = filteredMusics.sort((a, b) => a.name.localeCompare(b.name)); | ||
|
||
if (filteredMusics.length > 0) { | ||
filteredMusics.forEach(music => { | ||
let contentMatch = ""; | ||
if (searchQuery && music.content.join(" ").toLowerCase().includes(searchQuery)) { | ||
const fullContent = music.content.join(" "); | ||
const startIndex = fullContent.toLowerCase().indexOf(searchQuery); | ||
const endIndex = startIndex + searchQuery.length; | ||
|
||
const snippetStart = Math.max(0, startIndex - 100); | ||
const snippetEnd = Math.min(fullContent.length, endIndex + 100); | ||
const snippet = fullContent.substring(snippetStart, snippetEnd); | ||
|
||
contentMatch = snippet.replace(new RegExp(searchQuery, 'gi'), match => `<mark>${match}</mark>`); | ||
} | ||
|
||
resultsContainer.innerHTML += ` | ||
<div class="col-md-12 music-item"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title">${music.name}</h5> | ||
<p class="card-text">${music.artist}</p> | ||
${contentMatch ? `<p class="card-text">${contentMatch}</p>` : ''} | ||
<a href="${music.youtube_url}" class="btn btn-danger" target="_blank">YouTube</a> | ||
<a href="${music.cifra_url}" class="btn btn-warning" target="_blank">Cifra</a> | ||
<a href="${music.letra_url}" class="btn btn-success" target="_blank">Letra</a> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
}); | ||
} else { | ||
resultsContainer.innerHTML = `<p class="text-muted">No results found.</p>`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ | |
<a href="https://localcatolico.com.br"><img src="assets/img/logo.png" width="80" height="80"/></a><br><br> | ||
<h3 class="text-white">Local Católico</h3> | ||
<p class="text-white"></p> | ||
<a class="btn btn-outline-primary" href="index.html">Sumário</a> | ||
<a class="btn btn-outline-primary" href="index.html">Pesquisa</a> | ||
<a class="btn btn-primary" href="summary.html">Sumário</a> | ||
<a class="btn btn-primary" href="musics.html">Músicas</a> | ||
<a class="btn btn-primary" href="playlists.html">Playlists</a> | ||
<a class="btn btn-primary" href="slides.html">Slides (.ppt)</a> | ||
|
@@ -33,7 +34,20 @@ <h3 class="text-white">Local Católico</h3> | |
<main> | ||
<div class="d-flex justify-content-center" style="margin-top: 50px"> | ||
<div class="col-md-6"> | ||
<div class="accordion accordion-flush" id="summary"></div><br> | ||
<div class="row"> | ||
<div class="col-md-8 offset-md-2"> | ||
<div class="input-group"> | ||
<input type="text" id="searchInput" class="form-control" placeholder="Pesquise pelo nome da música ou artista" aria-label="Search" onkeyup="searchMusic()"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="d-flex justify-content-center" style="margin-top: 50px"> | ||
<div class="col-md-6 card"> | ||
<div class="card-body"> | ||
<div id="searchResults" class="search-results row"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<footer class="d-flex justify-content-center text-white" style="margin-top: 50px"> | ||
|
@@ -42,6 +56,6 @@ <h3 class="text-white">Local Católico</h3> | |
</footer> | ||
</main> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | ||
<script src="assets/js/summary.js"></script> | ||
<script src="assets/js/search.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Local Católico - Músicas</title> | ||
<link rel="icon" type="image/x-icon" href="assets/img/logo.png"> | ||
<meta name="description" content="Site com músicas da igreja católica."> | ||
<meta property="og:title" content="Local Católico - Músicas"/> | ||
<meta property="og:description" content="Site com músicas."> | ||
<meta property="og:image" content="https://pix.localcatolico.com.br/assets/img/logo.png"/> | ||
<meta property="og:type" content="website"/> | ||
<meta property="og:locale" content="pt_BR"/> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="assets/css/background.css"> | ||
</head> | ||
<body> | ||
<div> | ||
<div class="wave"></div> | ||
<div class="wave"></div> | ||
<div class="wave"></div> | ||
</div> | ||
<header class="m-4"> | ||
<a href="https://localcatolico.com.br"><img src="assets/img/logo.png" width="80" height="80"/></a><br><br> | ||
<h3 class="text-white">Local Católico</h3> | ||
<p class="text-white"></p> | ||
<a class="btn btn-primary" href="index.html">Pesquisa</a> | ||
<a class="btn btn-outline-primary" href="summary.html">Sumário</a> | ||
<a class="btn btn-primary" href="musics.html">Músicas</a> | ||
<a class="btn btn-primary" href="playlists.html">Playlists</a> | ||
<a class="btn btn-primary" href="slides.html">Slides (.ppt)</a> | ||
<a class="btn btn-info btn-sm" href="https://liturgia.cancaonova.com/pb" href="_blank">Liturgia</a> | ||
</header> | ||
<main> | ||
<div class="d-flex justify-content-center" style="margin-top: 50px"> | ||
<div class="col-md-6"> | ||
<div class="accordion accordion-flush" id="summary"></div><br> | ||
</div> | ||
</div> | ||
<footer class="d-flex justify-content-center text-white" style="margin-top: 50px"> | ||
Desenvolvido por | ||
<a href="https://github.com/rafaelbmateus" target="_blank" class="text-white">Rafael Mateus</a> | ||
</footer> | ||
</main> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script> | ||
<script src="assets/js/summary.js"></script> | ||
</body> | ||
</html> |