added like feature
tag beginnings
This commit is contained in:
55
js/index.js
55
js/index.js
@ -1,6 +1,7 @@
|
||||
let videos;
|
||||
let loadindex = 0;
|
||||
let scrollposition = 0;
|
||||
let loadedvideoid = -1;
|
||||
|
||||
$(document).ready(function () {
|
||||
$.post('php/videoload.php', 'action=getMovies', function (data) {
|
||||
@ -13,6 +14,8 @@ $(document).ready(function () {
|
||||
}, 'json');
|
||||
|
||||
$(".closebutton").click(function () {
|
||||
$("#likebtn").off();
|
||||
$("#tagbutton").off();
|
||||
$(".videopagewrapper").hide();
|
||||
$(".previewcontainer").show();
|
||||
// scroll back to last scroll position
|
||||
@ -23,7 +26,7 @@ $(document).ready(function () {
|
||||
|
||||
$(window).scroll(function () {
|
||||
if ($(window).scrollTop() >= (($(document).height() - $(window).height() - 60))) {
|
||||
if ($(".videowrapper").html() == "") {
|
||||
if ($(".videowrapper").html() === "") {
|
||||
loadPreviewBlock(6);
|
||||
}
|
||||
}
|
||||
@ -51,7 +54,8 @@ function loadPreview(src) {
|
||||
preview.click(function () {
|
||||
console.log("preview clicked");
|
||||
scrollposition = $(window).scrollTop();
|
||||
loadVideo($(this).attr("movie_id"));
|
||||
loadedvideoid = $(this).attr("movie_id");
|
||||
loadVideo(loadedvideoid);
|
||||
});
|
||||
$(".previewcontainer").append(preview);
|
||||
}, 'text');
|
||||
@ -73,6 +77,53 @@ function loadVideo(movieid) {
|
||||
],
|
||||
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");
|
||||
|
Reference in New Issue
Block a user