mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed upperlowercase bug with remotecontroll, ended up putting everything to lowercase, but showing uppercase because of CSS and looks. Updated looks of nochan.js and remotecontroller.js to be more similar to all other js files
This commit is contained in:
@@ -1 +1 @@
|
|||||||
!function(){function e(e){var n="",a=0;e.sort(t),pre_card=$(o);for(x in e){var i=e[x][3];if(20>a){var s=e[x][1],l=e[x][0],r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=e[x][4],d=pre_card;d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}n+="<option value='"+i+"'> ",a++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=n,$("#channels").fadeIn(800),$("#search").focus()}function t(e,t){var o=e[0],n=t[0],a=e[4],i=t[4];return n>o?1:o>n?-1:i>a?1:a>i?-1:0}var o,n;String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){o=$("#channels").html(),$("#channels").empty();var t=io.connect("//"+window.location.hostname+":3000");t.emit("frontpage_lists"),t.on("playlists",function(t){e(t)});var a=0;document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),n=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,n=$.parseJSON(n),$("#latest-commit").html("Latest Commit: <br>"+n[0].commit.author.date.substring(0,10)+": "+n[0].committer.login+"<br><a href='"+n[0].html_url+"'>"+n[0].sha.substring(0,10)+"</a>: "+n[0].commit.message+"<br")})}();
|
!function(){var e,t,o={populate_channels:function(t){var n="",a=0;t.sort(o.sortFunction),pre_card=$(e);for(x in t){var i=t[x][3];if(20>a){var s=t[x][1],l=t[x][0],r="background-image:url('https://img.youtube.com/vi/"+s+"/hqdefault.jpg');",c=t[x][4],d=pre_card;d.find(".chan-name").text(i),d.find(".chan-name").attr("title",i),d.find(".chan-views").text(l),d.find(".chan-songs").text(c),d.find(".chan-bg").attr("style",r),d.find(".chan-link").attr("href",i),$("#channels").append(d.html())}n+="<option value='"+i+"'> ",a++}document.getElementById("preloader").style.display="none",document.getElementById("searches").innerHTML=n,$("#channels").fadeIn(800),$("#search").focus()},sortFunction:function(e,t){var o=e[0],n=t[0],a=e[4],i=t[4];return n>o?1:o>n?-1:i>a?1:a>i?-1:0}};String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.slice(1)},$(document).ready(function(){e=$("#channels").html(),$("#channels").empty();var n=io.connect("//"+window.location.hostname+":3000");n.emit("frontpage_lists"),n.on("playlists",function(e){o.populate_channels(e)});var a=0;document.getElementById("zicon").addEventListener("click",function(){a+=10,document.getElementById("zicon").style.paddingLeft=a+"%",a>=100&&(window.location.href="https://www.youtube.com/v/0IGsNdVoEh0?autoplay=1&showinfo=0&autohide=1")}),t=$.ajax({type:"GET",url:"https://api.github.com/repos/zoff-music/zoff/commits",async:!1}).responseText,t=$.parseJSON(t),$("#latest-commit").html("Latest Commit: <br>"+t[0].commit.author.date.substring(0,10)+": "+t[0].committer.login+"<br><a href='"+t[0].html_url+"'>"+t[0].sha.substring(0,10)+"</a>: "+t[0].commit.message+"<br")})}();
|
||||||
File diff suppressed because one or more lines are too long
2
static/build-js/remotecontroller-min.js
vendored
2
static/build-js/remotecontroller-min.js
vendored
@@ -1 +1 @@
|
|||||||
!function(){function e(){o?(t||(t=$("#code-input").val().toLowerCase()),$("#code-input").val(""),o=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+t),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:!0,stop:function(e,o){socket.emit("id",[t,"volume",o.value]),console.log("volume")}})):(socket.emit("id",[t,"channel",$("#search").val().toLowerCase()]),$("#search").val(""))}var t,o=!0;$(document).ready(function(){setTimeout(function(){$("#search").focus()},500),socket=io.connect("//"+window.location.hostname+":3000"),t=window.location.pathname.split("/")[2],t&&e()}),$("#playbutton").on("click",function(){socket.emit("id",[t,"play","mock"])}),$("#pausebutton").on("click",function(){socket.emit("id",[t,"pause","mock"])}),$("#skipbutton").on("click",function(){socket.emit("id",[t,"skip","mock"])}),$("#remoteform").on("submit",function(){o?window.location.href="/remote/"+document.getElementById("remoteform").chan.value:e()})}();
|
!function(){var e,t=!0;$(document).ready(function(){setTimeout(function(){$("#search").focus()},500),socket=io.connect("//"+window.location.hostname+":3000"),e=window.location.pathname.split("/")[2],e&&(e=e.toLowerCase(),o.control())}),$("#playbutton").on("click",function(){socket.emit("id",[e,"play","mock"])}),$("#pausebutton").on("click",function(){socket.emit("id",[e,"pause","mock"])}),$("#skipbutton").on("click",function(){socket.emit("id",[e,"skip","mock"])}),$("#remoteform").on("submit",function(){t?window.location.href="/remote/"+document.getElementById("remoteform").chan.value:o.control()});var o={control:function(){t?(e||(e=$("#code-input").val().toLowerCase()),$("#code-input").val(""),t=!1,$(".rc").css("display","block"),$("#remote-text").text("Controlling "+e.toUpperCase()),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:!0,stop:function(t,o){socket.emit("id",[e,"volume",o.value]),console.log("volume")}})):(socket.emit("id",[e,"channel",$("#search").val().toLowerCase()]),$("#search").val(""))}}}();
|
||||||
@@ -4,6 +4,7 @@ var Hostcontroller = {
|
|||||||
socket.on("id", function(id)
|
socket.on("id", function(id)
|
||||||
{
|
{
|
||||||
var codeURL = "//"+window.location.hostname+"/remote/"+id;
|
var codeURL = "//"+window.location.hostname+"/remote/"+id;
|
||||||
|
console.log(id);
|
||||||
$("#code-text").text(id)
|
$("#code-text").text(id)
|
||||||
$("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL);
|
$("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL);
|
||||||
$("#code-link").attr("href", codeURL);
|
$("#code-link").attr("href", codeURL);
|
||||||
|
|||||||
@@ -14,70 +14,77 @@ function getCookie(cname) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function populate_channels(lists)
|
var Nochan = {
|
||||||
{
|
|
||||||
var output = "";
|
|
||||||
var num = 0;
|
|
||||||
lists.sort(sortFunction);
|
|
||||||
|
|
||||||
pre_card = $(list_html);
|
populate_channels: function(lists)
|
||||||
|
{
|
||||||
|
var output = "";
|
||||||
|
var num = 0;
|
||||||
|
lists.sort(Nochan.sortFunction);
|
||||||
|
|
||||||
for(x in lists)
|
pre_card = $(list_html);
|
||||||
{
|
|
||||||
|
|
||||||
var chan = lists[x][3];
|
for(x in lists)
|
||||||
if(num<20)
|
{
|
||||||
{
|
|
||||||
var id = lists[x][1];
|
|
||||||
var viewers = lists[x][0];
|
|
||||||
var img = "background-image:url('https://img.youtube.com/vi/"+id+"/hqdefault.jpg');";
|
|
||||||
var song_count = lists[x][4];
|
|
||||||
|
|
||||||
//$("#channels").append(list_html);
|
var chan = lists[x][3];
|
||||||
|
if(num<20)
|
||||||
|
{
|
||||||
|
var id = lists[x][1];
|
||||||
|
var viewers = lists[x][0];
|
||||||
|
var img = "background-image:url('https://img.youtube.com/vi/"+id+"/hqdefault.jpg');";
|
||||||
|
var song_count = lists[x][4];
|
||||||
|
|
||||||
|
//$("#channels").append(list_html);
|
||||||
|
|
||||||
|
var card = pre_card;
|
||||||
|
card.find(".chan-name").text(chan);
|
||||||
|
card.find(".chan-name").attr("title", chan);
|
||||||
|
card.find(".chan-views").text(viewers);
|
||||||
|
card.find(".chan-songs").text(song_count);
|
||||||
|
card.find(".chan-bg").attr("style", img);
|
||||||
|
card.find(".chan-link").attr("href", chan);
|
||||||
|
|
||||||
|
$("#channels").append(card.html());
|
||||||
|
|
||||||
|
//$("#channels").append(card);
|
||||||
|
//console.log(chan);
|
||||||
|
}
|
||||||
|
output+="<option value='"+chan+"'> ";
|
||||||
|
num++;
|
||||||
|
//if(num>19)break;
|
||||||
|
}
|
||||||
|
document.getElementById("preloader").style.display = "none";
|
||||||
|
document.getElementById("searches").innerHTML = output;
|
||||||
|
//Materialize.fadeInImage('#channels');
|
||||||
|
$("#channels").fadeIn(800);
|
||||||
|
$("#search").focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
sortFunction: function(a, b) {
|
||||||
|
var o1 = a[0];
|
||||||
|
var o2 = b[0];
|
||||||
|
|
||||||
|
var p1 = a[4];
|
||||||
|
var p2 = b[4];
|
||||||
|
|
||||||
|
if (o1 < o2) return 1;
|
||||||
|
if (o1 > o2) return -1;
|
||||||
|
if (p1 < p2) return 1;
|
||||||
|
if (p1 > p2) return -1;
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
|
||||||
var card = pre_card;
|
|
||||||
card.find(".chan-name").text(chan);
|
|
||||||
card.find(".chan-name").attr("title", chan);
|
|
||||||
card.find(".chan-views").text(viewers);
|
|
||||||
card.find(".chan-songs").text(song_count);
|
|
||||||
card.find(".chan-bg").attr("style", img);
|
|
||||||
card.find(".chan-link").attr("href", chan);
|
|
||||||
|
|
||||||
$("#channels").append(card.html());
|
|
||||||
|
|
||||||
//$("#channels").append(card);
|
|
||||||
//console.log(chan);
|
|
||||||
}
|
|
||||||
output+="<option value='"+chan+"'> ";
|
|
||||||
num++;
|
|
||||||
//if(num>19)break;
|
|
||||||
}
|
|
||||||
document.getElementById("preloader").style.display = "none";
|
|
||||||
document.getElementById("searches").innerHTML = output;
|
|
||||||
//Materialize.fadeInImage('#channels');
|
|
||||||
$("#channels").fadeIn(800);
|
|
||||||
$("#search").focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String.prototype.capitalizeFirstLetter = function() {
|
String.prototype.capitalizeFirstLetter = function() {
|
||||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sortFunction(a, b) {
|
|
||||||
var o1 = a[0];
|
|
||||||
var o2 = b[0];
|
|
||||||
|
|
||||||
var p1 = a[4];
|
|
||||||
var p2 = b[4];
|
|
||||||
|
|
||||||
if (o1 < o2) return 1;
|
|
||||||
if (o1 > o2) return -1;
|
|
||||||
if (p1 < p2) return 1;
|
|
||||||
if (p1 > p2) return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function (){
|
$(document).ready(function (){
|
||||||
|
|
||||||
//Materialize.toast("<a href='/remote' style='color:white;'>Try out our new feature, remote!</a>", 8000)
|
//Materialize.toast("<a href='/remote' style='color:white;'>Try out our new feature, remote!</a>", 8000)
|
||||||
@@ -88,7 +95,7 @@ $(document).ready(function (){
|
|||||||
var socket = io.connect('//'+window.location.hostname+':3000');
|
var socket = io.connect('//'+window.location.hostname+':3000');
|
||||||
socket.emit('frontpage_lists');
|
socket.emit('frontpage_lists');
|
||||||
socket.on('playlists', function(msg){
|
socket.on('playlists', function(msg){
|
||||||
populate_channels(msg);
|
Nochan.populate_channels(msg);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ $(document).ready(function (){
|
|||||||
id = window.location.pathname.split("/")[2];
|
id = window.location.pathname.split("/")[2];
|
||||||
if(id)
|
if(id)
|
||||||
{
|
{
|
||||||
//id = id.toLowerCase();
|
id = id.toLowerCase();
|
||||||
control();
|
Remotecontroller.control();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -32,45 +32,49 @@ $("#remoteform").on("submit", function()
|
|||||||
if(start)
|
if(start)
|
||||||
window.location.href = '/remote/'+document.getElementById("remoteform").chan.value;
|
window.location.href = '/remote/'+document.getElementById("remoteform").chan.value;
|
||||||
else
|
else
|
||||||
control();
|
Remotecontroller.control();
|
||||||
});
|
});
|
||||||
|
|
||||||
function control()
|
var Remotecontroller = {
|
||||||
{
|
|
||||||
if(start)
|
control: function()
|
||||||
{
|
{
|
||||||
if(!id)id = $("#code-input").val().toLowerCase();
|
if(start)
|
||||||
$("#code-input").val("");
|
{
|
||||||
start = false;
|
if(!id)id = $("#code-input").val().toLowerCase();
|
||||||
|
$("#code-input").val("");
|
||||||
|
start = false;
|
||||||
|
|
||||||
$(".rc").css("display", "block");
|
$(".rc").css("display", "block");
|
||||||
|
|
||||||
//document.getElementById("base").setAttribute("onsubmit", "control(); return false;");
|
//document.getElementById("base").setAttribute("onsubmit", "control(); return false;");
|
||||||
$("#remote-text").text("Controlling "+ id)
|
$("#remote-text").text("Controlling "+ id.toUpperCase())
|
||||||
document.getElementById("search").setAttribute("length", "18");
|
document.getElementById("search").setAttribute("length", "18");
|
||||||
document.getElementById("search").setAttribute("maxlength", "18");
|
document.getElementById("search").setAttribute("maxlength", "18");
|
||||||
$("#forsearch").html("Type new channel name to change to");
|
$("#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("volume");
|
||||||
|
//console.log(ui.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
socket.emit("id", [id, "channel", $("#search").val().toLowerCase()]);
|
||||||
|
$("#search").val("");
|
||||||
|
}
|
||||||
|
|
||||||
$("#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("volume");
|
|
||||||
//console.log(ui.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
socket.emit("id", [id, "channel", $("#search").val().toLowerCase()]);
|
|
||||||
$("#search").val("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user