init commit

new file:   .gitignore
	new file:   .idea/.gitignore
	new file:   .idea/dataSources.xml
	new file:   .idea/dbr-backend.iml
	new file:   .idea/jsLibraryMappings.xml
	new file:   .idea/misc.xml
	new file:   .idea/modules.xml
	new file:   .idea/vcs.xml
	new file:   go.mod
	new file:   go.sum
	new file:   main.go
	new file:   pb_public/admin/index.html
	new file:   pb_public/admin/upload.html
	new file:   pb_public/css/base.css
	new file:   pb_public/css/bootstrap-grid.css
	new file:   pb_public/css/bootstrap-grid.css.map
	new file:   pb_public/css/bootstrap-grid.min.css
	new file:   pb_public/css/bootstrap-grid.min.css.map
	new file:   pb_public/css/bootstrap-grid.rtl.css
	new file:   pb_public/css/bootstrap-grid.rtl.css.map
	new file:   pb_public/css/bootstrap-grid.rtl.min.css
	new file:   pb_public/css/bootstrap-grid.rtl.min.css.map
	new file:   pb_public/css/bootstrap-reboot.css
	new file:   pb_public/css/bootstrap-reboot.css.map
	new file:   pb_public/css/bootstrap-reboot.min.css
	new file:   pb_public/css/bootstrap-reboot.min.css.map
	new file:   pb_public/css/bootstrap-reboot.rtl.css
	new file:   pb_public/css/bootstrap-reboot.rtl.css.map
	new file:   pb_public/css/bootstrap-reboot.rtl.min.css
	new file:   pb_public/css/bootstrap-reboot.rtl.min.css.map
	new file:   pb_public/css/bootstrap-utilities.css
	new file:   pb_public/css/bootstrap-utilities.css.map
	new file:   pb_public/css/bootstrap-utilities.min.css
	new file:   pb_public/css/bootstrap-utilities.min.css.map
	new file:   pb_public/css/bootstrap-utilities.rtl.css
	new file:   pb_public/css/bootstrap-utilities.rtl.css.map
	new file:   pb_public/css/bootstrap-utilities.rtl.min.css
	new file:   pb_public/css/bootstrap-utilities.rtl.min.css.map
	new file:   pb_public/css/bootstrap.css
	new file:   pb_public/css/bootstrap.css.map
	new file:   pb_public/css/bootstrap.min.css
	new file:   pb_public/css/bootstrap.min.css.map
	new file:   pb_public/css/bootstrap.rtl.css
	new file:   pb_public/css/bootstrap.rtl.css.map
	new file:   pb_public/css/bootstrap.rtl.min.css
	new file:   pb_public/css/bootstrap.rtl.min.css.map
	new file:   pb_public/css/icons/bootstrap-icons.css
	new file:   pb_public/css/icons/fonts/bootstrap-icons.woff
	new file:   pb_public/css/icons/fonts/bootstrap-icons.woff2
	new file:   pb_public/css/slideshow.css
	new file:   pb_public/css/style.css
	new file:   pb_public/css/upload.css
	new file:   pb_public/css/uploadfile.css
	new file:   pb_public/index.html
	new file:   pb_public/js/api/media.js
	new file:   pb_public/js/bootstrap.bundle.js
	new file:   pb_public/js/bootstrap.bundle.js.map
	new file:   pb_public/js/bootstrap.bundle.min.js
	new file:   pb_public/js/bootstrap.bundle.min.js.map
	new file:   pb_public/js/bootstrap.esm.js
	new file:   pb_public/js/bootstrap.esm.js.map
	new file:   pb_public/js/bootstrap.esm.min.js
	new file:   pb_public/js/bootstrap.esm.min.js.map
	new file:   pb_public/js/bootstrap.js
	new file:   pb_public/js/bootstrap.js.map
	new file:   pb_public/js/bootstrap.min.js
	new file:   pb_public/js/bootstrap.min.js.map
	new file:   pb_public/js/jquery-1.11.0.js
	new file:   pb_public/js/jquery.uploadfile.min.js
	new file:   pb_public/js/multiple-uploader.js
	new file:   pb_public/js/pocketbase/pocketbase.esm.js
	new file:   pb_public/js/pocketbase/pocketbase.umd.js
	new file:   pb_public/js/slideshow.js
	new file:   pb_public/js/upload.js
	new file:   pb_public/js/util.js
