mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Controller is up
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
var began = false;
|
||||
var id
|
||||
|
||||
socket.on("guid", function(guid)
|
||||
socket.on("id", function(id)
|
||||
{
|
||||
console.log(guid);
|
||||
if(!began)
|
||||
{
|
||||
socket.on(guid, function(arr)
|
||||
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]);
|
||||
}else if(arr[0] == "channel")
|
||||
{
|
||||
socket.emit("change_channel");
|
||||
|
||||
42
static/js/mobilecontroller.js
Normal file
42
static/js/mobilecontroller.js
Normal file
@@ -0,0 +1,42 @@
|
||||
var start = true;
|
||||
var id;
|
||||
var socket;
|
||||
|
||||
$(document).ready(function (){
|
||||
setTimeout(function(){$("#search").focus();},500);
|
||||
socket = io.connect('http://'+window.location.hostname+':3000');
|
||||
});
|
||||
|
||||
function controll()
|
||||
{
|
||||
if(start)
|
||||
{
|
||||
id = $("#search").val().toLowerCase();
|
||||
$("#search").val("");
|
||||
start = false;
|
||||
$("#volume-controll").css("display", "block");
|
||||
$("#search").attr("length", "18");
|
||||
$("#search").attr("maxlength", "18");
|
||||
$("#forsearch").html("Type new channel name to change to")
|
||||
$("#volume-controll").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", $("#search").val().toLowerCase()]);
|
||||
$("#search").val("");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user