mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Closes #234
This commit is contained in:
@@ -130,7 +130,11 @@ var Chat = {
|
|||||||
$("#chatall").append("<li title='"+inp.channel+"'><span class='time_color'>" + time + "</span> " + icon_add + "<span style='color:"+color_temp+";'>"+inp.from+"</span><span class='channel-info-all-chat'> " + inp.channel + " </span></li>");
|
$("#chatall").append("<li title='"+inp.channel+"'><span class='time_color'>" + time + "</span> " + icon_add + "<span style='color:"+color_temp+";'>"+inp.from+"</span><span class='channel-info-all-chat'> " + inp.channel + " </span></li>");
|
||||||
var in_text = document.createTextNode(inp.msg);
|
var in_text = document.createTextNode(inp.msg);
|
||||||
$("#chatall li:last")[0].appendChild(in_text);
|
$("#chatall li:last")[0].appendChild(in_text);
|
||||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
if(!userscroll) {
|
||||||
|
programscroll = true;
|
||||||
|
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||||
|
programscroll = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
channelchat: function(data, time_sent, disable_blink) {
|
channelchat: function(data, time_sent, disable_blink) {
|
||||||
@@ -172,7 +176,11 @@ var Chat = {
|
|||||||
$("#chatchannel").append("<li><span class='time_color'>" + time + "</span> " + icon_add + "<span style='color:"+color_temp+";'>"+data.from+"</span></li>");
|
$("#chatchannel").append("<li><span class='time_color'>" + time + "</span> " + icon_add + "<span style='color:"+color_temp+";'>"+data.from+"</span></li>");
|
||||||
var in_text = document.createTextNode(data.msg);
|
var in_text = document.createTextNode(data.msg);
|
||||||
$("#chatchannel li:last")[0].appendChild(in_text);
|
$("#chatchannel li:last")[0].appendChild(in_text);
|
||||||
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
|
if(!userscroll) {
|
||||||
|
programscroll = true;
|
||||||
|
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
|
||||||
|
programscroll = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
chat_blink: function() {
|
chat_blink: function() {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ var end_programmatically = false;
|
|||||||
var music = 0;
|
var music = 0;
|
||||||
var timed_remove_check;
|
var timed_remove_check;
|
||||||
var slider_type = "horizontal";
|
var slider_type = "horizontal";
|
||||||
|
var programscroll = false;
|
||||||
|
var userscroll = false;
|
||||||
var gotten_np = false;
|
var gotten_np = false;
|
||||||
var frontpage = 1;
|
var frontpage = 1;
|
||||||
var empty_clear = false;
|
var empty_clear = false;
|
||||||
@@ -443,7 +445,7 @@ function init(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
channel_listeners(true);
|
||||||
$.contextMenu({
|
$.contextMenu({
|
||||||
selector: '.playlist-element',
|
selector: '.playlist-element',
|
||||||
reposition: true,
|
reposition: true,
|
||||||
@@ -780,8 +782,10 @@ function setup_chat_listener(){
|
|||||||
for(var i = 0; i < data.length; i++) {
|
for(var i = 0; i < data.length; i++) {
|
||||||
if(msg.all) {
|
if(msg.all) {
|
||||||
Chat.allchat(data[i], data[i].createdAt, true);
|
Chat.allchat(data[i], data[i].createdAt, true);
|
||||||
|
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||||
} else {
|
} else {
|
||||||
Chat.channelchat(data[i], data[i].createdAt, true);
|
Chat.channelchat(data[i], data[i].createdAt, true);
|
||||||
|
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1542,8 +1546,47 @@ $(document).on("click", ".chat-link", function(){
|
|||||||
}
|
}
|
||||||
unseen = false;
|
unseen = false;
|
||||||
$("#favicon").attr("href", "/assets/images/favicon.png");
|
$("#favicon").attr("href", "/assets/images/favicon.png");
|
||||||
|
|
||||||
|
scrollChat();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".chat-tab-li", function() {
|
||||||
|
scrollChat();
|
||||||
|
});
|
||||||
|
|
||||||
|
function channel_listeners(on) {
|
||||||
|
if(on) {
|
||||||
|
$("#chatchannel").scroll(function(e) {
|
||||||
|
if(!programscroll) {
|
||||||
|
userscroll = true;
|
||||||
|
if($("#chatchannel").scrollTop() + $("#chatchannel").innerHeight() >= $("#chatchannel")[0].scrollHeight) {
|
||||||
|
userscroll = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#chatall").scroll(function(e) {
|
||||||
|
if(!programscroll) {
|
||||||
|
userscroll = true;
|
||||||
|
if($("#chatall").scrollTop() + $("#chatall").innerHeight() >= $("#chatall")[0].scrollHeight) {
|
||||||
|
userscroll = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
$("#chatchannel").off("scroll");
|
||||||
|
$("#chatall").off("scroll");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollChat() {
|
||||||
|
var current = $(".chat-tab.active").attr("href");
|
||||||
|
if(current == "#channelchat") {
|
||||||
|
$('#chatchannel').scrollTop($('#chatchannel')[0].scrollHeight);
|
||||||
|
} else if(current == "#all_chat") {
|
||||||
|
$('#chatall').scrollTop($('#chatall')[0].scrollHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function searchTimeout(event) {
|
function searchTimeout(event) {
|
||||||
search_input = $(".search_input").val();
|
search_input = $(".search_input").val();
|
||||||
|
|
||||||
@@ -2063,7 +2106,7 @@ function onepage_load(){
|
|||||||
document.getElementById("volume-button").removeEventListener("click", Playercontrols.mute_video);
|
document.getElementById("volume-button").removeEventListener("click", Playercontrols.mute_video);
|
||||||
document.getElementById("playpause").removeEventListener("click", Playercontrols.play_pause);
|
document.getElementById("playpause").removeEventListener("click", Playercontrols.play_pause);
|
||||||
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
|
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
|
||||||
|
channel_listeners(false);
|
||||||
if(Helper.mobilecheck() || user_auth_avoid) {
|
if(Helper.mobilecheck() || user_auth_avoid) {
|
||||||
video_id = "";
|
video_id = "";
|
||||||
song_title = "";
|
song_title = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user