Upgrade interface do MMPSearch
Deploy / Deploy (push) Successful in 1m16s Details

This commit is contained in:
JotaChina 2025-11-30 18:24:05 -03:00
parent 5c851aae88
commit d3f8cd1184
5 changed files with 976 additions and 430 deletions

View File

@ -1,130 +1,306 @@
--- ---
layout: default layout: default
title: Projetos com a tag Automation title: Projetos por Automação
permalink: /automation/ permalink: /automation/
--- ---
<meta charset="utf-8" /> <meta charset="utf-8" />
<main class="main-content"> <main class="main-content">
<div class="publication">{% include sidebar.html %}</div> <div class="publication">
<div class="container"> <div class="container">
<div class="columns is-mobile is-vcentered" style="margin-bottom: 2rem"> <br />
<!-- Título -->
<div class="column is-auto"> <div class="tabs is-centered is-boxed is-medium mb-6">
<h2 class="title is-4"> {% include sidebar.html %}
<code>Projetos que possuem a tag automation:</code>
</h2>
</div> </div>
<!-- Botão Limpar Filtro -->
<div class="column is-auto">
<button id="clearFilterButton" class="button is-small is-light">
Limpar filtro
</button>
</div>
</div>
<!-- Projetos --> <details class="box mb-5 p-0 collapse-card" open
<div id="project-list" class="columns is-multiline"> style="border: 1px solid #cfe8fc; overflow: hidden; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); height: fit-content !important; min-height: unset;">
{% for projeto in site.data.all %} {% if projeto.tags.TAG contains
"automation" %}
<div
class="column is-6 project-item"
data-automation="{{ projeto.tags.automation | join: ',' }}"
>
<div class="box">
<!-- Botão do projeto -->
{% assign file_url = projeto.file | downcase | replace: ' ', '-' |
replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace:
'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' |
replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace:
'ú', 'u' %}
<a <summary class="p-4 is-flex is-justify-content-space-between is-align-items-center"
href="../mmp_pages/{{ file_url }}.html" style="cursor: pointer; background-color: #f0f8ff; transition: background-color 0.2s; user-select: none;">
class="button is-link is-fullwidth" <div class="is-flex is-align-items-center">
> <span class="icon has-text-info mr-2"><i class="fa-solid fa-guitar"></i></span>
{{ projeto.file }} <span class="has-text-grey-dark has-text-weight-bold">Todos as pistas de Automação Disponíveis</span>
</a> <span id="filter-counter" class="tag is-info is-light ml-3 is-hidden">0 selecionados</span>
</div>
<span class="icon has-text-grey-light chevron-icon"><i class="fa-solid fa-chevron-down"></i></span>
</summary>
<!-- Lista de automations clicáveis --> <div class="p-4" style="background-color: #fff; border-top: 1px solid #cfe8fc;">
{% if projeto.tags.automation and projeto.tags.automation.size > 0 %} <div class="tags is-centered are-medium mb-0">
<div style="margin-top: 1rem"> {% assign all_automation_string = "" %}
<p><strong>Automation:</strong></p>
<ul style="list-style-type: disc; padding-left: 1.25rem"> {% for p in site.data.all %}
{% for automation in projeto.tags.automation %} {% if automation {% for track in p.tracks %}
!= "" %} {% if track.automation %}
<li> {% for inst in track.automation %}
<a {% if inst.instrument_name and inst.instrument_name != "" %}
href="#" {% unless all_automation_string contains inst.instrument_name %}
class="automation-item" {% assign all_automation_string = all_automation_string | append: inst.instrument_name | append: "|||" %}
data-automation="{{ automation }}" {% endunless %}
>{{ automation }}</a {% endif %}
> {% endfor %}
</li> {% elsif track.instrument_name and track.instrument_name != "" %}
{% endif %} {% endfor %} {% unless all_automation_string contains track.instrument_name %}
</ul> {% assign all_automation_string = all_automation_string | append: track.instrument_name | append: "|||" %}
{% endunless %}
{% endif %}
{% endfor %}
{% endfor %}
{% assign unique_automation = all_automation_string | split: "|||" | sort %}
{% for item in unique_automation %}
{% if item != "" %}
<a href="#" class="tag is-white filter-item clickable-tag"
data-value="{{ item }}"
style="border: 1px solid #deeaf6; color: #5b7da3; margin-bottom: 0.5rem; transition: all 0.2s;">
{{ item }}
</a>
{% endif %}
{% endfor %}
</div>
<div class="has-text-centered mt-3">
<p class="help has-text-grey">Clique para filtrar.</p>
</div>
</div> </div>
{% endif %} </details>
<div class="columns is-mobile is-vcentered mb-5">
<div class="column is-auto">
<h2 class="title is-4 has-text-grey-dark">
<span class="icon has-text-info mr-2"><i class="fa-solid fa-filter"></i></span>
Filtro: <code id="filter-display-name" style="color: #d63384;">(todos)</code>
</h2>
</div>
<div class="column is-narrow">
<button id="clearFilterButton" class="button is-small is-danger is-light">
<span class="icon is-small"><i class="fa-solid fa-xmark"></i></span>
<span>Limpar Tudo</span>
</button>
</div> </div>
</div> </div>
{% endif %} {% endfor %}
<div id="project-list" class="columns is-multiline">
{% for projeto in site.data.all %}
{% assign project_insts = "" %}
{% for track in projeto.tracks %}
{% if track.automation %}
{% for inst in track.automation %}
{% assign project_insts = project_insts | append: inst.instrument_name | append: "," %}
{% endfor %}
{% elsif track.instrument_name %}
{% assign project_insts = project_insts | append: track.instrument_name | append: "," %}
{% endif %}
{% endfor %}
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen project-item"
data-automation="{{ project_insts }}">
<div class="card project-card" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column;">
{% assign file_url = projeto.file | downcase | replace: ' ', '-' | replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace: 'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace: 'ú', 'u' %}
{% assign page_url = '../mmp_pages/' | append: file_url | append: '.html' %}
<a href="{{ page_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;">
{{ projeto.file }}
</p>
{% if projeto.bpm %}
<div class="mb-3">
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
🎵 {{ projeto.bpm }} BPM
</span>
</div>
{% else %}
<div class="mb-3" style="height: 24px;"></div>
{% endif %}
<div style="flex: 1;"></div>
{% assign unique_proj_insts = project_insts | split: "," | uniq %}
{% if unique_proj_insts.size > 0 %}
<div class="tags is-centered is-gapless mb-0 mt-2" style="gap: 4px; justify-content: center;">
{% for item in unique_proj_insts %}
{% if item != "" %}
<span class="tag is-white filter-item clickable-tag" data-value="{{ item }}"
style="font-size: 0.65rem; border: 1px solid #deeaf6; color: #5b7da3; padding: 0 6px; height: 1.5em; text-decoration: none; cursor: pointer;">
{{ item | truncate: 15 }}
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</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 }}" data-modal-title="Detalhes: {{ projeto.file }}" data-full-btn-text="Ir para Página" data-full-btn-link="{{ page_url }}" style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee; transition: background 0.2s;">Ver</a>
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: projeto.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: {{ projeto.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>
{% endfor %}
</div>
</div> </div>
</div> </div>
</main> </main>
<script> <div id="preview-modal" class="modal">
document.addEventListener("DOMContentLoaded", function () { <div class="modal-background"></div>
const projects = document.querySelectorAll(".project-item"); <div class="modal-card" style="width: 90%; max-width: 800px;">
<header class="modal-card-head" style="background-color: #f0f8ff; border-bottom: 1px solid #cfe8fc;">
<p class="modal-card-title" id="modal-title" style="color: #205081; font-weight: bold;">Preview</p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body p-0" style="height: 500px; background-color: #fff;">
<iframe id="preview-iframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
</section>
<footer class="modal-card-foot" style="justify-content: flex-end; background-color: #fff; border-top: 1px solid #cfe8fc;">
<button class="button" id="close-modal-btn">Fechar</button>
<a href="#" id="full-edit-btn" target="_blank" class="button is-info">Abrir</a>
</footer>
</div>
</div>
// Função para aplicar filtro por automation <style>
function filterByAutomation(automationName) { .project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; background-color: #fff !important; }
projects.forEach((project) => { .clickable-tag:hover { background-color: #e3effd !important; color: #3273dc !important; border-color: #3273dc !important; transform: scale(1.05); }
const projectAutomations = project .tag.is-active-filter { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; font-weight: bold; box-shadow: 0 2px 5px rgba(50, 115, 220, 0.3); }
.getAttribute("data-automation") .collapse-card summary { list-style: none; transition: background 0.2s; }
.split(","); .collapse-card summary::-webkit-details-marker { display: none; }
if (projectAutomations.includes(automationName)) { .collapse-card[open] summary .chevron-icon { transform: rotate(180deg); }
project.style.display = "block"; .chevron-icon { transition: transform 0.3s ease; }
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
const projects = document.querySelectorAll('.project-item');
const filterDisplayName = document.getElementById('filter-display-name');
const filterCounter = document.getElementById('filter-counter');
let activeFilters = [];
function applyFilters() {
if (activeFilters.length > 0) {
filterDisplayName.textContent = activeFilters.join(" + ");
filterCounter.textContent = activeFilters.length + " selecionados";
filterCounter.classList.remove('is-hidden');
} else {
filterDisplayName.textContent = "(todos)";
filterCounter.classList.add('is-hidden');
}
// Atualiza visual das tags
document.querySelectorAll('.filter-item').forEach(tag => {
const val = tag.getAttribute('data-value');
if (activeFilters.includes(val)) {
tag.classList.add('is-active-filter');
} else {
tag.classList.remove('is-active-filter');
}
});
projects.forEach(project => {
const projectInstStr = project.getAttribute('data-automation');
// Cria array de automações deste projeto
const projectInsts = projectInstStr.split(',').map(s => s.trim());
if (activeFilters.length === 0) {
project.style.display = 'block';
} else { } else {
project.style.display = "none"; // Lógica OR: Se tiver pelo menos uma das automações filtradas, exibe
const hasMatch = activeFilters.some(filter => projectInsts.includes(filter));
project.style.display = hasMatch ? 'block' : 'none';
} }
}); });
}
// Lê a automation da URL se houver
const urlParams = new URLSearchParams(window.location.search);
const automationFromUrl = urlParams.get("automation");
if (automationFromUrl) {
filterByAutomation(automationFromUrl);
}
// Ao clicar numa automation na lista
const automationItems = document.querySelectorAll(".automation-item");
automationItems.forEach((item) => {
item.addEventListener("click", function (event) {
event.preventDefault();
const selectedAutomation = item.getAttribute("data-automation");
filterByAutomation(selectedAutomation);
// Atualiza a URL sem recarregar a página
const newUrl = new URL(window.location.href);
newUrl.searchParams.set("automation", selectedAutomation);
window.history.replaceState({}, "", newUrl);
});
});
// Botão para limpar filtro
const clearFilterButton = document.querySelector("#clearFilterButton");
clearFilterButton.addEventListener("click", function () {
projects.forEach((project) => {
project.style.display = "block";
});
// Remove o filtro da URL
const newUrl = new URL(window.location.href); const newUrl = new URL(window.location.href);
newUrl.searchParams.delete("automation"); if (activeFilters.length > 0) {
window.history.replaceState({}, "", newUrl); newUrl.searchParams.set('automation', activeFilters.join(','));
} else {
newUrl.searchParams.delete('automation');
}
window.history.replaceState({}, '', newUrl);
}
function toggleFilter(val) {
const index = activeFilters.indexOf(val);
if (index > -1) activeFilters.splice(index, 1);
else activeFilters.push(val);
applyFilters();
}
// Inicializa
const urlParams = new URLSearchParams(window.location.search);
const instParam = urlParams.get('automation');
if (instParam) {
activeFilters = instParam.split(',').map(s => s.trim()).filter(s => s !== "");
applyFilters();
}
// Eventos
document.querySelectorAll('.filter-item').forEach(tag => {
tag.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation(); // Evita clique no card se for dentro dele
const val = this.getAttribute('data-value');
toggleFilter(val);
});
}); });
document.querySelector('#clearFilterButton').addEventListener('click', function () {
activeFilters = [];
applyFilters();
});
// 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) {
modalTitle.textContent = title;
iframe.src = url;
fullEditBtn.textContent = btnText;
fullEditBtn.href = btnLink;
modal.classList.add('is-active');
document.documentElement.classList.add('is-clipped');
}
function closeModal() {
modal.classList.remove('is-active');
document.documentElement.classList.remove('is-clipped');
iframe.src = "";
}
document.querySelectorAll('.js-open-modal').forEach(btn => {
btn.addEventListener('click', (e) => {
e.preventDefault();
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
});
});
iframe.addEventListener('load', () => { try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const style = iframeDoc.createElement('style');
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
iframeDoc.head.appendChild(style);
} catch(e){} });
closeButtons.forEach(el => el.addEventListener('click', closeModal));
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
}); });
</script> </script>

