I did some things

This commit is contained in:
Kasper Rynning-Tønnesen
2015-11-25 23:45:23 +01:00
parent 5b50178639
commit 33803616fc
3 changed files with 107 additions and 36 deletions

View File

@@ -16,6 +16,8 @@ function getCookie(cname) {
var Nochan = {
blob_list: [],
populate_channels: function(lists)
{
var output = "";
@@ -89,32 +91,45 @@ var Nochan = {
},
add_backdrop: function(list, i) {
console.log(list.length)
if(i >= list.length) i = 0;
if(i >= list.length || i >= 8) i = 0;
var id = list[i][1];
$.ajax({
type: "POST",
data: {id:id},
url: "/php/imageblob.php",
success: function(data){
//data will contain the vote count echoed by the controller i.e.
$("#mega-background").css("opacity", 0);
$(".room-namer").css("opacity", 0);
setTimeout(function(){
$("#mega-background").css("background", "url(data:image/png;base64,"+data+")");
$("#mega-background").css("background-size" , "200%");
$("#mega-background").css("opacity", 1);
$("#search").attr("placeholder", list[i][3]);
$(".room-namer").css("opacity", 1);
},500);
//then append the result where ever you want like
//$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
if(Nochan.blob_list[i] !== undefined){
$("#mega-background").css("opacity", 0);
$(".room-namer").css("opacity", 0);
setTimeout(function(){
$("#mega-background").css("background", "url(data:image/png;base64,"+Nochan.blob_list[i]+")");
$("#mega-background").css("background-size" , "200%");
$("#mega-background").css("opacity", 1);
$("#search").attr("placeholder", list[i][3]);
$(".room-namer").css("opacity", 1);
},500);
}else{
$.ajax({
type: "POST",
data: {id:id},
url: "/php/imageblob.php",
success: function(data){
Nochan.blob_list.push(data);
//data will contain the vote count echoed by the controller i.e.
$("#mega-background").css("opacity", 0);
$(".room-namer").css("opacity", 0);
setTimeout(function(){
$("#mega-background").css("background", "url(data:image/png;base64,"+data+")");
$("#mega-background").css("background-size" , "200%");
$("#mega-background").css("opacity", 1);
$("#search").attr("placeholder", list[i][3]);
$(".room-namer").css("opacity", 1);
},500);
//then append the result where ever you want like
//$("span#votes_number").html(data); //data will be containing the vote count which you have echoed from the controller
}
});
}
setTimeout(function(){
Nochan.add_backdrop(list, i+1);
//Nochan.add_backdrop(list, i+1);
},6000);
}