Opera8 commited on
Commit
f13ec06
·
verified ·
1 Parent(s): d0ad9f0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +38 -34
index.html CHANGED
@@ -16,6 +16,7 @@
16
  --text-primary: #1A202C;
17
  --text-secondary: #626F86;
18
  --accent-primary: #4A6CFA;
 
19
  --accent-glow: rgba(74, 108, 250, 0.2);
20
  --success-color: #38A169;
21
  --radius-card: 20px;
@@ -83,45 +84,56 @@
83
  textarea { min-height: 120px; resize: vertical; }
84
  textarea:focus, input:focus, select:focus { border-color: var(--accent-primary); background: #fff; }
85
 
86
- /* --- دکمه اصلی جدید و جذاب --- */
 
 
 
 
 
 
87
  .btn-main {
88
  width: 100%; padding: 16px;
89
- background: linear-gradient(135deg, #3b5bdb, var(--accent-primary), #3b5bdb);
90
- background-size: 250% 100%;
91
- background-position: 100% 0;
92
  color: #fff; border: none; border-radius: var(--radius-btn);
93
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
94
  display: flex; justify-content: center; align-items: center; gap: 10px;
95
- box-shadow: 0 5px 15px var(--accent-glow);
96
- transition: all 0.4s ease-out;
97
  position: relative;
98
- overflow: hidden; /* برای افکت درخشش */
 
 
 
 
 
 
 
99
  }
100
- .btn-main span { transition: transform 0.3s ease; display: inline-block; }
101
  .btn-main:hover {
102
- transform: translateY(-3px);
103
- background-position: 0% 0;
104
- box-shadow: 0 10px 25px rgba(74, 108, 250, 0.35);
105
  }
106
- .btn-main:hover span {
107
- transform: translateX(-4px) rotate(-10deg);
108
  }
109
- .btn-main::before { /* افکت درخشش */
110
  content: '';
111
  position: absolute;
112
- top: 0;
113
- left: -100%;
114
- width: 75%;
115
- height: 100%;
116
- background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
117
- transition: none;
 
118
  }
119
  .btn-main:hover::before {
120
- left: 100%;
121
- transition: left 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
122
  }
123
  .btn-main:active { transform: scale(0.98); }
124
  .btn-main:disabled { opacity: 0.7; cursor: not-allowed; filter: grayscale(1); }
 
125
 
126
  .btn-outline {
127
  background: transparent; border: 2px solid var(--input-border);
@@ -224,7 +236,7 @@
224
  </div>
225
  <div class="checkbox-wrapper"><input type="checkbox" id="think_checkbox" checked><label for="think_checkbox" style="font-size: 0.9rem; cursor: pointer;"><b>فعال‌سازی تفکر مدل</b><br><span style="font-size: 0.8rem; color: #666;">افزایش کیفیت آهنگ</span></label></div>
226
  </div>
227
- <button id="processBtn" class="btn-main" style="margin-top: 15px;"><span>ساخت آهنگ 🎵</span></button>
228
  </div>
229
 
230
  <div id="loader" style="display: none;">
@@ -256,7 +268,6 @@
256
  const ACE_SPACE_URL = "https://ace-step-ace-step-v1-5.hf.space/";
257
  let db;
258
 
259
- // المان‌ها
260
  const ideaInput = document.getElementById('ideaInput');
261
  const processBtn = document.getElementById('processBtn');
262
  const step1 = document.getElementById('step1');
@@ -273,7 +284,6 @@
273
  const getNum = (id) => Number(document.getElementById(id).value);
274
  const getChk = (id) => document.getElementById(id).checked;
275
 
276
- // آکاردئون
277
  const acc = document.getElementsByClassName("accordion");
278
  for (let i = 0; i < acc.length; i++) {
279
  acc[i].addEventListener("click", function() {
@@ -283,14 +293,12 @@
283
  });
284
  }
285
 
286
- // --- مدیریت پایگاه داده IndexedDB ---
287
  function initDB() {
288
  const request = indexedDB.open("alphaMusicDB", 1);
289
- request.onerror = (event) => console.error("خطای IndexedDB:", event);
290
  request.onsuccess = (event) => { db = event.target.result; loadHistory(); };
291
  request.onupgradeneeded = (event) => {
292
- const db = event.target.result;
293
- db.createObjectStore("songs", { keyPath: "id" });
294
  };
295
  }
296
 
@@ -316,9 +324,7 @@
316
  }
317
  };
318
  transaction.oncomplete = () => loadHistory();
319
- } catch (error) {
320
- console.error("خطا در ذخیره آهنگ:", error);
321
- }
322
  }
323
 
