Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +289 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: flash-card
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,289 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Sentence Mining App</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<style>
|
| 9 |
+
.card-container {
|
| 10 |
+
perspective: 1000px;
|
| 11 |
+
}
|
| 12 |
+
.card {
|
| 13 |
+
transition: transform 0.6s, box-shadow 0.3s;
|
| 14 |
+
transform-style: preserve-3d;
|
| 15 |
+
}
|
| 16 |
+
.card:hover {
|
| 17 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
| 18 |
+
}
|
| 19 |
+
.card-expanded {
|
| 20 |
+
transform: translateY(-10px);
|
| 21 |
+
}
|
| 22 |
+
.cube {
|
| 23 |
+
transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
| 24 |
+
transform-origin: center;
|
| 25 |
+
backface-visibility: hidden;
|
| 26 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 27 |
+
width: 24px;
|
| 28 |
+
height: 24px;
|
| 29 |
+
border-radius: 4px;
|
| 30 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 31 |
+
display: flex;
|
| 32 |
+
align-items: center;
|
| 33 |
+
justify-content: center;
|
| 34 |
+
font-size: 10px;
|
| 35 |
+
text-align: center;
|
| 36 |
+
padding: 2px;
|
| 37 |
+
word-break: break-word;
|
| 38 |
+
}
|
| 39 |
+
.card-expanded .cube {
|
| 40 |
+
transform: translateX(0) !important;
|
| 41 |
+
opacity: 1 !important;
|
| 42 |
+
}
|
| 43 |
+
.original-text {
|
| 44 |
+
border-right: 2px dashed #cbd5e0;
|
| 45 |
+
}
|
| 46 |
+
.audio-btn {
|
| 47 |
+
transition: all 0.2s;
|
| 48 |
+
}
|
| 49 |
+
.audio-btn:hover {
|
| 50 |
+
transform: scale(1.1);
|
| 51 |
+
}
|
| 52 |
+
.audio-btn:active {
|
| 53 |
+
transform: scale(0.95);
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
</head>
|
| 57 |
+
<body class="bg-gray-50 min-h-screen py-12 px-4 sm:px-6 lg:px-8">
|
| 58 |
+
<div class="max-w-4xl mx-auto">
|
| 59 |
+
<header class="text-center mb-12">
|
| 60 |
+
<h1 class="text-4xl font-bold text-indigo-700 mb-2">Sentence Mining</h1>
|
| 61 |
+
<p class="text-lg text-gray-600">Click on cards to reveal translations and breakdowns</p>
|
| 62 |
+
</header>
|
| 63 |
+
|
| 64 |
+
<div class="space-y-8">
|
| 65 |
+
<!-- Card 1 -->
|
| 66 |
+
<div class="card-container">
|
| 67 |
+
<div class="card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer">
|
| 68 |
+
<div class="flex flex-col md:flex-row">
|
| 69 |
+
<!-- Left side - Original text -->
|
| 70 |
+
<div class="original-text p-6 md:w-1/2 flex flex-col">
|
| 71 |
+
<div class="flex items-center justify-between mb-4">
|
| 72 |
+
<span class="text-sm font-medium text-indigo-600 bg-indigo-50 px-3 py-1 rounded-full">Japanese</span>
|
| 73 |
+
<button class="audio-btn bg-indigo-100 p-2 rounded-full text-indigo-700 hover:bg-indigo-200">
|
| 74 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 75 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" />
|
| 76 |
+
</svg>
|
| 77 |
+
</button>
|
| 78 |
+
</div>
|
| 79 |
+
<p class="text-2xl font-medium text-gray-800 mb-4">今日はとても疲れています。</p>
|
| 80 |
+
<div class="mt-auto flex items-center text-sm text-gray-500">
|
| 81 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 82 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
| 83 |
+
</svg>
|
| 84 |
+
Added 2 days ago
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
<!-- Right side - Cubes -->
|
| 89 |
+
<div class="p-6 md:w-1/2 relative overflow-hidden cube-container" style="min-height: 180px;">
|
| 90 |
+
<!-- Sentence parts as uniform cubes -->
|
| 91 |
+
<div class="cube absolute">I'm</div>
|
| 92 |
+
<div class="cube absolute">very</div>
|
| 93 |
+
<div class="cube absolute">tired</div>
|
| 94 |
+
<div class="cube absolute">today</div>
|
| 95 |
+
<div class="cube absolute">.</div>
|
| 96 |
+
<div class="cube absolute bg-indigo-100 text-indigo-700">I'm very tired today.</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<!-- Card 2 -->
|
| 103 |
+
<div class="card-container">
|
| 104 |
+
<div class="card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer">
|
| 105 |
+
<div class="flex flex-col md:flex-row">
|
| 106 |
+
<!-- Left side - Original text -->
|
| 107 |
+
<div class="original-text p-6 md:w-1/2 flex flex-col">
|
| 108 |
+
<div class="flex items-center justify-between mb-4">
|
| 109 |
+
<span class="text-sm font-medium text-emerald-600 bg-emerald-50 px-3 py-1 rounded-full">Spanish</span>
|
| 110 |
+
<button class="audio-btn bg-emerald-100 p-2 rounded-full text-emerald-700 hover:bg-emerald-200">
|
| 111 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 112 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" />
|
| 113 |
+
</svg>
|
| 114 |
+
</button>
|
| 115 |
+
</div>
|
| 116 |
+
<p class="text-2xl font-medium text-gray-800 mb-4">¿Dónde está la biblioteca?</p>
|
| 117 |
+
<div class="mt-auto flex items-center text-sm text-gray-500">
|
| 118 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 119 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
| 120 |
+
</svg>
|
| 121 |
+
Added 1 week ago
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<!-- Right side - Cubes -->
|
| 126 |
+
<div class="p-6 md:w-1/2 flex flex-wrap justify-between items-center relative overflow-hidden" style="min-height: 180px;">
|
| 127 |
+
<!-- Cubes will be positioned absolutely -->
|
| 128 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(150px) rotate(15deg); opacity: 0; transition-delay: 0.1s;">Where</div>
|
| 129 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(-150px) rotate(-15deg); opacity: 0; transition-delay: 0.2s;">is</div>
|
| 130 |
+
<div class="cube absolute w-20 h-20 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateY(80px) rotate(10deg); opacity: 0; transition-delay: 0.3s;">the</div>
|
| 131 |
+
<div class="cube absolute w-24 h-24 rounded-lg bg-emerald-100 shadow-sm flex items-center justify-center font-medium text-emerald-700" style="transform: scale(0.3) rotate(30deg); opacity: 0; transition-delay: 0.4s;">library</div>
|
| 132 |
+
<div class="cube absolute w-28 h-28 rounded-lg bg-white shadow-md flex items-center justify-center font-medium" style="transform: scale(0.8); opacity: 0; transition-delay: 0.5s;">Where is the library?</div>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<!-- Card 3 -->
|
| 139 |
+
<div class="card-container">
|
| 140 |
+
<div class="card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer">
|
| 141 |
+
<div class="flex flex-col md:flex-row">
|
| 142 |
+
<!-- Left side - Original text -->
|
| 143 |
+
<div class="original-text p-6 md:w-1/2 flex flex-col">
|
| 144 |
+
<div class="flex items-center justify-between mb-4">
|
| 145 |
+
<span class="text-sm font-medium text-amber-600 bg-amber-50 px-3 py-1 rounded-full">French</span>
|
| 146 |
+
<button class="audio-btn bg-amber-100 p-2 rounded-full text-amber-700 hover:bg-amber-200">
|
| 147 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 148 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" />
|
| 149 |
+
</svg>
|
| 150 |
+
</button>
|
| 151 |
+
</div>
|
| 152 |
+
<p class="text-2xl font-medium text-gray-800 mb-4">Je voudrais un café, s'il vous plaît.</p>
|
| 153 |
+
<div class="mt-auto flex items-center text-sm text-gray-500">
|
| 154 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 155 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
| 156 |
+
</svg>
|
| 157 |
+
Added 3 days ago
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<!-- Right side - Cubes -->
|
| 162 |
+
<div class="p-6 md:w-1/2 flex flex-wrap justify-between items-center relative overflow-hidden" style="min-height: 180px;">
|
| 163 |
+
<!-- Cubes will be positioned absolutely -->
|
| 164 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(180px) translateY(-50px); opacity: 0; transition-delay: 0.1s;">I would</div>
|
| 165 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(-180px) translateY(50px); opacity: 0; transition-delay: 0.2s;">like</div>
|
| 166 |
+
<div class="cube absolute w-20 h-20 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(100px) translateY(100px); opacity: 0; transition-delay: 0.3s;">a coffee</div>
|
| 167 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(-100px) translateY(-100px); opacity: 0; transition-delay: 0.4s;">please</div>
|
| 168 |
+
<div class="cube absolute w-28 h-28 rounded-lg bg-amber-100 shadow-sm flex items-center justify-center font-medium text-amber-700" style="transform: scale(0.6); opacity: 0; transition-delay: 0.5s;">I would like a coffee, please</div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- Card 4 -->
|
| 175 |
+
<div class="card-container">
|
| 176 |
+
<div class="card bg-white rounded-xl shadow-md overflow-hidden cursor-pointer">
|
| 177 |
+
<div class="flex flex-col md:flex-row">
|
| 178 |
+
<!-- Left side - Original text -->
|
| 179 |
+
<div class="original-text p-6 md:w-1/2 flex flex-col">
|
| 180 |
+
<div class="flex items-center justify-between mb-4">
|
| 181 |
+
<span class="text-sm font-medium text-purple-600 bg-purple-50 px-3 py-1 rounded-full">German</span>
|
| 182 |
+
<button class="audio-btn bg-purple-100 p-2 rounded-full text-purple-700 hover:bg-purple-200">
|
| 183 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 184 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" />
|
| 185 |
+
</svg>
|
| 186 |
+
</button>
|
| 187 |
+
</div>
|
| 188 |
+
<p class="text-2xl font-medium text-gray-800 mb-4">Wie spät ist es?</p>
|
| 189 |
+
<div class="mt-auto flex items-center text-sm text-gray-500">
|
| 190 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 191 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
| 192 |
+
</svg>
|
| 193 |
+
Added yesterday
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
|
| 197 |
+
<!-- Right side - Cubes -->
|
| 198 |
+
<div class="p-6 md:w-1/2 flex flex-wrap justify-between items-center relative overflow-hidden" style="min-height: 180px;">
|
| 199 |
+
<!-- Cubes will be positioned absolutely -->
|
| 200 |
+
<div class="cube absolute w-20 h-20 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(120px) rotate(45deg); opacity: 0; transition-delay: 0.1s;">What</div>
|
| 201 |
+
<div class="cube absolute w-20 h-20 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateX(-120px) rotate(-45deg); opacity: 0; transition-delay: 0.2s;">time</div>
|
| 202 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateY(120px); opacity: 0; transition-delay: 0.3s;">is</div>
|
| 203 |
+
<div class="cube absolute w-16 h-16 rounded-lg shadow-sm flex items-center justify-center text-sm font-medium" style="transform: translateY(-120px); opacity: 0; transition-delay: 0.4s;">it</div>
|
| 204 |
+
<div class="cube absolute w-24 h-24 rounded-lg bg-purple-100 shadow-sm flex items-center justify-center font-medium text-purple-700" style="transform: scale(0.4); opacity: 0; transition-delay: 0.5s;">What time is it?</div>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<script>
|
| 213 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 214 |
+
const cards = document.querySelectorAll('.card');
|
| 215 |
+
|
| 216 |
+
function scatterCubes(cubes, container) {
|
| 217 |
+
const containerRect = container.getBoundingClientRect();
|
| 218 |
+
cubes.forEach(cube => {
|
| 219 |
+
const maxX = containerRect.width - cube.offsetWidth;
|
| 220 |
+
const maxY = containerRect.height - cube.offsetHeight;
|
| 221 |
+
const angle = Math.random() * 2 * Math.PI;
|
| 222 |
+
const distance = Math.random() * 60;
|
| 223 |
+
|
| 224 |
+
const x = Math.cos(angle) * distance + (Math.random() * maxX * 0.5);
|
| 225 |
+
const y = Math.sin(angle) * distance + (Math.random() * maxY * 0.5);
|
| 226 |
+
const rot = (Math.random() - 0.5) * 40;
|
| 227 |
+
const scale = 0.95 + Math.random() * 0.1;
|
| 228 |
+
|
| 229 |
+
cube.style.transition = 'all 0.8s ease-in-out';
|
| 230 |
+
cube.style.left = `${x}px`;
|
| 231 |
+
cube.style.top = `${y}px`;
|
| 232 |
+
cube.style.transform = `rotate(${rot}deg) scale(${scale})`;
|
| 233 |
+
cube.style.opacity = '0.8';
|
| 234 |
+
});
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
function arrangeCubes(cubes, container) {
|
| 238 |
+
const containerRect = container.getBoundingClientRect();
|
| 239 |
+
const cols = 4;
|
| 240 |
+
const cubeSize = 24;
|
| 241 |
+
const padding = 8;
|
| 242 |
+
const totalWidth = (cols * (cubeSize + padding)) - padding;
|
| 243 |
+
const startX = (containerRect.width - totalWidth) / 2;
|
| 244 |
+
|
| 245 |
+
cubes.forEach((cube, index) => {
|
| 246 |
+
const row = Math.floor(index / cols);
|
| 247 |
+
const col = index % cols;
|
| 248 |
+
const x = startX + (col * (cubeSize + padding));
|
| 249 |
+
const y = 20 + (row * (cubeSize + padding));
|
| 250 |
+
|
| 251 |
+
cube.style.transition = `all 0.8s ease-in-out ${index * 50}ms`;
|
| 252 |
+
cube.style.left = `${x}px`;
|
| 253 |
+
cube.style.top = `${y}px`;
|
| 254 |
+
cube.style.transform = 'rotate(0deg) scale(1)';
|
| 255 |
+
cube.style.opacity = '1';
|
| 256 |
+
});
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
cards.forEach(card => {
|
| 260 |
+
const cubes = card.querySelectorAll('.cube');
|
| 261 |
+
const container = card.querySelector('.cube-container') || card.querySelector('[class*="cube-container"], [class*="relative"]');
|
| 262 |
+
|
| 263 |
+
// Initial scatter
|
| 264 |
+
scatterCubes(cubes, container);
|
| 265 |
+
|
| 266 |
+
card.addEventListener('click', function () {
|
| 267 |
+
const isExpanded = this.classList.toggle('card-expanded');
|
| 268 |
+
if (isExpanded) {
|
| 269 |
+
arrangeCubes(cubes, container);
|
| 270 |
+
} else {
|
| 271 |
+
scatterCubes(cubes, container);
|
| 272 |
+
}
|
| 273 |
+
});
|
| 274 |
+
});
|
| 275 |
+
|
| 276 |
+
// Audio button functionality
|
| 277 |
+
const audioButtons = document.querySelectorAll('.audio-btn');
|
| 278 |
+
audioButtons.forEach(button => {
|
| 279 |
+
button.addEventListener('click', function (e) {
|
| 280 |
+
e.stopPropagation(); // Prevent triggering card
|
| 281 |
+
console.log('Playing audio for this sentence');
|
| 282 |
+
this.classList.add('animate-ping');
|
| 283 |
+
setTimeout(() => this.classList.remove('animate-ping'), 300);
|
| 284 |
+
});
|
| 285 |
+
});
|
| 286 |
+
});
|
| 287 |
+
</script>
|
| 288 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ArthurZ/flash-card" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 289 |
+
</html>
|