Improve file viewer style consistnecy
This commit is contained in:
@@ -149,7 +149,7 @@ head.valueimpression_loaded.subscribe(v => {
|
|||||||
<img bind:this={banner} usemap="#socials_map" class="banner" src="/res/img/advertising/pixeldrain_socials.webp" style="display: inline-block; width: 728px; height: 90px;" alt="Pixeldrain social media"/>
|
<img bind:this={banner} usemap="#socials_map" class="banner" src="/res/img/advertising/pixeldrain_socials.webp" style="display: inline-block; width: 728px; height: 90px;" alt="Pixeldrain social media"/>
|
||||||
|
|
||||||
{:else if ad_type === "patreon_support"}
|
{:else if ad_type === "patreon_support"}
|
||||||
<div class="banner highlight_green" style="font-size: 1.1em; border-radius: 0;">
|
<div class="banner support_banner">
|
||||||
<span style="display: block; margin-bottom: 2px;">
|
<span style="display: block; margin-bottom: 2px;">
|
||||||
No ads today. Pixeldrain is currently funded by our subscribers!
|
No ads today. Pixeldrain is currently funded by our subscribers!
|
||||||
</span>
|
</span>
|
||||||
@@ -193,4 +193,9 @@ head.valueimpression_loaded.subscribe(v => {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
transform-origin: 0 0;
|
transform-origin: 0 0;
|
||||||
}
|
}
|
||||||
|
.support_banner {
|
||||||
|
font-size: 1.2em;
|
||||||
|
text-align: center;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -10,9 +10,9 @@ let file = {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<br/>
|
<h1>{file.name}</h1>
|
||||||
<TextBlock width="750px">
|
<TextBlock>
|
||||||
<h1>Unavailable for legal reasons</h1>
|
<h2>Unavailable for legal reasons</h2>
|
||||||
<p>
|
<p>
|
||||||
This file has been removed for violating pixeldrain's
|
This file has been removed for violating pixeldrain's
|
||||||
<a href="/about#content-policy">content policy</a>. Type of abuse:
|
<a href="/about#content-policy">content policy</a>. Type of abuse:
|
||||||
|
@@ -12,7 +12,7 @@ $: transfer_left = download_limits.transfer_limit = download_limits.transfer_lim
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $download_limits.loaded}
|
{#if $download_limits.loaded}
|
||||||
<TextBlock width="700px" center={true}>
|
<TextBlock center={true}>
|
||||||
{#if file.size > transfer_left}
|
{#if file.size > transfer_left}
|
||||||
<div class="highlight_yellow">
|
<div class="highlight_yellow">
|
||||||
This file is too large to download completely with your current
|
This file is too large to download completely with your current
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import BandwidthUsage from "./BandwidthUsage.svelte";
|
import BandwidthUsage from "./BandwidthUsage.svelte";
|
||||||
import TextBlock from "./TextBlock.svelte";
|
import IconBlock from "./IconBlock.svelte";
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export const set_file = f => file = f
|
export const set_file = f => file = f
|
||||||
@@ -17,8 +17,7 @@ let file = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>{file.name}</h1>
|
<h1>{file.name}</h1>
|
||||||
<img src={file.icon_href} alt="File icon" class="icon">
|
<IconBlock icon_href={file.icon_href}>
|
||||||
<TextBlock width="600px">
|
|
||||||
Type: {file.mime_type}<br/>
|
Type: {file.mime_type}<br/>
|
||||||
No preview is available for this file type. Download to view it locally.
|
No preview is available for this file type. Download to view it locally.
|
||||||
<br/>
|
<br/>
|
||||||
@@ -26,9 +25,8 @@ let file = {
|
|||||||
<i class="icon">download</i>
|
<i class="icon">download</i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
</TextBlock>
|
</IconBlock>
|
||||||
|
<br/>
|
||||||
<br/><br/>
|
|
||||||
{#if file.show_ads}
|
{#if file.show_ads}
|
||||||
<BandwidthUsage file={file} on:reload/>
|
<BandwidthUsage file={file} on:reload/>
|
||||||
{/if}
|
{/if}
|
||||||
|
36
svelte/src/file_viewer/viewers/IconBlock.svelte
Normal file
36
svelte/src/file_viewer/viewers/IconBlock.svelte
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<script>
|
||||||
|
export let icon_href = ""
|
||||||
|
export let width = "750px"
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="block" style="width: {width}; max-width: 100%">
|
||||||
|
<img src={icon_href} alt="File icon" class="icon">
|
||||||
|
<div class="description">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.block {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-right: 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
/* Prevent icon from being stretched if text content is too large */
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
.description {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: initial;
|
||||||
|
padding-left: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
|
||||||
|
background-color: var(--shaded_background);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
@@ -15,7 +15,7 @@ export let file = {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<TextBlock width="800px">
|
<TextBlock>
|
||||||
<img src="/res/img/slow_down.webp" class="header_image" alt="Yea, I'm gonna need you to slow down a bit"/>
|
<img src="/res/img/slow_down.webp" class="header_image" alt="Yea, I'm gonna need you to slow down a bit"/>
|
||||||
<p>
|
<p>
|
||||||
Pixeldrain's free tier is supported by advertisements. There's only so
|
Pixeldrain's free tier is supported by advertisements. There's only so
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
export let width = "800px"
|
export let width = "750px"
|
||||||
export let center = false
|
export let center = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="block" class:center style="max-width: {width};">
|
<div class="block" class:center style="width: {width};">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ export let center = false
|
|||||||
text-align: initial;
|
text-align: initial;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
max-width: 100%;
|
||||||
|
|
||||||
background-color: var(--shaded_background);
|
background-color: var(--shaded_background);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@@ -3,6 +3,7 @@ import { createEventDispatcher } from "svelte";
|
|||||||
import Magnet from "../../icons/Magnet.svelte";
|
import Magnet from "../../icons/Magnet.svelte";
|
||||||
import { formatDate } from "../../util/Formatting.svelte"
|
import { formatDate } from "../../util/Formatting.svelte"
|
||||||
import { copy_text } from "../../util/Util.svelte";
|
import { copy_text } from "../../util/Util.svelte";
|
||||||
|
import IconBlock from "./IconBlock.svelte";
|
||||||
import TextBlock from "./TextBlock.svelte";
|
import TextBlock from "./TextBlock.svelte";
|
||||||
import TorrentItem from "./TorrentItem.svelte"
|
import TorrentItem from "./TorrentItem.svelte"
|
||||||
|
|
||||||
@@ -79,8 +80,7 @@ const copy_magnet = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>{file.name}</h1>
|
<h1>{file.name}</h1>
|
||||||
<img src={file.icon_href} alt="File icon" class="icon">
|
<IconBlock icon_href={file.icon_href}>
|
||||||
<TextBlock width="650px">
|
|
||||||
{#if status === "finished"}
|
{#if status === "finished"}
|
||||||
Created by: {torrent.created_by}<br/>
|
Created by: {torrent.created_by}<br/>
|
||||||
Comment: {torrent.comment}<br/>
|
Comment: {torrent.comment}<br/>
|
||||||
@@ -120,12 +120,10 @@ const copy_magnet = () => {
|
|||||||
<i class="icon">download</i>
|
<i class="icon">download</i>
|
||||||
<span>Download torrent file</span>
|
<span>Download torrent file</span>
|
||||||
</button>
|
</button>
|
||||||
</TextBlock>
|
</IconBlock>
|
||||||
|
<br/>
|
||||||
{#if status === "finished"}
|
{#if status === "finished"}
|
||||||
<br/>
|
<TextBlock>
|
||||||
<br/>
|
|
||||||
<TextBlock width="1000px">
|
|
||||||
<h2>Files in this torrent</h2>
|
<h2>Files in this torrent</h2>
|
||||||
<TorrentItem item={torrent.files} />
|
<TorrentItem item={torrent.files} />
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount, createEventDispatcher, tick } from "svelte";
|
import { onMount, createEventDispatcher, tick } from "svelte";
|
||||||
import BandwidthUsage from "./BandwidthUsage.svelte";
|
import BandwidthUsage from "./BandwidthUsage.svelte";
|
||||||
import TextBlock from "./TextBlock.svelte";
|
import IconBlock from "./IconBlock.svelte";
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export let is_list = false
|
export let is_list = false
|
||||||
@@ -163,8 +163,7 @@ const fullscreen = () => {
|
|||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<h1>{file.name}</h1>
|
<h1>{file.name}</h1>
|
||||||
<img src={file.icon_href} class="video_icon" alt="Video icon">
|
<IconBlock icon_href={file.icon_href}>
|
||||||
<TextBlock width="600px">
|
|
||||||
The online video player on pixeldrain is only available for registered
|
The online video player on pixeldrain is only available for registered
|
||||||
users, or when the uploader of the video has a Pro account. You can
|
users, or when the uploader of the video has a Pro account. You can
|
||||||
still download the video and watch it locally on your computer without
|
still download the video and watch it locally on your computer without
|
||||||
@@ -179,9 +178,8 @@ const fullscreen = () => {
|
|||||||
<a href="https://www.patreon.com/join/pixeldrain" target="_blank" class="button" rel="noreferrer">
|
<a href="https://www.patreon.com/join/pixeldrain" target="_blank" class="button" rel="noreferrer">
|
||||||
<i class="icon">bolt</i> Get Pixeldrain Pro
|
<i class="icon">bolt</i> Get Pixeldrain Pro
|
||||||
</a>
|
</a>
|
||||||
</TextBlock>
|
</IconBlock>
|
||||||
|
<br/>
|
||||||
<br/><br/>
|
|
||||||
{#if file.show_ads}
|
{#if file.show_ads}
|
||||||
<BandwidthUsage file={file} on:reload/>
|
<BandwidthUsage file={file} on:reload/>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -226,11 +224,6 @@ h1 {
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
.video_icon {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
@media(max-height: 500px) {
|
@media(max-height: 500px) {
|
||||||
.container {
|
.container {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
import { formatDataVolume, formatDate } from "../../util/Formatting.svelte"
|
import { formatDataVolume, formatDate } from "../../util/Formatting.svelte"
|
||||||
|
import IconBlock from "./IconBlock.svelte";
|
||||||
import TextBlock from "./TextBlock.svelte";
|
import TextBlock from "./TextBlock.svelte";
|
||||||
import ZipItem from "./ZipItem.svelte";
|
import ZipItem from "./ZipItem.svelte";
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ let zip = {
|
|||||||
children: null,
|
children: null,
|
||||||
}
|
}
|
||||||
let uncomp_size = 0
|
let uncomp_size = 0
|
||||||
|
let comp_ratio = 0
|
||||||
|
|
||||||
export const set_file = async f => {
|
export const set_file = async f => {
|
||||||
file = f
|
file = f
|
||||||
@@ -37,6 +39,7 @@ export const set_file = async f => {
|
|||||||
zip = await resp.json()
|
zip = await resp.json()
|
||||||
|
|
||||||
uncomp_size = recursive_size(zip)
|
uncomp_size = recursive_size(zip)
|
||||||
|
comp_ratio = (uncomp_size / file.size)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -64,34 +67,30 @@ const recursive_size = (file) => {
|
|||||||
|
|
||||||
<h1>{file.name}</h1>
|
<h1>{file.name}</h1>
|
||||||
|
|
||||||
<img src={file.icon_href} alt="File icon" class="icon">
|
<IconBlock icon_href={file.icon_href}>
|
||||||
<TextBlock width="600px">
|
|
||||||
Compressed size: {formatDataVolume(file.size, 3)}<br/>
|
Compressed size: {formatDataVolume(file.size, 3)}<br/>
|
||||||
Uncompressed size: {formatDataVolume(uncomp_size, 3)}<br/>
|
Uncompressed size: {formatDataVolume(uncomp_size, 3)} (Ratio: {comp_ratio.toFixed(2)}x)<br/>
|
||||||
Uploaded on: {formatDate(file.date_upload, true, true, true)}
|
Uploaded on: {formatDate(file.date_upload, true, true, true)}
|
||||||
<br/>
|
<br/>
|
||||||
<button class="button_highlight" on:click={() => {dispatch("download")}}>
|
<button class="button_highlight" on:click={() => {dispatch("download")}}>
|
||||||
<i class="icon">download</i>
|
<i class="icon">download</i>
|
||||||
<span>Download</span>
|
<span>Download</span>
|
||||||
</button>
|
</button>
|
||||||
|
</IconBlock>
|
||||||
|
<br/>
|
||||||
|
{#if status === "finished"}
|
||||||
|
<TextBlock>
|
||||||
|
<h2>Files in this zip archive</h2>
|
||||||
|
<ZipItem item={zip} />
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<br/><br/>
|
{:else if status === "parse_failed"}
|
||||||
|
<TextBlock>
|
||||||
{#if status === "parse_failed"}
|
|
||||||
<TextBlock width="650px">
|
|
||||||
<p>
|
<p>
|
||||||
Zip archive could not be parsed. It may be corrupted.
|
Zip archive could not be parsed. It may be corrupted.
|
||||||
</p>
|
</p>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if status === "finished"}
|
|
||||||
<TextBlock width="1000px">
|
|
||||||
<h2>Files in this zip archive</h2>
|
|
||||||
<ZipItem item={zip} />
|
|
||||||
</TextBlock>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
h1 {
|
h1 {
|
||||||
text-shadow: 1px 1px 3px var(--shadow_color);
|
text-shadow: 1px 1px 3px var(--shadow_color);
|
||||||
|
@@ -260,7 +260,7 @@ func (s styleSheet) String() string {
|
|||||||
s.BodyBackground.CSS(),
|
s.BodyBackground.CSS(),
|
||||||
s.BodyText.CSS(),
|
s.BodyText.CSS(),
|
||||||
s.Separator.CSS(),
|
s.Separator.CSS(),
|
||||||
s.BodyColor.WithAlpha(0.5).CSS(), // shaded_background
|
s.BodyColor.WithAlpha(0.6).CSS(), // shaded_background
|
||||||
s.CardColor.CSS(),
|
s.CardColor.CSS(),
|
||||||
s.Chart1.CSS(),
|
s.Chart1.CSS(),
|
||||||
s.Chart2.CSS(),
|
s.Chart2.CSS(),
|
||||||
|
Reference in New Issue
Block a user