324
  function loadHistory() {
@@ -361,7 +367,6 @@
361
 
362
  initDB();
363
 
364
- // --- فرآیند اصلی ساخت آهنگ ---
365
  processBtn.addEventListener('click', async () => {
366
  if (!ideaInput.value.trim()) return alert("لطفا موضوع آهنگ را بنویسید");
367
 
@@ -456,7 +461,6 @@
456
 
457
  function formatLyrics(text) { return text.replace(/\[(.*?)\]/g, '<span class="lyrics-tag">[$1]</span>'); }
458
 
459
- // انیمیشن پس‌زمینه
460
  const canvas = document.getElementById('music-canvas');
461
  const ctx = canvas.getContext('2d');
462
  let t = 0;
 
16
  --text-primary: #1A202C;
17
  --text-secondary: #626F86;
18
  --accent-primary: #4A6CFA;
19
+ --accent-secondary: #9F7AEA; /* رنگ دوم برای گرادینت */
20
  --accent-glow: rgba(74, 108, 250, 0.2);
21
  --success-color: #38A169;
22
  --radius-card: 20px;
 
84
  textarea { min-height: 120px; resize: vertical; }
85
  textarea:focus, input:focus, select:focus { border-color: var(--accent-primary); background: #fff; }
86
 
87
+ /* --- START: دکمه اصلی کاملاً جدید و خفن --- */
88
+ @keyframes move-gradient {
89
+ 0% { background-position: 0% 50%; }
90
+ 50% { background-position: 100% 50%; }
91
+ 100% { background-position: 0% 50%; }
92
+ }
93
+
94
  .btn-main {
95
  width: 100%; padding: 16px;
96
+ background: linear-gradient(110deg, var(--accent-secondary), var(--accent-primary), var(--accent-secondary));
97
+ background-size: 200% 100%;
 
98
  color: #fff; border: none; border-radius: var(--radius-btn);
99
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
100
  display: flex; justify-content: center; align-items: center; gap: 10px;
101
+ transition: all 0.3s ease-out;
 
102
  position: relative;
103
+ z-index: 1;
104
+ }
105
+ .btn-main-content {
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ gap: 10px;
110
+ transition: transform 0.3s ease;
111
  }
 
112
  .btn-main:hover {
113
+ transform: translateY(-4px);
114
+ box-shadow: 0 12px 28px -5px rgba(124, 93, 250, 0.4);
 
115
  }
116
+ .btn-main:hover .btn-main-content {
117
+ transform: scale(1.05);
118
  }
119
+ .btn-main::before { /* لایه زیرین برای افکت حاشیه */
120
  content: '';
121
  position: absolute;
122
+ top: -2px; left: -2px; right: -2px; bottom: -2px;
123
+ background: linear-gradient(110deg, var(--accent-secondary), var(--accent-primary), var(--accent-secondary));
124
+ background-size: 400%;
125
+ border-radius: 16px;
126
+ z-index: -1;
127
+ opacity: 0;
128
+ transition: opacity 0.4s ease-out;
129
  }
130
  .btn-main:hover::before {
131
+ opacity: 1;
132
+ animation: move-gradient 4s linear infinite;
133
  }
134
  .btn-main:active { transform: scale(0.98); }
135
  .btn-main:disabled { opacity: 0.7; cursor: not-allowed; filter: grayscale(1); }
136
+ /* --- END: دکمه اصلی کاملاً جدید --- */
137
 
138
  .btn-outline {
139
  background: transparent; border: 2px solid var(--input-border);
 
236
  </div>
237
  <div class="checkbox-wrapper"><input type="checkbox" id="think_checkbox" checked><label for="think_checkbox" style="font-size: 0.9rem; cursor: pointer;"><b>فعال‌سازی تفکر مدل</b><br><span style="font-size: 0.8rem; color: #666;">افزایش کیفیت آهنگ</span></label></div>
238
  </div>
239
+ <button id="processBtn" class="btn-main" style="margin-top: 15px;"><div class="btn-main-content">ساخت آهنگ <span>🎵</span></div></button>
240
  </div>
241
 
242
  <div id="loader" style="display: none;">
 
268
  const ACE_SPACE_URL = "https://ace-step-ace-step-v1-5.hf.space/";
269
  let db;
270
 
 
271
  const ideaInput = document.getElementById('ideaInput');
272
  const processBtn = document.getElementById('processBtn');
273
  const step1 = document.getElementById('step1');
 
284
  const getNum = (id) => Number(document.getElementById(id).value);
285
  const getChk = (id) => document.getElementById(id).checked;
286
 
 
287
  const acc = document.getElementsByClassName("accordion");
288
  for (let i = 0; i < acc.length; i++) {
289
  acc[i].addEventListener("click", function() {
 
293
  });
294
  }
295
 
 
296
  function initDB() {
297
  const request = indexedDB.open("alphaMusicDB", 1);
298
+ request.onerror = (event) => console.error("IndexedDB error:", event);
299
  request.onsuccess = (event) => { db = event.target.result; loadHistory(); };
300
  request.onupgradeneeded = (event) => {
301
+ event.target.result.createObjectStore("songs", { keyPath: "id" });
 
302
  };
303
  }
304
 
 
324
  }
325
  };
326
  transaction.oncomplete = () => loadHistory();
327
+ } catch (error) { console.error("Error saving song:", error); }
 
 
328
  }
329
 
330
  function loadHistory() {
 
367
 
368
  initDB();
369
 
 
370
  processBtn.addEventListener('click', async () => {
371
  if (!ideaInput.value.trim()) return alert("لطفا موضوع آهنگ را بنویسید");
372
 
 
461
 
462
  function formatLyrics(text) { return text.replace(/\[(.*?)\]/g, '<span class="lyrics-tag">[$1]</span>'); }
463
 
 
464
  const canvas = document.getElementById('music-canvas');
465
  const ctx = canvas.getContext('2d');
466
  let t = 0;