View File

@ -1,138 +1,306 @@
--- ---
layout: default layout: default
title: Projetos com a tag Bassline title: Projetos por Basslines
permalink: /bassline/ permalink: /bassline/
--- ---
<meta charset="utf-8" /> <meta charset="utf-8" />
<main class="main-content"> <main class="main-content">
<div class="publication">{% include sidebar.html %}</div> <div class="publication">
<div class="container"> <div class="container">
<div class="columns is-mobile is-vcentered" style="margin-bottom: 2rem"> <br />
<!-- Título -->
<div class="column is-auto"> <div class="tabs is-centered is-boxed is-medium mb-6">
<h2 class="title is-4"> {% include sidebar.html %}
<code>Projetos que possuem a tag bassline:</code>
</h2>
</div> </div>
<!-- Botão Limpar Filtro -->
<div class="column is-auto">
<button id="clearFilterButton" class="button is-small is-light">
Limpar filtro
</button>
</div>
</div>
<!-- Projetos --> <details class="box mb-5 p-0 collapse-card" open
<div id="project-list" class="columns is-multiline"> style="border: 1px solid #cfe8fc; overflow: hidden; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); height: fit-content !important; min-height: unset;">
{% for projeto in site.data.all %} {% if projeto.tags.TAG contains
"bassline" %}
<div
class="column is-6 project-item"
data-bassline="{{ projeto.tags.bassline | join: ',' }}"
>
<div class="box">
<!-- Botão do projeto -->
{% assign file_url = projeto.file | downcase | replace: ' ', '-' |
replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace:
'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' |
replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace:
'ú', 'u' %}
<a <summary class="p-4 is-flex is-justify-content-space-between is-align-items-center"
href="../mmp_pages/{{ file_url }}.html" style="cursor: pointer; background-color: #f0f8ff; transition: background-color 0.2s; user-select: none;">
class="button is-link is-fullwidth" <div class="is-flex is-align-items-center">
> <span class="icon has-text-info mr-2"><i class="fa-solid fa-guitar"></i></span>
{{ projeto.file }} <span class="has-text-grey-dark has-text-weight-bold">Todos as Basslines Disponíveis</span>
</a> <span id="filter-counter" class="tag is-info is-light ml-3 is-hidden">0 selecionados</span>
</div>
<span class="icon has-text-grey-light chevron-icon"><i class="fa-solid fa-chevron-down"></i></span>
</summary>
<!-- Lista de Basslines clicáveis --> <div class="p-4" style="background-color: #fff; border-top: 1px solid #cfe8fc;">
{% if projeto.tags.bassline and projeto.tags.bassline.size > 0 %} <div class="tags is-centered are-medium mb-0">
<div style="margin-top: 1rem"> {% assign all_automation_string = "" %}
<p><strong>Bassline:</strong></p>
<ul style="list-style-type: disc; padding-left: 1.25rem"> {% for p in site.data.all %}
{% for bassline in projeto.tags.bassline %} {% if bassline != "" {% for track in p.tracks %}
%} {% if track.bassline %}
<li> {% for inst in track.bassline %}
<a href="#" class="bassline-item" data-bassline="{{ bassline }}" {% if inst.instrument_name and inst.instrument_name != "" %}
>{{ bassline }}</a {% unless all_automation_string contains inst.instrument_name %}
> {% assign all_automation_string = all_automation_string | append: inst.instrument_name | append: "|||" %}
</li> {% endunless %}
{% endif %} {% endfor %} {% endif %}
</ul> {% endfor %}
{% elsif track.instrument_name and track.instrument_name != "" %}
{% unless all_automation_string contains track.instrument_name %}
{% assign all_automation_string = all_automation_string | append: track.instrument_name | append: "|||" %}
{% endunless %}
{% endif %}
{% endfor %}
{% endfor %}
{% assign unique_automation = all_automation_string | split: "|||" | sort %}
{% for item in unique_automation %}
{% if item != "" %}
<a href="#" class="tag is-white filter-item clickable-tag"
data-value="{{ item }}"
style="border: 1px solid #deeaf6; color: #5b7da3; margin-bottom: 0.5rem; transition: all 0.2s;">
{{ item }}
</a>
{% endif %}
{% endfor %}
</div>
<div class="has-text-centered mt-3">
<p class="help has-text-grey">Clique para filtrar.</p>
</div>
</div> </div>
{% endif %} </details>
<div class="columns is-mobile is-vcentered mb-5">
<div class="column is-auto">
<h2 class="title is-4 has-text-grey-dark">
<span class="icon has-text-info mr-2"><i class="fa-solid fa-filter"></i></span>
Filtro: <code id="filter-display-name" style="color: #d63384;">(todos)</code>
</h2>
</div>
<div class="column is-narrow">
<button id="clearFilterButton" class="button is-small is-danger is-light">
<span class="icon is-small"><i class="fa-solid fa-xmark"></i></span>
<span>Limpar Tudo</span>
</button>
</div> </div>
</div> </div>
{% endif %} {% endfor %}
<div id="project-list" class="columns is-multiline">
{% for projeto in site.data.all %}
{% assign project_insts = "" %}
{% for track in projeto.tracks %}
{% if track.bassline %}
{% for inst in track.bassline %}
{% assign project_insts = project_insts | append: inst.instrument_name | append: "," %}
{% endfor %}
{% elsif track.instrument_name %}
{% assign project_insts = project_insts | append: track.instrument_name | append: "," %}
{% endif %}
{% endfor %}
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen project-item"
data-bassline="{{ project_insts }}">
<div class="card project-card" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column;">
{% assign file_url = projeto.file | downcase | replace: ' ', '-' | replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace: 'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace: 'ú', 'u' %}
{% assign page_url = '../mmp_pages/' | append: file_url | append: '.html' %}
<a href="{{ page_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;">
{{ projeto.file }}
</p>
{% if projeto.bpm %}
<div class="mb-3">
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
🎵 {{ projeto.bpm }} BPM
</span>
</div>
{% else %}
<div class="mb-3" style="height: 24px;"></div>
{% endif %}
<div style="flex: 1;"></div>
{% assign unique_proj_insts = project_insts | split: "," | uniq %}
{% if unique_proj_insts.size > 0 %}
<div class="tags is-centered is-gapless mb-0 mt-2" style="gap: 4px; justify-content: center;">
{% for item in unique_proj_insts %}
{% if item != "" %}
<span class="tag is-white filter-item clickable-tag" data-value="{{ item }}"
style="font-size: 0.65rem; border: 1px solid #deeaf6; color: #5b7da3; padding: 0 6px; height: 1.5em; text-decoration: none; cursor: pointer;">
{{ item | truncate: 15 }}
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</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 }}" data-modal-title="Detalhes: {{ projeto.file }}" data-full-btn-text="Ir para Página" data-full-btn-link="{{ page_url }}" style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee; transition: background 0.2s;">Ver</a>
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: projeto.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: {{ projeto.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>
{% endfor %}
</div>
</div> </div>
</div> </div>
</main> </main>
<script> <div id="preview-modal" class="modal">
document.addEventListener("DOMContentLoaded", function () { <div class="modal-background"></div>
const projects = document.querySelectorAll(".project-item"); <div class="modal-card" style="width: 90%; max-width: 800px;">
<header class="modal-card-head" style="background-color: #f0f8ff; border-bottom: 1px solid #cfe8fc;">
<p class="modal-card-title" id="modal-title" style="color: #205081; font-weight: bold;">Preview</p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body p-0" style="height: 500px; background-color: #fff;">
<iframe id="preview-iframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
</section>
<footer class="modal-card-foot" style="justify-content: flex-end; background-color: #fff; border-top: 1px solid #cfe8fc;">
<button class="button" id="close-modal-btn">Fechar</button>
<a href="#" id="full-edit-btn" target="_blank" class="button is-info">Abrir</a>
</footer>
</div>
</div>
// Função para aplicar filtro por bassline <style>
function filterByBassline(basslineName) { .project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; background-color: #fff !important; }
projects.forEach((project) => { .clickable-tag:hover { background-color: #e3effd !important; color: #3273dc !important; border-color: #3273dc !important; transform: scale(1.05); }
const projectBasslines = project .tag.is-active-filter { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; font-weight: bold; box-shadow: 0 2px 5px rgba(50, 115, 220, 0.3); }
.getAttribute("data-bassline") .collapse-card summary { list-style: none; transition: background 0.2s; }
.split(","); .collapse-card summary::-webkit-details-marker { display: none; }
if (projectBasslines.includes(basslineName)) { .collapse-card[open] summary .chevron-icon { transform: rotate(180deg); }
project.style.display = "block"; .chevron-icon { transition: transform 0.3s ease; }
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
const projects = document.querySelectorAll('.project-item');
const filterDisplayName = document.getElementById('filter-display-name');
const filterCounter = document.getElementById('filter-counter');
let activeFilters = [];
function applyFilters() {
if (activeFilters.length > 0) {
filterDisplayName.textContent = activeFilters.join(" + ");
filterCounter.textContent = activeFilters.length + " selecionados";
filterCounter.classList.remove('is-hidden');
} else {
filterDisplayName.textContent = "(todos)";
filterCounter.classList.add('is-hidden');
}
// Atualiza visual das tags
document.querySelectorAll('.filter-item').forEach(tag => {
const val = tag.getAttribute('data-value');
if (activeFilters.includes(val)) {
tag.classList.add('is-active-filter');
} else {
tag.classList.remove('is-active-filter');
}
});
projects.forEach(project => {
const projectInstStr = project.getAttribute('data-bassline');
// Cria array de automações deste projeto
const projectInsts = projectInstStr.split(',').map(s => s.trim());
if (activeFilters.length === 0) {
project.style.display = 'block';
} else { } else {
project.style.display = "none"; // Lógica OR: Se tiver pelo menos uma das automações filtradas, exibe
const hasMatch = activeFilters.some(filter => projectInsts.includes(filter));
project.style.display = hasMatch ? 'block' : 'none';
} }
}); });
const newUrl = new URL(window.location.href);
if (activeFilters.length > 0) {
newUrl.searchParams.set('bassline', activeFilters.join(','));
} else {
newUrl.searchParams.delete('bassline');
}
window.history.replaceState({}, '', newUrl);
} }
// Lê o parâmetro bassline da URL (se houver) function toggleFilter(val) {
const index = activeFilters.indexOf(val);
if (index > -1) activeFilters.splice(index, 1);
else activeFilters.push(val);
applyFilters();
}
// Inicializa
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
let basslineFromUrl = urlParams.get("bassline"); const instParam = urlParams.get('bassline');
if (instParam) {
// Substituir "+" por " " (espaços) activeFilters = instParam.split(',').map(s => s.trim()).filter(s => s !== "");
if (basslineFromUrl) { applyFilters();
basslineFromUrl = basslineFromUrl.replace(/\+/g, " ");
filterByBassline(basslineFromUrl);
} }
// Ao clicar numa bassline na lista // Eventos
const basslineItems = document.querySelectorAll(".bassline-item"); document.querySelectorAll('.filter-item').forEach(tag => {
if (basslineItems.length > 0) { tag.addEventListener('click', function(e) {
basslineItems.forEach((item) => { e.preventDefault();
item.addEventListener("click", function (event) { e.stopPropagation(); // Evita clique no card se for dentro dele
event.preventDefault(); const val = this.getAttribute('data-value');
const selectedBassline = item.getAttribute("data-bassline"); toggleFilter(val);
// Substitui espaços por "+"
const basslineForUrl = selectedBassline.replace(/ /g, "+");
filterByBassline(selectedBassline);
// Atualiza a URL sem recarregar a página
const newUrl = new URL(window.location.href);
newUrl.searchParams.set("bassline", basslineForUrl);
window.history.replaceState({}, "", newUrl);
}); });
}); });
}
// Botão para limpar filtro document.querySelector('#clearFilterButton').addEventListener('click', function () {
const clearFilterButton = document.querySelector("#clearFilterButton"); activeFilters = [];
if (clearFilterButton) { applyFilters();
clearFilterButton.addEventListener("click", function () { });
projects.forEach((project) => {
project.style.display = "block";
});
// Remove o parâmetro bassline da URL // Modal
const newUrl = new URL(window.location.href); const modal = document.getElementById('preview-modal');
newUrl.searchParams.delete("bassline"); const iframe = document.getElementById('preview-iframe');
window.history.replaceState({}, "", newUrl); const modalTitle = document.getElementById('modal-title');
}); const fullEditBtn = document.getElementById('full-edit-btn');
const closeButtons = document.querySelectorAll('.modal-background, .modal-card-head .delete, #close-modal-btn');
function openModal(url, title, btnText, btnLink) {
modalTitle.textContent = title;
iframe.src = url;
fullEditBtn.textContent = btnText;
fullEditBtn.href = btnLink;
modal.classList.add('is-active');
document.documentElement.classList.add('is-clipped');
} }
function closeModal() {
modal.classList.remove('is-active');
document.documentElement.classList.remove('is-clipped');
iframe.src = "";
}
document.querySelectorAll('.js-open-modal').forEach(btn => {
btn.addEventListener('click', (e) => {
e.preventDefault();
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
});
});
iframe.addEventListener('load', () => { try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const style = iframeDoc.createElement('style');
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
iframeDoc.head.appendChild(style);
} catch(e){} });
closeButtons.forEach(el => el.addEventListener('click', closeModal));
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
}); });
</script> </script>

