fix gifv view
This commit is contained in:
parent
6853149638
commit
b3189cb472
1 changed files with 66 additions and 45 deletions
|
@ -1,12 +1,3 @@
|
||||||
<%
|
|
||||||
function extension(str){
|
|
||||||
let file = str.split('/').pop();
|
|
||||||
return [file.substr(0,file.lastIndexOf('.')),file.substr(file.lastIndexOf('.'),file.length).toLowerCase()]
|
|
||||||
}
|
|
||||||
|
|
||||||
const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.mkv', '.wmv', '.webm'];
|
|
||||||
%>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -14,7 +5,7 @@ const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.mkv', '.wmv', '.webm'
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<link rel="alternate" type="application/json+oembed"
|
<link rel="alternate" type="application/json+oembed"
|
||||||
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
||||||
<meta property="og:title" content="<%= extension(url)[0] %>.gif"></meta>
|
<meta property="og:title" content="<%= extension(url)[0] %>.gif"></meta>
|
||||||
<meta property="og:description" content="Click to view the GIF"></meta>
|
<meta property="og:description" content="Click to view the GIF"></meta>
|
||||||
<meta property="og:site_name" content="embedder"></meta>
|
<meta property="og:site_name" content="embedder"></meta>
|
||||||
<meta property="og:type" content="article"></meta>
|
<meta property="og:type" content="article"></meta>
|
||||||
|
@ -27,7 +18,7 @@ const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.mkv', '.wmv', '.webm'
|
||||||
<meta name="twitter:card" content="player">
|
<meta name="twitter:card" content="player">
|
||||||
<link rel="alternate" type="application/json+oembed"
|
<link rel="alternate" type="application/json+oembed"
|
||||||
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
||||||
<meta property="og:title" content="<%= extension(url)[0]+extension(url)[1] %>"></meta>
|
<meta property="og:title" content="<%= extension(url)[0]+extension(url)[1] %>"></meta>
|
||||||
<meta property="og:description" content="Click to view the GIFv"></meta>
|
<meta property="og:description" content="Click to view the GIFv"></meta>
|
||||||
<meta property="og:site_name" content="embedder"></meta>
|
<meta property="og:site_name" content="embedder"></meta>
|
||||||
<meta property="og:type" content="article"></meta>
|
<meta property="og:type" content="article"></meta>
|
||||||
|
@ -40,7 +31,7 @@ const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.mkv', '.wmv', '.webm'
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<link rel="alternate" type="application/json+oembed"
|
<link rel="alternate" type="application/json+oembed"
|
||||||
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
href="<%= host %>/oembed/<%= extension(url)[0]+extension(url)[1] %>"></link>
|
||||||
<meta property="og:title" content="<%= extension(url)[0] + extension(url)[1] %>"></meta>
|
<meta property="og:title" content="<%= extension(url)[0] + extension(url)[1] %>"></meta>
|
||||||
<meta property="og:description" content="Click to view the image"></meta>
|
<meta property="og:description" content="Click to view the image"></meta>
|
||||||
<meta property="og:site_name" content="embedder"></meta>
|
<meta property="og:site_name" content="embedder"></meta>
|
||||||
<meta property="og:type" content="article"></meta>
|
<meta property="og:type" content="article"></meta>
|
||||||
|
@ -53,44 +44,70 @@ const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.mkv', '.wmv', '.webm'
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
html, body {
|
||||||
background-color: #121212; /* Dark background */
|
height: 100%;
|
||||||
color: #e0e0e0; /* Light text color for contrast */
|
|
||||||
font-family: Arial, sans-serif; /* A modern, readable font */
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 0;
|
||||||
|
background-color: #121212;
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
body {
|
||||||
color: #bb86fc; /* A lighter shade for links */
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-content {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 800px; /* Limit the width of the content */
|
max-width: 800px;
|
||||||
margin: auto;
|
margin: 0 auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #1e1e1e; /* Slightly lighter than body background */
|
background-color: #1e1e1e;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5); /* Adding a subtle shadow for depth */
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.media-container {
|
||||||
font-size: 24px;
|
position: relative;
|
||||||
margin-bottom: 10px;
|
width: 100%;
|
||||||
|
max-height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
.image {
|
||||||
line-height: 1.6; /* Improve readability */
|
max-width: 100%;
|
||||||
|
max-height: 80vh;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
video.image {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #bb86fc;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
text-align: center;
|
flex-shrink: 0;
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
color: #e0e0e0;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #1e1e1e; /* Dark background for the footer */
|
text-align: center;
|
||||||
color: #e0e0e0; /* Light text color for contrast */
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer p {
|
footer p {
|
||||||
|
@ -98,28 +115,32 @@ footer p {
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer a {
|
||||||
color: #bb86fc; /* Light shade for links, adjust as needed */
|
color: #bb86fc;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a:hover {
|
footer a:hover {
|
||||||
text-decoration: underline; /* Adds an underline on hover for better user experience */
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
@media (prefers-color-scheme: light) {
|
||||||
|
/* Light theme styles here */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="page-content">
|
||||||
<% if (videoExtensions.includes(extension(url)[1])) { %>
|
<div class="container">
|
||||||
<video class="image" width="100%" controls autoplay muted>
|
<div class="media-container">
|
||||||
<source src="/uploads/720p-<%= extension(url)[0]+extension(url)[1] %>" type="video/mp4">
|
<% if (videoExtensions.includes(extension(url)[1])) { %>
|
||||||
</video>
|
<video class="image" controls autoplay muted>
|
||||||
<% } else { %>
|
<source src="/uploads/720p-<%= extension(url)[0]+extension(url)[1] %>" type="video/mp4">
|
||||||
<img width="100%" src="/uploads/<%= extension(url)[0] + extension(url)[1] %>" class="image">
|
</video>
|
||||||
<% } %>
|
<% } else { %>
|
||||||
|
<img src="/uploads/<%= extension(url)[0] + extension(url)[1] %>" class="image">
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue