Improve navigation and accessibility
This commit is contained in:
@@ -13,13 +13,10 @@ onMount(() => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Math.floor(Math.random()*4)) {
|
switch (Math.floor(Math.random()*3)) {
|
||||||
case 0:
|
case 0:
|
||||||
set_ad_type("aads")
|
set_ad_type("aads")
|
||||||
break
|
break
|
||||||
case 1:
|
|
||||||
set_ad_type("brave")
|
|
||||||
break
|
|
||||||
case 2:
|
case 2:
|
||||||
set_ad_type("ads.plus")
|
set_ad_type("ads.plus")
|
||||||
break
|
break
|
||||||
|
@@ -20,7 +20,15 @@ import GalleryView from "./GalleryView.svelte";
|
|||||||
import Spinner from "../util/Spinner.svelte";
|
import Spinner from "../util/Spinner.svelte";
|
||||||
import Downloader from "./Downloader.svelte";
|
import Downloader from "./Downloader.svelte";
|
||||||
|
|
||||||
let loading = true
|
let loading = 0
|
||||||
|
const on_loading = e => {
|
||||||
|
if (e.detail) {
|
||||||
|
loading++
|
||||||
|
} else {
|
||||||
|
loading--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let embedded = false
|
let embedded = false
|
||||||
let view_token = ""
|
let view_token = ""
|
||||||
let ads_enabled = false
|
let ads_enabled = false
|
||||||
@@ -84,6 +92,7 @@ let embed_visible = false
|
|||||||
let skyscraper_visible = false
|
let skyscraper_visible = false
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
loading++
|
||||||
let viewer_data = window.viewer_data
|
let viewer_data = window.viewer_data
|
||||||
embedded = viewer_data.embedded
|
embedded = viewer_data.embedded
|
||||||
|
|
||||||
@@ -101,10 +110,10 @@ onMount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ads_enabled = list.files[0].show_ads
|
ads_enabled = list.files[0].show_ads
|
||||||
loading = false
|
loading--
|
||||||
})
|
})
|
||||||
const reload = async () => {
|
const reload = async () => {
|
||||||
loading = true
|
loading++
|
||||||
if (is_list) {
|
if (is_list) {
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(list.info_href);
|
const resp = await fetch(list.info_href);
|
||||||
@@ -129,7 +138,7 @@ const reload = async () => {
|
|||||||
alert(err)
|
alert(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loading = false
|
loading--
|
||||||
}
|
}
|
||||||
|
|
||||||
const open_list = l => {
|
const open_list = l => {
|
||||||
@@ -145,14 +154,18 @@ const open_list = l => {
|
|||||||
// correct file is opened
|
// correct file is opened
|
||||||
is_list = true
|
is_list = true
|
||||||
|
|
||||||
|
hash_change()
|
||||||
|
}
|
||||||
|
const hash_change = () => {
|
||||||
// Skip to the file defined in the link hash
|
// Skip to the file defined in the link hash
|
||||||
let matches = location.hash.match(new RegExp('item=([^&]*)'))
|
let matches = location.hash.match(/item=([\d]+)/)
|
||||||
let hashID = parseInt(matches ? matches[1] : null)
|
let index = parseInt(matches ? matches[1] : null)
|
||||||
if (Number.isInteger(hashID)) {
|
if (Number.isInteger(index)) {
|
||||||
// The URL contains an item number. Navigate to that item
|
// The URL contains an item number. Navigate to that item
|
||||||
open_file_index(hashID)
|
open_file_index(index)
|
||||||
} else if (view !== "gallery") {
|
} else if (view !== "gallery") {
|
||||||
toggle_gallery()
|
view = "gallery"
|
||||||
|
file = file_struct // Empty the file struct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const open_file_index = async index => {
|
const open_file_index = async index => {
|
||||||
@@ -161,6 +174,11 @@ const open_file_index = async index => {
|
|||||||
} else if (index < 0) {
|
} else if (index < 0) {
|
||||||
index = list.files.length - 1
|
index = list.files.length - 1
|
||||||
}
|
}
|
||||||
|
if (list.files[index] === file) {
|
||||||
|
console.debug("ignoring request to load the same file that is currently loaded")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
console.debug("received request to open file", index)
|
console.debug("received request to open file", index)
|
||||||
|
|
||||||
file_set_href(list.files[index])
|
file_set_href(list.files[index])
|
||||||
@@ -174,8 +192,8 @@ const open_file_index = async index => {
|
|||||||
file_preview.set_file(file)
|
file_preview.set_file(file)
|
||||||
|
|
||||||
if (is_list) {
|
if (is_list) {
|
||||||
// Update the URL
|
// Update the URL without pushing a new history entry
|
||||||
location.replace("#item=" + index)
|
window.location.replace("#item=" + index)
|
||||||
list_navigator.set_item(index)
|
list_navigator.set_item(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,11 +206,9 @@ const open_file_index = async index => {
|
|||||||
}
|
}
|
||||||
const toggle_gallery = () => {
|
const toggle_gallery = () => {
|
||||||
if (view === "gallery") {
|
if (view === "gallery") {
|
||||||
open_file_index(0)
|
window.location.hash = "#item=0"
|
||||||
} else {
|
} else {
|
||||||
location.replace("#gallery")
|
window.location.hash = "#gallery"
|
||||||
view = "gallery"
|
|
||||||
file = file_struct // Empty the file struct
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,31 +321,45 @@ const keyboard_event = evt => {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keydown={keyboard_event}/>
|
<svelte:window on:keydown={keyboard_event} on:hashchange={hash_change}/>
|
||||||
|
|
||||||
<div id="file_viewer" class="file_viewer">
|
<div id="file_viewer" class="file_viewer">
|
||||||
<!-- Head elements for the ads -->
|
<!-- Head elements for the ads -->
|
||||||
<AdHead></AdHead>
|
<AdHead></AdHead>
|
||||||
|
|
||||||
{#if loading}
|
{#if loading !== 0}
|
||||||
<div class="spinner_container">
|
<div class="spinner_container">
|
||||||
<Spinner></Spinner>
|
<Spinner></Spinner>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div id="headerbar" class="headerbar" class:embedded>
|
<div id="headerbar" class="headerbar" class:embedded>
|
||||||
<button on:click={toolbar_toggle} class="button_toggle_toolbar round" class:button_highlight={toolbar_visible}>
|
<button
|
||||||
|
on:click={toolbar_toggle}
|
||||||
|
class="button_toggle_toolbar round"
|
||||||
|
class:button_highlight={toolbar_visible}
|
||||||
|
title="Open or close the toolbar">
|
||||||
<i class="icon">menu</i>
|
<i class="icon">menu</i>
|
||||||
</button>
|
</button>
|
||||||
<a href="/" bind:this={button_home} class="button button_home round" target={embedded ? "_blank" : ""}>
|
|
||||||
|
<a
|
||||||
|
href="/"
|
||||||
|
bind:this={button_home}
|
||||||
|
class="button button_home round"
|
||||||
|
target={embedded ? "_blank" : ""}
|
||||||
|
title="Go to the pixeldrain home page">
|
||||||
<PixeldrainLogo style="height: 1.6em; width: 1.6em; margin: 0 4px 0 0;"></PixeldrainLogo>
|
<PixeldrainLogo style="height: 1.6em; width: 1.6em; margin: 0 4px 0 0;"></PixeldrainLogo>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div id="file_viewer_headerbar_title" class="file_viewer_headerbar_title">
|
<div id="file_viewer_headerbar_title" class="file_viewer_headerbar_title">
|
||||||
{#if list.title !== ""}{list.title}<br/>{/if}
|
{#if list.title !== ""}{list.title}<br/>{/if}
|
||||||
{#if file.name !== ""}{file.name}{/if}
|
{#if file.name !== ""}{file.name}{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if embedded && supports_fullscreen}
|
{#if embedded && supports_fullscreen}
|
||||||
<button class="round" on:click={toggle_fullscreen}>
|
<button
|
||||||
|
class="round"
|
||||||
|
on:click={toggle_fullscreen}
|
||||||
|
title="Open this page in full-screen mode">
|
||||||
<i class="icon" id="btn_fullscreen_icon">fullscreen</i>
|
<i class="icon" id="btn_fullscreen_icon">fullscreen</i>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -352,29 +382,42 @@ const keyboard_event = evt => {
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if is_list}
|
{#if is_list}
|
||||||
<button on:click={toggle_gallery} class="toolbar_button button_full_width" class:button_highlight={view === "gallery"}>
|
<button
|
||||||
|
on:click={toggle_gallery}
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
class:button_highlight={view === "gallery"}
|
||||||
|
title="Opens a gallery view of the album">
|
||||||
<i class="icon">photo_library</i>
|
<i class="icon">photo_library</i>
|
||||||
Gallery
|
Gallery
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if file.abuse_type === "" && view === "file"}
|
{#if file.abuse_type === "" && view === "file"}
|
||||||
<button on:click={downloader.download_file} class="toolbar_button button_full_width">
|
<button
|
||||||
|
on:click={downloader.download_file}
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
title="Save this file to your computer">
|
||||||
<i class="icon">download</i>
|
<i class="icon">download</i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if file.abuse_type === "" && is_list}
|
{#if file.abuse_type === "" && is_list}
|
||||||
<button on:click={downloader.download_list} class="toolbar_button button_full_width">
|
<button
|
||||||
|
on:click={downloader.download_list}
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
title="Download all files in this album as a zip archive">
|
||||||
<i class="icon">download</i>
|
<i class="icon">download</i>
|
||||||
<span>DL all files</span>
|
<span>DL all files</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<button on:click={copy_url}
|
<button
|
||||||
|
on:click={copy_url}
|
||||||
class="toolbar_button button_full_width"
|
class="toolbar_button button_full_width"
|
||||||
class:button_highlight={copy_url_status === "copied"}
|
class:button_highlight={copy_url_status === "copied"}
|
||||||
class:button_red={copy_url_status === "error"}>
|
class:button_red={copy_url_status === "error"}
|
||||||
|
title="Copy a link to this page to your clipboard">
|
||||||
<i class="icon">content_copy</i>
|
<i class="icon">content_copy</i>
|
||||||
<span>
|
<span>
|
||||||
{#if copy_url_status === "copied"}
|
{#if copy_url_status === "copied"}
|
||||||
@@ -387,12 +430,20 @@ const keyboard_event = evt => {
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button on:click={toggle_sharebar} class="toolbar_button button_full_width" class:button_highlight={sharebar_visible}>
|
<button
|
||||||
|
on:click={toggle_sharebar}
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
class:button_highlight={sharebar_visible}
|
||||||
|
title="Share this file on social media">
|
||||||
<i class="icon">share</i>
|
<i class="icon">share</i>
|
||||||
<span>Share</span>
|
<span>Share</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="toolbar_button button_full_width" on:click={qr_window.toggle} class:button_highlight={qr_visible}>
|
<button
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
on:click={qr_window.toggle}
|
||||||
|
class:button_highlight={qr_visible}
|
||||||
|
title="Show a QR code with a link to this page. Useful for sharing files in-person">
|
||||||
<i class="icon">qr_code</i>
|
<i class="icon">qr_code</i>
|
||||||
<span>QR code</span>
|
<span>QR code</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -400,7 +451,7 @@ const keyboard_event = evt => {
|
|||||||
{#if is_list}
|
{#if is_list}
|
||||||
<button
|
<button
|
||||||
class="toolbar_button button_full_width"
|
class="toolbar_button button_full_width"
|
||||||
title="Randomize the order of the files in this list"
|
title="Go to a random file when pressing → or clicking the next file button"
|
||||||
class:button_highlight={list_shuffle}
|
class:button_highlight={list_shuffle}
|
||||||
on:click={toggle_shuffle}>
|
on:click={toggle_shuffle}>
|
||||||
<i class="icon">shuffle</i>
|
<i class="icon">shuffle</i>
|
||||||
@@ -413,7 +464,11 @@ const keyboard_event = evt => {
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if view === "file"}
|
{#if view === "file"}
|
||||||
<button class="toolbar_button button_full_width" on:click={details_window.toggle} class:button_highlight={details_visible}>
|
<button
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
on:click={details_window.toggle}
|
||||||
|
class:button_highlight={details_visible}
|
||||||
|
title="Information and statistics about this file">
|
||||||
<i class="icon">help</i>
|
<i class="icon">help</i>
|
||||||
<span>Deta<u>i</u>ls</span>
|
<span>Deta<u>i</u>ls</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -422,26 +477,41 @@ const keyboard_event = evt => {
|
|||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
{#if file.can_edit || list.can_edit}
|
{#if file.can_edit || list.can_edit}
|
||||||
<button class="toolbar_button button_full_width" on:click={edit_window.toggle} class:button_highlight={edit_visible}>
|
<button
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
on:click={edit_window.toggle}
|
||||||
|
class:button_highlight={edit_visible}
|
||||||
|
title="Edit or delete this file or album">
|
||||||
<i class="icon">edit</i>
|
<i class="icon">edit</i>
|
||||||
<span><u>E</u>dit</span>
|
<span><u>E</u>dit</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if view === "file" && window.user_authenticated && !file.can_edit}
|
{#if view === "file" && window.user_authenticated && !file.can_edit}
|
||||||
<button on:click={grab_file} class="toolbar_button button_full_width" title="Copy this file to your own pixeldrain account">
|
<button
|
||||||
|
on:click={grab_file}
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
title="Copy this file to your own pixeldrain account">
|
||||||
<i class="icon">save_alt</i>
|
<i class="icon">save_alt</i>
|
||||||
<span><u>G</u>rab file</span>
|
<span><u>G</u>rab file</span>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<button class="toolbar_button button_full_width" title="Include this file in your own webpages" on:click={embed_window.toggle} class:button_highlight={embed_visible}>
|
<button
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
title="Include this file in your own webpages"
|
||||||
|
on:click={embed_window.toggle}
|
||||||
|
class:button_highlight={embed_visible}>
|
||||||
<i class="icon">code</i>
|
<i class="icon">code</i>
|
||||||
<span>E<u>m</u>bed</span>
|
<span>E<u>m</u>bed</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if view === "file"}
|
{#if view === "file"}
|
||||||
<button class="toolbar_button button_full_width" title="Report abuse in this file" on:click={report_window.toggle} class:button_highlight={report_visible}>
|
<button
|
||||||
|
class="toolbar_button button_full_width"
|
||||||
|
title="Report this file as abusive"
|
||||||
|
on:click={report_window.toggle}
|
||||||
|
class:button_highlight={report_visible}>
|
||||||
<i class="icon">flag</i>
|
<i class="icon">flag</i>
|
||||||
<span>Report</span>
|
<span>Report</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -455,14 +525,14 @@ const keyboard_event = evt => {
|
|||||||
bind:this={file_preview}
|
bind:this={file_preview}
|
||||||
on:download={downloader.download_file}
|
on:download={downloader.download_file}
|
||||||
on:prev={() => { if (list_navigator) { list_navigator.prev() }}}
|
on:prev={() => { if (list_navigator) { list_navigator.prev() }}}
|
||||||
on:next={() => { if (list_navigator) { list_navigator.next() }}}>
|
on:next={() => { if (list_navigator) { list_navigator.next() }}}
|
||||||
|
on:loading={on_loading}>
|
||||||
</FilePreview>
|
</FilePreview>
|
||||||
{:else if view === "gallery"}
|
{:else if view === "gallery"}
|
||||||
<GalleryView
|
<GalleryView
|
||||||
list={list}
|
list={list}
|
||||||
on:set_file={e => { open_file_index(e.detail) }}
|
|
||||||
on:reload={reload}
|
on:reload={reload}
|
||||||
on:loading={e => {loading = e.detail}}>
|
on:loading={on_loading}>
|
||||||
</GalleryView>
|
</GalleryView>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -15,10 +15,6 @@ export let list = {
|
|||||||
|
|
||||||
let file_picker;
|
let file_picker;
|
||||||
|
|
||||||
const click_file = index => {
|
|
||||||
dispatch("set_file", index)
|
|
||||||
}
|
|
||||||
|
|
||||||
const update_list = async new_files => {
|
const update_list = async new_files => {
|
||||||
dispatch("loading", true)
|
dispatch("loading", true)
|
||||||
|
|
||||||
@@ -125,9 +121,9 @@ const drop = (e, index) => {
|
|||||||
|
|
||||||
<div class="gallery">
|
<div class="gallery">
|
||||||
{#each list.files as file, index (file)}
|
{#each list.files as file, index (file)}
|
||||||
<div
|
<a
|
||||||
|
href="#item={index}"
|
||||||
class="file"
|
class="file"
|
||||||
on:click={() => {click_file(index)}}
|
|
||||||
draggable={list.can_edit}
|
draggable={list.can_edit}
|
||||||
on:dragstart={e => drag(e, index)}
|
on:dragstart={e => drag(e, index)}
|
||||||
on:drop|preventDefault={e => drop(e, index)}
|
on:drop|preventDefault={e => drop(e, index)}
|
||||||
@@ -141,14 +137,14 @@ const drop = (e, index) => {
|
|||||||
class:editing={list.can_edit}
|
class:editing={list.can_edit}
|
||||||
style="background-image: url('{file.icon_href}?width=256&height=256');">
|
style="background-image: url('{file.icon_href}?width=256&height=256');">
|
||||||
{#if list.can_edit}
|
{#if list.can_edit}
|
||||||
<i class="icon" on:click|stopPropagation style="cursor: grab;">drag_indicator</i>
|
<i class="icon" on:click|stopPropagation|preventDefault style="cursor: grab;">drag_indicator</i>
|
||||||
<i class="icon" on:click|stopPropagation={() => {move_left(index)}}>chevron_left</i>
|
<i class="icon" on:click|stopPropagation|preventDefault={() => {move_left(index)}}>chevron_left</i>
|
||||||
<i class="icon" on:click|stopPropagation={() => {move_right(index)}}>chevron_right</i>
|
<i class="icon" on:click|stopPropagation|preventDefault={() => {move_right(index)}}>chevron_right</i>
|
||||||
<i class="icon" on:click|stopPropagation={() => {delete_file(index)}}>delete</i>
|
<i class="icon" on:click|stopPropagation|preventDefault={() => {delete_file(index)}}>delete</i>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{file.name}
|
{file.name}
|
||||||
</div>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
{#if list.can_edit}
|
{#if list.can_edit}
|
||||||
@@ -190,6 +186,7 @@ const drop = (e, index) => {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
color: var(--text_color);
|
||||||
}
|
}
|
||||||
.file:hover, .highlight {
|
.file:hover, .highlight {
|
||||||
box-shadow: 0 0 2px 2px var(--highlight_color);
|
box-shadow: 0 0 2px 2px var(--highlight_color);
|
||||||
|
@@ -11,13 +11,12 @@ let selected_file_index = 0
|
|||||||
export const next = () => {
|
export const next = () => {
|
||||||
if (shuffle) {
|
if (shuffle) {
|
||||||
rand_item()
|
rand_item()
|
||||||
return
|
} else {
|
||||||
|
dispatch("set_file", selected_file_index+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
select_item_event(selected_file_index+1)
|
|
||||||
}
|
}
|
||||||
export const prev = () => {
|
export const prev = () => {
|
||||||
select_item_event(selected_file_index-1)
|
dispatch("set_file", selected_file_index-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
let history = []
|
let history = []
|
||||||
@@ -29,14 +28,7 @@ export const rand_item = () => {
|
|||||||
console.log("rand is " + rand)
|
console.log("rand is " + rand)
|
||||||
} while(history.indexOf(rand) > -1)
|
} while(history.indexOf(rand) > -1)
|
||||||
|
|
||||||
select_item_event(rand)
|
dispatch("set_file", rand)
|
||||||
}
|
|
||||||
|
|
||||||
// select_item_event signals to the FileViewer that the file needs to be
|
|
||||||
// changed. The FileViewer then calls set_item if the change has been approved.
|
|
||||||
// ListNavigator cannot call set_item itself because it will cause a loop.
|
|
||||||
const select_item_event = idx => {
|
|
||||||
dispatch("set_file", idx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const set_item = idx => {
|
export const set_item = idx => {
|
||||||
@@ -81,13 +73,14 @@ export const set_item = idx => {
|
|||||||
<i class="icon">chevron_left</i>
|
<i class="icon">chevron_left</i>
|
||||||
</button>
|
</button>
|
||||||
<div bind:this={file_list_div} class="list_navigator">
|
<div bind:this={file_list_div} class="list_navigator">
|
||||||
{#each files as file, index}
|
{#each files as file, index (file)}
|
||||||
<div class="list_item file_button"
|
<a
|
||||||
class:file_button_selected={file.selected}
|
href="#item={index}"
|
||||||
on:click={() => { select_item_event(index) }}>
|
class="list_item file_button"
|
||||||
|
class:file_button_selected={file.selected}>
|
||||||
<img src={file.icon_href+"?width=48&height=48"} alt={file.name} class="list_item_thumbnail" loading="lazy"/>
|
<img src={file.icon_href+"?width=48&height=48"} alt={file.name} class="list_item_thumbnail" loading="lazy"/>
|
||||||
{file.name}
|
{file.name}
|
||||||
</div>
|
</a>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<button class="nav_button" style="margin-left: 0;" on:click={next}>
|
<button class="nav_button" style="margin-left: 0;" on:click={next}>
|
||||||
|
@@ -73,6 +73,8 @@ const toggle_play = () => playing ? player.pause() : player.play()
|
|||||||
{#if file.id && !audio_reload}
|
{#if file.id && !audio_reload}
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
<audio
|
<audio
|
||||||
|
on:loadstart={() => {dispatch("loading", true)}}
|
||||||
|
on:load={() => {dispatch("loading", false)}}
|
||||||
bind:this={player}
|
bind:this={player}
|
||||||
class="player"
|
class="player"
|
||||||
controls
|
controls
|
||||||
|
@@ -38,6 +38,7 @@ let dispatch = createEventDispatcher()
|
|||||||
const download = () => { dispatch("download") }
|
const download = () => { dispatch("download") }
|
||||||
const next = () => { dispatch("next") }
|
const next = () => { dispatch("next") }
|
||||||
const prev = () => { dispatch("prev") }
|
const prev = () => { dispatch("prev") }
|
||||||
|
const loading = e => {dispatch("loading", e.detail)}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -51,11 +52,11 @@ const prev = () => { dispatch("prev") }
|
|||||||
{:else if viewer_type === "rate_limit"}
|
{:else if viewer_type === "rate_limit"}
|
||||||
<RateLimit bind:this={viewer} on:download={download}></RateLimit>
|
<RateLimit bind:this={viewer} on:download={download}></RateLimit>
|
||||||
{:else if viewer_type === "image"}
|
{:else if viewer_type === "image"}
|
||||||
<Image bind:this={viewer}></Image>
|
<Image bind:this={viewer} on:loading={loading}></Image>
|
||||||
{:else if viewer_type === "video"}
|
{:else if viewer_type === "video"}
|
||||||
<Video bind:this={viewer} on:download={download} on:prev={prev} on:next={next}></Video>
|
<Video bind:this={viewer} on:loading={loading} on:download={download} on:prev={prev} on:next={next}></Video>
|
||||||
{:else if viewer_type === "audio"}
|
{:else if viewer_type === "audio"}
|
||||||
<Audio bind:this={viewer} on:prev={prev} on:next={next}></Audio>
|
<Audio bind:this={viewer} on:loading={loading} on:prev={prev} on:next={next}></Audio>
|
||||||
{:else if viewer_type === "pdf"}
|
{:else if viewer_type === "pdf"}
|
||||||
<PDF bind:this={viewer}></PDF>
|
<PDF bind:this={viewer}></PDF>
|
||||||
{:else if viewer_type === "text"}
|
{:else if viewer_type === "text"}
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { createEventDispatcher } from "svelte"
|
||||||
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export const set_file = f => file = f
|
export const set_file = f => file = f
|
||||||
let file = {
|
let file = {
|
||||||
id: "",
|
id: "",
|
||||||
@@ -51,6 +54,8 @@ const mouseup = (e) => {
|
|||||||
|
|
||||||
<div bind:this={container} class="container" class:zoom>
|
<div bind:this={container} class="container" class:zoom>
|
||||||
<img
|
<img
|
||||||
|
on:loadstart={() => {dispatch("loading", true)}}
|
||||||
|
on:load={() => {dispatch("loading", false)}}
|
||||||
on:dblclick={() => {zoom = !zoom}}
|
on:dblclick={() => {zoom = !zoom}}
|
||||||
on:doubletap={() => {zoom = !zoom}}
|
on:doubletap={() => {zoom = !zoom}}
|
||||||
on:mousedown={mousedown}
|
on:mousedown={mousedown}
|
||||||
|
@@ -62,6 +62,8 @@ let download = () => { dispatch("download", {}) }
|
|||||||
{#if !video_reload}
|
{#if !video_reload}
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
<video
|
<video
|
||||||
|
on:loadstart={() => {dispatch("loading", true)}}
|
||||||
|
on:load={() => {dispatch("loading", false)}}
|
||||||
bind:this={player}
|
bind:this={player}
|
||||||
controls
|
controls
|
||||||
playsinline
|
playsinline
|
||||||
|
Reference in New Issue
Block a user