Spaces:
Running
Running
Add 2 files
Browse files- index.html +273 -197
- prompts.txt +7 -3
index.html
CHANGED
|
@@ -120,6 +120,19 @@
|
|
| 120 |
color: #3b82f6;
|
| 121 |
transform: scale(1.1);
|
| 122 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
</style>
|
| 124 |
</head>
|
| 125 |
<body class="bg-gray-50 min-h-screen">
|
|
@@ -241,6 +254,8 @@
|
|
| 241 |
<button type="button" id="placeholderBtn" class="rich-text-button">[Variable]</button>
|
| 242 |
</div>
|
| 243 |
<textarea id="scriptContent" rows="8" class="w-full px-3 py-2 border rounded" required></textarea>
|
|
|
|
|
|
|
| 244 |
</div>
|
| 245 |
|
| 246 |
<div class="flex justify-end gap-2 pt-4 border-t">
|
|
@@ -352,6 +367,7 @@
|
|
| 352 |
const placeholderBtn = document.getElementById('placeholderBtn');
|
| 353 |
const toggleDatesBtn = document.getElementById('toggleDatesBtn');
|
| 354 |
const togglePinnedDatesBtn = document.getElementById('togglePinnedDatesBtn');
|
|
|
|
| 355 |
|
| 356 |
// State
|
| 357 |
let showDates = true;
|
|
@@ -380,12 +396,74 @@
|
|
| 380 |
searchInput.addEventListener('input', handleSearch);
|
| 381 |
closeModalBtn.addEventListener('click', closeModalHandler);
|
| 382 |
cancelScriptBtn.addEventListener('click', closeModalHandler);
|
| 383 |
-
boldBtn.addEventListener('click', () =>
|
| 384 |
-
italicBtn.addEventListener('click', () =>
|
| 385 |
-
underlineBtn.addEventListener('click', () =>
|
| 386 |
placeholderBtn.addEventListener('click', insertPlaceholder);
|
| 387 |
toggleDatesBtn.addEventListener('click', toggleDatesVisibility);
|
| 388 |
togglePinnedDatesBtn.addEventListener('click', toggleDatesVisibility);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
}
|
| 390 |
|
| 391 |
// Toggle dates visibility
|
|
@@ -500,7 +578,7 @@
|
|
| 500 |
const dateInfo = showDates ? `
|
| 501 |
<div class="mt-3 text-xs text-gray-400">
|
| 502 |
Created: ${formatDate(script.createdAt)}
|
| 503 |
-
${script.updatedAt ? `<br>Updated: ${formatDate(script.updatedAt)}` : ''}
|
| 504 |
</div>
|
| 505 |
` : '';
|
| 506 |
|
|
@@ -525,7 +603,7 @@
|
|
| 525 |
</button>
|
| 526 |
</div>
|
| 527 |
</div>
|
| 528 |
-
<div class="mt-2 whitespace-pre-line text-gray-700">${highlightedContent}</div>
|
| 529 |
${dateInfo}
|
| 530 |
`;
|
| 531 |
scriptsContainer.appendChild(scriptElement);
|
|
@@ -541,6 +619,16 @@
|
|
| 541 |
}
|
| 542 |
}
|
| 543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
// Render pinned scripts
|
| 545 |
function renderPinnedScripts() {
|
| 546 |
pinnedScriptsContainer.innerHTML = '';
|
|
@@ -570,7 +658,7 @@
|
|
| 570 |
const dateInfo = showDates ? `
|
| 571 |
<div class="mt-3 text-xs text-gray-400">
|
| 572 |
Created: ${formatDate(script.createdAt)}
|
| 573 |
-
${script.updatedAt ? `<br>Updated: ${formatDate(script.updatedAt)}` : ''}
|
| 574 |
</div>
|
| 575 |
` : '';
|
| 576 |
|
|
@@ -595,7 +683,7 @@
|
|
| 595 |
</button>
|
| 596 |
</div>
|
| 597 |
</div>
|
| 598 |
-
<div class="mt-2 whitespace-pre-line text-gray-700">${script.content}</div>
|
| 599 |
${dateInfo}
|
| 600 |
`;
|
| 601 |
pinnedScriptsContainer.appendChild(scriptElement);
|
|
@@ -636,7 +724,14 @@
|
|
| 636 |
function copyScript(id) {
|
| 637 |
const script = scripts.find(s => s.id === id);
|
| 638 |
if (script) {
|
| 639 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
navigator.clipboard.writeText(textToCopy).then(() => {
|
| 641 |
showCopyNotification();
|
| 642 |
}).catch(err => {
|
|
@@ -662,6 +757,7 @@
|
|
| 662 |
modalTitle.textContent = 'Add New Script';
|
| 663 |
renderCategorySelector();
|
| 664 |
scriptModal.classList.remove('hidden');
|
|
|
|
| 665 |
}
|
| 666 |
|
| 667 |
// Edit script
|
|
@@ -672,218 +768,198 @@
|
|
| 672 |
scriptTitle.value = script.title;
|
| 673 |
scriptContent.value = script.content;
|
| 674 |
scriptPinned.checked = script.pinned;
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
|
|
|
|
|
|
| 678 |
}
|
| 679 |
-
}
|
| 680 |
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 704 |
title,
|
| 705 |
content,
|
| 706 |
categories,
|
| 707 |
pinned,
|
| 708 |
-
|
| 709 |
-
|
|
|
|
| 710 |
}
|
| 711 |
-
|
| 712 |
-
// Add new script
|
| 713 |
-
scripts.push({
|
| 714 |
-
id,
|
| 715 |
-
title,
|
| 716 |
-
content,
|
| 717 |
-
categories,
|
| 718 |
-
pinned,
|
| 719 |
-
createdAt: now,
|
| 720 |
-
updatedAt: null
|
| 721 |
-
});
|
| 722 |
-
}
|
| 723 |
-
|
| 724 |
-
saveData();
|
| 725 |
-
renderScripts();
|
| 726 |
-
renderPinnedScripts();
|
| 727 |
-
closeModalHandler();
|
| 728 |
-
}
|
| 729 |
-
|
| 730 |
-
// Delete script
|
| 731 |
-
function deleteScript(id) {
|
| 732 |
-
if (confirm('Are you sure you want to delete this script?')) {
|
| 733 |
-
scripts = scripts.filter(script => script.id !== id);
|
| 734 |
saveData();
|
| 735 |
renderScripts();
|
| 736 |
renderPinnedScripts();
|
|
|
|
| 737 |
}
|
| 738 |
-
}
|
| 739 |
|
| 740 |
-
|
| 741 |
-
|
| 742 |
-
|
| 743 |
-
|
| 744 |
-
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
renderPinnedScripts();
|
| 749 |
}
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
}
|
| 762 |
-
|
| 763 |
-
// Hide add label form
|
| 764 |
-
function hideAddLabelForm() {
|
| 765 |
-
addLabelForm.classList.add('hidden');
|
| 766 |
-
newLabelInput.value = '';
|
| 767 |
-
}
|
| 768 |
-
|
| 769 |
-
// Save new label
|
| 770 |
-
function saveNewLabel() {
|
| 771 |
-
const newLabel = newLabelInput.value.trim();
|
| 772 |
-
if (newLabel) {
|
| 773 |
-
labels.push(newLabel);
|
| 774 |
-
saveData();
|
| 775 |
-
renderLabels();
|
| 776 |
-
hideAddLabelForm();
|
| 777 |
}
|
| 778 |
-
}
|
| 779 |
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
if (newLabel) {
|
| 797 |
-
labels
|
| 798 |
saveData();
|
| 799 |
renderLabels();
|
|
|
|
| 800 |
}
|
| 801 |
-
};
|
| 802 |
-
|
| 803 |
-
input.addEventListener('blur', saveEdit);
|
| 804 |
-
input.addEventListener('keypress', (e) => {
|
| 805 |
-
if (e.key === 'Enter') {
|
| 806 |
-
saveEdit();
|
| 807 |
-
}
|
| 808 |
-
});
|
| 809 |
-
}
|
| 810 |
-
|
| 811 |
-
// Delete label
|
| 812 |
-
function deleteLabel(index) {
|
| 813 |
-
if (confirm('Are you sure you want to delete this label?')) {
|
| 814 |
-
labels.splice(index, 1);
|
| 815 |
-
saveData();
|
| 816 |
-
renderLabels();
|
| 817 |
}
|
| 818 |
-
}
|
| 819 |
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
|
|
|
|
|
|
| 827 |
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 838 |
}
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
'
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 887 |
</script>
|
| 888 |
<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=Honda219/text-scripts" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 889 |
</html>
|
|
|
|
| 120 |
color: #3b82f6;
|
| 121 |
transform: scale(1.1);
|
| 122 |
}
|
| 123 |
+
/* Style for formatted text preview */
|
| 124 |
+
.formatted-text {
|
| 125 |
+
white-space: pre-line;
|
| 126 |
+
}
|
| 127 |
+
.formatted-text b, .formatted-text strong {
|
| 128 |
+
font-weight: bold;
|
| 129 |
+
}
|
| 130 |
+
.formatted-text i, .formatted-text em {
|
| 131 |
+
font-style: italic;
|
| 132 |
+
}
|
| 133 |
+
.formatted-text u {
|
| 134 |
+
text-decoration: underline;
|
| 135 |
+
}
|
| 136 |
</style>
|
| 137 |
</head>
|
| 138 |
<body class="bg-gray-50 min-h-screen">
|
|
|
|
| 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>
|
| 257 |
+
<div class="mt-2 text-sm text-gray-500">Preview:</div>
|
| 258 |
+
<div id="contentPreview" class="formatted-text p-2 border rounded bg-gray-50 mt-1"></div>
|
| 259 |
</div>
|
| 260 |
|
| 261 |
<div class="flex justify-end gap-2 pt-4 border-t">
|
|
|
|
| 367 |
const placeholderBtn = document.getElementById('placeholderBtn');
|
| 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;
|
|
|
|
| 396 |
searchInput.addEventListener('input', handleSearch);
|
| 397 |
closeModalBtn.addEventListener('click', closeModalHandler);
|
| 398 |
cancelScriptBtn.addEventListener('click', closeModalHandler);
|
| 399 |
+
boldBtn.addEventListener('click', () => applyFormatting('bold'));
|
| 400 |
+
italicBtn.addEventListener('click', () => applyFormatting('italic'));
|
| 401 |
+
underlineBtn.addEventListener('click', () => applyFormatting('underline'));
|
| 402 |
placeholderBtn.addEventListener('click', insertPlaceholder);
|
| 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;
|
| 413 |
+
const selectedText = textarea.value.substring(start, end);
|
| 414 |
+
const beforeText = textarea.value.substring(0, start);
|
| 415 |
+
const afterText = textarea.value.substring(end);
|
| 416 |
+
|
| 417 |
+
let formattedText = '';
|
| 418 |
+
let cursorOffset = 0;
|
| 419 |
+
|
| 420 |
+
switch(formatType) {
|
| 421 |
+
case 'bold':
|
| 422 |
+
formattedText = `**${selectedText}**`;
|
| 423 |
+
cursorOffset = 2;
|
| 424 |
+
break;
|
| 425 |
+
case 'italic':
|
| 426 |
+
formattedText = `_${selectedText}_`;
|
| 427 |
+
cursorOffset = 1;
|
| 428 |
+
break;
|
| 429 |
+
case 'underline':
|
| 430 |
+
formattedText = `<u>${selectedText}</u>`;
|
| 431 |
+
cursorOffset = 4;
|
| 432 |
+
break;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
if (start !== end) {
|
| 436 |
+
// Text is selected, wrap it with formatting
|
| 437 |
+
textarea.value = beforeText + formattedText + afterText;
|
| 438 |
+
// Set cursor position after the formatted text
|
| 439 |
+
textarea.setSelectionRange(
|
| 440 |
+
start + cursorOffset,
|
| 441 |
+
end + cursorOffset
|
| 442 |
+
);
|
| 443 |
+
} else {
|
| 444 |
+
// No text selected, insert formatting tags and place cursor between them
|
| 445 |
+
textarea.value = beforeText + formattedText + afterText;
|
| 446 |
+
textarea.setSelectionRange(
|
| 447 |
+
start + cursorOffset,
|
| 448 |
+
start + cursorOffset
|
| 449 |
+
);
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
textarea.focus();
|
| 453 |
+
updateContentPreview();
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
// Update content preview
|
| 457 |
+
function updateContentPreview() {
|
| 458 |
+
// Convert markdown-style formatting to HTML
|
| 459 |
+
let previewText = scriptContent.value
|
| 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 |
+
|
| 466 |
+
contentPreview.innerHTML = previewText;
|
| 467 |
}
|
| 468 |
|
| 469 |
// Toggle dates visibility
|
|
|
|
| 578 |
const dateInfo = showDates ? `
|
| 579 |
<div class="mt-3 text-xs text-gray-400">
|
| 580 |
Created: ${formatDate(script.createdAt)}
|
| 581 |
+
${script.updatedAt ? `<br>Updated: ${formatDate(script.updatedAt)}</br>` : ''}
|
| 582 |
</div>
|
| 583 |
` : '';
|
| 584 |
|
|
|
|
| 603 |
</button>
|
| 604 |
</div>
|
| 605 |
</div>
|
| 606 |
+
<div class="mt-2 whitespace-pre-line text-gray-700">${formatScriptContent(highlightedContent)}</div>
|
| 607 |
${dateInfo}
|
| 608 |
`;
|
| 609 |
scriptsContainer.appendChild(scriptElement);
|
|
|
|
| 619 |
}
|
| 620 |
}
|
| 621 |
|
| 622 |
+
// Format script content with HTML tags
|
| 623 |
+
function formatScriptContent(content) {
|
| 624 |
+
return content
|
| 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 |
+
}
|
| 631 |
+
|
| 632 |
// Render pinned scripts
|
| 633 |
function renderPinnedScripts() {
|
| 634 |
pinnedScriptsContainer.innerHTML = '';
|
|
|
|
| 658 |
const dateInfo = showDates ? `
|
| 659 |
<div class="mt-3 text-xs text-gray-400">
|
| 660 |
Created: ${formatDate(script.createdAt)}
|
| 661 |
+
${script.updatedAt ? `<br>Updated: ${formatDate(script.updatedAt)}</br>` : ''}
|
| 662 |
</div>
|
| 663 |
` : '';
|
| 664 |
|
|
|
|
| 683 |
</button>
|
| 684 |
</div>
|
| 685 |
</div>
|
| 686 |
+
<div class="mt-2 whitespace-pre-line text-gray-700">${formatScriptContent(script.content)}</div>
|
| 687 |
${dateInfo}
|
| 688 |
`;
|
| 689 |
pinnedScriptsContainer.appendChild(scriptElement);
|
|
|
|
| 724 |
function copyScript(id) {
|
| 725 |
const script = scripts.find(s => s.id === id);
|
| 726 |
if (script) {
|
| 727 |
+
// Remove formatting tags when copying to clipboard
|
| 728 |
+
const cleanContent = script.content
|
| 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(() => {
|
| 736 |
showCopyNotification();
|
| 737 |
}).catch(err => {
|
|
|
|
| 757 |
modalTitle.textContent = 'Add New Script';
|
| 758 |
renderCategorySelector();
|
| 759 |
scriptModal.classList.remove('hidden');
|
| 760 |
+
contentPreview.innerHTML = '';
|
| 761 |
}
|
| 762 |
|
| 763 |
// Edit script
|
|
|
|
| 768 |
scriptTitle.value = script.title;
|
| 769 |
scriptContent.value = script.content;
|
| 770 |
scriptPinned.checked = script.pinned;
|
| 771 |
+
modalTitle.textContent = 'Edit Script';
|
| 772 |
+
renderCategorySelector(script.categories);
|
| 773 |
+
scriptModal.classList.remove('hidden');
|
| 774 |
+
updateContentPreview();
|
| 775 |
+
}
|
| 776 |
}
|
|
|
|
| 777 |
|
| 778 |
+
// Handle form submission
|
| 779 |
+
function handleFormSubmit(e) {
|
| 780 |
+
e.preventDefault();
|
| 781 |
+
|
| 782 |
+
const id = scriptId.value ? parseInt(scriptId.value) : Date.now();
|
| 783 |
+
const title = scriptTitle.value.trim();
|
| 784 |
+
const content = scriptContent.value.trim();
|
| 785 |
+
const categories = getSelectedCategories();
|
| 786 |
+
const pinned = scriptPinned.checked;
|
| 787 |
+
|
| 788 |
+
if (!title || !content || categories.length === 0) {
|
| 789 |
+
alert('Please fill in all fields and select at least one category');
|
| 790 |
+
return;
|
| 791 |
+
}
|
| 792 |
+
|
| 793 |
+
const now = new Date().toISOString();
|
| 794 |
+
|
| 795 |
+
if (scriptId.value) {
|
| 796 |
+
// Update existing script
|
| 797 |
+
const index = scripts.findIndex(s => s.id === id);
|
| 798 |
+
if (index !== -1) {
|
| 799 |
+
scripts[index] = {
|
| 800 |
+
...scripts[index],
|
| 801 |
+
title,
|
| 802 |
+
content,
|
| 803 |
+
categories,
|
| 804 |
+
pinned,
|
| 805 |
+
updatedAt: now
|
| 806 |
+
};
|
| 807 |
+
}
|
| 808 |
+
} else {
|
| 809 |
+
// Add new script
|
| 810 |
+
scripts.push({
|
| 811 |
+
id,
|
| 812 |
title,
|
| 813 |
content,
|
| 814 |
categories,
|
| 815 |
pinned,
|
| 816 |
+
createdAt: now,
|
| 817 |
+
updatedAt: null
|
| 818 |
+
});
|
| 819 |
}
|
| 820 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 821 |
saveData();
|
| 822 |
renderScripts();
|
| 823 |
renderPinnedScripts();
|
| 824 |
+
closeModalHandler();
|
| 825 |
}
|
|
|
|
| 826 |
|
| 827 |
+
// Delete script
|
| 828 |
+
function deleteScript(id) {
|
| 829 |
+
if (confirm('Are you sure you want to delete this script?')) {
|
| 830 |
+
scripts = scripts.filter(script => script.id !== id);
|
| 831 |
+
saveData();
|
| 832 |
+
renderScripts();
|
| 833 |
+
renderPinnedScripts();
|
| 834 |
+
}
|
|
|
|
| 835 |
}
|
| 836 |
+
|
| 837 |
+
// Toggle pin status
|
| 838 |
+
function togglePinScript(id) {
|
| 839 |
+
const script = scripts.find(s => s.id === id);
|
| 840 |
+
if (script) {
|
| 841 |
+
script.pinned = !script.pinned;
|
| 842 |
+
script.updatedAt = new Date().toISOString();
|
| 843 |
+
saveData();
|
| 844 |
+
renderScripts();
|
| 845 |
+
renderPinnedScripts();
|
| 846 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
}
|
|
|
|
| 848 |
|
| 849 |
+
// Close modal
|
| 850 |
+
function closeModalHandler() {
|
| 851 |
+
scriptModal.classList.add('hidden');
|
| 852 |
+
}
|
| 853 |
+
|
| 854 |
+
// Show add label form
|
| 855 |
+
function showAddLabelForm() {
|
| 856 |
+
addLabelForm.classList.remove('hidden');
|
| 857 |
+
newLabelInput.focus();
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
// Hide add label form
|
| 861 |
+
function hideAddLabelForm() {
|
| 862 |
+
addLabelForm.classList.add('hidden');
|
| 863 |
+
newLabelInput.value = '';
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
// Save new label
|
| 867 |
+
function saveNewLabel() {
|
| 868 |
+
const newLabel = newLabelInput.value.trim();
|
| 869 |
if (newLabel) {
|
| 870 |
+
labels.push(newLabel);
|
| 871 |
saveData();
|
| 872 |
renderLabels();
|
| 873 |
+
hideAddLabelForm();
|
| 874 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 875 |
}
|
|
|
|
| 876 |
|
| 877 |
+
// Edit label
|
| 878 |
+
function editLabel(index) {
|
| 879 |
+
const currentLabel = labels[index];
|
| 880 |
+
const labelItem = document.querySelectorAll('.label-item')[index];
|
| 881 |
+
|
| 882 |
+
const input = document.createElement('input');
|
| 883 |
+
input.type = 'text';
|
| 884 |
+
input.className = 'label-edit-input w-full px-2 py-1 border rounded';
|
| 885 |
+
input.value = currentLabel;
|
| 886 |
|
| 887 |
+
labelItem.innerHTML = '';
|
| 888 |
+
labelItem.appendChild(input);
|
| 889 |
+
input.focus();
|
| 890 |
+
|
| 891 |
+
const saveEdit = () => {
|
| 892 |
+
const newLabel = input.value.trim();
|
| 893 |
+
if (newLabel) {
|
| 894 |
+
labels[index] = newLabel;
|
| 895 |
+
saveData();
|
| 896 |
+
renderLabels();
|
| 897 |
+
}
|
| 898 |
+
};
|
| 899 |
+
|
| 900 |
+
input.addEventListener('blur', saveEdit);
|
| 901 |
+
input.addEventListener('keypress', (e) => {
|
| 902 |
+
if (e.key === 'Enter') {
|
| 903 |
+
saveEdit();
|
| 904 |
+
}
|
| 905 |
+
});
|
| 906 |
}
|
| 907 |
+
|
| 908 |
+
// Delete label
|
| 909 |
+
function deleteLabel(index) {
|
| 910 |
+
if (confirm('Are you sure you want to delete this label?')) {
|
| 911 |
+
labels.splice(index, 1);
|
| 912 |
+
saveData();
|
| 913 |
+
renderLabels();
|
| 914 |
+
}
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
// Insert placeholder
|
| 918 |
+
function insertPlaceholder() {
|
| 919 |
+
const textarea = scriptContent;
|
| 920 |
+
const start = textarea.selectionStart;
|
| 921 |
+
const end = textarea.selectionEnd;
|
| 922 |
+
const beforeText = textarea.value.substring(0, start);
|
| 923 |
+
const afterText = textarea.value.substring(end);
|
| 924 |
+
|
| 925 |
+
textarea.value = beforeText + '[Variable]' + afterText;
|
| 926 |
+
textarea.focus();
|
| 927 |
+
textarea.setSelectionRange(start + '[Variable]'.length, start + '[Variable]'.length);
|
| 928 |
+
updateContentPreview();
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
// Get category name
|
| 932 |
+
function getCategoryName(category) {
|
| 933 |
+
const categories = {
|
| 934 |
+
'intro': 'Introduction',
|
| 935 |
+
'General': 'General',
|
| 936 |
+
'documents_requested': 'Documents Request',
|
| 937 |
+
'VA IRRRL': 'VA IRRRL',
|
| 938 |
+
'Lost Contact/Gaslight': 'Lost Contact',
|
| 939 |
+
'Preapproval/Purchase': 'Preapproval',
|
| 940 |
+
'Funny': 'Funny',
|
| 941 |
+
'Appointment': 'Appointment'
|
| 942 |
+
};
|
| 943 |
+
return categories[category] || category;
|
| 944 |
+
}
|
| 945 |
+
|
| 946 |
+
// Format date
|
| 947 |
+
function formatDate(dateString) {
|
| 948 |
+
if (!dateString) return '';
|
| 949 |
+
const date = new Date(dateString);
|
| 950 |
+
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
| 951 |
+
}
|
| 952 |
+
|
| 953 |
+
// Make functions available globally
|
| 954 |
+
window.copyScript = copyScript;
|
| 955 |
+
window.togglePinScript = togglePinScript;
|
| 956 |
+
window.editScript = editScript;
|
| 957 |
+
window.deleteScript = deleteScript;
|
| 958 |
+
window.editLabel = editLabel;
|
| 959 |
+
window.deleteLabel = deleteLabel;
|
| 960 |
+
window.moveLabelUp = moveLabelUp;
|
| 961 |
+
window.moveLabelDown = moveLabelDown;
|
| 962 |
+
window.closeModalHandler = closeModalHandler;
|
| 963 |
</script>
|
| 964 |
<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=Honda219/text-scripts" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 965 |
</html>
|
prompts.txt
CHANGED
|
@@ -1,3 +1,7 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
make the bold, underline, and italic buttons work properly
|
| 2 |
+
the bold, italic, and underline buttons do not work properly. please fix them
|
| 3 |
+
make the bold, italic, and underline buttons functional and make them have the correct functions
|
| 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
|