reformula buscas
Deploy / Deploy (push) Successful in 1m27s
Details
Deploy / Deploy (push) Successful in 1m27s
Details
This commit is contained in:
parent
a6c0802069
commit
007a40cdb2
|
|
@ -12,26 +12,45 @@ permalink: /projetos/
|
|||
{% assign list_automation = "" %}
|
||||
|
||||
{% for p in site.data.all %}
|
||||
{% if p.bpm %}{% assign list_bpm = list_bpm | append: p.bpm | append: "|||" %}{% endif %}
|
||||
{% 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 %}
|
||||
{% 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 %}
|
||||
|
||||
{% 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.instruments %}
|
||||
{% for inst in track.instruments %}
|
||||
{% if inst.instrument_name and inst.instrument_name != "" %}
|
||||
{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elsif track.instrument_name and 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_bpm_array = 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 %}
|
||||
{% assign unique_bassline = list_bassline | split: "|||" | uniq | sort %}
|
||||
{% assign unique_automation = list_automation | split: "|||" | uniq | sort %}
|
||||
|
||||
{% assign min_bpm_val = 0 %}
|
||||
{% assign max_bpm_val = 300 %}
|
||||
{% if unique_bpm_array.size > 0 %}
|
||||
{% assign min_bpm_val = unique_bpm_array | first %}
|
||||
{% assign max_bpm_val = unique_bpm_array | last %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="publication">
|
||||
<div class="container is-fluid">
|
||||
<br />
|
||||
|
|
@ -44,7 +63,7 @@ permalink: /projetos/
|
|||
<div class="column">
|
||||
<h1 class="title is-3 has-text-grey-dark">📁 Projetos Disponíveis</h1>
|
||||
<p class="subtitle is-6 has-text-grey">
|
||||
Busca avançada: Digite termos ou selecione filtros para refinar.
|
||||
Busca avançada: Use o slicer de BPM ou filtros de tag para encontrar o projeto ideal.
|
||||
</p>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
|
|
@ -72,19 +91,18 @@ permalink: /projetos/
|
|||
<hr class="my-3">
|
||||
|
||||
<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 %}
|
||||
<p class="menu-label has-text-weight-bold mb-2">Faixa de BPM</p>
|
||||
<div class="columns is-mobile is-variable is-1">
|
||||
<div class="column">
|
||||
<label class="is-size-7 has-text-grey">Mín</label>
|
||||
<input class="input is-small" type="number" id="bpm-min" value="{{ min_bpm_val }}" min="0" max="999">
|
||||
</div>
|
||||
<div class="column">
|
||||
<label class="is-size-7 has-text-grey">Máx</label>
|
||||
<input class="input is-small" type="number" id="bpm-max" value="{{ max_bpm_val }}" min="0" max="999">
|
||||
</div>
|
||||
</div>
|
||||
<p class="help has-text-centered is-size-7" style="margin-top: -5px;">Projetos entre esses valores.</p>
|
||||
</div>
|
||||
<hr class="my-3">
|
||||
|
||||
|
|
@ -161,12 +179,26 @@ permalink: /projetos/
|
|||
{% for page in project_pages %}
|
||||
{% if page.url != '/projetos/' %}
|
||||
|
||||
{% assign p_bpm = page.bpm | append: "" %}
|
||||
{% 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: ',' %}
|
||||
{% assign p_samples = page.tags.sample | join: ',' %}
|
||||
{% assign p_instruments = page.tags.instruments | default: page.tags.instrument | join: ',' %}
|
||||
|
||||
{% assign p_name = page.title | default: page.name | downcase %}
|
||||
|
||||
|
|
@ -176,7 +208,7 @@ permalink: /projetos/
|
|||
data-plugins="{{ p_plugins }}"
|
||||
data-bassline="{{ p_bassline }}"
|
||||
data-automation="{{ p_automation }}"
|
||||
data-instruments="{{ p_instruments }}"
|
||||
data-instruments="{{ p_instruments_str }}"
|
||||
data-samples="{{ p_samples }}">
|
||||
|
||||
<div class="card project-card"
|
||||
|
|
@ -209,17 +241,19 @@ permalink: /projetos/
|
|||
|
||||
<div class="mt-auto pt-2" style="width: 100%; border-top: 1px dashed #eef6fc;">
|
||||
|
||||
{% assign inst_tags = page.tags.instruments | default: page.tags.instrument %}
|
||||
{% if inst_tags and inst_tags.size > 0 %}
|
||||
{% 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">
|
||||
<div class="tag-label"><span>🎸</span> <span class="tag-text">INSTRUMENTS</span></div>
|
||||
<span class="icon is-small chevron"><i class="fa-solid fa-chevron-down"></i></span>
|
||||
</summary>
|
||||
<div class="tags is-centered mt-1 mb-2 px-1" style="gap: 3px;">
|
||||
{% for tag in inst_tags %}{% if tag != "" %}
|
||||
<a href="{{ '/instruments/?instrument=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag">{{ tag | truncate: 18 }}</a>
|
||||
{% endif %}{% endfor %}
|
||||
{% for tag in unique_insts_page %}
|
||||
{% if tag != "" %}
|
||||
<a href="{{ '/instruments/?instrument=' | append: tag | relative_url }}" class="tag is-light is-info clickable-tag">{{ tag | truncate: 18 }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
||||
|
|
@ -370,6 +404,10 @@ permalink: /projetos/
|
|||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const checkboxes = document.querySelectorAll('.filter-checkbox');
|
||||
const searchInput = document.getElementById('search-input');
|
||||
// Inputs de BPM
|
||||
const bpmMinInput = document.getElementById('bpm-min');
|
||||
const bpmMaxInput = document.getElementById('bpm-max');
|
||||
|
||||
const projects = document.querySelectorAll('.project-item');
|
||||
const resetBtn = document.getElementById('reset-all-filters');
|
||||
const countBar = document.getElementById('results-count-bar');
|
||||
|
|
@ -377,17 +415,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
const noResults = document.getElementById('no-results');
|
||||
|
||||
// Estado do Filtro
|
||||
let activeFilters = { bpm: [], instruments: [], plugins: [], samples: [], bassline: [], automation: [] };
|
||||
let activeFilters = { instruments: [], plugins: [], samples: [], bassline: [], automation: [] };
|
||||
let searchText = "";
|
||||
|
||||
// Valores Iniciais de BPM
|
||||
let initialMinBpm = parseInt(bpmMinInput.value) || 0;
|
||||
let initialMaxBpm = parseInt(bpmMaxInput.value) || 999;
|
||||
|
||||
function updateState() {
|
||||
// Reseta Arrays
|
||||
activeFilters = { bpm: [], instruments: [], plugins: [], samples: [], bassline: [], automation: [] };
|
||||
// Reseta Arrays (menos BPM que é tratado separado)
|
||||
activeFilters = { instruments: [], plugins: [], samples: [], bassline: [], automation: [] };
|
||||
|
||||
// Lê Checkboxes
|
||||
checkboxes.forEach(cb => {
|
||||
if (cb.checked) {
|
||||
const category = cb.getAttribute('data-category');
|
||||
// BPM não usa checkbox mais, mas mantive a segurança
|
||||
if (activeFilters[category]) activeFilters[category].push(cb.value);
|
||||
if(cb.parentElement.classList.contains('tag')) cb.parentElement.classList.add('is-checked');
|
||||
} else {
|
||||
|
|
@ -403,28 +446,33 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
|
||||
function applyFilters() {
|
||||
let visibleCount = 0;
|
||||
|
||||
// Lê valores atuais do Slicer de BPM
|
||||
const currentMinBpm = parseInt(bpmMinInput.value) || 0;
|
||||
const currentMaxBpm = parseInt(bpmMaxInput.value) || 999;
|
||||
|
||||
projects.forEach(project => {
|
||||
// Lê dados do elemento
|
||||
const pName = project.getAttribute('data-name') || "";
|
||||
const pBpm = project.getAttribute('data-bpm') || "";
|
||||
const pBpm = parseInt(project.getAttribute('data-bpm')) || 0;
|
||||
const pInsts = (project.getAttribute('data-instruments') || "").split(',');
|
||||
const pPlugins = (project.getAttribute('data-plugins') || "").split(',');
|
||||
const pSamples = (project.getAttribute('data-samples') || "").split(',');
|
||||
const pBassline = (project.getAttribute('data-bassline') || "").split(',');
|
||||
const pAutomation = (project.getAttribute('data-automation') || "").split(',');
|
||||
|
||||
// 1. Checa Filtros de Categoria (Checkbox)
|
||||
const matchBpm = activeFilters.bpm.length === 0 || activeFilters.bpm.includes(pBpm);
|
||||
// 1. Checa SLICER DE BPM (Lógica de Intervalo)
|
||||
const matchBpm = (pBpm >= currentMinBpm && pBpm <= currentMaxBpm);
|
||||
|
||||
// 2. Checa Filtros de Categoria (Checkbox)
|
||||
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));
|
||||
const matchBassline = activeFilters.bassline.length === 0 || activeFilters.bassline.some(f => pBassline.includes(f));
|
||||
const matchAutomation = activeFilters.automation.length === 0 || activeFilters.automation.some(f => pAutomation.includes(f));
|
||||
|
||||
// 2. Checa Busca de Texto (IA Filter)
|
||||
// Concatena tudo para buscar em qualquer campo
|
||||
const fullMeta = [pName, pBpm, pInsts.join(' '), pPlugins.join(' '), pSamples.join(' '), pBassline.join(' '), pAutomation.join(' ')].join(' ').toLowerCase();
|
||||
// 3. Checa Busca de Texto (IA Filter)
|
||||
const fullMeta = [pName, pBpm.toString(), pInsts.join(' '), pPlugins.join(' '), pSamples.join(' '), pBassline.join(' '), pAutomation.join(' ')].join(' ').toLowerCase();
|
||||
const matchText = searchText === "" || fullMeta.includes(searchText);
|
||||
|
||||
if (matchBpm && matchInst && matchPlugin && matchSample && matchBassline && matchAutomation && matchText) {
|
||||
|
|
@ -443,6 +491,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
// Eventos
|
||||
checkboxes.forEach(cb => cb.addEventListener('change', updateState));
|
||||
searchInput.addEventListener('input', updateState);
|
||||
bpmMinInput.addEventListener('input', updateState);
|
||||
bpmMaxInput.addEventListener('input', updateState);
|
||||
|
||||
// Suporte para parâmetros de URL (q=...)
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
|
@ -458,10 +508,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
if(cb.parentElement.classList.contains('tag')) cb.parentElement.classList.remove('is-checked');
|
||||
});
|
||||
searchInput.value = "";
|
||||
// Reseta BPM para os valores iniciais da página
|
||||
bpmMinInput.value = initialMinBpm;
|
||||
bpmMaxInput.value = initialMaxBpm;
|
||||
updateState();
|
||||
});
|
||||
|
||||
// --- Modal Logic ---
|
||||
// --- Modal Logic (Preview) ---
|
||||
const modal = document.getElementById('preview-modal');
|
||||
const iframe = document.getElementById('preview-iframe');
|
||||
const modalTitle = document.getElementById('modal-title');
|
||||
|
|
|
|||
Loading…
Reference in New Issue