This commit is contained in:
Elmar Kresse
2023-01-30 07:33:24 +01:00
commit c6657ede34
91 changed files with 84686 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/pb_data/*
/pb_data/**

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

17
.idea/dataSources.xml generated Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="data" uuid="f8561cd4-cd58-433e-93c0-1e5cf60505e7">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\MiBook\GolandProjects\dbr-backend\pb_data\data.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.39.2/sqlite-jdbc-3.39.2.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

12
.idea/dbr-backend.iml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
<excludeFolder url="file://$MODULE_DIR$/pb_data/storage/onxkahyumxp44tz/utofeessbq04lsz" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/jsLibraryMappings.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="PROJECT" libraries="{jquery-1.11.0}" />
</component>
</project>

6
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="FLOW" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/dbr-backend.iml" filepath="$PROJECT_DIR$/.idea/dbr-backend.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

87
go.mod Normal file
View File

@ -0,0 +1,87 @@
module dbr-backend
go 1.19
require github.com/pocketbase/pocketbase v0.10.4
require (
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.165 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.7 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.46 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.22 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.28 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/domodwyer/mailyak/v3 v3.3.4 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.1 // indirect
github.com/ganigeorgiev/fexpr v0.1.1 // indirect
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/wire v0.5.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/pocketbase/dbx v1.8.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
go.opencensus.io v0.24.0 // indirect
gocloud.dev v0.27.0 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/image v0.2.0 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.4.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.105.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
modernc.org/ccgo/v3 v3.16.13 // indirect
modernc.org/libc v1.22.2 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.20.0 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
)

2370
go.sum Normal file

File diff suppressed because it is too large Load Diff

23
main.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/apis"
"github.com/pocketbase/pocketbase/core"
"log"
"os"
)
func main() {
app := pocketbase.New()
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
// add new "GET /hello" route to the app router (echo)
e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS("./pb_public"), false))
return nil
})
if err := app.Start(); err != nil {
log.Fatal(err)
}
}

BIN
pb_data/data.db Normal file

Binary file not shown.

BIN
pb_data/logs.db Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":{"original-filename":"Screenshot (3).png"},"md5":"eNzl4XWNbStDPz/VjtRSmg=="}

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"uQTx3mvJI01gb3t9XZ/6ZQ=="}

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"usKf1Ws4ZKcI9/78vnqeJQ=="}

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"XAG72tlR76YK20pBAxYv1Q=="}

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"EKX+EdLPr8tmO7mZ7SCuuw=="}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/jpeg","user.metadata":{"original-filename":"image0.jpeg"},"md5":"5QjPSBVntbIXwCzS6VYOfw=="}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1 @@
{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/jpeg","user.metadata":null,"md5":"ZM+CD9USHcqYSAgBAV+IAQ=="}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Panel</title>
</head>
<body>
Admin
</body>
</html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>

14
pb_public/css/base.css Normal file
View File

@ -0,0 +1,14 @@
body {
background: #000;
margin: 0;
padding: 0;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color:#fff;
}
a {
color: #fff;
}
ul {
font-size: 1.3em;
line-height: 1.5em;
}

5051
pb_public/css/bootstrap-grid.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/css/bootstrap-grid.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5050
pb_public/css/bootstrap-grid.rtl.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

485
pb_public/css/bootstrap-reboot.css vendored Normal file
View File

@ -0,0 +1,485 @@
/*!
* Bootstrap Reboot v5.1.3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
:root {
--bs-blue: #0d6efd;
--bs-indigo: #6610f2;
--bs-purple: #6f42c1;
--bs-pink: #d63384;
--bs-red: #dc3545;
--bs-orange: #fd7e14;
--bs-yellow: #ffc107;
--bs-green: #198754;
--bs-teal: #20c997;
--bs-cyan: #0dcaf0;
--bs-white: #fff;
--bs-gray: #6c757d;
--bs-gray-dark: #343a40;
--bs-gray-100: #f8f9fa;
--bs-gray-200: #e9ecef;
--bs-gray-300: #dee2e6;
--bs-gray-400: #ced4da;
--bs-gray-500: #adb5bd;
--bs-gray-600: #6c757d;
--bs-gray-700: #495057;
--bs-gray-800: #343a40;
--bs-gray-900: #212529;
--bs-primary: #0d6efd;
--bs-secondary: #6c757d;
--bs-success: #198754;
--bs-info: #0dcaf0;
--bs-warning: #ffc107;
--bs-danger: #dc3545;
--bs-light: #f8f9fa;
--bs-dark: #212529;
--bs-primary-rgb: 13, 110, 253;
--bs-secondary-rgb: 108, 117, 125;
--bs-success-rgb: 25, 135, 84;
--bs-info-rgb: 13, 202, 240;
--bs-warning-rgb: 255, 193, 7;
--bs-danger-rgb: 220, 53, 69;
--bs-light-rgb: 248, 249, 250;
--bs-dark-rgb: 33, 37, 41;
--bs-white-rgb: 255, 255, 255;
--bs-black-rgb: 0, 0, 0;
--bs-body-color-rgb: 33, 37, 41;
--bs-body-bg-rgb: 255, 255, 255;
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--bs-body-font-family: var(--bs-font-sans-serif);
--bs-body-font-size: 1rem;
--bs-body-font-weight: 400;
--bs-body-line-height: 1.5;
--bs-body-color: #212529;
--bs-body-bg: #fff;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: var(--bs-font-monospace);
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::-webkit-file-upload-button {
font: inherit;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

482
pb_public/css/bootstrap-reboot.rtl.css vendored Normal file
View File

@ -0,0 +1,482 @@
/*!
* Bootstrap Reboot v5.1.3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
:root {
--bs-blue: #0d6efd;
--bs-indigo: #6610f2;
--bs-purple: #6f42c1;
--bs-pink: #d63384;
--bs-red: #dc3545;
--bs-orange: #fd7e14;
--bs-yellow: #ffc107;
--bs-green: #198754;
--bs-teal: #20c997;
--bs-cyan: #0dcaf0;
--bs-white: #fff;
--bs-gray: #6c757d;
--bs-gray-dark: #343a40;
--bs-gray-100: #f8f9fa;
--bs-gray-200: #e9ecef;
--bs-gray-300: #dee2e6;
--bs-gray-400: #ced4da;
--bs-gray-500: #adb5bd;
--bs-gray-600: #6c757d;
--bs-gray-700: #495057;
--bs-gray-800: #343a40;
--bs-gray-900: #212529;
--bs-primary: #0d6efd;
--bs-secondary: #6c757d;
--bs-success: #198754;
--bs-info: #0dcaf0;
--bs-warning: #ffc107;
--bs-danger: #dc3545;
--bs-light: #f8f9fa;
--bs-dark: #212529;
--bs-primary-rgb: 13, 110, 253;
--bs-secondary-rgb: 108, 117, 125;
--bs-success-rgb: 25, 135, 84;
--bs-info-rgb: 13, 202, 240;
--bs-warning-rgb: 255, 193, 7;
--bs-danger-rgb: 220, 53, 69;
--bs-light-rgb: 248, 249, 250;
--bs-dark-rgb: 33, 37, 41;
--bs-white-rgb: 255, 255, 255;
--bs-black-rgb: 0, 0, 0;
--bs-body-color-rgb: 33, 37, 41;
--bs-body-bg-rgb: 255, 255, 255;
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--bs-body-font-family: var(--bs-font-sans-serif);
--bs-body-font-size: 1rem;
--bs-body-font-weight: 400;
--bs-body-line-height: 1.5;
--bs-body-color: #212529;
--bs-body-bg: #fff;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: var(--bs-font-monospace);
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::-webkit-file-upload-button {
font: inherit;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4866
pb_public/css/bootstrap-utilities.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4857
pb_public/css/bootstrap-utilities.rtl.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

11266
pb_public/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

11242
pb_public/css/bootstrap.rtl.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/css/bootstrap.rtl.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1876
pb_public/css/icons/bootstrap-icons.css vendored Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,77 @@
.slideshow-info, .slideshow-docs {
position: absolute;
padding: 5px 10px;
background: rgba(0,0,0,.8);
color: #fff;
visibility: hidden;
}
.slideshow-docs {
right: 0;
text-align: right;
}
.slideshow-docs span {
display: block;
}
.slideshow-wrapper {
width:100%;
height:100vh;
overflow: hidden;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
}
.slideshow-wrapper video {
object-fit: contain;
width:100%;
height:100%;
}
#slideshow-next, #slideshow-prev {
position: absolute;
top: 70px;
width: 40px;
text-align: center;
font-size: 2em;
height: calc(100vh - 70px);
background: rgba(0,0,0,.2);
border: none;
color: #fff;
z-index: 10;
}
#slideshow-next.hidden, #slideshow-prev.hidden,#slideshow-autoplay.hidden {
display: none;
}
#slideshow-autoplay {
position: absolute;
bottom: 5px;
text-align: center;
font-size: 2em;
width: 5em;
left: calc(50% - 2.5em);
background: transparent;
border: none;
color: #fff;
z-index: 10;
}
#slideshow-autoplay:focus {
outline: 2px solid #fff;
}
#slideshow-next:focus, #slideshow-prev:focus {
border: none;
color: lime;
outline: none;
}
#slideshow-next {
right: 0;
}
.slideshow-wrapper[data-loaded=false]::after {
content: ''; /* loading <- Textanzeige */
position: absolute;
top: 3em;
background: rgba(0,0,0,.8);
padding: 5px 10px;
font-size: 1.5em;
z-index:10;
color: #fff;
transition: 200ms;
}

6757
pb_public/css/style.css Normal file

File diff suppressed because it is too large Load Diff

107
pb_public/css/upload.css Normal file
View File

