added old project files
This commit is contained in:
27
js/login.js
Executable file
27
js/login.js
Executable file
@@ -0,0 +1,27 @@
|
||||
$(document).ready(function() {
|
||||
$("#myform").submit(function(event) {
|
||||
event.preventDefault();
|
||||
// console.log($("#myform").serialize());
|
||||
checkpasswd($("#myform").serialize());
|
||||
//
|
||||
});
|
||||
});
|
||||
|
||||
function checkpasswd(data) {
|
||||
// console.log(data);
|
||||
$.post('php/checkpasswd.php', data, function(retdata){
|
||||
if (retdata.valid == true) {
|
||||
//successfully logged in
|
||||
sessionStorage.LAST_ACTIVITY = Math.round(new Date().getTime() / 1000);
|
||||
document.cookie = "LAST_ACTIVITY="+Math.round(new Date().getTime() / 1000);
|
||||
window.location ="movies.php";
|
||||
return true;
|
||||
}else {
|
||||
$(".mypassalert").show();
|
||||
|
||||
setTimeout(function () {
|
||||
$(".mypassalert").hide();
|
||||
}, 2000);
|
||||
}
|
||||
},'json');
|
||||
}
|
94
js/movies.js
Executable file
94
js/movies.js
Executable file
@@ -0,0 +1,94 @@
|
||||
//global variables:
|
||||
var loadedVideos =0;
|
||||
var allmovies = null;
|
||||
var tempmovies = [];
|
||||
|
||||
var tempscrollposition = null;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$.post('php/db/getmoviefromdb.php','action=all',function(data){
|
||||
//console.log(data);
|
||||
allmovies = data;
|
||||
tempmovies = allmovies.data;
|
||||
|
||||
loadNewPreviews(20);
|
||||
},'json');
|
||||
|
||||
$(window).scroll(function() {
|
||||
if($(window).scrollTop() + $(window).height() == $(document).height()) {
|
||||
loadNewPreviews(10);
|
||||
console.log("loadnew");
|
||||
}
|
||||
});
|
||||
|
||||
$('.moviespace-backbutton').click(function() {
|
||||
$('#moviespace').hide();
|
||||
$('.moviespace-videospace').html("");
|
||||
$('.movielist').show();
|
||||
$(window).scrollTop(tempscrollposition);
|
||||
});
|
||||
|
||||
$("#moviesearch-form").submit(false);
|
||||
|
||||
$("#moviesearch").change(function(event) {
|
||||
console.log("change...");
|
||||
search();
|
||||
|
||||
});
|
||||
|
||||
$('#moviesearch-button').click(function(event) {
|
||||
search();
|
||||
});
|
||||
|
||||
$('.btnloadmore').click(function() {
|
||||
loadNewPreviews(10);
|
||||
});
|
||||
});
|
||||
|
||||
function search() {
|
||||
$(".movielist").html("");
|
||||
tempmovies = [];
|
||||
loadedVideos = 0;
|
||||
for (var i in allmovies.data) {
|
||||
if(allmovies.data[i].name.toUpperCase().includes($("#moviesearch").val().toUpperCase())){
|
||||
tempmovies.push(allmovies.data[i]);
|
||||
}
|
||||
}
|
||||
console.log(tempmovies.length);
|
||||
if(tempmovies.length < 15){
|
||||
loadNewPreviews(tempmovies.length);
|
||||
}else{
|
||||
loadNewPreviews(15);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function loadNewPreviews(number) {
|
||||
for (var i = 0; i < number; i++) {
|
||||
if (loadedVideos < tempmovies.length) { //maybe TODO
|
||||
loadMoviePreview(tempmovies[loadedVideos]);
|
||||
|
||||
loadedVideos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadMoviePreview(data) {
|
||||
var preview = $("<div class='movietile'><div class='movietile-thumbnail'><img style='max-width: 100%;max-height:100%;border-radius: 25px;' src='rsc/thumbnails/"+data.thumbnail+"'></img></div><div class='movietile-text'>"+data.name+"</div></div>");
|
||||
$(".movielist").append(preview);
|
||||
preview.click(function(event) {
|
||||
tempscrollposition = $(window).scrollTop();
|
||||
$('.movielist').hide();
|
||||
var thisvideo = tempmovies[$(this).index()];
|
||||
$('#moviespace').show();
|
||||
$('.moviespace-videospace').html("<video id='moviespace-video' controls><source src='../Filme/"+thisvideo.url+"'></video>");
|
||||
$('.moviespace-heading').html(thisvideo.name);
|
||||
$.post('rsc/moviedatajson/'+thisvideo.name+'.json','',function(data){
|
||||
console.log(data);
|
||||
$('.moviespace-infospace').html(data.overview);
|
||||
},'json');
|
||||
|
||||
|
||||
});
|
||||
}
|
55
js/series.js
Executable file
55
js/series.js
Executable file
@@ -0,0 +1,55 @@
|
||||
var tempscrollposition = 0;
|
||||
|
||||
$(document).ready(function() {
|
||||
$.post('php/getseriesdata.php','action=getallseries',function(data){
|
||||
console.log(data);
|
||||
// console.log("post finished");
|
||||
|
||||
for (var num in data.data) {
|
||||
//insert a tile for each TV show...
|
||||
var previewtvshow = $("<div class='movietile'><div class='movietile-thumbnail'><img style='max-width: 100%;max-height:100%;' src=\"rsc/thumbnailsseries/"+data.data[num].thumbnail+"\"></img></div><div class='movietile-text'>"+data.data[num].name+"</div></div>");
|
||||
$(".movielist").append(previewtvshow);
|
||||
previewtvshow.click(function(event) {
|
||||
var clickeditem = data.data[$(this).index()];
|
||||
|
||||
tempscrollposition = $(window).scrollTop();
|
||||
$('.movielist').hide();
|
||||
console.log(clickeditem);
|
||||
$.post('php/getseriesdata.php','action=getseries&seriesname='+clickeditem.name,function(data){
|
||||
console.log(data);
|
||||
|
||||
// TODO
|
||||
// var seasons = [];
|
||||
/*
|
||||
var seasonold = "";
|
||||
for (var n in data.data) {
|
||||
var filename = data.data[n].name;
|
||||
var season = filename.substring(filename.length-5,filename.length-3); // TODO:
|
||||
if (season != seasonold) {
|
||||
seasons.push(season);
|
||||
seasonold = season;
|
||||
}
|
||||
}
|
||||
console.log("This tv show has "+seasons.length+" seasons");*/
|
||||
|
||||
$('.episodelist').html("");
|
||||
for (var i in data.data) {
|
||||
var episode = $("<div class='movietile'><div class='movietile-thumbnail'><img style='max-width: 100%;max-height:100%;' src=\"rsc/thumbnailsseries/"+data.data[i].thumbnail+"\"></img></div><div class='movietile-text'>"+data.data[i].name+"</div></div>");
|
||||
$('.episodelist').append(episode);
|
||||
episode.click(function(event) {
|
||||
var clickeditem = data.data[$(this).index()];
|
||||
console.log(clickeditem);
|
||||
$('.episodelist').hide();
|
||||
$('#moviespace').show();
|
||||
|
||||
$('.moviespace-videospace').html("<video id='moviespace-video' controls><source src='../Serien/"+clickeditem.url+"'></video>");
|
||||
$('.moviespace-heading').html(clickeditem.name);
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
$('.episodelist').show();
|
||||
});
|
||||
}
|
||||
|
||||
},'json');
|
||||
});
|
Reference in New Issue
Block a user