155
pages/beats.md Normal file
View File

@ -0,0 +1,155 @@
---
layout: default
title: Beats Disponíveis
permalink: /beats/
---
<main class="main-content">
<div class="publication">
{% include sidebar.html %}
<div class="container">
<br />
<div class="tabs is-centered is-boxed is-medium mb-6">
<ul>
<li><a href="{{ '/mmp_pages/' | relative_url }}"><span class="icon is-small"><i class="fa-solid fa-folder-open"></i></span><span>Projetos Disponíveis</span></a></li>
<li><a href="{{ '/search/' | relative_url }}"><span class="icon is-small"><i class="fa-solid fa-magnifying-glass"></i></span><span>Buscas</span></a></li>
<li class="is-active"><a href="{{ '/beats/' | relative_url }}"><span class="icon is-small"><i class="fa-solid fa-headphones"></i></span><span>Beats</span></a></li>
<li><a href="{{ '/create/' | relative_url }}" class="has-text-primary"><span class="icon is-small"><i class="fa-solid fa-plus-circle"></i></span><span>Crie seu projeto</span></a></li>
</ul>
</div>
<div class="has-text-centered mb-6">
<h1 class="title is-3 has-text-grey-dark">🎧 Beats Disponíveis</h1>
<p class="subtitle is-6 has-text-grey">
Ouça e baixe beats criados pela comunidade.
</p>
<div style="width: 60px; height: 4px; background-color: #3273dc; margin: 1rem auto; border-radius: 2px;"></div>
</div>
<div class="columns is-multiline">
{% assign files = site.static_files %}
{% for file in files %}
{% if file.path contains '/wav/' %}
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen">
<div class="card beat-card"
style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column; transition: all 0.3s ease;">
<div class="card-content has-text-centered p-4" style="flex: 1; display: flex; flex-direction: column; justify-content: center;">
<div class="mb-3" style="width: 60px; height: 60px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; box-shadow: 0 4px 10px rgba(0,0,0,0.05);">
<span class="icon is-large has-text-info"><i class="fa-solid fa-compact-disc fa-2x fa-spin-hover"></i></span>
</div>
{% assign file_name_clean = file.name | remove: '.wav' %}
{% assign project_url = "" %}
{% for projeto in site.data.all %}
{% if projeto.file == file_name_clean %}
{% assign project_url = "/mmp_pages/"
| append: projeto.file | downcase
| replace: ' ', '-' | replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace: 'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace: 'ú', 'u'
| append: ".html" %}
{% endif %}
{% endfor %}
<h3 class="title is-6 mb-3" style="color: #205081; word-break: break-word;">
{% if project_url != "" %}
<a href="{{ project_url | relative_url }}" class="beat-link" title="Ir para o projeto">
{{ file_name_clean }} <i class="fa-solid fa-arrow-up-right-from-square" style="font-size: 0.7em; margin-left: 4px;"></i>
</a>
{% else %}
{{ file_name_clean }}
{% endif %}
</h3>
<div class="audio-wrapper" style="width: 100%;">
<audio class="audio-player" controls style="width: 100%; height: 32px; border-radius: 20px;">
<source src="{{ file.path | relative_url }}" type="audio/wav">
Seu navegador não suporta áudio.
</audio>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</main>
<style>
/* Estilo do Card */
.beat-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15);
border-color: #3273dc !important;
background-color: #fff !important;
}
/* Animação do Disco ao passar o mouse */
.beat-card:hover .fa-spin-hover {
animation: spin 2s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
/* Link do Título */
.beat-link {
color: #205081;
text-decoration: none;
border-bottom: 1px dotted transparent;
transition: all 0.2s;
}
.beat-link:hover {
color: #3273dc;
border-bottom-color: #3273dc;
}
/* Ajuste fino do player */
audio::-webkit-media-controls-panel {
background-color: #f1f3f5;
}
.beat-card:hover audio::-webkit-media-controls-panel {
background-color: #eef6fc;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Lógica para tocar apenas um áudio por vez
const audioPlayers = document.querySelectorAll('.audio-player');
audioPlayers.forEach(audio => {
audio.addEventListener('play', function() {
audioPlayers.forEach(otherAudio => {
if (otherAudio !== audio && !otherAudio.paused) {
otherAudio.pause();
otherAudio.currentTime = 0; // Opcional: reinicia o outro
}
});
// Adiciona um efeito visual ao card ativo
const card = audio.closest('.beat-card');
if(card) {
card.style.borderColor = '#4caf50';
card.style.backgroundColor = '#f0fff4';
}
});
audio.addEventListener('pause', function() {
const card = audio.closest('.beat-card');
if(card) {
card.style.borderColor = '#cfe8fc';
card.style.backgroundColor = '#f0f8ff';
}
});
});
});
</script>