@ -0,0 +1,107 @@
.multiple-uploader {
display: flex;
flex-wrap: wrap;
justify-content: center;
border-radius: 15px;
border: 2px dashed #858585;
min-height: 150px;
margin: 20px auto;
cursor: pointer;
width: 80%;
}
.mup-msg {
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.mup-msg span {
margin-bottom: 10px;
}
.mup-msg .mup-main-msg {
color: #606060;
font-size: 1.2rem;
font-weight: 700;
}
.mup-msg .mup-msg {
color: #737373;
}
.image-container{
margin: 1rem;
width: 120px;
height: 120px;
position: relative;
cursor: auto;
pointer-events: unset;
}
.image-container:before {
z-index: 3;
content: "\2716";
align-content: center;
font-size: 10px;
font-weight: bold;
text-align: center;
line-height: 22px;
color: white;
position: absolute;
top: -5px;
left: -5px;
width: 20px;
height: 20px;
border-radius: 50%;
background: #e50000;
pointer-events: all;
cursor: pointer;
}
.image-preview {
position: absolute;
width: 120px;
height: 120px;
border-radius: 12px;
}
.image-size {
position: absolute;
z-index: 1;
height: 120px;
width: 120px;
backdrop-filter: blur(4px);
font-weight: bolder;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
opacity: 0;
pointer-events: unset;
}
.image-size:hover {
opacity: 1;
}
.exceeded-size
{
position: absolute;
z-index: 2;
height: 120px;
width: 120px;
display: flex;
font-weight: bold;
font-size: 12px;
text-align: center;
align-items: center;
justify-content: center;
border-radius: 12px;
color: white;
background: rgba(255, 0, 0, 0.6);
pointer-events: unset;
}

View File

@ -0,0 +1,164 @@
.ajax-file-upload-statusbar {
border: 1px solid #0ba1b5;
margin-top: 10px;
width: 420px;
margin-right: 10px;
margin: 5px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
padding: 5px 5px 5px 15px
}
.ajax-file-upload-filename {
width: 300px;
height: auto;
margin: 0 5px 5px 0px;
}
.ajax-file-upload-filesize {
width: 50px;
height: auto;
margin: 0 5px 5px 0px;
display: inline-block;
vertical-align:middle;
}
.ajax-file-upload-progress {
margin: 5px 10px 5px 0px;
position: relative;
width: 250px;
border: 1px solid #ddd;
padding: 1px;
border-radius: 3px;
display: inline-block;
color:#FFFFFF;
}
.ajax-file-upload-bar {
background-color: #0ba1b5;
width: 0;
height: 20px;
border-radius: 3px;
color:#FFFFFF;
}
.ajax-file-upload-percent {
position: absolute;
display: inline-block;
top: 3px;
left: 48%
}
.ajax-file-upload-red {
-moz-box-shadow: inset 0 39px 0 -24px #e67a73;
-webkit-box-shadow: inset 0 39px 0 -24px #e67a73;
box-shadow: inset 0 39px 0 -24px #e67a73;
background-color: #e4685d;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
display: inline-block;
color: #fff;
font-family: arial;
font-size: 13px;
font-weight: normal;
padding: 4px 15px;
text-decoration: none;
text-shadow: 0 1px 0 #b23e35;
cursor: pointer;
vertical-align: top;
margin: 5px 10px 5px 0px;
}
.ajax-file-upload-green {
background-color: #77b55a;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
margin: 0;
padding: 0;
display: inline-block;
color: #fff;
font-family: arial;
font-size: 13px;
font-weight: normal;
padding: 4px 15px;
text-decoration: none;
cursor: pointer;
text-shadow: 0 1px 0 #5b8a3c;
vertical-align: top;
margin: 5px 10px 5px 0px;
}
.ajax-file-upload {
font-family: Arial, Helvetica, sans-serif;
/*! font-size: 16px; */
/*! font-weight: bold; */
padding: 15px 20px;
cursor:pointer;
line-height:20px;
height:25px;
margin:0 10px 10px 0;
display: inline-block;
background: #fff;
/*! border: 1px solid #e8e8e8; */
color: #888;
/*! text-decoration: none; */
/*! border-radius: 3px; */
/*! -webkit-border-radius: 3px; */
-moz-border-radius: 3px;
-moz-box-shadow: 0 2px 0 0 #e8e8e8;
/*! -webkit-box-shadow: 0 2px 0 0 #e8e8e8; */
/*! box-shadow: 0 2px 0 0 #e8e8e8; */
padding: 6px 10px 4px 10px;
color: #495057;
/*! background: #2f8ab9; */
/*! border: none; */
/*! -moz-box-shadow: 0 2px 0 0 #13648d; */
/*! -webkit-box-shadow: 0 2px 0 0 #13648d; */
/*! box-shadow: 0 2px 0 0 #13648d; */
vertical-align: middle;
display: -ms-flexbox;
display: ruby;
-ms-flex-align: center;
align-items: center;
padding: .375rem .75rem;
margin-bottom: 0;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
text-align: center;
white-space: nowrap;
background-color: #e9ecef;
border: 1px solid #ced4da;
border-radius: .25rem;
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
.ajax-file-upload:hover {
background: #3396c9;
-moz-box-shadow: 0 2px 0 0 #15719f;
-webkit-box-shadow: 0 2px 0 0 #15719f;
box-shadow: 0 2px 0 0 #15719f;
}
.ajax-upload-dragdrop
{
border:1px solid #DADCE3;
width: 100%;
color: #505051;
text-align:left;
vertical-align:middle;
padding:10px 10px 0px 10px;
border-radius: 5px;
}
.state-hover
{
border:2px solid #A5A5C7;
}
.ajax-file-upload-container
{
margin:20px 0px 20px 0px;
}

68
pb_public/index.html Normal file
View File

@ -0,0 +1,68 @@
<html lang="de" style="overflow: hidden;">
<head>
<style>
body {
background-color: #000;
margin: 0;
}
#image_container {
position: relative;
}
#image_blur {
background-size: cover;
width: 100%;
height: 100%;
z-index: 0;
position: relative;
filter: blur(20px) brightness(50%);
}
#image {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
margin-left: auto;
margin-right: auto;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
</style>
<title>SlideShow</title>
</head>
<body>
<div id="image_container">
<div id="image_blur"></div>
<div id="image"></div>
</div>
</body>
<script type="module">
import PocketBase from './js/pocketbase/pocketbase.esm.js'
const sliderArrayQuery = [];
const pb = new PocketBase('http://127.0.0.1:8090');
const media = pb.collection('media').getFullList(200, {
sort: '-created',
});
media.then(
it => it.forEach((arrObj) => {
sliderArrayQuery.push(new Slider(arrObj.collectionId, arrObj.collectionName, arrObj.created, arrObj.duration, arrObj.enabled, arrObj.id, arrObj.media, arrObj.updated))
let sliderArray = sliderArrayQuery.filter(mediaObjekt => {return mediaObjekt.enabled === true})
let slideshow = new Slideshow('#image_container', sliderArray, '', true, true, 0)
startSlideShow(slideshow)
})
);
</script>
<script src="js/slideshow.js"></script>
</html>

View File

@ -0,0 +1 @@

6812
pb_public/js/bootstrap.bundle.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/js/bootstrap.bundle.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4999
pb_public/js/bootstrap.esm.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/js/bootstrap.esm.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5046
pb_public/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
pb_public/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10337
pb_public/js/jquery-1.11.0.js vendored Normal file

File diff suppressed because it is too large Load Diff

801
pb_public/js/jquery.uploadfile.min.js vendored Normal file
View File

