Add 1 files
Browse files- index.html +336 -122
index.html
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
9 |
-
<
|
10 |
<style>
|
11 |
.target-container {
|
12 |
position: relative;
|
@@ -15,12 +15,14 @@
|
|
15 |
border-radius: 50%;
|
16 |
overflow: visible;
|
17 |
touch-action: none;
|
|
|
18 |
}
|
19 |
|
20 |
.circle {
|
21 |
position: absolute;
|
22 |
border-radius: 50%;
|
23 |
z-index: 1;
|
|
|
24 |
}
|
25 |
|
26 |
.circle1 { background-color: #fecaca; width: 8%; height: 8%; top: 46%; left: 46%; }
|
@@ -31,29 +33,33 @@
|
|
31 |
|
32 |
.label {
|
33 |
position: absolute;
|
34 |
-
font-weight:
|
35 |
-
font-size: 0.
|
36 |
-
color: #
|
37 |
cursor: move;
|
38 |
user-select: none;
|
39 |
white-space: nowrap;
|
40 |
z-index: 7;
|
41 |
-
padding: 0.
|
42 |
-
background-color: rgba(255, 255, 255, 0.
|
43 |
-
border-radius:
|
44 |
transition: all 0.2s ease;
|
45 |
-
box-shadow: 0
|
|
|
46 |
}
|
47 |
|
48 |
.label:hover {
|
49 |
transform: scale(1.05);
|
50 |
-
|
|
|
51 |
}
|
52 |
|
53 |
.label.selected {
|
54 |
background-color: #3b82f6;
|
55 |
color: white;
|
56 |
transform: scale(1.1);
|
|
|
|
|
57 |
}
|
58 |
|
59 |
#canvas {
|
@@ -68,19 +74,27 @@
|
|
68 |
|
69 |
.note-input {
|
70 |
resize: none;
|
71 |
-
font-size: 0.
|
72 |
text-align: center;
|
73 |
background-color: transparent;
|
74 |
border: none;
|
75 |
outline: none;
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
.note-input::placeholder {
|
79 |
-
color: #
|
|
|
80 |
}
|
81 |
|
82 |
.action-btn {
|
83 |
transition: all 0.2s ease;
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
.action-btn:hover {
|
@@ -91,35 +105,110 @@
|
|
91 |
transform: translateY(1px);
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
@media (max-width: 640px) {
|
95 |
.label {
|
96 |
-
font-size: 0.65rem;
|
97 |
-
padding: 0.15rem 0.3rem;
|
98 |
-
}
|
99 |
-
|
100 |
-
.note-input {
|
101 |
font-size: 0.75rem;
|
|
|
102 |
}
|
103 |
|
104 |
-
.
|
105 |
-
|
106 |
}
|
107 |
|
108 |
.action-btn {
|
109 |
padding: 0.5rem;
|
110 |
font-size: 0.8rem;
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
</style>
|
114 |
</head>
|
115 |
-
<body class="bg-gray-50 min-h-screen flex flex-col items-center justify-center p-4">
|
116 |
-
<div class="w-full max-w-
|
117 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
<textarea id="userNotes" class="note-input w-full
|
120 |
-
placeholder="
|
121 |
|
122 |
-
<div class="target-container
|
123 |
<canvas id="canvas"></canvas>
|
124 |
<div class="circle circle5"></div>
|
125 |
<div class="circle circle4"></div>
|
@@ -128,42 +217,91 @@
|
|
128 |
<div class="circle circle1"></div>
|
129 |
</div>
|
130 |
|
131 |
-
<div class="grid grid-cols-2 gap-3">
|
132 |
<input type="text" id="newKeyword" placeholder="Nouveau mot"
|
133 |
-
class="col-span-2 p-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
134 |
-
|
135 |
-
<div class="flex space-x-2">
|
136 |
-
<input type="text" id="editKeyword" placeholder="Modifier"
|
137 |
-
class="flex-1 p-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
138 |
-
<button onclick="updateKeyword()" class="action-btn bg-blue-500 text-white px-3 py-2 rounded-lg hover:bg-blue-600">
|
139 |
-
Modifier
|
140 |
-
</button>
|
141 |
-
</div>
|
142 |
-
|
143 |
-
<button onclick="deleteKeyword()" class="action-btn bg-red-500 text-white py-2 rounded-lg hover:bg-red-600">
|
144 |
-
Supprimer
|
145 |
-
</button>
|
146 |
|
147 |
<button onclick="addKeyword()" class="action-btn bg-green-500 text-white py-2 rounded-lg hover:bg-green-600">
|
148 |
-
|
|
|
149 |
</button>
|
|
|
|
|
|
|
|
|
150 |
|
151 |
-
<
|
152 |
-
|
153 |
-
|
|
|
154 |
|
155 |
-
<
|
156 |
-
|
157 |
-
|
|
|
158 |
|
159 |
-
<
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
<button onclick="
|
164 |
-
|
165 |
</button>
|
166 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
</div>
|
168 |
|
169 |
<script>
|
@@ -171,16 +309,16 @@
|
|
171 |
const { jsPDF } = window.jspdf;
|
172 |
|
173 |
let keywords = [
|
174 |
-
{ text: "Identification", x: null, y: null },
|
175 |
-
{ text: "Gestion", x: null, y: null },
|
176 |
-
{ text: "Adaptation", x: null, y: null },
|
177 |
-
{ text: "Autonomie", x: null, y: null },
|
178 |
-
{ text: "Connaissance", x: null, y: null },
|
179 |
-
{ text: "Prévention", x: null, y: null },
|
180 |
-
{ text: "Équilibre", x: null, y: null },
|
181 |
-
{ text: "Stratégies", x: null, y: null },
|
182 |
-
{ text: "Motivation", x: null, y: null },
|
183 |
-
{ text: "Recours", x: null, y: null }
|
184 |
];
|
185 |
|
186 |
let selectedKeywordIndex = null;
|
@@ -188,9 +326,13 @@
|
|
188 |
let dragStartX, dragStartY;
|
189 |
let draggedLabel = null;
|
190 |
let draggedIndex = null;
|
|
|
|
|
|
|
191 |
|
192 |
const canvas = document.getElementById('canvas');
|
193 |
const ctx = canvas.getContext('2d');
|
|
|
194 |
|
195 |
function renderKeywords() {
|
196 |
const container = document.getElementById('target-container');
|
@@ -208,6 +350,12 @@
|
|
208 |
label.textContent = word.text;
|
209 |
label.dataset.index = index;
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
// Calculate position if not set
|
212 |
if (word.x === null || word.y === null) {
|
213 |
const angleStep = (2 * Math.PI) / keywords.length;
|
@@ -223,6 +371,11 @@
|
|
223 |
startDrag(e, label, index);
|
224 |
});
|
225 |
|
|
|
|
|
|
|
|
|
|
|
226 |
label.addEventListener('touchstart', (e) => {
|
227 |
e.preventDefault();
|
228 |
const touch = e.touches[0];
|
@@ -263,9 +416,11 @@
|
|
263 |
}
|
264 |
|
265 |
function startDrag(e, label, index) {
|
|
|
|
|
|
|
266 |
// Toggle selection if clicking on same label
|
267 |
if (selectedKeywordIndex === index) {
|
268 |
-
deselectKeyword();
|
269 |
return;
|
270 |
}
|
271 |
|
@@ -336,7 +491,6 @@
|
|
336 |
|
337 |
function selectKeyword(index) {
|
338 |
selectedKeywordIndex = index;
|
339 |
-
document.getElementById('editKeyword').value = keywords[index].text;
|
340 |
|
341 |
// Update UI
|
342 |
document.querySelectorAll('.label').forEach(label => {
|
@@ -347,16 +501,22 @@
|
|
347 |
if (selectedLabel) {
|
348 |
selectedLabel.classList.add('selected');
|
349 |
}
|
|
|
|
|
|
|
350 |
}
|
351 |
|
352 |
function deselectKeyword() {
|
353 |
selectedKeywordIndex = null;
|
354 |
-
document.getElementById('editKeyword').value = '';
|
355 |
|
356 |
// Update UI
|
357 |
document.querySelectorAll('.label').forEach(label => {
|
358 |
label.classList.remove('selected');
|
359 |
});
|
|
|
|
|
|
|
|
|
360 |
}
|
361 |
|
362 |
function resizeCanvas() {
|
@@ -372,9 +532,17 @@
|
|
372 |
if (keywords.length < 2) return;
|
373 |
|
374 |
ctx.beginPath();
|
375 |
-
ctx.strokeStyle =
|
376 |
-
ctx.lineWidth =
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
|
379 |
const labels = document.querySelectorAll('.label');
|
380 |
const positions = [];
|
@@ -407,84 +575,117 @@
|
|
407 |
const text = input.value.trim();
|
408 |
|
409 |
if (text) {
|
410 |
-
keywords.push({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
input.value = '';
|
412 |
renderKeywords();
|
413 |
}
|
414 |
}
|
415 |
|
416 |
-
function
|
417 |
-
|
418 |
-
const text = input.value.trim();
|
419 |
|
420 |
-
|
421 |
-
|
|
|
422 |
renderKeywords();
|
423 |
selectKeyword(selectedKeywordIndex);
|
424 |
}
|
|
|
|
|
425 |
}
|
426 |
|
427 |
-
function
|
428 |
-
if (selectedKeywordIndex
|
|
|
|
|
429 |
keywords.splice(selectedKeywordIndex, 1);
|
430 |
deselectKeyword();
|
431 |
renderKeywords();
|
432 |
}
|
|
|
|
|
433 |
}
|
434 |
|
435 |
function resetKeywords() {
|
436 |
-
|
437 |
-
word
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
});
|
440 |
-
|
441 |
-
|
|
|
442 |
}
|
443 |
|
444 |
-
|
445 |
-
|
446 |
-
buttons.forEach(btn => btn.style.visibility = 'hidden');
|
447 |
|
448 |
-
const
|
449 |
-
const originalStyles = {
|
450 |
-
textAlign: note.style.textAlign,
|
451 |
-
fontSize: note.style.fontSize,
|
452 |
-
fontWeight: note.style.fontWeight,
|
453 |
-
backgroundColor: note.style.backgroundColor,
|
454 |
-
border: note.style.border,
|
455 |
-
boxShadow: note.style.boxShadow
|
456 |
-
};
|
457 |
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
note.style.boxShadow = 'none';
|
464 |
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
});
|
472 |
-
|
473 |
-
const link = document.createElement('a');
|
474 |
-
link.download = `etoile_mots_${new Date().toISOString().split('T')[0]}.png`;
|
475 |
-
link.href = canvas.toDataURL('image/png');
|
476 |
-
document.body.appendChild(link);
|
477 |
-
link.click();
|
478 |
-
document.body.removeChild(link);
|
479 |
-
} catch (err) {
|
480 |
-
console.error("Erreur lors de l'export:", err);
|
481 |
-
} finally {
|
482 |
-
buttons.forEach(btn => btn.style.visibility = 'visible');
|
483 |
-
|
484 |
-
Object.keys(originalStyles).forEach(style => {
|
485 |
-
note.style[style] = originalStyles[style];
|
486 |
-
});
|
487 |
-
}
|
488 |
}
|
489 |
|
490 |
async function saveAsPDF() {
|
@@ -509,7 +710,7 @@
|
|
509 |
note.style.boxShadow = 'none';
|
510 |
|
511 |
try {
|
512 |
-
const canvas = await html2canvas(document.querySelector('.w-full.max-w-
|
513 |
scale: 2,
|
514 |
backgroundColor: '#f9fafb',
|
515 |
useCORS: true,
|
@@ -529,6 +730,7 @@
|
|
529 |
pdf.save(`etoile_mots_${new Date().toISOString().split('T')[0]}.pdf`);
|
530 |
} catch (err) {
|
531 |
console.error("Erreur lors de l'export PDF:", err);
|
|
|
532 |
} finally {
|
533 |
buttons.forEach(btn => btn.style.visibility = 'visible');
|
534 |
|
@@ -550,6 +752,18 @@
|
|
550 |
renderKeywords();
|
551 |
}, 200);
|
552 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
});
|
554 |
</script>
|
555 |
<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=PierreH/star" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Étoile de Mots Interactive</title>
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
10 |
<style>
|
11 |
.target-container {
|
12 |
position: relative;
|
|
|
15 |
border-radius: 50%;
|
16 |
overflow: visible;
|
17 |
touch-action: none;
|
18 |
+
background: radial-gradient(circle, #f8fafc 0%, #e2e8f0 100%);
|
19 |
}
|
20 |
|
21 |
.circle {
|
22 |
position: absolute;
|
23 |
border-radius: 50%;
|
24 |
z-index: 1;
|
25 |
+
opacity: 0.7;
|
26 |
}
|
27 |
|
28 |
.circle1 { background-color: #fecaca; width: 8%; height: 8%; top: 46%; left: 46%; }
|
|
|
33 |
|
34 |
.label {
|
35 |
position: absolute;
|
36 |
+
font-weight: 500;
|
37 |
+
font-size: 0.85rem;
|
38 |
+
color: #1e293b;
|
39 |
cursor: move;
|
40 |
user-select: none;
|
41 |
white-space: nowrap;
|
42 |
z-index: 7;
|
43 |
+
padding: 0.35rem 0.7rem;
|
44 |
+
background-color: rgba(255, 255, 255, 0.9);
|
45 |
+
border-radius: 1rem;
|
46 |
transition: all 0.2s ease;
|
47 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
48 |
+
border: 1px solid rgba(0,0,0,0.05);
|
49 |
}
|
50 |
|
51 |
.label:hover {
|
52 |
transform: scale(1.05);
|
53 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.15);
|
54 |
+
z-index: 10;
|
55 |
}
|
56 |
|
57 |
.label.selected {
|
58 |
background-color: #3b82f6;
|
59 |
color: white;
|
60 |
transform: scale(1.1);
|
61 |
+
box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
|
62 |
+
z-index: 10;
|
63 |
}
|
64 |
|
65 |
#canvas {
|
|
|
74 |
|
75 |
.note-input {
|
76 |
resize: none;
|
77 |
+
font-size: 0.9rem;
|
78 |
text-align: center;
|
79 |
background-color: transparent;
|
80 |
border: none;
|
81 |
outline: none;
|
82 |
+
padding: 0.5rem;
|
83 |
+
border-radius: 0.5rem;
|
84 |
+
background-color: rgba(255,255,255,0.7);
|
85 |
}
|
86 |
|
87 |
.note-input::placeholder {
|
88 |
+
color: #94a3b8;
|
89 |
+
font-style: italic;
|
90 |
}
|
91 |
|
92 |
.action-btn {
|
93 |
transition: all 0.2s ease;
|
94 |
+
display: flex;
|
95 |
+
align-items: center;
|
96 |
+
justify-content: center;
|
97 |
+
gap: 0.5rem;
|
98 |
}
|
99 |
|
100 |
.action-btn:hover {
|
|
|
105 |
transform: translateY(1px);
|
106 |
}
|
107 |
|
108 |
+
.context-menu {
|
109 |
+
position: absolute;
|
110 |
+
background: white;
|
111 |
+
border-radius: 0.5rem;
|
112 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
113 |
+
z-index: 100;
|
114 |
+
min-width: 180px;
|
115 |
+
overflow: hidden;
|
116 |
+
display: none;
|
117 |
+
}
|
118 |
+
|
119 |
+
.context-menu-item {
|
120 |
+
padding: 0.5rem 1rem;
|
121 |
+
cursor: pointer;
|
122 |
+
display: flex;
|
123 |
+
align-items: center;
|
124 |
+
gap: 0.5rem;
|
125 |
+
font-size: 0.85rem;
|
126 |
+
}
|
127 |
+
|
128 |
+
.context-menu-item:hover {
|
129 |
+
background-color: #f1f5f9;
|
130 |
+
}
|
131 |
+
|
132 |
+
.style-editor {
|
133 |
+
background: white;
|
134 |
+
border-radius: 0.75rem;
|
135 |
+
box-shadow: 0 4px 16px rgba(0,0,0,0.1);
|
136 |
+
padding: 1rem;
|
137 |
+
margin-top: 1rem;
|
138 |
+
}
|
139 |
+
|
140 |
+
.style-option {
|
141 |
+
display: flex;
|
142 |
+
align-items: center;
|
143 |
+
justify-content: space-between;
|
144 |
+
margin-bottom: 0.75rem;
|
145 |
+
}
|
146 |
+
|
147 |
+
.color-option {
|
148 |
+
width: 24px;
|
149 |
+
height: 24px;
|
150 |
+
border-radius: 50%;
|
151 |
+
cursor: pointer;
|
152 |
+
border: 2px solid transparent;
|
153 |
+
}
|
154 |
+
|
155 |
+
.color-option.selected {
|
156 |
+
border-color: #1e293b;
|
157 |
+
}
|
158 |
+
|
159 |
+
.color-palette {
|
160 |
+
display: flex;
|
161 |
+
gap: 0.5rem;
|
162 |
+
flex-wrap: wrap;
|
163 |
+
}
|
164 |
+
|
165 |
@media (max-width: 640px) {
|
166 |
.label {
|
|
|
|
|
|
|
|
|
|
|
167 |
font-size: 0.75rem;
|
168 |
+
padding: 0.25rem 0.5rem;
|
169 |
}
|
170 |
|
171 |
+
.note-input {
|
172 |
+
font-size: 0.8rem;
|
173 |
}
|
174 |
|
175 |
.action-btn {
|
176 |
padding: 0.5rem;
|
177 |
font-size: 0.8rem;
|
178 |
}
|
179 |
+
|
180 |
+
.context-menu {
|
181 |
+
min-width: 160px;
|
182 |
+
}
|
183 |
+
|
184 |
+
.mobile-hidden {
|
185 |
+
display: none;
|
186 |
+
}
|
187 |
}
|
188 |
</style>
|
189 |
</head>
|
190 |
+
<body class="bg-gradient-to-br from-gray-50 to-gray-100 min-h-screen flex flex-col items-center justify-center p-4">
|
191 |
+
<div class="w-full max-w-2xl bg-white rounded-xl shadow-lg p-6 space-y-6">
|
192 |
+
<div class="flex justify-between items-center">
|
193 |
+
<h1 class="text-2xl font-bold text-center text-gray-800">
|
194 |
+
<i class="fas fa-star text-yellow-400 mr-2"></i>Étoile de Mots
|
195 |
+
</h1>
|
196 |
+
<div class="flex gap-2">
|
197 |
+
<button onclick="saveAsPDF()" class="action-btn bg-indigo-500 text-white px-4 py-2 rounded-lg hover:bg-indigo-600">
|
198 |
+
<i class="fas fa-file-pdf"></i>
|
199 |
+
<span class="mobile-hidden">PDF</span>
|
200 |
+
</button>
|
201 |
+
<button onclick="resetKeywords()" class="action-btn bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600">
|
202 |
+
<i class="fas fa-redo"></i>
|
203 |
+
<span class="mobile-hidden">Réinit.</span>
|
204 |
+
</button>
|
205 |
+
</div>
|
206 |
+
</div>
|
207 |
|
208 |
+
<textarea id="userNotes" class="note-input w-full"
|
209 |
+
placeholder="Titre, notes ou objectifs... ✍️" rows="2"></textarea>
|
210 |
|
211 |
+
<div class="target-container shadow-inner" id="target-container">
|
212 |
<canvas id="canvas"></canvas>
|
213 |
<div class="circle circle5"></div>
|
214 |
<div class="circle circle4"></div>
|
|
|
217 |
<div class="circle circle1"></div>
|
218 |
</div>
|
219 |
|
220 |
+
<div class="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
221 |
<input type="text" id="newKeyword" placeholder="Nouveau mot"
|
222 |
+
class="col-span-2 sm:col-span-1 p-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
<button onclick="addKeyword()" class="action-btn bg-green-500 text-white py-2 rounded-lg hover:bg-green-600">
|
225 |
+
<i class="fas fa-plus"></i>
|
226 |
+
<span>Ajouter</span>
|
227 |
</button>
|
228 |
+
</div>
|
229 |
+
|
230 |
+
<div class="style-editor" id="styleEditor" style="display: none;">
|
231 |
+
<h3 class="font-medium text-gray-700 mb-3">Style du mot sélectionné</h3>
|
232 |
|
233 |
+
<div class="style-option">
|
234 |
+
<span>Couleur du texte:</span>
|
235 |
+
<input type="color" id="textColor" value="#1e293b" class="w-8 h-8">
|
236 |
+
</div>
|
237 |
|
238 |
+
<div class="style-option">
|
239 |
+
<span>Couleur de fond:</span>
|
240 |
+
<input type="color" id="bgColor" value="#ffffff" class="w-8 h-8">
|
241 |
+
</div>
|
242 |
|
243 |
+
<div class="style-option">
|
244 |
+
<span>Taille de police:</span>
|
245 |
+
<select id="fontSize" class="border rounded p-1">
|
246 |
+
<option value="0.75rem">Petit</option>
|
247 |
+
<option value="0.85rem" selected>Moyen</option>
|
248 |
+
<option value="1rem">Grand</option>
|
249 |
+
</select>
|
250 |
+
</div>
|
251 |
+
|
252 |
+
<div class="style-option">
|
253 |
+
<span>Style de police:</span>
|
254 |
+
<select id="fontWeight" class="border rounded p-1">
|
255 |
+
<option value="400">Normal</option>
|
256 |
+
<option value="500" selected>Medium</option>
|
257 |
+
<option value="600">Gras</option>
|
258 |
+
</select>
|
259 |
+
</div>
|
260 |
+
|
261 |
+
<div class="mt-4">
|
262 |
+
<span class="block mb-2">Style des liens:</span>
|
263 |
+
<div class="color-palette">
|
264 |
+
<div class="color-option bg-blue-500 selected" data-color="#3b82f6" onclick="selectLineColor(this)"></div>
|
265 |
+
<div class="color-option bg-red-500" data-color="#ef4444" onclick="selectLineColor(this)"></div>
|
266 |
+
<div class="color-option bg-green-500" data-color="#10b981" onclick="selectLineColor(this)"></div>
|
267 |
+
<div class="color-option bg-purple-500" data-color="#8b5cf6" onclick="selectLineColor(this)"></div>
|
268 |
+
<div class="color-option bg-pink-500" data-color="#ec4899" onclick="selectLineColor(this)"></div>
|
269 |
+
</div>
|
270 |
+
|
271 |
+
<div class="mt-3">
|
272 |
+
<span class="block mb-1">Épaisseur:</span>
|
273 |
+
<input type="range" id="lineWidth" min="1" max="5" value="1" class="w-full">
|
274 |
+
</div>
|
275 |
+
|
276 |
+
<div class="mt-3">
|
277 |
+
<span class="block mb-1">Style:</span>
|
278 |
+
<select id="lineStyle" class="border rounded p-1 w-full">
|
279 |
+
<option value="solid">Continue</option>
|
280 |
+
<option value="dashed">Pointillés</option>
|
281 |
+
<option value="dotted">Pointillés fins</option>
|
282 |
+
</select>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
|
286 |
+
<button onclick="applyStyles()" class="mt-4 w-full bg-blue-500 text-white py-2 rounded-lg hover:bg-blue-600">
|
287 |
+
Appliquer
|
288 |
</button>
|
289 |
</div>
|
290 |
+
|
291 |
+
<div class="context-menu" id="contextMenu">
|
292 |
+
<div class="context-menu-item" onclick="editSelectedKeyword()">
|
293 |
+
<i class="fas fa-edit text-blue-500"></i> Modifier
|
294 |
+
</div>
|
295 |
+
<div class="context-menu-item" onclick="deleteSelectedKeyword()">
|
296 |
+
<i class="fas fa-trash text-red-500"></i> Supprimer
|
297 |
+
</div>
|
298 |
+
<div class="context-menu-item" onclick="deselectKeyword()">
|
299 |
+
<i class="fas fa-times-circle text-gray-500"></i> Désélectionner
|
300 |
+
</div>
|
301 |
+
<div class="context-menu-item" onclick="showStyleEditor()">
|
302 |
+
<i class="fas fa-paint-brush text-purple-500"></i> Style
|
303 |
+
</div>
|
304 |
+
</div>
|
305 |
</div>
|
306 |
|
307 |
<script>
|
|
|
309 |
const { jsPDF } = window.jspdf;
|
310 |
|
311 |
let keywords = [
|
312 |
+
{ text: "Identification", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
313 |
+
{ text: "Gestion", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
314 |
+
{ text: "Adaptation", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
315 |
+
{ text: "Autonomie", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
316 |
+
{ text: "Connaissance", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
317 |
+
{ text: "Prévention", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
318 |
+
{ text: "Équilibre", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
319 |
+
{ text: "Stratégies", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
320 |
+
{ text: "Motivation", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" },
|
321 |
+
{ text: "Recours", x: null, y: null, color: "#1e293b", bgColor: "#ffffff", fontSize: "0.85rem", fontWeight: "500" }
|
322 |
];
|
323 |
|
324 |
let selectedKeywordIndex = null;
|
|
|
326 |
let dragStartX, dragStartY;
|
327 |
let draggedLabel = null;
|
328 |
let draggedIndex = null;
|
329 |
+
let lineColor = "#3b82f6";
|
330 |
+
let lineWidth = 1;
|
331 |
+
let lineStyle = "solid";
|
332 |
|
333 |
const canvas = document.getElementById('canvas');
|
334 |
const ctx = canvas.getContext('2d');
|
335 |
+
const contextMenu = document.getElementById('contextMenu');
|
336 |
|
337 |
function renderKeywords() {
|
338 |
const container = document.getElementById('target-container');
|
|
|
350 |
label.textContent = word.text;
|
351 |
label.dataset.index = index;
|
352 |
|
353 |
+
// Apply custom styles
|
354 |
+
label.style.color = word.color;
|
355 |
+
label.style.backgroundColor = word.bgColor;
|
356 |
+
label.style.fontSize = word.fontSize;
|
357 |
+
label.style.fontWeight = word.fontWeight;
|
358 |
+
|
359 |
// Calculate position if not set
|
360 |
if (word.x === null || word.y === null) {
|
361 |
const angleStep = (2 * Math.PI) / keywords.length;
|
|
|
371 |
startDrag(e, label, index);
|
372 |
});
|
373 |
|
374 |
+
label.addEventListener('contextmenu', (e) => {
|
375 |
+
e.preventDefault();
|
376 |
+
showContextMenu(e, index);
|
377 |
+
});
|
378 |
+
|
379 |
label.addEventListener('touchstart', (e) => {
|
380 |
e.preventDefault();
|
381 |
const touch = e.touches[0];
|
|
|
416 |
}
|
417 |
|
418 |
function startDrag(e, label, index) {
|
419 |
+
// Prevent context menu on drag
|
420 |
+
if (e.button === 2) return;
|
421 |
+
|
422 |
// Toggle selection if clicking on same label
|
423 |
if (selectedKeywordIndex === index) {
|
|
|
424 |
return;
|
425 |
}
|
426 |
|
|
|
491 |
|
492 |
function selectKeyword(index) {
|
493 |
selectedKeywordIndex = index;
|
|
|
494 |
|
495 |
// Update UI
|
496 |
document.querySelectorAll('.label').forEach(label => {
|
|
|
501 |
if (selectedLabel) {
|
502 |
selectedLabel.classList.add('selected');
|
503 |
}
|
504 |
+
|
505 |
+
// Hide style editor when selecting new keyword
|
506 |
+
document.getElementById('styleEditor').style.display = 'none';
|
507 |
}
|
508 |
|
509 |
function deselectKeyword() {
|
510 |
selectedKeywordIndex = null;
|
|
|
511 |
|
512 |
// Update UI
|
513 |
document.querySelectorAll('.label').forEach(label => {
|
514 |
label.classList.remove('selected');
|
515 |
});
|
516 |
+
|
517 |
+
// Hide context menu and style editor
|
518 |
+
contextMenu.style.display = 'none';
|
519 |
+
document.getElementById('styleEditor').style.display = 'none';
|
520 |
}
|
521 |
|
522 |
function resizeCanvas() {
|
|
|
532 |
if (keywords.length < 2) return;
|
533 |
|
534 |
ctx.beginPath();
|
535 |
+
ctx.strokeStyle = lineColor;
|
536 |
+
ctx.lineWidth = lineWidth;
|
537 |
+
|
538 |
+
// Set line style
|
539 |
+
if (lineStyle === "dashed") {
|
540 |
+
ctx.setLineDash([5, 3]);
|
541 |
+
} else if (lineStyle === "dotted") {
|
542 |
+
ctx.setLineDash([2, 2]);
|
543 |
+
} else {
|
544 |
+
ctx.setLineDash([]);
|
545 |
+
}
|
546 |
|
547 |
const labels = document.querySelectorAll('.label');
|
548 |
const positions = [];
|
|
|
575 |
const text = input.value.trim();
|
576 |
|
577 |
if (text) {
|
578 |
+
keywords.push({
|
579 |
+
text: text,
|
580 |
+
x: null,
|
581 |
+
y: null,
|
582 |
+
color: "#1e293b",
|
583 |
+
bgColor: "#ffffff",
|
584 |
+
fontSize: "0.85rem",
|
585 |
+
fontWeight: "500"
|
586 |
+
});
|
587 |
input.value = '';
|
588 |
renderKeywords();
|
589 |
}
|
590 |
}
|
591 |
|
592 |
+
function editSelectedKeyword() {
|
593 |
+
if (selectedKeywordIndex === null) return;
|
|
|
594 |
|
595 |
+
const newText = prompt("Modifier le mot:", keywords[selectedKeywordIndex].text);
|
596 |
+
if (newText !== null && newText.trim() !== "") {
|
597 |
+
keywords[selectedKeywordIndex].text = newText.trim();
|
598 |
renderKeywords();
|
599 |
selectKeyword(selectedKeywordIndex);
|
600 |
}
|
601 |
+
|
602 |
+
contextMenu.style.display = 'none';
|
603 |
}
|
604 |
|
605 |
+
function deleteSelectedKeyword() {
|
606 |
+
if (selectedKeywordIndex === null) return;
|
607 |
+
|
608 |
+
if (confirm("Supprimer ce mot?")) {
|
609 |
keywords.splice(selectedKeywordIndex, 1);
|
610 |
deselectKeyword();
|
611 |
renderKeywords();
|
612 |
}
|
613 |
+
|
614 |
+
contextMenu.style.display = 'none';
|
615 |
}
|
616 |
|
617 |
function resetKeywords() {
|
618 |
+
if (confirm("Réinitialiser tous les mots à leur position par défaut?")) {
|
619 |
+
keywords.forEach(word => {
|
620 |
+
word.x = null;
|
621 |
+
word.y = null;
|
622 |
+
});
|
623 |
+
deselectKeyword();
|
624 |
+
renderKeywords();
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
function showContextMenu(e, index) {
|
629 |
+
e.preventDefault();
|
630 |
+
selectKeyword(index);
|
631 |
+
|
632 |
+
contextMenu.style.display = 'block';
|
633 |
+
contextMenu.style.left = `${e.clientX}px`;
|
634 |
+
contextMenu.style.top = `${e.clientY}px`;
|
635 |
+
|
636 |
+
// Close menu when clicking elsewhere
|
637 |
+
setTimeout(() => {
|
638 |
+
document.addEventListener('click', closeContextMenu);
|
639 |
+
}, 10);
|
640 |
+
}
|
641 |
+
|
642 |
+
function closeContextMenu() {
|
643 |
+
contextMenu.style.display = 'none';
|
644 |
+
document.removeEventListener('click', closeContextMenu);
|
645 |
+
}
|
646 |
+
|
647 |
+
function showStyleEditor() {
|
648 |
+
if (selectedKeywordIndex === null) return;
|
649 |
+
|
650 |
+
const editor = document.getElementById('styleEditor');
|
651 |
+
const keyword = keywords[selectedKeywordIndex];
|
652 |
+
|
653 |
+
// Set current values
|
654 |
+
document.getElementById('textColor').value = keyword.color;
|
655 |
+
document.getElementById('bgColor').value = keyword.bgColor;
|
656 |
+
document.getElementById('fontSize').value = keyword.fontSize;
|
657 |
+
document.getElementById('fontWeight').value = keyword.fontWeight;
|
658 |
+
|
659 |
+
editor.style.display = 'block';
|
660 |
+
contextMenu.style.display = 'none';
|
661 |
+
}
|
662 |
+
|
663 |
+
function selectLineColor(element) {
|
664 |
+
document.querySelectorAll('.color-option').forEach(opt => {
|
665 |
+
opt.classList.remove('selected');
|
666 |
});
|
667 |
+
element.classList.add('selected');
|
668 |
+
lineColor = element.dataset.color;
|
669 |
+
drawLines();
|
670 |
}
|
671 |
|
672 |
+
function applyStyles() {
|
673 |
+
if (selectedKeywordIndex === null) return;
|
|
|
674 |
|
675 |
+
const keyword = keywords[selectedKeywordIndex];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
|
677 |
+
// Update keyword styles
|
678 |
+
keyword.color = document.getElementById('textColor').value;
|
679 |
+
keyword.bgColor = document.getElementById('bgColor').value;
|
680 |
+
keyword.fontSize = document.getElementById('fontSize').value;
|
681 |
+
keyword.fontWeight = document.getElementById('fontWeight').value;
|
|
|
682 |
|
683 |
+
// Update line styles
|
684 |
+
lineWidth = document.getElementById('lineWidth').value;
|
685 |
+
lineStyle = document.getElementById('lineStyle').value;
|
686 |
+
|
687 |
+
renderKeywords();
|
688 |
+
document.getElementById('styleEditor').style.display = 'none';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
}
|
690 |
|
691 |
async function saveAsPDF() {
|
|
|
710 |
note.style.boxShadow = 'none';
|
711 |
|
712 |
try {
|
713 |
+
const canvas = await html2canvas(document.querySelector('.w-full.max-w-2xl'), {
|
714 |
scale: 2,
|
715 |
backgroundColor: '#f9fafb',
|
716 |
useCORS: true,
|
|
|
730 |
pdf.save(`etoile_mots_${new Date().toISOString().split('T')[0]}.pdf`);
|
731 |
} catch (err) {
|
732 |
console.error("Erreur lors de l'export PDF:", err);
|
733 |
+
alert("Une erreur est survenue lors de l'export PDF");
|
734 |
} finally {
|
735 |
buttons.forEach(btn => btn.style.visibility = 'visible');
|
736 |
|
|
|
752 |
renderKeywords();
|
753 |
}, 200);
|
754 |
});
|
755 |
+
|
756 |
+
// Close context menu when clicking outside
|
757 |
+
document.addEventListener('click', (e) => {
|
758 |
+
if (!contextMenu.contains(e.target) && contextMenu.style.display === 'block') {
|
759 |
+
contextMenu.style.display = 'none';
|
760 |
+
}
|
761 |
+
|
762 |
+
if (!document.getElementById('styleEditor').contains(e.target) &&
|
763 |
+
document.getElementById('styleEditor').style.display === 'block') {
|
764 |
+
document.getElementById('styleEditor').style.display = 'none';
|
765 |
+
}
|
766 |
+
});
|
767 |
});
|
768 |
</script>
|
769 |
<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=PierreH/star" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|