o1-mini-2024-09-12· OpenAI
WildChat-4.8M (AI2)
<!DOCTYPE html> <html lang="fa"> <head> <meta charset="UTF-8"> <title>صفحه دانلود…
- Usercode
- Assistant
/* Wrapper برای انتقال محتویات به سمت بالا */
.wrapper {
transform: translateY(-6cm); /* انتقال ۶ سانتیمتر به سمت بالا */
/* اطمینان از اینکه محتویات به درستی جایگذاری شوند */
position: relative;
}
/* حذف حاشیههای پیشفرض تمامی تگهای p */
p {
margin: 0;
padding: 0;
}
.iframe-container {
position: relative;
width: 100%;
height: 600px; /* تنظیم ارتفاع مناسب برای iframe */
overflow: hidden;
margin: 20px 0;
}
iframe {
width: 100%;
height: 100%;
border: none;
display: none; /* مخفی کردن iframe تا بارگذاری شود */
position: relative;
}
.loading {
position: fixed; /* قرارگیری روی کل صفحه */
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
z-index: 10000;
/* حذف پسزمینه و سایر استایلهای اضافی */
}
.loading-message {
margin-bottom: 20px;
font-size: 18px;
text-align: center;
}
.progress {
width: 80%;
max-width: 400px;
height: 20px;
background-color: #ddd;
border-radius: 5px;
overflow: hidden;
}
.progress-bar {
height: 100%;
width: 0;
background-color: #4caf50;
transition: width 1s;
}
.error-message {
display: none;
color: red;
margin-top: 20px;
font-size: 16px;
text-align: center;
}
#retryButton {
display: none;
margin-top: 10px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: #4caf50;
color: white;
border: none;
border-radius: 5px;
}
/* دکمههای دانلود و توضیحات */
.download-button, .description-button {
display: block;
width: 90px;
color: white;
text-align: center;
padding: 6px;
border-radius: 5px;
cursor: pointer;
font-size: 12px;
transition: background-color 0.3s;
position: fixed; /* حفظ موقعیت fixed */
top: 10px;
z-index: 10001;
text-decoration: none;
}
.download-button {
background-color: #4CAF50;
right: 10px; /* موقعیت fixed در سمت راست */
}
.description-button {
background-color: rgb(84, 110, 122);
left: 10px; /* موقعیت fixed در سمت چپ */
}
.download-button:hover, .description-button:hover {
background-color: #45a049;
}
/* استایل پنجره سفارشی (modal) */
.modal {
display: none;
position: fixed;
z-index: 10002;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content, .confirm-modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
text-align: center;
border-radius: 5px;
}
.confirm-modal-content {
max-width: 400px;
}
.modal-button {
margin-top: 20px;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
}
.cancel-btn {
background-color: #f44336;
color: white;
}
.confirm-btn {
background-color: #4CAF50;
color: white;
}
.confirm-btn:hover {
background-color: #45a049;
}
.canceled-btn {
background-color: #f44336;
color: white;
}
.canceled-btn:hover {
background-color: #d32f2f;
}
.audio-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 15px;
}
.audio-item {
display: flex;
flex-direction: column;
align-items: center;
margin: 20px 0;
width: 100%;
text-align: center;
}
/* مرکزیت برچسب ها */
.audio-label {
font-weight: bold;
margin-bottom: 5px;
font-size: 16px;
text-align: center; /* مرکزیت متن */
}
.audio-player {
width: 80%;
margin-bottom: 10px;
}
.download-audio-button {
background-color: #4CAF50;
color: white;
padding: 8px 16px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
}
.download-audio-button:hover {
background-color: #45a049;
}
.download-button-bottom {
position: fixed; /* باقی ماندن در موقعیت fixed */
bottom: 10px;
left: 50%;
transform: translateX(-50%);
background-color: #4CAF50;
padding: 16px 20px; /* افزایش پدینگ عمودی از 12px به 16px */
max-width: 90%;
width: 250px; /* عرض ثابت، قابل تنظیم */
border-radius: 5px;
color: white;
text-align: center;
font-size: 16px;
text-decoration: none;
z-index: 10001;
cursor: pointer;
box-sizing: border-box; /* شامل شدن پدینگ در محاسبه عرض */
display: none; /* مخفی کردن دکمه در ابتدا */
}
.download-button-bottom:hover {
background-color: #45a049;
}
/* تنظیمات برای صفحات بسیار کوچک */
@media (max-width: 300px) {
.download-button-bottom {
width: 90%;
}
}
</style>
<!-- پنجره سفارشی (modal) برای نمایش صداهای دانلود شده -->
<div id="myModal" class="modal">
<div class="modal-content">
<p style="text-align: center;">صداهای شناسایی شده</p>
<div class="audio-container" id="audioContainer"><!-- پلیرهای صدا در اینجا قرار خواهند گرفت --></div>
<button class="modal-button cancel-btn" id="closeBtn">بستن</button>
</div>
</div>
<!-- پنجره تأیید دانلود -->
<div id="confirmModal" class="modal">
<div class="confirm-modal-content">
<p>برای دانلود فایل صوتی روی تایید کلیک کنید و بعد از باز شدن مرورگر سمت راست فایل کلیک کنید و بارگیری فایل را انتخاب کنید.</p>
<button class="modal-button confirm-btn" id="confirmDownloadBtn">تایید</button>
<button class="modal-button canceled-btn" id="cancelDownloadBtn">لغو</button>
</div>
</div>
<!-- پنجره سفارشی (modal) برای نمایش توضیحات -->
<div id="myDescriptionModal" class="modal">
<div class="modal-content">
<hr />
<p style="text-align: center;">دستیار مجهز به هوش مصنوعی شما</p>
<p style="text-align: center;"><span style="color: #0000ff;"><strong>افزایش کیفیت صدا</strong></span> بهره وری از پیشرفتهترین مدل هوش مصنوعی برای تقویت فایلهای صوتی</p>
<p style="text-align: center;">حذف نویز و تقویت پیشرفته صدا AI </p>
<button class="modal-button cancel-btn" id="closeDescriptionBtn">بستن</button>
</div>
</div>
<!-- لودینگ و iframe -->
<div class="iframe-container">
<div class="loading" id="loadingContainer">
<div class="loading-message">لطفاً صبر کنید...</div>
<div class="progress">
<div class="progress-bar" id="progressBar"></div>
</div>
<div class="error-message" id="errorMessage">بارگیری زیاد طول کشید.<br />در صورت عدم بارگذاری، فیلترشکن خود را روشن کنید.</div>
<button id="retryButton">بارگذاری مجدد</button>
</div>
<iframe id="myIframe" onload="iframeLoaded()" onerror="iframeError()"></iframe>
</div>
<!-- دکمه دانلود صدا در پایین صفحه -->
<div>
<a href="#" class="download-button-bottom" id="downloadButtonBottom">دانلود صدا 📥</a>
</div>
</div> <!-- پایان wrapper -->
<script>
let progress = 0;
const progressBar = document.getElementById('progressBar');
const retryButton = document.getElementById('retryButton');
const errorMessage = document.getElementById('errorMessage');
const loadingContainer = document.getElementById('loadingContainer');
let interval;
let iframeLoadedFlag = false;
// متغیر برای ذخیرهی لینک فایل صوتی انتخاب شده
let selectedAudioUrl = '';
function startProgress() {
loadingContainer.style.display = 'flex'; // نمایش لودینگ
progressBar.style.width = '0%'; // ریست شدن نوار پیشرفت
progress = 0; // ریست پیشرفت
interval = setInterval(() => {
if (progress < 100) {
progress += 10;
progressBar.style.width = progress + '%';
}
if (progress === 100) {
clearInterval(interval);
if (!iframeLoadedFlag) {
retryButton.style.display = 'block';
errorMessage.style.display = 'block';
}
}
}, 1000);
}
function iframeLoaded() {
iframeLoadedFlag = true;
clearInterval(interval);
loadingContainer.style.display = 'none'; // مخفی کردن لودینگ
document.getElementById('myIframe').style.display = 'block'; // نمایش iframe
// نمایش دکمه دانلود پایین صفحه پس از بارگذاری موفق
document.getElementById('downloadButtonBottom').style.display = 'block';
}
function iframeError() {
clearInterval(interval);
retryButton.style.display = 'block';
errorMessage.style.display = 'block';
}
retryButton.addEventListener('click', function() {
progress = 0;
progressBar.style.width = '0%';
iframeLoadedFlag = false;
retryButton.style.display = 'none';
errorMessage.style.display = 'none';
loadingContainer.style.display = 'flex'; // بازگرداندن لودینگ
document.getElementById('myIframe').style.display = 'none'; // مخفی کردن iframe
loadIframe();
startProgress();
});
function loadIframe() {
const iframe = document.getElementById('myIframe');
// آدرس iframe خود را در اینجا تنظیم کنید
const urlParts = ['https:', '', 'nick088-edge-tts.hf.space', ''];
iframe.src = urlParts.join('/');
}
function handleDownload(event) {
event.preventDefault();
const iframe = document.getElementById('myIframe');
let iframeDocument;
try {
iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
} catch (error) {
console.error("دسترسی به محتوای iframe به دلیل محدودیتهای امنیتی امکانپذیر نیست.", error);
alert("دسترسی به محتوای iframe به دلیل محدودیتهای امنیتی امکانپذیر نیست.");
return;
}
try {
const links = iframeDocument.querySelectorAll('a');
if (links.length === 0) {
alert("هیچ لینک صوتی برای دانلود یافت نشد.");
return;
}
let wavFiles = [];
links.forEach((link) => {
const href = link.href;
if (href && href.toLowerCase().endsWith('.wav')) {
wavFiles.push(href);
}
});
if (wavFiles.length === 0) {
alert("هیچ فایل صوتی ساخته شده یافت نشد.");
return;
}
// محدود به دو فایل
wavFiles = wavFiles.slice(0, 2);
const audioContainer = document.getElementById('audioContainer');
audioContainer.innerHTML = '';
wavFiles.forEach((audioUrl, index) => {
const audioItem = document.createElement('div');
audioItem.classList.add('audio-item');
// تعیین برچسب بر اساس شماره پلیر
let labelText = '';
if (index === 0) {
labelText = 'خروجی صدای بدون نویز';
} else if (index === 1) {
labelText = 'خروجی صدای پیشرفته';
}
audioItem.innerHTML = `
<p class="audio-label">${labelText}</p>
<audio controls class="audio-player">
<source src="${audioUrl}" type="audio/wav">
مرورگر شما از پخش این فایل صوتی پشتیبانی نمیکند.
</audio>
<button class="download-audio-button" onclick="downloadAudio('${audioUrl}')">دانلود صدا</button>
`;
audioContainer.appendChild(audioItem);
});
document.getElementById('myModal').style.display = 'block';
} catch (error) {
console.error("خطا در شناسایی صداها: ", error);
alert("خطایی در شناسایی صداها رخ داد.");
}
}
function downloadAudio(audioUrl) {
// ذخیره لینک فایل صوتی انتخاب شده
selectedAudioUrl = audioUrl;
// نمایش پنجره تأیید
document.getElementById('confirmModal').style.display = 'block';
}
// Event listener برای دکمه تایید دانلود
document.getElementById('confirmDownloadBtn').addEventListener('click', function() {
if (selectedAudioUrl) {
window.open(selectedAudioUrl, '_blank'); // باز کردن لینک در تب جدید
// بسته شدن پنجره تأیید
document.getElementById('confirmModal').style.display = 'none';
// پاک کردن متغیر بعد از استفاده
selectedAudioUrl = '';
}
});
// Event listener برای دکمه لغو دانلود
document.getElementById('cancelDownloadBtn').addEventListener('click', function() {
// بسته شدن پنجره تأیید
document.getElementById('confirmModal').style.display = 'none';
// پاک کردن متغیر
selectedAudioUrl = '';
});
// Event listeners برای دکمه دریافت صدا
document.getElementById('downloadButton').addEventListener('click', handleDownload);
document.getElementById('downloadButtonBottom').addEventListener('click', handleDownload);
// بستن پنجره مودالها با کلیک خارج از آنها
window.addEventListener('click', function(event) {
const modals = ['myModal', 'myDescriptionModal', 'confirmModal'];
modals.forEach(modalId => {
const modal = document.getElementById(modalId);
if (event.target == modal) {
modal.style.display = 'none';
}
});
});
// مدیریت پنجره توضیحات
const descriptionModal = document.getElementById('myDescriptionModal');
const descriptionButton = document.getElementById('descriptionButton');
const closeDescriptionBtn = document.getElementById('closeDescriptionBtn');
descriptionButton.addEventListener('click', function(event) {
event.preventDefault();
descriptionModal.style.display = 'block';
});
closeDescriptionBtn.addEventListener('click', function() {
descriptionModal.style.display = 'none';
});
// مدیریت پنجره بستن مودال صدا
const myModal = document.getElementById('myModal');
const closeBtn = document.getElementById('closeBtn');
closeBtn.addEventListener('click', function() {
myModal.style.display = 'none';
});
// اجرای بارگذاری iframe و آغاز لودینگ
loadIframe();
startProgress();
</script>
برای تغییر میزان انتقال محتویات به سمت بالا از ۶ سانتیمتر به ۳ سانتیمتر، باید مقدار translateY در کلاس .wrapper را از -6cm به -3cm تغییر دهید. این تغییر باعث میشود که محتوای صفحه تنها به اندازه ۳ سانتیمتر به سمت بالا منتقل شود و بخش بالایی آن کمتر مخفی شود.
.wrapper {
transform: translateY(-3cm); /* انتقال ۳ سانتیمتر به سمت بالا */
position: relative;
}
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<title>صفحه دانلود صدا</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #f0f0f0;
font-family: Arial, sans-serif;
overflow: hidden; /* مخفی کردن اسکرول */
}
/* Wrapper برای انتقال محتویات به سمت بالا */
.wrapper {
transform: translateY(-3cm); /* انتقال ۳ سانتیمتر به سمت بالا */
/* اطمینان از اینکه محتویات به درستی جایگذاری شوند */
position: relative;
}
/* حذف حاشیههای پیشفرض تمامی تگهای p */
p {
margin: 0;
padding: 0;
}
.iframe-container {
position: relative;
width: 100%;
height: 600px; /* تنظیم ارتفاع مناسب برای iframe */
overflow: hidden;
margin: 20px 0;
}
iframe {
width: 100%;
height: 100%;
border: none;
display: none; /* مخفی کردن iframe تا بارگذاری شود */
position: relative;
}
.loading {
position: fixed; /* قرارگیری روی کل صفحه */
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
z-index: 10000;
/* حذف پسزمینه و سایر استایلهای اضافی */
}
.loading-message {
margin-bottom: 20px;
font-size: 18px;
text-align: center;
}
.progress {
width: 80%;
max-width: 400px;
height: 20px;
background-color: #ddd;
border-radius: 5px;
overflow: hidden;
}
.progress-bar {
height: 100%;
width: 0;
background-color: #4caf50;
transition: width 1s;
}
.error-message {
display: none;
color: red;
margin-top: 20px;
font-size: 16px;
text-align: center;
}
#retryButton {
display: none;
margin-top: 10px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: #4caf50;
color: white;
border: none;
border-radius: 5px;
}
/* دکمههای دانلود و توضیحات */
.download-button, .description-button {
display: block;
width: 90px;
color: white;
text-align: center;
padding: 6px;
border-radius: 5px;
cursor: pointer;
font-size: 12px;
transition: background-color 0.3s;
position: fixed; /* حفظ موقعیت fixed */
top: 10px;
z-index: 10001;
text-decoration: none;
}
.download-button {
background-color: #4CAF50;
right: 10px; /* موقعیت fixed در سمت راست */
}
.description-button {
background-color: rgb(84, 110, 122);
left: 10px; /* موقعیت fixed در سمت چپ */
}
.download-button:hover, .description-button:hover {
background-color: #45a049;
}
/* استایل پنجره سفارشی (modal) */
.modal {
display: none;
position: fixed;
z-index: 10002;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content, .confirm-modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
text-align: center;
border-radius: 5px;
}
.confirm-modal-content {
max-width: 400px;
}
.modal-button {
margin-top: 20px;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
}
.cancel-btn {
background-color: #f44336;
color: white;
}
.confirm-btn {
background-color: #4CAF50;
color: white;
}
.confirm-btn:hover {
background-color: #45a049;
}
.canceled-btn {
background-color: #f44336;
color: white;
}
.canceled-btn:hover {
background-color: #d32f2f;
}
.audio-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 15px;
}
.audio-item {
display: flex;
flex-direction: column;
align-items: center;
margin: 20px 0;
width: 100%;
text-align: center;
}
/* مرکزیت برچسب ها */
.audio-label {
font-weight: bold;
margin-bottom: 5px;
font-size: 16px;
text-align: center; /* مرکزیت متن */
}
.audio-player {
width: 80%;
margin-bottom: 10px;
}
.download-audio-button {
background-color: #4CAF50;
color: white;
padding: 8px 16px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
}
.download-audio-button:hover {
background-color: #45a049;
}
.download-button-bottom {
position: fixed; /* باقی ماندن در موقعیت fixed */
bottom: 10px;
left: 50%;
transform: translateX(-50%);
background-color: #4CAF50;
padding: 16px 20px; /* افزایش پدینگ عمودی از 12px به 16px */
max-width: 90%;
width: 250px; /* عرض ثابت، قابل تنظیم */
border-radius: 5px;
color: white;
text-align: center;
font-size: 16px;
text-decoration: none;
z-index: 10001;
cursor: pointer;
box-sizing: border-box; /* شامل شدن پدینگ در محاسبه عرض */
display: none; /* مخفی کردن دکمه در ابتدا */
}
.download-button-bottom:hover {
background-color: #45a049;
}
/* تنظیمات برای صفحات بسیار کوچک */
@media (max-width: 300px) {
.download-button-bottom {
width: 90%;
}
}
</style>
</head>
<body>
<!-- Wrapper برای انتقال محتویات به سمت بالا -->
<div class="wrapper">
<!-- دکمههای دانلود و توضیحات -->
<div>
<a href="#" class="download-button" id="downloadButton">دانلود صدا 📥</a>
<a href="#" class="description-button" id="descriptionButton">توضیحات</a>
</div>
<!-- پنجره سفارشی (modal) برای نمایش صداهای دانلود شده -->
<div id="myModal" class="modal">
<div class="modal-content">
<p style="text-align: center;">صداهای شناسایی شده</p>
<div class="audio-container" id="audioContainer"><!-- پلیرهای صدا در اینجا قرار خواهند گرفت --></div>
<button class="modal-button cancel-btn" id="closeBtn">بستن</button>
</div>
</div>
<!-- پنجره تأیید دانلود -->
<div id="confirmModal" class="modal">
<div class="confirm-modal-content">
<p>برای دانلود فایل صوتی روی تایید کلیک کنید و بعد از باز شدن مرورگر سمت راست فایل کلیک کنید و بارگیری فایل را انتخاب کنید.</p>
<button class="modal-button confirm-btn" id="confirmDownloadBtn">تایید</button>
<button class="modal-button canceled-btn" id="cancelDownloadBtn">لغو</button>
</div>
</div>
<!-- پنجره سفارشی (modal) برای نمایش توضیحات -->
<div id="myDescriptionModal" class="modal">
<div class="modal-content">
<hr />
<p style="text-align: center;">دستیار مجهز به هوش مصنوعی شما</p>
<p style="text-align: center;"><span style="color: #0000ff;"><strong>افزایش کیفیت صدا</strong></span> بهره وری از پیشرفتهترین مدل هوش مصنوعی برای تقویت فایلهای صوتی</p>
<p style="text-align: center;">حذف نویز و تقویت پیشرفته صدا AI </p>
<button class="modal-button cancel-btn" id="closeDescriptionBtn">بستن</button>
</div>
</div>
<!-- لودینگ و iframe -->
<div class="iframe-container">
<div class="loading" id="loadingContainer">
<div class="loading-message">لطفاً صبر کنید...</div>
<div class="progress">
<div class="progress-bar" id="progressBar"></div>
</div>
<div class="error-message" id="errorMessage">بارگیری زیاد طول کشید.<br />در صورت عدم بارگذاری، فیلترشکن خود را روشن کنید.</div>
<button id="retryButton">بارگذاری مجدد</button>
</div>
<iframe id="myIframe" onload="iframeLoaded()" onerror="iframeError()"></iframe>
</div>
<!-- دکمه دانلود صدا در پایین صفحه -->
<div>
<a href="#" class="download-button-bottom" id="downloadButtonBottom">دانلود صدا 📥</a>
</div>
</div> <!-- پایان wrapper -->
<script>
let progress = 0;
const progressBar = document.getElementById('progressBar');
const retryButton = document.getElementById('retryButton');
const errorMessage = document.getElementById('errorMessage');
const loadingContainer = document.getElementById('loadingContainer');
let interval;
let iframeLoadedFlag = false;
// متغیر برای ذخیرهی لینک فایل صوتی انتخاب شده
let selectedAudioUrl = '';
function startProgress() {
loadingContainer.style.display = 'flex'; // نمایش لودینگ
progressBar.style.width = '0%'; // ریست شدن نوار پیشرفت
progress = 0; // ریست پیشرفت
interval = setInterval(() => {
if (progress < 100) {
progress += 10;
progressBar.style.width = progress + '%';
}
if (progress === 100) {
clearInterval(interval);
if (!iframeLoadedFlag) {
retryButton.style.display = 'block';
errorMessage.style.display = 'block';
}
}
}, 1000);
}
function iframeLoaded() {
iframeLoadedFlag = true;
clearInterval(interval);
loadingContainer.style.display = 'none'; // مخفی کردن لودینگ
document.getElementById('myIframe').style.display = 'block'; // نمایش iframe
// نمایش دکمه دانلود پایین صفحه پس از بارگذاری موفق
document.getElementById('downloadButtonBottom').style.display = 'block';
}
function iframeError() {
clearInterval(interval);
retryButton.style.display = 'block';
errorMessage.style.display = 'block';
}
retryButton.addEventListener('click', function() {
progress = 0;
progressBar.style.width = '0%';
iframeLoadedFlag = false;
retryButton.style.display = 'none';
errorMessage.style.display = 'none';
loadingContainer.style.display = 'flex'; // بازگرداندن لودینگ
document.getElementById('myIframe').style.display = 'none'; // مخفی کردن iframe
loadIframe();
startProgress();
});
function loadIframe() {
const iframe = document.getElementById('myIframe');
// آدرس iframe خود را در اینجا تنظیم کنید
const urlParts = ['https:', '', 'nick088-edge-tts.hf.space', ''];
iframe.src = urlParts.join('/');
}
function handleDownload(event) {
event.preventDefault();
const iframe = document.getElementById('myIframe');
let iframeDocument;
try {
iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
} catch (error) {
console.error("دسترسی به محتوای iframe به دلیل محدودیتهای امنیتی امکانپذیر نیست.", error);
alert("دسترسی به محتوای iframe به دلیل محدودیتهای امنیتی امکانپذیر نیست.");
return;
}
try {
const links = iframeDocument.querySelectorAll('a');
if (links.length === 0) {
alert("هیچ لینک صوتی برای دانلود یافت نشد.");
return;
}
let wavFiles = [];
links.forEach((link) => {
const href = link.href;
if (href && href.toLowerCase().endsWith('.wav')) {
wavFiles.push(href);
}
});
if (wavFiles.length === 0) {
alert("هیچ فایل صوتی ساخته شده یافت نشد.");
return;
}
// محدود به دو فایل
wavFiles = wavFiles.slice(0, 2);
const audioContainer = document.getElementById('audioContainer');
audioContainer.innerHTML = '';
wavFiles.forEach((audioUrl, index) => {
const audioItem = document.createElement('div');
audioItem.classList.add('audio-item');
// تعیین برچسب بر اساس شماره پلیر
let labelText = '';
if (index === 0) {
labelText = 'خروجی صدای بدون نویز';
} else if (index === 1) {
labelText = 'خروجی صدای پیشرفته';
}
audioItem.innerHTML = `
<p class="audio-label">${labelText}</p>
<audio controls class="audio-player">
<source src="${audioUrl}" type="audio/wav">
مرورگر شما از پخش این فایل صوتی پشتیبانی نمیکند.
</audio>
<button class="download-audio-button" onclick="downloadAudio('${audioUrl}')">دانلود صدا</button>
`;
audioContainer.appendChild(audioItem);
});
document.getElementById('myModal').style.display = 'block';
} catch (error) {
console.error("خطا در شناسایی صداها: ", error);
alert("خطایی در شناسایی صداها رخ داد.");
}
}
function downloadAudio(audioUrl) {
// ذخیره لینک فایل صوتی انتخاب شده
selectedAudioUrl = audioUrl;
// نمایش پنجره تأیید
document.getElementById('confirmModal').style.display = 'block';
}
// Event listener برای دکمه تایید دانلود
document.getElementById('confirmDownloadBtn').addEventListener('click', function() {
if (selectedAudioUrl) {
window.open(selectedAudioUrl, '_blank'); // باز کردن لینک در تب جدید
// بسته شدن پنجره تأیید
document.getElementById('confirmModal').style.display = 'none';
// پاک کردن متغیر بعد از استفاده
selectedAudioUrl = '';
}
});
// Event listener برای دکمه لغو دانلود
document.getElementById('cancelDownloadBtn').addEventListener('click', function() {
// بسته شدن پنجره تأیید
document.getElementById('confirmModal').style.display = 'none';
// پاک کردن متغیر
selectedAudioUrl = '';
});
// Event listeners برای دکمه دریافت صدا
document.getElementById('downloadButton').addEventListener('click', handleDownload);
document.getElementById('downloadButtonBottom').addEventListener('click', handleDownload);
// بستن پنجره مودالها با کلیک خارج از آنها
window.addEventListener('click', function(event) {
const modals = ['myModal', 'myDescriptionModal', 'confirmModal'];
modals.forEach(modalId => {
const modal = document.getElementById(modalId);
if (event.target == modal) {
modal.style.display = 'none';
}
});
});
// مدیریت پنجره توضیحات
const descriptionModal = document.getElementById('myDescriptionModal');
const descriptionButton = document.getElementById('descriptionButton');
const closeDescriptionBtn = document.getElementById('closeDescriptionBtn');
descriptionButton.addEventListener('click', function(event) {
event.preventDefault();
descriptionModal.style.display = 'block';
});
closeDescriptionBtn.addEventListener('click', function() {
descriptionModal.style.display = 'none';
});
// مدیریت پنجره بستن مودال صدا
const myModal = document.getElementById('myModal');
const closeBtn = document.getElementById('closeBtn');
closeBtn.addEventListener('click', function() {
myModal.style.display = 'none';
});
// اجرای بارگذاری iframe و آغاز لودینگ
loadIframe();
startProgress();
</script>
</body>
</html>
تغییر مقدار translateY:
translateY از -6cm به -3cm، محتویات صفحه تنها به اندازه ۳ سانتیمتر به سمت بالا منتقل میشوند که باعث میشود ناحیه بالایی صفحه کمتر مخفی شود.تأثیرات دیگر:
تست در مرورگرهای مختلف:
اگر نیاز به تغییرات بیشتری دارید یا سوال دیگری در این زمینه دارید، خوشحال میشوم که کمک کنم!
Not yet included in a published release.