Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ui/common/src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ export const isMobile = (): boolean => isAndroid() || isIOS();

export const isAndroid = (): boolean => /Android/.test(navigator.userAgent);

export const getSafariMajorVersion = (): number | undefined => {
const regex = /^((?!chrome|android).)*Version\/(\d+).*Safari/i;
const result = regex.exec(navigator.userAgent);
return result ? parseInt(result[2]) : undefined;
};

export const isIOS = (constraint?: { below?: number; atLeast?: number }): boolean => {
let answer = ios();
if (!constraint || !answer) return answer;
Expand Down
9 changes: 9 additions & 0 deletions ui/dasher/src/dasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Redraw } from 'common/snabbdom';
import { DasherCtrl } from './ctrl';
import { json as xhrJson } from 'common/xhr';
import { spinnerVdom, spinnerHtml } from 'common/spinner';
import { getSafariMajorVersion } from 'common/device';
import { init as initSnabbdom, type VNode, classModule, attributesModule, h } from 'snabbdom';

const patch = initSnabbdom([classModule, attributesModule]);
Expand All @@ -22,6 +23,14 @@ export default async function initModule(): Promise<DasherCtrl> {
vnode || element,
h('div#dasher_app.dropdown', ctrl?.render() ?? h('div.initiating', spinnerVdom())),
);

const safari = getSafariMajorVersion();
if (safari && safari < 18) {
const el = document?.querySelector("#dasher_app .sound input[type='range']");
if (el) {
(el as HTMLElement).style.appearance = 'slider-vertical';
}
}
};

redraw();
Expand Down