File size: 6,094 Bytes
67f6005 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
class HelpModal extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.modal.active {
opacity: 1;
visibility: visible;
}
.modal-content {
background: #1F2937;
border-radius: 10px;
width: 90%;
max-width: 600px;
max-height: 90vh;
overflow-y: auto;
transform: translateY(-20px);
transition: transform 0.3s ease;
}
.modal.active .modal-content {
transform: translateY(0);
}
.modal-header {
padding: 1rem 1.5rem;
border-bottom: 1px solid #374151;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-body {
padding: 1.5rem;
}
.modal-footer {
padding: 1rem 1.5rem;
border-top: 1px solid #374151;
display: flex;
justify-content: flex-end;
}
.close-btn {
background: none;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
}
h2 {
margin-top: 0;
color: white;
}
h3 {
color: #9CA3AF;
margin-top: 1.5rem;
}
ul {
padding-left: 1.5rem;
}
li {
margin-bottom: 0.5rem;
color: #D1D5DB;
}
kbd {
background: #374151;
padding: 0.2rem 0.4rem;
border-radius: 0.25rem;
font-family: monospace;
}
</style>
<div class="modal" id="help-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Teleprompter Help</h2>
<button class="close-btn">×</button>
</div>
<div class="modal-body">
<h3>Getting Started</h3>
<p>Enter your script in the text area on the left. Adjust settings like scroll speed, text size, and theme using the controls.</p>
<h3>Controls</h3>
<ul>
<li><strong>Start Scrolling:</strong> Begin the teleprompter scroll</li>
<li><strong>Pause:</strong> Temporarily stop the scroll</li>
<li><strong>Speed Slider:</strong> Adjust scrolling speed (0.1x - 5x)</li>
</ul>
<h3>Keyboard Shortcuts</h3>
<ul>
<li><kbd>Space</kbd> - Toggle scrolling</li>
<li><kbd>Ctrl</kbd>+<kbd>S</kbd> - Save script</li>
<li><kbd>Ctrl</kbd>+<kbd>O</kbd> - Load script</li>
<li><kbd>Ctrl</kbd>+<kbd>E</kbd> - Export script</li>
<li><kbd>↑</kbd> - Increase speed</li>
<li><kbd>↓</kbd> - Decrease speed</li>
</ul>
<h3>Advanced Features</h3>
<ul>
<li><strong>Themes:</strong> Choose from 6 color themes</li>
<li><strong>Text Formatting:</strong> Bold, italic, underline options</li>
<li><strong>Mirror View:</strong> Flip text for teleprompter reflection</li>
<li><strong>Preview Mode:</strong> Toggle between dark/light backgrounds</li>
</ul>
</div>
<div class="modal-footer">
<button id="close-help" class="px-4 py-2 bg-gray-600 hover:bg-gray-500 rounded">Close</button>
</div>
</div>
</div>
`;
// Add event listeners
this.shadowRoot.querySelector('.close-btn').addEventListener('click', () => this.close());
this.shadowRoot.querySelector('#close-help').addEventListener('click', () => this.close());
// Close modal when clicking outside
this.shadowRoot.querySelector('.modal').addEventListener('click', (e) => {
if (e.target.classList.contains('modal')) {
this.close();
}
});
}
open() {
this.shadowRoot.querySelector('.modal').classList.add('active');
}
close() {
this.shadowRoot.querySelector('.modal').classList.remove('active');
}
}
customElements.define('help-modal', HelpModal); |