View File

@ -1,127 +1,306 @@
--- ---
layout: default layout: default
title: Projetos com a tag Sample title: Projetos por Samples
permalink: /sample/ permalink: /sample/
--- ---
<meta charset="utf-8"> <meta charset="utf-8" />
<main class="main-content"> <main class="main-content">
<div class="publication"> <div class="publication">
<div class="tabs is-centered is-boxed is-medium mb-6">
{% include sidebar.html %}
</div>
<div class="container"> <div class="container">
<div class="columns is-mobile is-vcentered" style="margin-bottom: 2rem;"> <br />
<!-- Título -->
<div class="column is-auto"> <div class="tabs is-centered is-boxed is-medium mb-6">
<h2 class="title is-4"><code>Projetos que possuem a tag sample:</code></h2> {% include sidebar.html %}
</div> </div>
<!-- Botão Limpar Filtro -->
<div class="column is-auto">
<button id="clearFilterButton" class="button is-small is-light">
Limpar filtro
</button>
</div>
</div>
<!-- Projetos --> <details class="box mb-5 p-0 collapse-card" open
<div id="project-list" class="columns is-multiline"> style="border: 1px solid #cfe8fc; overflow: hidden; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); height: fit-content !important; min-height: unset;">
{% for projeto in site.data.all %}
{% if projeto.tags.TAG contains "sample" %}
<div class="column is-6 project-item" data-sample="{{ projeto.tags.sample | join: ',' }}">
<div class="box">
<!-- Botão do projeto -->
{% assign file_url = projeto.file | downcase
| replace: ' ', '-'
| replace: 'ç', 'c'
| replace: 'ã', 'a'
| replace: 'á', 'a'
| replace: 'â', 'a'
| replace: 'é', 'e'
| replace: 'ê', 'e'
| replace: 'í', 'i'
| replace: 'ó', 'o'
| replace: 'ô', 'o'
| replace: 'õ', 'o'
| replace: 'ú', 'u' %}
<a href="../mmp_pages/{{ file_url }}.html" class="button is-link is-fullwidth"> <summary class="p-4 is-flex is-justify-content-space-between is-align-items-center"
{{ projeto.file }} style="cursor: pointer; background-color: #f0f8ff; transition: background-color 0.2s; user-select: none;">
</a> <div class="is-flex is-align-items-center">
<span class="icon has-text-info mr-2"><i class="fa-solid fa-guitar"></i></span>
<span class="has-text-grey-dark has-text-weight-bold">Todos os Samples Disponíveis</span>
<span id="filter-counter" class="tag is-info is-light ml-3 is-hidden">0 selecionados</span>
</div>
<span class="icon has-text-grey-light chevron-icon"><i class="fa-solid fa-chevron-down"></i></span>
</summary>
<!-- Lista de samples clicáveis --> <div class="p-4" style="background-color: #fff; border-top: 1px solid #cfe8fc;">
{% if projeto.tags.sample and projeto.tags.sample.size > 0 %} <div class="tags is-centered are-medium mb-0">
<div style="margin-top: 1rem;"> {% assign all_automation_string = "" %}
<p><strong>Sample:</strong></p>
<ul style="list-style-type: disc; padding-left: 1.25rem;"> {% for p in site.data.all %}
{% for sample in projeto.tags.sample %} {% for track in p.tracks %}
{% if sample != "" %} {% if track.sample %}
<li><a href="#" class="sample-item" data-sample="{{ sample }}">{{ sample }}</a></li> {% for inst in track.sample %}
{% if inst.instrument_name and inst.instrument_name != "" %}
{% unless all_automation_string contains inst.instrument_name %}
{% assign all_automation_string = all_automation_string | append: inst.instrument_name | append: "|||" %}
{% endunless %}
{% endif %}
{% endfor %}
{% elsif track.instrument_name and track.instrument_name != "" %}
{% unless all_automation_string contains track.instrument_name %}
{% assign all_automation_string = all_automation_string | append: track.instrument_name | append: "|||" %}
{% endunless %}
{% endif %}
{% endfor %}
{% endfor %}
{% assign unique_automation = all_automation_string | split: "|||" | sort %}
{% for item in unique_automation %}
{% if item != "" %}
<a href="#" class="tag is-white filter-item clickable-tag"
data-value="{{ item }}"
style="border: 1px solid #deeaf6; color: #5b7da3; margin-bottom: 0.5rem; transition: all 0.2s;">
{{ item }}
</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </div>
</div> <div class="has-text-centered mt-3">
{% endif %} <p class="help has-text-grey">Clique para filtrar.</p>
</div> </div>
</div> </div>
{% endif %} </details>
{% endfor %}
<div class="columns is-mobile is-vcentered mb-5">
<div class="column is-auto">
<h2 class="title is-4 has-text-grey-dark">
<span class="icon has-text-info mr-2"><i class="fa-solid fa-filter"></i></span>
Filtro: <code id="filter-display-name" style="color: #d63384;">(todos)</code>
</h2>
</div>
<div class="column is-narrow">
<button id="clearFilterButton" class="button is-small is-danger is-light">
<span class="icon is-small"><i class="fa-solid fa-xmark"></i></span>
<span>Limpar Tudo</span>
</button>
</div>
</div>
<div id="project-list" class="columns is-multiline">
{% for projeto in site.data.all %}
{% assign project_insts = "" %}
{% for track in projeto.tracks %}
{% if track.sample %}
{% for inst in track.sample %}
{% assign project_insts = project_insts | append: inst.instrument_name | append: "," %}
{% endfor %}
{% elsif track.instrument_name %}
{% assign project_insts = project_insts | append: track.instrument_name | append: "," %}
{% endif %}
{% endfor %}
<div class="column is-12-mobile is-6-tablet is-4-desktop is-3-widescreen project-item"
data-sample="{{ project_insts }}">
<div class="card project-card" style="height: 100%; background-color: #f0f8ff; border: 1px solid #cfe8fc; border-radius: 12px; display: flex; flex-direction: column;">
{% assign file_url = projeto.file | downcase | replace: ' ', '-' | replace: 'ç', 'c' | replace: 'ã', 'a' | replace: 'á', 'a' | replace: 'â', 'a' | replace: 'é', 'e' | replace: 'ê', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ô', 'o' | replace: 'õ', 'o' | replace: 'ú', 'u' %}
{% assign page_url = '../mmp_pages/' | append: file_url | append: '.html' %}
<a href="{{ page_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;">
{{ projeto.file }}
</p>
{% if projeto.bpm %}
<div class="mb-3">
<span class="tag is-dark is-rounded is-light" style="font-size: 0.7rem; font-weight: bold; border: 1px solid #ccc;">
🎵 {{ projeto.bpm }} BPM
</span>
</div>
{% else %}
<div class="mb-3" style="height: 24px;"></div>
{% endif %}
<div style="flex: 1;"></div>
{% assign unique_proj_insts = project_insts | split: "," | uniq %}
{% if unique_proj_insts.size > 0 %}
<div class="tags is-centered is-gapless mb-0 mt-2" style="gap: 4px; justify-content: center;">
{% for item in unique_proj_insts %}
{% if item != "" %}
<span class="tag is-white filter-item clickable-tag" data-value="{{ item }}"
style="font-size: 0.65rem; border: 1px solid #deeaf6; color: #5b7da3; padding: 0 6px; height: 1.5em; text-decoration: none; cursor: pointer;">
{{ item | truncate: 15 }}
</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</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 }}" data-modal-title="Detalhes: {{ projeto.file }}" data-full-btn-text="Ir para Página" data-full-btn-link="{{ page_url }}" style="color: #5b7da3; font-size: 0.8rem; font-weight: 600; border-right: 1px solid #eee; transition: background 0.2s;">Ver</a>
{% assign creation_url = '/mmpSearch/creation.html?project=' | append: projeto.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: {{ projeto.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>
{% endfor %}
</div>
</div> </div>
</div> </div>
</main> </main>
<div id="preview-modal" class="modal">
<div class="modal-background"></div>
<div class="modal-card" style="width: 90%; max-width: 800px;">
<header class="modal-card-head" style="background-color: #f0f8ff; border-bottom: 1px solid #cfe8fc;">
<p class="modal-card-title" id="modal-title" style="color: #205081; font-weight: bold;">Preview</p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body p-0" style="height: 500px; background-color: #fff;">
<iframe id="preview-iframe" src="" style="width: 100%; height: 100%; border: none;"></iframe>
</section>
<footer class="modal-card-foot" style="justify-content: flex-end; background-color: #fff; border-top: 1px solid #cfe8fc;">
<button class="button" id="close-modal-btn">Fechar</button>
<a href="#" id="full-edit-btn" target="_blank" class="button is-info">Abrir</a>
</footer>
</div>
</div>
<style>
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(50, 115, 220, 0.15); border-color: #3273dc !important; background-color: #fff !important; }
.clickable-tag:hover { background-color: #e3effd !important; color: #3273dc !important; border-color: #3273dc !important; transform: scale(1.05); }
.tag.is-active-filter { background-color: #3273dc !important; color: #fff !important; border-color: #3273dc !important; font-weight: bold; box-shadow: 0 2px 5px rgba(50, 115, 220, 0.3); }
.collapse-card summary { list-style: none; transition: background 0.2s; }
.collapse-card summary::-webkit-details-marker { display: none; }
.collapse-card[open] summary .chevron-icon { transform: rotate(180deg); }
.chevron-icon { transition: transform 0.3s ease; }
</style>
<script> <script>
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const projects = document.querySelectorAll('.project-item'); const projects = document.querySelectorAll('.project-item');
const filterDisplayName = document.getElementById('filter-display-name');
const filterCounter = document.getElementById('filter-counter');
let activeFilters = [];
function applyFilters() {
if (activeFilters.length > 0) {
filterDisplayName.textContent = activeFilters.join(" + ");
filterCounter.textContent = activeFilters.length + " selecionados";
filterCounter.classList.remove('is-hidden');
} else {
filterDisplayName.textContent = "(todos)";
filterCounter.classList.add('is-hidden');
}
// Atualiza visual das tags
document.querySelectorAll('.filter-item').forEach(tag => {
const val = tag.getAttribute('data-value');
if (activeFilters.includes(val)) {
tag.classList.add('is-active-filter');
} else {
tag.classList.remove('is-active-filter');
}
});
// Função para aplicar filtro por sample
function filterBySample(sampleName) {
projects.forEach(project => { projects.forEach(project => {
const projectSample = project.getAttribute('data-sample').split(','); const projectInstStr = project.getAttribute('data-sample');
if (projectSample.includes(sampleName)) { // Cria array de automações deste projeto
project.style.display = 'block'; const projectInsts = projectInstStr.split(',').map(s => s.trim());
if (activeFilters.length === 0) {
project.style.display = 'block';
} else { } else {
project.style.display = 'none'; // Lógica OR: Se tiver pelo menos uma das automações filtradas, exibe
const hasMatch = activeFilters.some(filter => projectInsts.includes(filter));
project.style.display = hasMatch ? 'block' : 'none';
} }
}); });
}
// Lê o sample da URL se houver
const urlParams = new URLSearchParams(window.location.search);
const sampleFromUrl = urlParams.get('sample');
if (sampleFromUrl) {
filterBySample(sampleFromUrl);
}
// Ao clicar num sample na lista
const sampleItems = document.querySelectorAll('.sample-item');
sampleItems.forEach(item => {
item.addEventListener('click', function (event) {
event.preventDefault();
const selectedSample = item.getAttribute('data-sample');
filterBySample(selectedSample);
// Atualiza a URL sem recarregar a página
const newUrl = new URL(window.location.href);
newUrl.searchParams.set('sample', selectedSample);
window.history.replaceState({}, '', newUrl);
});
});
// Botão para limpar filtro
const clearFilterButton = document.querySelector('#clearFilterButton');
clearFilterButton.addEventListener('click', function () {
projects.forEach(project => {
project.style.display = 'block';
});
// Remove o filtro da URL
const newUrl = new URL(window.location.href); const newUrl = new URL(window.location.href);
newUrl.searchParams.delete('sample'); if (activeFilters.length > 0) {
newUrl.searchParams.set('sample', activeFilters.join(','));
} else {
newUrl.searchParams.delete('sample');
}
window.history.replaceState({}, '', newUrl); window.history.replaceState({}, '', newUrl);
}
function toggleFilter(val) {
const index = activeFilters.indexOf(val);
if (index > -1) activeFilters.splice(index, 1);
else activeFilters.push(val);
applyFilters();
}
// Inicializa
const urlParams = new URLSearchParams(window.location.search);
const instParam = urlParams.get('sample');
if (instParam) {
activeFilters = instParam.split(',').map(s => s.trim()).filter(s => s !== "");
applyFilters();
}
// Eventos
document.querySelectorAll('.filter-item').forEach(tag => {
tag.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation(); // Evita clique no card se for dentro dele
const val = this.getAttribute('data-value');
toggleFilter(val);
});
}); });
document.querySelector('#clearFilterButton').addEventListener('click', function () {
activeFilters = [];
applyFilters();
});
// 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) {
modalTitle.textContent = title;
iframe.src = url;
fullEditBtn.textContent = btnText;
fullEditBtn.href = btnLink;
modal.classList.add('is-active');
document.documentElement.classList.add('is-clipped');
}
function closeModal() {
modal.classList.remove('is-active');
document.documentElement.classList.remove('is-clipped');
iframe.src = "";
}
document.querySelectorAll('.js-open-modal').forEach(btn => {
btn.addEventListener('click', (e) => {
e.preventDefault();
openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink);
});
});
iframe.addEventListener('load', () => { try {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const style = iframeDoc.createElement('style');
style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
iframeDoc.head.appendChild(style);
} catch(e){} });
closeButtons.forEach(el => el.addEventListener('click', closeModal));
document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
}); });
</script> </script>

