From d042cc87f747bca689db9fc00071bd7c7317d110 Mon Sep 17 00:00:00 2001
From: jotachina _posts
directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve
, which launches a web server and auto-regenerates your site when a file is updated.
_posts
directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve
, which launches a web server and auto-regenerates your site when a file is updated.
Jekyll requires blog post files to be named according to the following format:
diff --git a/assets/js/search.js b/assets/js/search.js index 65236f5..26b234f 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -1,13 +1,25 @@ document.addEventListener("DOMContentLoaded", function() { var fileItemsMMP = document.querySelectorAll('#file-list-mmp .file-item'); - var fileItemsWAV = document.querySelectorAll('#file-list-wav li'); + var fileItemsWAV = document.querySelectorAll('#file-list-wav .file-wav-item'); + + // Função para exibir apenas os arquivos WAV correspondentes aos instrumentos encontrados nos projetos MMP + function showWAVFilesByInstrument(selectedInstrument) { + fileItemsWAV.forEach(function(item) { + var fileName = item.getAttribute('data-file').toLowerCase(); + if (fileName.includes(selectedInstrument)) { + item.style.display = 'block'; + } else { + item.style.display = 'none'; + } + }); + } // Buscar por instrumento usando o campo de entrada para MMP var searchButton = document.getElementById('search-button'); searchButton.addEventListener('click', function() { var searchInput = document.getElementById('instrument-search').value.trim().toLowerCase(); if (searchInput === '') { - resetSearchMMP(); + resetSearch(); return; } fileItemsMMP.forEach(function(item) { @@ -29,10 +41,14 @@ document.addEventListener("DOMContentLoaded", function() { document.getElementById('file-list-mmp').style.display = 'block'; }); - // Buscar por nome do arquivo WAV + // Buscar por nome de arquivo WAV usando o campo de entrada var searchWavButton = document.getElementById('search-wav-button'); searchWavButton.addEventListener('click', function() { var searchInput = document.getElementById('file-wav-search').value.trim().toLowerCase(); + if (searchInput === '') { + resetSearch(); + return; + } fileItemsWAV.forEach(function(item) { var fileName = item.querySelector('span').textContent.toLowerCase(); if (fileName.includes(searchInput)) { @@ -45,12 +61,48 @@ document.addEventListener("DOMContentLoaded", function() { document.getElementById('file-list-wav').style.display = 'block'; }); - // Função para resetar a busca para arquivos MMP - function resetSearchMMP() { + // Buscar por instrumento ou nome de arquivo WAV usando o campo de entrada combinado + var searchBothButton = document.getElementById('search-both-button'); + searchBothButton.addEventListener('click', function() { + var searchInput = document.getElementById('instrument-wav-search').value.trim().toLowerCase(); + if (searchInput === '') { + resetSearch(); + return; + } + // Buscar em arquivos MMP por instrumento + fileItemsMMP.forEach(function(item) { + var instrumentsList = item.querySelectorAll('.instrument-list .instrument-name'); + var hasInstrument = false; + instrumentsList.forEach(function(instrument) { + var instrumentName = instrument.getAttribute('data-instrument').toLowerCase(); + if (instrumentName.includes(searchInput)) { + hasInstrument = true; + // Mostrar arquivo WAV correspondente ao instrumento + showWAVFilesByInstrument(item.getAttribute('data-file')); + } + }); + if (hasInstrument) { + item.style.display = 'block'; + } else { + item.style.display = 'none'; + } + }); + // Exibir as listas de arquivos após a busca + document.getElementById('file-list-mmp').style.display = 'block'; + document.getElementById('file-list-wav').style.display = 'block'; + }); + + // Função para resetar a busca + function resetSearch() { fileItemsMMP.forEach(function(item) { item.style.display = 'block'; }); + fileItemsWAV.forEach(function(item) { + item.style.display = 'block'; + }); document.getElementById('file-list-mmp').style.display = 'none'; + document.getElementById('file-list-wav').style.display = 'none'; } }); + diff --git a/search.md b/search.md index 60ccfd1..51015c1 100644 --- a/search.md +++ b/search.md @@ -21,13 +21,19 @@ permalink: /buscas/