2026-11-24 04:55:02 +02:00
|
|
|
<section class="offline-settings" aria-labelledby="offline-settings-title" @keydown.space.stop
|
2026-11-24 02:45:38 +02:00
|
|
|
x-data="{
|
2026-11-24 03:15:58 +02:00
|
|
|
get offline() { return $store.offline }, min: 100000000, max: 512000000000, draft: null,
|
2026-11-24 02:45:38 +02:00
|
|
|
marks: [100000000,1000000000,10000000000,100000000000,512000000000],
|
|
|
|
|
position(bytes) { return 100 * Math.log(Math.max(this.min, bytes) / this.min) / Math.log(this.max / this.min) },
|
|
|
|
|
bytesAt(position) {
|
|
|
|
|
const bytes = this.min * Math.pow(this.max / this.min, Number(position) / 100);
|
|
|
|
|
return Math.min(this.max, Math.max(this.min, Math.round(bytes)));
|
|
|
|
|
}
|
|
|
|
|
}">
|
2026-11-24 04:55:02 +02:00
|
|
|
<div class="offline-preferences" :class="{ 'cache-disabled': !offline.enabled }">
|
|
|
|
|
<div class="offline-preferences-main">
|
|
|
|
|
<div class="offline-preferences-head">
|
|
|
|
|
<h4 id="offline-settings-title" tabindex="-1">{{ t.player_offline_listening }}</h4>
|
|
|
|
|
<span class="offline-preferences-help" x-data="{help:false}" @click.outside="help = false"
|
|
|
|
|
@pointerenter="if ($event.pointerType === 'mouse') help = true" @pointerleave="help = false"
|
|
|
|
|
@keydown.escape="if (help) { $event.stopPropagation(); $event.preventDefault(); help = false }">
|
|
|
|
|
<button type="button" class="offline-mode-info" aria-label="{{ t.player_info }}"
|
|
|
|
|
aria-describedby="offline-settings-hint" @focus="help = true" @blur="help = false" @click="help = true">
|
|
|
|
|
<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true">
|
|
|
|
|
<circle cx="10" cy="10" r="7.25"/><path d="M10 9v4.25"/><circle cx="10" cy="6.5" r=".9" fill="currentColor" stroke="none"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
<span role="tooltip" id="offline-settings-hint" :class="{visible:help}">{{ t.player_offline_hint }}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<button type="button" class="offline-switch-row" role="switch" aria-label="{{ t.player_offline_enable }}"
|
|
|
|
|
:aria-checked="offline.enabled" :disabled="offline.busy || (!offline.supported && !offline.enabled)"
|
|
|
|
|
@click="offline.setEnabled(!offline.enabled)">
|
|
|
|
|
<span class="offline-switch" aria-hidden="true"></span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="offline-saved-reveal" :inert="offline.enabled || offline.items.length ? null : true">
|
|
|
|
|
<div>
|
|
|
|
|
<button type="button" id="open-offline-cache" class="offline-saved-link"
|
|
|
|
|
aria-label="{{ t.player_offline_saved }} · {{ t.player_offline_open_cache }}" title="{{ t.player_offline_open_cache }}"
|
|
|
|
|
aria-describedby="offline-saved-count" @click="openCache()">
|
|
|
|
|
<span>{{ t.player_offline_saved }}</span>
|
|
|
|
|
<small id="offline-saved-count" x-text="formatArtistCount(offline.items.length, 'tracks') + ' · ' + offline.formatBytes(offline.bytes)"></small>
|
|
|
|
|
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="m6 3.5 4.5 4.5L6 12.5"/></svg>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="offline-limit" x-show="offline.enabled" :inert="offline.enabled ? null : true" x-transition.opacity.duration.120ms x-cloak>
|
2026-11-24 02:45:38 +02:00
|
|
|
<div class="offline-limit-label">
|
|
|
|
|
<label for="offline-limit">{{ t.player_offline_limit }}</label>
|
|
|
|
|
<output for="offline-limit" x-text="offline.formatBytes(draft ?? offline.limitBytes)"></output>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="offline-scale">
|
|
|
|
|
<div class="offline-scale-marks" aria-hidden="true">
|
|
|
|
|
<template x-for="mark in marks" :key="mark">
|
|
|
|
|
<span :style="{left: position(mark) + '%'}" x-text="offline.formatBytes(mark)"></span>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
<input id="offline-limit" type="range" min="0" max="100" step="0.5"
|
2026-11-24 04:55:02 +02:00
|
|
|
:style="{'--limit-position': position(draft ?? offline.limitBytes) + '%'}"
|
2026-11-24 02:45:38 +02:00
|
|
|
:value="position(offline.limitBytes)" :aria-valuetext="offline.formatBytes(draft ?? offline.limitBytes)"
|
|
|
|
|
@input="draft = bytesAt($el.value)" @change="offline.setLimit(bytesAt($el.value)); draft = null">
|
|
|
|
|
</div>
|
2026-11-24 04:55:02 +02:00
|
|
|
</div>
|
2026-11-24 02:45:38 +02:00
|
|
|
</div>
|
2026-11-24 04:55:02 +02:00
|
|
|
<p class="offline-settings-status" role="status" x-show="!offline.supported || offline.busy && !offline.enabled || offline.saving" x-cloak
|
|
|
|
|
x-text="!offline.supported ? '{{ t.player_offline_unsupported }}' : offline.saving ? '{{ t.player_offline_saving }}' : '{{ t.player_offline_preparing }}'"></p>
|
|
|
|
|
<p class="offline-settings-status offline-error" role="alert" x-show="offline.error" x-text="offline.error" x-cloak></p>
|
2026-11-24 02:45:38 +02:00
|
|
|
</section>
|