Commit 952bd87d authored by Gautam Chitnis's avatar Gautam Chitnis

Component-division: existing functions completely divided as needed

This commit places all the exisiting functions into their appropriate components.
VLM basics are also added.
To try it, just open the console first, select VLM option from side menu,
select submit without entering any text and the error returned by VLM pops up in the console.

Gautam C.
parent 462410a6
function openNav() {
if(screen.width <= 480){
document.getElementById("sideNav").style.width = "60%";
}
else
{
document.getElementById("sideNav").style.width = "20%";
}
}
function openNavMobile() {
document.getElementById("sideNav").style.width = "60%";
}
function closeNav() {
document.getElementById("sideNav").style.width = "0";
}
\ No newline at end of file
function toggleRepeat()
{
sendCommand(0,"command=pl_repeat");
}
function removeCurrent()
{
sendCommand(0,"command=pl_delete&id="+data.children[0].children[0].id);
app.removeItem(data.children[0].children[0].id);
playlistInit();
}
\ No newline at end of file
function openPlaylist() {
document.getElementById("playlistNav").style.width = "60%";
document.getElementById("playlistNavMobile").style.width = "0%";
}
function closePlaylist() {
document.getElementById("playlistNav").style.width = "0%";
document.getElementById("playlistNavMobile").style.width = "10%";
}
function playlistInit()
{
sendCommand(1);
}
function populatePlaylist()
{
data = JSON.parse(jsonData);
for (var i = 0; i < data.children[0].children.length; i++) {
app.addItem(data.children[0].children[i].id, data.children[0].children[i].name, data.children[0].children[i].src);
}
}
\ No newline at end of file
var player;
var app;
var fileInput;
var jsonData;
var xmlData;
var data;
$(function() { // Handler for .ready() called.
......@@ -17,59 +17,6 @@ $(function() { // Handler for .ready() called.
});
});
function openNav() {
if(screen.width <= 480){
document.getElementById("sideNav").style.width = "60%";
}
else
{
document.getElementById("sideNav").style.width = "20%";
}
}
function openNavMobile() {
document.getElementById("sideNav").style.width = "60%";
}
function openPlaylist() {
document.getElementById("playlistNav").style.width = "60%";
document.getElementById("playlistNavMobile").style.width = "0%";
}
function closePlaylist() {
document.getElementById("playlistNav").style.width = "0%";
document.getElementById("playlistNavMobile").style.width = "10%";
}
function closeNav() {
document.getElementById("sideNav").style.width = "0";
}
function playlistInit()
{
sendCommand(1);
}
function populatePlaylist()
{
data = JSON.parse(jsonData);
for (var i = 0; i < data.children[0].children.length; i++) {
app.addItem(data.children[0].children[i].id, data.children[0].children[i].name, data.children[0].children[i].src);
}
}
function toggleRepeat()
{
sendCommand(0,"command=pl_repeat");
}
function removeCurrent()
{
sendCommand(0,"command=pl_delete&id="+data.children[0].children[0].id);
app.removeItem(data.children[0].children[0].id);
playlistInit();
}
function sendCommand(mode, params) {
if(mode == 0)
{
......@@ -92,7 +39,14 @@ function sendCommand(mode, params) {
});
} else if(mode == 2)
{
$.ajax({
url: 'requests/vlm_cmd.xml',
data: params,
success: function (data, status, jqXHR) {
xmlData = data;
console.log(xmlData);
}
});
} else if(mode == 3)
{
......
function executeVLM()
{
var cmd = document.getElementById("vlm-command").value;
sendCommand(2,"?command="+cmd);
console.log(xmlData);
}
\ No newline at end of file
......@@ -12,6 +12,10 @@
<script src="vendors/plyr/plyr.js"></script>
<script src='components/vue.methods.js'></script>
<script src="components/player/plyr.methods.js"></script>
<script src='components/controls/menu.component.js'></script>
<script src='components/vlm/vlm.component.js'></script>
<script src='components/playlist/playlist.component.js'></script>
<script src='components/playlist/buttons.playlist.component.js'></script>
<script src="components/script.js"></script>
<!--<script src="js/jstree.min.js"></script>-->
<!--<link rel="stylesheet" href="css/jstree-theme.css" />-->
......@@ -40,13 +44,13 @@
</script>
<div id="sideNav" class="sideNav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">Menu</span></a>
<a href="#" data-toggle="modal" data-target="#fileModal" onclick="">Open File</a>
<a href="#">Open File</a>
<!--<input type="file" id="videoInput"/>-->
<a href="#">Local Network</a>
<a href="#">Podcast</a>
<a href="#">Manage Streams</a>
<a href="#">Track Synchronization</a>
<a href="#">VLM Batch Commands</a>
<a href="#" data-toggle="modal" data-target="#vlmModal" onclick="">VLM Batch Commands</a>
</div>
<!-- Use any element to open the sidenav -->
......@@ -101,31 +105,26 @@
</div>
<!-- Modal -->
<div id="fileModal" class="modal fade" role="dialog">
<div id="vlmModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Select a file</h4>
<h4 class="modal-title">Write your VLM commands here (seperated by new line)</h4>
</div>
<div class="modal-body" id="jstree">
<ul>
<li>Root node 1
<ul>
<li id="child_node_1">Child node 1</li>
<li>Child node 2</li>
</ul>
</li>
<li>Root node 2</li>
</ul>
<div class="modal-body" id="">
<textarea id="vlm-command" cols="30 " rows="5"></textarea>
<div id="status">
status:
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" onclick="executeVLM()">Submit</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment