now fixed context menu

This commit is contained in:
Andreas Fruhwirt 2025-04-05 20:05:31 +02:00
parent 3db9ce34f5
commit 27c5ca29cc
2 changed files with 3 additions and 10 deletions

View File

@ -212,8 +212,8 @@ async def main_page(credentials: Annotated[HTTPBasicCredentials, Depends(securit
global client_data
if not is_authorized(credentials):
return Response("Get outta here män :(", status_code=401)
ui.add_head_html(f"<script type='text/javascript' src='/static/record.js'></script>")
ui.add_head_html(f"<link type='text/tailwindcss' rel='stylesheet' href='/static/style.css'>")
ui.add_head_html(f"<script type='text/javascript' src='/static/record.js'></script>")
container = ui.column().classes('w-full h-[calc(100vh-2rem)] items-center justify-center')
@ -223,8 +223,8 @@ async def main_page(credentials: Annotated[HTTPBasicCredentials, Depends(securit
cd.container = container
label = ui.label('Checking if the server is online...').classes('text-xl mb-20 whitespace-nowrap text-[3vw]')
cd.text_above = label
with ui.element().classes('w-[50vw] max-h-[75%] aspect-square rounded-full bg-grey text-white flex items-center justify-center whitespace-nowrap text-[3vw] active:scale-95 transition-transform').props("id=recordbutton disabled") as button:
ui.image('/static/microphone.png').classes('h-[75%] w-[75%] object-contain').props("id=recordbuttonimage")
button = ui.element().classes('w-[50vw] max-h-[75%] aspect-square rounded-full bg-gray-300 text-white flex items-center justify-center whitespace-nowrap text-[3vw] active:scale-95 transition-transform z-10 bg-[url(/static/microphone.png)] bg-center bg-no-repeat bg-contain').props("id=recordbutton disabled")
# ui.image('').classes('h-[75%] w-[75%] object-contain').props("id=recordbuttonimage draggable=false")
button.on('mousedown', lambda: start_recording(client.id))
button.on('mouseup', lambda: stop_recording(client.id))
button.on('touchstart', lambda: start_recording(client.id))

View File

@ -11,13 +11,6 @@ window.addEventListener("load", async (event) => {
await navigator.mediaDevices.getUserMedia({ audio: true });
});
document.getElementById('recordbuttonimage').oncontextmenu = function(event) {
event.preventDefault();
event.stopPropagation(); // not necessary in my case, could leave in case stopImmediateProp isn't available?
event.stopImmediatePropagation();
return false;
};
function startButtonPulse(analyser) {
const button = document.querySelector('#recordbutton');