reformula buscas
Deploy / Deploy (push) Successful in 1m23s
Details
Deploy / Deploy (push) Successful in 1m23s
Details
This commit is contained in:
parent
fd61245d52
commit
5ea3ad0110
|
|
@ -12,7 +12,11 @@ permalink: /projetos/
|
|||
{% assign list_automation = "" %}
|
||||
|
||||
{% for p in site.data.all %}
|
||||
{% if p.bpm %}{% assign list_bpm = list_bpm | append: p.bpm | append: "|||" %}{% endif %}
|
||||
{% assign raw_bpm = p.bpm | append: "" %}
|
||||
{% if raw_bpm != "" and raw_bpm != "N/A" and raw_bpm != "nil" %}
|
||||
{% assign list_bpm = list_bpm | append: raw_bpm | append: "|||" %}
|
||||
{% endif %}
|
||||
|
||||
{% for item in p.tags.plugin %}{% if item != "" %}{% assign list_plugins = list_plugins | append: item | append: "|||" %}{% endif %}{% endfor %}
|
||||
{% if p.tags.bassline %}{% for item in p.tags.bassline %}{% if item != "" %}{% assign list_bassline = list_bassline | append: item | append: "|||" %}{% endif %}{% endfor %}{% endif %}
|
||||
{% if p.tags.automation %}{% for item in p.tags.automation %}{% if item != "" %}{% assign list_automation = list_automation | append: item | append: "|||" %}{% endif %}{% endfor %}{% endif %}
|
||||
|
|
@ -35,8 +39,8 @@ permalink: /projetos/
|
|||
{% assign min_limit = 0 %}
|
||||
{% assign max_limit = 300 %}
|
||||
{% if unique_bpm_array.size > 0 %}
|
||||
{% assign min_limit = unique_bpm_array | first | minus: 0 %}
|
||||
{% assign max_limit = unique_bpm_array | last | plus: 0 %}
|
||||
{% assign last_bpm = unique_bpm_array | last | plus: 0 %}
|
||||
{% if last_bpm > max_limit %}{% assign max_limit = last_bpm %}{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="publication">
|
||||
|
|
@ -165,66 +169,37 @@ permalink: /projetos/
|
|||
</details>
|
||||
<hr class="my-3">
|
||||
|
||||
<details>
|
||||
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Instrumentos</summary>
|
||||
<div class="filter-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="instruments" style="height: auto; font-size: 0.65rem;">
|
||||
<span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span>
|
||||
</button>
|
||||
</div>
|
||||
<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">
|
||||
{% assign filter_groups = "instruments|Instrumentos,plugins|Plugins,bassline|Bassline,automation|Automação,samples|Samples" | split: "," %}
|
||||
{% for group in filter_groups %}
|
||||
{% assign parts = group | split: "|" %}
|
||||
{% assign cat_key = parts[0] %}
|
||||
{% assign cat_label = parts[1] %}
|
||||
|
||||
<details {% if cat_key == 'instruments' or cat_key == 'plugins' %}open{% endif %}>
|
||||
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">{{ cat_label }}</summary>
|
||||
<div class="filter-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="{{ cat_key }}" style="height: auto; font-size: 0.65rem;">
|
||||
<span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||
{% assign current_list = "" %}
|
||||
{% if cat_key == 'instruments' %}{% assign current_list = unique_instruments %}
|
||||
{% elsif cat_key == 'plugins' %}{% assign current_list = unique_plugins %}
|
||||
{% elsif cat_key == 'bassline' %}{% assign current_list = unique_bassline %}
|
||||
{% elsif cat_key == 'automation' %}{% assign current_list = unique_automation %}
|
||||
{% elsif cat_key == 'samples' %}{% assign current_list = unique_samples %}
|
||||
{% endif %}
|
||||
|
||||
<details>
|
||||
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Plugins</summary>
|
||||
<div class="filter-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="plugins" style="height: auto; font-size: 0.65rem;">
|
||||
<span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span>
|
||||
</button>
|
||||
</div>
|
||||
<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">Bassline</summary>
|
||||
<div class="filter-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="bassline" style="height: auto; font-size: 0.65rem;"><span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span></button>
|
||||
</div>
|
||||
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||
{% for item in unique_bassline %}{% if item != "" %}<label class="checkbox is-block mb-1 is-size-7"><input type="checkbox" class="filter-checkbox" data-category="bassline" 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">Automação</summary>
|
||||
<div class="filter-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="automation" style="height: auto; font-size: 0.65rem;"><span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span></button>
|
||||
</div>
|
||||
<div class="filter-content" style="max-height: 200px; overflow-y: auto;">
|
||||
{% for item in unique_automation %}{% if item != "" %}<label class="checkbox is-block mb-1 is-size-7"><input type="checkbox" class="filter-checkbox" data-category="automation" 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-header-actions">
|
||||
<button class="button is-ghost is-small p-0 js-clear-group" data-target="samples" style="height: auto; font-size: 0.65rem;"><span class="icon"><i class="fa-solid fa-eraser"></i></span> <span>Limpar</span></button>
|
||||
</div>
|
||||
<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>
|
||||
{% for item in current_list %}{% if item != "" %}
|
||||
<label class="checkbox is-block mb-1 is-size-7">
|
||||
<input type="checkbox" class="filter-checkbox" data-category="{{ cat_key }}" value="{{ item }}"> {{ item }}
|
||||
</label>
|
||||
{% endif %}{% endfor %}
|
||||
</div>
|
||||
</details>
|
||||
<hr class="my-3">
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -240,13 +215,20 @@ permalink: /projetos/
|
|||
{% for page in project_pages %}
|
||||
{% if page.url != '/projetos/' %}
|
||||
|
||||
{% assign raw_bpm = page.bpm | append: "" %}
|
||||
{% if raw_bpm == "" or raw_bpm == "N/A" or raw_bpm == "nil" %}
|
||||
{% assign p_bpm = 0 %}
|
||||
{% else %}
|
||||
{% assign p_bpm = raw_bpm | plus: 0 %}
|
||||
{% endif %}
|
||||
|
||||
{% assign p_insts_array = "" | split: "," %}
|
||||
{% for track in page.tracks %}
|
||||
{% if track.instruments %}{% for inst in track.instruments %}{% if inst.instrument_name %}{% assign p_insts_array = p_insts_array | push: inst.instrument_name %}{% endif %}{% endfor %}
|
||||
{% elsif track.instrument_name %}{% assign p_insts_array = p_insts_array | push: track.instrument_name %}{% endif %}
|
||||
{% endfor %}
|
||||
{% assign p_instruments_str = p_insts_array | uniq | join: ',' %}
|
||||
{% assign p_bpm = page.bpm | default: 0 %}
|
||||
|
||||
{% assign p_plugins = page.tags.plugin | join: ',' %}
|
||||
{% assign p_bassline = page.tags.bassline | join: ',' %}
|
||||
{% assign p_automation = page.tags.automation | join: ',' %}
|
||||
|
|
@ -279,9 +261,13 @@ permalink: /projetos/
|
|||
</p>
|
||||
|
||||
<div class="bpm-container mb-3" style="min-height: 25px;">
|
||||
{% if page.bpm %}
|
||||
{% if p_bpm > 0 %}
|
||||
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
|
||||
🎵 {{ page.bpm }} BPM
|
||||
🎵 {{ p_bpm }} BPM
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="tag is-white is-rounded border-tag" style="font-size: 0.65rem; color: #999;">
|
||||
⚠️ BPM N/A
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
@ -289,7 +275,10 @@ permalink: /projetos/
|
|||
<div style="flex: 1;"></div>
|
||||
|
||||
<div class="mt-auto pt-2" style="width: 100%; border-top: 1px dashed #eef6fc;">
|
||||
|
||||
{% assign tags_list = "" %}
|
||||
{% assign unique_insts_page = p_insts_array | uniq | sort %}
|
||||
|
||||
{% if unique_insts_page.size > 0 %}
|
||||
<details class="category-reveal mb-1" style="width: 100%;">
|
||||
<summary class="tag is-white summary-btn">
|
||||
|
|
@ -298,9 +287,7 @@ permalink: /projetos/
|
|||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in unique_insts_page %}{% if tag != "" %}
|
||||
<a href="{{ '/instruments/?instrument=' | append: tag | relative_url }}"
|
||||
class="tag is-light is-info clickable-tag"
|
||||
data-tag-value="{{ tag }}">
|
||||
<a href="{{ '/instruments/?instrument=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag" data-tag-value="{{ tag }}">
|
||||
{{ tag | truncate: 18 }}
|
||||
</a>
|
||||
{% endif %}{% endfor %}
|
||||
|
|
@ -308,7 +295,7 @@ permalink: /projetos/
|
|||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tags.plugin and page.tags.plugin.size > 0 %}
|
||||
{% if page.tags.plugin.size > 0 %}
|
||||
<details class="category-reveal mb-1" style="width: 100%;">
|
||||
<summary class="tag is-white summary-btn">
|
||||
<div class="tag-label"><span>🔌</span> <span class="tag-text">PLUGINS</span></div>
|
||||
|
|
@ -316,9 +303,7 @@ permalink: /projetos/
|
|||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in page.tags.plugin %}{% if tag != "" %}
|
||||
<a href="{{ '/plugin/?plugin=' | append: tag | relative_url }}"
|
||||
class="tag is-light is-info clickable-tag"
|
||||
data-tag-value="{{ tag }}">
|
||||
<a href="{{ '/plugin/?plugin=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag" data-tag-value="{{ tag }}">
|
||||
{{ tag | truncate: 18 }}
|
||||
</a>
|
||||
{% endif %}{% endfor %}
|
||||
|
|
@ -326,7 +311,7 @@ permalink: /projetos/
|
|||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tags.bassline and page.tags.bassline.size > 0 %}
|
||||
{% if page.tags.bassline.size > 0 %}
|
||||
<details class="category-reveal mb-1" style="width: 100%;">
|
||||
<summary class="tag is-white summary-btn">
|
||||
<div class="tag-label"><span>🎹</span> <span class="tag-text">BASSLINE</span></div>
|
||||
|
|
@ -334,9 +319,7 @@ permalink: /projetos/
|
|||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in page.tags.bassline %}{% if tag != "" %}
|
||||
<a href="{{ '/bassline/?bassline=' | append: tag | relative_url }}"
|
||||
class="tag is-light is-info clickable-tag"
|
||||
data-tag-value="{{ tag }}">
|
||||
<a href="{{ '/bassline/?bassline=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag" data-tag-value="{{ tag }}">
|
||||
{{ tag | truncate: 18 }}
|
||||
</a>
|
||||
{% endif %}{% endfor %}
|
||||
|
|
@ -344,7 +327,7 @@ permalink: /projetos/
|
|||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tags.automation and page.tags.automation.size > 0 %}
|
||||
{% if page.tags.automation.size > 0 %}
|
||||
<details class="category-reveal mb-1" style="width: 100%;">
|
||||
<summary class="tag is-white summary-btn">
|
||||
<div class="tag-label"><span>🎚️</span> <span class="tag-text">AUTOMATION</span></div>
|
||||
|
|
@ -352,9 +335,7 @@ permalink: /projetos/
|
|||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in page.tags.automation %}{% if tag != "" %}
|
||||
<a href="{{ '/automation/?automation=' | append: tag | relative_url }}"
|
||||
class="tag is-light is-info clickable-tag"
|
||||
data-tag-value="{{ tag }}">
|
||||
<a href="{{ '/automation/?automation=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag" data-tag-value="{{ tag }}">
|
||||
{{ tag | truncate: 18 }}
|
||||
</a>
|
||||
{% endif %}{% endfor %}
|
||||
|
|
@ -362,7 +343,7 @@ permalink: /projetos/
|
|||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tags.sample and page.tags.sample.size > 0 %}
|
||||
{% if page.tags.sample.size > 0 %}
|
||||
<details class="category-reveal mb-1" style="width: 100%;">
|
||||
<summary class="tag is-white summary-btn">
|
||||
<div class="tag-label"><span>🎤</span> <span class="tag-text">SAMPLES</span></div>
|
||||
|
|
@ -370,9 +351,7 @@ permalink: /projetos/
|
|||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in page.tags.sample %}{% if tag != "" %}
|
||||
<a href="{{ '/sample/?sample=' | append: tag | relative_url }}"
|
||||
class="tag is-light is-info clickable-tag"
|
||||
data-tag-value="{{ tag }}">
|
||||
<a href="{{ '/sample/?sample=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag" data-tag-value="{{ tag }}">
|
||||
{{ tag | truncate: 18 }}
|
||||
</a>
|
||||
{% endif %}{% endfor %}
|
||||
|
|
@ -517,7 +496,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
let currentMinStars = 'all';
|
||||
let searchText = "";
|
||||
|
||||
// Definição Inicial BPM
|
||||
// Definição Inicial BPM (Do HTML)
|
||||
let defMin = parseInt(inputMin.value), defMax = parseInt(inputMax.value);
|
||||
|
||||
// --- 2. LÓGICA DO SLIDER DE BPM (Dual) ---
|
||||
|
|
@ -555,6 +534,18 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
.then(data => {
|
||||
enrichCards(data);
|
||||
createGenreCheckboxes(data);
|
||||
|
||||
// Recalcula limites de BPM com base nos dados reais (Opcional, mas ajusta o maximo)
|
||||
const bpms = data.map(i => parseFloat(i.analise_tecnica?.bpm || 0)).filter(b => b > 0);
|
||||
if(bpms.length > 0) {
|
||||
const maxData = Math.ceil(Math.max(...bpms));
|
||||
if(maxData > parseInt(sliderMax.max)) {
|
||||
sliderMax.max = maxData;
|
||||
inputMax.max = maxData;
|
||||
sliderMin.max = maxData;
|
||||
inputMin.max = maxData;
|
||||
}
|
||||
}
|
||||
applyGlobalFilters();
|
||||
})
|
||||
.catch(console.warn);
|
||||
|
|
@ -585,7 +576,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
const titleKey = normalizarChaveJS(item.getAttribute('data-title'));
|
||||
const info = mapDados[titleKey];
|
||||
|
||||
// Padrões
|
||||
let genero = "Unknown", subgeneros = [], estrelas = 0, intensidade = -100, bpm = 0, tomHtml = "", tomRaw = "all", subTagsHTML = "";
|
||||
|
||||
if (info) {
|
||||
|
|
@ -611,18 +601,33 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
}
|
||||
}
|
||||
|
||||
// Atributos
|
||||
item.setAttribute('data-genre', genero);
|
||||
item.setAttribute('data-subgenres', subgeneros.join(',').toLowerCase());
|
||||
item.setAttribute('data-stars', estrelas);
|
||||
item.setAttribute('data-intensity', intensidade);
|
||||
item.setAttribute('data-key', tomRaw);
|
||||
if(bpm > 0) item.setAttribute('data-bpm-real', bpm);
|
||||
|
||||
// Se o JSON tiver um BPM real, usamos ele (sobrescrevendo o do Liquid se precisar)
|
||||
// Se o projeto for 0, mas o JSON tiver valor, atualizamos.
|
||||
if(bpm > 0) {
|
||||
item.setAttribute('data-bpm-real', bpm);
|
||||
// Atualiza o atributo usado no filtro se o liquid falhou
|
||||
if(item.getAttribute('data-bpm') == "0") item.setAttribute('data-bpm', Math.round(bpm));
|
||||
}
|
||||
|
||||
// Visual
|
||||
const bpmContainer = card.querySelector('.bpm-container');
|
||||
if(bpmContainer) {
|
||||
const existingBpm = bpmContainer.innerHTML;
|
||||
// Mantém o BPM original se existir, ou o novo do JSON
|
||||
let bpmDisplay = "";
|
||||
if(bpm > 0) {
|
||||
bpmDisplay = `<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">🎵 ${Math.round(bpm)} BPM</span>`;
|
||||
} else if (item.getAttribute('data-bpm') != "0") {
|
||||
// Mantém o que veio do Liquid se for válido
|
||||
bpmDisplay = bpmContainer.innerHTML;
|
||||
} else {
|
||||
bpmDisplay = `<span class="tag is-white is-rounded border-tag" style="font-size: 0.65rem; color: #999;">⚠️ BPM N/A</span>`;
|
||||
}
|
||||
|
||||
let newHtml = `<div class="mt-2" style="display:flex; flex-direction:column; align-items:center; gap:4px;">`;
|
||||
newHtml += `<div>${renderizarDificuldade(estrelas)}</div>`;
|
||||
newHtml += `<div class="tags is-centered mb-0" style="gap:4px;">`;
|
||||
|
|
@ -637,7 +642,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
newHtml += `</div>`;
|
||||
if(subTagsHTML) newHtml += `<div style="display:flex; flex-wrap:wrap; justify-content:center; gap:2px;">${subTagsHTML}</div>`;
|
||||
newHtml += `</div>`;
|
||||
bpmContainer.innerHTML = existingBpm + newHtml;
|
||||
|
||||
bpmContainer.innerHTML = bpmDisplay + newHtml;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -649,7 +655,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
if(Array.isArray(i.analise_ia?.nuvem_tags)) i.analise_ia.nuvem_tags.forEach(t => genres.add(t.tag));
|
||||
});
|
||||
|
||||
sidebarGenreContainer.innerHTML = ""; // Clear loader
|
||||
sidebarGenreContainer.innerHTML = "";
|
||||
Array.from(genres).sort().forEach(g => {
|
||||
const label = document.createElement('label');
|
||||
label.className = "checkbox is-block mb-1 is-size-7";
|
||||
|
|
@ -657,13 +663,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
sidebarGenreContainer.appendChild(label);
|
||||
});
|
||||
|
||||
// Re-attach listeners to new checkboxes
|
||||
document.querySelectorAll('#sidebar-genres .filter-checkbox').forEach(cb => {
|
||||
cb.addEventListener('change', updateActiveSidebar);
|
||||
});
|
||||
}
|
||||
|
||||
// --- 4. GESTÃO DE FILTROS ---
|
||||
function updateActiveSidebar() {
|
||||
activeSidebar = { instruments: [], plugins: [], samples: [], bassline: [], automation: [], keys: [], genres: [] };
|
||||
document.querySelectorAll('.filter-checkbox').forEach(bx => {
|
||||
|
|
@ -677,15 +681,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
applyGlobalFilters();
|
||||
}
|
||||
|
||||
// --- MAIN FILTER LOGIC WITH HIGHLIGHTING ---
|
||||
function applyGlobalFilters() {
|
||||
let visibleCount = 0;
|
||||
let minBpm = parseInt(inputMin.value);
|
||||
let maxBpm = parseInt(inputMax.value);
|
||||
if(minBpm > maxBpm) { let t = minBpm; minBpm = maxBpm; maxBpm = t; }
|
||||
|
||||
// Coleta todos os termos de busca para o highlight
|
||||
// (Junta todos os filtros de texto ativos em um único set para performance)
|
||||
const allActiveTags = new Set([
|
||||
...activeSidebar.instruments,
|
||||
...activeSidebar.plugins,
|
||||
|
|
@ -696,27 +697,26 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
...activeSidebar.keys
|
||||
].map(s => s.toLowerCase()));
|
||||
|
||||
// Check if any filter (except stars/bpm) is active to trigger auto-open
|
||||
const hasActiveTypeFilter = allActiveTags.size > 0 || (searchText.length > 2);
|
||||
|
||||
document.querySelectorAll('.project-item').forEach(item => {
|
||||
// Leitura
|
||||
const pName = item.getAttribute('data-name') || "";
|
||||
const pBpm = parseInt(item.getAttribute('data-bpm')) || 0;
|
||||
// Garante que é número. Se "0" ou "NaN", vira 0.
|
||||
let pBpm = parseInt(item.getAttribute('data-bpm'));
|
||||
if(isNaN(pBpm)) pBpm = 0;
|
||||
|
||||
const pInsts = (item.getAttribute('data-instruments') || "").split(',');
|
||||
const pPlugins = (item.getAttribute('data-plugins') || "").split(',');
|
||||
const pSamples = (item.getAttribute('data-samples') || "").split(',');
|
||||
const pBassline = (item.getAttribute('data-bassline') || "").split(',');
|
||||
const pAutomation = (item.getAttribute('data-automation') || "").split(',');
|
||||
|
||||
// Novos (IA/Sidebar)
|
||||
const pGenre = (item.getAttribute('data-genre') || "").toLowerCase();
|
||||
const pSubs = (item.getAttribute('data-subgenres') || "").toLowerCase();
|
||||
const pTagsIA = pGenre + "," + pSubs;
|
||||
const pKey = item.getAttribute('data-key') || 'all';
|
||||
const pStars = parseInt(item.getAttribute('data-stars') || 0);
|
||||
|
||||
// Matches
|
||||
const matchInst = activeSidebar.instruments.length === 0 || activeSidebar.instruments.some(f => pInsts.includes(f));
|
||||
const matchPlugin = activeSidebar.plugins.length === 0 || activeSidebar.plugins.some(f => pPlugins.includes(f));
|
||||
const matchSample = activeSidebar.samples.length === 0 || activeSidebar.samples.some(f => pSamples.includes(f));
|
||||
|
|
@ -736,34 +736,26 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
item.style.display = 'block';
|
||||
visibleCount++;
|
||||
|
||||
// --- HIGHLIGHT LOGIC ---
|
||||
// 1. Reset highlights
|
||||
// Highlight
|
||||
const clickableTags = item.querySelectorAll('.clickable-tag');
|
||||
clickableTags.forEach(t => t.classList.remove('is-matched-tag'));
|
||||
|
||||
// 2. Apply matches & Auto-open
|
||||
if(hasActiveTypeFilter) {
|
||||
// Close all details first to reduce noise (optional strategy)
|
||||
item.querySelectorAll('details').forEach(d => d.open = false);
|
||||
|
||||
clickableTags.forEach(tagEl => {
|
||||
const tagVal = (tagEl.dataset.tagValue || "").trim().toLowerCase();
|
||||
// Check exact match from filters OR text search partial match
|
||||
const isFilterMatch = allActiveTags.has(tagVal);
|
||||
const isTextMatch = searchText.length > 2 && tagVal.includes(searchText);
|
||||
|
||||
if (isFilterMatch || isTextMatch) {
|
||||
tagEl.classList.add('is-matched-tag');
|
||||
const parentDetails = tagEl.closest('details');
|
||||
if(parentDetails) parentDetails.open = true; // Auto-open!
|
||||
if(parentDetails) parentDetails.open = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// If no filters active, maybe leave default open state (usually instruments open)
|
||||
else {
|
||||
// Reset to default (Instruments open, others closed)
|
||||
} else {
|
||||
item.querySelectorAll('details').forEach(d => d.open = false);
|
||||
const instDetail = item.querySelector('details:first-of-type'); // Assuming instruments is first
|
||||
const instDetail = item.querySelector('details:first-of-type');
|
||||
if(instDetail) instDetail.open = true;
|
||||
}
|
||||
|
||||
|
|
@ -777,15 +769,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
noResults.classList.toggle('is-hidden', visibleCount > 0);
|
||||
}
|
||||
|
||||
// --- 5. EVENT LISTENERS GERAIS ---
|
||||
checkboxes.forEach(cb => cb.addEventListener('change', updateActiveSidebar));
|
||||
|
||||
searchInput.addEventListener('input', (e) => { searchText = e.target.value.toLowerCase().trim(); applyGlobalFilters(); });
|
||||
clearInputBtn.addEventListener('click', () => { searchInput.value = ""; searchText = ""; applyGlobalFilters(); });
|
||||
|
||||
if(starFilterSelect) starFilterSelect.addEventListener('change', (e) => { currentMinStars = e.target.value; applyGlobalFilters(); });
|
||||
|
||||
// Sort
|
||||
if(sortSelect) sortSelect.addEventListener('change', (e) => {
|
||||
const crit = e.target.value;
|
||||
const cols = Array.from(projectsContainer.children);
|
||||
|
|
@ -801,19 +789,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
cols.forEach(c => projectsContainer.appendChild(c));
|
||||
});
|
||||
|
||||
// Limpeza Individual de Grupos
|
||||
clearGroupBtns.forEach(btn => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // Não fechar o details
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
const target = btn.dataset.target;
|
||||
|
||||
// Reseta BPM especificamente ou checkboxes
|
||||
if(target === 'bpm') {
|
||||
sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max;
|
||||
updateSlider();
|
||||
sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
|
||||
} else {
|
||||
// Desmarca checkboxes daquela categoria
|
||||
document.querySelectorAll(`.filter-checkbox[data-category="${target}"]`).forEach(cb => {
|
||||
cb.checked = false;
|
||||
if(cb.parentElement.classList.contains('tag')) cb.parentElement.classList.remove('is-checked');
|
||||
|
|
@ -823,19 +805,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
});
|
||||
});
|
||||
|
||||
// Reset Total
|
||||
resetBtn.addEventListener('click', () => {
|
||||
document.querySelectorAll('.filter-checkbox').forEach(cb => { cb.checked = false; cb.parentElement.classList.remove('is-checked'); });
|
||||
searchInput.value = ""; searchText = "";
|
||||
|
||||
sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
|
||||
starFilterSelect.value = 'all'; currentMinStars = 'all';
|
||||
sortSelect.value = 'default';
|
||||
|
||||
starFilterSelect.value = 'all'; currentMinStars = 'all'; sortSelect.value = 'default';
|
||||
updateActiveSidebar();
|
||||
});
|
||||
|
||||
// Modal
|
||||
const modal = document.getElementById('preview-modal');
|
||||
const iframe = document.getElementById('preview-iframe');
|
||||
const modalTitle = document.getElementById('modal-title');
|
||||
|
|
|
|||
Loading…
Reference in New Issue