tenna
Version:
A node js application that lets you easily stream most videos from any PC/laptop in your home network, to other devices in the network with a browser.
50 lines (48 loc) • 1.47 kB
JavaScript
(function() {
$(document).ready(function() {
var scrollToVid, target;
scrollToVid = function(video) {
var $video, scrollConf;
$video = $(video);
if ($video.length !== 1) {
console.log('bad video target: ', video);
window.location.hash = '';
return;
}
scrollConf = {
scrollTop: $video.offset().top
};
return $('html, body').stop().animate(scrollConf, 500, 'swing', function() {
return window.location.hash = video;
});
};
target = window.location.hash;
if (target) {
scrollToVid(target);
}
$(".row").on("click", ".video-wrapper", function(evt) {
var videoTarget;
videoTarget = $(this).attr('id');
$("video").each(function(i, e) {
var $e, classToggle;
$e = $(e);
classToggle = $e.attr("data-vid") === videoTarget;
$e.toggleClass("hide", !classToggle);
$e.toggleClass("show", classToggle);
return e.pause();
});
return $("video.show")[0].play();
});
return $(".row").on("click", ".delete-btn", function(evt) {
var $container, videoName;
videoName = $(this).data('name');
$container = $(this).parents('.tile');
if (!confirm("Are you sure you want to delete this video?")) {
return 0;
}
return $.get('delete/' + videoName).done(function() {
return $container.remove();
});
});
});
}).call(this);