commit
8456a4aec4
29 files changed
+14762
-513
No files matched your search
@@ -1,47 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en" dir="ltr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>hub</title>
|
|
||||||
<link rel="stylesheet" href="css/plyr.css"/>
|
|
||||||
<link rel="stylesheet" href="css/index.css">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Latest compiled and minified CSS -->
|
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
|
||||||
|
|
||||||
<!-- jQuery library -->
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Popper JS -->
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Latest compiled JavaScript -->
|
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
|
|
||||||
|
|
||||||
<script src="js/plyr.js"></script>
|
|
||||||
<script src="js/index.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<!-- Grey with black text -->
|
|
||||||
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
|
|
||||||
<!-- Brand -->
|
|
||||||
<a class="navbar-brand" href="#">Lukis Tube</a>
|
|
||||||
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item ">
|
|
||||||
<a class="nav-link" href="index.html">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="random.html">Random Video</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item active">
|
|
||||||
<a class="nav-link" href="category.html">Categories</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Whitespace-only changes.
@@ -1 +0,0 @@
|
|||||||
@keyframes plyr-progress{to{background-position:25px 0}}@keyframes plyr-popup{0%{opacity:.5;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes plyr-fade-in{from{opacity:0}to{opacity:1}}.plyr{-moz-osx-font-smoothing:auto;-webkit-font-smoothing:subpixel-antialiased;direction:ltr;font-family:Avenir,"Avenir Next","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;font-variant-numeric:tabular-nums;font-weight:500;line-height:1.7;max-width:100%;min-width:200px;position:relative;text-shadow:none;transition:box-shadow .3s ease}.plyr audio,.plyr video{border-radius:inherit;height:auto;vertical-align:middle;width:100%}.plyr button{font:inherit;line-height:inherit;width:auto}.plyr:focus{outline:0}.plyr--full-ui{box-sizing:border-box}.plyr--full-ui *,.plyr--full-ui ::after,.plyr--full-ui ::before{box-sizing:inherit}.plyr--full-ui a,.plyr--full-ui button,.plyr--full-ui input,.plyr--full-ui label{touch-action:manipulation}.plyr__badge{background:#4a5764;border-radius:2px;color:#fff;font-size:9px;line-height:1;padding:3px 4px}.plyr--full-ui ::-webkit-media-text-track-container{display:none}.plyr__captions{animation:plyr-fade-in .3s ease;bottom:0;color:#fff;display:none;font-size:14px;left:0;padding:10px;position:absolute;text-align:center;transition:transform .4s ease-in-out;width:100%}.plyr__captions .plyr__caption{background:rgba(0,0,0,.8);border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone;line-height:185%;padding:.2em .5em;white-space:pre-wrap}.plyr__captions .plyr__caption div{display:inline}.plyr__captions span:empty{display:none}@media (min-width:480px){.plyr__captions{font-size:16px;padding:20px}}@media (min-width:768px){.plyr__captions{font-size:18px}}.plyr--captions-active .plyr__captions{display:block}.plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty)~.plyr__captions{transform:translateY(-40px)}.plyr__control{background:0 0;border:0;border-radius:3px;color:inherit;cursor:pointer;flex-shrink:0;overflow:visible;padding:7px;position:relative;transition:all .3s ease}.plyr__control svg{display:block;fill:currentColor;height:18px;pointer-events:none;width:18px}.plyr__control:focus{outline:0}.plyr__control.plyr__tab-focus{box-shadow:0 0 0 5px rgba(0,179,255,.5);outline:0}a.plyr__control{text-decoration:none}a.plyr__control::after,a.plyr__control::before{display:none}.plyr__control.plyr__control--pressed .icon--not-pressed,.plyr__control.plyr__control--pressed .label--not-pressed,.plyr__control:not(.plyr__control--pressed) .icon--pressed,.plyr__control:not(.plyr__control--pressed) .label--pressed{display:none}.plyr--audio .plyr__control.plyr__tab-focus,.plyr--audio .plyr__control:hover,.plyr--audio .plyr__control[aria-expanded=true]{background:#00b3ff;color:#fff}.plyr--video .plyr__control.plyr__tab-focus,.plyr--video .plyr__control:hover,.plyr--video .plyr__control[aria-expanded=true]{background:#00b3ff;color:#fff}.plyr__control--overlaid{background:rgba(0,179,255,.8);border:0;border-radius:100%;color:#fff;display:none;left:50%;padding:15px;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.plyr__control--overlaid svg{left:2px;position:relative}.plyr__control--overlaid:focus,.plyr__control--overlaid:hover{background:#00b3ff}.plyr--playing .plyr__control--overlaid{opacity:0;visibility:hidden}.plyr--full-ui.plyr--video .plyr__control--overlaid{display:block}.plyr--full-ui ::-webkit-media-controls{display:none}.plyr__controls{align-items:center;display:flex;justify-content:flex-end;text-align:center}.plyr__controls .plyr__progress__container{flex:1;min-width:0}.plyr__controls .plyr__controls__item{margin-left:2.5px}.plyr__controls .plyr__controls__item:first-child{margin-left:0;margin-right:auto}.plyr__controls .plyr__controls__item.plyr__progress__container{padding-left:2.5px}.plyr__controls .plyr__controls__item.plyr__time{padding:0 5px}.plyr__controls .plyr__controls__item.plyr__progress__container:first-child,.plyr__controls .plyr__controls__item.plyr__time+.plyr__time,.plyr__controls .plyr__controls__item.plyr__time:first-child{padding-left:0}.plyr__controls .plyr__controls__item.plyr__volume{padding-right:5px}.plyr__controls .plyr__controls__item.plyr__volume:first-child{padding-right:0}.plyr__controls:empty{display:none}.plyr--audio .plyr__controls{background:#fff;border-radius:inherit;color:#4a5764;padding:10px}.plyr--video .plyr__controls{background:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,.7));border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;bottom:0;color:#fff;left:0;padding:20px 5px 5px;position:absolute;right:0;transition:opacity .4s ease-in-out,transform .4s ease-in-out;z-index:3}@media (min-width:480px){.plyr--video .plyr__controls{padding:35px 10px 10px}}.plyr--video.plyr--hide-controls .plyr__controls{opacity:0;pointer-events:none;transform:translateY(100%)}.plyr [data-plyr=airplay],.plyr [data-plyr=captions],.plyr [data-plyr=fullscreen],.plyr [data-plyr=pip]{display:none}.plyr--airplay-supported [dataLine truncated
|
|
||||||
Whitespace-only changes.
-86
@@ -1,86 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en" dir="ltr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>hub</title>
|
|
||||||
<link rel="stylesheet" href="css/plyr.css"/>
|
|
||||||
<link rel="stylesheet" href="css/index.css">
|
|
||||||
<link rel="stylesheet" href="css/video.css">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Latest compiled and minified CSS -->
|
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
|
||||||
|
|
||||||
<!-- jQuery library -->
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Popper JS -->
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Latest compiled JavaScript -->
|
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
|
|
||||||
|
|
||||||
<script src="js/plyr.js"></script>
|
|
||||||
<script src="js/index.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<!-- Grey with black text -->
|
|
||||||
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
|
|
||||||
<!-- Brand -->
|
|
||||||
<a class="navbar-brand" href="#">Lukis Tube</a>
|
|
||||||
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item active">
|
|
||||||
<a class="nav-link" href="index.html">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="random.html">Random Video</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="category.html">Categories</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="videopagewrapper hideit">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="videoleftbanner">
|
|
||||||
<div class="likefield">Likes: 10</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="videowrapper"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="closebutton">Close</div>
|
|
||||||
<div class="videorightbanner"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-5">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<button id="likebtn">Like it!</button>
|
|
||||||
<button id="tagbutton">Tag it!</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-5">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="previewcontainer">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
-130
@@ -1,130 +0,0 @@
|
|||||||
let videos;
|
|
||||||
let loadindex = 0;
|
|
||||||
let scrollposition = 0;
|
|
||||||
let loadedvideoid = -1;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
$.post('php/videoload.php', 'action=getMovies', function (data) {
|
|
||||||
videos = data;
|
|
||||||
loadPreviewBlock(15);
|
|
||||||
}, 'json');
|
|
||||||
|
|
||||||
$.post('php/videoload.php', 'action=getDbSize', function (data) {
|
|
||||||
console.log(data);
|
|
||||||
}, 'json');
|
|
||||||
|
|
||||||
$(".closebutton").click(function () {
|
|
||||||
$("#likebtn").off();
|
|
||||||
$("#tagbutton").off();
|
|
||||||
$(".videopagewrapper").hide();
|
|
||||||
$(".previewcontainer").show();
|
|
||||||
// scroll back to last scroll position
|
|
||||||
$(window).scrollTop(scrollposition);
|
|
||||||
$(".videowrapper").html("");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(window).scroll(function () {
|
|
||||||
if ($(window).scrollTop() >= (($(document).height() - $(window).height() - 60))) {
|
|
||||||
if ($(".videowrapper").html() === "") {
|
|
||||||
loadPreviewBlock(6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function loadPreviewBlock(nr) {
|
|
||||||
for (let i = 0; i < nr; i++) {
|
|
||||||
if (loadindex + i < videos.length) {
|
|
||||||
loadPreview(videos[loadindex + i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadindex += nr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadPreview(src) {
|
|
||||||
$.post('php/videoload.php', 'action=readThumbnail&movieid=' + src.movie_id, function (data) {
|
|
||||||
var preview = $(`
|
|
||||||
<div class='videopreview'>
|
|
||||||
<div class='previewtitle'>${src.movie_name}</div>
|
|
||||||
<div class='previewpic'>
|
|
||||||
<img style='width:100%;height:100%' src="${data}" alt='no thumbnail found'/>
|
|
||||||
</div>
|
|
||||||
</div>`);
|
|
||||||
preview.attr('movie_id', src.movie_id);
|
|
||||||
preview.click(function () {
|
|
||||||
console.log("preview clicked");
|
|
||||||
scrollposition = $(window).scrollTop();
|
|
||||||
loadedvideoid = $(this).attr("movie_id");
|
|
||||||
loadVideo(loadedvideoid);
|
|
||||||
});
|
|
||||||
$(".previewcontainer").append(preview);
|
|
||||||
}, 'text');
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadVideo(movieid) {
|
|
||||||
$.post('php/videoload.php', 'action=loadVideo&movieid=' + movieid, function (data) {
|
|
||||||
$(".videowrapper").html("<div class='myvideo'><video controls crossorigin playsinline id='player'></video></div>");
|
|
||||||
|
|
||||||
const player = new Plyr('#player');
|
|
||||||
player.source = {
|
|
||||||
type: 'video',
|
|
||||||
sources: [
|
|
||||||
{
|
|
||||||
src: data.movie_url,
|
|
||||||
type: 'video/mp4',
|
|
||||||
size: 1080,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
poster: data.thumbnail
|
|
||||||
};
|
|
||||||
|
|
||||||
$(".likefield").html("Likes: " + data.likes);
|
|
||||||
|
|
||||||
$.post('php/videoload.php', 'action=getTags&movieid=' + loadedvideoid, function (data) {
|
|
||||||
for (const tag in data.tags) {
|
|
||||||
$(".videoleftbanner").append(`<div>${tag}</div>`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
}, "json");
|
|
||||||
|
|
||||||
$("#likebtn").click(function () {
|
|
||||||
console.log("likebtn clicked");
|
|
||||||
$.post('php/videoload.php', 'action=addLike&movieid=' + loadedvideoid, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
}, "json");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#tagbutton").click(function () {
|
|
||||||
console.log("tagbrn clicked");
|
|
||||||
Swal.mixin({
|
|
||||||
input: 'text',
|
|
||||||
confirmButtonText: 'Next →',
|
|
||||||
showCancelButton: true,
|
|
||||||
progressSteps: ['1', '2', '3']
|
|
||||||
}).queue([
|
|
||||||
{
|
|
||||||
title: 'Question 1',
|
|
||||||
text: 'Chaining swal2 modals is easy'
|
|
||||||
},
|
|
||||||
'Question 2',
|
|
||||||
'Question 3'
|
|
||||||
]).then((result) => {
|
|
||||||
if (result.value) {
|
|
||||||
const answers = JSON.stringify(result.value)
|
|
||||||
Swal.fire({
|
|
||||||
title: 'All done!',
|
|
||||||
html: `
|
|
||||||
Your answers:
|
|
||||||
<pre><code>${answers}</code></pre>
|
|
||||||
`,
|
|
||||||
confirmButtonText: 'Lovely!'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".videopagewrapper").show();
|
|
||||||
$(".previewcontainer").hide();
|
|
||||||
}, "json");
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
"object"==typeof navigator&&function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Plyr",t):(e=e||self).Plyr=t()}(this,function(){"use strict";!function(){if("undefined"!=typeof window)try{var e=new window.CustomEvent("test",{cancelable:!0});if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,i;return(t=t||{}).bubbles=!!t.bubbles,t.cancelable=!!t.cancelable,(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i=n.preventDefault,n.preventDefault=function(){i.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n,i,r,a="object",o=function(e){return e&&e.Math==Math&&e},s=o(typeof globalThis==a&&globalThis)||o(typeof window==a&&window)||o(typeof self==a&&self)||o(typeof e==a&&e)||Function("return this")(),l=function(e){try{return!!e()}catch(e){return!0}},c=!l(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),u={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,f={f:h&&!u.call({1:2},1)?function(e){var t=h(this,e);return!!t&&t.enumerable}:u},d=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},p={}.toString,m=function(e){return p.call(e).slice(8,-1)},g="".split,v=l(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==m(e)?g.call(e,""):Object(e)}:Object,y=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},b=function(e){return v(y(e))},w=function(e){return"object"==typeof e?null!==e:"function"==typeof e},k=function(e,t){if(!w(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!w(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!w(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!w(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")},T={}.hasOwnProperty,S=function(e,t){return T.call(e,t)},E=s.document,A=w(E)&&w(E.createElement),x=function(e){return A?E.createElement(e):{}},P=!c&&!l(function(){return 7!=Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a}),C=Object.getOwnPropertyDescriptor,I={f:c?C:function(e,t){if(e=b(e),t=k(t,!0),P)try{return C(e,t)}catch(e){}if(S(e,t))return d(!f.f.call(e,t),e[t])}},L=function(e){if(!w(e))throw TypeError(String(e)+" is not an object");return e},M=Object.defineProperty,O={f:c?M:function(e,t,n){if(L(e),t=k(t,!0),L(n),P)try{return M(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},j=c?function(e,t,n){return O.f(e,t,d(1,n))}:function(e,t,n){return e[t]=n,e},N=function(e,t){try{j(s,e,t)}catch(n){s[e]=t}return t},_=t(function(e){var t=s["__core-js_shared__"]||N("__core-js_shared__",{});(e.exports=function(e,n){return t[e]||(t[e]=void 0!==n?n:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),R=_("native-function-to-string",Function.toString),U=s.WeakMap,F="function"==typeof U&&/native code/.test(R.call(U)),q=0,D=Math.random(),H=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++q+D).toString(36)},V=_("keys"),B=function(e){return V[e]||(V[e]=H(e))},z={},W=s.WeakMap;if(F){var K=new W,$=K.get,Y=K.has,G=K.set;n=function(e,t){return G.call(K,e,t),t},i=function(e){return $.call(K,e)||{}},r=function(e){return Y.call(K,e)}}else{var Q=B("state");z[Q]=!0,n=function(e,t){return j(e,Q,t),t},i=function(e){return S(e,Q)?e[Q]:{}},r=function(e){return S(e,Q)}}var X={set:n,get:i,has:r,enforce:function(e){return r(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var n;if(!w(t)||(n=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},J=t(function(e){var t=X.get,n=X.enforce,i=String(R).split("toString");_("inspectSource",function(e){return R.call(e)}),(e.exports=function(e,t,r,a){var o=!!a&&!!a.unsafe,l=!!a&&!!a.enumerable,c=!!a&&!!a.noTargetGet;"function"==typeof r&&("string"!=typeof t||S(r,"name")||j(r,"name",t),n(r).source=i.join("string"==typeof t?t:"")),e!==s?(o?!c&&e[t]&&(l=!0):delete e[t],l?e[t]=r:j(e,t,r)):l?e[t]=r:N(t,r)})(Function.prototype,"toString",function(){return"function"==typeof this&&t(this).source||R.call(this)})}),Z=s,ee=function(e){return"function"==typeof e?e:void 0},te=function(e,t){return arguments.length<2?ee(Z[e])||ee(s[e]):Z[e]&&Z[e][t]||s[e]&&s[e][t]},ne=Math.ceil,ie=Math.floor,re=function(e){return isNaN(e=+e)?0:(e>0?ie:ne)(e)},ae=Math.min,oe=function(e){return e>0?ae(re(e),9007199254740991):0},se=Math.max,le=Math.min,ce=function(e,t){var n=re(e);return n<0?se(n+t,0):le(Line truncated
|
|
||||||
//# sourceMappingURL=plyr.polyfilled.js.map
|
|
||||||
-125
@@ -1,125 +0,0 @@
|
|||||||
let videos;
|
|
||||||
let loadindex = 0;
|
|
||||||
let loadedvideoid = -1;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
$.post('php/videoload.php', 'action=getRandomMovies&number=6', function (data) {
|
|
||||||
videos = data;
|
|
||||||
loadPreviewBlock(6);
|
|
||||||
}, 'json');
|
|
||||||
|
|
||||||
$(".closebutton").click(function () {
|
|
||||||
$("#likebtn").off();
|
|
||||||
$("#tagbutton").off();
|
|
||||||
$(".videopagewrapper").hide();
|
|
||||||
$(".previewcontainer").show();
|
|
||||||
// scroll back to last scroll position
|
|
||||||
$(window).scrollTop(scrollposition);
|
|
||||||
$(".videowrapper").html("");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#shufflebtn").click(function () {
|
|
||||||
$(".previewcontainer").html("");
|
|
||||||
$.post('php/videoload.php', 'action=getRandomMovies&number=6', function (data) {
|
|
||||||
videos = data;
|
|
||||||
loadPreviewBlock(6);
|
|
||||||
}, 'json');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function loadPreviewBlock(nr) {
|
|
||||||
for (let i = 0; i < nr; i++) {
|
|
||||||
if (loadindex + i < videos.length) {
|
|
||||||
loadPreview(videos[loadindex + i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadindex += nr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadPreview(src) {
|
|
||||||
$.post('php/videoload.php', 'action=readThumbnail&movieid=' + src.movie_id, function (data) {
|
|
||||||
var preview = $(`
|
|
||||||
<div class='videopreview'>
|
|
||||||
<div class='previewtitle'>${src.movie_name}</div>
|
|
||||||
<div class='previewpic'>
|
|
||||||
<img style='width:100%;height:100%' src="${data}" alt='no thumbnail found'/>
|
|
||||||
</div>
|
|
||||||
</div>`);
|
|
||||||
preview.attr('movie_id', src.movie_id);
|
|
||||||
preview.click(function () {
|
|
||||||
console.log("preview clicked");
|
|
||||||
scrollposition = $(window).scrollTop();
|
|
||||||
loadedvideoid = $(this).attr("movie_id");
|
|
||||||
loadVideo(loadedvideoid);
|
|
||||||
});
|
|
||||||
$(".previewcontainer").append(preview);
|
|
||||||
}, 'text');
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadVideo(movieid) {
|
|
||||||
$.post('php/videoload.php', 'action=loadVideo&movieid=' + movieid, function (data) {
|
|
||||||
$(".videowrapper").html("<div class='myvideo'><video controls crossorigin playsinline id='player'></video></div>");
|
|
||||||
|
|
||||||
const player = new Plyr('#player');
|
|
||||||
player.source = {
|
|
||||||
type: 'video',
|
|
||||||
sources: [
|
|
||||||
{
|
|
||||||
src: data.movie_url,
|
|
||||||
type: 'video/mp4',
|
|
||||||
size: 1080,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
poster: data.thumbnail
|
|
||||||
};
|
|
||||||
|
|
||||||
$(".likefield").html("Likes: " + data.likes);
|
|
||||||
|
|
||||||
$.post('php/videoload.php', 'action=getTags&movieid=' + loadedvideoid, function (data) {
|
|
||||||
for (const tag in data.tags) {
|
|
||||||
$(".videoleftbanner").append(`<div>${tag}</div>`);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(data);
|
|
||||||
}, "json");
|
|
||||||
|
|
||||||
$("#likebtn").click(function () {
|
|
||||||
console.log("likebtn clicked");
|
|
||||||
$.post('php/videoload.php', 'action=addLike&movieid=' + loadedvideoid, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
}, "json");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#tagbutton").click(function () {
|
|
||||||
console.log("tagbrn clicked");
|
|
||||||
Swal.mixin({
|
|
||||||
input: 'text',
|
|
||||||
confirmButtonText: 'Next →',
|
|
||||||
showCancelButton: true,
|
|
||||||
progressSteps: ['1', '2', '3']
|
|
||||||
}).queue([
|
|
||||||
{
|
|
||||||
title: 'Question 1',
|
|
||||||
text: 'Chaining swal2 modals is easy'
|
|
||||||
},
|
|
||||||
'Question 2',
|
|
||||||
'Question 3'
|
|
||||||
]).then((result) => {
|
|
||||||
if (result.value) {
|
|
||||||
const answers = JSON.stringify(result.value)
|
|
||||||
Swal.fire({
|
|
||||||
title: 'All done!',
|
|
||||||
html: `
|
|
||||||
Your answers:
|
|
||||||
<pre><code>${answers}</code></pre>
|
|
||||||
`,
|
|
||||||
confirmButtonText: 'Lovely!'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".videopagewrapper").show();
|
|
||||||
$(".previewcontainer").hide();
|
|
||||||
}, "json");
|
|
||||||
}
|
|
||||||
Generated
+14053
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "untitled",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
|
"@testing-library/react": "^9.5.0",
|
||||||
|
"@testing-library/user-event": "^7.2.1",
|
||||||
|
"bootstrap": "^4.5.0",
|
||||||
|
"react": "^16.13.1",
|
||||||
|
"react-dom": "^16.13.1",
|
||||||
|
"react-scripts": "3.4.1",
|
||||||
|
"plyr-react": "2.2.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"proxy": "http://127.0.0.1:4000",
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "react-app"
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
-85
@@ -1,85 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en" dir="ltr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>hub</title>
|
|
||||||
<link rel="stylesheet" href="css/plyr.css"/>
|
|
||||||
<link rel="stylesheet" href="css/video.css">
|
|
||||||
<link rel="stylesheet" href="css/random.css">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Latest compiled and minified CSS -->
|
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
|
||||||
|
|
||||||
<!-- jQuery library -->
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Popper JS -->
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Latest compiled JavaScript -->
|
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
|
|
||||||
|
|
||||||
<script src="js/plyr.js"></script>
|
|
||||||
<script src="js/random.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<!-- Grey with black text -->
|
|
||||||
<nav class="navbar navbar-expand-sm bg-primary navbar-dark">
|
|
||||||
<!-- Brand -->
|
|
||||||
<a class="navbar-brand" href="#">Lukis Tube</a>
|
|
||||||
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="index.html">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item active">
|
|
||||||
<a class="nav-link" href="random.html">Random Video</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="category.html">Categories</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="videopagewrapper hideit">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="videoleftbanner">
|
|
||||||
<div class="likefield">Likes: 10</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="videowrapper"></div>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<div class="closebutton">Close</div>
|
|
||||||
<div class="videorightbanner"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-5">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<button id="likebtn">Like it!</button>
|
|
||||||
<button id="tagbutton">Tag it!</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-5">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="previewcontainer">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100%"><button type="button" id="shufflebtn" class="btn btn-success">Shuffle</button></div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import MainBody from "./MainBody";
|
||||||
|
|
||||||
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||||
|
|
||||||
|
class App extends React.Component {
|
||||||
|
constructor(props, context) {
|
||||||
|
super(props, context);
|
||||||
|
this.state = {page: "default"};
|
||||||
|
|
||||||
|
// bind this to the method for being able to call methods such as this.setstate
|
||||||
|
this.showVideo = this.showVideo.bind(this);
|
||||||
|
this.hideVideo = this.hideVideo.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="App">
|
||||||
|
<nav className="navbar navbar-expand-sm bg-primary navbar-dark">
|
||||||
|
<a className="navbar-brand" href="!#">Lukis Tube</a>
|
||||||
|
|
||||||
|
<ul className="navbar-nav">
|
||||||
|
<li className="nav-item">
|
||||||
|
<a className="nav-link" onClick={() => this.loadHomePage()} href='# '>Home</a>
|
||||||
|
</li>
|
||||||
|
<li className="nav-item">
|
||||||
|
<a className="nav-link" onClick={() => this.loadRandomPage()} href="# ">Random Video</a>
|
||||||
|
</li>
|
||||||
|
<li className="nav-item">
|
||||||
|
<a className="nav-link" onClick={() => this.loadCategoriesPage()} href="# ">Categories</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<MainBody viewbinding={{showVideo: this.showVideo, hideVideo: this.hideVideo}} page={this.state.page}
|
||||||
|
videoelement={this.element}/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadCategoriesPage() {
|
||||||
|
console.log("click categories");
|
||||||
|
this.setState({page: "categories"});
|
||||||
|
}
|
||||||
|
|
||||||
|
loadRandomPage() {
|
||||||
|
console.log("click random");
|
||||||
|
this.setState({page: "random"});
|
||||||
|
}
|
||||||
|
|
||||||
|
loadHomePage() {
|
||||||
|
console.log("click default");
|
||||||
|
this.setState({page: "default"});
|
||||||
|
}
|
||||||
|
|
||||||
|
showVideo(element) {
|
||||||
|
this.setState({
|
||||||
|
page: "video"
|
||||||
|
});
|
||||||
|
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
hideVideo() {
|
||||||
|
this.setState({
|
||||||
|
page: "default"
|
||||||
|
});
|
||||||
|
this.element = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import React from "react";
|
||||||
|
import Preview from "./Preview";
|
||||||
|
import "./css/HomePage.css"
|
||||||
|
|
||||||
|
class HomePage extends React.Component {
|
||||||
|
// stores all available movies
|
||||||
|
data = null;
|
||||||
|
// stores current index of loaded elements
|
||||||
|
loadindex = 0;
|
||||||
|
|
||||||
|
constructor(props, context) {
|
||||||
|
super(props, context);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
loadeditems: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
document.addEventListener('scroll', this.trackScrolling);
|
||||||
|
|
||||||
|
const updateRequest = new FormData();
|
||||||
|
updateRequest.append('action', 'getMovies');
|
||||||
|
|
||||||
|
// fetch all videos available
|
||||||
|
fetch('/php/videoload.php', {method: 'POST', body: updateRequest})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((result) => {
|
||||||
|
this.data = result;
|
||||||
|
this.loadPreviewBlock(12);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.setState({});
|
||||||
|
document.removeEventListener('scroll', this.trackScrolling);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div><h1>Home page</h1></div>
|
||||||
|
<div className='sideinfo'>
|
||||||
|
beep beep
|
||||||
|
</div>
|
||||||
|
<div className='maincontent'>
|
||||||
|
{this.state.loadeditems.map(elem => (
|
||||||
|
<Preview
|
||||||
|
key={elem.movie_id}
|
||||||
|
name={elem.movie_name}
|
||||||
|
movie_id={elem.movie_id}
|
||||||
|
viewbinding={this.props.viewbinding}/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className='rightinfo'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadPreviewBlock(nr) {
|
||||||
|
console.log("loadpreviewblock called ...")
|
||||||
|
let ret = [];
|
||||||
|
for (let i = 0; i < nr; i++) {
|
||||||
|
// only add if not end
|
||||||
|
if (this.data.length > this.loadindex + i) {
|
||||||
|
ret.push(this.data[this.loadindex + i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
loadeditems: [
|
||||||
|
...this.state.loadeditems,
|
||||||
|
...ret
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
this.loadindex += nr;
|
||||||
|
}
|
||||||
|
|
||||||
|
trackScrolling = (e) => {
|
||||||
|
if (window.innerHeight + document.documentElement.scrollTop === document.documentElement.offsetHeight) {
|
||||||
|
this.loadPreviewBlock(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomePage;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from "react";
|
||||||
|
import HomePage from "./HomePage";
|
||||||
|
|
||||||
|
class MainBody extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.props = props;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let page;
|
||||||
|
if (this.props.page === "default") {
|
||||||
|
page = <HomePage viewbinding={this.props.viewbinding}/>;
|
||||||
|
} else if (this.props.page === "video") {
|
||||||
|
// show videoelement if neccessary
|
||||||
|
page = this.props.videoelement;
|
||||||
|
} else {
|
||||||
|
page = <div>unimplemented yet!</div>;
|
||||||
|
}
|
||||||
|
return (page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MainBody;
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
import React from "react";
|
||||||
|
import "./css/Player.css"
|
||||||
|
import {PlyrComponent} from 'plyr-react';
|
||||||
|
|
||||||
|
|
||||||
|
class Player extends React.Component {
|
||||||
|
constructor(props, context) {
|
||||||
|
super(props, context);
|
||||||
|
|
||||||
|
this.state = {};
|
||||||
|
|
||||||
|
this.props = props;
|
||||||
|
}
|
||||||
|
|
||||||
|
options = {
|
||||||
|
controls: [
|
||||||
|
'play-large', // The large play button in the center
|
||||||
|
'play', // Play/pause playback
|
||||||
|
'progress', // The progress bar and scrubber for playback and buffering
|
||||||
|
'current-time', // The current time of playback
|
||||||
|
'duration', // The full duration of the media
|
||||||
|
'mute', // Toggle mute
|
||||||
|
'volume', // Volume control
|
||||||
|
'captions', // Toggle captions
|
||||||
|
'settings', // Settings menu
|
||||||
|
'airplay', // Airplay (currently Safari only)
|
||||||
|
'download', // Show a download button with a link to either the current source or a custom URL you specify in your options
|
||||||
|
'fullscreen', // Toggle fullscreen
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.fetchMovieData();
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-sm-2">
|
||||||
|
<div className="videoleftbanner">
|
||||||
|
<div className="likefield">Likes: {this.state.likes}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-sm-8">
|
||||||
|
<div className="videowrapper">
|
||||||
|
<div className='myvideo'>
|
||||||
|
{this.state.sources ? <PlyrComponent
|
||||||
|
sources={this.state.sources}
|
||||||
|
options={this.options}/> :
|
||||||
|
<div>not loaded yet</div>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-sm-2">
|
||||||
|
<div className="closebutton" onClick={() => {this.closebtn()}}>Close</div>
|
||||||
|
<div className="videorightbanner"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-sm-5">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="col-sm-2">
|
||||||
|
<button className='btn btn-primary' onClick={() => {this.likebtn()}}>Like it!</button>
|
||||||
|
<button className='btn btn-info' id="tagbutton">Tag it!</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="col-sm-5">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchMovieData(){
|
||||||
|
const updateRequest = new FormData();
|
||||||
|
updateRequest.append('action', 'loadVideo');
|
||||||
|
updateRequest.append('movieid', this.props.movie_id);
|
||||||
|
|
||||||
|
fetch('/php/videoload.php', {method: 'POST', body: updateRequest})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((result) => {
|
||||||
|
this.setState({
|
||||||
|
sources: {
|
||||||
|
type: 'video',
|
||||||
|
sources: [
|
||||||
|
{
|
||||||
|
src: result.movie_url,
|
||||||
|
type: 'video/mp4',
|
||||||
|
size: 1080,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
poster: result.thumbnail
|
||||||
|
},
|
||||||
|
likes: result.likes
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Click Listener */
|
||||||
|
likebtn() {
|
||||||
|
const updateRequest = new FormData();
|
||||||
|
updateRequest.append('action', 'addLike');
|
||||||
|
updateRequest.append('movieid', this.props.movie_id);
|
||||||
|
|
||||||
|
fetch('/php/videoload.php', {method: 'POST', body: updateRequest})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((result) => {
|
||||||
|
if(result.result === "success"){
|
||||||
|
this.fetchMovieData();
|
||||||
|
}else{
|
||||||
|
console.log("an error occured while liking");
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
closebtn() {
|
||||||
|
this.props.viewbinding.hideVideo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Player;
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import React from "react";
|
||||||
|
import "./css/Preview.css"
|
||||||
|
import Player from "./Player";
|
||||||
|
|
||||||
|
class Preview extends React.Component {
|
||||||
|
constructor(props, context) {
|
||||||
|
super(props, context);
|
||||||
|
this.props = props;
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
previewpicture: null,
|
||||||
|
name: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.setState({});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.setState({
|
||||||
|
previewpicture: null,
|
||||||
|
name: this.props.name
|
||||||
|
});
|
||||||
|
|
||||||
|
const updateRequest = new FormData();
|
||||||
|
updateRequest.append('action', 'readThumbnail');
|
||||||
|
updateRequest.append('movieid', this.props.movie_id);
|
||||||
|
|
||||||
|
fetch('/php/videoload.php', {method: 'POST', body: updateRequest})
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((result) => {
|
||||||
|
this.setState(prevState => ({
|
||||||
|
...prevState.previewpicture, previewpicture: result
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className='videopreview' onClick={() => this.itemClick()}>
|
||||||
|
<div className='previewtitle'>{this.state.name}</div>
|
||||||
|
<div className='previewpic'>
|
||||||
|
<img className='previewimage'
|
||||||
|
src={this.state.previewpicture}
|
||||||
|
alt='no thumbnail found'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemClick() {
|
||||||
|
console.log("item clicked!" + this.state.name);
|
||||||
|
|
||||||
|
this.props.viewbinding.showVideo(<Player viewbinding={this.props.viewbinding} movie_id={this.props.movie_id}/>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Preview;
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
.sideinfo{
|
||||||
|
width: 20%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maincontent{
|
||||||
|
float: left;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rightinfo{
|
||||||
|
float: left;
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
.hideit {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.closebutton {
|
.closebutton {
|
||||||
color: white;
|
color: white;
|
||||||
height: 35px;
|
height: 35px;
|
||||||
@@ -35,36 +31,3 @@
|
|||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.previewcontainer {
|
|
||||||
margin-left: 10%;
|
|
||||||
width: 80%;
|
|
||||||
margin-right: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.videopreview {
|
|
||||||
height: 300px;
|
|
||||||
width: 30%;
|
|
||||||
float: left;
|
|
||||||
margin: 1%;
|
|
||||||
background-color: #7F7F7F;
|
|
||||||
cursor: pointer;
|
|
||||||
opacity: 0.9;
|
|
||||||
border: 10px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.videopreview:hover {
|
|
||||||
opacity: 1;
|
|
||||||
transition: opacity 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.previewtitle {
|
|
||||||
height: 10%;
|
|
||||||
color: white;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.previewpic {
|
|
||||||
height: 80%;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
.previewtitle {
|
||||||
|
height: 10%;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.previewpic {
|
||||||
|
height: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.previewimage{
|
||||||
|
width:100%;
|
||||||
|
height:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videopreview {
|
||||||
|
height: 300px;
|
||||||
|
width: 30%;
|
||||||
|
float: left;
|
||||||
|
margin: 1%;
|
||||||
|
background-color: #7F7F7F;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.9;
|
||||||
|
border: 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videopreview:hover {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* todo check if neccessary*/
|
||||||
|
.previewcontainer {
|
||||||
|
margin-left: 10%;
|
||||||
|
width: 80%;
|
||||||
|
margin-right: 10%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import './css/index.css';
|
||||||
|
import App from './App';
|
||||||
|
import * as serviceWorker from './serviceWorker';
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>,
|
||||||
|
document.getElementById('root')
|
||||||
|
);
|
||||||
|
|
||||||
|
// If you want your app to work offline and load faster, you can change
|
||||||
|
// unregister() to register() below. Note this comes with some pitfalls.
|
||||||
|
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||||
|
serviceWorker.register();
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
// This optional code is used to register a service worker.
|
||||||
|
// register() is not called by default.
|
||||||
|
|
||||||
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
// it offline capabilities. However, it also means that developers (and users)
|
||||||
|
// will only see deployed updates on subsequent visits to a page, after all the
|
||||||
|
// existing tabs open on the page have been closed, since previously cached
|
||||||
|
// resources are updated in the background.
|
||||||
|
|
||||||
|
// To learn more about the benefits of this model and instructions on how to
|
||||||
|
// opt-in, read https://bit.ly/CRA-PWA
|
||||||
|
|
||||||
|
const isLocalhost = Boolean(
|
||||||
|
window.location.hostname === 'localhost' ||
|
||||||
|
// [::1] is the IPv6 localhost address.
|
||||||
|
window.location.hostname === '[::1]' ||
|
||||||
|
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||||
|
window.location.hostname.match(
|
||||||
|
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export function register(config) {
|
||||||
|
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||||
|
// The URL constructor is available in all browsers that support SW.
|
||||||
|
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||||
|
if (publicUrl.origin !== window.location.origin) {
|
||||||
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||||
|
// from what our page is served on. This might happen if a CDN is used to
|
||||||
|
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||||
|
|
||||||
|
if (isLocalhost) {
|
||||||
|
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||||
|
checkValidServiceWorker(swUrl, config);
|
||||||
|
|
||||||
|
// Add some additional logging to localhost, pointing developers to the
|
||||||
|
// service worker/PWA documentation.
|
||||||
|
navigator.serviceWorker.ready.then(() => {
|
||||||
|
console.log(
|
||||||
|
'This web app is being served cache-first by a service ' +
|
||||||
|
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Is not localhost. Just register service worker
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerValidSW(swUrl, config) {
|
||||||
|
navigator.serviceWorker
|
||||||
|
.register(swUrl)
|
||||||
|
.then(registration => {
|
||||||
|
registration.onupdatefound = () => {
|
||||||
|
const installingWorker = registration.installing;
|
||||||
|
if (installingWorker == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
installingWorker.onstatechange = () => {
|
||||||
|
if (installingWorker.state === 'installed') {
|
||||||
|
if (navigator.serviceWorker.controller) {
|
||||||
|
// At this point, the updated precached content has been fetched,
|
||||||
|
// but the previous service worker will still serve the older
|
||||||
|
// content until all client tabs are closed.
|
||||||
|
console.log(
|
||||||
|
'New content is available and will be used when all ' +
|
||||||
|
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onUpdate) {
|
||||||
|
config.onUpdate(registration);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// At this point, everything has been precached.
|
||||||
|
// It's the perfect time to display a
|
||||||
|
// "Content is cached for offline use." message.
|
||||||
|
console.log('Content is cached for offline use.');
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onSuccess) {
|
||||||
|
config.onSuccess(registration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error during service worker registration:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidServiceWorker(swUrl, config) {
|
||||||
|
// Check if the service worker can be found. If it can't reload the page.
|
||||||
|
fetch(swUrl, {
|
||||||
|
headers: { 'Service-Worker': 'script' },
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
// Ensure service worker exists, and that we really are getting a JS file.
|
||||||
|
const contentType = response.headers.get('content-type');
|
||||||
|
if (
|
||||||
|
response.status === 404 ||
|
||||||
|
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||||
|
) {
|
||||||
|
// No service worker found. Probably a different app. Reload the page.
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister().then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Service worker found. Proceed as normal.
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
console.log(
|
||||||
|
'No internet connection found. App is running in offline mode.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unregister() {
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.ready
|
||||||
|
.then(registration => {
|
||||||
|
registration.unregister();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||||
|
// allows you to do things like:
|
||||||
|
// expect(element).toHaveTextContent(/react/i)
|
||||||
|
// learn more: https://github.com/testing-library/jest-dom
|
||||||
|
import '@testing-library/jest-dom/extend-expect';
|
||||||
Reference in new issue
Block a user