Spaces:
Running
Running
Add 2 files
Browse files- index.html +143 -2
- prompts.txt +2 -1
index.html
CHANGED
|
@@ -133,6 +133,66 @@
|
|
| 133 |
.formatted-text u {
|
| 134 |
text-decoration: underline;
|
| 135 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
</style>
|
| 137 |
</head>
|
| 138 |
<body class="bg-gray-50 min-h-screen">
|
|
@@ -251,6 +311,42 @@
|
|
| 251 |
<button type="button" id="boldBtn" class="rich-text-button"><i class="fas fa-bold"></i></button>
|
| 252 |
<button type="button" id="italicBtn" class="rich-text-button"><i class="fas fa-italic"></i></button>
|
| 253 |
<button type="button" id="underlineBtn" class="rich-text-button"><i class="fas fa-underline"></i></button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
<button type="button" id="placeholderBtn" class="rich-text-button">[Variable]</button>
|
| 255 |
</div>
|
| 256 |
<textarea id="scriptContent" rows="8" class="w-full px-3 py-2 border rounded" required></textarea>
|
|
@@ -368,9 +464,14 @@
|
|
| 368 |
const toggleDatesBtn = document.getElementById('toggleDatesBtn');
|
| 369 |
const togglePinnedDatesBtn = document.getElementById('togglePinnedDatesBtn');
|
| 370 |
const contentPreview = document.getElementById('contentPreview');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
|
| 372 |
// State
|
| 373 |
let showDates = true;
|
|
|
|
| 374 |
|
| 375 |
// Save data to localStorage
|
| 376 |
function saveData() {
|
|
@@ -403,10 +504,42 @@
|
|
| 403 |
toggleDatesBtn.addEventListener('click', toggleDatesVisibility);
|
| 404 |
togglePinnedDatesBtn.addEventListener('click', toggleDatesVisibility);
|
| 405 |
scriptContent.addEventListener('input', updateContentPreview);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
}
|
| 407 |
|
| 408 |
// Apply formatting to selected text
|
| 409 |
-
function applyFormatting(formatType) {
|
| 410 |
const textarea = scriptContent;
|
| 411 |
const start = textarea.selectionStart;
|
| 412 |
const end = textarea.selectionEnd;
|
|
@@ -430,6 +563,10 @@
|
|
| 430 |
formattedText = `<u>${selectedText}</u>`;
|
| 431 |
cursorOffset = 4;
|
| 432 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
}
|
| 434 |
|
| 435 |
if (start !== end) {
|
|
@@ -460,6 +597,7 @@
|
|
| 460 |
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // bold
|
| 461 |
.replace(/\_(.*?)\_/g, '<em>$1</em>') // italic
|
| 462 |
.replace(/<u>(.*?)<\/u>/g, '<u>$1</u>') // underline
|
|
|
|
| 463 |
.replace(/\n/g, '<br>') // line breaks
|
| 464 |
.replace(/\[(.*?)\]/g, '<span class="bg-blue-100 text-blue-800 px-1 rounded">[$1]</span>'); // placeholders
|
| 465 |
|
|
@@ -625,6 +763,7 @@
|
|
| 625 |
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // bold
|
| 626 |
.replace(/\_(.*?)\_/g, '<em>$1</em>') // italic
|
| 627 |
.replace(/<u>(.*?)<\/u>/g, '<u>$1</u>') // underline
|
|
|
|
| 628 |
.replace(/\n/g, '<br>') // line breaks
|
| 629 |
.replace(/\[(.*?)\]/g, '<span class="bg-blue-100 text-blue-800 px-1 rounded">[$1]</span>'); // placeholders
|
| 630 |
}
|
|
@@ -729,7 +868,9 @@
|
|
| 729 |
.replace(/\*\*/g, '')
|
| 730 |
.replace(/_/g, '')
|
| 731 |
.replace(/<u>/g, '')
|
| 732 |
-
.replace(/<\/u>/g, '')
|
|
|
|
|
|
|
| 733 |
|
| 734 |
const textToCopy = `${script.title}\n\n${cleanContent.replace(/<[^>]*>/g, '')}`;
|
| 735 |
navigator.clipboard.writeText(textToCopy).then(() => {
|
|
|
|
| 133 |
.formatted-text u {
|
| 134 |
text-decoration: underline;
|
| 135 |
}
|
| 136 |
+
/* Color picker styles */
|
| 137 |
+
.color-picker {
|
| 138 |
+
position: relative;
|
| 139 |
+
display: inline-block;
|
| 140 |
+
}
|
| 141 |
+
.color-preview {
|
| 142 |
+
width: 20px;
|
| 143 |
+
height: 20px;
|
| 144 |
+
border-radius: 4px;
|
| 145 |
+
border: 1px solid #d1d5db;
|
| 146 |
+
cursor: pointer;
|
| 147 |
+
}
|
| 148 |
+
.color-palette {
|
| 149 |
+
position: absolute;
|
| 150 |
+
top: 100%;
|
| 151 |
+
left: 0;
|
| 152 |
+
z-index: 10;
|
| 153 |
+
display: none;
|
| 154 |
+
background: white;
|
| 155 |
+
padding: 8px;
|
| 156 |
+
border-radius: 4px;
|
| 157 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 158 |
+
width: 180px;
|
| 159 |
+
}
|
| 160 |
+
.color-palette.show {
|
| 161 |
+
display: grid;
|
| 162 |
+
grid-template-columns: repeat(6, 1fr);
|
| 163 |
+
gap: 4px;
|
| 164 |
+
}
|
| 165 |
+
.color-option {
|
| 166 |
+
width: 20px;
|
| 167 |
+
height: 20px;
|
| 168 |
+
border-radius: 4px;
|
| 169 |
+
cursor: pointer;
|
| 170 |
+
border: 1px solid #d1d5db;
|
| 171 |
+
}
|
| 172 |
+
.color-option:hover {
|
| 173 |
+
transform: scale(1.1);
|
| 174 |
+
}
|
| 175 |
+
.custom-color-input {
|
| 176 |
+
grid-column: span 6;
|
| 177 |
+
display: flex;
|
| 178 |
+
align-items: center;
|
| 179 |
+
gap: 4px;
|
| 180 |
+
margin-top: 4px;
|
| 181 |
+
}
|
| 182 |
+
.custom-color-input input {
|
| 183 |
+
flex: 1;
|
| 184 |
+
padding: 4px;
|
| 185 |
+
border: 1px solid #d1d5db;
|
| 186 |
+
border-radius: 4px;
|
| 187 |
+
}
|
| 188 |
+
.custom-color-input button {
|
| 189 |
+
padding: 4px 8px;
|
| 190 |
+
background: #3b82f6;
|
| 191 |
+
color: white;
|
| 192 |
+
border: none;
|
| 193 |
+
border-radius: 4px;
|
| 194 |
+
cursor: pointer;
|
| 195 |
+
}
|
| 196 |
</style>
|
| 197 |
</head>
|
| 198 |
<body class="bg-gray-50 min-h-screen">
|
|
|
|
| 311 |
<button type="button" id="boldBtn" class="rich-text-button"><i class="fas fa-bold"></i></button>
|
| 312 |
<button type="button" id="italicBtn" class="rich-text-button"><i class="fas fa-italic"></i></button>
|
| 313 |
<button type="button" id="underlineBtn" class="rich-text-button"><i class="fas fa-underline"></i></button>
|
| 314 |
+
<div class="color-picker">
|
| 315 |
+
<div class="rich-text-button" id="colorPickerBtn">
|
| 316 |
+
<i class="fas fa-palette"></i>
|
| 317 |
+
</div>
|
| 318 |
+
<div class="color-palette" id="colorPalette">
|
| 319 |
+
<div class="color-option" style="background-color: #000000;" data-color="#000000"></div>
|
| 320 |
+
<div class="color-option" style="background-color: #ffffff; border: 1px solid #000;" data-color="#ffffff"></div>
|
| 321 |
+
<div class="color-option" style="background-color: #ff0000;" data-color="#ff0000"></div>
|
| 322 |
+
<div class="color-option" style="background-color: #00ff00;" data-color="#00ff00"></div>
|
| 323 |
+
<div class="color-option" style="background-color: #0000ff;" data-color="#0000ff"></div>
|
| 324 |
+
<div class="color-option" style="background-color: #ffff00;" data-color="#ffff00"></div>
|
| 325 |
+
<div class="color-option" style="background-color: #ff00ff;" data-color="#ff00ff"></div>
|
| 326 |
+
<div class="color-option" style="background-color: #00ffff;" data-color="#00ffff"></div>
|
| 327 |
+
<div class="color-option" style="background-color: #800000;" data-color="#800000"></div>
|
| 328 |
+
<div class="color-option" style="background-color: #008000;" data-color="#008000"></div>
|
| 329 |
+
<div class="color-option" style="background-color: #000080;" data-color="#000080"></div>
|
| 330 |
+
<div class="color-option" style="background-color: #808000;" data-color="#808000"></div>
|
| 331 |
+
<div class="color-option" style="background-color: #800080;" data-color="#800080"></div>
|
| 332 |
+
<div class="color-option" style="background-color: #008080;" data-color="#008080"></div>
|
| 333 |
+
<div class="color-option" style="background-color: #c0c0c0;" data-color="#c0c0c0"></div>
|
| 334 |
+
<div class="color-option" style="background-color: #808080;" data-color="#808080"></div>
|
| 335 |
+
<div class="color-option" style="background-color: #ffa500;" data-color="#ffa500"></div>
|
| 336 |
+
<div class="color-option" style="background-color: #ff6347;" data-color="#ff6347"></div>
|
| 337 |
+
<div class="color-option" style="background-color: #ff69b4;" data-color="#ff69b4"></div>
|
| 338 |
+
<div class="color-option" style="background-color: #9370db;" data-color="#9370db"></div>
|
| 339 |
+
<div class="color-option" style="background-color: #7fffd4;" data-color="#7fffd4"></div>
|
| 340 |
+
<div class="color-option" style="background-color: #ffd700;" data-color="#ffd700"></div>
|
| 341 |
+
<div class="color-option" style="background-color: #cd5c5c;" data-color="#cd5c5c"></div>
|
| 342 |
+
<div class="color-option" style="background-color: #4b0082;" data-color="#4b0082"></div>
|
| 343 |
+
<div class="color-option" style="background-color: #f08080;" data-color="#f08080"></div>
|
| 344 |
+
<div class="custom-color-input">
|
| 345 |
+
<input type="text" id="customColorInput" placeholder="#hex or color name" class="flex-1">
|
| 346 |
+
<button type="button" id="applyCustomColor">Apply</button>
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
</div>
|
| 350 |
<button type="button" id="placeholderBtn" class="rich-text-button">[Variable]</button>
|
| 351 |
</div>
|
| 352 |
<textarea id="scriptContent" rows="8" class="w-full px-3 py-2 border rounded" required></textarea>
|
|
|
|
| 464 |
const toggleDatesBtn = document.getElementById('toggleDatesBtn');
|
| 465 |
const togglePinnedDatesBtn = document.getElementById('togglePinnedDatesBtn');
|
| 466 |
const contentPreview = document.getElementById('contentPreview');
|
| 467 |
+
const colorPickerBtn = document.getElementById('colorPickerBtn');
|
| 468 |
+
const colorPalette = document.getElementById('colorPalette');
|
| 469 |
+
const customColorInput = document.getElementById('customColorInput');
|
| 470 |
+
const applyCustomColor = document.getElementById('applyCustomColor');
|
| 471 |
|
| 472 |
// State
|
| 473 |
let showDates = true;
|
| 474 |
+
let currentColor = '#000000';
|
| 475 |
|
| 476 |
// Save data to localStorage
|
| 477 |
function saveData() {
|
|
|
|
| 504 |
toggleDatesBtn.addEventListener('click', toggleDatesVisibility);
|
| 505 |
togglePinnedDatesBtn.addEventListener('click', toggleDatesVisibility);
|
| 506 |
scriptContent.addEventListener('input', updateContentPreview);
|
| 507 |
+
|
| 508 |
+
// Color picker events
|
| 509 |
+
colorPickerBtn.addEventListener('click', toggleColorPalette);
|
| 510 |
+
document.addEventListener('click', (e) => {
|
| 511 |
+
if (!colorPalette.contains(e.target) && e.target !== colorPickerBtn) {
|
| 512 |
+
colorPalette.classList.remove('show');
|
| 513 |
+
}
|
| 514 |
+
});
|
| 515 |
+
|
| 516 |
+
// Color selection
|
| 517 |
+
document.querySelectorAll('.color-option').forEach(option => {
|
| 518 |
+
option.addEventListener('click', () => {
|
| 519 |
+
currentColor = option.dataset.color;
|
| 520 |
+
applyFormatting('color', currentColor);
|
| 521 |
+
colorPalette.classList.remove('show');
|
| 522 |
+
});
|
| 523 |
+
});
|
| 524 |
+
|
| 525 |
+
// Custom color
|
| 526 |
+
applyCustomColor.addEventListener('click', () => {
|
| 527 |
+
const color = customColorInput.value.trim();
|
| 528 |
+
if (color) {
|
| 529 |
+
currentColor = color;
|
| 530 |
+
applyFormatting('color', currentColor);
|
| 531 |
+
colorPalette.classList.remove('show');
|
| 532 |
+
}
|
| 533 |
+
});
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
// Toggle color palette visibility
|
| 537 |
+
function toggleColorPalette() {
|
| 538 |
+
colorPalette.classList.toggle('show');
|
| 539 |
}
|
| 540 |
|
| 541 |
// Apply formatting to selected text
|
| 542 |
+
function applyFormatting(formatType, color = null) {
|
| 543 |
const textarea = scriptContent;
|
| 544 |
const start = textarea.selectionStart;
|
| 545 |
const end = textarea.selectionEnd;
|
|
|
|
| 563 |
formattedText = `<u>${selectedText}</u>`;
|
| 564 |
cursorOffset = 4;
|
| 565 |
break;
|
| 566 |
+
case 'color':
|
| 567 |
+
formattedText = `<span style="color: ${color}">${selectedText}</span>`;
|
| 568 |
+
cursorOffset = 0;
|
| 569 |
+
break;
|
| 570 |
}
|
| 571 |
|
| 572 |
if (start !== end) {
|
|
|
|
| 597 |
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // bold
|
| 598 |
.replace(/\_(.*?)\_/g, '<em>$1</em>') // italic
|
| 599 |
.replace(/<u>(.*?)<\/u>/g, '<u>$1</u>') // underline
|
| 600 |
+
.replace(/<span style="color: (.*?)">(.*?)<\/span>/g, '<span style="color: $1">$2</span>') // color
|
| 601 |
.replace(/\n/g, '<br>') // line breaks
|
| 602 |
.replace(/\[(.*?)\]/g, '<span class="bg-blue-100 text-blue-800 px-1 rounded">[$1]</span>'); // placeholders
|
| 603 |
|
|
|
|
| 763 |
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // bold
|
| 764 |
.replace(/\_(.*?)\_/g, '<em>$1</em>') // italic
|
| 765 |
.replace(/<u>(.*?)<\/u>/g, '<u>$1</u>') // underline
|
| 766 |
+
.replace(/<span style="color: (.*?)">(.*?)<\/span>/g, '<span style="color: $1">$2</span>') // color
|
| 767 |
.replace(/\n/g, '<br>') // line breaks
|
| 768 |
.replace(/\[(.*?)\]/g, '<span class="bg-blue-100 text-blue-800 px-1 rounded">[$1]</span>'); // placeholders
|
| 769 |
}
|
|
|
|
| 868 |
.replace(/\*\*/g, '')
|
| 869 |
.replace(/_/g, '')
|
| 870 |
.replace(/<u>/g, '')
|
| 871 |
+
.replace(/<\/u>/g, '')
|
| 872 |
+
.replace(/<span style="color: (.*?)">/g, '')
|
| 873 |
+
.replace(/<\/span>/g, '');
|
| 874 |
|
| 875 |
const textToCopy = `${script.title}\n\n${cleanContent.replace(/<[^>]*>/g, '')}`;
|
| 876 |
navigator.clipboard.writeText(textToCopy).then(() => {
|
prompts.txt
CHANGED
|
@@ -4,4 +4,5 @@ make the bold, italic, and underline buttons functional and make them have the c
|
|
| 4 |
make the bold button actually bold the text, make the italic button actually italicize, and make the underline button actually underline the text
|
| 5 |
Don't make the formatting visible in the script editor. Just apply the format to the text
|
| 6 |
make the bold, italic, and underline buttons work properly.
|
| 7 |
-
make the bold, italic, and underline buttons work in the script and the content
|
|
|
|
|
|
| 4 |
make the bold button actually bold the text, make the italic button actually italicize, and make the underline button actually underline the text
|
| 5 |
Don't make the formatting visible in the script editor. Just apply the format to the text
|
| 6 |
make the bold, italic, and underline buttons work properly.
|
| 7 |
+
make the bold, italic, and underline buttons work in the script and the content
|
| 8 |
+
allow me to change font colors and save custom font colors
|