reformula buscas

This commit is contained in:
JotaChina committed 2025-12-17 17:03:33 -03:00
1 parent e411e426ba
commit 05ae70d234
3 files changed
+233 -82

No files matched your search

+122 -68
View File
@@ -269,6 +269,74 @@ permalink: /projetos/
{% elsif track.instrument_name %}{% assign p_insts_array = p_insts_array | push: track.instrument_name %}{% endif %}
{% endfor %}
{% assign has_patterns_display = false %}
{% capture patterns_html_content %}
<div class="px-1 py-1">
{% for track in page.tracks %}
{% if track.instruments %}
{% for inst in track.instruments %}
{% if inst.patterns %}
{% assign current_inst_patterns = "" | split: "," %}
{% for pattern in inst.patterns %}
{% assign p_steps = pattern.steps %}
{% if p_steps and p_steps.size > 0 %}
{% assign total_s = p_steps.size %}
{% assign n_chunks = total_s | divided_by: 4 %}
{% for i in (0..n_chunks) %}
{% assign idx = i | times: 4 %}
{% assign chunk = p_steps | slice: idx, 4 %}
{% if chunk.size > 0 %}
{% assign c_str = "" %}
{% for s in chunk %}
{% if s == true or s == 1 or s == 'true' %}{% assign c_str = c_str | append: "1" %}{% else %}{% assign c_str = c_str | append: "0" %}{% endif %}
{% endfor %}
{% if c_str != "0000" %}
{% unless current_inst_patterns contains c_str %}
{% assign current_inst_patterns = current_inst_patterns | push: c_str %}
{% endunless %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if current_inst_patterns.size > 0 %}
{% assign has_patterns_display = true %}
<div class="pattern-row">
<span style="font-weight:600; max-width: 45%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">
{{ inst.instrument_name | truncate: 12 }}
</span>
<div style="display:flex; gap:2px;">
{% for pat in current_inst_patterns %}
<div class="pattern-mini-grid" title="Pattern: {{ pat }}">
{% assign bits = pat | split: '' %}
{% for bit in bits %}
<div class="mini-step {% if bit == '1' %}active{% else %}inactive{% endif %}"></div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endcapture %}
{% if has_patterns_display %}
<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">RITMO</span></div>
<span class="icon is-small chevron"><i class="fa-solid fa-chevron-down"></i></span>
</summary>
<div class="mt-1 mb-2 has-text-left" style="background: #fdfdfd; border-radius: 4px; border: 1px solid #f0f0f0;">
{{ patterns_html_content }}
</div>
</details>
{% endif %}
{% assign p_patterns_str = project_patterns_flat | join: ',' %}
{% assign p_instruments_str = p_insts_array | uniq | join: ',' %}
{% assign p_plugins = page.tags.plugin | join: ',' %}
@@ -279,7 +347,19 @@ permalink: /projetos/
<div class="column is-12-mobile is-6-tablet is-4-desktop is-4-widescreen project-item" data-name="{{ p_name }}" data-title="{{ page.title | escape }}" data-bpm="{{ p_bpm }}" data-plugins="{{ p_plugins }}" data-bassline="{{ p_bassline }}" data-automation="{{ p_automation }}" data-instruments="{{ p_instruments_str }}" data-samples="{{ p_samples }}" data-patterns="{{ p_patterns_str }}">
<div class="card project-card" data-title="{{ page.title | escape }}" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column; position: relative;">
<div class="card project-card" data-title="{{ page.title | escape }}" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column; position: relative; transition: all 0.3s ease;">
{% assign matching_beat = nil %}
{% if site.data.beats %}
{% assign proj_slug = page.file | slugify %}
{% for filename in site.data.beats %}
{% assign beat_slug = filename | remove: '.wav' | remove: '.mp3' | slugify %}
{% if beat_slug == proj_slug %}
{% assign matching_beat = filename %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
<a href="{{ page.url | relative_url }}" style="text-decoration: none; flex: 1; display: flex; flex-direction: column;">
<div class="card-content has-text-centered p-4" style="flex: 1; display: flex; flex-direction: column;">
@@ -300,6 +380,15 @@ permalink: /projetos/
{% endif %}
</div>
{% if matching_beat %}
<div class="audio-wrapper mb-3" style="width: 100%;" onclick="event.preventDefault();">
<audio class="audio-player" controls style="width: 100%; height: 28px; border-radius: 15px; opacity: 0.9;">
<source src="/mmpSearch/src_mmpSearch/wav/{{ matching_beat | url_encode }}" type="audio/wav">
Seu navegador não suporta áudio.
</audio>
</div>
{% endif %}
<div style="flex: 1;"></div>
<div class="mt-auto pt-2" style="width: 100%; border-top: 1px dashed #eef6fc;">
@@ -315,73 +404,6 @@ permalink: /projetos/
</details>
{% endif %}
{% assign has_patterns_display = false %}
{% capture patterns_html_content %}
<div class="px-1 py-1">
{% for track in page.tracks %}
{% if track.instruments %}
{% for inst in track.instruments %}
{% if inst.patterns %}
{% assign current_inst_patterns = "" | split: "," %}
{% for pattern in inst.patterns %}
{% assign p_steps = pattern.steps %}
{% if p_steps and p_steps.size > 0 %}
{% assign total_s = p_steps.size %}
{% assign n_chunks = total_s | divided_by: 4 %}
{% for i in (0..n_chunks) %}
{% assign idx = i | times: 4 %}
{% assign chunk = p_steps | slice: idx, 4 %}
{% if chunk.size > 0 %}
{% assign c_str = "" %}
{% for s in chunk %}
{% if s == true or s == 1 or s == 'true' %}{% assign c_str = c_str | append: "1" %}{% else %}{% assign c_str = c_str | append: "0" %}{% endif %}
{% endfor %}
{% if c_str != "0000" %}
{% unless current_inst_patterns contains c_str %}
{% assign current_inst_patterns = current_inst_patterns | push: c_str %}
{% endunless %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if current_inst_patterns.size > 0 %}
{% assign has_patterns_display = true %}
<div class="pattern-row">
<span style="font-weight:600; max-width: 45%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">
{{ inst.instrument_name | truncate: 12 }}
</span>
<div style="display:flex; gap:2px;">
{% for pat in current_inst_patterns %}
<div class="pattern-mini-grid" title="Pattern: {{ pat }}">
{% assign bits = pat | split: '' %}
{% for bit in bits %}
<div class="mini-step {% if bit == '1' %}active{% else %}inactive{% endif %}"></div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endcapture %}
{% if has_patterns_display %}
<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">RITMO</span></div>
<span class="icon is-small chevron"><i class="fa-solid fa-chevron-down"></i></span>
</summary>
<div class="mt-1 mb-2 has-text-left" style="background: #fdfdfd; border-radius: 4px; border: 1px solid #f0f0f0;">
{{ patterns_html_content }}
</div>
</details>
{% endif %}
{% 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><span class="icon is-small chevron"><i class="fa-solid fa-chevron-down"></i></span></summary>
@@ -557,6 +579,10 @@ permalink: /projetos/
border-bottom: 1px dashed #f0f0f0;
}
.pattern-row:last-child { border-bottom: none; }
/* AUDIO PLAYER CUSTOM */
audio::-webkit-media-controls-panel { background-color: #f1f3f5; }
.project-card:hover audio::-webkit-media-controls-panel { background-color: #eef6fc; }
</style>
<script>
@@ -739,6 +765,34 @@ document.addEventListener('DOMContentLoaded', function () {
// --- 3. LÓGICA DE UI E EVENT LISTENERS ---
// AUDIO PLAYER LOGIC
const audioPlayers = document.querySelectorAll('.audio-player');
audioPlayers.forEach(audio => {
audio.addEventListener('play', function() {
// Pausa outros
audioPlayers.forEach(otherAudio => {
if (otherAudio !== audio && !otherAudio.paused) {
otherAudio.pause();
}
});
// Highlight Visual
const card = audio.closest('.project-card');
if(card) {
card.style.borderColor = '#4caf50';
card.style.backgroundColor = '#f0fff4';
}
});
audio.addEventListener('pause', function() {
const card = audio.closest('.project-card');
if(card) {
// Volta ao original
card.style.borderColor = '#cfe8fc';
card.style.backgroundColor = '#f0f8ff';
}
});
});
// BPM Slider Logic
function updateSlider() {
let val1 = parseInt(sliderMin.value);