295 lines
12 KiB
Markdown
Executable File
295 lines
12 KiB
Markdown
Executable File
---
|
|
layout: default
|
|
title: Busca Avançada de Projetos
|
|
permalink: /search/
|
|
---
|
|
|
|
{% assign list_bpm = "" %}
|
|
{% assign list_plugins = "" %}
|
|
{% assign list_instruments = "" %}
|
|
{% assign list_samples = "" %}
|
|
|
|
{% for p in site.data.all %}
|
|
{% if p.bpm %}{% assign list_bpm = list_bpm | append: p.bpm | append: "|||" %}{% endif %}
|
|
|
|
{% for item in p.tags.plugin %}{% if item != "" %}{% assign list_plugins = list_plugins | append: item | append: "|||" %}{% endif %}{% endfor %}
|
|
|
|
{% for track in p.tracks %}
|
|
{% if track.instruments %}
|
|
{% for inst in track.instruments %}{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}{% endfor %}
|
|
{% elsif track.instrument_name %}
|
|
{% assign list_instruments = list_instruments | append: track.instrument_name | append: "|||" %}
|
|
{% endif %}
|
|
{% if track.sample %}
|
|
{% for smp in track.sample %}{% assign list_samples = list_samples | append: smp.sample_name | append: "|||" %}{% endfor %}
|
|
{% elsif track.sample_name %}
|
|
{% assign list_samples = list_samples | append: track.sample_name | append: "|||" %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
|
|
{% assign unique_bpm = list_bpm | split: "|||" | uniq | sort %}
|
|
{% assign unique_plugins = list_plugins | split: "|||" | uniq | sort %}
|
|
{% assign unique_instruments = list_instruments | split: "|||" | uniq | sort %}
|
|
{% assign unique_samples = list_samples | split: "|||" | uniq | sort %}
|
|
|
|
<main class="main-content">
|
|
<div class="publication">
|
|
<div class="container is-fluid">
|
|
<br />
|
|
|
|
<div class="columns mb-5 is-vcentered">
|
|
<div class="column">
|
|
<h1 class="title is-3 has-text-grey-dark">Explorar Projetos</h1>
|
|
<p class="subtitle is-6 has-text-grey">Use os filtros laterais para combinar critérios.</p>
|
|
</div>
|
|
<div class="column is-narrow">
|
|
<button id="reset-all-filters" class="button is-danger is-light is-small">
|
|
<span class="icon"><i class="fa-solid fa-rotate-left"></i></span>
|
|
<span>Limpar Todos os Filtros</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column is-3">
|
|
<div class="box p-3" style="background: #fcfcfc; border: 1px solid #eee;">
|
|
|
|
<div class="filter-group mb-4">
|
|
<p class="menu-label has-text-weight-bold mb-2">BPM</p>
|
|
<div class="field is-grouped is-grouped-multiline">
|
|
{% for item in unique_bpm %}
|
|
{% if item != "" %}
|
|
<div class="control">
|
|
<label class="checkbox tag is-white" style="border: 1px solid #dbdbdb; cursor: pointer;">
|
|
<input type="checkbox" class="filter-checkbox" data-category="bpm" value="{{ item }}">
|
|
{{ item }}
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<hr class="my-3">
|
|
|
|
<details open>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Instrumentos</summary>
|
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
|
{% for item in unique_instruments %}
|
|
{% if item != "" %}
|
|
<label class="checkbox is-block mb-1 is-size-7">
|
|
<input type="checkbox" class="filter-checkbox" data-category="instruments" value="{{ item }}">
|
|
{{ item }}
|
|
</label>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</details>
|
|
<hr class="my-3">
|
|
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Plugins</summary>
|
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
|
{% for item in unique_plugins %}
|
|
{% if item != "" %}
|
|
<label class="checkbox is-block mb-1 is-size-7">
|
|
<input type="checkbox" class="filter-checkbox" data-category="plugins" value="{{ item }}">
|
|
{{ item }}
|
|
</label>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</details>
|
|
<hr class="my-3">
|
|
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Samples</summary>
|
|
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
|
{% for item in unique_samples %}
|
|
{% if item != "" %}
|
|
<label class="checkbox is-block mb-1 is-size-7">
|
|
<input type="checkbox" class="filter-checkbox" data-category="samples" value="{{ item }}">
|
|
{{ item | truncate: 25 }}
|
|
</label>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</details>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="column is-9">
|
|
<div class="notification is-info is-light mb-4 is-hidden" id="results-count-bar">
|
|
Encontrados <span id="visible-count" class="has-text-weight-bold">0</span> projetos.
|
|
</div>
|
|
|
|
<div id="project-list" class="columns is-multiline">
|
|
{% for projeto in site.data.all %}
|
|
{% include project-card.html project=projeto %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<div id="no-results" class="has-text-centered is-hidden mt-6">
|
|
<span class="icon is-large has-text-grey-light"><i class="fa-solid fa-face-frown fa-3x"></i></span>
|
|
<p class="subtitle mt-3 has-text-grey">Nenhum projeto encontrado com essa combinação.</p>
|
|
<button class="button is-small is-info mt-2" onclick="document.getElementById('reset-all-filters').click()">Limpar Filtros</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
{% include preview-modal.html %}
|
|
|
|
<style>
|
|
.clickable-summary { cursor: pointer; user-select: none; }
|
|
.clickable-summary:hover { color: #3273dc; }
|
|
.tag.is-checked { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; }
|
|
|
|
/* Scrollbar fina para os filtros */
|
|
.filter-content::-webkit-scrollbar { width: 6px; }
|
|
.filter-content::-webkit-scrollbar-track { background: #f1f1f1; }
|
|
.filter-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
|
|
|
|
/* Efeito de hover no card */
|
|
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; }
|
|
</style>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const checkboxes = document.querySelectorAll('.filter-checkbox');
|
|
const projects = document.querySelectorAll('.project-item');
|
|
const resetBtn = document.getElementById('reset-all-filters');
|
|
const countBar = document.getElementById('results-count-bar');
|
|
const countSpan = document.getElementById('visible-count');
|
|
const noResults = document.getElementById('no-results');
|
|
|
|
// Estado do Filtro
|
|
let activeFilters = {
|
|
bpm: [],
|
|
instruments: [],
|
|
plugins: [],
|
|
samples: []
|
|
};
|
|
|
|
function updateState() {
|
|
// Reseta estado
|
|
activeFilters = { bpm: [], instruments: [], plugins: [], samples: [] };
|
|
|
|
// Lê checkboxes marcados
|
|
checkboxes.forEach(cb => {
|
|
if (cb.checked) {
|
|
const category = cb.getAttribute('data-category');
|
|
activeFilters[category].push(cb.value);
|
|
|
|
// Estilo visual (para as tags de BPM)
|
|
if(cb.parentElement.classList.contains('tag')) {
|
|
cb.parentElement.classList.add('is-checked');
|
|
}
|
|
} else {
|
|
if(cb.parentElement.classList.contains('tag')) {
|
|
cb.parentElement.classList.remove('is-checked');
|
|
}
|
|
}
|
|
});
|
|
|
|
applyFilters();
|
|
}
|
|
|
|
function applyFilters() {
|
|
let visibleCount = 0;
|
|
|
|
projects.forEach(project => {
|
|
// Pega dados do projeto
|
|
const pBpm = project.getAttribute('data-bpm');
|
|
const pInsts = project.getAttribute('data-instruments').split(',');
|
|
const pPlugins = project.getAttribute('data-plugins').split(',');
|
|
const pSamples = project.getAttribute('data-samples').split(',');
|
|
|
|
// Lógica de Filtragem (AND entre categorias, OR dentro da categoria)
|
|
// Ex: (Guitar OR Bass) AND (120 BPM)
|
|
|
|
const matchBpm = activeFilters.bpm.length === 0 || activeFilters.bpm.includes(pBpm);
|
|
|
|
const matchInst = activeFilters.instruments.length === 0 ||
|
|
activeFilters.instruments.some(f => pInsts.includes(f));
|
|
|
|
const matchPlugin = activeFilters.plugins.length === 0 ||
|
|
activeFilters.plugins.some(f => pPlugins.includes(f));
|
|
|
|
const matchSample = activeFilters.samples.length === 0 ||
|
|
activeFilters.samples.some(f => pSamples.includes(f));
|
|
|
|
if (matchBpm && matchInst && matchPlugin && matchSample) {
|
|
project.style.display = 'block';
|
|
visibleCount++;
|
|
} else {
|
|
project.style.display = 'none';
|
|
}
|
|
});
|
|
|
|
// Atualiza UI de contagem
|
|
countSpan.textContent = visibleCount;
|
|
if (visibleCount < projects.length) {
|
|
countBar.classList.remove('is-hidden');
|
|
} else {
|
|
countBar.classList.add('is-hidden');
|
|
}
|
|
|
|
if (visibleCount === 0) {
|
|
noResults.classList.remove('is-hidden');
|
|
} else {
|
|
noResults.classList.add('is-hidden');
|
|
}
|
|
}
|
|
|
|
// Event Listeners
|
|
checkboxes.forEach(cb => {
|
|
cb.addEventListener('change', updateState);
|
|
});
|
|
|
|
resetBtn.addEventListener('click', () => {
|
|
checkboxes.forEach(cb => cb.checked = false);
|
|
updateState();
|
|
});
|
|
|
|
// --- CÓDIGO DO MODAL (Mantido igual) ---
|
|
const modal = document.getElementById('preview-modal');
|
|
const iframe = document.getElementById('preview-iframe');
|
|
const modalTitle = document.getElementById('modal-title');
|
|
const fullEditBtn = document.getElementById('full-edit-btn');
|
|
const closeButtons = document.querySelectorAll('.modal-background, .modal-card-head .delete, #close-modal-btn');
|
|
|
|
function openModal(url, title, btnText, btnLink) {
|
|
modalTitle.textContent = title;
|
|
iframe.src = url;
|
|
fullEditBtn.textContent = btnText;
|
|
fullEditBtn.href = btnLink;
|
|
modal.classList.add('is-active');
|
|
document.documentElement.classList.add('is-clipped');
|
|
}
|
|
function closeModal() {
|
|
modal.classList.remove('is-active');
|
|
document.documentElement.classList.remove('is-clipped');
|
|
iframe.src = "";
|
|
}
|
|
document.querySelectorAll('.js-open-modal').forEach(btn => {
|
|
btn.addEventListener('click', (e) => {
|
|
e.preventDefault();
|
|
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
|
|
});
|
|
});
|
|
iframe.addEventListener('load', () => { try {
|
|
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
const style = iframeDoc.createElement('style');
|
|
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
|
|
iframeDoc.head.appendChild(style);
|
|
} catch(e){} });
|
|
closeButtons.forEach(el => el.addEventListener('click', closeModal));
|
|
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
|
|
});
|
|
</script> |