You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
985 B
JavaScript
44 lines
985 B
JavaScript
class ClaudeKeyboard {
|
|
constructor(onSendText, onSendKey) {
|
|
this.onSendText = onSendText;
|
|
this.onSendKey = onSendKey;
|
|
this._active = false;
|
|
this._actionBar = null;
|
|
}
|
|
|
|
activate() {
|
|
if (this._active) return;
|
|
this._active = true;
|
|
}
|
|
|
|
deactivate() {
|
|
if (!this._active) return;
|
|
this._active = false;
|
|
}
|
|
|
|
_makeBtn(extraClass, icon, label, onClick) {
|
|
const btn = document.createElement('button');
|
|
btn.className = `cc-action-btn ${extraClass}`;
|
|
|
|
const iconEl = document.createElement('span');
|
|
iconEl.className = 'cc-action-icon';
|
|
iconEl.textContent = icon;
|
|
|
|
const labelEl = document.createElement('span');
|
|
labelEl.className = 'cc-action-label';
|
|
labelEl.textContent = label;
|
|
|
|
btn.appendChild(iconEl);
|
|
btn.appendChild(labelEl);
|
|
btn.addEventListener('click', () => {
|
|
if (navigator.vibrate) navigator.vibrate(8);
|
|
onClick();
|
|
});
|
|
|
|
return btn;
|
|
}
|
|
|
|
}
|
|
|
|
window.ClaudeKeyboard = ClaudeKeyboard;
|