1060 lines
56 KiB
HTML
Executable File
1060 lines
56 KiB
HTML
Executable File
---
|
|
layout: default
|
|
title: MMPSearch - Projetos
|
|
permalink: /projetos/
|
|
---
|
|
|
|
{% assign list_bpm = "" %}
|
|
{% assign list_plugins = "" %}
|
|
{% assign list_instruments = "" %}
|
|
{% assign list_samples = "" %}
|
|
{% assign list_bassline = "" %}
|
|
{% assign list_automation = "" %}
|
|
|
|
{% for p in site.data.all %}
|
|
{% 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 %}
|
|
|
|
{% for track in p.tracks %}
|
|
{% if track.instruments %}{% for inst in track.instruments %}{% if inst.instrument_name %}{% assign list_instruments = list_instruments | append: inst.instrument_name | append: "|||" %}{% endif %}{% 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_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_limit = 0 %}
|
|
{% assign max_limit = 300 %}
|
|
{% if unique_bpm_array.size > 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">
|
|
<div class="container is-fluid">
|
|
<br />
|
|
|
|
<div class="tabs is-centered is-boxed is-medium mb-5">
|
|
{% include sidebar.html %}
|
|
</div>
|
|
|
|
<div class="columns is-vcentered mb-4">
|
|
<div class="column">
|
|
<h1 class="title is-3 has-text-grey-dark">📁 Projetos Disponíveis</h1>
|
|
<p class="subtitle is-6 has-text-grey">
|
|
Utilize os filtros laterais para refinar sua busca.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="column is-narrow">
|
|
<div class="field is-grouped is-grouped-multiline" style="justify-content: flex-end;">
|
|
|
|
<div class="control has-icons-left">
|
|
<div class="select is-small is-rounded">
|
|
<select id="star-filter">
|
|
<option value="all">Dificuldade: Todas</option>
|
|
<option value="5">🔥 Expert (5)</option>
|
|
<option value="4">⚡ Avançado (4)</option>
|
|
<option value="3">🔷 Médio (3)</option>
|
|
<option value="2">🟢 Básico (2)</option>
|
|
</select>
|
|
</div>
|
|
<div class="icon is-small is-left has-text-warning"><i class="fa-solid fa-star"></i></div>
|
|
</div>
|
|
|
|
<div class="control has-icons-left">
|
|
<div class="select is-small is-rounded">
|
|
<select id="sort-select">
|
|
<option value="default">Ordem Padrão</option>
|
|
<option value="stars_desc">⭐ Mais Complexos</option>
|
|
<option value="stars_asc">⭐ Mais Simples</option>
|
|
<option value="intensity_desc">🔥 Mais Intensos</option>
|
|
<option value="intensity_asc">❄️ Mais Calmos</option>
|
|
<option value="bpm_desc">⚡ BPM (Rápido)</option>
|
|
</select>
|
|
</div>
|
|
<div class="icon is-small is-left"><i class="fa-solid fa-sort"></i></div>
|
|
</div>
|
|
|
|
<div class="control">
|
|
<button id="reset-all-filters" class="button is-danger is-light is-small">
|
|
<span class="icon"><i class="fa-solid fa-trash-can"></i></span>
|
|
<span>Limpar Tudo</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column is-3">
|
|
<div class="box p-3" style="background: #fcfcfc; border: 1px solid #eee;">
|
|
|
|
<div class="field mb-5">
|
|
<label class="label is-size-7 has-text-grey">BUSCA TEXTUAL</label>
|
|
<div class="control has-icons-left has-icons-right">
|
|
<input class="input is-small" type="text" id="search-input" placeholder="Nome, plugin...">
|
|
<span class="icon is-small is-left"><i class="fa-solid fa-magnifying-glass"></i></span>
|
|
<span class="icon is-small is-right is-clickable js-clear-input" style="pointer-events: all; cursor: pointer;">
|
|
<i class="fa-solid fa-xmark"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<hr class="my-3">
|
|
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">🥁 Pattern Rítmico</summary>
|
|
<div class="filter-header-actions">
|
|
<button class="button is-ghost is-small p-0 js-clear-group" data-target="pattern" 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 px-1 pb-2 has-text-centered">
|
|
<p class="is-size-7 has-text-grey mb-2">Desenhe o ritmo:</p>
|
|
<div id="pattern-search-box" style="display: flex; gap: 4px; justify-content: center; flex-wrap: wrap;">
|
|
{% for i in (0..15) %}
|
|
{% assign mod = i | modulo: 4 %}
|
|
{% if i > 0 and mod == 0 %}<div style="width: 100%; height: 0px; flex-basis: 100%;"></div>{% endif %}
|
|
<div class="search-step" data-index="{{i}}"
|
|
style="width: 22px; height: 35px; background: #eee; border: 1px solid #ccc; border-radius: 3px; cursor: pointer; transition: all 0.1s;">
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
<p class="help is-size-7 mt-1 has-text-grey-light">Clique para ativar steps</p>
|
|
</div>
|
|
</details>
|
|
<hr class="my-3">
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Gêneros (IA)</summary>
|
|
<div class="filter-header-actions">
|
|
<button class="button is-ghost is-small p-0 js-clear-group" data-target="genres" 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" id="sidebar-genres" style="max-height: 200px; overflow-y: auto;">
|
|
<p class="is-size-7 has-text-grey-light p-1">Carregando...</p>
|
|
</div>
|
|
</details>
|
|
<hr class="my-3">
|
|
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Tom / Key</summary>
|
|
<div class="filter-header-actions">
|
|
<button class="button is-ghost is-small p-0 js-clear-group" data-target="keys" 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 keys_list = "C,Cm,C#,C#m,Db,Dm,D,D#m,Eb,E,Em,F,Fm,F#,F#m,Gb,G,Gm,G#,Ab,A,Am,Bb,B,Bm" | split: "," %}
|
|
{% for key in keys_list %}
|
|
<label class="checkbox is-block mb-1 is-size-7">
|
|
<input type="checkbox" class="filter-checkbox" data-category="keys" value="{{ key }}">
|
|
🎹 {{ key }}
|
|
</label>
|
|
{% endfor %}
|
|
</div>
|
|
</details>
|
|
<hr class="my-3">
|
|
|
|
<details>
|
|
<summary class="menu-label has-text-weight-bold mb-2 clickable-summary">Faixa de BPM</summary>
|
|
<div class="filter-header-actions">
|
|
<button class="button is-ghost is-small p-0 js-clear-group" data-target="bpm" style="height: auto; font-size: 0.65rem;">
|
|
<span class="icon"><i class="fa-solid fa-rotate-left"></i></span> <span>Resetar</span>
|
|
</button>
|
|
</div>
|
|
<div class="filter-content px-1 pb-2">
|
|
<div class="range-slider-container mt-4 mb-5">
|
|
<div class="slider-track" id="slider-track"></div>
|
|
<input type="range" id="range-min" min="{{ min_limit }}" max="{{ max_limit }}" value="{{ min_limit }}">
|
|
<input type="range" id="range-max" min="{{ min_limit }}" max="{{ max_limit }}" value="{{ max_limit }}">
|
|
</div>
|
|
<div class="columns is-mobile is-variable is-1">
|
|
<div class="column"><input class="input is-small has-text-centered" type="number" id="bpm-min" value="{{ min_limit }}"></div>
|
|
<div class="column"><input class="input is-small has-text-centered" type="number" id="bpm-max" value="{{ max_limit }}"></div>
|
|
</div>
|
|
</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>
|
|
<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 %}
|
|
|
|
{% 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>
|
|
|
|
<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">
|
|
{% assign project_pages = site.pages | where_exp: "page", "page.path contains 'projetos/'" | sort: "title" %}
|
|
{% 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: "," %}
|
|
|
|
{% assign project_patterns_flat = "" | 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 %}
|
|
{% if inst.patterns %}
|
|
{% for pattern in inst.patterns %}
|
|
{% assign pattern_steps = pattern.steps %}
|
|
{% if pattern_steps and pattern_steps.size > 0 %}
|
|
{% assign chunk_string = "" %}
|
|
{% assign step_count = 0 %}
|
|
{% for step in pattern_steps %}
|
|
{% if step == true or step == 'true' or step == 1 %}{% assign chunk_string = chunk_string | append: '1' %}{% else %}{% assign chunk_string = chunk_string | append: '0' %}{% endif %}
|
|
{% assign step_count = step_count | plus: 1 %}
|
|
{% if step_count == 4 %}
|
|
{% unless project_patterns_flat contains chunk_string %}
|
|
{% assign project_patterns_flat = project_patterns_flat | push: chunk_string %}
|
|
{% endunless %}
|
|
{% assign chunk_string = "" %}
|
|
{% assign step_count = 0 %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% 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: ',' %}
|
|
{% assign p_bassline = page.tags.bassline | join: ',' %}
|
|
{% assign p_automation = page.tags.automation | join: ',' %}
|
|
{% assign p_samples = page.tags.sample | join: ',' %}
|
|
{% assign p_name = page.title | default: page.name | downcase %}
|
|
|
|
<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; 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;">
|
|
|
|
<div style="width: 50px; height: 50px; background-color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem auto; box-shadow: 0 2px 5px rgba(0,0,0,0.05);">
|
|
<span class="icon" style="color: #3273dc;"><i class="fa-solid fa-music fa-lg"></i></span>
|
|
</div>
|
|
|
|
<p class="title is-6 mb-2" style="color: #205081; word-break: break-word; font-weight: 700; line-height: 1.2;">
|
|
{{ page.title | default: page.name | replace: '.html', '' }}
|
|
</p>
|
|
|
|
<div class="bpm-container mb-3" style="min-height: 25px;">
|
|
{% 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;">🎵 {{ 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>
|
|
|
|
{% 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;">
|
|
{% 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 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 }}">{{ tag | truncate: 18 }}</a>
|
|
{% endif %}{% endfor %}
|
|
</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>
|
|
<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 }}">{{ tag | truncate: 18 }}</a>
|
|
{% endif %}{% endfor %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
|
|
{% 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><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 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 }}">{{ tag | truncate: 18 }}</a>
|
|
{% endif %}{% endfor %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
|
|
{% 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><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 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 }}">{{ tag | truncate: 18 }}</a>
|
|
{% endif %}{% endfor %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
|
|
{% 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><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 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 }}">{{ tag | truncate: 18 }}</a>
|
|
{% endif %}{% endfor %}
|
|
</div>
|
|
</details>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</a>
|
|
|
|
<footer class="card-footer" style="border-top: 1px solid #cfe8fc; background-color: #fff; border-radius: 0 0 12px 12px; overflow: hidden;">
|
|
<a href="#" class="card-footer-item js-open-modal" data-target-url="{{ page.url | relative_url }}" data-modal-title="Detalhes: {{ page.file }}" data-full-btn-text="Ir para Página" data-full-btn-link="{{ page.url | relative_url }}" style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee;">Ver</a>
|
|
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: page.file %}
|
|
{% assign embed_url = creation_url | append: '&embed=true' %}
|
|
<a href="#" class="card-footer-item js-open-modal" data-target-url="{{ embed_url }}" data-modal-title="Editor: {{ page.file }}" data-full-btn-text="Abrir Editor" data-full-btn-link="{{ creation_url }}" style="color: #3273dc; font-size: 0.8rem; font-weight: 600;">Editar</a>
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% 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.</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>
|
|
|
|
{% include preview-modal.html %}
|
|
|
|
<style>
|
|
/* UI Geral */
|
|
.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; }
|
|
|
|
.filter-content::-webkit-scrollbar { width: 6px; }
|
|
.filter-content::-webkit-scrollbar-track { background: #f1f1f1; }
|
|
.filter-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
|
|
|
|
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; }
|
|
|
|
.category-reveal summary { list-style: none; transition: all 0.2s ease; }
|
|
.category-reveal summary::-webkit-details-marker { display: none; }
|
|
|
|
.summary-btn { width: 100%; justify-content: space-between; cursor: pointer; border: 1px solid #deeaf6; color: #5b7da3; padding: 2px 8px; min-height: 22px; margin-bottom: 2px; display: flex !important; }
|
|
.tag-label { display: flex; align-items: center; gap: 6px; }
|
|
.tag-text { font-weight: 700; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; }
|
|
.chevron { font-size: 0.6rem; opacity: 0.7; transition: transform 0.2s ease; }
|
|
|
|
.category-reveal summary:hover { background-color: #f8fbff; border-color: #3273dc; }
|
|
.category-reveal[open] summary { background-color: #eef6fc !important; border-color: #3273dc !important; color: #3273dc !important; }
|
|
.category-reveal[open] summary .chevron { transform: rotate(180deg); }
|
|
|
|
.clickable-tag { font-size: 0.6rem; height: 1.5em; border: 1px solid #cfe8fc; text-decoration: none; padding: 0 6px; transition: all 0.2s ease; }
|
|
.clickable-tag:hover { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; transform: translateY(-1px); }
|
|
|
|
/* TAG HIGHLIGHT (Amarelo) */
|
|
.clickable-tag.is-matched-tag {
|
|
background-color: #ffdd57 !important;
|
|
color: #363636 !important;
|
|
border-color: #ffcc00 !important;
|
|
box-shadow: 0 0 5px rgba(255, 200, 0, 0.5);
|
|
font-weight: 700;
|
|
transform: scale(1.05);
|
|
}
|
|
|
|
/* PATTERN HIGHLIGHT (Amarelo para o Grid) */
|
|
.pattern-mini-grid.is-highlighted {
|
|
border-color: #ffcc00 !important;
|
|
background-color: #fffdf5;
|
|
box-shadow: 0 0 0 1px #ffcc00;
|
|
transform: scale(1.15);
|
|
z-index: 5;
|
|
}
|
|
|
|
.border-tag { border: 1px solid #dbdbdb; color: #555; }
|
|
|
|
/* Botões de Limpar Grupo */
|
|
.filter-header-actions {
|
|
display: flex; justify-content: flex-end; margin-bottom: 4px; border-bottom: 1px solid #f0f0f0;
|
|
}
|
|
.filter-header-actions .button:hover { background: none; color: #f14668; text-decoration: underline; }
|
|
|
|
/* Dual Slider */
|
|
.range-slider-container { position: relative; width: 100%; height: 20px; }
|
|
.slider-track { width: 100%; height: 5px; background-color: #ddd; position: absolute; top: 50%; transform: translateY(-50%); border-radius: 5px; }
|
|
input[type="range"] {
|
|
-webkit-appearance: none; pointer-events: none; position: absolute; left: 0; top: 0; width: 100%; height: 20px; background: none; z-index: 2; margin: 0;
|
|
}
|
|
input[type="range"]::-webkit-slider-thumb {
|
|
-webkit-appearance: none; pointer-events: all; width: 16px; height: 16px; background-color: #3273dc; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); margin-top: 0px;
|
|
}
|
|
input[type="range"]::-moz-range-thumb {
|
|
pointer-events: all; width: 16px; height: 16px; background-color: #3273dc; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
}
|
|
/* Estilo Steps */
|
|
.search-step.is-active {
|
|
background-color: #3273dc !important;
|
|
border-color: #205081 !important;
|
|
}
|
|
/* Steps nos cards dos projetos */
|
|
.pattern-mini-grid {
|
|
display: inline-flex;
|
|
gap: 1px;
|
|
padding: 1px;
|
|
border: 1px solid #deeaf6;
|
|
border-radius: 2px;
|
|
background-color: #fff;
|
|
margin-right: 2px;
|
|
vertical-align: middle;
|
|
transition: all 0.2s ease;
|
|
}
|
|
.mini-step {
|
|
width: 3px;
|
|
height: 6px;
|
|
border-radius: 1px;
|
|
}
|
|
.mini-step.active { background-color: #3273dc; }
|
|
.mini-step.inactive { background-color: #eee; }
|
|
|
|
/* Ajuste para o container dos patterns dentro do card */
|
|
.pattern-row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
font-size: 0.6rem;
|
|
color: #555;
|
|
padding: 2px 4px;
|
|
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>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// --- 1. ELEMENTOS DOM E VARIÁVEIS GLOBAIS ---
|
|
const checkboxes = document.querySelectorAll('.filter-checkbox');
|
|
const searchInput = document.getElementById('search-input');
|
|
const clearInputBtn = document.querySelector('.js-clear-input');
|
|
|
|
// Slider BPM
|
|
const sliderMin = document.getElementById('range-min');
|
|
const sliderMax = document.getElementById('range-max');
|
|
const inputMin = document.getElementById('bpm-min');
|
|
const inputMax = document.getElementById('bpm-max');
|
|
const sliderTrack = document.getElementById('slider-track');
|
|
|
|
// Pattern Search
|
|
const searchSteps = document.querySelectorAll('.search-step');
|
|
let activePatternChunks = [];
|
|
|
|
// Controles Gerais
|
|
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');
|
|
|
|
// Filtros IA / Técnicos
|
|
const sidebarGenreContainer = document.getElementById('sidebar-genres');
|
|
const starFilterSelect = document.getElementById('star-filter');
|
|
const sortSelect = document.getElementById('sort-select');
|
|
const projectsContainer = document.getElementById('project-list');
|
|
|
|
// Botões de Limpar Grupo
|
|
const clearGroupBtns = document.querySelectorAll('.js-clear-group');
|
|
|
|
// Estado Global
|
|
let activeSidebar = { instruments: [], plugins: [], samples: [], bassline: [], automation: [], keys: [], genres: [] };
|
|
let currentMinStars = 'all';
|
|
let searchText = "";
|
|
|
|
// Definição Inicial BPM (Do HTML)
|
|
let defMin = parseInt(inputMin.value), defMax = parseInt(inputMax.value);
|
|
|
|
|
|
// --- 2. FUNÇÕES DE FILTRAGEM (DEFINIDAS PRIMEIRO) ---
|
|
|
|
// Função Principal de Aplicação de Filtros
|
|
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; }
|
|
|
|
const allActiveTags = new Set([
|
|
...activeSidebar.instruments,
|
|
...activeSidebar.plugins,
|
|
...activeSidebar.samples,
|
|
...activeSidebar.bassline,
|
|
...activeSidebar.automation,
|
|
...activeSidebar.genres,
|
|
...activeSidebar.keys
|
|
].map(s => s.toLowerCase()));
|
|
|
|
const hasActiveTypeFilter = allActiveTags.size > 0 || (searchText.length > 2);
|
|
|
|
document.querySelectorAll('.project-item').forEach(item => {
|
|
const pName = item.getAttribute('data-name') || "";
|
|
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(',');
|
|
|
|
// PATTERN SEARCH
|
|
const pPatternsStr = item.getAttribute('data-patterns') || "";
|
|
const pPatterns = pPatternsStr.split(',');
|
|
|
|
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);
|
|
|
|
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));
|
|
const matchBassline = activeSidebar.bassline.length === 0 || activeSidebar.bassline.some(f => pBassline.includes(f));
|
|
const matchAuto = activeSidebar.automation.length === 0 || activeSidebar.automation.some(f => pAutomation.includes(f));
|
|
|
|
const matchKeys = activeSidebar.keys.length === 0 || activeSidebar.keys.includes(pKey);
|
|
const matchGenres = activeSidebar.genres.length === 0 || activeSidebar.genres.some(g => pTagsIA.includes(g.toLowerCase()));
|
|
|
|
const matchBpm = (pBpm >= minBpm && pBpm <= maxBpm);
|
|
const matchStars = (currentMinStars === 'all' || pStars === parseInt(currentMinStars));
|
|
|
|
const fullMeta = [pName, pBpm, pInsts, pPlugins, pTagsIA].join(' ').toLowerCase();
|
|
const matchText = searchText === "" || fullMeta.includes(searchText);
|
|
|
|
const matchPattern = activePatternChunks.length === 0 || activePatternChunks.every(chunk => pPatterns.includes(chunk));
|
|
|
|
if (matchInst && matchPlugin && matchSample && matchBassline && matchAuto && matchBpm && matchText && matchGenres && matchKeys && matchStars && matchPattern) {
|
|
item.style.display = 'block';
|
|
visibleCount++;
|
|
|
|
// 1. Reset Highlight States
|
|
const clickableTags = item.querySelectorAll('.clickable-tag');
|
|
clickableTags.forEach(t => t.classList.remove('is-matched-tag'));
|
|
|
|
const patternGrids = item.querySelectorAll('.pattern-mini-grid');
|
|
patternGrids.forEach(g => g.classList.remove('is-highlighted'));
|
|
|
|
// 2. Logic: Open correct details and Highlight Tags/Patterns
|
|
if(hasActiveTypeFilter || activePatternChunks.length > 0) {
|
|
item.querySelectorAll('details').forEach(d => d.open = false);
|
|
|
|
// Highlight Text Tags (Instruments, Plugins, etc)
|
|
clickableTags.forEach(tagEl => {
|
|
const tagVal = (tagEl.dataset.tagValue || "").trim().toLowerCase();
|
|
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;
|
|
}
|
|
});
|
|
|
|
// Highlight Patterns
|
|
if (activePatternChunks.length > 0) {
|
|
let hasPatternMatch = false;
|
|
patternGrids.forEach(grid => {
|
|
const title = grid.getAttribute('title') || "";
|
|
const patVal = title.replace("Pattern: ", "").trim();
|
|
if (activePatternChunks.includes(patVal)) {
|
|
grid.classList.add('is-highlighted');
|
|
hasPatternMatch = true;
|
|
}
|
|
});
|
|
if (hasPatternMatch) {
|
|
if(patternGrids.length > 0) {
|
|
const parentDet = patternGrids[0].closest('details');
|
|
if(parentDet) parentDet.open = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
} else {
|
|
// Default view: Close all details
|
|
item.querySelectorAll('details').forEach(d => d.open = false);
|
|
}
|
|
|
|
} else {
|
|
item.style.display = 'none';
|
|
}
|
|
});
|
|
|
|
countSpan.textContent = visibleCount;
|
|
countBar.classList.toggle('is-hidden', visibleCount >= document.querySelectorAll('.project-item').length);
|
|
noResults.classList.toggle('is-hidden', visibleCount > 0);
|
|
}
|
|
|
|
// Função de atualização do Sidebar
|
|
function updateActiveSidebar() {
|
|
activeSidebar = { instruments: [], plugins: [], samples: [], bassline: [], automation: [], keys: [], genres: [] };
|
|
document.querySelectorAll('.filter-checkbox').forEach(bx => {
|
|
if(bx.checked) {
|
|
activeSidebar[bx.dataset.category].push(bx.value);
|
|
if(bx.parentElement.classList.contains('tag')) bx.parentElement.classList.add('is-checked');
|
|
} else {
|
|
if(bx.parentElement.classList.contains('tag')) bx.parentElement.classList.remove('is-checked');
|
|
}
|
|
});
|
|
applyGlobalFilters();
|
|
}
|
|
|
|
|
|
// --- 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);
|
|
let val2 = parseInt(sliderMax.value);
|
|
if (val1 > val2) { let temp = val1; val1 = val2; val2 = temp; }
|
|
inputMin.value = val1; inputMax.value = val2;
|
|
fillSlider(val1, val2);
|
|
applyGlobalFilters();
|
|
}
|
|
function fillSlider(from, to) {
|
|
const rangeDistance = parseInt(sliderMax.max) - parseInt(sliderMax.min);
|
|
const fromPosition = ((from - parseInt(sliderMin.min)) / rangeDistance) * 100;
|
|
const toPosition = ((to - parseInt(sliderMax.min)) / rangeDistance) * 100;
|
|
sliderTrack.style.background = `linear-gradient(to right, #ddd ${fromPosition}%, #3273dc ${fromPosition}%, #3273dc ${toPosition}%, #ddd ${toPosition}%)`;
|
|
}
|
|
sliderMin.addEventListener('input', updateSlider);
|
|
sliderMax.addEventListener('input', updateSlider);
|
|
inputMin.addEventListener('change', function() {
|
|
let val = parseInt(this.value); if(val > parseInt(inputMax.value)) val = parseInt(inputMax.value);
|
|
sliderMin.value = val; updateSlider();
|
|
});
|
|
inputMax.addEventListener('change', function() {
|
|
let val = parseInt(this.value); if(val < parseInt(inputMin.value)) val = parseInt(inputMin.value);
|
|
sliderMax.value = val; updateSlider();
|
|
});
|
|
fillSlider(defMin, defMax);
|
|
|
|
// Pattern Search Logic
|
|
searchSteps.forEach(step => {
|
|
step.addEventListener('click', function() {
|
|
this.classList.toggle('is-active');
|
|
updatePatternChunks();
|
|
applyGlobalFilters();
|
|
});
|
|
});
|
|
|
|
function updatePatternChunks() {
|
|
let fullPattern = "";
|
|
searchSteps.forEach(step => {
|
|
fullPattern += step.classList.contains('is-active') ? "1" : "0";
|
|
});
|
|
const rawChunks = fullPattern.match(/.{1,4}/g) || [];
|
|
activePatternChunks = rawChunks.filter(c => c !== "0000");
|
|
}
|
|
|
|
// Checkboxes Init
|
|
checkboxes.forEach(cb => cb.addEventListener('change', updateActiveSidebar));
|
|
|
|
// Inputs de Busca
|
|
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(); });
|
|
|
|
if(sortSelect) sortSelect.addEventListener('change', (e) => {
|
|
const crit = e.target.value;
|
|
const cols = Array.from(projectsContainer.children);
|
|
cols.sort((a, b) => {
|
|
const getVal = (el, k) => parseFloat(el.getAttribute(k) || 0);
|
|
if(crit === 'stars_desc') return getVal(b, 'data-stars') - getVal(a, 'data-stars');
|
|
if(crit === 'stars_asc') return getVal(a, 'data-stars') - getVal(b, 'data-stars');
|
|
if(crit === 'bpm_desc') return getVal(b, 'data-bpm-real') - getVal(a, 'data-bpm-real');
|
|
if(crit === 'intensity_desc') return getVal(b, 'data-intensity') - getVal(a, 'data-intensity');
|
|
if(crit === 'intensity_asc') return getVal(a, 'data-intensity') - getVal(b, 'data-intensity');
|
|
return a.getAttribute('data-title').localeCompare(b.getAttribute('data-title'));
|
|
});
|
|
cols.forEach(c => projectsContainer.appendChild(c));
|
|
});
|
|
|
|
// Botões Limpar Grupo
|
|
clearGroupBtns.forEach(btn => {
|
|
btn.addEventListener('click', (e) => {
|
|
e.preventDefault(); e.stopPropagation();
|
|
const target = btn.dataset.target;
|
|
if(target === 'bpm') {
|
|
sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
|
|
} else if (target === 'pattern') {
|
|
searchSteps.forEach(s => s.classList.remove('is-active'));
|
|
updatePatternChunks();
|
|
applyGlobalFilters();
|
|
} else {
|
|
document.querySelectorAll(`.filter-checkbox[data-category="${target}"]`).forEach(cb => {
|
|
cb.checked = false;
|
|
if(cb.parentElement.classList.contains('tag')) cb.parentElement.classList.remove('is-checked');
|
|
});
|
|
updateActiveSidebar();
|
|
}
|
|
});
|
|
});
|
|
|
|
resetBtn.addEventListener('click', () => {
|
|
document.querySelectorAll('.filter-checkbox').forEach(cb => { cb.checked = false; cb.parentElement.classList.remove('is-checked'); });
|
|
searchInput.value = ""; searchText = "";
|
|
searchSteps.forEach(s => s.classList.remove('is-active'));
|
|
updatePatternChunks();
|
|
sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
|
|
starFilterSelect.value = 'all'; currentMinStars = 'all'; sortSelect.value = 'default';
|
|
updateActiveSidebar();
|
|
});
|
|
|
|
|
|
// --- 4. ENRIQUECIMENTO DOS CARDS COM JSON (FETCH) ---
|
|
const JSON_URL = '/mmpSearch/src_mmpSearch/saida_analises/db_final_completo.json';
|
|
|
|
fetch(JSON_URL)
|
|
.then(r => r.ok ? r.json() : [])
|
|
.then(data => {
|
|
enrichCards(data);
|
|
createGenreCheckboxes(data);
|
|
|
|
// Recalcula limites de BPM com base no JSON
|
|
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;
|
|
}
|
|
}
|
|
// Aplica filtros pela primeira vez APÓS carregar dados
|
|
applyGlobalFilters();
|
|
})
|
|
.catch(console.warn);
|
|
|
|
function normalizarChaveJS(str) {
|
|
if (!str) return "";
|
|
return str.toString().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
|
|
}
|
|
|
|
function renderizarDificuldade(num) {
|
|
const n = Math.round(num) || 1;
|
|
let label = "Básico", icon = "fa-leaf", color = "is-success";
|
|
if (n >= 4.5) { label = "Expert"; icon = "fa-fire"; color = "is-danger"; }
|
|
else if (n >= 3.5) { label = "Avançado"; icon = "fa-bolt"; color = "is-warning"; }
|
|
else if (n >= 2.5) { label = "Médio"; icon = "fa-layer-group"; color = "is-info"; }
|
|
return `<span class="tag ${color} is-light is-rounded" title="Complexidade: ${n}/5" style="border: 1px solid rgba(0,0,0,0.1);"><i class="fa-solid ${icon} mr-1"></i> ${label}</span>`;
|
|
}
|
|
|
|
function enrichCards(data) {
|
|
const mapDados = {};
|
|
data.forEach(item => {
|
|
if(item.arquivo) mapDados[normalizarChaveJS(item.arquivo.replace('.wav','').replace('.mp3',''))] = item;
|
|
if(item.dados_projeto?.titulo) mapDados[normalizarChaveJS(item.dados_projeto.titulo)] = item;
|
|
});
|
|
|
|
document.querySelectorAll('.project-item').forEach(item => {
|
|
const card = item.querySelector('.project-card');
|
|
const titleKey = normalizarChaveJS(item.getAttribute('data-title'));
|
|
const info = mapDados[titleKey];
|
|
|
|
let genero = "Unknown", subgeneros = [], estrelas = 0, intensidade = -100, bpm = 0, tomHtml = "", tomRaw = "all", subTagsHTML = "";
|
|
|
|
if (info) {
|
|
if (info.analise_ia) {
|
|
genero = info.analise_ia.genero_macro || "Unknown";
|
|
if (Array.isArray(info.analise_ia.nuvem_tags)) {
|
|
info.analise_ia.nuvem_tags.forEach(t => { if(t.tag) subgeneros.push(t.tag); });
|
|
info.analise_ia.nuvem_tags.slice(0, 2).forEach(t => {
|
|
subTagsHTML += `<span class="tag is-white is-rounded border-tag" title="IA: ${Math.round(t.score*100)}%" style="font-size: 0.65rem; color: #666; margin-right: 2px;">#${t.tag}</span>`;
|
|
});
|
|
}
|
|
}
|
|
if (info.analise_tecnica) {
|
|
intensidade = parseFloat(info.analise_tecnica.intensidade_db || -100);
|
|
bpm = parseFloat(info.analise_tecnica.bpm || 0);
|
|
estrelas = Math.round(info.analise_tecnica.complexidade?.estrelas || 0);
|
|
if (info.analise_tecnica.tom) {
|
|
const t = info.analise_tecnica.tom;
|
|
const e = info.analise_tecnica.escala === 'minor' ? 'm' : '';
|
|
tomRaw = t + e;
|
|
tomHtml = `<span class="tag is-white is-rounded border-tag" title="Tom">🎹 ${tomRaw}</span>`;
|
|
}
|
|
}
|
|
}
|
|
|
|
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);
|
|
if(item.getAttribute('data-bpm') == "0") item.setAttribute('data-bpm', Math.round(bpm));
|
|
}
|
|
|
|
const bpmContainer = card.querySelector('.bpm-container');
|
|
if(bpmContainer) {
|
|
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") {
|
|
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;">`;
|
|
if(genero !== "Unknown") {
|
|
let c = 'is-primary';
|
|
if(genero === 'Electronic') c = 'is-info';
|
|
if(genero === 'Hip Hop') c = 'is-warning';
|
|
if(genero === 'Rock') c = 'is-danger';
|
|
newHtml += `<span class="tag ${c} is-light is-rounded" style="font-size: 0.7rem;">🤖 ${genero}</span>`;
|
|
}
|
|
newHtml += tomHtml;
|
|
newHtml += `</div>`;
|
|
if(subTagsHTML) newHtml += `<div style="display:flex; flex-wrap:wrap; justify-content:center; gap:2px;">${subTagsHTML}</div>`;
|
|
newHtml += `</div>`;
|
|
|
|
bpmContainer.innerHTML = bpmDisplay + newHtml;
|
|
}
|
|
});
|
|
}
|
|
|
|
function createGenreCheckboxes(data) {
|
|
const genres = new Set();
|
|
data.forEach(i => {
|
|
if(i.analise_ia?.genero_macro && i.analise_ia.genero_macro !== "Unknown") genres.add(i.analise_ia.genero_macro);
|
|
if(Array.isArray(i.analise_ia?.nuvem_tags)) i.analise_ia.nuvem_tags.forEach(t => genres.add(t.tag));
|
|
});
|
|
|
|
sidebarGenreContainer.innerHTML = "";
|
|
Array.from(genres).sort().forEach(g => {
|
|
const label = document.createElement('label');
|
|
label.className = "checkbox is-block mb-1 is-size-7";
|
|
label.innerHTML = `<input type="checkbox" class="filter-checkbox" data-category="genres" value="${g}"> ${g}`;
|
|
sidebarGenreContainer.appendChild(label);
|
|
});
|
|
|
|
document.querySelectorAll('#sidebar-genres .filter-checkbox').forEach(cb => {
|
|
cb.addEventListener('change', updateActiveSidebar);
|
|
});
|
|
}
|
|
|
|
// Modal
|
|
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) {
|
|
if(!modal) return; 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() {
|
|
if(!modal) return; 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); });
|
|
});
|
|
if(iframe) { 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> |