mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Better colorthief handling
- Moved colorthief handling to api, making it easier to controll where the requests comes from
This commit is contained in:
@@ -547,7 +547,6 @@ var Channel = {
|
||||
socket.removeEventListener("suggested");
|
||||
socket.removeEventListener("color");
|
||||
socket.removeEventListener("chat_history");
|
||||
socket.removeEventListener("color");
|
||||
$.ajax({
|
||||
url: "/",
|
||||
success: function(e){
|
||||
|
||||
@@ -21,6 +21,22 @@ function removeAllListeners() {
|
||||
socket.removeEventListener(id);
|
||||
}
|
||||
|
||||
function getColor(id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/api/color",
|
||||
async: true,
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function(c) {
|
||||
if(typeof(c) == "object") {
|
||||
Player.setBGimage({color:c, only:true});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function hide_native(way) {
|
||||
if(way == 1){
|
||||
if(!$('.castButton').hasClass('castButton-white-active')) {
|
||||
@@ -453,9 +469,9 @@ function setup_chat_listener(){
|
||||
}
|
||||
|
||||
function setup_list_listener(){
|
||||
//if(!client) {
|
||||
if(!offline) {
|
||||
socket.on("color", Player.setBGimage);
|
||||
//}
|
||||
}
|
||||
socket.on("channel", List.channel_function);
|
||||
}
|
||||
|
||||
@@ -524,6 +540,7 @@ function change_offline(enabled, already_offline){
|
||||
}
|
||||
|
||||
if(window.location.pathname != "/"){
|
||||
socket.removeEventListener("color");
|
||||
$("#controls").on("mouseenter", function(e){
|
||||
if($("#seekToDuration").hasClass("hide")){
|
||||
$("#seekToDuration").removeClass("hide");
|
||||
@@ -592,6 +609,7 @@ function change_offline(enabled, already_offline){
|
||||
$("#controls").off("click", Channel.seekToClick);
|
||||
$("#seekToDuration").remove();
|
||||
if(window.location.pathname != "/"){
|
||||
socket.on("color", Player.setBGimage);
|
||||
socket.emit("pos", {channel: chan.toLowerCase()});
|
||||
var add = "";
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
|
||||
@@ -405,7 +405,8 @@ var Player = {
|
||||
Player.player.loadVideoById({'videoId': id, 'startSeconds': s, 'endSeconds': e});
|
||||
}
|
||||
if(offline) {
|
||||
socket.emit("color", {id: id});
|
||||
getColor(id);
|
||||
//socket.emit("color", {id: id});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user