This commit is contained in:
Nicolas A. Tonne
2015-06-07 23:32:56 +02:00
8 changed files with 96 additions and 29 deletions

View File

@@ -770,8 +770,42 @@ ul #chat-log{
text-align: center;
}
#code-link + span{
line-height: normal;
color: black;
text-align: center;
#volume-control {
cursor:pointer;
float:left;
position: relative;
left: 10px;
margin: 13px auto;
height:5px;
width: 97%;
background-color:rgba(0, 0, 0, 0.5);
border: none;
outline: none;
border-radius: 2px;
}
#volume-control .ui-slider-range-min {
height:5px;
width: 75px;
position: absolute;
background-color:rgba(47, 47, 47, 1);
border: none;
outline: none;
border-radius: 2px;
}
#volume-control .ui-slider-handle {
height:15px;
width:5px;
background-color:black;
position: absolute;
cursor: pointer;
outline: none;
border: none;
}

View File

@@ -13,11 +13,13 @@ socket.on("id", function(id)
{
socket.on(id, function(arr)
{
console.log(arr);
if(arr[0] == "volume")
{
$("#volume").slider("value", arr[1]);
ytplayer.setVolume(arr[1]);
localStorage.setItem("volume", arr[1]);
choose_button(arr[1], false);
}else if(arr[0] == "channel")
{
socket.emit("change_channel");

View File

@@ -76,6 +76,8 @@ function sortFunction(a, b) {
$(document).ready(function (){
//Materialize.toast("<a href='/remote' style='color:white;'>Try out our new feature, remote!</a>", 8000)
list_html = $("#channels").html();
$("#channels").empty();

View File

@@ -7,30 +7,32 @@ $(document).ready(function (){
socket = io.connect('http://'+window.location.hostname+':3000');
id = window.location.pathname.split("/")[2];
if(id)
{
id = id.toLowerCase();
control();
}
});
document.getElementById("remote_play").addEventListener("click", function()
function play()
{
socket.emit("id", [id, "play", "mock"]);
});
};
document.getElementById("remote_pause").addEventListener("click", function()
function pause()
{
socket.emit("id", [id, "pause", "mock"]);
});
};
document.getElementById("remote_skip").addEventListener("click", function()
function skip()
{
socket.emit("id", [id, "skip", "mock"]);
});
};
/*
document.getElementById("volume-control").addEventListener("click", function()
{
console.log("Sending...")
socket.emit("id", [id, "volume", $("#volume-control").val()]);
console.log("Sent new vol signal")
});
socket.emit("id", [id, "volume", $("#volume-control").val()]);
});*/
>>>>>>> 126fe2fec4a1d36ec179e889d4d7162118b4fc49
function control()
{
@@ -45,14 +47,32 @@ function control()
$("#volume-control").css("display", "block");
$("#remote-controls").css("display", "block");
document.getElementById("base").setAttribute("onsubmit", "control(); return false;");
$("#remote-text").text("Controlling "+ id.toUpperCase())
$("#code-input").attr("length", "18");
$("#code-input").attr("maxlength", "18");
document.getElementById("search").setAttribute("length", "18");
document.getElementById("search").setAttribute("maxlength", "18");
$("#forsearch").html("Type new channel name to change to");
$("#volume-control").slider({
min: 0,
max: 100,
value: 100,
range: "min",
animate: true,
/*slide: function(event, ui) {
console.log(ui.value);
//localStorage.setItem("volume", ui.value);
},*/
stop:function(event, ui) {
socket.emit("id", [id, "volume", ui.value]);
//console.log(ui.value);
}
});
}else
{
socket.emit("id", [id, "channel", $("#code-input").val().toLowerCase()]);
$("#code-input").val("");
socket.emit("id", [id, "channel", $("#search").val().toLowerCase()]);
$("#search").val("");
}
return false;
}