View File

@ -1,132 +0,0 @@
---
layout: default
title: Beats Disponíveis
permalink: /beats/
---
<main class="main-content">
<div class="publication">
<div class="tabs is-centered is-boxed is-medium mb-6">
{% include sidebar.html %}
</div>
<div class="container">
<br>
<h2 class="title is-4 mb-5"><code>🎧 Lista de Beats 🎧</code></h2>
<p>Aqui estão os beats disponíveis.
<br>Clique em um beat para ouvi-lo.</p>
<!-- Lista de Beats -->
<div class="beat-list">
{% assign files = site.static_files %}
{% for file in files %}
{% if file.path contains '/wav/' %}
<div class="beat-item box">
{% assign project_url = "" %}
<!-- Aqui, tentamos encontrar o projeto correspondente com base no nome do arquivo -->
{% assign file_name_without_extension = file.name | remove: '.wav' %}
{% for projeto in site.data.all %}
{% if projeto.file == file_name_without_extension %}
{% assign project_url = "/mmp_pages/"
| append: projeto.file
| downcase
| replace: ' ', '-'
| replace: ' ', '-'
| replace: 'ç', 'c'
| replace: 'ã', 'a'
| replace: 'á', 'a'
| replace: 'â', 'a'
| replace: 'é', 'e'
| replace: 'ê', 'e'
| replace: 'í', 'i'
| replace: 'ó', 'o'
| replace: 'ô', 'o'
| replace: 'õ', 'o'
| replace: 'ú', 'u'
| append: ".html" %}
{% endif %}
{% endfor %}
<p class="beat-name">
{% if project_url %}
<!-- Link para o projeto que originou o arquivo .wav -->
<a href="{{ project_url | relative_url }}" class="project-link">
<code>{{ file.name | replace: '.wav', '' }}</code>
</a>
{% else %}
<!-- Se não encontrar um projeto relacionado, exibe o nome do arquivo -->
{{ file.name | replace: '.wav', '' }}
{% endif %}
</p>
<audio class="audio-player" controls>
<source src="{{ file.path | relative_url }}" type="audio/wav">
Seu navegador não suporta o elemento de áudio.
</audio>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</main>
<style>
.beat-list {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 2rem;
}
.beat-item {
background-color: #f9f9f9;
padding: 0.2rem; /* Reduzido o padding para diminuir a altura */
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 250px;
text-align: center;
max-height: 25px; /* Define a altura máxima das divs */
overflow: hidden; /* Garante que conteúdo extra não sobrecarregue a div */
}
.beat-name {
font-size: 0.9rem;
font-weight: bold;
margin-bottom: 0.2rem;
text-overflow: ellipsis; /* Adiciona '...' se o texto for muito grande */
white-space: nowrap; /* Garante que o texto não quebre e adicione '...' */
overflow: hidden; /* Garante que o nome do arquivo longo seja cortado com '...' */
}
.audio-player {
width: 100%;
margin-top: 0.5rem;
}
.project-link {
text-decoration: none;
color: #3273dc;
}
.project-link:hover {
text-decoration: underline;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
const audioPlayers = document.querySelectorAll('.audio-player');
audioPlayers.forEach(audio => {
audio.addEventListener('play', function() {
audioPlayers.forEach(otherAudio => {
if (otherAudio !== audio && !otherAudio.paused) {
otherAudio.pause();
}
});
});
});
});
</script>