iphlex commited on
Commit
60e09cb
·
verified ·
1 Parent(s): 1266f93

🐳 18/03 - 17:19 - hello

Browse files
Files changed (1) hide show
  1. script.js +12 -7
script.js CHANGED
@@ -1695,21 +1695,26 @@ function renderExercises(exercises) {
1695
  const chineseName = nameParts[0];
1696
  const englishName = nameParts.slice(1).join(' ');
1697
 
 
 
 
 
1698
  card.innerHTML = `
1699
  <div class="flex flex-col md:flex-row gap-6">
1700
  <div class="md:w-1/3">
1701
- <div class="video-placeholder rounded-2xl aspect-video flex items-center justify-center relative group cursor-pointer overflow-hidden border border-gold-500/20">
1702
- <img src="http://static.photos/fitness/640x360/${(index % 5) + 1}" alt="${exercise.name}" class="w-full h-full object-cover opacity-60 group-hover:opacity-80 transition-all duration-500 group-hover:scale-110">
1703
  <div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
1704
  <div class="absolute inset-0 flex items-center justify-center">
1705
- <div class="w-16 h-16 rounded-full bg-gold-500/90 flex items-center justify-center transform group-hover:scale-125 transition-transform duration-300 shadow-lg shadow-gold-500/50 group-hover:bg-gold-400">
1706
- <i data-lucide="play" class="w-8 h-8 text-black ml-1"></i>
1707
  </div>
1708
  </div>
1709
- <div class="absolute bottom-2 right-2 px-3 py-1 bg-black/70 rounded-full text-xs text-white border border-white/20">
1710
- 點擊播放示範
1711
  </div>
1712
- </div>
 
1713
  </div>
1714
  <div class="md:w-2/3 flex flex-col justify-center">
1715
  <div class="flex items-center space-x-3 mb-3">
 
1695
  const chineseName = nameParts[0];
1696
  const englishName = nameParts.slice(1).join(' ');
1697
 
1698
+ const hasVideo = exercise.videoUrl && exercise.videoUrl.length > 0;
1699
+ const videoThumbnail = hasVideo ? `https://img.youtube.com/vi/${exercise.videoUrl.split('/').pop().split('?')[0]}/hqdefault.jpg` : `http://static.photos/fitness/640x360/${(index % 5) + 1}`;
1700
+ const videoLink = hasVideo ? exercise.videoUrl : '#';
1701
+
1702
  card.innerHTML = `
1703
  <div class="flex flex-col md:flex-row gap-6">
1704
  <div class="md:w-1/3">
1705
+ <a href="${videoLink}" target="_blank" rel="noopener noreferrer" class="video-placeholder rounded-2xl aspect-video flex items-center justify-center relative group cursor-pointer overflow-hidden border border-gold-500/20 block ${hasVideo ? 'hover:border-gold-500/50' : ''}">
1706
+ <img src="${videoThumbnail}" alt="${exercise.name}" class="w-full h-full object-cover ${hasVideo ? 'opacity-80' : 'opacity-60'} group-hover:opacity-100 transition-all duration-500 group-hover:scale-110" onerror="this.src='http://static.photos/fitness/640x360/${(index % 5) + 1}'">
1707
  <div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
1708
  <div class="absolute inset-0 flex items-center justify-center">
1709
+ <div class="w-16 h-16 rounded-full ${hasVideo ? 'bg-red-600/90' : 'bg-gold-500/90'} flex items-center justify-center transform group-hover:scale-125 transition-transform duration-300 shadow-lg ${hasVideo ? 'shadow-red-600/50 group-hover:bg-red-500' : 'shadow-gold-500/50 group-hover:bg-gold-400'}">
1710
+ <i data-lucide="play" class="w-8 h-8 text-white ml-1 fill-current"></i>
1711
  </div>
1712
  </div>
1713
+ <div class="absolute bottom-2 right-2 px-3 py-1 bg-black/70 rounded-full text-xs text-white border border-white/20 flex items-center gap-1">
1714
+ ${hasVideo ? '<i data-lucide="youtube" class="w-3 h-3 text-red-400"></i> 觀看示範影片' : '點擊播放示範'}
1715
  </div>
1716
+ ${hasVideo ? '<div class="absolute top-2 left-2 px-2 py-1 bg-red-600/90 rounded text-xs text-white font-bold">YouTube</div>' : ''}
1717
+ </a>
1718
  </div>
1719
  <div class="md:w-2/3 flex flex-col justify-center">
1720
  <div class="flex items-center space-x-3 mb-3">