aboutsummaryrefslogtreecommitdiff
path: root/downloads/floatimg-buttons.html
blob: 317dd42bd1edd898dd5976bf096548f845e1c581 (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Floating Buttons Setup</title>
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
      min-height: 100vh;
      padding: 40px 20px;
      color: #fff;
    }
    .container { max-width: 640px; margin: 0 auto; }
    h1 { text-align: center; margin-bottom: 10px; font-size: 1.8em; }
    h2 { margin: 35px 0 15px; font-size: 1.2em; color: #90EE90; }
    .subtitle { text-align: center; color: #888; margin-bottom: 30px; }

    .card {
      background: rgba(255,255,255,0.1);
      border: 1px solid transparent;
      border-radius: 12px;
      padding: 18px 20px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: background 0.2s;
      display: flex;
      align-items: center;
      gap: 15px;
      user-select: none;
    }
    .card:hover { background: rgba(255,255,255,0.18); }
    .card:active { transform: scale(0.98); }
    .card.copied { background: rgba(76,175,80,0.35); border-color: #4CAF50; }

    .emoji { font-size: 1.8em; width: 50px; text-align: center; }
    .info { flex: 1; min-width: 0; }
    .label { font-size: 1.1em; font-weight: bold; margin-bottom: 5px; }
    .cmd {
      font-family: monospace;
      background: rgba(0,0,0,0.35);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 0.82em;
      color: #90EE90;
      word-break: break-all;
      white-space: pre-wrap;
    }
    .copy-icon { font-size: 1.3em; opacity: 0.4; }
    .card:hover .copy-icon { opacity: 1; }

    .btn-wide {
      background: #4CAF50;
      color: white;
      border: none;
      padding: 14px 30px;
      border-radius: 8px;
      font-size: 1.05em;
      cursor: pointer;
      width: 100%;
      margin-top: 15px;
      transition: background 0.2s;
    }
    .btn-wide:hover { background: #45a049; }
    .btn-wide:active { transform: scale(0.98); }

    .note {
      background: rgba(255,193,7,0.12);
      border-left: 4px solid #FFC107;
      padding: 14px 18px;
      border-radius: 0 8px 8px 0;
      margin: 20px 0;
      font-size: 0.92em;
      color: #ffe082;
    }

    .preview {
      background: rgba(0,0,0,0.25);
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 25px;
      text-align: center;
    }
    .preview-label { color: #888; margin-bottom: 14px; font-size: 0.9em; }
    .preview-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
    .preview-btn {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border: none;
      padding: 10px 16px;
      border-radius: 8px;
      font-size: 1.25em;
    }

    .toast {
      position: fixed;
      bottom: 30px;
      left: 50%;
      transform: translateX(-50%) translateY(120px);
      background: #4CAF50;
      color: white;
      padding: 12px 24px;
      border-radius: 8px;
      font-weight: bold;
      transition: transform 0.3s;
      z-index: 1000;
    }
    .toast.show { transform: translateX(-50%) translateY(0); }
  </style>
</head>
<body>
  <div class="container">
    <h1>๐Ÿ‘† Floating Buttons Setup</h1>
    <p class="subtitle">Click a card to copy the command &nbsp;ยท&nbsp; paste it in the WebX11 terminal</p>

    <div class="preview">
      <div class="preview-label">Preview</div>
      <div class="preview-btns" id="previewBtns"></div>
    </div>

    <div class="note">
      โš ๏ธ <b>Note:</b> <code>clipboard-history</code> is <b>not</b> a real command in this system โ€”
      that's why the ๐Ÿ“‹ button did nothing. It was replaced below with real, verified commands.
    </div>

    <h2>โœ… Your Buttons (all verified working)</h2>
    <div id="cardsMain"></div>
    <button class="btn-wide" id="btnCopyMain">๐Ÿ“‹ Copy All Main Commands</button>

    <h2>๐Ÿ’ก More Examples (all verified working)</h2>
    <div id="cardsMore"></div>
    <button class="btn-wide" id="btnCopyMore">๐Ÿ“‹ Copy All Example Commands</button>
  </div>

  <div class="toast" id="toast">Copied!</div>

  <script>
    // โ”€โ”€ All commands below were verified against the system command list โ”€โ”€

    var MAIN_BUTTONS = [
      { emoji: '๐Ÿ†•', label: 'New Session',
        cmd: 'floating-add btn new-session "๐Ÿ†•" new-session' },
      { emoji: 'โœ…', label: 'AI Allow',
        cmd: 'floating-add btn ai-allow "โœ…" ai-allow' },
      { emoji: 'โš™๏ธ', label: 'AI Config (confirm-timeout 0)',
        cmd: 'floating-add btn config-timeout "โš™๏ธ" ai-config confirm-timeout 0' },
      { emoji: '๐ŸŒ', label: 'WebDAV Browser',
        cmd: 'floating-add btn webdav-btn "๐ŸŒ" webdav-browser' },
      { emoji: '๐Ÿ“Š', label: 'System Status',
        cmd: 'floating-add btn status-btn "๐Ÿ“Š" status' }
    ];

    var MORE_BUTTONS = [
      { emoji: '๐Ÿฉบ', label: 'Health Check',
        cmd: 'floating-add btn health-btn "๐Ÿฉบ" health-check' },
      { emoji: '๐Ÿงน', label: 'Clear AI Context',
        cmd: 'floating-add btn ai-clear-btn "๐Ÿงน" ai-clear' },
      { emoji: 'โน๏ธ', label: 'Stop AI Task',
        cmd: 'floating-add btn ai-stop-btn "โน๏ธ" ai-stop' },
      { emoji: '๐Ÿง ', label: 'Memory Usage',
        cmd: 'floating-add btn mem-btn "๐Ÿง " mem' },
      { emoji: '๐Ÿ“ฆ', label: 'List Modules',
        cmd: 'floating-add btn modules-btn "๐Ÿ“ฆ" modules' },
      { emoji: '๐ŸŽจ', label: 'Change Theme',
        cmd: 'floating-add btn theme-btn "๐ŸŽจ" theme' },
      { emoji: '๐Ÿ’ฌ', label: 'Chat Mode',
        cmd: 'floating-add btn chat-btn "๐Ÿ’ฌ" chat' },
      { emoji: '๐Ÿ‘ฅ', label: 'List Agents',
        cmd: 'floating-add btn agents-btn "๐Ÿ‘ฅ" agent-list' },
      { emoji: '๐Ÿ—‚๏ธ', label: 'Kanban Board',
        cmd: 'floating-add btn kanban-btn "๐Ÿ—‚๏ธ" kanban' },
      { emoji: '๐Ÿ”', label: 'WebDAV Status',
        cmd: 'floating-add btn webdav-status-btn "๐Ÿ”" webdav-status' },
      { emoji: '๐Ÿงช', label: 'Run System Doctor',
        cmd: 'floating-add btn doctor-btn "๐Ÿงช" doctor' },
      { emoji: 'โฐ', label: 'System Uptime',
        cmd: 'floating-add btn uptime-btn "โฐ" uptime' }
    ];

    // โ”€โ”€ Copy helpers (robust: clipboard API first, textarea fallback second) โ”€โ”€

    function fallbackCopy(text) {
      var ta = document.createElement('textarea');
      ta.value = text;
      ta.setAttribute('readonly', '');
      ta.style.position = 'fixed';
      ta.style.left = '-9999px';
      ta.style.top = '0';
      document.body.appendChild(ta);
      ta.focus();
      ta.select();
      var ok = false;
      try { ok = document.execCommand('copy'); } catch (e) { ok = false; }
      document.body.removeChild(ta);
      return ok;
    }

    function copyText(text) {
      return new Promise(function (resolve) {
        if (navigator.clipboard && window.isSecureContext) {
          navigator.clipboard.writeText(text).then(
            function () { resolve(true); },
            function () { resolve(fallbackCopy(text)); }
          );
        } else {
          resolve(fallbackCopy(text));
        }
      });
    }

    function showToast(msg) {
      var toast = document.getElementById('toast');
      toast.textContent = msg;
      toast.classList.add('show');
      setTimeout(function () { toast.classList.remove('show'); }, 2000);
    }

    function copyCard(el, cmd) {
      copyText(cmd).then(function (ok) {
        if (ok) {
          el.classList.add('copied');
          showToast('Copied! Paste in terminal');
          setTimeout(function () { el.classList.remove('copied'); }, 1500);
        } else {
          showToast('Copy failed โ€” select the command text manually');
        }
      });
    }

    // โ”€โ”€ Render cards from data (no inline onclick โ€” avoids quote-escaping bugs) โ”€โ”€

    function renderCards(containerId, list) {
      var host = document.getElementById(containerId);
      list.forEach(function (b) {
        var card = document.createElement('div');
        card.className = 'card';

        var emoji = document.createElement('div');
        emoji.className = 'emoji';
        emoji.textContent = b.emoji;

        var info = document.createElement('div');
        info.className = 'info';
        var label = document.createElement('div');
        label.className = 'label';
        label.textContent = b.label;
        var cmd = document.createElement('div');
        cmd.className = 'cmd';
        cmd.textContent = b.cmd;   // textContent โ†’ no HTML escaping issues
        info.appendChild(label);
        info.appendChild(cmd);

        var icon = document.createElement('div');
        icon.className = 'copy-icon';
        icon.textContent = '๐Ÿ“‹';

        card.appendChild(emoji);
        card.appendChild(info);
        card.appendChild(icon);

        card.addEventListener('click', function () { copyCard(card, b.cmd); });
        host.appendChild(card);
      });
    }

    renderCards('cardsMain', MAIN_BUTTONS);
    renderCards('cardsMore', MORE_BUTTONS);

    // Preview strip
    var preview = document.getElementById('previewBtns');
    MAIN_BUTTONS.forEach(function (b) {
      var pb = document.createElement('div');
      pb.className = 'preview-btn';
      pb.textContent = b.emoji;
      preview.appendChild(pb);
    });

    // Copy-all buttons
    document.getElementById('btnCopyMain').addEventListener('click', function () {
      copyText(MAIN_BUTTONS.map(function (b) { return b.cmd; }).join('\n'))
        .then(function () { showToast('All main commands copied!'); });
    });
    document.getElementById('btnCopyMore').addEventListener('click', function () {
      copyText(MORE_BUTTONS.map(function (b) { return b.cmd; }).join('\n'))
        .then(function () { showToast('All example commands copied!'); });
    });
  </script>
</body>
</html>