@ -0,0 +1,801 @@
/*!
* jQuery Upload File Plugin
* version: 4.0.11
* @requires jQuery v1.5 or later & form plugin
* Copyright (c) 2013 Ravishanker Kusuma
* http://hayageek.com/
*/
!(function (e) {
void 0 == e.fn.ajaxForm &&
e.getScript(
("https:" == document.location.protocol ? "https://" : "http://") +
"malsup.github.io/jquery.form.js"
);
var a = {};
(a.fileapi = void 0 !== e("<input type='file'/>").get(0).files),
(a.formdata = void 0 !== window.FormData),
(e.fn.uploadFile = function (t) {
function r() {
D ||
((D = !0),
(function e() {
if (
(w.sequential || (w.sequentialCount = 99999),
0 == x.length && 0 == F.length)
)
w.afterUploadAll && w.afterUploadAll(C), (D = !1);
else {
if (F.length < w.sequentialCount) {
var a = x.shift();
void 0 != a &&
(F.push(a), a.removeClass(C.formGroup), a.submit());
}
window.setTimeout(e, 100);
}
})());
}
function o(a, t, r) {
r.on("dragenter", function (a) {
a.stopPropagation(),
a.preventDefault(),
e(this).addClass(t.dragDropHoverClass);
}),
r.on("dragover", function (a) {
a.stopPropagation(), a.preventDefault();
var r = e(this);
r.hasClass(t.dragDropContainerClass) &&
!r.hasClass(t.dragDropHoverClass) &&
r.addClass(t.dragDropHoverClass);
}),
r.on("drop", function (r) {
r.preventDefault(),
e(this).removeClass(t.dragDropHoverClass),
a.errorLog.html("");
var o = r.originalEvent.dataTransfer.files;
!t.multiple && o.length > 1
? t.showError &&
e(
"<div class='" +
t.errorClass +
"'>" +
t.multiDragErrorStr +
"</div>"
).appendTo(a.errorLog)
: 0 != t.onSelect(o) && l(t, a, o);
}),
r.on("dragleave", function (a) {
e(this).removeClass(t.dragDropHoverClass);
}),
e(document).on("dragenter", function (e) {
e.stopPropagation(), e.preventDefault();
}),
e(document).on("dragover", function (a) {
a.stopPropagation(), a.preventDefault();
var r = e(this);
r.hasClass(t.dragDropContainerClass) ||
r.removeClass(t.dragDropHoverClass);
}),
e(document).on("drop", function (a) {
a.stopPropagation(),
a.preventDefault(),
e(this).removeClass(t.dragDropHoverClass);
});
}
function s(e) {
var a = e / 1024;
return parseInt(a) > 1024
? (a / 1024).toFixed(2) + " MB"
: a.toFixed(2) + " KB";
}
function i(a) {
var t,
r,
o = [],
s = (o =
"string" == jQuery.type(a) ? a.split("&") : e.param(a).split("&"))
.length,
i = [];
for (t = 0; t < s; t++)
(o[t] = o[t].replace(/\+/g, " ")),
(r = o[t].split("=")),
i.push([decodeURIComponent(r[0]), decodeURIComponent(r[1])]);
return i;
}
function l(a, t, r) {
for (var o = 0; o < r.length; o++)
if (n(t, a, r[o].name))
if (a.allowDuplicates || !d(t, r[o].name))
if (-1 != a.maxFileSize && r[o].size > a.maxFileSize)
a.showError &&
e(
"<div class='" +
a.errorClass +
"'><b>" +
r[o].name +
"</b> " +
a.sizeErrorStr +
s(a.maxFileSize) +
"</div>"
).appendTo(t.errorLog);
else if (
-1 != a.maxFileCount &&
t.selectedFiles >= a.maxFileCount
)
a.showError &&
e(
"<div class='" +
a.errorClass +
"'><b>" +
r[o].name +
"</b> " +
a.maxFileCountErrorStr +
a.maxFileCount +
"</div>"
).appendTo(t.errorLog);
else {
t.selectedFiles++, t.existingFileNames.push(r[o].name);
var l = e.extend({}, a),
u = new FormData(),
p = a.fileName.replace("[]", "");
u.append(p, r[o]);
var c = a.formData;
if (c)
for (var h = i(c), f = 0; f < h.length; f++)
h[f] && u.append(h[f][0], h[f][1]);
l.fileData = u;
var w = new m(t, a),
g = "";
(g = a.showFileCounter
? t.fileCounter + a.fileCounterStyle + r[o].name
: r[o].name),
a.showFileSize && (g += " (" + s(r[o].size) + ")"),
w.filename.html(g);
var C = e(
"<form style='display:block; position:absolute;left: 150px;' class='" +
t.formGroup +
"' method='" +
a.method +
"' action='" +
a.url +
"' enctype='" +
a.enctype +
"'></form>"
);
C.appendTo("body");
var b = [];
b.push(r[o].name), v(C, l, w, b, t, r[o]), t.fileCounter++;
}
else
a.showError &&
e(
"<div class='" +
a.errorClass +
"'><b>" +
r[o].name +
"</b> " +
a.duplicateErrorStr +
"</div>"
).appendTo(t.errorLog);
else
a.showError &&
e(
"<div class='" +
a.errorClass +
"'><b>" +
r[o].name +
"</b> " +
a.extErrorStr +
a.allowedTypes +
"</div>"
).appendTo(t.errorLog);
}
function n(e, a, t) {
var r = a.allowedTypes.toLowerCase().split(/[\s,]+/g),
o = t.split(".").pop().toLowerCase();
return !("*" != a.allowedTypes && jQuery.inArray(o, r) < 0);
}
function d(e, a) {
var t = !1;
if (e.existingFileNames.length)
for (var r = 0; r < e.existingFileNames.length; r++)
(e.existingFileNames[r] == a ||
(w.duplicateStrict &&
e.existingFileNames[r].toLowerCase() == a.toLowerCase())) &&
(t = !0);
return t;
}
function u(e, a) {
if (e.existingFileNames.length)
for (var t = 0; t < a.length; t++) {
var r = e.existingFileNames.indexOf(a[t]);
-1 != r && e.existingFileNames.splice(r, 1);
}
}
function p(e, a) {
if (e) {
a.show();
var t = new FileReader();
(t.onload = function (e) {
a.attr("src", e.target.result);
}),
t.readAsDataURL(e);
}
}
function c(a, t) {
if (a.showFileCounter) {
var r = e(t.container).find(".ajax-file-upload-filename").length;
(t.fileCounter = r + 1),
e(t.container)
.find(".ajax-file-upload-filename")
.each(function (t, o) {
var s = e(this).html().split(a.fileCounterStyle),
i = (parseInt(s[0]), r + a.fileCounterStyle + s[1]);
e(this).html(i), r--;
});
}
}
function h(t, r, o, s) {
var i = "ajax-upload-id-" + new Date().getTime(),
d = e(
"<form method='" +
o.method +
"' action='" +
o.url +
"' enctype='" +
o.enctype +
"'></form>"
),
u =
"<input type='file' id='" +
i +
"' name='" +
o.fileName +
"' accept='" +
o.acceptFiles +
"'/>";
o.multiple &&
(o.fileName.indexOf("[]") != o.fileName.length - 2 &&
(o.fileName += "[]"),
(u =
"<input type='file' id='" +
i +
"' name='" +
o.fileName +
"' accept='" +
o.acceptFiles +
"' multiple/>"));
var p = e(u).appendTo(d);
p.change(function () {
t.errorLog.html("");
o.allowedTypes.toLowerCase().split(",");
var i = [];
if (this.files) {
for (g = 0; g < this.files.length; g++) i.push(this.files[g].name);
if (0 == o.onSelect(this.files)) return;
} else {
var u = e(this).val(),
p = [];
if ((i.push(u), !n(t, o, u)))
return void (
o.showError &&
e(
"<div class='" +
o.errorClass +
"'><b>" +
u +
"</b> " +
o.extErrorStr +
o.allowedTypes +
"</div>"
).appendTo(t.errorLog)
);
if ((p.push({ name: u, size: "NA" }), 0 == o.onSelect(p))) return;
}
if (
(c(o, t),
s.unbind("click"),
d.hide(),
h(t, r, o, s),
d.addClass(r),
o.serialize && a.fileapi && a.formdata)
) {
d.removeClass(r);
var f = this.files;
d.remove(), l(o, t, f);
} else {
for (var w = "", g = 0; g < i.length; g++)
o.showFileCounter
? (w += t.fileCounter + o.fileCounterStyle + i[g] + "<br>")
: (w += i[g] + "<br>"),
t.fileCounter++;
if (
-1 != o.maxFileCount &&
t.selectedFiles + i.length > o.maxFileCount
)
return void (
o.showError &&
e(
"<div class='" +
o.errorClass +
"'><b>" +
w +
"</b> " +
o.maxFileCountErrorStr +
o.maxFileCount +
"</div>"
).appendTo(t.errorLog)
);
t.selectedFiles += i.length;
var C = new m(t, o);
C.filename.html(w), v(d, o, C, i, t, null);
}
}),
o.nestedForms
? (d.css({ margin: 0, padding: 0 }),
s.css({
position: "relative",
overflow: "hidden",
cursor: "default",
}),
p.css({
position: "absolute",
cursor: "pointer",
top: "0px",
width: "100%",
height: "100%",
left: "0px",
"z-index": "100",
opacity: "0.0",
filter: "alpha(opacity=0)",
"-ms-filter": "alpha(opacity=0)",
"-khtml-opacity": "0.0",
"-moz-opacity": "0.0",
}),
d.appendTo(s))
: (d.appendTo(e("body")),
d.css({
margin: 0,
padding: 0,
display: "block",
position: "absolute",
left: "-250px",
}),
-1 != navigator.appVersion.indexOf("MSIE ")
? s.attr("for", i)
: s.click(function () {
p.click();
}));
}
function f(a, t) {
return (
(this.statusbar = e(
"<div class='ajax-file-upload-statusbar'></div>"
).width(t.statusBarWidth)),
(this.preview = e("<img class='ajax-file-upload-preview' />")
.width(t.previewWidth)
.height(t.previewHeight)
.appendTo(this.statusbar)
.hide()),
(this.filename = e(
"<div class='ajax-file-upload-filename'></div>"
).appendTo(this.statusbar)),
(this.progressDiv = e("<div class='ajax-file-upload-progress'>")
.appendTo(this.statusbar)
.hide()),
(this.progressbar = e(
"<div class='ajax-file-upload-bar'></div>"
).appendTo(this.progressDiv)),
(this.abort = e("<div>" + t.abortStr + "</div>")
.appendTo(this.statusbar)
.hide()),
(this.cancel = e("<div>" + t.cancelStr + "</div>")
.appendTo(this.statusbar)
.hide()),
(this.done = e("<div>" + t.doneStr + "</div>")
.appendTo(this.statusbar)
.hide()),
(this.download = e("<div>" + t.downloadStr + "</div>")
.appendTo(this.statusbar)
.hide()),
(this.del = e("<div>" + t.deleteStr + "</div>")
.appendTo(this.statusbar)
.hide()),
this.abort.addClass("ajax-file-upload-red"),
this.done.addClass("ajax-file-upload-green"),
this.download.addClass("ajax-file-upload-green"),
this.cancel.addClass("ajax-file-upload-red"),
this.del.addClass("ajax-file-upload-red"),
this
);
}
function m(a, t) {
var r = null;
return (
(r = t.customProgressBar
? new t.customProgressBar(a, t)
: new f(a, t)).abort.addClass(a.formGroup),
r.abort.addClass(t.abortButtonClass),
r.cancel.addClass(a.formGroup),
r.cancel.addClass(t.cancelButtonClass),
t.extraHTML &&
(r.extraHTML = e(
"<div class='extrahtml'>" + t.extraHTML() + "</div>"
).insertAfter(r.filename)),
"bottom" == t.uploadQueueOrder
? e(a.container).append(r.statusbar)
: e(a.container).prepend(r.statusbar),
r
);
}
function v(t, o, s, l, n, d) {
var h = {
cache: !1,
contentType: !1,
processData: !1,
forceSync: !1,
type: o.method,
data: o.formData,
formData: o.fileData,
dataType: o.returnType,
headers: o.headers,
beforeSubmit: function (a, r, d) {
if (0 != o.onSubmit.call(this, l)) {
if (o.dynamicFormData) {
var p = i(o.dynamicFormData());
if (p)
for (var h = 0; h < p.length; h++)
p[h] &&
(o.serialize && void 0 != o.fileData
? d.formData.append(p[h][0], p[h][1])
: (d.data[p[h][0]] = p[h][1]));
}
return (
o.extraHTML &&
e(s.extraHTML)
.find("input,select,textarea")
.each(function (a, t) {
o.serialize && void 0 != o.fileData
? d.formData.append(e(this).attr("name"), e(this).val())
: (d.data[e(this).attr("name")] = e(this).val());
}),
!0
);
}
return (
s.statusbar.append(
"<div class='" +
o.errorClass +
"'>" +
o.uploadErrorStr +
"</div>"
),
s.cancel.show(),
t.remove(),
s.cancel.click(function () {
x.splice(x.indexOf(t), 1),
u(n, l),
s.statusbar.remove(),
o.onCancel.call(n, l, s),
(n.selectedFiles -= l.length),
c(o, n);
}),
!1
);
},
beforeSend: function (e, t) {
for (var r in t.headers) e.setRequestHeader(r, t.headers[r]);
s.progressDiv.show(),
s.cancel.hide(),
s.done.hide(),
o.showAbort &&
(s.abort.show(),
s.abort.click(function () {
u(n, l),
e.abort(),
(n.selectedFiles -= l.length),
o.onAbort.call(n, l, s);
})),
a.formdata
? s.progressbar.width("1%")
: s.progressbar.width("5%");
},
uploadProgress: function (e, a, t, r) {
r > 98 && (r = 98);
var i = r + "%";
r > 1 && s.progressbar.width(i),
o.showProgress &&
(s.progressbar.html(i),
s.progressbar.css("text-align", "center"));
},
success: function (a, r, i) {
if (
(s.cancel.remove(),
F.pop(),
"json" == o.returnType &&
"object" == e.type(a) &&
a.hasOwnProperty(o.customErrorKeyStr))
) {
s.abort.hide();
var d = a[o.customErrorKeyStr];
return (
o.onError.call(this, l, 200, d, s),
o.showStatusAfterError
? (s.progressDiv.hide(),
s.statusbar.append(
"<span class='" +
o.errorClass +
"'>ERROR: " +
d +
"</span>"
))
: (s.statusbar.hide(), s.statusbar.remove()),
(n.selectedFiles -= l.length),
void t.remove()
);
}
n.responses.push(a),
s.progressbar.width("100%"),
o.showProgress &&
(s.progressbar.html("100%"),
s.progressbar.css("text-align", "center")),
s.abort.hide(),
o.onSuccess.call(this, l, a, i, s),
o.showStatusAfterSuccess
? (o.showDone
? (s.done.show(),
s.done.click(function () {
s.statusbar.hide("slow"), s.statusbar.remove();
}))
: s.done.hide(),
o.showDelete
? (s.del.show(),
s.del.click(function () {
u(n, l),
s.statusbar.hide().remove(),
o.deleteCallback && o.deleteCallback.call(this, a, s),
(n.selectedFiles -= l.length),
c(o, n);
}))
: s.del.hide())
: (s.statusbar.hide("slow"), s.statusbar.remove()),
o.showDownload &&
(s.download.show(),
s.download.click(function () {
o.downloadCallback && o.downloadCallback(a, s);
})),
t.remove();
},
error: function (e, a, r) {
s.cancel.remove(),
F.pop(),
s.abort.hide(),
"abort" == e.statusText
? (s.statusbar.hide("slow").remove(), c(o, n))
: (o.onError.call(this, l, a, r, s),
o.showStatusAfterError
? (s.progressDiv.hide(),
s.statusbar.append(
"<span class='" +
o.errorClass +
"'>ERROR: " +
r +
"</span>"
))
: (s.statusbar.hide(), s.statusbar.remove()),
(n.selectedFiles -= l.length)),
t.remove();
},
};
o.showPreview &&
null != d &&
"image" == d.type.toLowerCase().split("/").shift() &&
p(d, s.preview),
o.autoSubmit
? (t.ajaxForm(h), x.push(t), r())
: (o.showCancel &&
(s.cancel.show(),
s.cancel.click(function () {
x.splice(x.indexOf(t), 1),
u(n, l),
t.remove(),
s.statusbar.remove(),
o.onCancel.call(n, l, s),
(n.selectedFiles -= l.length),
c(o, n);
})),
t.ajaxForm(h));
}
var w = e.extend(
{
url: "",
method: "POST",
enctype: "multipart/form-data",
returnType: null,
allowDuplicates: !0,
duplicateStrict: !1,
allowedTypes: "*",
acceptFiles: "*",
fileName: "file",
formData: !1,
dynamicFormData: !1,
maxFileSize: -1,
maxFileCount: -1,
multiple: !0,
dragDrop: !0,
autoSubmit: !0,
showCancel: !0,
showAbort: !0,
showDone: !1,
showDelete: !1,
showError: !0,
showStatusAfterSuccess: !0,
showStatusAfterError: !0,
showFileCounter: !0,
fileCounterStyle: "). ",
showFileSize: !0,
showProgress: !1,
nestedForms: !0,
showDownload: !1,
onLoad: function (e) {},
onSelect: function (e) {
return !0;
},
onSubmit: function (e, a) {},
onSuccess: function (e, a, t, r) {},
onError: function (e, a, t, r) {},
onCancel: function (e, a) {},
onAbort: function (e, a) {},
downloadCallback: !1,
deleteCallback: !1,
afterUploadAll: !1,
serialize: !0,
sequential: !1,
sequentialCount: 2,
customProgressBar: !1,
abortButtonClass: "ajax-file-upload-abort",
cancelButtonClass: "ajax-file-upload-cancel",
dragDropContainerClass: "ajax-upload-dragdrop",
dragDropHoverClass: "state-hover",
errorClass: "ajax-file-upload-error",
uploadButtonClass: "ajax-file-upload",
dragDropStr: "<span>Drag &amp; Drop Files</span>",
uploadStr: "Upload",
abortStr: "Abort",
cancelStr: "Cancel",
deleteStr: "Delete",
doneStr: "Done",
multiDragErrorStr: "Multiple File Drag &amp; Drop is not allowed.",
extErrorStr: "is not allowed. Allowed extensions: ",
duplicateErrorStr: "is not allowed. File already exists.",
sizeErrorStr: "is not allowed. Allowed Max size: ",
uploadErrorStr: "Upload is not allowed",
maxFileCountErrorStr: " is not allowed. Maximum allowed files are:",
downloadStr: "Download",
customErrorKeyStr: "jquery-upload-file-error",
showQueueDiv: !1,
statusBarWidth: "100%",
dragdropWidth: "100%",
showPreview: !1,
previewHeight: "auto",
previewWidth: "100%",
extraHTML: !1,
uploadQueueOrder: "top",
headers: {},
},
t
);
(this.fileCounter = 1), (this.selectedFiles = 0);
var g = "ajax-file-upload-" + new Date().getTime();
(this.formGroup = g),
(this.errorLog = e("<div></div>")),
(this.responses = []),
(this.existingFileNames = []),
a.formdata || (w.dragDrop = !1),
(a.formdata && 1 !== w.maxFileCount) || (w.multiple = !1),
e(this).html("");
var C = this,
b = e("<div>" + w.uploadStr + "</div>");
e(b).addClass(w.uploadButtonClass),
(function a() {
if (e.fn.ajaxForm) {
if (w.dragDrop) {
var t = e(
'<div class="' +
w.dragDropContainerClass +
'" style="vertical-align:top;"></div>'
).width(w.dragdropWidth);
e(C).append(t),
e(t).append(b),
e(t).append(e(w.dragDropStr)),
o(C, w, t);
} else e(C).append(b);
e(C).append(C.errorLog),
w.showQueueDiv
? (C.container = e("#" + w.showQueueDiv))
: (C.container = e(
"<div class='ajax-file-upload-container'></div>"
).insertAfter(e(C))),
w.onLoad.call(this, C),
h(C, g, w, b);
} else window.setTimeout(a, 10);
})(),
(this.startUpload = function () {
e("form").each(function (a, t) {
e(this).hasClass(C.formGroup) && x.push(e(this));
}),
x.length >= 1 && r();
}),
(this.getFileCount = function () {
return C.selectedFiles;
}),
(this.stopUpload = function () {
e("." + w.abortButtonClass).each(function (a, t) {
e(this).hasClass(C.formGroup) && e(this).click();
}),
e("." + w.cancelButtonClass).each(function (a, t) {
e(this).hasClass(C.formGroup) && e(this).click();
});
}),
(this.cancelAll = function () {
e("." + w.cancelButtonClass).each(function (a, t) {
e(this).hasClass(C.formGroup) && e(this).click();
});
}),
(this.update = function (a) {
(w = e.extend(w, a)),
a.hasOwnProperty("url") &&
e("form").each(function (t, r) {
e(this).attr("action", a.url);
});
}),
(this.enqueueFile = function (e) {
e instanceof File && l(w, C, [e]);
}),
(this.reset = function (e) {
(C.fileCounter = 1),
(C.selectedFiles = 0),
C.errorLog.html(""),
0 != e && C.container.html("");
}),
(this.remove = function () {
C.container.html(""), e(C).remove();
}),
(this.createProgress = function (e, a, t) {
var r = new m(this, w);
r.progressDiv.show(), r.progressbar.width("100%");
var o = "";
return (
(o = w.showFileCounter
? C.fileCounter + w.fileCounterStyle + e
: e),
w.showFileSize && (o += " (" + s(t) + ")"),
r.filename.html(o),
C.fileCounter++,
C.selectedFiles++,
w.showPreview && (r.preview.attr("src", a), r.preview.show()),
w.showDownload &&
(r.download.show(),
r.download.click(function () {
w.downloadCallback && w.downloadCallback.call(C, [e], r);
})),
w.showDelete &&
(r.del.show(),
r.del.click(function () {
r.statusbar.hide().remove();
var a = [e];
w.deleteCallback && w.deleteCallback.call(this, a, r),
(C.selectedFiles -= 1),
c(w, C);
})),
r
);
}),
(this.getResponses = function () {
return this.responses;
});
var x = [],
F = [],
D = !1;
return this;
});
})(jQuery);

