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:
Kasper Rynning-Tønnesen
2015-06-26 16:54:24 +02:00
parent 3b3b393d6a
commit 926a8c6d55
6 changed files with 102 additions and 90 deletions

View File

@@ -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

View File

@@ -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(""))}}}();

View File

@@ -4,6 +4,7 @@ var Hostcontroller = {
socket.on("id", function(id)
{
var codeURL = "//"+window.location.hostname+"/remote/"+id;
console.log(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-link").attr("href", codeURL);

View File

@@ -14,11 +14,13 @@ function getCookie(cname) {
}
*/
function populate_channels(lists)
{
var Nochan = {
populate_channels: function(lists)
{
var output = "";
var num = 0;
lists.sort(sortFunction);
lists.sort(Nochan.sortFunction);
pre_card = $(list_html);
@@ -57,14 +59,9 @@ function populate_channels(lists)
//Materialize.fadeInImage('#channels');
$("#channels").fadeIn(800);
$("#search").focus();
}
},
String.prototype.capitalizeFirstLetter = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
function sortFunction(a, b) {
sortFunction: function(a, b) {
var o1 = a[0];
var o2 = b[0];
@@ -76,6 +73,16 @@ function sortFunction(a, b) {
if (p1 < p2) return 1;
if (p1 > p2) return -1;
return 0;
},
}
String.prototype.capitalizeFirstLetter = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
$(document).ready(function (){
@@ -88,7 +95,7 @@ $(document).ready(function (){
var socket = io.connect('//'+window.location.hostname+':3000');
socket.emit('frontpage_lists');
socket.on('playlists', function(msg){
populate_channels(msg);
Nochan.populate_channels(msg);
})

View File

@@ -7,8 +7,8 @@ $(document).ready(function (){
id = window.location.pathname.split("/")[2];
if(id)
{
//id = id.toLowerCase();
control();
id = id.toLowerCase();
Remotecontroller.control();
}
});
@@ -32,11 +32,13 @@ $("#remoteform").on("submit", function()
if(start)
window.location.href = '/remote/'+document.getElementById("remoteform").chan.value;
else
control();
Remotecontroller.control();
});
function control()
{
var Remotecontroller = {
control: function()
{
if(start)
{
if(!id)id = $("#code-input").val().toLowerCase();
@@ -46,7 +48,7 @@ function control()
$(".rc").css("display", "block");
//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("maxlength", "18");
$("#forsearch").html("Type new channel name to change to");
@@ -73,4 +75,6 @@ function control()
$("#search").val("");
}
}
}