mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
feat: Hide keyboard shortcuts on devices without physical keyboards
This commit is contained in:
parent
26789115b6
commit
4f4b10fd86
2 changed files with 24 additions and 0 deletions
|
@ -138,6 +138,11 @@ li.active-marker {
|
|||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Hide keyboard shortcuts on devices likely without physical keyboards */
|
||||
.no-physical-keyboard .keyboard-shortcuts {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.keyboard-shortcuts kbd {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #ccc;
|
||||
|
|
|
@ -2,6 +2,25 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
let player; // Store player reference to make it accessible to click handlers
|
||||
let globalAudio; // Global audio element to be reused
|
||||
|
||||
// Detect if device likely has no physical keyboard
|
||||
function detectNoKeyboard() {
|
||||
// Check if it's a touch device (most mobile devices)
|
||||
const isTouchDevice = ('ontouchstart' in window) ||
|
||||
(navigator.maxTouchPoints > 0) ||
|
||||
(navigator.msMaxTouchPoints > 0);
|
||||
|
||||
// Check common mobile user agents as additional signal
|
||||
const isMobileUA = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
|
||||
// If it's a touch device and has a mobile user agent, likely has no physical keyboard
|
||||
if (isTouchDevice && isMobileUA) {
|
||||
document.body.classList.add('no-physical-keyboard');
|
||||
}
|
||||
}
|
||||
|
||||
// Run detection
|
||||
detectNoKeyboard();
|
||||
|
||||
// Parse the transcript section to create markers and convert timestamps to links
|
||||
function parseTranscript() {
|
||||
const markers = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue