Update index.html
Browse files- index.html +36 -9
index.html
CHANGED
|
@@ -364,7 +364,10 @@
|
|
| 364 |
.audio-player-wrap {
|
| 365 |
background: white; border: 1.5px solid var(--border); border-radius: 16px;
|
| 366 |
padding: 10px 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.04);
|
| 367 |
-
display: flex;
|
|
|
|
|
|
|
|
|
|
| 368 |
}
|
| 369 |
.audio-label {
|
| 370 |
display: flex; align-items: center; gap: 5px;
|
|
@@ -375,6 +378,7 @@
|
|
| 375 |
|
| 376 |
/* ===== DOWNLOAD BUTTON ===== */
|
| 377 |
.download-btn {
|
|
|
|
| 378 |
flex-shrink: 0;
|
| 379 |
display: flex; align-items: center; gap: 6px;
|
| 380 |
padding: 8px 14px; border-radius: 12px; border: none;
|
|
@@ -592,13 +596,15 @@
|
|
| 592 |
</button>
|
| 593 |
</div>
|
| 594 |
<div class="audio-player-wrap">
|
| 595 |
-
<div class="audio-
|
| 596 |
-
<
|
| 597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 598 |
</div>
|
| 599 |
-
<audio id="audioPlayer" controls controlsList="nodownload">
|
| 600 |
-
مرورگر شما از پخش صدا پشتیبانی نمیکند.
|
| 601 |
-
</audio>
|
| 602 |
<button class="download-btn" id="downloadBtn" title="دانلود صدا">
|
| 603 |
<div class="dl-icon"><i class="fa-solid fa-arrow-down"></i></div>
|
| 604 |
دانلود صدا
|
|
@@ -679,8 +685,28 @@
|
|
| 679 |
const rtl = isRTL(langName) || langName === 'شناسایی خودکار';
|
| 680 |
inputText.dir = rtl ? 'rtl' : 'ltr';
|
| 681 |
inputText.style.textAlign = rtl ? 'right' : 'left';
|
|
|
|
|
|
|
|
|
|
| 682 |
}
|
| 683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
function applyOutputDir(langName) {
|
| 685 |
const rtl = isRTL(langName);
|
| 686 |
outputText.dir = rtl ? 'rtl' : 'ltr';
|
|
@@ -733,6 +759,7 @@
|
|
| 733 |
clearBtn.addEventListener('click', () => {
|
| 734 |
inputText.value = '';
|
| 735 |
inputText.focus();
|
|
|
|
| 736 |
outputSection.classList.remove('visible');
|
| 737 |
setTimeout(() => { outputSection.style.display = 'none'; }, 450);
|
| 738 |
});
|
|
@@ -797,10 +824,10 @@
|
|
| 797 |
|
| 798 |
if (result.audio_url) {
|
| 799 |
audioPlayer.src = result.audio_url + '?t=' + Date.now();
|
| 800 |
-
audioPlayer.parentElement.style.display = 'flex';
|
| 801 |
audioPlayer.play().catch(() => {});
|
| 802 |
} else {
|
| 803 |
-
audioPlayer.parentElement.style.display = 'none';
|
| 804 |
}
|
| 805 |
|
| 806 |
outputSection.style.display = 'flex';
|
|
|
|
| 364 |
.audio-player-wrap {
|
| 365 |
background: white; border: 1.5px solid var(--border); border-radius: 16px;
|
| 366 |
padding: 10px 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.04);
|
| 367 |
+
display: flex; flex-direction: column; gap: 10px;
|
| 368 |
+
}
|
| 369 |
+
.audio-player-row {
|
| 370 |
+
display: flex; align-items: center; gap: 8px; width: 100%;
|
| 371 |
}
|
| 372 |
.audio-label {
|
| 373 |
display: flex; align-items: center; gap: 5px;
|
|
|
|
| 378 |
|
| 379 |
/* ===== DOWNLOAD BUTTON ===== */
|
| 380 |
.download-btn {
|
| 381 |
+
align-self: flex-start;
|
| 382 |
flex-shrink: 0;
|
| 383 |
display: flex; align-items: center; gap: 6px;
|
| 384 |
padding: 8px 14px; border-radius: 12px; border: none;
|
|
|
|
| 596 |
</button>
|
| 597 |
</div>
|
| 598 |
<div class="audio-player-wrap">
|
| 599 |
+
<div class="audio-player-row">
|
| 600 |
+
<div class="audio-label">
|
| 601 |
+
<i class="fa-solid fa-volume-high"></i>
|
| 602 |
+
صدا
|
| 603 |
+
</div>
|
| 604 |
+
<audio id="audioPlayer" controls controlsList="nodownload">
|
| 605 |
+
مرورگر شما از پخش صدا پشتیبانی نمیکند.
|
| 606 |
+
</audio>
|
| 607 |
</div>
|
|
|
|
|
|
|
|
|
|
| 608 |
<button class="download-btn" id="downloadBtn" title="دانلود صدا">
|
| 609 |
<div class="dl-icon"><i class="fa-solid fa-arrow-down"></i></div>
|
| 610 |
دانلود صدا
|
|
|
|
| 685 |
const rtl = isRTL(langName) || langName === 'شناسایی خودکار';
|
| 686 |
inputText.dir = rtl ? 'rtl' : 'ltr';
|
| 687 |
inputText.style.textAlign = rtl ? 'right' : 'left';
|
| 688 |
+
if (langName === 'شناسایی خودکار') {
|
| 689 |
+
checkDynamicDirection();
|
| 690 |
+
}
|
| 691 |
}
|
| 692 |
|
| 693 |
+
function checkDynamicDirection() {
|
| 694 |
+
if (sourceLang.value !== 'شناسایی خودکار') return;
|
| 695 |
+
const val = inputText.value;
|
| 696 |
+
const firstCharMatch = val.match(/\S/);
|
| 697 |
+
if (firstCharMatch) {
|
| 698 |
+
const rtlRegex = /[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/;
|
| 699 |
+
const isRtl = rtlRegex.test(firstCharMatch[0]);
|
| 700 |
+
inputText.dir = isRtl ? 'rtl' : 'ltr';
|
| 701 |
+
inputText.style.textAlign = isRtl ? 'right' : 'left';
|
| 702 |
+
} else {
|
| 703 |
+
inputText.dir = 'rtl';
|
| 704 |
+
inputText.style.textAlign = 'right';
|
| 705 |
+
}
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
inputText.addEventListener('input', checkDynamicDirection);
|
| 709 |
+
|
| 710 |
function applyOutputDir(langName) {
|
| 711 |
const rtl = isRTL(langName);
|
| 712 |
outputText.dir = rtl ? 'rtl' : 'ltr';
|
|
|
|
| 759 |
clearBtn.addEventListener('click', () => {
|
| 760 |
inputText.value = '';
|
| 761 |
inputText.focus();
|
| 762 |
+
checkDynamicDirection();
|
| 763 |
outputSection.classList.remove('visible');
|
| 764 |
setTimeout(() => { outputSection.style.display = 'none'; }, 450);
|
| 765 |
});
|
|
|
|
| 824 |
|
| 825 |
if (result.audio_url) {
|
| 826 |
audioPlayer.src = result.audio_url + '?t=' + Date.now();
|
| 827 |
+
audioPlayer.parentElement.parentElement.style.display = 'flex';
|
| 828 |
audioPlayer.play().catch(() => {});
|
| 829 |
} else {
|
| 830 |
+
audioPlayer.parentElement.parentElement.style.display = 'none';
|
| 831 |
}
|
| 832 |
|
| 833 |
outputSection.style.display = 'flex';
|