1248 lines
40 KiB
PHP
1248 lines
40 KiB
PHP
<!-- Upload Modal - Cute Staged Pop-up -->
|
|
<div class="modal fade" id="uploadModal" tabindex="-1" aria-labelledby="uploadModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
|
<div class="modal-content upload-modal-content">
|
|
<!-- Header -->
|
|
<div class="modal-header upload-modal-header">
|
|
<div class="d-flex align-items-center gap-3">
|
|
<div class="upload-icon-wrapper">
|
|
<i class="bi bi-cloud-arrow-up-fill"></i>
|
|
</div>
|
|
<div>
|
|
<h5 class="modal-title" id="uploadModalLabel">Upload Video</h5>
|
|
<span class="upload-subtitle">Share your creativity</span>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn-close btn-close-white" onclick="closeUploadModal()" aria-label="Close"></button>
|
|
</div>
|
|
|
|
<!-- Body -->
|
|
<div class="modal-body upload-modal-body">
|
|
<!-- Progress Steps -->
|
|
<div class="upload-steps">
|
|
<div class="upload-step active" data-step="1">
|
|
<div class="step-circle">
|
|
<span>1</span>
|
|
<i class="bi bi-check-lg"></i>
|
|
</div>
|
|
<span class="step-label">Video</span>
|
|
</div>
|
|
<div class="step-line"></div>
|
|
<div class="upload-step" data-step="2">
|
|
<div class="step-circle">
|
|
<span>2</span>
|
|
<i class="bi bi-check-lg"></i>
|
|
</div>
|
|
<span class="step-label">Details</span>
|
|
</div>
|
|
<div class="step-line"></div>
|
|
<div class="upload-step" data-step="3">
|
|
<div class="step-circle">
|
|
<span>3</span>
|
|
<i class="bi bi-check-lg"></i>
|
|
</div>
|
|
<span class="step-label">Thumbnail</span>
|
|
</div>
|
|
<div class="step-line"></div>
|
|
<div class="upload-step" data-step="4">
|
|
<div class="step-circle">
|
|
<span>4</span>
|
|
<i class="bi bi-check-lg"></i>
|
|
</div>
|
|
<span class="step-label">Privacy</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form -->
|
|
<form id="upload-form-modal" enctype="multipart/form-data">
|
|
@csrf
|
|
|
|
<!-- Step 1: Video File -->
|
|
<div class="upload-step-content active" data-step="1">
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-camera-video"></i> Video File *
|
|
</label>
|
|
<div id="video-dropzone-modal" class="dropzone-modal">
|
|
<input type="file" name="video" id="video-modal" accept="video/*" required>
|
|
<div id="dropzone-default-modal">
|
|
<div class="dropzone-icon">
|
|
<i class="bi bi-cloud-arrow-up"></i>
|
|
</div>
|
|
<p class="dropzone-title">Click to select or drag video here</p>
|
|
<p class="dropzone-hint">MP4, MOV, AVI, WebM up to 512MB</p>
|
|
</div>
|
|
<div id="file-info-modal" class="file-info-modal">
|
|
<div class="file-preview">
|
|
<i class="bi bi-film"></i>
|
|
</div>
|
|
<div class="file-details">
|
|
<p class="filename" id="filename-modal"></p>
|
|
<p id="filesize-modal"></p>
|
|
</div>
|
|
<button type="button" class="btn-remove-file" onclick="removeVideoModal(event)">
|
|
<i class="bi bi-x-lg"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step-navigation">
|
|
<div></div>
|
|
<button type="button" class="btn-next" onclick="nextStep(2)" id="btn-step-1" disabled>
|
|
Next Step <i class="bi bi-arrow-right"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Step 2: Details -->
|
|
<div class="upload-step-content" data-step="2">
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-card-heading"></i> Title *
|
|
</label>
|
|
<input type="text" name="title" id="upload-video-title" required
|
|
class="form-input"
|
|
placeholder="Give your video a catchy title">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-text-paragraph"></i> Description
|
|
</label>
|
|
<textarea name="description" rows="3"
|
|
class="form-textarea"
|
|
placeholder="Tell viewers about your video"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-collection-play"></i> Video Type
|
|
</label>
|
|
<div class="visibility-options-modal" id="type-options-modal">
|
|
<label class="visibility-option-modal active">
|
|
<input type="radio" name="type" value="generic" checked>
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-film"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Generic</span>
|
|
<span class="visibility-desc">Standard video</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
<label class="visibility-option-modal">
|
|
<input type="radio" name="type" value="music">
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-music-note"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Music</span>
|
|
<span class="visibility-desc">Music video or song</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
<label class="visibility-option-modal">
|
|
<input type="radio" name="type" value="match">
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-trophy"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Match</span>
|
|
<span class="visibility-desc">Sports match or competition</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step-navigation">
|
|
<button type="button" class="btn-prev" onclick="prevStep(1)">
|
|
<i class="bi bi-arrow-left"></i> Back
|
|
</button>
|
|
<button type="button" class="btn-next" onclick="nextStep(3)">
|
|
Next Step <i class="bi bi-arrow-right"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Step 3: Thumbnail -->
|
|
<div class="upload-step-content" data-step="3">
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-image"></i> Thumbnail (optional)
|
|
</label>
|
|
<div id="thumbnail-dropzone-modal" class="dropzone-modal">
|
|
<input type="file" name="thumbnail" id="thumbnail-modal" accept="image/*">
|
|
<div id="thumbnail-default-modal">
|
|
<div class="dropzone-icon">
|
|
<i class="bi bi-card-image"></i>
|
|
</div>
|
|
<p class="dropzone-title">Click to select or drag thumbnail</p>
|
|
<p class="dropzone-hint">JPG, PNG, WebP up to 5MB</p>
|
|
</div>
|
|
<div id="thumbnail-info-modal" class="file-info-modal">
|
|
<div class="file-preview thumbnail-preview">
|
|
<img id="thumbnail-preview-img" src="" alt="Thumbnail preview">
|
|
</div>
|
|
<div class="file-details">
|
|
<p class="filename" id="thumbnail-filename-modal"></p>
|
|
<p id="thumbnail-filesize-modal"></p>
|
|
</div>
|
|
<button type="button" class="btn-remove-file" onclick="removeThumbnailModal(event)">
|
|
<i class="bi bi-x-lg"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="step-navigation">
|
|
<button type="button" class="btn-prev" onclick="prevStep(2)">
|
|
<i class="bi bi-arrow-left"></i> Back
|
|
</button>
|
|
<button type="button" class="btn-next" onclick="nextStep(4)">
|
|
Next Step <i class="bi bi-arrow-right"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Step 4: Privacy & Upload -->
|
|
<div class="upload-step-content" data-step="4">
|
|
<div class="form-group">
|
|
<label class="form-label">
|
|
<i class="bi bi-shield-lock"></i> Privacy Setting
|
|
</label>
|
|
<div class="visibility-options-modal" id="visibility-options-modal">
|
|
<label class="visibility-option-modal active">
|
|
<input type="radio" name="visibility" value="public" checked>
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-globe"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Public</span>
|
|
<span class="visibility-desc">Everyone can see this video</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
<label class="visibility-option-modal">
|
|
<input type="radio" name="visibility" value="unlisted">
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-link-45deg"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Unlisted</span>
|
|
<span class="visibility-desc">Only people with the link</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
<label class="visibility-option-modal">
|
|
<input type="radio" name="visibility" value="private">
|
|
<div class="visibility-content-modal">
|
|
<i class="bi bi-lock"></i>
|
|
<div class="visibility-text">
|
|
<span class="visibility-title">Private</span>
|
|
<span class="visibility-desc">Only you can see</span>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Progress Bar (hidden initially) -->
|
|
<div id="progress-container-modal" class="progress-container-modal">
|
|
<div class="progress-info">
|
|
<span class="progress-label" id="progress-label-modal">Uploading...</span>
|
|
<span class="progress-percent" id="progress-percent-modal">0%</span>
|
|
</div>
|
|
<div class="progress-bar-wrapper">
|
|
<div id="progress-bar-modal" class="progress-bar-fill"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Status Message -->
|
|
<div id="status-message-modal" class="status-message-modal"></div>
|
|
|
|
<div class="step-navigation">
|
|
<button type="button" class="btn-prev" onclick="prevStep(3)" id="btn-back-step-4">
|
|
<i class="bi bi-arrow-left"></i> Back
|
|
</button>
|
|
<button type="submit" class="btn-upload" id="submit-btn-modal">
|
|
<i class="bi bi-cloud-arrow-up-fill"></i> Upload Video
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
/* Modal Base Styles */
|
|
.upload-modal-content {
|
|
background: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
|
|
border: 1px solid #3a3a3a;
|
|
border-radius: 24px;
|
|
box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(230, 30, 30, 0.1);
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* Cute Staged Animation */
|
|
#uploadModal .modal-dialog {
|
|
max-width: 640px;
|
|
transform: scale(0.8) translateY(20px);
|
|
opacity: 0;
|
|
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
}
|
|
|
|
#uploadModal.show .modal-dialog {
|
|
transform: scale(1) translateY(0);
|
|
opacity: 1;
|
|
}
|
|
|
|
#uploadModal.show .modal-dialog {
|
|
animation: modalBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
|
|
}
|
|
|
|
@keyframes modalBounce {
|
|
0% {
|
|
transform: scale(0.9) translateY(10px);
|
|
opacity: 0;
|
|
}
|
|
60% {
|
|
transform: scale(1.02) translateY(-5px);
|
|
}
|
|
100% {
|
|
transform: scale(1) translateY(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
/* Header */
|
|
.upload-modal-header {
|
|
background: linear-gradient(135deg, #e61e1e 0%, #ff4757 100%);
|
|
border-bottom: none;
|
|
padding: 20px 24px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.upload-modal-header::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: -50%;
|
|
right: -50%;
|
|
width: 100%;
|
|
height: 200%;
|
|
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.upload-modal-header .btn-close {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.upload-icon-wrapper {
|
|
width: 48px;
|
|
height: 48px;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border-radius: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 24px;
|
|
color: white;
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
|
|
.upload-modal-header .modal-title {
|
|
font-size: 20px;
|
|
font-weight: 600;
|
|
color: white;
|
|
margin: 0;
|
|
}
|
|
|
|
.upload-subtitle {
|
|
font-size: 13px;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
|
|
/* Body */
|
|
.upload-modal-body {
|
|
padding: 28px 24px;
|
|
background: #1a1a1a;
|
|
}
|
|
|
|
/* Progress Steps */
|
|
.upload-steps {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 32px;
|
|
padding: 0 10px;
|
|
}
|
|
|
|
.upload-step {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.step-circle {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 50%;
|
|
background: #2a2a2a;
|
|
border: 2px solid #404040;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
color: #888;
|
|
transition: all 0.3s;
|
|
position: relative;
|
|
}
|
|
|
|
.step-circle i {
|
|
display: none;
|
|
font-size: 18px;
|
|
color: #4ade80;
|
|
}
|
|
|
|
.upload-step.active .step-circle {
|
|
background: linear-gradient(135deg, #e61e1e 0%, #ff4757 100%);
|
|
border-color: #e61e1e;
|
|
color: white;
|
|
box-shadow: 0 4px 15px rgba(230, 30, 30, 0.4);
|
|
}
|
|
|
|
.upload-step.completed .step-circle {
|
|
background: #22c55e;
|
|
border-color: #22c55e;
|
|
color: white;
|
|
}
|
|
|
|
.upload-step.completed .step-circle span {
|
|
display: none;
|
|
}
|
|
|
|
.upload-step.completed .step-circle i {
|
|
display: block;
|
|
}
|
|
|
|
.step-label {
|
|
font-size: 12px;
|
|
color: #888;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.upload-step.active .step-label {
|
|
color: #e61e1e;
|
|
}
|
|
|
|
.step-line {
|
|
width: 50px;
|
|
height: 2px;
|
|
background: #333;
|
|
margin: 0 8px;
|
|
margin-bottom: 24px;
|
|
transition: background 0.3s;
|
|
}
|
|
|
|
.step-line.active {
|
|
background: linear-gradient(90deg, #e61e1e, #22c55e);
|
|
}
|
|
|
|
/* Step Content */
|
|
.upload-step-content {
|
|
display: none;
|
|
animation: fadeSlideIn 0.4s ease;
|
|
}
|
|
|
|
.upload-step-content.active {
|
|
display: block;
|
|
}
|
|
|
|
@keyframes fadeSlideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateX(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
}
|
|
|
|
/* Form Elements */
|
|
.form-group {
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.form-label {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-bottom: 10px;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
color: #e5e5e5;
|
|
}
|
|
|
|
.form-label i {
|
|
color: #e61e1e;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.form-input, .form-textarea {
|
|
width: 100%;
|
|
background: #121212;
|
|
border: 1px solid #333;
|
|
border-radius: 12px;
|
|
padding: 14px 16px;
|
|
color: #f1f1f1;
|
|
font-size: 14px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.form-input:focus, .form-textarea:focus {
|
|
outline: none;
|
|
border-color: #e61e1e;
|
|
box-shadow: 0 0 0 3px rgba(230, 30, 30, 0.15);
|
|
}
|
|
|
|
.form-input::placeholder, .form-textarea::placeholder {
|
|
color: #666;
|
|
}
|
|
|
|
/* Dropzone */
|
|
.dropzone-modal {
|
|
border: 2px dashed #404040;
|
|
border-radius: 16px;
|
|
padding: 32px 20px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
position: relative;
|
|
background: #151515;
|
|
}
|
|
|
|
.dropzone-modal:hover {
|
|
border-color: #e61e1e;
|
|
background: rgba(230, 30, 30, 0.05);
|
|
}
|
|
|
|
.dropzone-modal.dragover {
|
|
border-color: #e61e1e;
|
|
background: rgba(230, 30, 30, 0.1);
|
|
transform: scale(1.01);
|
|
}
|
|
|
|
.dropzone-modal input[type="file"] {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
opacity: 0;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.dropzone-icon {
|
|
font-size: 48px;
|
|
color: #e61e1e;
|
|
margin-bottom: 12px;
|
|
animation: float 3s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes float {
|
|
0%, 100% { transform: translateY(0); }
|
|
50% { transform: translateY(-8px); }
|
|
}
|
|
|
|
.dropzone-title {
|
|
color: #e5e5e5;
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.dropzone-hint {
|
|
color: #666;
|
|
font-size: 13px;
|
|
margin: 0;
|
|
}
|
|
|
|
/* File Info */
|
|
.file-info-modal {
|
|
display: none;
|
|
align-items: center;
|
|
gap: 16px;
|
|
padding: 16px;
|
|
background: #1f1f1f;
|
|
border-radius: 12px;
|
|
border: 1px solid #333;
|
|
}
|
|
|
|
.file-info-modal.active {
|
|
display: flex;
|
|
}
|
|
|
|
.file-preview {
|
|
width: 56px;
|
|
height: 56px;
|
|
background: linear-gradient(135deg, #e61e1e 0%, #ff6b6b 100%);
|
|
border-radius: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 24px;
|
|
color: white;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.file-preview.thumbnail-preview {
|
|
background: none;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.file-preview.thumbnail-preview img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
border-radius: 12px;
|
|
}
|
|
|
|
.file-details {
|
|
flex: 1;
|
|
text-align: left;
|
|
}
|
|
|
|
.file-details .filename {
|
|
color: #e5e5e5;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin: 0 0 4px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 250px;
|
|
}
|
|
|
|
.file-details p {
|
|
color: #888;
|
|
font-size: 13px;
|
|
margin: 0;
|
|
}
|
|
|
|
.btn-remove-file {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 50%;
|
|
background: #333;
|
|
border: none;
|
|
color: #888;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-remove-file:hover {
|
|
background: #e61e1e;
|
|
color: white;
|
|
}
|
|
|
|
/* Visibility Options */
|
|
.visibility-options-modal {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
.visibility-option-modal {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.visibility-option-modal input {
|
|
display: none;
|
|
}
|
|
|
|
.visibility-content-modal {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
padding: 16px;
|
|
background: #1a1a1a;
|
|
border: 2px solid #333;
|
|
border-radius: 14px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.visibility-option-modal:hover .visibility-content-modal {
|
|
border-color: #555;
|
|
background: #1f1f1f;
|
|
}
|
|
|
|
.visibility-option-modal.active .visibility-content-modal {
|
|
border-color: #e61e1e;
|
|
background: rgba(230, 30, 30, 0.1);
|
|
}
|
|
|
|
.visibility-content-modal i {
|
|
font-size: 22px;
|
|
color: #666;
|
|
width: 32px;
|
|
text-align: center;
|
|
transition: color 0.2s;
|
|
}
|
|
|
|
.visibility-option-modal.active .visibility-content-modal i {
|
|
color: #e61e1e;
|
|
}
|
|
|
|
.visibility-text {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
}
|
|
|
|
.visibility-title {
|
|
font-weight: 500;
|
|
font-size: 15px;
|
|
color: #e5e5e5;
|
|
}
|
|
|
|
.visibility-desc {
|
|
color: #777;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* Step Navigation */
|
|
.step-navigation {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-top: 28px;
|
|
padding-top: 20px;
|
|
border-top: 1px solid #2a2a2a;
|
|
}
|
|
|
|
.btn-prev, .btn-next, .btn-upload {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 24px;
|
|
border-radius: 12px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
;
|
|
}
|
|
|
|
.btn-prev {
|
|
background: transparent;
|
|
border: 1px solid #404040;
|
|
color: #aaa;
|
|
}
|
|
|
|
.btn-prev:hover {
|
|
border-color: #666;
|
|
color: #fff;
|
|
}
|
|
|
|
.btn-next, .btn-upload {
|
|
background: linear-gradient(135deg, #e61e1e 0%, #ff4757 100%);
|
|
color: white;
|
|
box-shadow: 0 4px 15px rgba(230, 30, 30, 0.3);
|
|
}
|
|
|
|
.btn-next:hover, .btn-upload:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 6px 20px rgba(230, 30, 30, 0.4);
|
|
}
|
|
|
|
.btn-next:disabled, .btn-upload:disabled {
|
|
background: #444;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
/* Progress Bar */
|
|
.progress-container-modal {
|
|
display: none;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.progress-container-modal.active {
|
|
display: block;
|
|
animation: fadeSlideIn 0.3s ease;
|
|
}
|
|
|
|
.progress-info {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.progress-label {
|
|
color: #aaa;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.progress-percent {
|
|
color: #e61e1e;
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.progress-bar-wrapper {
|
|
background: #2a2a2a;
|
|
border-radius: 8px;
|
|
height: 10px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.progress-bar-fill {
|
|
background: linear-gradient(90deg, #e61e1e, #ff6b6b);
|
|
height: 100%;
|
|
width: 0%;
|
|
border-radius: 8px;
|
|
transition: width 0.3s ease;
|
|
position: relative;
|
|
}
|
|
|
|
.progress-bar-fill::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
|
animation: shimmer 1.5s infinite;
|
|
}
|
|
|
|
@keyframes shimmer {
|
|
0% { transform: translateX(-100%); }
|
|
100% { transform: translateX(100%); }
|
|
}
|
|
|
|
/* Status Message */
|
|
.status-message-modal {
|
|
display: none;
|
|
padding: 14px 18px;
|
|
border-radius: 10px;
|
|
margin-bottom: 16px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.status-message-modal.success {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
background: rgba(34, 197, 94, 0.15);
|
|
color: #4ade80;
|
|
border: 1px solid rgba(34, 197, 94, 0.3);
|
|
}
|
|
|
|
.status-message-modal.error {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
background: rgba(239, 68, 68, 0.15);
|
|
color: #f87171;
|
|
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 576px) {
|
|
.upload-modal-body {
|
|
padding: 20px 16px;
|
|
}
|
|
|
|
.upload-steps {
|
|
transform: scale(0.85);
|
|
}
|
|
|
|
.step-line {
|
|
width: 30px;
|
|
}
|
|
|
|
.step-navigation {
|
|
flex-direction: column-reverse;
|
|
gap: 12px;
|
|
}
|
|
|
|
.btn-prev, .btn-next, .btn-upload {
|
|
width: 100%;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
// Global state
|
|
let currentUploadStep = 1;
|
|
const totalSteps = 4;
|
|
|
|
// Initialize modal functions
|
|
function openUploadModal() {
|
|
// Check if mobile device - redirect to create page on mobile
|
|
if (window.innerWidth < 992) {
|
|
window.location.href = '{{ route("videos.create") }}';
|
|
return;
|
|
}
|
|
|
|
const modalEl = document.getElementById('uploadModal');
|
|
const modal = new bootstrap.Modal(modalEl);
|
|
modal.show();
|
|
|
|
// Add show class for animation
|
|
setTimeout(() => {
|
|
modalEl.classList.add('show');
|
|
}, 10);
|
|
}
|
|
|
|
function closeUploadModal() {
|
|
const modalEl = document.getElementById('uploadModal');
|
|
const modal = bootstrap.Modal.getInstance(modalEl);
|
|
|
|
if (modal) {
|
|
modal.hide();
|
|
}
|
|
|
|
// Reset form after hidden
|
|
modalEl.addEventListener('hidden.bs.modal', function() {
|
|
resetUploadForm();
|
|
modalEl.classList.remove('show');
|
|
}, { once: true });
|
|
}
|
|
|
|
function resetUploadForm() {
|
|
currentUploadStep = 1;
|
|
updateStepDisplay();
|
|
document.getElementById('upload-form-modal').reset();
|
|
|
|
// Reset file previews
|
|
document.getElementById('dropzone-default-modal').style.display = 'block';
|
|
document.getElementById('file-info-modal').classList.remove('active');
|
|
document.getElementById('thumbnail-default-modal').style.display = 'block';
|
|
document.getElementById('thumbnail-info-modal').classList.remove('active');
|
|
|
|
// Reset progress
|
|
document.getElementById('progress-container-modal').classList.remove('active');
|
|
document.getElementById('progress-bar-modal').style.width = '0%';
|
|
document.getElementById('status-message-modal').className = 'status-message-modal';
|
|
document.getElementById('submit-btn-modal').disabled = false;
|
|
document.getElementById('submit-btn-modal').innerHTML = '<i class="bi bi-cloud-arrow-up-fill"></i> Upload Video';
|
|
document.getElementById('btn-step-1').disabled = true;
|
|
}
|
|
|
|
// Step Navigation
|
|
function nextStep(step) {
|
|
// Validate current step before moving
|
|
if (step === 2) {
|
|
// Step 1 -> Step 2: require video
|
|
const videoInput = document.getElementById('video-modal');
|
|
if (!videoInput.files || !videoInput.files[0]) {
|
|
alert('Please select a video file first');
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (step === 3) {
|
|
// Step 2 -> Step 3: require title
|
|
const title = document.getElementById('upload-video-title').value.trim();
|
|
if (!title) {
|
|
alert('Please enter a title for your video');
|
|
return;
|
|
}
|
|
}
|
|
|
|
currentUploadStep = step;
|
|
updateStepDisplay();
|
|
}
|
|
|
|
function prevStep(step) {
|
|
currentUploadStep = step;
|
|
updateStepDisplay();
|
|
}
|
|
|
|
function updateStepDisplay() {
|
|
// Update step indicators
|
|
document.querySelectorAll('.upload-step').forEach((el, index) => {
|
|
const stepNum = index + 1;
|
|
el.classList.remove('active', 'completed');
|
|
|
|
if (stepNum === currentUploadStep) {
|
|
el.classList.add('active');
|
|
} else if (stepNum < currentUploadStep) {
|
|
el.classList.add('completed');
|
|
}
|
|
});
|
|
|
|
// Update step lines
|
|
document.querySelectorAll('.step-line').forEach((el, index) => {
|
|
if (index < currentUploadStep - 1) {
|
|
el.classList.add('active');
|
|
} else {
|
|
el.classList.remove('active');
|
|
}
|
|
});
|
|
|
|
// Update step content
|
|
document.querySelectorAll('.upload-step-content').forEach(el => {
|
|
el.classList.remove('active');
|
|
if (parseInt(el.dataset.step) === currentUploadStep) {
|
|
el.classList.add('active');
|
|
}
|
|
});
|
|
}
|
|
|
|
// Video Dropzone
|
|
const videoDropzoneModal = document.getElementById('video-dropzone-modal');
|
|
const videoInputModal = document.getElementById('video-modal');
|
|
|
|
videoInputModal.addEventListener('change', function() {
|
|
handleVideoSelectModal(this);
|
|
});
|
|
|
|
videoDropzoneModal.addEventListener('click', function(e) {
|
|
if (e.target.classList.contains('btn-remove-file')) return;
|
|
});
|
|
|
|
videoDropzoneModal.addEventListener('dragover', (e) => {
|
|
e.preventDefault();
|
|
videoDropzoneModal.classList.add('dragover');
|
|
});
|
|
|
|
videoDropzoneModal.addEventListener('dragleave', () => {
|
|
videoDropzoneModal.classList.remove('dragover');
|
|
});
|
|
|
|
videoDropzoneModal.addEventListener('drop', (e) => {
|
|
e.preventDefault();
|
|
videoDropzoneModal.classList.remove('dragover');
|
|
if (e.dataTransfer.files.length) {
|
|
videoInputModal.files = e.dataTransfer.files;
|
|
handleVideoSelectModal(videoInputModal);
|
|
}
|
|
});
|
|
|
|
function handleVideoSelectModal(input) {
|
|
if (input.files && input.files[0]) {
|
|
const file = input.files[0];
|
|
const maxSize = 512 * 1024 * 1024; // 512MB in bytes
|
|
|
|
// Validate file type
|
|
const validTypes = ['video/mp4', 'video/webm', 'video/ogg', 'video/quicktime', 'video/x-msvideo', 'video/x-flv', 'video/x-matroska'];
|
|
const validExtensions = ['.mp4', '.webm', '.ogg', '.mov', '.avi', '.wmv', '.flv', '.mkv'];
|
|
|
|
let isValidType = validTypes.includes(file.type);
|
|
let fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
|
if (!isValidType) {
|
|
isValidType = validExtensions.includes(fileExtension);
|
|
}
|
|
|
|
if (!isValidType) {
|
|
alert('Invalid video format. Please select a valid video file (MP4, MOV, AVI, WebM, OGG, WMV, FLV, MKV).');
|
|
input.value = '';
|
|
document.getElementById('dropzone-default-modal').style.display = 'block';
|
|
document.getElementById('file-info-modal').classList.remove('active');
|
|
document.getElementById('btn-step-1').disabled = true;
|
|
return;
|
|
}
|
|
|
|
if (file.size > maxSize) {
|
|
alert('File size exceeds 512MB limit. Please select a smaller video file.');
|
|
input.value = ''; // Clear the input
|
|
document.getElementById('dropzone-default-modal').style.display = 'block';
|
|
document.getElementById('file-info-modal').classList.remove('active');
|
|
document.getElementById('btn-step-1').disabled = true;
|
|
return;
|
|
}
|
|
|
|
document.getElementById('filename-modal').textContent = file.name;
|
|
document.getElementById('filesize-modal').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
|
document.getElementById('dropzone-default-modal').style.display = 'none';
|
|
document.getElementById('file-info-modal').classList.add('active');
|
|
|
|
// Enable next button
|
|
document.getElementById('btn-step-1').disabled = false;
|
|
}
|
|
}
|
|
|
|
function removeVideoModal(e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
videoInputModal.value = '';
|
|
document.getElementById('dropzone-default-modal').style.display = 'block';
|
|
document.getElementById('file-info-modal').classList.remove('active');
|
|
document.getElementById('btn-step-1').disabled = true;
|
|
}
|
|
|
|
// Thumbnail Dropzone
|
|
const thumbnailDropzoneModal = document.getElementById('thumbnail-dropzone-modal');
|
|
const thumbnailInputModal = document.getElementById('thumbnail-modal');
|
|
|
|
thumbnailInputModal.addEventListener('change', function() {
|
|
handleThumbnailSelectModal(this);
|
|
});
|
|
|
|
thumbnailDropzoneModal.addEventListener('dragover', (e) => {
|
|
e.preventDefault();
|
|
thumbnailDropzoneModal.classList.add('dragover');
|
|
});
|
|
|
|
thumbnailDropzoneModal.addEventListener('dragleave', () => {
|
|
thumbnailDropzoneModal.classList.remove('dragover');
|
|
});
|
|
|
|
thumbnailDropzoneModal.addEventListener('drop', (e) => {
|
|
e.preventDefault();
|
|
thumbnailDropzoneModal.classList.remove('dragover');
|
|
if (e.dataTransfer.files.length) {
|
|
thumbnailInputModal.files = e.dataTransfer.files;
|
|
handleThumbnailSelectModal(thumbnailInputModal);
|
|
}
|
|
});
|
|
|
|
function handleThumbnailSelectModal(input) {
|
|
if (input.files && input.files[0]) {
|
|
const file = input.files[0];
|
|
document.getElementById('thumbnail-filename-modal').textContent = file.name;
|
|
document.getElementById('thumbnail-filesize-modal').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
|
|
|
// Show thumbnail preview
|
|
const reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
document.getElementById('thumbnail-preview-img').src = e.target.result;
|
|
};
|
|
reader.readAsDataURL(file);
|
|
|
|
document.getElementById('thumbnail-default-modal').style.display = 'none';
|
|
document.getElementById('thumbnail-info-modal').classList.add('active');
|
|
}
|
|
}
|
|
|
|
function removeThumbnailModal(e) {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
thumbnailInputModal.value = '';
|
|
document.getElementById('thumbnail-default-modal').style.display = 'block';
|
|
document.getElementById('thumbnail-info-modal').classList.remove('active');
|
|
}
|
|
|
|
// Visibility options
|
|
const visibilityOptionsModal = document.querySelectorAll('.visibility-option-modal');
|
|
visibilityOptionsModal.forEach(option => {
|
|
const radio = option.querySelector('input[type="radio"]');
|
|
radio.addEventListener('change', function() {
|
|
visibilityOptionsModal.forEach(opt => opt.classList.remove('active'));
|
|
option.classList.add('active');
|
|
});
|
|
});
|
|
|
|
// Form submission
|
|
document.getElementById('upload-form-modal').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
const formData = new FormData(this);
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
// Set timeout for large file uploads (30 minutes for large videos)
|
|
xhr.timeout = 1800000; // 30 minutes
|
|
|
|
// Show progress
|
|
document.getElementById('progress-container-modal').classList.add('active');
|
|
document.getElementById('submit-btn-modal').disabled = true;
|
|
document.getElementById('submit-btn-modal').innerHTML = '<i class="bi bi-arrow-repeat"></i> Uploading...';
|
|
document.getElementById('btn-back-step-4').style.display = 'none';
|
|
document.getElementById('status-message-modal').className = 'status-message-modal';
|
|
|
|
// Track upload start time for timeout handling
|
|
const uploadStartTime = Date.now();
|
|
|
|
xhr.upload.addEventListener('progress', function(e) {
|
|
if (e.lengthComputable) {
|
|
const percent = Math.round((e.loaded / e.total) * 100);
|
|
document.getElementById('progress-bar-modal').style.width = percent + '%';
|
|
document.getElementById('progress-percent-modal').textContent = percent + '%';
|
|
|
|
// Calculate and display upload speed for large files
|
|
if (percent > 0) {
|
|
const elapsed = (Date.now() - uploadStartTime) / 1000; // seconds
|
|
const speed = (e.loaded / elapsed / 1024 / 1024).toFixed(2); // MB/s
|
|
if (elapsed > 5 && speed > 0) {
|
|
document.getElementById('progress-label-modal').textContent = `Uploading... ${speed} MB/s`;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
xhr.addEventListener('load', function() {
|
|
document.getElementById('progress-bar-modal').style.width = '100%';
|
|
document.getElementById('progress-label-modal').textContent = 'Processing...';
|
|
|
|
// Check for successful HTTP status
|
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
try {
|
|
const response = JSON.parse(xhr.responseText);
|
|
if (response.success) {
|
|
document.getElementById('progress-percent-modal').textContent = 'Done!';
|
|
document.getElementById('status-message-modal').innerHTML = '<i class="bi bi-check-circle-fill"></i> Upload successful! Closing...';
|
|
document.getElementById('status-message-modal').className = 'status-message-modal success';
|
|
|
|
// Close modal and redirect after short delay
|
|
setTimeout(() => {
|
|
closeUploadModal();
|
|
window.location.href = response.redirect;
|
|
}, 1000);
|
|
} else {
|
|
showErrorModal(response.message || 'Upload failed');
|
|
}
|
|
} catch(e) {
|
|
showErrorModal('Invalid response from server');
|
|
}
|
|
} else if (xhr.status === 0) {
|
|
showErrorModal('Connection lost. Please check your internet connection and try again.');
|
|
} else {
|
|
// Try to parse error message from server response
|
|
try {
|
|
const response = JSON.parse(xhr.responseText);
|
|
showErrorModal(response.message || `Server error (${xhr.status}). Please try again.`);
|
|
} catch(e) {
|
|
showErrorModal(`Upload failed with status ${xhr.status}. Please try again.`);
|
|
}
|
|
}
|
|
});
|
|
|
|
xhr.addEventListener('error', function() {
|
|
showErrorModal('Upload failed. Please check your internet connection and try again.');
|
|
});
|
|
|
|
xhr.addEventListener('timeout', function() {
|
|
showErrorModal('Upload timed out. The file may be too large or the connection too slow. Please try again.');
|
|
});
|
|
|
|
xhr.addEventListener('abort', function() {
|
|
showErrorModal('Upload was cancelled. Please try again.');
|
|
});
|
|
|
|
xhr.open('POST', '{{ route("videos.store") }}');
|
|
xhr.setRequestHeader('X-CSRF-TOKEN', '{{ csrf_token() }}');
|
|
xhr.send(formData);
|
|
});
|
|
|
|
function showErrorModal(message) {
|
|
document.getElementById('progress-container-modal').classList.remove('active');
|
|
document.getElementById('status-message-modal').innerHTML = '<i class="bi bi-exclamation-circle-fill"></i> ' + message;
|
|
document.getElementById('status-message-modal').className = 'status-message-modal error';
|
|
document.getElementById('submit-btn-modal').disabled = false;
|
|
document.getElementById('submit-btn-modal').innerHTML = '<i class="bi bi-cloud-arrow-up-fill"></i> Upload Video';
|
|
document.getElementById('btn-back-step-4').style.display = 'flex';
|
|
}
|
|
</script>
|