View File

@ -0,0 +1,165 @@
class MultipleUploader {
#multipleUploader;
#$imagesUploadInput;
constructor( multiUploaderSelector )
{
this.#multipleUploader = document.querySelector(multiUploaderSelector);
this.#$imagesUploadInput = document.createElement('input')
}
init( { maxUpload = 10 , maxSize = 2 , formSelector = 'form' , filesInpName = 'images' } = {} )
{
const form = document.querySelector(formSelector);
if (! this.#multipleUploader ) // check if the end user didnt write the multiple uploader div
throw new Error('The multiple uploader element doesnt exist');
if (! form ) // check if there is no form with this selector
throw new Error('We couldn\'t find a form with this selector: ' + formSelector);
// ensure that the form has enctype attribute with the value multipart/form-data
form.enctype = 'multipart/form-data'
if ( document.getElementById('max-upload-number') )
document.getElementById('max-upload-number').innerHTML = `Upload up to ${ maxUpload } files`;
// create multiple file input and make it hidden
this.#$imagesUploadInput.type = 'file';
this.#$imagesUploadInput.name = `${filesInpName}[]`;
this.#$imagesUploadInput.multiple = true;
this.#$imagesUploadInput.accept = "image/*";
this.#$imagesUploadInput.style.setProperty('display','none','important');
// create multiple file input and make it hidden
// append the newly created input to the form with the help of the formSelector provided by the user
document.querySelector(formSelector).append( this.#$imagesUploadInput );
this.#multipleUploader.addEventListener("click", (e) => {
if ( e.target.className === 'multiple-uploader' || e.target.className === 'mup-msg' || e.target.className === 'mup-main-msg' )
this.#$imagesUploadInput.click() // trigger the input file to upload images
});
const self = this;
// preview the uploaded images
this.#$imagesUploadInput.addEventListener("change",function () {
if (this.files.length > 0)
{
self.#multipleUploader.querySelectorAll('.image-container').forEach( image => image.remove() ); // clear the previous rendered images
self.#multipleUploader.querySelector('.mup-msg').style.setProperty('display', 'none'); // hide the hint texts inside drop zone
// if the length of uploaded images greater than the images uploaded by the user, the maximum uploaded will be considered
const uploadedImagesCount = this.files.length > maxUpload ? maxUpload : this.files.length;
const unAcceptableImagesIndices = [];
for (let index = 0; index < uploadedImagesCount; index++) {
const imageSize = self.#bytesToSize( this.files[ index ].size );
const isImageSizeAcceptable = self.#checkImageSize( index , imageSize , maxSize , 'MB' );
// appended the newly created image to the multiple uploader
self.#multipleUploader.innerHTML += `
<div class="image-container" data-image-index="${ index }" id="mup-image-${ index }" data-acceptable-image="${ +isImageSizeAcceptable }" >
<div class="image-size"> ${ imageSize['size'] + ' ' + imageSize['unit'] } </div>
${ !isImageSizeAcceptable ? `<div class="exceeded-size"> greater than ${ maxSize } MB </div>` : '' }
<img src="${ URL.createObjectURL( this.files[ index ]) }" class="image-preview" alt="" />
</div>`;
if ( ! isImageSizeAcceptable )
unAcceptableImagesIndices.push( index )
}
unAcceptableImagesIndices.forEach( (index ) => self.#removeFileFromInput(index, false ))
}
});
// event for deleting uploaded images
document.addEventListener('click',function(e){
if( e.target.className === 'image-container' ) // clicked on remove pseudo element
{
const imageIndex = e.target.getAttribute(`data-image-index`)
const imageIsAcceptable = e.target.getAttribute(`data-acceptable-image`)
e.target.remove() // remove the html element from the dom
if ( +imageIsAcceptable )
self.#removeFileFromInput(imageIndex)
if ( document.querySelectorAll('.image-container').length === 0 ) // if there are no images
self.clear();
self.#reorderFilesIndices(); // reorder images indices
}
});
return this;
}
clear()
{
this.#multipleUploader.querySelectorAll('.image-container').forEach( image => image.remove() );
this.#multipleUploader.querySelectorAll('.mup-msg').forEach( msg => msg.style.setProperty('display', 'flex') );
this.#$imagesUploadInput.value = [];
}
#removeFileFromInput( deletedIndex )
{
// remove the delete file from input
const dt = new DataTransfer()
for (const [ index, file] of Object.entries( this.#$imagesUploadInput.files ))
{
if ( index != deletedIndex )
dt.items.add( file )
}
this.#$imagesUploadInput.files = dt.files
// remove the delete file from input
}
#reorderFilesIndices()
{
document.querySelectorAll('.image-container').forEach( ( element, index) => {
element.setAttribute('data-image-index', index.toString() );
element.setAttribute('id',`mup-image-${ index }`)
});
}
#checkImageSize( imageIndex, imageSize , maxSize )
{
return imageSize['unit'] !== 'MB' || ( imageSize['unit'] === 'MB' && ( imageSize['size'] <= maxSize ) ) ; // return true if acceptable
}
#bytesToSize(bytes)
{
const sizes = ['Bytes', 'KB', 'MB']
const i = parseInt( Math.floor(Math.log(bytes) / Math.log(1024) ), 10)
if (i === 0)
return {size: bytes , unit: sizes[i] }
else
return {size: (bytes / (1024 ** i)).toFixed(1) , unit: sizes[i] }
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

248
pb_public/js/slideshow.js Normal file
View File

@ -0,0 +1,248 @@
class Slideshow {
constructor(container, sliderArray, folder, autoplay, endless, random) {
this.container = container
this.sliderArray = sliderArray
this.autoplay = autoplay
this.endless = endless
this.random = random
}
}
class Slider {
constructor(collectionId, collectionName, created, duration, enabled, id, media, updated) {
this.collectionId = collectionId
this.collectionName = collectionName
this.created = created
this.duration = duration
this.enabled = enabled
this.id = id
this.media = media
this.updated = updated
}
}
let counter = 0;
let all = 0;
let restart, speed, wrapper, first, last, timeout, unusedPictureArray, random, autoIncrease, hash, slideshow, wrapper_blur;
async function startSlideShow(slideshowVariable) {
slideshow = slideshowVariable;
if ((typeof slideshow) === 'object') {
let styles = document.createElement('link');
styles.rel = "stylesheet";
styles.href = "/css/slideshow.css";
document.head.appendChild(styles);
document.querySelector(slideshow.container).innerHTML = `<div id="image_blur"></div><div id="image"></div>`;
wrapper = document.querySelector('#image');
wrapper_blur = document.querySelector('#image_blur');
hash = 'counter';
if (!isNaN(localStorage.getItem(hash))) {
counter = localStorage.getItem(hash)
}
autoIncrease = slideshow.autoplay;
restart = slideshow.endless;
if (slideshow.random === 0) {
random = false;
console.debug("random is false");
} else {
random = true;
console.debug("random is true");
}
first = 0;
last = slideshow.sliderArray.length - 1;
timeout = false;
speed = slideshow.speed || 12000;
all = slideshow.sliderArray.length;
unusedPictureArray = Array.from(Array(all).keys());
document.addEventListener('keyup', ev => {
ev.preventDefault();
if (ev.key === "ArrowRight") {
console.debug("Nächstes Bild");
nextSlide();
}
if (ev.key === "ArrowUp") {
history.back();
}
if (ev.key === "ArrowLeft") {
console.debug("Vorheriges Bild");
previousSlide();
}
if (ev.key === " ") {
toggleAuto();
}
});
validateCounter();
} else {
console.error('Please define a slideshow object first');
document.body.innerHTML = "Kein gültiges SlideShow Objekt"
}
}
function validateCounter() {
localStorage.setItem(hash, counter);
if (restart) {
if (counter < 0) {
counter = all - 1;
} else {
counter = counter % all;
}
} else {
if (counter <= 0) {
counter = 0;
}
if (counter === all){
counter = all - 1;
}
}
if (!restart) {
first = counter === 0;
last = counter === all - 1;
}
localStorage.setItem(hash, counter);
show();
}
function show() {
clearTimeout(timeout);
wrapper.innerHTML = '';
wrapper_blur.innerHTML = '';
wrapper.dataset.loaded = 'false'; /* zeigt nen lade symbol*/
speed = slideshow.sliderArray[counter].duration;
if (slideshow.sliderArray[counter].media.endsWith('.html')) {
wrapper.style.backgroundImage = ``;
wrapper.id = "test";
const makeIframe = document.createElement("iframe");
makeIframe.setAttribute('src', "/api/files/" + slideshow.sliderArray[counter].collectionId + "/" + slideshow.sliderArray[counter].id + "/" + slideshow.sliderArray[counter].media);
makeIframe.setAttribute("scrolling", "no");
makeIframe.style.width = "100%";
makeIframe.style.height = "100vh";
makeIframe.style.overflow = "hidden";
makeIframe.style.border = "none";
if (wrapper.dataset.loaded === 'false') {
wrapper.dataset.loaded = 'true';
wrapper.appendChild(makeIframe);
loaded();
}
} else {
if (slideshow.sliderArray[counter].media.endsWith('.mp4')) {
wrapper.style.backgroundImage = ``;
const vid = document.createElement('video');
vid.setAttribute('loop', 'true');
vid.setAttribute('autoplay', 'true');
vid.muted = true;
vid.style.height = `100%`;
vid.style.display = `block`;
vid.style.margin = `0 auto`;
wrapper_blur.style.background = ``;
wrapper.style.background = ``;
vid.setAttribute('src', "/api/files/" + slideshow.sliderArray[counter].collectionId + "/" + slideshow.sliderArray[counter].id + "/" + slideshow.sliderArray[counter].media);
if (wrapper.dataset.loaded === 'false') {
vid.addEventListener('canplaythrough', () => {
wrapper.appendChild(vid);
loaded();
}, {passive: true});
}
} else {
wrapper.innerHTML = ' ';
let url = '/api/files/' + slideshow.sliderArray[counter].collectionId + "/" + slideshow.sliderArray[counter].id + "/" + slideshow.sliderArray[counter].media;
let i = new Image();
i.src = url;
i.onload = function () {
wrapper.style.background = `url(${url}) no-repeat center`; //50% 50% no-repeat
wrapper.style.backgroundSize = `contain`;
wrapper_blur.style.background = `url(${url}) 50% 50% no-repeat`;
wrapper_blur.style.backgroundSize = `cover`;
loaded();
}
}
}
}
function loaded() {
wrapper.dataset.loaded = 'true';
if (random) {
timeout = window.setTimeout(function () {
counter = randomPictureFromArray();
localStorage.setItem(hash, counter);
show();
}, speed);
} else {
if (autoIncrease) {
if (counter !== last) {
timeout = window.setTimeout(function () {
counter++;
validateCounter();
}, speed);
} else {
timeout = window.setTimeout(function () {
counter = 0;
validateCounter();
}, speed);
}
}
}
}
function nextSlide() {
if (counter !== last) {
// Nächstes Bild
counter++;
autoIncrease = false;
validateCounter();
} else {
// Wenn letztes dann von vorne
counter = 0;
autoIncrease = false;
validateCounter();
}
}
//Vorheriges Bild
function previousSlide() {
if (counter !== first) {
counter--;
autoIncrease = false;
validateCounter();
}
}
//Automatisches Abspielen anhalten / fortsetzen
function toggleAuto() {
autoIncrease = !autoIncrease;
random = !random;
validateCounter();
}
function randomPictureFromArray() {
if (unusedPictureArray.length < 1) {
unusedPictureArray = Array.from(Array(all).keys());
}
let randomNumber = randomIntFromInterval(0, unusedPictureArray.length - 1);
let imageNumber = unusedPictureArray[randomNumber];
if (unusedPictureArray.length > 1) {
while (imageNumber === counter) {
randomNumber = randomIntFromInterval(0, unusedPictureArray.length - 1);
imageNumber = unusedPictureArray[randomNumber];
}
}
console.debug("Bildnummer: " + imageNumber);
unusedPictureArray.splice(randomNumber, 1);
return imageNumber;
}
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min);
}

47
pb_public/js/upload.js Normal file
View File

@ -0,0 +1,47 @@
$(document).ready(function() {
/* variables */
var preview = $('img');
var statusausgabe = $('.status');
var progress_bar = $('.progress-bar');
/* only for image preview */
$("#image").change(function(){
preview.fadeOut();
/* html FileRender Api */
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("image").files[0]);
oFReader.onload = function (oFREvent) {
preview.attr('src', oFREvent.target.result).fadeIn();
};
});
/* submit form with ajax request */
$('form').ajaxForm({
/* set data type json */
dataType: 'json',
/* reset before submitting */
beforeSend: function() {
statusausgabe.fadeOut();
progress_bar.width('0%');
progress_bar.html('0%');
},
/* progress bar call back*/
uploadProgress: function(event, position, total, percentComplete) {
var pVel = percentComplete + '%';
progress_bar.width(pVel);
progress_bar.html(pVel);
},
complete: function(data) {
/* var statusausgabe = $('.status'); */
preview.fadeOut(800);
/* statusausgabe.html(data.responseJSON.statusausgabe).fadeIn(); */
}
});
});

11
pb_public/js/util.js Normal file
View File

@ -0,0 +1,11 @@
export function bytesToSize(bytes)
{
const sizes = ['Bytes', 'KB', 'MB']
const i = parseInt( Math.floor(Math.log(bytes) / Math.log(1024) ), 10)
if (i === 0)
return {size: bytes , unit: sizes[i] }
else
return {size: (bytes / (1024 ** i)).toFixed(1) , unit: sizes[i] }
}