Add 2 files
Browse files- README.md +7 -5
- index.html +484 -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: bloc-note
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: yellow
|
| 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,484 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Notorium - Bloc-notes intelligent</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<script>
|
| 10 |
+
tailwind.config = {
|
| 11 |
+
darkMode: 'class',
|
| 12 |
+
theme: {
|
| 13 |
+
extend: {
|
| 14 |
+
colors: {
|
| 15 |
+
dark: {
|
| 16 |
+
900: '#0a0a0a',
|
| 17 |
+
800: '#1a1a1a',
|
| 18 |
+
700: '#2a2a2a',
|
| 19 |
+
600: '#3a3a3a',
|
| 20 |
+
},
|
| 21 |
+
primary: {
|
| 22 |
+
500: '#6366f1',
|
| 23 |
+
600: '#4f46e5',
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
</script>
|
| 30 |
+
<style>
|
| 31 |
+
.note-content {
|
| 32 |
+
min-height: 300px;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
}
|
| 35 |
+
.suggestion-item:hover {
|
| 36 |
+
background-color: rgba(99, 102, 241, 0.2);
|
| 37 |
+
}
|
| 38 |
+
.fade-in {
|
| 39 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 40 |
+
}
|
| 41 |
+
@keyframes fadeIn {
|
| 42 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 43 |
+
to { opacity: 1; transform: translateY(0); }
|
| 44 |
+
}
|
| 45 |
+
.separator {
|
| 46 |
+
border-top: 1px dashed rgba(255,255,255,0.1);
|
| 47 |
+
margin: 1rem 0;
|
| 48 |
+
}
|
| 49 |
+
</style>
|
| 50 |
+
</head>
|
| 51 |
+
<body class="bg-dark-900 text-gray-200 min-h-screen">
|
| 52 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
| 53 |
+
<!-- Header -->
|
| 54 |
+
<header class="flex justify-between items-center mb-8">
|
| 55 |
+
<div class="flex items-center space-x-3">
|
| 56 |
+
<i class="fas fa-book-open text-primary-500 text-2xl"></i>
|
| 57 |
+
<h1 class="text-2xl font-bold">Notorium</h1>
|
| 58 |
+
</div>
|
| 59 |
+
<div class="flex space-x-4">
|
| 60 |
+
<button id="searchBtn" class="p-2 rounded-full hover:bg-dark-700 transition">
|
| 61 |
+
<i class="fas fa-search"></i>
|
| 62 |
+
</button>
|
| 63 |
+
<button id="settingsBtn" class="p-2 rounded-full hover:bg-dark-700 transition">
|
| 64 |
+
<i class="fas fa-cog"></i>
|
| 65 |
+
</button>
|
| 66 |
+
</div>
|
| 67 |
+
</header>
|
| 68 |
+
|
| 69 |
+
<!-- Search Modal -->
|
| 70 |
+
<div id="searchModal" class="hidden fixed inset-0 bg-black bg-opacity-70 z-50 flex items-center justify-center p-4">
|
| 71 |
+
<div class="bg-dark-800 rounded-lg w-full max-w-md p-6">
|
| 72 |
+
<div class="flex justify-between items-center mb-4">
|
| 73 |
+
<h3 class="text-lg font-semibold">Rechercher dans vos notes</h3>
|
| 74 |
+
<button id="closeSearch" class="text-gray-400 hover:text-white">
|
| 75 |
+
<i class="fas fa-times"></i>
|
| 76 |
+
</button>
|
| 77 |
+
</div>
|
| 78 |
+
<input type="text" placeholder="Tapez pour rechercher..." class="w-full bg-dark-700 border border-dark-600 rounded-md px-4 py-2 mb-4 focus:outline-none focus:ring-2 focus:ring-primary-500">
|
| 79 |
+
<div class="flex space-x-2 mb-4">
|
| 80 |
+
<select class="bg-dark-700 border border-dark-600 rounded-md px-3 py-1 text-sm">
|
| 81 |
+
<option>Toutes les dates</option>
|
| 82 |
+
<option>Aujourd'hui</option>
|
| 83 |
+
<option>Cette semaine</option>
|
| 84 |
+
<option>Ce mois</option>
|
| 85 |
+
</select>
|
| 86 |
+
<select class="bg-dark-700 border border-dark-600 rounded-md px-3 py-1 text-sm">
|
| 87 |
+
<option>Tous les tags</option>
|
| 88 |
+
<option>Professionnel</option>
|
| 89 |
+
<option>Créatif</option>
|
| 90 |
+
<option>Personnel</option>
|
| 91 |
+
</select>
|
| 92 |
+
</div>
|
| 93 |
+
<div id="searchResults" class="max-h-60 overflow-y-auto">
|
| 94 |
+
<!-- Results will appear here -->
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<!-- Note Editor -->
|
| 100 |
+
<div class="bg-dark-800 rounded-xl shadow-lg overflow-hidden mb-6">
|
| 101 |
+
<!-- Toolbar -->
|
| 102 |
+
<div class="flex items-center px-4 py-2 bg-dark-700 border-b border-dark-600">
|
| 103 |
+
<div class="flex space-x-2">
|
| 104 |
+
<button class="p-2 rounded hover:bg-dark-600" title="Gras" onclick="formatText('bold')">
|
| 105 |
+
<i class="fas fa-bold"></i>
|
| 106 |
+
</button>
|
| 107 |
+
<button class="p-2 rounded hover:bg-dark-600" title="Italique" onclick="formatText('italic')">
|
| 108 |
+
<i class="fas fa-italic"></i>
|
| 109 |
+
</button>
|
| 110 |
+
<button class="p-2 rounded hover:bg-dark-600" title="Liste à puces" onclick="formatText('insertUnorderedList')">
|
| 111 |
+
<i class="fas fa-list-ul"></i>
|
| 112 |
+
</button>
|
| 113 |
+
</div>
|
| 114 |
+
<div class="ml-auto flex space-x-2">
|
| 115 |
+
<button id="suggestBtn" class="px-3 py-1 bg-dark-600 hover:bg-primary-500 rounded-md text-sm flex items-center space-x-1 transition">
|
| 116 |
+
<i class="fas fa-lightbulb"></i>
|
| 117 |
+
<span>Suggestions</span>
|
| 118 |
+
</button>
|
| 119 |
+
<button id="generateBtn" class="px-3 py-1 bg-primary-500 hover:bg-primary-600 rounded-md text-sm flex items-center space-x-1 transition">
|
| 120 |
+
<i class="fas fa-magic"></i>
|
| 121 |
+
<span>Générer</span>
|
| 122 |
+
</button>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- Editor -->
|
| 127 |
+
<div class="p-4">
|
| 128 |
+
<div id="noteEditor" class="note-content outline-none" contenteditable="true" placeholder="Commencez à écrire ici..."></div>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<!-- Suggestions Panel -->
|
| 133 |
+
<div id="suggestionsPanel" class="hidden bg-dark-800 rounded-lg p-4 mb-6 fade-in">
|
| 134 |
+
<div class="flex justify-between items-center mb-3">
|
| 135 |
+
<h3 class="font-medium">Suggestions intelligentes</h3>
|
| 136 |
+
<button id="closeSuggestions" class="text-gray-400 hover:text-white">
|
| 137 |
+
<i class="fas fa-times"></i>
|
| 138 |
+
</button>
|
| 139 |
+
</div>
|
| 140 |
+
<div id="suggestionsContent" class="space-y-2">
|
| 141 |
+
<!-- Suggestions will appear here -->
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<!-- Generated Content -->
|
| 146 |
+
<div id="generatedContent" class="hidden bg-dark-800 rounded-lg p-4 mb-6 fade-in">
|
| 147 |
+
<div class="flex justify-between items-center mb-3">
|
| 148 |
+
<h3 class="font-medium">Contenu optimisé</h3>
|
| 149 |
+
<div class="flex space-x-2">
|
| 150 |
+
<button id="copyAll" class="px-2 py-1 bg-dark-700 hover:bg-dark-600 rounded text-xs flex items-center space-x-1">
|
| 151 |
+
<i class="fas fa-copy"></i>
|
| 152 |
+
<span>Tout copier</span>
|
| 153 |
+
</button>
|
| 154 |
+
<button id="insertAll" class="px-2 py-1 bg-primary-500 hover:bg-primary-600 rounded text-xs flex items-center space-x-1">
|
| 155 |
+
<i class="fas fa-plus"></i>
|
| 156 |
+
<span>Insérer</span>
|
| 157 |
+
</button>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
<div id="generatedText" class="whitespace-pre-line">
|
| 161 |
+
<!-- Generated content will appear here -->
|
| 162 |
+
</div>
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
<!-- Status Bar -->
|
| 166 |
+
<div class="flex justify-between items-center text-sm text-gray-500">
|
| 167 |
+
<div>
|
| 168 |
+
<span id="charCount">0</span> caractères
|
| 169 |
+
</div>
|
| 170 |
+
<div class="flex space-x-4">
|
| 171 |
+
<button id="saveBtn" class="hover:text-gray-300 flex items-center space-x-1">
|
| 172 |
+
<i class="fas fa-cloud"></i>
|
| 173 |
+
<span>Sauvegarder</span>
|
| 174 |
+
</button>
|
| 175 |
+
<button id="exportBtn" class="hover:text-gray-300 flex items-center space-x-1">
|
| 176 |
+
<i class="fas fa-share"></i>
|
| 177 |
+
<span>Exporter</span>
|
| 178 |
+
</button>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
|
| 183 |
+
<script>
|
| 184 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 185 |
+
const noteEditor = document.getElementById('noteEditor');
|
| 186 |
+
const charCount = document.getElementById('charCount');
|
| 187 |
+
const suggestBtn = document.getElementById('suggestBtn');
|
| 188 |
+
const generateBtn = document.getElementById('generateBtn');
|
| 189 |
+
const suggestionsPanel = document.getElementById('suggestionsPanel');
|
| 190 |
+
const generatedContent = document.getElementById('generatedContent');
|
| 191 |
+
const generatedText = document.getElementById('generatedText');
|
| 192 |
+
const closeSuggestions = document.getElementById('closeSuggestions');
|
| 193 |
+
const copyAll = document.getElementById('copyAll');
|
| 194 |
+
const insertAll = document.getElementById('insertAll');
|
| 195 |
+
const searchBtn = document.getElementById('searchBtn');
|
| 196 |
+
const searchModal = document.getElementById('searchModal');
|
| 197 |
+
const closeSearch = document.getElementById('closeSearch');
|
| 198 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 199 |
+
const exportBtn = document.getElementById('exportBtn');
|
| 200 |
+
|
| 201 |
+
// Update character count
|
| 202 |
+
noteEditor.addEventListener('input', function() {
|
| 203 |
+
charCount.textContent = noteEditor.textContent.length;
|
| 204 |
+
});
|
| 205 |
+
|
| 206 |
+
// Handle paste event to auto-detect and format title/description/hashtags
|
| 207 |
+
noteEditor.addEventListener('paste', function(e) {
|
| 208 |
+
e.preventDefault();
|
| 209 |
+
const text = (e.clipboardData || window.clipboardData).getData('text/plain');
|
| 210 |
+
|
| 211 |
+
// Process the pasted text to detect and format elements
|
| 212 |
+
setTimeout(() => {
|
| 213 |
+
processPastedContent(text);
|
| 214 |
+
}, 10);
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
function cleanText(text) {
|
| 218 |
+
// Remove "Titre :", "Description :", "Hashtag :" and their variations
|
| 219 |
+
return text
|
| 220 |
+
.replace(/^(Titre|titre)\s*:\s*/gmi, '')
|
| 221 |
+
.replace(/^(Description|description)\s*:\s*/gmi, '')
|
| 222 |
+
.replace(/^(Hashtag|hashtag|Mots-clés|mots-clés)\s*:\s*/gmi, '')
|
| 223 |
+
.trim();
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
function processPastedContent(text) {
|
| 227 |
+
// Clean the text first
|
| 228 |
+
text = cleanText(text);
|
| 229 |
+
|
| 230 |
+
// Try to detect title, description and hashtags in various formats
|
| 231 |
+
let title = '';
|
| 232 |
+
let description = '';
|
| 233 |
+
let hashtags = '';
|
| 234 |
+
|
| 235 |
+
// Common pattern detection
|
| 236 |
+
if (text.includes('Titre:') || text.includes('titre:')) {
|
| 237 |
+
const parts = text.split(/\n\s*\n/);
|
| 238 |
+
parts.forEach(part => {
|
| 239 |
+
if (part.match(/^(Titre|titre):/i)) {
|
| 240 |
+
title = cleanText(part);
|
| 241 |
+
} else if (part.match(/^(Description|description):/i)) {
|
| 242 |
+
description = cleanText(part);
|
| 243 |
+
} else if (part.match(/^(Hashtags|hashtags|Mots-clés|mots-clés):/i)) {
|
| 244 |
+
hashtags = cleanText(part);
|
| 245 |
+
}
|
| 246 |
+
});
|
| 247 |
+
} else {
|
| 248 |
+
// Try to split by empty lines
|
| 249 |
+
const parts = text.split(/\n\s*\n/);
|
| 250 |
+
if (parts.length >= 3) {
|
| 251 |
+
title = cleanText(parts[0]);
|
| 252 |
+
description = cleanText(parts[1]);
|
| 253 |
+
hashtags = cleanText(parts[2]);
|
| 254 |
+
} else if (parts.length === 2) {
|
| 255 |
+
title = cleanText(parts[0]);
|
| 256 |
+
description = cleanText(parts[1]);
|
| 257 |
+
} else if (parts.length === 1) {
|
| 258 |
+
description = cleanText(parts[0]);
|
| 259 |
+
}
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// Format the content with empty line separation
|
| 263 |
+
let formattedContent = '';
|
| 264 |
+
if (title) formattedContent += title + '\n\n';
|
| 265 |
+
if (description) formattedContent += description + '\n\n';
|
| 266 |
+
if (hashtags) {
|
| 267 |
+
// Ensure hashtags start with #
|
| 268 |
+
hashtags = hashtags.split(/\s+/).map(tag => {
|
| 269 |
+
return tag.startsWith('#') ? tag : '#' + tag;
|
| 270 |
+
}).join(' ');
|
| 271 |
+
formattedContent += hashtags;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
// Insert the formatted content
|
| 275 |
+
noteEditor.innerHTML = formattedContent;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
// Generate optimized content
|
| 279 |
+
generateBtn.addEventListener('click', function() {
|
| 280 |
+
const content = noteEditor.textContent.trim();
|
| 281 |
+
if (!content) return;
|
| 282 |
+
|
| 283 |
+
// Simulate content generation (in a real app, this would use AI/NLP)
|
| 284 |
+
const generated = generateOptimizedContent(content);
|
| 285 |
+
generatedText.textContent = generated;
|
| 286 |
+
generatedContent.classList.remove('hidden');
|
| 287 |
+
});
|
| 288 |
+
|
| 289 |
+
function generateOptimizedContent(text) {
|
| 290 |
+
// Extract main ideas for title
|
| 291 |
+
const sentences = text.split(/[.!?]\s+/);
|
| 292 |
+
const firstSentence = sentences[0];
|
| 293 |
+
const keywords = extractKeywords(text);
|
| 294 |
+
|
| 295 |
+
// Generate title
|
| 296 |
+
let title = '';
|
| 297 |
+
if (firstSentence.length < 60) {
|
| 298 |
+
title = firstSentence;
|
| 299 |
+
} else {
|
| 300 |
+
title = keywords.slice(0, 3).join(' ') + '...';
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
// Generate description
|
| 304 |
+
let description = '';
|
| 305 |
+
if (sentences.length > 1) {
|
| 306 |
+
description = sentences.slice(1).join('. ') + '.';
|
| 307 |
+
} else {
|
| 308 |
+
description = firstSentence;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
// Generate hashtags
|
| 312 |
+
let hashtags = keywords.slice(0, 5).map(word => '#' + word.toLowerCase()).join(' ');
|
| 313 |
+
|
| 314 |
+
// Format with empty lines between sections
|
| 315 |
+
return `${title}\n\n${description}\n\n${hashtags}`;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
function extractKeywords(text) {
|
| 319 |
+
// Simple keyword extraction (in a real app, this would be more sophisticated)
|
| 320 |
+
const words = text.toLowerCase().split(/\s+/);
|
| 321 |
+
const commonWords = ['le', 'la', 'les', 'un', 'une', 'des', 'et', 'ou', 'mais', 'pour', 'dans', 'avec', 'sur', 'par'];
|
| 322 |
+
|
| 323 |
+
const wordCount = {};
|
| 324 |
+
words.forEach(word => {
|
| 325 |
+
word = word.replace(/[^a-zéèêëàâùûîïôöç]/g, '');
|
| 326 |
+
if (word.length > 3 && !commonWords.includes(word)) {
|
| 327 |
+
wordCount[word] = (wordCount[word] || 0) + 1;
|
| 328 |
+
}
|
| 329 |
+
});
|
| 330 |
+
|
| 331 |
+
return Object.entries(wordCount)
|
| 332 |
+
.sort((a, b) => b[1] - a[1])
|
| 333 |
+
.map(entry => entry[0]);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
// Show suggestions
|
| 337 |
+
suggestBtn.addEventListener('click', function() {
|
| 338 |
+
const content = noteEditor.textContent.trim();
|
| 339 |
+
if (!content) return;
|
| 340 |
+
|
| 341 |
+
// Simulate intelligent suggestions
|
| 342 |
+
const suggestions = generateSuggestions(content);
|
| 343 |
+
displaySuggestions(suggestions);
|
| 344 |
+
suggestionsPanel.classList.remove('hidden');
|
| 345 |
+
});
|
| 346 |
+
|
| 347 |
+
function generateSuggestions(text) {
|
| 348 |
+
// Simulate suggestion generation based on content
|
| 349 |
+
const suggestions = [];
|
| 350 |
+
const keywords = extractKeywords(text);
|
| 351 |
+
|
| 352 |
+
if (keywords.length > 0) {
|
| 353 |
+
suggestions.push({
|
| 354 |
+
type: 'keywords',
|
| 355 |
+
content: `Mots-clés pertinents: ${keywords.slice(0, 5).join(', ')}`
|
| 356 |
+
});
|
| 357 |
+
|
| 358 |
+
suggestions.push({
|
| 359 |
+
type: 'hashtags',
|
| 360 |
+
content: `Hashtags suggérés: ${keywords.slice(0, 5).map(k => '#' + k).join(' ')}`
|
| 361 |
+
});
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
if (text.length > 100) {
|
| 365 |
+
suggestions.push({
|
| 366 |
+
type: 'summary',
|
| 367 |
+
content: `Résumé possible: ${text.substring(0, 100)}...`
|
| 368 |
+
});
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
// Add some generic suggestions
|
| 372 |
+
suggestions.push({
|
| 373 |
+
type: 'question',
|
| 374 |
+
content: "Pourriez-vous développer ce point davantage ?"
|
| 375 |
+
});
|
| 376 |
+
|
| 377 |
+
suggestions.push({
|
| 378 |
+
type: 'example',
|
| 379 |
+
content: "Un exemple concret pourrait renforcer votre argument."
|
| 380 |
+
});
|
| 381 |
+
|
| 382 |
+
return suggestions;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
function displaySuggestions(suggestions) {
|
| 386 |
+
const container = document.getElementById('suggestionsContent');
|
| 387 |
+
container.innerHTML = '';
|
| 388 |
+
|
| 389 |
+
suggestions.forEach(suggestion => {
|
| 390 |
+
const item = document.createElement('div');
|
| 391 |
+
item.className = 'suggestion-item p-3 bg-dark-700 rounded-md cursor-pointer';
|
| 392 |
+
item.innerHTML = `
|
| 393 |
+
<div class="flex items-start">
|
| 394 |
+
<div class="mt-1 mr-3 text-primary-500">
|
| 395 |
+
${getSuggestionIcon(suggestion.type)}
|
| 396 |
+
</div>
|
| 397 |
+
<div>${suggestion.content}</div>
|
| 398 |
+
</div>
|
| 399 |
+
`;
|
| 400 |
+
item.addEventListener('click', () => {
|
| 401 |
+
applySuggestion(suggestion);
|
| 402 |
+
});
|
| 403 |
+
container.appendChild(item);
|
| 404 |
+
});
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
function getSuggestionIcon(type) {
|
| 408 |
+
switch(type) {
|
| 409 |
+
case 'keywords': return '<i class="fas fa-tags"></i>';
|
| 410 |
+
case 'hashtags': return '<i class="fas fa-hashtag"></i>';
|
| 411 |
+
case 'summary': return '<i class="fas fa-align-left"></i>';
|
| 412 |
+
case 'question': return '<i class="fas fa-question-circle"></i>';
|
| 413 |
+
case 'example': return '<i class="fas fa-lightbulb"></i>';
|
| 414 |
+
default: return '<i class="fas fa-comment"></i>';
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
function applySuggestion(suggestion) {
|
| 419 |
+
// In a real app, this would be more sophisticated
|
| 420 |
+
const selection = window.getSelection();
|
| 421 |
+
if (!selection.rangeCount) return;
|
| 422 |
+
|
| 423 |
+
const range = selection.getRangeAt(0);
|
| 424 |
+
const node = document.createTextNode(suggestion.content + ' ');
|
| 425 |
+
range.insertNode(node);
|
| 426 |
+
|
| 427 |
+
// Move cursor to end of inserted text
|
| 428 |
+
range.setStartAfter(node);
|
| 429 |
+
range.setEndAfter(node);
|
| 430 |
+
selection.removeAllRanges();
|
| 431 |
+
selection.addRange(range);
|
| 432 |
+
|
| 433 |
+
suggestionsPanel.classList.add('hidden');
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// Close suggestions panel
|
| 437 |
+
closeSuggestions.addEventListener('click', function() {
|
| 438 |
+
suggestionsPanel.classList.add('hidden');
|
| 439 |
+
});
|
| 440 |
+
|
| 441 |
+
// Copy all generated content
|
| 442 |
+
copyAll.addEventListener('click', function() {
|
| 443 |
+
navigator.clipboard.writeText(generatedText.textContent)
|
| 444 |
+
.then(() => {
|
| 445 |
+
const originalText = copyAll.innerHTML;
|
| 446 |
+
copyAll.innerHTML = '<i class="fas fa-check"></i> <span>Copié</span>';
|
| 447 |
+
setTimeout(() => {
|
| 448 |
+
copyAll.innerHTML = originalText;
|
| 449 |
+
}, 2000);
|
| 450 |
+
});
|
| 451 |
+
});
|
| 452 |
+
|
| 453 |
+
// Insert all generated content
|
| 454 |
+
insertAll.addEventListener('click', function() {
|
| 455 |
+
noteEditor.innerHTML = generatedText.textContent;
|
| 456 |
+
generatedContent.classList.add('hidden');
|
| 457 |
+
});
|
| 458 |
+
|
| 459 |
+
// Search functionality
|
| 460 |
+
searchBtn.addEventListener('click', function() {
|
| 461 |
+
searchModal.classList.remove('hidden');
|
| 462 |
+
});
|
| 463 |
+
|
| 464 |
+
closeSearch.addEventListener('click', function() {
|
| 465 |
+
searchModal.classList.add('hidden');
|
| 466 |
+
});
|
| 467 |
+
|
| 468 |
+
// Save and export buttons (simulated)
|
| 469 |
+
saveBtn.addEventListener('click', function() {
|
| 470 |
+
alert('Note sauvegardée dans le cloud');
|
| 471 |
+
});
|
| 472 |
+
|
| 473 |
+
exportBtn.addEventListener('click', function() {
|
| 474 |
+
alert('Exportation vers les réseaux sociaux');
|
| 475 |
+
});
|
| 476 |
+
});
|
| 477 |
+
|
| 478 |
+
// Text formatting functions
|
| 479 |
+
function formatText(command, value = null) {
|
| 480 |
+
document.execCommand(command, false, value);
|
| 481 |
+
}
|
| 482 |
+
</script>
|
| 483 |
+
<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=Chasme/bloc-note" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 484 |
+
</html>
|