'+lang[245]+'');
}
if (times == 1) {
a(".arrowchat_chatboxmessagecontent>div>img,.arrowchat_emoji_text>img").one("load", function() {
a("#arrowchat_popout_text_" + b).scrollTop(5E4);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
}
}
}
});
}
function update_pending_room_status(id, pending_msg_count_local, pending_class) {
if (a(".arrowchat_pending_msg_room_"+pending_msg_count_local).length > 0) {
a(".arrowchat_pending_msg_room_"+pending_msg_count_local+" .arrowchat_pending_icon").addClass(pending_class);
if (a.isNumeric(id) && id != 0)
a(".arrowchat_pending_msg_room_"+pending_msg_count_local).attr('id', "arrowchat_chatroom_message_"+id);
}
}
function sendChatroomMessage($element, to_id) {
var i = $element.val();
i = i.replace(/^\s+|\s+$/g, "");
$element.val("");
$element.focus();
if (c_send_room_msg == 1 && i != "") {
displayMessage("arrowchat_chatroom_message_flyout", lang[209], "error");
} else {
var pending_msg_count_local = 0;
i != "" && a.ajax({
url: c_ac_path + "includes/json/send/send_message_chatroom.php",
type: "post",
cache: false,
dataType: "json",
data: {
userid: u_id,
username: u_name,
chatroomid: to_id,
message: i
},
beforeSend: function () {
pending_msg_room_count++;
pending_msg_count_local = pending_msg_room_count;
addMessageToChatroom(0, u_name, i, 0, to_id, pending_msg_count_local);
},
error: function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[135], "error");
update_pending_room_status(0, pending_msg_count_local, "arrowchat_pending_error");
},
success: function (o) {
if (o) {
var is_json = true;
if (a.isNumeric(o)) is_json = false;
var no_error = true;
if (is_json) {
o && a.each(o, function (i, e) {
if (i == "error") {
a.each(e, function (l, f) {
no_error = false;
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
update_pending_room_status(o, pending_msg_count_local, "arrowchat_pending_error");
});
}
});
}
if (no_error) {
update_pending_room_status(o, pending_msg_count_local, "arrowchat_pending_delivered");
var data_array = [o, u_name, i, to_id];
lsClick(JSON.stringify(data_array), 'send_chatroom_message');
a(".arrowchat_popout_convo", $chatrooms_popups[to_id]).scrollTop(a(".arrowchat_popout_convo", $chatrooms_popups[to_id])[0].scrollHeight);
}
}
}
});
}
return false
}
function chatroomKeydown(key, $element, id) {
if (key.keyCode == 13 && key.shiftKey == 0) {
sendChatroomMessage($element, id);
return false;
}
}
function chatroomKeyup(b, $element, id) {
if (a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").hide();
}
}
function userchatKeydown(key, $element, typing) {
clearTimeout(pa);
pa = setTimeout(function () {
a.post(c_ac_path + "includes/json/send/send_typing.php", {
userid: u_id,
typing: typing,
untype: 1
}, function () {});
fa = -1
}, 5E3);
if (fa != typing) {
a.post(c_ac_path + "includes/json/send/send_typing.php", {
userid: u_id,
typing: typing
}, function () {});
fa = typing
}
if (key.keyCode == 13 && key.shiftKey == 0) {
sendUserMessage($element, typing);
return false;
}
}
function update_pending_status(id, pending_msg_count_local, pending_class) {
if (a(".arrowchat_pending_msg_"+pending_msg_count_local).length > 0) {
a(".arrowchat_pending_msg_"+pending_msg_count_local+" .arrowchat_pending_icon").addClass(pending_class);
if (a.isNumeric(id) && id != 0)
a(".arrowchat_pending_msg_"+pending_msg_count_local).attr('id', "arrowchat_message_"+id);
}
}
function sendUserMessage($element, to_id) {
var sent_msg = $element.val();
sent_msg = sent_msg.replace(/^\s+|\s+$/g, "");
$element.val("");
$element.focus();
if (c_send_priv_msg == 1 && sent_msg != "") {
displayMessage("arrowchat_chatroom_message_flyout", lang[209], "error");
} else {
var pending_msg_count_local = 0;
var time = Math.floor((new Date).getTime() / 1E3);
sent_msg != "" && a.ajax({
url: c_ac_path + "includes/json/send/send_message.php",
type: "post",
cache: false,
dataType: "json",
data: {
userid: u_id,
to: to_id,
message: sent_msg
},
beforeSend: function () {
pending_msg_count++;
pending_msg_count_local = pending_msg_count;
clearTimeout(pa);
fa = -1;
receiveMessage(0, to_id, sent_msg, time, 1, 0, 1, pending_msg_count_local);
},
error: function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[135], "error");
update_pending_status(0, pending_msg_count_local, "arrowchat_pending_error");
},
success: function (e) {
if (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
update_pending_status(e, pending_msg_count_local, "arrowchat_pending_error");
});
}
});
} else {
last_id[to_id] = e;
update_pending_status(e, pending_msg_count_local, "arrowchat_pending_delivered");
var data_array = [e, to_id, sent_msg, time, 1, 1];
lsClick(JSON.stringify(data_array), 'private_message');
}
}
K = 1;
}
});
}
}
function userchatKeyup(key, $element, d) {
if (a(".arrowchat_smiley_popout", $user_popups[d]).is(":visible")) {
a(".arrowchat_smiley_popout", $user_popups[d]).children(".arrowchat_more_popout").hide();
}
a(".arrowchat_popout_convo", $user_popups[d]).scrollTop(a(".arrowchat_popout_convo", $user_popups[d])[0].scrollHeight)
}
function toggleUserChatTab(b, c, d, e, l, f) {
if (typeof($users[b]) != "undefined") {
if (!$users[b].hasClass("arrowchat_tabclick") && f != 1) {
$users[b].click();
}
} else {
var name = renderHTMLString(uc_name[b]);
var noAvatarColor = getRandomColor(name);
$users[b] = a("
").attr("data-id", b).addClass("arrowchat_popout_tab").html('
').appendTo(a("#arrowchat_popout_container"));
var status = uc_status[b];
if (status == "available")
status = lang[1];
if (status == "away")
status = lang[240];
if (status == "offline")
status = lang[241];
if (status == "busy")
status = lang[216];
$user_popups[b] = a("
").attr("data-id", b).addClass("arrowchat_popout_convo_wrapper").html('
').appendTo(a("#arrowchat_popout_chat"));
a('
').prependTo($user_popups[b]);
a(".arrowchat_closed_image", $users[b]).css('background-color', noAvatarColor["color"]);
a(".arrowchat_tab_letter", $users[b]).html(noAvatarColor["character"]);
a(".arrowchat_avatarbox", $user_popups[b]).css('background-color', noAvatarColor["color"]);
a(".arrowchat_info_avatar", $user_popups[b]).css('background-color', noAvatarColor["color"]);
a(".arrowchat_avatartab", $users[b]).css('background-color', noAvatarColor["color"]);
a(".arrowchat_tab_letter", $user_popups[b]).html(noAvatarColor["character"]);
if (c_enable_moderation != 1) a(".arrowchat_option_report").hide();
a("#arrowchat_option_ban_" + b).click(function() {
a(".arrowchat_closebox_bottom", $users[b]).click();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
block_chat: b
}, function () {
if (typeof(blockList[b]) == "undefined") {
blockList[b] = b;
}
loadBuddyList();
})
});
a(".arrowchat_info_option_wrapper").mouseenter(function() {
a(this).addClass("arrowchat_info_option_wrapper_hover");
});
a(".arrowchat_info_option_wrapper").mouseleave(function() {
a(this).removeClass("arrowchat_info_option_wrapper_hover");
});
a("#arrowchat_option_clear_" + b).click(function() {
a("#arrowchat_popout_text_" + b).html("");
a.post(c_ac_path + "includes/json/send/send_settings.php", {
clear_chat: b
}, function () {})
});
a("#arrowchat_option_report_" + b).click(function() {
a("#arrowchat_option_report_" + b).hide();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
report_from: u_id,
report_about: b
}, function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[168], "notice");
});
});
a("#arrowchat_info_" + b).mouseenter(function () {
a(this).addClass("arrowchat_popout_info_hover");
showTooltip(a(this), lang[23], false, a(this).width() + 18, 6, 1, false);
});
a("#arrowchat_info_" + b).mouseleave(function () {
a(this).removeClass("arrowchat_popout_info_hover");
hideTooltip();
});
a("#arrowchat_info_" + b).click(function() {
hideTooltip();
if (a(".arrowchat_info_panel", $user_popups[b]).is(":visible")) {
a(".arrowchat_info_panel", $user_popups[b]).hide();
$user_popups[b].removeClass("arrowchat_info_panel_visible");
a(this).removeClass("arrowchat_popout_info_clicked");
a(".arrowchat_popout_convo", $user_popups[b]).css("margin-right", "0px");
a(".arrowchat_popout_input_container", $user_popups[b]).css("margin-right", "0px");
} else {
a(".arrowchat_info_panel", $user_popups[b]).show();
$user_popups[b].addClass("arrowchat_info_panel_visible");
a(this).addClass("arrowchat_popout_info_clicked");
a(".arrowchat_popout_convo", $user_popups[b]).css("margin-right", "201px");
a(".arrowchat_popout_input_container", $user_popups[b]).css("margin-right", "201px");
}
});
a(".arrowchat_closebox_bottom", $users[b]).mouseenter(function () {
a(this).addClass("arrowchat_closebox_bottomhover")
});
a(".arrowchat_closebox_bottom", $users[b]).mouseleave(function () {
a(this).removeClass("arrowchat_closebox_bottomhover")
});
$users[b].mouseenter(function () {
a(this).addClass("arrowchat_tabmouseover_popout");
});
$users[b].mouseleave(function () {
a(this).removeClass("arrowchat_tabmouseover_popout");
});
if (c_video_chat == 1) {
a("#arrowchat_video_chat_" + b).mouseenter(function () {
if (uc_status[b] == 'offline' || (uc_status[b] == 'busy' && c_video_select != 2 && c_video_select != 3)) {
showTooltip(a(this), lang[146], false, a(this).width() + 18, 6, 1, false);
} else {
showTooltip(a(this), lang[88], false, a(this).width() + 18, 6, 1, false);
a(this).addClass("arrowchat_popout_info_hover");
}
});
a("#arrowchat_video_chat_" + b).mouseleave(function () {
a(this).removeClass("arrowchat_popout_info_hover");
hideTooltip();
});
if (uc_status[b] == 'offline' || (uc_status[b] == 'busy' && c_video_select != 2 && c_video_select != 3))
a(".arrowchat_popout_video_chat", $user_popups[b]).addClass("arrowchat_video_unavailable");
else
a(".arrowchat_popout_video_chat", $user_popups[b]).removeClass("arrowchat_video_unavailable");
a("#arrowchat_video_chat_" + b).click(function () {
hideTooltip();
if (uc_status[b] != 'offline' && (uc_status[b] != 'busy' || c_video_select == 2 || c_video_select == 3)) {
var RN = Math.floor(Math.random() * 9999999999);
while (String(RN).length < 10) {
RN = '0' + RN;
}
if (c_video_select == 4 || c_video_select == 1)
RN = encodeURI(location.host).replace(/\./g, '') + RN;
if (c_video_select == 2) {
a.ajax({
type:"post",
url: c_ac_path + "public/video/video_session.php",
data: {
room: RN
},
async: false,
success: function(sess) {
a.post(c_ac_path + "includes/json/send/send_message.php", {
userid: u_id,
to: b,
message: "video{" + sess + "}"
}, function (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
} else {
jqac.arrowchat.videoWith(sess);
displayMessage("arrowchat_chatroom_message_flyout", lang[63], "notice");
}
a("#arrowchat_popout_text_" + b).scrollTop(a("#arrowchat_popout_text_" + b)[0].scrollHeight);
});
}
});
} else {
a.post(c_ac_path + "includes/json/send/send_message.php", {
userid: u_id,
to: b,
message: "video{" + RN + "}"
}, function (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
} else {
jqac.arrowchat.videoWith(RN);
displayMessage("arrowchat_chatroom_message_flyout", lang[63], "notice");
}
a("#arrowchat_popout_text_" + b).scrollTop(a("#arrowchat_popout_text_" + b)[0].scrollHeight);
});
}
} else {
displayMessage("arrowchat_chatroom_message_flyout", lang[146], "error");
}
});
} else {
a(".arrowchat_popout_video_chat").hide();
}
a(".arrowchat_closebox_bottom", $users[b]).click(function () {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
close_chat: b,
tab_alert: 1
}, function () {});
$user_popups[b].remove();
$users[b].remove();
delete $user_popups[b];
delete $users[b];
y[b] = null;
G[b] = null;
ca[b] = 0;
M();
});
a(".arrowchat_textarea", $user_popups[b]).keydown(function (h) {
return userchatKeydown(h, a(this), b);
});
a(".arrowchat_textarea", $user_popups[b]).keyup(function (h) {
return userchatKeyup(h, a(this), b);
});
$users[b].click(function () {
var tba = 0;
if (a(".arrowchat_popout_alert", $users[b]).length > 0) {
tba = 1;
a(".arrowchat_popout_alert", $users[b]).remove();
G[b] = 0;
y[b] = 0;
S()
}
if (a(this).hasClass("arrowchat_popout_focused")) {
a(this).removeClass("arrowchat_popout_focused");
$user_popups[b].removeClass("arrowchat_popout_convo_focused");
a.post(c_ac_path + "includes/json/send/send_settings.php", {
unfocus_chat: b,
tab_alert: 1
}, function () {})
} else {
a(".arrowchat_popout_tab").removeClass("arrowchat_popout_focused");
a(".arrowchat_popout_convo_wrapper").removeClass("arrowchat_popout_convo_focused");
if (ca[b] != 1) {
receiveHistory(b);
ca[b] = 1
}
if (typeof(init_open[b]) == "undefined")
init_open[b] = 1;
if (init_open[b] == 1) {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
focus_chat: b,
tab_alert: tba
}, function () {});
a(".arrowchat_textarea", $user_popups[b]).focus();
}
init_open[b] = 1;
a(this).addClass("arrowchat_popout_focused");
$user_popups[b].addClass("arrowchat_popout_convo_focused");
}
a(".arrowchat_popout_convo", $user_popups[b]).scrollTop(a(".arrowchat_popout_convo", $user_popups[b])[0].scrollHeight);
});
a(".arrowchat_emoji_selector", $user_popups[b]).click(function() {
if (!a(this).hasClass("arrowchat_emoji_focused")) {
a(".arrowchat_emoji_wrapper", $user_popups[b]).html('
');
a(".arrowchat_emoji_selector", $user_popups[b]).removeClass("arrowchat_emoji_focused");
a(this).addClass("arrowchat_emoji_focused");
var load_id = a(this).attr("data-id");
a.ajax({
url: c_ac_path + 'includes/emojis/' + load_id + '.php',
type: "GET",
cache: true,
success: function(html) {
a(".arrowchat_emoji_wrapper", $user_popups[b]).html(html);
a(".arrowchat_emoji", $user_popups[b]).click(function () {
if (a(this).hasClass("arrowchat_emoji_custom"))
var smiley_code = a(this).children('img').attr("data-id");
else
var smiley_code = a(this).html();
var existing_text = a(".arrowchat_textarea", $user_popups[b]).val();
a(".arrowchat_textarea", $user_popups[b]).focus().val('').val(existing_text + smiley_code);
});
}
});
}
});
a(".arrowchat_emoji_selector").mouseover(function(){
a(this).addClass("arrowchat_emoji_selector_hover");
});
a(".arrowchat_emoji_selector").mouseout(function(){
a(this).removeClass("arrowchat_emoji_selector_hover");
});
a(".arrowchat_emoji_smileys").mouseover(function(){showTooltip(a(this), lang[230], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_animals").mouseover(function(){showTooltip(a(this), lang[231], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_food").mouseover(function(){showTooltip(a(this), lang[232], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_activities").mouseover(function(){showTooltip(a(this), lang[233], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_travel").mouseover(function(){showTooltip(a(this), lang[234], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_objects").mouseover(function(){showTooltip(a(this), lang[235], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_symbols").mouseover(function(){showTooltip(a(this), lang[236], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_flags").mouseover(function(){showTooltip(a(this), lang[237], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_custom").mouseover(function(){showTooltip(a(this), lang[238], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_smiley_button", $user_popups[b]).mouseenter(function () {
if (a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").is(":visible")) {} else {
showTooltip(a(this), lang[307], 0, 10, 0);
}
a(this).addClass("arrowchat_smiley_button_hover")
});
a(".arrowchat_smiley_button", $user_popups[b]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_smiley_button_hover");
});
a(".arrowchat_smiley_button", $user_popups[b]).click(function () {
hideTooltip();
if (a(".arrowchat_giphy_popout", $user_popups[b]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_giphy_popout", $user_popups[b]).children(".arrowchat_more_popout").hide();
}
if (a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").hide();
} else {
if (!a(".arrowchat_emoji_selector", $user_popups[b]).hasClass("arrowchat_emoji_focused")) {
a(".arrowchat_emoji_wrapper", $user_popups[b]).html('
');
a(".arrowchat_emoji_selector", $user_popups[b]).removeClass("arrowchat_emoji_focused");
a(".arrowchat_emoji_smileys", $user_popups[b]).addClass("arrowchat_emoji_focused");
a.ajax({
url: c_ac_path + 'includes/emojis/emoji_smileys.php',
type: "GET",
cache: true,
success: function(html) {
a(".arrowchat_emoji_wrapper", $user_popups[b]).html(html);
a(".arrowchat_emoji", $user_popups[b]).click(function () {
if (a(this).hasClass("arrowchat_emoji_custom"))
var smiley_code = a(this).children('img').attr("data-id");
else
var smiley_code = a(this).html();
var existing_text = a(".arrowchat_textarea", $user_popups[b]).val();
a(".arrowchat_textarea", $user_popups[b]).focus().val('').val(existing_text + smiley_code);
});
}
});
}
a(".arrowchat_textarea", $user_popups[b]).focus();
a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").show();
}
}).children().not('i').click(function(e){
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest(".arrowchat_smiley_button").length)
return;
a(".arrowchat_smiley_popout .arrowchat_more_popout").hide();
});
a(".arrowchat_user_send_button", $user_popups[b]).mouseenter(function () {
showTooltip(a(this), lang[311], 0, 10, 0);
a(this).addClass("arrowchat_user_send_button_hover")
});
a(".arrowchat_user_send_button", $user_popups[b]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_user_send_button_hover");
});
a(".arrowchat_user_send_button", $user_popups[b]).click(function() {
hideTooltip();
sendUserMessage(a(".arrowchat_textarea", $user_popups[b]), b);
});
a(".arrowchat_giphy_button", $user_popups[b]).mouseenter(function () {
if (a(".arrowchat_giphy_button", $user_popups[b]).find(".arrowchat_more_popout").is(":visible")) {} else {
showTooltip(a(this), lang[309], 1, 10, 0);
a(this).addClass("arrowchat_giphy_button_hover");
}
});
a(".arrowchat_giphy_button", $user_popups[b]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_giphy_button_hover");
});
a(".arrowchat_giphy_button", $user_popups[b]).click(function () {
hideTooltip();
if (a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_smiley_popout", $user_popups[b]).children(".arrowchat_more_popout").hide();
}
if (a(".arrowchat_giphy_popout", $user_popups[b]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_giphy_popout", $user_popups[b]).children(".arrowchat_more_popout").hide();
} else {
a(".arrowchat_giphy_popout", $user_popups[b]).children(".arrowchat_more_popout").show();
a(".arrowchat_giphy_search", $user_popups[b]).val('');
a(".arrowchat_giphy_search", $user_popups[b]).focus();
loadGiphy('https://api.giphy.com/v1/gifs/trending?api_key=IOYyr4NK5ldaU&limit=20', 1, b);
}
}).children('.arrowchat_giphy_popout').click(function(e){
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest(".arrowchat_giphy_button").length)
return;
a(".arrowchat_giphy_button .arrowchat_more_popout").hide();
});
a(".arrowchat_giphy_search", $user_popups[b]).keyup(function () {
a(".arrowchat_giphy_image_wrapper", $user_popups[b]).html('
');
if (a(".arrowchat_giphy_search", $user_popups[b]).val() == '')
loadGiphy('https://api.giphy.com/v1/gifs/trending?api_key=IOYyr4NK5ldaU&limit=20', 1, b);
else
loadGiphy('https://api.giphy.com/v1/gifs/search?api_key=IOYyr4NK5ldaU&limit=20&q=' + a(".arrowchat_giphy_search", $user_popups[b]).val(), 1, b);
});
if (c_disable_smilies == 1) {a(".arrowchat_smiley_button").hide();a(".arrowchat_popout_input_container", $user_popups[b]).addClass("arrowchat_no_smiley")}
if (c_file_transfer != 1) {a("#arrowchat_upload_button_" + b).remove();a(".arrowchat_popout_input_container", $user_popups[b]).addClass("arrowchat_no_file_upload")}
if (c_giphy == 1) {a(".arrowchat_giphy_button", $user_popups[b]).hide();a(".arrowchat_popout_input_container", $user_popups[b]).addClass("arrowchat_no_giphy")}
if (c_file_transfer == 1) {uploadProcessing(b, 0);}
f != 1 && $users[b].click();
y[b] = 0;
G[b] = 0;
}
M();
}
function loadGiphy(url, selector, popup_id) {
var selector_id;
if (selector == 1)
selector_id = $user_popups[popup_id];
else
selector_id = $chatrooms_popups[popup_id];
a.ajax({
url: url,
type: "get",
cache: false,
dataType: "json",
success: function (results) {
results && a.each(results, function (i, e) {
if (i == "data") {
a(".arrowchat_giphy_image_wrapper", selector_id).html('');
var new_height = 0;
a.each(e, function (l, f) {
new_height = Math.round((270/(f.images.fixed_height_downsampled.width/f.images.fixed_height_downsampled.height)));
a(".arrowchat_giphy_image_wrapper", selector_id).append('
');
});
a(".arrowchat_giphy_image", selector_id).click(function () {
a(".arrowchat_giphy_popout", selector_id).children(".arrowchat_more_popout").hide();
var giphy_src = a(this).attr('src');
if (selector == 2) {
a.post(c_ac_path + "includes/json/send/send_message_chatroom.php", {
userid: u_id,
username: u_name,
chatroomid: popup_id,
message: "giphy{" + a(this).attr('height') + "}{" + a(this).attr('src') + "}"
}, function (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
} else {
if (a("#arrowchat_chatroom_message_" + e).length) {} else {
var tooltip = formatTimestamp(new Date(Math.floor((new Date).getTime() / 1E3) * 1E3), 1);
a(".arrowchat_popout_convo", $chatrooms_popups[popup_id]).append('
');
var data_array = [e, u_name, '
', popup_id];
lsClick(JSON.stringify(data_array), 'send_chatroom_message');
showChatroomTime();
}
}
a(".arrowchat_popout_convo", $chatrooms_popups[popup_id]).scrollTop(a(".arrowchat_popout_convo", $chatrooms_popups[popup_id])[0].scrollHeight);
});
} else {
a.post(c_ac_path + "includes/json/send/send_message.php", {
userid: u_id,
to: popup_id,
message: "giphy{" + a(this).attr('height') + "}{" + a(this).attr('src') + "}"
}, function (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
} else {
if (a("#arrowchat_message_" + e).length) {} else {
var tooltip = formatTimestamp(new Date(Math.floor((new Date).getTime() / 1E3) * 1E3), 1);
a(".arrowchat_popout_convo", $user_popups[popup_id]).append('
');
var time = Math.floor((new Date).getTime() / 1E3);
var data_array = [e, popup_id, '
', time, 1, 1];
lsClick(JSON.stringify(data_array), 'private_message');
showTimeAndTooltip();
}
}
a(".arrowchat_popout_convo", $user_popups[popup_id]).scrollTop(a(".arrowchat_popout_convo", $user_popups[popup_id])[0].scrollHeight);
});
}
});
}
});
}
});
}
function uploadProcessing(b, chatroom) {
var selector_id;
if (chatroom == 1)
selector_id = $chatrooms_popups[b];
else
selector_id = $user_popups[b];
var ts67 = Math.round(new Date().getTime());
var path = c_ac_path.replace("../", "/");
a("#arrowchat_upload_button_" + b).uploadifive({
'uploadScript': path + 'includes/classes/class_uploads.php',
'buttonText': ' ',
'buttonClass': 'arrowchat_upload_user_button',
'removeCompleted' : true,
'formData': {
'unixtime': ts67,
'user': u_id
},
'queueID' : 'arrowchat_user_upload_queue_' + b,
'height' : 'auto',
'width' : 'auto',
'multi': false,
'auto': true,
'fileType': '.avi,.bmp,.doc,.docx,.gif,.ico,.jpeg,.jpg,.mp3,.mp4,.pdf,.png,.ppt,.pptx,.rar,.tar,.txt,.wav,.wmv,.xls,.xlsx,.zip,.7z',
'fileSizeLimit' : c_max_upload_size + 'MB',
'onError': function (file, errorCode, errorMsg, errorString) {
a(".arrowchat_textarea", selector_id).focus();
},
'onCancel': function (file) {
a(".arrowchat_textarea", selector_id).focus();
},
'onUploadComplete': function (file) {
var uploadType = "file",
fileType = file.type.toLowerCase();
if (fileType == "image/jpeg" || fileType == "image/gif" || fileType == "image/jpg" || fileType == "image/png")
uploadType = "image";
var sendUrl = "includes/json/send/send_message.php";
var messageID = "arrowchat_message_";
if (chatroom == 1) {
sendUrl = "includes/json/send/send_message_chatroom.php";
messageID = "arrowchat_chatroom_message_";
}
a.post(c_ac_path + sendUrl, {
userid: u_id,
username: u_name,
chatroomid: b,
to: b,
message: uploadType + "{" + ts67 + "}{" + file.name + "}"
}, function (e) {
if (!a.isNumeric(e)) {
a.each(e, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
} else {
if (a("#" + messageID + e).length) {} else {
var message = "";
var tooltip = formatTimestamp(new Date(Math.floor((new Date).getTime() / 1E3) * 1E3), 1);
if (uploadType == "image") {
a(".arrowchat_popout_convo", selector_id).append('
');
message = '
';
a(".arrowchat_chatboxmessagecontent>div>img,.arrowchat_emoji_text>img").one("load", function() {
setTimeout(function () {
a(".arrowchat_popout_convo").scrollTop(5E4);
}, 500);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
} else {
a(".arrowchat_popout_convo", selector_id).append('
');
message = '
';
}
if (chatroom == 1) {
showChatroomTime();
var data_array = [e, u_name, message, b];
lsClick(JSON.stringify(data_array), 'send_chatroom_message');
} else {
showTimeAndTooltip();
var time = Math.floor((new Date).getTime() / 1E3);
var data_array = [e, b, message, time, 1, 1];
lsClick(JSON.stringify(data_array), 'private_message');
}
}
}
a(".arrowchat_popout_convo").scrollTop(5E4);
});
a(".arrowchat_textarea", selector_id).focus();
uploadProcessing(b, chatroom);
}
});
a(".arrowchat_upload_user_button").mouseenter(function () {
showTooltip(a(this), lang[310], 1, 20, -8);
a(".arrowchat_upload_button_container").addClass("arrowchat_upload_button_hover")
});
a(".arrowchat_upload_user_button").mouseleave(function () {
hideTooltip();
a(".arrowchat_upload_button_container").removeClass("arrowchat_upload_button_hover");
});
}
function loadChatroomList() {
a("#arrowchat_popout_left_lists").html("");
a(".arrowchat_nofriends").remove();
a('
').appendTo("#arrowchat_popout_friends");
a.ajax({
url: c_ac_path + "includes/json/receive/receive_chatroom_list.php",
cache: false,
type: "post",
dataType: "json",
success: function (b) {
buildChatroomList(b);
}
});
}
function buildChatroomList(b) {
a(".arrowchat_loading_icon").remove();
a(".arrowchat_nofriends").remove();
a("#arrowchat_popout_left_lists").html("");
var c = {},
code = "",
featured_list = "",
totalNumber = 0,
other_list = "";
b && a.each(b, function (i, e) {
if (i == "chatrooms") {
a.each(e, function (l, f) {
totalNumber++;
code = '
';
if (f.o == 1) {
other_list += code;
} else {
featured_list += code;
}
cr_name[f.id] = f.n;
cr_desc[f.id] = f.d;
cr_welcome[f.id] = f.welcome;
cr_img[f.id] = f.img;
cr_type[f.id] = f.t;
cr_count[f.id] = f.c;
cr_other[f.id] = f.o;
})
}
});
if (totalNumber == 0) {
a('
' + lang[318] + "
").appendTo("#arrowchat_popout_friends");
}
if (featured_list != "") {
a('
' + lang[227] + '
').appendTo(a("#arrowchat_popout_left_lists"));
a(featured_list).appendTo(a("#arrowchat_popout_left_lists"));
}
if (other_list != "") {
a('
' + lang[228] + '
').appendTo(a("#arrowchat_popout_left_lists"));
a(other_list).appendTo(a("#arrowchat_popout_left_lists"));
}
a(".arrowchat_chatroom_list").mouseover(function () {
a(this).addClass("arrowchat_chatroom_list_hover");
}).mouseout(function () {
a(this).removeClass("arrowchat_chatroom_list_hover");
});
a(".arrowchat_chatroom_list").click(function (l) {
chatroomListClicked(a(this), 19)
});
a(".arrowchat_chatroom_count").mouseenter(function() {
showTooltip(a(this), lang[35], 0, 5, 15);
});
a(".arrowchat_chatroom_count").mouseleave(function() {
hideTooltip();
});
}
function leaveChatroom(id) {
lsClick(".arrowchat_closebox_bottom", 'ac_click', "chatrooms['"+id+"']");
a.post(c_ac_path + "includes/json/send/send_settings.php", {
close_chat: 'r'+id
}, function () {});
$chatroom_tab[id].remove();
$chatrooms_popups[id].remove();
delete $chatroom_tab[id];
delete $chatrooms_popups[id];
M();
room_history_loaded[id] = 0;
if (Object.keys($chatroom_tab).length < 1) {
clearTimeout(Crref2);
Crref2 = -1;
}
if (c_push_engine != 1) {
cancelJSONP();
receiveCore();
}
changePushChannel(id, 0);
y[id] = null;
G[id] = null;
}
function chatroomListClicked(b, length) {
if (a(b).attr("id"))
c = a(b).attr("id").substr(length);
if (c == "") c = a(b).parent().attr("id").substr(length);
if (cr_type[c] == 2) {
a("#arrowchat_chatroom_password_id").val(c);
if (a("#arrowchat_chatroom_" + c).hasClass("arrowchat_chatroom_clicked")) {
a("#arrowchat_chatroom_password_flyout").hide("slide", { direction: "up"}, 250);
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
} else {
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
a("#arrowchat_chatroom_" + c).addClass("arrowchat_chatroom_clicked");
if (!a("#arrowchat_chatroom_password_flyout").is(":visible")) {
a("#arrowchat_chatroom_password_flyout").show("slide", { direction: "up"}, 250, function() {
a("#arrowchat_chatroom_password_input").focus();
});
a("#arrowchat_popout_wrapper").addClass("arrowchat_chatroom_opacity");
} else {
a("#arrowchat_chatroom_password_flyout").hide("slide", { direction: "up"}, 250);
a("#arrowchat_chatroom_password_flyout").show("slide", { direction: "up"}, 250, function() {
a("#arrowchat_chatroom_password_input").focus();
});
a("#arrowchat_popout_wrapper").addClass("arrowchat_chatroom_opacity");
}
}
} else {
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
a("#arrowchat_chatroom_password_flyout").hide("slide", { direction: "up"}, 250);
}
addChatroomTab(c, 1);
if (room_history_loaded[c] != 1) {
loadChatroom(c, cr_type[c]);
room_history_loaded[c] = 1;
}
}
}
function addChatroomTab(id, focused) {
if (typeof $chatroom_tab[id] == "undefined") {
if (typeof(cr_name[id]) == "undefined")
cr_name[id] = lang[301];
if (typeof(cr_desc[id]) == "undefined")
cr_desc[id] = lang[301];
if (typeof(cr_img[id]) == "undefined")
cr_img[id] = "chatroom_default.png";
if (typeof(cr_count[id]) == "undefined")
cr_count[id] = 0;
var img = c_ac_path + "themes/" + u_theme + '/images/icons/' + cr_img[id];
$chatroom_tab[id] = a("
").attr("data-room-id", id).addClass("arrowchat_popout_tab").html('
' + cr_count[id] + '
' + cr_name[id] + '
').appendTo(a("#arrowchat_popout_container"));
$chatrooms_popups[id] = a("
").attr("data-room-id", id).addClass("arrowchat_popout_convo_wrapper").addClass("arrowchat_popout_chatroom_convo").html('
').appendTo(a("#arrowchat_popout_chat"));
a('
'+lang[148]+'
'+lang[149]+'
'+lang[147]+'
').prependTo($chatrooms_popups[id]);
addHover($chatroom_tab[id], "arrowchat_tabmouseover_popout");
a(".arrowchat_closebox_bottom", $chatroom_tab[id]).unbind('click');
a(".arrowchat_closebox_bottom", $chatroom_tab[id]).click(function() {
leaveChatroom(id);
});
a("#arrowchat_display_list_" + id).mouseenter(function () {
a(this).addClass("arrowchat_popout_info_hover");
showTooltip(a(this), lang[312], false, a(this).width() + 18, 6, 1, false);
});
a("#arrowchat_display_list_" + id).mouseleave(function () {
a(this).removeClass("arrowchat_popout_info_hover");
hideTooltip();
});
a("#arrowchat_display_list_" + id).click(function() {
hideTooltip();
if (a(".arrowchat_info_panel", $chatrooms_popups[id]).is(":visible")) {
a(".arrowchat_info_panel", $chatrooms_popups[id]).hide();
$chatrooms_popups[id].removeClass("arrowchat_info_panel_visible");
a(this).removeClass("arrowchat_popout_display_list_clicked");
a(".arrowchat_popout_convo", $chatrooms_popups[id]).css("margin-right", "0px");
a(".arrowchat_popout_input_container", $chatrooms_popups[id]).css("margin-right", "0px");
} else {
a(".arrowchat_info_panel", $chatrooms_popups[id]).show();
$chatrooms_popups[id].addClass("arrowchat_info_panel_visible");
a(this).addClass("arrowchat_popout_display_list_clicked");
a(".arrowchat_popout_convo", $chatrooms_popups[id]).css("margin-right", "201px");
a(".arrowchat_popout_input_container", $chatrooms_popups[id]).css("margin-right", "201px");
}
a("#arrowchat_popout_text_room_" + id).scrollTop(5E4);
});
a("#arrowchat_room_options_" + id).mouseenter(function () {
a(this).addClass("arrowchat_popout_room_options_hover");
showTooltip(a(this), lang[23], false, a(this).width() + 18, 6, 1, false);
});
a("#arrowchat_room_options_" + id).mouseleave(function () {
a(this).removeClass("arrowchat_popout_room_options_hover");
hideTooltip();
});
a("#arrowchat_room_options_" + id).click(function () {
hideTooltip();
a(".arrowchat_more_popout_user", $chatrooms_popups[id]).toggle();
a(this).toggleClass("arrowchat_more_button_selected");
a(".arrowchat_inner_menu", $chatrooms_popups[id]).show();
a(".arrowchat_flood_menu", $chatrooms_popups[id]).hide();
}).parent().children('.arrowchat_more_user_wrapper').click(function () {
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest(a(".arrowchat_popout_room_options", $chatrooms_popups[id])).length)
return;
a(".arrowchat_more_popout_user", $chatrooms_popups[id]).hide();
a(".arrowchat_popout_room_options", $chatrooms_popups[id]).removeClass("arrowchat_more_button_selected");
});
if (u_chatroom_sound == 1) {
a(".arrowchat_room_sounds .arrowchat_switch :input", $chatrooms_popups[id]).prop("checked", true)
} else {
a(".arrowchat_room_sounds").addClass("arrowchat_menu_unchecked");
a(".arrowchat_room_sounds .arrowchat_switch :input", $chatrooms_popups[id]).prop("checked", false)
}
a(".arrowchat_room_sounds", $chatrooms_popups[id]).click(function () {
a(".arrowchat_room_sounds").toggleClass("arrowchat_menu_unchecked");
var _chatroomsound;
if (a(".arrowchat_room_sounds :input", $chatrooms_popups[id]).is(":checked")) {
a(".arrowchat_room_sounds :input").prop("checked", false);
_chatroomsound = -1;
u_chatroom_sound = 0;
} else {
a(".arrowchat_room_sounds :input").prop("checked", true);
_chatroomsound = 1;
u_chatroom_sound = 1;
}
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_sound: _chatroomsound
}, function () {
});
});
if (u_chatroom_block_chats == 1) {
a(".arrowchat_block_private_chats .arrowchat_switch :input", $chatrooms_popups[id]).prop("checked", true)
} else {
a(".arrowchat_block_private_chats").addClass("arrowchat_menu_unchecked");
a(".arrowchat_block_private_chats .arrowchat_switch :input", $chatrooms_popups[id]).prop("checked", false)
}
a(".arrowchat_block_private_chats", $chatrooms_popups[id]).click(function () {
a(".arrowchat_block_private_chats").toggleClass("arrowchat_menu_unchecked");
var _chatroomblock;
if (a(".arrowchat_block_private_chats :input", $chatrooms_popups[id]).is(":checked")) {
a(".arrowchat_block_private_chats :input").prop("checked", false);
_chatroomblock = -1;
u_chatroom_block_chats = 0;
} else {
a(".arrowchat_block_private_chats :input").prop("checked", true);
_chatroomblock = 1;
u_chatroom_block_chats = 1;
}
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_block_chats: _chatroomblock
}, function () {
});
});
a(".arrowchat_textarea", $chatrooms_popups[id]).keydown(function (h) {
return chatroomKeydown(h, a(".arrowchat_textarea", $chatrooms_popups[id]), id)
});
a(".arrowchat_textarea", $chatrooms_popups[id]).keyup(function (h) {
return chatroomKeyup(h, a(this), id);
});
$chatroom_tab[id].unbind('click');
$chatroom_tab[id].click(function () {
if (a(".arrowchat_popout_alert", $chatroom_tab[id]).length > 0) {
a(".arrowchat_popout_alert", $chatroom_tab[id]).remove();
}
if ($chatroom_tab[id].hasClass("arrowchat_popout_focused")) {
a(this).removeClass("arrowchat_popout_focused");
$chatrooms_popups[id].removeClass("arrowchat_popout_convo_focused");
j="";
a.post(c_ac_path + "includes/json/send/send_settings.php", {
unfocus_chat: 'r'+id
}, function () {})
} else {
a(".arrowchat_popout_tab").removeClass("arrowchat_popout_focused");
a(".arrowchat_popout_convo_wrapper").removeClass("arrowchat_popout_convo_focused");
if (room_history_loaded[id] != 1) {
loadChatroom(id, cr_type[id]);
room_history_loaded[id] = 1;
}
a(this).addClass("arrowchat_popout_focused");
$chatrooms_popups[id].addClass("arrowchat_popout_convo_focused");
if (typeof(init_open_room[id]) == "undefined")
init_open_room[id] = 1;
if (init_open_room[id] == 1) {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
focus_chat: 'r'+id
}, function () {});
a(".arrowchat_textarea", $chatrooms_popups[id]).focus();
}
init_open_room[id] = 1;
}
a("#arrowchat_popout_text_room_" + id).scrollTop(5E4);
});
a(".arrowchat_closebox_bottom", $chatroom_tab[id]).mouseenter(function () {
a(this).addClass("arrowchat_closebox_bottomhover")
});
a(".arrowchat_closebox_bottom", $chatroom_tab[id]).mouseleave(function () {
a(this).removeClass("arrowchat_closebox_bottomhover")
});
a(".arrowchat_emoji_selector", $chatrooms_popups[id]).click(function() {
if (!a(this).hasClass("arrowchat_emoji_focused")) {
a(".arrowchat_emoji_wrapper", $chatrooms_popups[id]).html('
');
a(".arrowchat_emoji_selector", $chatrooms_popups[id]).removeClass("arrowchat_emoji_focused");
a(this).addClass("arrowchat_emoji_focused");
var load_id = a(this).attr("data-id");
a.ajax({
url: c_ac_path + 'includes/emojis/' + load_id + '.php',
type: "GET",
cache: true,
success: function(html) {
a(".arrowchat_emoji_wrapper", $chatrooms_popups[id]).html(html);
a(".arrowchat_emoji", $chatrooms_popups[id]).click(function () {
if (a(this).hasClass("arrowchat_emoji_custom"))
var smiley_code = a(this).children('img').attr("data-id");
else
var smiley_code = a(this).html();
var existing_text = a(".arrowchat_textarea", $chatrooms_popups[id]).val();
a(".arrowchat_textarea", $chatrooms_popups[id]).focus().val('').val(existing_text + smiley_code);
});
}
});
}
});
a(".arrowchat_emoji_selector").mouseover(function(){
a(this).addClass("arrowchat_emoji_selector_hover");
});
a(".arrowchat_emoji_selector").mouseout(function(){
a(this).removeClass("arrowchat_emoji_selector_hover");
});
a(".arrowchat_emoji_smileys").mouseover(function(){showTooltip(a(this), lang[230], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_animals").mouseover(function(){showTooltip(a(this), lang[231], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_food").mouseover(function(){showTooltip(a(this), lang[232], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_activities").mouseover(function(){showTooltip(a(this), lang[233], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_travel").mouseover(function(){showTooltip(a(this), lang[234], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_objects").mouseover(function(){showTooltip(a(this), lang[235], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_symbols").mouseover(function(){showTooltip(a(this), lang[236], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_flags").mouseover(function(){showTooltip(a(this), lang[237], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_emoji_custom").mouseover(function(){showTooltip(a(this), lang[238], false, 0, 20);}).mouseout(function(){hideTooltip();});
a(".arrowchat_smiley_button", $chatrooms_popups[id]).mouseenter(function () {
if (a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {} else {
showTooltip(a(this), lang[307], 0, 10, 0);
}
a(this).addClass("arrowchat_smiley_button_hover")
});
a(".arrowchat_smiley_button", $chatrooms_popups[id]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_smiley_button_hover");
});
a(".arrowchat_smiley_button", $chatrooms_popups[id]).click(function () {
hideTooltip();
if (a(".arrowchat_giphy_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_giphy_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").hide();
}
if (a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").hide();
} else {
if (!a(".arrowchat_emoji_selector", $chatrooms_popups[id]).hasClass("arrowchat_emoji_focused")) {
a(".arrowchat_emoji_wrapper", $chatrooms_popups[id]).html('
');
a(".arrowchat_emoji_selector", $chatrooms_popups[id]).removeClass("arrowchat_emoji_focused");
a(".arrowchat_emoji_smileys", $chatrooms_popups[id]).addClass("arrowchat_emoji_focused");
a.ajax({
url: c_ac_path + 'includes/emojis/emoji_smileys.php',
type: "GET",
cache: true,
success: function(html) {
a(".arrowchat_emoji_wrapper", $chatrooms_popups[id]).html(html);
a(".arrowchat_emoji", $chatrooms_popups[id]).click(function () {
if (a(this).hasClass("arrowchat_emoji_custom"))
var smiley_code = a(this).children('img').attr("data-id");
else
var smiley_code = a(this).html();
var existing_text = a(".arrowchat_textarea", $chatrooms_popups[id]).val();
a(".arrowchat_textarea", $chatrooms_popups[id]).focus().val('').val(existing_text + smiley_code);
});
}
});
}
a(".arrowchat_textarea", $chatrooms_popups[id]).focus();
a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").show();
}
}).children().not('i').click(function(e){
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest(".arrowchat_smiley_button").length)
return;
a(".arrowchat_smiley_popout .arrowchat_more_popout").hide();
});
a(".arrowchat_user_send_button", $chatrooms_popups[id]).mouseenter(function () {
showTooltip(a(this), lang[311], 0, 10, 0);
a(this).addClass("arrowchat_user_send_button_hover")
});
a(".arrowchat_user_send_button", $chatrooms_popups[id]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_user_send_button_hover");
});
a(".arrowchat_user_send_button", $chatrooms_popups[id]).click(function () {
hideTooltip();
sendChatroomMessage(a(".arrowchat_textarea", $chatrooms_popups[id]), id);
});
a(".arrowchat_giphy_button", $chatrooms_popups[id]).mouseenter(function () {
if (a(".arrowchat_giphy_button", $chatrooms_popups[id]).find(".arrowchat_more_popout").is(":visible")) {} else {
showTooltip(a(this), lang[309], 1, 10, 0);
a(this).addClass("arrowchat_giphy_button_hover");
}
});
a(".arrowchat_giphy_button", $chatrooms_popups[id]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_giphy_button_hover");
});
a(".arrowchat_giphy_button", $chatrooms_popups[id]).click(function () {
if (a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_smiley_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").hide();
}
if (a(".arrowchat_giphy_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").is(":visible")) {
a(".arrowchat_giphy_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").hide();
} else {
a(".arrowchat_giphy_popout", $chatrooms_popups[id]).children(".arrowchat_more_popout").show();
a(".arrowchat_giphy_search", $chatrooms_popups[id]).val('');
a(".arrowchat_giphy_search", $chatrooms_popups[id]).focus();
loadGiphy('https://api.giphy.com/v1/gifs/trending?api_key=IOYyr4NK5ldaU&limit=20', 2, id);
}
}).children('.arrowchat_giphy_popout').click(function(e){
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest(".arrowchat_giphy_button").length)
return;
a(".arrowchat_giphy_button .arrowchat_more_popout").hide();
});
a(".arrowchat_giphy_search", $chatrooms_popups[id]).keyup(function () {
a(".arrowchat_giphy_image_wrapper", $chatrooms_popups[id]).html('
');
if (a(".arrowchat_giphy_search", $chatrooms_popups[id]).val() == '')
loadGiphy('https://api.giphy.com/v1/gifs/trending?api_key=IOYyr4NK5ldaU&limit=20', 2, id);
else
loadGiphy('https://api.giphy.com/v1/gifs/search?api_key=IOYyr4NK5ldaU&limit=20&q=' + a(".arrowchat_giphy_search", $chatrooms_popups[id]).val(), 2, id);
});
if (c_disable_smilies == 1) {a(".arrowchat_smiley_button").hide();a(".arrowchat_popout_input_container", $chatrooms_popups[id]).addClass("arrowchat_no_smiley")}
if (c_file_transfer != 1 || c_chatroom_transfer != 1) {a("#arrowchat_upload_button_" + id).remove();a(".arrowchat_popout_input_container", $chatrooms_popups[id]).addClass("arrowchat_no_file_upload")}
if (c_giphy_chatroom == 1) {a(".arrowchat_giphy_button", $chatrooms_popups[id]).hide();a(".arrowchat_popout_input_container", $chatrooms_popups[id]).addClass("arrowchat_no_giphy")}
if (c_chatroom_transfer == 1) {uploadProcessing(id, 1);}
focused == 1 && $chatroom_tab[id].click();
} else {
if (!$chatroom_tab[id].hasClass("arrowchat_tabclick") && focused != 1) {
$chatroom_tab[id].click();
}
}
M();
}
function loadChatroom(b, c, pass) {
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
var global_mod = 0,
global_admin = 0,
admin_markup = "",
msg_history = "",
message = "";
chatroom_mod[b] = 0;
chatroom_admin[b] = 0;
a.ajax({
url: c_ac_path + "includes/json/receive/receive_chatroom_room.php",
data: {
chatroomid: b,
chatroom_pw: pass
},
type: "post",
cache: false,
dataType: "json",
success: function (o) {
if (o) {
var no_error = true;
o && a.each(o, function (i, e) {
if (i == "error") {
a.each(e, function (l, f) {
no_error = false;
if (typeof($chatroom_tab[b]) != "undefined") {
a(".arrowchat_closebox_bottom", $chatroom_tab[b]).click();
}
loadChatroomList();
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
});
}
});
if (no_error) {
if (Crref2 == -1) {
Crref2 = setTimeout(function () {
receiveChatroom()
}, 30000);
}
if (c_push_engine != 1) {
cancelJSONP();
changePushChannel(b, 1);
receiveCore();
} else {
changePushChannel(b, 1);
}
o && a.each(o, function (i, e) {
if (i == "user_title") {
a.each(e, function (l, f) {
if (f.admin == 1) {
global_admin = 1;
chatroom_admin[b] = 1;
}
if (f.mod == 1) {
global_mod = 1;
chatroom_mod[b] = 1;
}
});
}
if (i == "chat_name") {
a.each(e, function (l, f) {
if (typeof cr_name[b] == "undefined") {
cr_name[b] = f.n;
}
});
}
if (i == "chat_users") {
var longname,adminCount=0,modCount=0,userCount=0;
a(".arrowchat_chatroom_list_users", $chatrooms_popups[b]).html("");
a(".arrowchat_chatroom_list_mods", $chatrooms_popups[b]).html("");
a(".arrowchat_chatroom_list_admins", $chatrooms_popups[b]).html("");
a(".arrowchat_chatroom_user_popouts", $chatrooms_popups[b]).html("");
a.each(e, function (l, f) {
if ((global_admin == 1 || global_mod == 1) && (f.t == 1 || f.t == 4)) {
admin_markup = '';
}
if (global_admin == 1 && f.t == 2) {
admin_markup = '';
}
appendVal = a(".arrowchat_chatroom_list_users", $chatrooms_popups[b]);
if (f.t == 2) {
appendVal = a(".arrowchat_chatroom_list_mods", $chatrooms_popups[b]);
modCount++;
} else if (f.t == 3) {
appendVal = a(".arrowchat_chatroom_list_admins", $chatrooms_popups[b]);
adminCount++;
} else
userCount++;
longname = renderHTMLString(f.n);
f.n = renderHTMLString(f.n);
var icon = ' fas fa-circle';
if (f.status == 'away')
icon = ' fas fa-moon';
else if (f.status == 'busy')
icon = ' far fa-mobile-screen';
a("
").attr('data-user-pop-id', f.id).attr("class", "arrowchat_chatroom_user").mouseover(function () {
a(this).addClass("arrowchat_chatroom_list_hover");
}).mouseout(function () {
a(this).removeClass("arrowchat_chatroom_list_hover");
}).addClass("arrowchat_chatroom_room_list").addClass('arrowchat_chatroom_admin_' + f.t).html('
' + f.n + ' ').appendTo(appendVal);
var pm_opacity = "";
if ((f.b == 1 && global_admin != 1) || f.id == u_id) pm_opacity = " arrowchat_no_private_msg";
a("
").attr("data-user-id", f.id).addClass("arrowchat_more_wrapper_chatroom").html('
').appendTo(a('.arrowchat_chatroom_user_popouts', $chatrooms_popups[b]));
if (f.t == 2) {
a("#arrowchat_chatroom_title_" + f.id, $chatrooms_popups[b]).html('
' + longname + ' ' + lang[44]);
} else if (f.t == 3) {
a("#arrowchat_chatroom_title_" + f.id, $chatrooms_popups[b]).html('
' + longname + ' ' + lang[45]);
} else if (f.t == 4) {
a("#arrowchat_chatroom_title_" + f.id, $chatrooms_popups[b]).html('
' + longname + ' ' + lang[212])
}
addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
chatroomUserOptions(global_admin);
uc_cr_block[f.id] = f.b;
});
var sort_by_name = function(a, b) {
return a.querySelector('.arrowchat_chatroom_room_name').innerHTML.toLowerCase().localeCompare(b.querySelector('.arrowchat_chatroom_room_name').innerHTML.toLowerCase());
};
var list = a(".arrowchat_chatroom_list_users > div", $chatrooms_popups[b]).get();
list.sort(sort_by_name);
for (var i = 0; i < list.length; i++) {
list[i].parentNode.appendChild(list[i]);
}
if (userCount == 0)
a(".arrowchat_popout_room_users", $chatrooms_popups[b]).hide();
else
a(".arrowchat_popout_room_users", $chatrooms_popups[b]).show();
if (adminCount == 0)
a(".arrowchat_popout_room_admins", $chatrooms_popups[b]).hide();
else
a(".arrowchat_popout_room_admins", $chatrooms_popups[b]).show();
if (modCount == 0)
a(".arrowchat_popout_room_mods", $chatrooms_popups[b]).hide();
else
a(".arrowchat_popout_room_mods", $chatrooms_popups[b]).show();
a(".arrowchat_chatroom_admin_3").css("background-color", "#"+c_admin_bg);
a(".arrowchat_chatroom_admin_3").css("color", "#"+c_admin_txt);
}
if (i == "chat_history") {
msg_history = "";
a.each(e, function (l, f) {
var regex = new RegExp('(^|\\s)(@' + u_name + ')(\\s|$)', 'i');
f.m = f.m.replace(regex, '$1
$2 $3');
if (typeof(blockList[f.userid]) == "undefined") {
var title = "", important = "";
if (f.mod == 1) {
title = lang[137];
important = " arrowchat_chatroom_important";
}
if (f.admin == 1) {
title = lang[136];
important = " arrowchat_chatroom_important";
}
l = "";
var image_msg = "";
fromname = f.n;
var pending_icon = "";
if (f.n == u_name) {
l = " arrowchat_self";
pending_icon = "
";
}
if (f.m.substr(0, 4) == "
' + formatTimestamp(sent_time) + f.m + "
"
} else {
var noAvatarColor = getRandomColor(fromname);
msg_history += '
' + fromname + '
' + noAvatarColor["character"] + ' ' + f.m + '
' + pending_icon + '
';
}
}
});
}
if (i == "room_info") {
a.each(e, function (l, f) {
if (f.welcome_msg != "") {
message = stripslashes(f.welcome_msg);
cr_welcome[b] = message;
message = replaceURLWithHTMLLinks(message);
}
cr_desc[b] = f.desc;
room_limit_msg[b] = f.limit_msg;
room_limit_sec[b] = f.limit_sec;
});
}
});
a("#arrowchat_popout_text_room_" + b).html(msg_history);
showChatroomTime();
if (message != "") {
a("#arrowchat_popout_text_room_" + b).append('
');
}
a("#arrowchat_popout_text_room_" + b + " .arrowchat_pending_icon").hide();
a("#arrowchat_popout_text_room_" + b + " .arrowchat_chatroom_box_message .arrowchat_pending_icon:last").show();
modDeleteControls(b);
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
a("#arrowchat_popout_text_room_" + b).scrollTop(5E4);
//a(".arrowchat_textarea", $chatrooms_popups[b]).focus();
if (global_admin == 1 || global_mod == 1) {
addChatroomAdminControls(b);
} else {
a(".arrowchat_admin_controls", $chatrooms_popups[b]).hide();
}
a(".arrowchat_image_msg img,.arrowchat_emoji_text>img").one("load", function() {
a("#arrowchat_popout_text_room_" + b).scrollTop(5E4);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
}
}
}
})
}
function addChatroomAdminControls(id) {
a('.arrowchat_admin_controls', $chatrooms_popups[id]).show();
a(".arrowchat_edit_welcome_msg", $chatrooms_popups[id]).unbind('click');
a(".arrowchat_edit_welcome_msg", $chatrooms_popups[id]).click(function () {
var welcome_msg_input = prompt(lang[154], cr_welcome[id]);
if (welcome_msg_input || welcome_msg_input == "") {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_welcome_msg: welcome_msg_input,
chatroom_id: id
}, function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[155], "notice");
cr_welcome[id] = welcome_msg_input;
a('.arrowchat_popout_room_options', $chatrooms_popups[id]).click();
});
}
});
a(".arrowchat_edit_description", $chatrooms_popups[id]).unbind('click');
a(".arrowchat_edit_description", $chatrooms_popups[id]).click(function () {
var desc_input = prompt(lang[158], cr_desc[id]);
if (desc_input || desc_input == "") {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_description: desc_input,
chatroom_id: id
}, function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[155], "notice");
cr_desc[id] = desc_input;
desc_input = renderHTMLString(desc_input);
loadChatroomList();
a('.arrowchat_name_description', $chatrooms_popups[id]).html(desc_input);
a('.arrowchat_popout_room_options', $chatrooms_popups[id]).click();
});
}
});
a(".arrowchat_edit_flood", $chatrooms_popups[id]).unbind('click');
a(".arrowchat_edit_flood", $chatrooms_popups[id]).click(function () {
a(this).parents(".arrowchat_inner_menu").hide();
a(".arrowchat_flood_select_messages", $chatrooms_popups[id]).val(room_limit_msg[id]);
a(".arrowchat_flood_select_seconds", $chatrooms_popups[id]).val(room_limit_sec[id]);
a(".arrowchat_flood_menu", $chatrooms_popups[id]).show();
});
a(".arrowchat_flood_back", $chatrooms_popups[id]).unbind('click');
a(".arrowchat_flood_back", $chatrooms_popups[id]).click(function () {
a(this).parents('.arrowchat_more_popout').find(".arrowchat_inner_menu").show();
a(".arrowchat_flood_menu", $chatrooms_popups[id]).hide();
});
a(".arrowchat_flood_save", $chatrooms_popups[id]).unbind('click');
a(".arrowchat_flood_save", $chatrooms_popups[id]).click(function () {
a(".arrowchat_popout_room_options", $chatrooms_popups[id]).click();
var flood_message = a(".arrowchat_flood_select_messages", $chatrooms_popups[id]).val();
var flood_seconds = a(".arrowchat_flood_select_seconds", $chatrooms_popups[id]).val();
if (!isNaN(flood_message) && !isNaN(flood_seconds)) {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_id: id,
flood_message: flood_message,
flood_seconds: flood_seconds
}, function () {
displayMessage("arrowchat_chatroom_message_flyout", lang[155], "notice");
room_limit_msg[id] = flood_message;
room_limit_sec[id] = flood_seconds;
});
}
});
}
function receiveChatroom() {
if (c_chatrooms != 1) {
return false;
}
clearTimeout(Crref2);
var admin_markup = "";
var rooms_string = "";
for (var i in $chatroom_tab) {
rooms_string += i + ",";
}
rooms_string = rooms_string.slice(0, -1);
a.ajax({
url: c_ac_path + "includes/json/receive/receive_chatroom.php",
cache: false,
type: "post",
data: {
chatrooms: rooms_string
},
dataType: "json",
success: function (data) {
if (data.room_data) {
var no_error = true;
var open_flyout = 0;
var open_flyout_cr_id = 0;
if (a('.arrowchat_chatroom_create_flyout_display').length) {
open_flyout = a('.arrowchat_chatroom_create_flyout_display').parent().attr('data-user-id');
open_flyout_cr_id = a('.arrowchat_chatroom_create_flyout_display').parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
}
data.room_data && a.each(data.room_data, function (i, room) {
if (room.error != 0) {
no_error = false;
if (typeof($chatroom_tab[c]) != "undefined") {
a(".arrowchat_closebox_bottom", $chatroom_tab[c]).click();
}
loadChatroomList();
displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
}
chatroom_admin[room.id] = 0;
chatroom_mod[room.id] = 0;
if (no_error) {
if (room.user_title.admin == 1) {
chatroom_admin[room.id] = 1;
}
if (room.user_title.mod == 1) {
chatroom_mod[room.id] = 1;
}
var adminCount=0,modCount=0,userCount=0,totalCount=0;
a(".arrowchat_chatroom_list_users", $chatrooms_popups[room.id]).html("");
a(".arrowchat_chatroom_list_mods", $chatrooms_popups[room.id]).html("");
a(".arrowchat_chatroom_list_admins", $chatrooms_popups[room.id]).html("");
a(".arrowchat_chatroom_user_popouts", $chatrooms_popups[room.id]).html("");
a.each(room.chat_users, function (l, user) {
admin_markup = "";
totalCount++;
if ((chatroom_admin[room.id] == 1 || chatroom_mod[room.id] == 1) && (user.t == 1 || user.t == 4)) {
admin_markup = '';
}
if (chatroom_admin[room.id] == 1 && user.t == 2) {
admin_markup = '';
}
var appendVal = a(".arrowchat_chatroom_list_users", $chatrooms_popups[room.id]);
if (user.t == 2) {
appendVal = a(".arrowchat_chatroom_list_mods", $chatrooms_popups[room.id]);
modCount++;
} else if (user.t == 3) {
appendVal = a(".arrowchat_chatroom_list_admins", $chatrooms_popups[room.id]);
adminCount++;
} else
userCount++;
user.n = renderHTMLString(user.n);
var icon = ' fas fa-circle';
if (user.status == 'away')
icon = ' fas fa-moon';
else if (user.status == 'busy')
icon = ' far fa-mobile-screen';
a("
").attr('data-user-pop-id', user.id).attr("class", "arrowchat_chatroom_user").mouseover(function () {
a(this).addClass("arrowchat_chatroom_list_hover");
}).mouseout(function () {
a(this).removeClass("arrowchat_chatroom_list_hover");
}).addClass("arrowchat_chatroom_room_list").addClass('arrowchat_chatroom_admin_' + user.t).html('
' + user.n + ' ').appendTo(appendVal);
var pm_opacity = "";
if ((user.b == 1 && chatroom_admin[room.id] != 1) || user.id == u_id) pm_opacity = " arrowchat_no_private_msg";
a("
").attr("data-user-id", user.id).addClass("arrowchat_more_wrapper_chatroom").html('
').appendTo(a('.arrowchat_chatroom_user_popouts', $chatrooms_popups[room.id]));
addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
uc_avatar[user.id] = user.a;
uc_cr_block[user.id] = user.b;
});
chatroomUserOptions(chatroom_admin[room.id]);
var sort_by_name = function(a, b) {
return a.querySelector('.arrowchat_chatroom_room_name').innerHTML.toLowerCase().localeCompare(b.querySelector('.arrowchat_chatroom_room_name').innerHTML.toLowerCase());
};
var list = a(".arrowchat_chatroom_list_users > div").get();
list.sort(sort_by_name);
for (var i = 0; i < list.length; i++) {
list[i].parentNode.appendChild(list[i]);
}
if (userCount == 0)
a(".arrowchat_popout_room_users", $chatrooms_popups[room.id]).hide();
else
a(".arrowchat_popout_room_users", $chatrooms_popups[room.id]).show();
if (adminCount == 0)
a(".arrowchat_popout_room_admins", $chatrooms_popups[room.id]).hide();
else
a(".arrowchat_popout_room_admins", $chatrooms_popups[room.id]).show();
if (modCount == 0)
a(".arrowchat_popout_room_mods", $chatrooms_popups[room.id]).hide();
else
a(".arrowchat_popout_room_mods", $chatrooms_popups[room.id]).show();
modDeleteControls(room.id);
if (chatroom_admin[room.id] == 1 || chatroom_mod[room.id] == 1) {
addChatroomAdminControls(room.id);
} else {
a('.arrowchat_admin_controls', $chatrooms_popups[room.id]).hide();
}
a('.arrowchat_chatroom_count_window span', $chatrooms_popups[room.id]).html(totalCount);
a('.arrowchat_chatroom_count_window span', $chatroom_tab[room.id]).html(totalCount);
a('#arrowchat_chatroom_' + room.id).find('.arrowchat_chatroom_count').children('span').html(totalCount);
}
});
if (no_error) {
a(".arrowchat_chatroom_admin_3").css("background-color", "#"+c_admin_bg);
a(".arrowchat_chatroom_admin_3").css("color", "#"+c_admin_txt);
if (open_flyout != 0) {
a('div[data-user-pop-id="'+open_flyout+'"]', $chatrooms_popups[open_flyout_cr_id]).click();
}
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
if (a("#arrowchat_chatroom_show_names :input").is(":checked")) {
setAvatarVisibility(0);
}
}
}
}
});
clearTimeout(Crref2);
Crref2 = setTimeout(function () {
receiveChatroom()
}, 6E4);
}
function showChatroomTime() {
a(".arrowchat_chatroom_msg:not(.arrowchat_global_chatroom_message)").unbind('mouseenter');
a(".arrowchat_chatroom_msg:not(.arrowchat_global_chatroom_message)").mouseenter(function (e) {
if (a(this).parents('.arrowchat_chatroom_box_message').hasClass('arrowchat_image_msg'))
showTooltip(a(this), a(this).parent().attr("data-id"), false, a(this).parent().width() + 23, 6, 1, false);
else
showTooltip(a(this), a(this).parent().attr("data-id"), false, a(this).parent().width() - 5, -3, 1, false);
if (!a(this).parents('.arrowchat_chatroom_box_message').hasClass('arrowchat_self')) {
a(this).parents(".arrowchat_chatroom_msg_wrap").find(".arrowchat_message_controls").addClass("arrowchat_message_controls_display");
}
});
a(".arrowchat_chatroom_msg:not(.arrowchat_global_chatroom_message)").unbind('mouseleave');
a(".arrowchat_chatroom_msg:not(.arrowchat_global_chatroom_message)").mouseleave(function (e) {
if(!a(e.toElement).hasClass('arrowchat_message_controls')) {
hideTooltip();
a(".arrowchat_message_controls").removeClass("arrowchat_message_controls_display");
}
});
a(".arrowchat_message_controls").unbind('mouseleave');
a(".arrowchat_message_controls").mouseleave(function (e) {
if(!a(e.toElement).hasClass('arrowchat_chatroom_msg')) {
hideTooltip();
a(".arrowchat_message_controls").removeClass("arrowchat_message_controls_display");
}
});
a(".arrowchat_chatroom_reply").unbind("mouseenter").unbind("mouseleave").unbind("click");
a(".arrowchat_chatroom_reply").mouseenter(function () {
showTooltip(a(this), lang[313], 0, 10, 10);
a(this).addClass("arrowchat_chatroom_reply_hover");
});
a(".arrowchat_chatroom_reply").mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_chatroom_reply_hover");
});
a(".arrowchat_chatroom_reply").click(function () {
hideTooltip();
a(".arrowchat_message_controls").removeClass("arrowchat_message_controls_display");
var id = a(this).parents('.arrowchat_tabpopup').attr('data-room-id');
var mention_name = a(this).parents('.arrowchat_chatroom_box_message').find('.arrowchat_chatroom_message_avatar').attr('alt');
if (mention_name.charAt(mention_name.length-1) == ":")
mention_name = mention_name.substring(0, mention_name.length - 1);
var mention_full = '@' + mention_name + ' ';
var existing_text = a(".arrowchat_textarea", $chatrooms_popups[id]).val();
if (existing_text != "") {
if (existing_text.charAt(existing_text.length-1) != " ")
mention_full = ' ' + mention_full;
}
a(".arrowchat_textarea", $chatrooms_popups[id]).focus().val('').val(existing_text + mention_full);
});
a(".arrowchat_lightbox").unbind('click');
a(".arrowchat_lightbox").click(function (){
a.slimbox(a(this).attr('data-id'), '
'+lang[70]+' ', {resizeDuration:1, overlayFadeDuration:1, imageFadeDuration:1, captionAnimationDuration:1});
});
}
function chatroomUserOptions(is_admin) {
a(".arrowchat_chatroom_make_mod").unbind('click');
a(".arrowchat_chatroom_make_mod").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_mod: clicked_id,
chatroom_id: chatroom_id
}, function () {receiveChatroom();});
toggleChatroomUserInfo(a(this), clicked_id);
});
a(".arrowchat_chatroom_remove_mod").unbind('click');
a(".arrowchat_chatroom_remove_mod").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_remove_mod: clicked_id,
chatroom_id: chatroom_id
}, function () {receiveChatroom();});
toggleChatroomUserInfo(a(this), clicked_id);
});
a(".arrowchat_chatroom_block_user").unbind('click');
a(".arrowchat_chatroom_block_user").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
a.post(c_ac_path + "includes/json/send/send_settings.php", {
block_chat: clicked_id
}, function (json_data) {
if (json_data != "-1") {
if (typeof(blockList[clicked_id]) == "undefined") {
blockList[clicked_id] = clicked_id;
}
loadBuddyList();
displayMessage("arrowchat_chatroom_message_flyout", lang[103], "notice");
}
});
toggleChatroomUserInfo(a(this), clicked_id);
});
if (c_enable_moderation != 1) a(".arrowchat_chatroom_report_user").parent().hide();
a(".arrowchat_chatroom_report_user").unbind('click');
a(".arrowchat_chatroom_report_user").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
a.post(c_ac_path + "includes/json/send/send_settings.php", {
report_about: clicked_id,
report_from: u_id,
report_chatroom: chatroom_id
}, function (json_data) {
displayMessage("arrowchat_chatroom_message_flyout", lang[168], "notice");
});
toggleChatroomUserInfo(a(this), clicked_id);
});
a(".arrowchat_chatroom_ban_user").unbind('click');
a(".arrowchat_chatroom_ban_user").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
var ban_length = prompt(lang[57]);
if (ban_length != null && ban_length != "" && !(isNaN(ban_length))) {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_ban: clicked_id,
chatroom_id: chatroom_id,
chatroom_ban_length: ban_length
}, function () {receiveChatroom();});
}
toggleChatroomUserInfo(a(this), clicked_id);
});
a(".arrowchat_chatroom_silence_user").unbind('click');
a(".arrowchat_chatroom_silence_user").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
var silence_length = prompt(lang[162]);
if (silence_length != null && silence_length != "" && !(isNaN(silence_length))) {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chatroom_silence: clicked_id,
chatroom_id: chatroom_id,
chatroom_silence_length: silence_length
}, function () {});
}
toggleChatroomUserInfo(a(this), clicked_id);
});
a(".arrowchat_chatroom_private_message").unbind('click');
a(".arrowchat_chatroom_private_message").click(function () {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
if (u_id != clicked_id) {
if (uc_cr_block[clicked_id] != 1 || chatroom_admin[clicked_id] == 1 || chatroom_mod[clicked_id] == 1) {
toggleChatroomUserInfo(a(this), clicked_id);
jqac.arrowchat.chatWith(clicked_id);
}
}
});
a(".arrowchat_chatroom_title").unbind('click');
a(".arrowchat_chatroom_title").click(function() {
var clicked_id = a(this).parents('.arrowchat_more_wrapper_chatroom').attr('data-user-id');
if (typeof(uc_link[clicked_id]) != "undefined")
window.open(uc_link[clicked_id], "_blank");
});
a(".arrowchat_chatroom_user").unbind('click');
a(".arrowchat_chatroom_user").click(function () {
var chatroom_id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
var clicked_id = a(this).attr('data-user-pop-id');
a(".arrowchat_chatroom_user").removeClass("arrowchat_chatroom_clicked");
a('.arrowchat_more_popout').removeClass("arrowchat_chatroom_create_flyout_display");
a(this).toggleClass("arrowchat_chatroom_clicked");
a('div[data-user-id="'+clicked_id+'"]', $chatrooms_popups[chatroom_id]).children('.arrowchat_more_popout').toggleClass("arrowchat_chatroom_create_flyout_display");
});
a('body').click(function(evt){
if(a(evt.target).closest('.arrowchat_chatroom_user').length)
return;
if(a(evt.target).closest('.arrowchat_more_popout').length)
return;
a(".arrowchat_chatroom_user").removeClass("arrowchat_chatroom_clicked");
a('.arrowchat_more_popout').removeClass("arrowchat_chatroom_create_flyout_display");
});
}
function toggleChatroomUserInfo(element, clicked_id) {
var chatroom_id = element.parents('.arrowchat_tabpopup').attr('data-room-id');
a('div[data-user-pop-id="'+clicked_id+'"]', $chatrooms_popups[chatroom_id]).toggleClass("arrowchat_chatroom_clicked");
a('div[data-user-id="'+clicked_id+'"]', $chatrooms_popups[chatroom_id]).children('.arrowchat_more_popout').toggleClass("arrowchat_chatroom_create_flyout_display");
}
function addMessageToChatroom(b, c, d, multi_tab, id, pending_msg) {
if (typeof(multi_tab) == "undefined") multi_tab = 0;
var title = "",important = "", image_msg = "";
if (chatroom_mod[id] == 1) {
title = lang[137];
important = " arrowchat_chatroom_important";
}
if (chatroom_admin[id] == 1) {
title = lang[136];
important = " arrowchat_chatroom_important";
}
if (multi_tab != 1)
d = d.replace(//g, ">").replace(/\n/g, "
").replace(/\"/g, """);
d = youTubeEmbed(d);
d = replaceURLWithHTMLLinks(d);
d = smileyreplace(d);
if (d.substr(0, 4) == "
0) {
} else {
if (b != 0) {
var id_element = ' id="arrowchat_chatroom_message_' + b + '" ';
} else {
var id_element = "";
}
a("#arrowchat_popout_text_room_" + id).append('
' + c + '
' + d + '
' + pending_icon + '
');
a("#arrowchat_popout_text_room_" + id).scrollTop(5E4);
}
if (id != 0) {
showChatroomTime();
modDeleteControls(id);
}
}
function modDeleteControls(chatroomid) {
if (chatroom_mod[chatroomid] == 1 || chatroom_admin[chatroomid] == 1) {
a(".arrowchat_chatroom_delete", $chatrooms_popups[chatroomid]).show();
a(".arrowchat_chatroom_delete", $chatrooms_popups[chatroomid]).unbind("mouseenter").unbind("mouseleave").unbind("click");
a(".arrowchat_chatroom_delete", $chatrooms_popups[chatroomid]).mouseenter(function () {
showTooltip(a(this), lang[160], 0, 10, 10);
a(this).addClass("arrowchat_chatroom_delete_hover")
});
a(".arrowchat_chatroom_delete", $chatrooms_popups[chatroomid]).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_chatroom_delete_hover");
});
a(".arrowchat_chatroom_delete").click(function () {
hideTooltip();
var msg_id = a(this).attr('data-id');
var id = a(this).parents('.arrowchat_popout_chatroom_convo').attr('data-room-id');
a("#arrowchat_chatroom_message_" + msg_id + " .arrowchat_chatroom_delete").remove();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
delete_msg: msg_id,
chatroom_id: id,
delete_name: u_name
}, function () {
a("#arrowchat_chatroom_message_" + msg_id + " .arrowchat_chatroom_msg").html(lang[159] + u_name);
})
});
} else {
a(".arrowchat_chatroom_delete", $chatrooms_popups[chatroomid]).hide();
}
}
function changePushChannel(id, connect) {
if (connect == 1) {
if (c_push_engine == 1) {
push_room[id] = push.subscribe(c_push_encrypt + "_chatroom" + id);
push_room[id].on('data', function (data) {
pushReceive(data);
});
}
chatroom_list[id] = id;
} else {
if (c_push_engine == 1 && typeof(push_room[id]) != "undefined") {
push_room[id].unsubscribe();
}
if (typeof(chatroom_list[id]) != "undefined") {
delete chatroom_list[id];
}
}
}
function startCreateChatRoom() {
var i = a(".arrowchat_room_name_input").val();
var passinput = a(".arrowchat_room_password_input").val();
var descinput = "";
var welcomeinput = "";
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
a(".arrowchat_room_name_input").val("");
a(".arrowchat_room_password_input").val("");
i = i.replace(/^\s+|\s+$/g, "");
i != "" && a.post(c_ac_path + "includes/json/send/send_chatroom_create.php", {
userid: u_id,
name: i,
password: passinput,
description: descinput,
welcome: welcomeinput
}, function (e) {
if (e) {
a("#arrowchat_create_room_flyout").removeClass("arrowchat_create_room_flyout_display");
a(".arrowchat_room_create").hide();
if (e == "-1") {
displayMessage("arrowchat_chatroom_message_flyout", lang[39], "error");
} else if (e == "-2") {
displayMessage("arrowchat_chatroom_message_flyout", lang[40], "error");
} else {
loadChatroomList();
}
}
});
}
function loadChatroomInit() {
a("#arrowchat_password_cancel_button").click(function () {
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
a("#arrowchat_chatroom_password_flyout").hide("slide", { direction: "up"}, 250);
});
a("#arrowchat_password_button").click(function () {
c = a("#arrowchat_chatroom_password_id").val();
a("#arrowchat_chatroom_password_flyout").hide();
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
input_value = a("#arrowchat_chatroom_password_input").val();
a("#arrowchat_chatroom_password_input").val("");
input_value = input_value.replace(/^\s+|\s+$/g, "");
loadChatroom(c, cr_type[c], input_value)
});
a('body').click(function(evt){
if(a(evt.target).closest('#arrowchat_chatroom_password_flyout').length || a(evt.target).closest('.arrowchat_chatroom_list').length)
return;
a("#arrowchat_chatroom_password_flyout").hide();
a("#arrowchat_popout_wrapper").removeClass("arrowchat_chatroom_opacity");
a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
});
if (c_user_chatrooms == 1) {
a("#arrowchat_room_selection").mouseenter(function() {
a(".arrowchat_room_create").show();
});
a("#arrowchat_room_selection").mouseleave(function() {
if (!a("#arrowchat_create_room_flyout").hasClass("arrowchat_create_room_flyout_display"))
a(".arrowchat_room_create").hide();
});
a(".arrowchat_room_create").mouseenter(function() {
showTooltip(a(this), lang[93], 0, 10, 5);
a(this).addClass("arrowchat_room_create_hover");
}).children().mouseenter(function () {
return false;
});
a(".arrowchat_room_create").mouseleave(function() {
hideTooltip();
a(this).removeClass("arrowchat_room_create_hover");
}).children().mouseleave(function () {
return false;
});
a(".arrowchat_room_create").click(function () {
hideTooltip();
a("#arrowchat_create_room_flyout").toggleClass("arrowchat_create_room_flyout_display");
a(this).toggleClass("arrowchat_room_create_selected");
a('.arrowchat_create_input').focus();
}).children().click(function () {
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest('.arrowchat_room_create').length)
return;
a("#arrowchat_create_room_flyout").removeClass("arrowchat_create_room_flyout_display");
});
a(".arrowchat_create_password_wrapper").click(function() {
a(".arrowchat_password_input_wrapper").show();
a(this).hide();
a(".arrowchat_room_password_input").focus();
});
a(".arrowchat_room_name_input").keydown(function (h) {
if (h.keyCode == 13) {
startCreateChatRoom();
}
});
a("#arrowchat_create_room_button").click(function() {
startCreateChatRoom();
});
a(".arrowchat_room_password_input").placeholder();
a(".arrowchat_room_name_input").placeholder();
}
}
function displayMessage(id, message, type) {
clearTimeout(message_timeout);
if (a("#" + id).is(":visible")) {
a("#" + id).hide("slide", { direction: "up"}, 250, function() {
a("#" + id + " .arrowchat_message_text").html(message);
type == "error" && a(".arrowchat_message_box").addClass("arrowchat_message_box_error").removeClass("arrowchat_message_box_notice");
type == "notice" && a(".arrowchat_message_box").addClass("arrowchat_message_box_notice").removeClass("arrowchat_message_box_error");
a("#" + id).show("slide", { direction: "up"}, 250);
});
} else {
type == "error" && a(".arrowchat_message_box").addClass("arrowchat_message_box_error").removeClass("arrowchat_message_box_notice");
type == "notice" && a(".arrowchat_message_box").addClass("arrowchat_message_box_notice").removeClass("arrowchat_message_box_error");
a("#" + id + " .arrowchat_message_text").html(message);
a("#" + id).show("slide", { direction: "up"}, 250);
}
message_timeout = setTimeout(function () {
a("#" + id).hide("slide", { direction: "up"}, 250);
}, 5000);
}
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\0/g,'\0');
str=str.replace(/\\\\/g,'\\');
return str;
}
function receiveMessage(id, from, message, sent, self, old, multi_tab, pending_msg) {
if (pending_msg == 0 && self == 1 && multi_tab == 0) {
return false;
}
aa[from] != 1 && receiveUser(from, uc_name[from], uc_status[from], uc_avatar[from], uc_link[from], 1, 1);
if (pending_msg == 0 && self != 1) {
var data_array = [id, from, message, sent, self, old];
acsi != 1 && lsClick(JSON.stringify(data_array), 'private_message');
}
clearTimeout(dtit3);
document.title = dtit;
if (uc_name[from] == null || uc_name[from] == "") setTimeout(function () {
receiveMessage(id, from, message, sent, self, old, multi_tab, pending_msg)
}, 500);
else {
lsClick(from, 'untyping');
receiveNotTyping(from);
var container = a("#arrowchat_popout_text_" + from)[0].scrollHeight - a("#arrowchat_popout_text_" + from).scrollTop() - 10;
var container2 = a("#arrowchat_popout_text_" + from).outerHeight();
var o = uc_name[from];
if (uc_status[from] == "offline" && self != 1) {
const unixTime = Math.floor(Date.now() / 1000);
if ((unixTime - sent) < 10) {
loadBuddyList();
}
}
f = "";
if (self == 1) {
fromname = u_name;
fromid = u_id;
f = " arrowchat_self";
avatar = u_avatar;
var pending_icon = "
";
if (multi_tab == 1) {
pending_icon = "
";
}
} else {
DTitChange(uc_name[from]);
fromname = o;
fromid = from;
avatar = uc_avatar[from];
var pending_icon = "";
a(".arrowchat_pending_icon", $user_popups[from]).hide();
a(".arrowchat_pending_icon:last", $user_popups[from]).show();
}
var pending_class = "";
var pending_class_id = "";
if (pending_msg != 0) {
pending_class = " arrowchat_pending_msg";
pending_class_id = ' arrowchat_pending_msg_' + pending_msg;
}
tooltip = formatTimestamp(new Date(sent * 1E3), 1);
var image_msg = "";
var show_time_class = "";
message = stripslashes(message);
if (multi_tab == 1) {
message = youTubeEmbed(message);
}
message = replaceURLWithHTMLLinks(message);
if (multi_tab == 1) {
message = smileyreplace(message);
}
if (message.substr(0, 4) == "
180) {
show_time_class = " arrowchat_show_time";
}
if (a("#arrowchat_message_" + id).length > 0 && pending_msg == 0) {
a("#arrowchat_message_" + id + " .arrowchat_chatboxmessagecontent").html(message);
} else {
if (c_show_full_name != 1) {
if (fromname.indexOf(" ") != -1) fromname = fromname.slice(0, fromname.indexOf(" "));
}
if (id != 0) {
var id_element = ' id="arrowchat_message_' + id + '" ';
} else {
var id_element = "";
}
var noAvatarColor = getRandomColor(fromname);
a(".arrowchat_popout_convo", $user_popups[from]).append('
' + formatTimestamp(new Date(sent * 1E3)) + '
' + noAvatarColor["character"] + ' ' + pending_icon + '
');
if (a("#arrowchat_message_" + last_id[from]).length && self != 1) {
a("#arrowchat_message_" + last_id[from]).children('.arrowchat_chatboxmessagefrom').addClass('arrowchat_single_avatar_hide');
}
last_sent[from] = sent;
last_name[from] = fromid;
if (pending_msg == 0) {
last_id[from] = id;
}
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
}
if (container <= container2 || !$users[from].hasClass("arrowchat_popout_focused")) {
a("#arrowchat_popout_text_" + from).scrollTop(5E4);
a(".arrowchat_chatboxmessagecontent>div>img,.arrowchat_emoji_text>img").one("load", function() {
setTimeout(function () {
a("#arrowchat_popout_text_" + from).scrollTop(5E4);
}, 500);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
} else {
displayMessage("arrowchat_chatroom_message_flyout", lang[134], "notice");
}
notifyNewMessage(from, 1);
}
}
function receiveTyping(id) {
if (a("#arrowchat_popout_text_" + id).length) {
var container = a("#arrowchat_popout_text_" + id)[0].scrollHeight - a("#arrowchat_popout_text_" + id).scrollTop() - 10;
var container2 = a("#arrowchat_popout_text_" + id).outerHeight();
a(".arrowchat_closed_status", $users[id]).addClass("arrowchat_typing");
a(".arrowchat_is_typing", $users[id]).show();
if (a("#arrowchat_popout_text_" + id + " #arrowchat_typing_message_" + id).length) {
a("#arrowchat_popout_text_" + id + " #arrowchat_typing_message_" + id).remove();
}
var noAvatarColor = getRandomColor(uc_name[id]);
a("#arrowchat_popout_text_" + id).append('
' + noAvatarColor["character"] + ' ');
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
if (container <= container2 || !$users[id].hasClass("arrowchat_popout_focused")) {
a("#arrowchat_popout_text_" + id).scrollTop(5E4);
}
clearTimeout(typingTimeout);
typingTimeout = setTimeout(function () {
lsClick(id, 'untyping');
receiveNotTyping(id)
}, 30000);
}
}
function receiveNotTyping(id) {
if (a("#arrowchat_popout_text_" + id).length) {
clearTimeout(typingTimeout);
if (a("#arrowchat_typing_message_" + id).length) {
a("#arrowchat_typing_message_" + id).remove();
}
a(".arrowchat_closed_status", $users[id]).removeClass("arrowchat_typing");
a(".arrowchat_is_typing", $users[id]).hide();
}
}
function receiveWarning(h) {
if (h.read == 0 && h.data != "") {
a("#arrowchat_warnings").remove();
a("#arrowchat_warning_background").remove();
$body.append('
');
a("#arrowchat_warnings .arrowchat_warnings_close").click(function () {
a("#arrowchat_warnings").remove();
a("#arrowchat_warning_background").remove();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
warning_read: 1
}, function () {});
});
} else {
a("#arrowchat_warnings").remove();
a("#arrowchat_warning_background").remove();
}
}
function chatroomAlerts(count, chatroomid) {
if (typeof($chatroom_tab[chatroomid]) != "undefined") {
if ($chatroom_tab[chatroomid].hasClass("arrowchat_popout_focused")) {
return false;
}
if (a(".arrowchat_popout_alert", $chatroom_tab[chatroomid]).length > 0) {
count = parseInt(a(".arrowchat_popout_alert", $chatroom_tab[chatroomid]).html()) + parseInt(count);
}
if (count == 0) {
$chatroom_tab[chatroomid].removeClass("arrowchat_tab_new_message");
a(".arrowchat_popout_alert", $chatroom_tab[chatroomid]).remove()
} else {
if (a(".arrowchat_popout_alert", $chatroom_tab[chatroomid]).length > 0) {
a(".arrowchat_popout_alert", $chatroom_tab[chatroomid]).html(count);
} else a("
").addClass("arrowchat_popout_alert").html(count).prependTo(a(".arrowchat_popout_wrap", $chatroom_tab[chatroomid]));
$chatroom_tab[chatroomid].removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message")
}
M();
}
}
function addChatroomMessage(id, name, message, userid, sent, global, mod, admin, chatroomid) {
if (userid == u_id) {
uc_avatar[u_id] = u_avatar;
}
message = stripslashes(message);
message = replaceURLWithHTMLLinks(message);
var sent_time = new Date(sent * 1E3);
if (typeof(uc_avatar[userid]) == "undefined") {
a.ajax({
url: c_ac_path + "includes/json/receive/receive_user.php",
data: {
userid: userid
},
type: "post",
cache: false,
dataType: "json",
success: function (data) {
if (data) {
uc_avatar[userid] = data.a;
chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin, userid, chatroomid);
}
}
});
} else {
chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin, userid, chatroomid);
}
count++;
}
function chatroomDiv(id, image, name, time, message, global, mod, admin, userid, chatroomid) {
if (userid == u_id && global == 0) {
return false;
}
var container = a("#arrowchat_popout_text_room_" + chatroomid)[0].scrollHeight - a("#arrowchat_popout_text_room_" + chatroomid).scrollTop() - 10;
var container2 = a("#arrowchat_popout_text_room_" + chatroomid).outerHeight();
var title = "", l = "", important = "", image_msg = "";
if (userid == u_id) {
l = "arrowchat_self";
}
if (mod == 1) {
title = lang[137];
important = "arrowchat_chatroom_important";
}
if (admin == 1) {
title = lang[136];
important = "arrowchat_chatroom_important";
}
if (message.substr(0, 4) == "
$2$3');
if (a("#arrowchat_chatroom_message_" + id).length > 0) {
a("#arrowchat_chatroom_message_" + id + " .arrowchat_chatboxmessagecontent").html(message);
if (userid == u_id) {
a("#arrowchat_chatroom_message_" + id).addClass(l);
}
} else {
var tooltip = formatTimestamp(time, 1);
if (global == 1) {
a("
").attr("id", "arrowchat_chatroom_message_" + id).addClass("arrowchat_chatroom_box_message").addClass("arrowchat_global_chatroom_message").html('
' + formatTimestamp(time) + message + "
").appendTo("#arrowchat_popout_text_room_" + chatroomid);
receiveChatroom();
} else {
var noAvatarColor = getRandomColor(name);
a("
").attr("id", "arrowchat_chatroom_message_" + id).addClass(important).addClass(image_msg).addClass(l).addClass("arrowchat_chatboxmessage").addClass("arrowchat_popout_room_msg").html('
' + name + '
' + noAvatarColor["character"] + ' ' + message + '
').appendTo("#arrowchat_popout_text_room_" + chatroomid);
}
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
if (container <= container2) {
a("#arrowchat_popout_text_room_" + chatroomid).scrollTop(5E4);
a(".arrowchat_image_msg img,.arrowchat_emoji_text>img").one("load", function() {
setTimeout(function () {
a("#arrowchat_popout_text_room_" + chatroomid).scrollTop(5E4);
}, 500);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
} else {
displayMessage("arrowchat_chatroom_message_flyout", lang[134], "notice");
}
showChatroomTime();
modDeleteControls(chatroomid);
}
}
function receiveAnnouncement(h) {
if (h.read == 0 && h.data != "") {
a("#arrowchat_announcement").remove();
$body.append('
');
a("#arrowchat_announcement .arrowchat_announce_close").click(function () {
a("#arrowchat_announcement").remove();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
announce: 1
}, function () {});
});
} else {
a("#arrowchat_announcement").remove();
}
}
function pushSubscribe() {
if (c_push_engine == 1) {
push_uid = push.subscribe(c_push_encrypt + "_u"+u_id);
push_arrowchat = push.subscribe(c_push_encrypt + "_arrowchat");
push_arrowchat.on('data', function (data) {
pushReceive(data);
});
push_uid.on('data', function (data) {
pushReceive(data);
});
}
}
function pushReceive(data) {
if ("announcement" in data) {
receiveAnnouncement(data.announcement);
}
if ("typing" in data) {
lsClick(data.typing.id, 'typing');
receiveTyping(data.typing.id);
}
if ("warning" in data) {
receiveWarning(data.warning);
}
if ("nottyping" in data) {
lsClick(data.nottyping.id, 'untyping');
receiveNotTyping(data.nottyping.id);
}
if ("messages" in data) {
receiveMessage(data.messages.id, data.messages.from, data.messages.message, data.messages.sent, data.messages.self, data.messages.old, 0, 0);
data.messages.self != 1 && u_sounds == 1 && !a(".arrowchat_textarea").is(":focus") && playNewMessageSound();
showTimeAndTooltip();
K = 1;
D = E;
}
if ("chatroommessage" in data) {
if (typeof(blockList[data.chatroommessage.userid]) == "undefined")
{
addChatroomMessage(data.chatroommessage.id, data.chatroommessage.name, data.chatroommessage.message, data.chatroommessage.userid, data.chatroommessage.sent, data.chatroommessage.global, data.chatroommessage.mod, data.chatroommessage.admin, data.chatroommessage.chatroomid);
if (data.chatroommessage.name != 'Delete' && data.chatroommessage.global != 1) {
chatroomAlerts(1, data.chatroommessage.chatroomid);
var data_array = [1, data.chatroommessage.chatroomid];
lsClick(JSON.stringify(data_array), 'chatroom_alerts');
if (data.chatroommessage.userid != u_id) {
u_chatroom_sound == 1 && !a(".arrowchat_textarea").is(":focus") && playNewMessageSound();
}
}
}
}
if ("chatroomban" in data) {
a(".arrowchat_closebox_bottom", $chatroom_tab[data.chatroomban.id]).click();
displayMessage("arrowchat_chatroom_message_flyout", data.chatroomban.error2, "error");
}
}
function renderHTMLString(string) {
var render = a("
").attr("id", "arrowchat_render").html(string).appendTo('body');
var new_render = a("#arrowchat_render").html();
render.remove();
return new_render;
}
function buildModButton() {
a("#arrowchat_setting_mod_cp").show();
a("#arrowchat_setting_mod_cp").click(function() {
window.open(c_ac_path + "mod/", "_blank", "");
var total_count = parseInt(a(".arrowchat_mobiletab_new_count").html());
var more_count = parseInt(a("#arrowchat_more_notification").html());
if ((total_count-more_count) <= 0) {
a("#arrowchat_mobiletab_new").hide();
}
a(".arrowchat_mobiletab_new_count").html(parseInt(total_count-more_count));
a("#arrowchat_more_notification_modcp").hide();
a("#arrowchat_more_notification").hide();
});
if (u_num_mod_reports > 0) {
var total_count = parseInt(a(".arrowchat_mobiletab_new_count").html()) + parseInt(u_num_mod_reports);
a(".arrowchat_mobiletab_new_count").html(total_count);
a("#arrowchat_mobiletab_new").show();
a("#arrowchat_more_notification").show().html(u_num_mod_reports);
a("#arrowchat_more_notification_modcp").show().html(u_num_mod_reports);
}
}
function loadSettingsButton() {
if (u_sounds == 1) {
a("#arrowchat_setting_sound :input").prop("checked", true)
} else {
a("#arrowchat_setting_sound").addClass("arrowchat_menu_unchecked");
a("#arrowchat_setting_sound :input").prop("checked", false)
}
if (u_no_avatars == 1) {
a("#arrowchat_setting_names_only :input").prop("checked", true)
} else {
a("#arrowchat_setting_names_only").addClass("arrowchat_menu_unchecked");
a("#arrowchat_setting_names_only :input").prop("checked", false);
}
if (u_chatroom_block_chats == 1) {
a("#arrowchat_chatroom_block :input").prop("checked", true)
} else {
a("#arrowchat_chatroom_block").addClass("arrowchat_menu_unchecked");
a("#arrowchat_chatroom_block :input").prop("checked", false)
}
if (u_chatroom_show_names == 1) {
a("#arrowchat_chatroom_show_names :input").prop("checked", true)
} else {
a("#arrowchat_chatroom_show_names").addClass("arrowchat_menu_unchecked");
a("#arrowchat_chatroom_show_names :input").prop("checked", false)
}
var noAvatarColor = getRandomColor(u_name);
a(".arrowchat_popout_settings_button").css('background-color', noAvatarColor["color"]);
a(".arrowchat_tab_letter_psmall").html(noAvatarColor["character"]);
a("#arrowchat_popout_settings").click(function() {
a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
a("#arrowchat_options_flyout").children(".arrowchat_inner_menu").show();
a(".arrowchat_block_menu").hide();
a(".arrowchat_change_name_menu").hide();
}).children().not('.arrowchat_popout_settings_button').click(function () {
return false;
});
a(".arrowchat_popout_settings_button").mouseover(function() {
a(this).addClass("arrowchat_popout_settings_button_hover");
});
a(".arrowchat_popout_settings_button").mouseleave(function() {
a(this).removeClass("arrowchat_popout_settings_button_hover");
});
a('body').click(function(evt){
if(a(evt.target).closest('#arrowchat_popout_settings').length)
return;
if(a(evt.target).closest('#arrowchat_options_flyout').length)
return;
a("#arrowchat_options_flyout").removeClass("arrowchat_options_flyout_display");
});
a("#arrowchat_setting_sound").click(function () {
a(this).toggleClass("arrowchat_menu_unchecked");
if (a("#arrowchat_setting_sound :input").is(":checked")) {
a("#arrowchat_setting_sound :input").prop("checked", false);
_soundcheck = -1;
u_sounds = 0;
} else {
a("#arrowchat_setting_sound :input").prop("checked", true);
_soundcheck = 1;
u_sounds = 1;
}
a.post(c_ac_path + "includes/json/send/send_settings.php", {
sound: _soundcheck
}, function () {
});
});
a("#arrowchat_setting_names_only").click(function () {
a(this).toggleClass("arrowchat_menu_unchecked");
if (a("#arrowchat_setting_names_only :input").is(":checked")) {
a("#arrowchat_setting_names_only :input").prop("checked", false);
setAvatarVisibility(0);
_namecheck = -1
} else {
a("#arrowchat_setting_names_only :input").prop("checked", true);
setAvatarVisibility(1);
_namecheck = 1
}
a.post(c_ac_path + "includes/json/send/send_settings.php", {
name: _namecheck
}, function () {
});
});
if (u_is_guest == 1 && c_guest_name_change == 1 && u_guest_name == "") {
function guestNameInput() {
var new_name = a(".arrowchat_guest_name_input").val();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
chat_name: new_name
}, function (data) {
if (data != "1") {
if (data == lang[123]) {
displayMessage("arrowchat_chatroom_message_flyout", data, "error");
a(".arrowchat_enter_name_wrapper").fadeOut('fast');
} else {
displayMessage("arrowchat_chatroom_message_flyout", data, "error");
}
} else {
a(".arrowchat_enter_name_wrapper").fadeOut('fast');
u_name = new_name;
}
});
}
a(".arrowchat_enter_name_wrapper").show();
a(".arrowchat_guest_name_input").keydown(function (h) {
if (h.keyCode == 13) {
guestNameInput();
}
});
a("#arrowchat_guest_name_button").click(function() {
guestNameInput();
});
}
a("#arrowchat_setting_block_list").click(function () {
a(this).parent().parent(".arrowchat_inner_menu").hide();
a(".arrowchat_block_menu").show();
a.ajax({
url: c_ac_path + "includes/json/receive/receive_block_list.php",
type: "get",
cache: false,
dataType: "json",
success: function (b) {
if (b && b != null) {
a(".arrowchat_block_menu select").html("");
a("
").attr("value", "0").html(lang[118]).appendTo(a(".arrowchat_block_menu select"));
a.each(b, function (e, l) {
a.each(l, function (f, h) {
a("
").attr("value", h.id).html(h.username).appendTo(a(".arrowchat_block_menu select"));
});
});
}
}
});
});
a("#arrowchat_block_back").click(function () {
a("#arrowchat_options_flyout .arrowchat_inner_menu").show();
a(".arrowchat_block_menu").hide();
});
a("#arrowchat_unblock_button").click(function () {
a("#arrowchat_popout_settings").click();
var unblock_chat_user = a(".arrowchat_block_menu select").val();
if (unblock_chat_user != "0") {
a.post(c_ac_path + "includes/json/send/send_settings.php", {
unblock_chat: unblock_chat_user
}, function () {
if (typeof(blockList[unblock_chat_user]) != "undefined") {
blockList.splice(unblock_chat_user, 1);
}
loadBuddyList();
});
}
});
addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
if (a.cookie('arrowchat_hide_lists') == 1 || ac_autohide_panel == 1) {
a(".arrowchat_popout_hide_lists").show();
a("#arrowchat_popout_wrapper").addClass("arrowchat_lists_hidden");
}
a(".arrowchat_popout_hide_lists").mouseenter(function () {
a(this).addClass("arrowchat_popout_info_hover");
});
a(".arrowchat_popout_hide_lists").mouseleave(function () {
a(this).removeClass("arrowchat_popout_info_hover");
});
a("#arrowchat_hide_lists_button").click(function() {
a.cookie('arrowchat_hide_lists', 1, {expires: 365, path: '/'});
a("#arrowchat_popout_settings").click();
a(".arrowchat_popout_hide_lists").show();
a("#arrowchat_popout_wrapper").addClass("arrowchat_lists_hidden");
});
a(".arrowchat_popout_hide_lists").click(function () {
a.cookie('arrowchat_hide_lists', 0, {expires: 365, path: '/'});
a(".arrowchat_popout_hide_lists").hide();
a("#arrowchat_popout_wrapper").removeClass("arrowchat_lists_hidden");
});
}
function loadSelectionButtons() {
a("#arrowchat_room_selection").click(function() {
if (a(this).hasClass("arrowchat_selection_tab_selected")){}else{
a("#arrowchat_user_selection").removeClass("arrowchat_selection_tab_selected");
a(this).addClass("arrowchat_selection_tab_selected");
loadChatroomList();
}
});
a("#arrowchat_user_selection").click(function() {
if (a(this).hasClass("arrowchat_selection_tab_selected")){}else{
a(".arrowchat_search_friends_input").val('');
a("#arrowchat_room_selection").removeClass("arrowchat_selection_tab_selected");
a(this).addClass("arrowchat_selection_tab_selected");
a("#arrowchat_popout_left_lists").html("");
a('
').appendTo("#arrowchat_popout_friends");
loadBuddyList();
}
});
a(".arrowchat_search_friends_input").keydown(function() {
a("#arrowchat_user_selection").click();
});
a(".arrowchat_search_friends_input").placeholder();
a(".arrowchat_search_friends_input").keyup(function () {
if (typeof(searchxhr) != "undefined") searchxhr.abort();
a(".arrowchat_search_not_found").remove();
a("#arrowchat_popout_left_lists").children('div').not('.arrowchat_userslist_offline').hide();
clearTimeout(Z);
var i = 0,
c = "",
d = "",
f = a(this).val();
if (f.length < 2) {
a(".arrowchat_search_not_found").remove();
a("#arrowchat_popout_left_lists").children('div').not('#arrowchat_userslist_offline').show();
if (buddylisttest == 2) loadBuddyList();
buddylisttest = 1;
} else {
a(".arrowchat_nofriends").remove();
a("
").attr("class", "arrowchat_search_not_found arrowchat_nofriends").html('
').prependTo("#arrowchat_popout_left_lists");
buddylisttest = 2;
if (a("#arrowchat_setting_names_only :input").is(":checked")) d = "arrowchat_hide_avatars";
searchxhr = a.ajax({
url: c_ac_path + "includes/json/receive/receive_search.php",
type: "post",
cache: false,
dataType: "json",
data: {
search_name: f
},
success: function (b) {
if (b && b != null) {
a.each(b, function (e, l) {
a.each(l, function (f, h) {
if (typeof(uc_avatar[h.id]) != "undefined")
var ava = uc_avatar[h.id];
else
var ava = h.avatar;
var icon = ' fas fa-circle';
if (h.status == 'away')
icon = ' fas fa-moon';
else if (h.status == 'busy')
icon = ' far fa-mobile-screen';
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) d = "arrowchat_hide_avatars";
c += '
' + h.name + ' ';
i++;
});
});
if (i == 0) {
a(".arrowchat_search_not_found").html(lang[26]);
} else {
a(".arrowchat_search_not_found").remove();
a('#arrowchat_userslist_available').show().html(c);
a(".arrowchat_userlist").click(function () {
var c = a(this).attr('id').substr(19);
receiveUser(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c]);
});
}
}
}
});
}
});
}
function addHover($elements, classes) {
$elements.each( function (i, element) {
a(element).hover(
function () {
a(this).addClass(classes);
}, function () {
a(this).removeClass(classes);
}
);
});
}
function setAvatarVisibility(b) {
if (b == 1) {
a(".arrowchat_popout_tab[data-id] .arrowchat_avatar_tab").addClass("arrowchat_hide_avatars");
a(".arrowchat_popout_convo_wrapper[data-id] .arrowchat_avatarbox img").addClass("arrowchat_hide_avatars");
a(".arrowchat_popout_convo_wrapper[data-id] .arrowchat_info_avatar img").addClass("arrowchat_hide_avatars");
a(".arrowchat_popout_settings_button img").addClass("arrowchat_hide_avatars");
a(".arrowchat_tab_letter").css('display', 'flex');
a(".arrowchat_userlist .arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_flyout_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_chatbox_avatar").addClass("arrowchat_hide_avatars");
a(".arrowchat_popout_settings_button").removeClass("arrowchat_white_background");
a(".arrowchat_chatboxmessagefrom").removeClass("arrowchat_white_background");
a(".arrowchat_avatarbox").removeClass("arrowchat_white_background");
a(".arrowchat_info_avatar").removeClass("arrowchat_white_background");
a(".arrowchat_avatartab").removeClass("arrowchat_white_background");
a(".arrowchat_chatbox_avatar_wrapper").removeClass("arrowchat_white_background");
a(".arrowchat_disable_avatars_name").show();
a(".arrowchat_chatboxmessage_wrapper").addClass("arrowchat_chatboxmessage_wrapper2");
a(".arrowchat_chatboxmessagecontent").addClass("arrowchat_chatboxmessagecontent2");
a(".arrowchat_userlist").addClass("arrowchat_userslist_no_avatars");
} else {
a(".arrowchat_popout_tab[data-id] .arrowchat_avatar_tab").removeClass("arrowchat_hide_avatars");
a(".arrowchat_popout_convo_wrapper[data-id] .arrowchat_avatarbox img").removeClass("arrowchat_hide_avatars");
a(".arrowchat_popout_convo_wrapper[data-id] .arrowchat_info_avatar img").removeClass("arrowchat_hide_avatars");
a(".arrowchat_popout_settings_button img").removeClass("arrowchat_hide_avatars");
a(".arrowchat_tab_letter").hide();
a(".arrowchat_userlist .arrowchat_userlist_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_flyout_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_chatroom_message_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_chatbox_avatar").removeClass("arrowchat_hide_avatars");
a(".arrowchat_popout_settings_button").addClass("arrowchat_white_background");
a(".arrowchat_chatboxmessagefrom").addClass("arrowchat_white_background");
a(".arrowchat_avatarbox").addClass("arrowchat_white_background");
a(".arrowchat_info_avatar").addClass("arrowchat_white_background");
a(".arrowchat_avatartab").addClass("arrowchat_white_background");
a(".arrowchat_chatbox_avatar_wrapper").addClass("arrowchat_white_background");
a(".arrowchat_disable_avatars_name").hide();
a(".arrowchat_chatboxmessage_wrapper").removeClass("arrowchat_chatboxmessage_wrapper2");
a(".arrowchat_chatboxmessagecontent").removeClass("arrowchat_chatboxmessagecontent2");
a(".arrowchat_userlist").removeClass("arrowchat_userslist_no_avatars");
}
}
function setUserStatus(status) {
a.post(c_ac_path + "includes/json/send/send_status.php", {
userid: u_id,
status: status
}, function () {})
}
function buildMaintenance() {
var language = lang[58];
var extraHTML = "";
if (c_chat_maintenance != 0 || c_db_connection == 1 || c_disable_arrowchat == 1)
if (c_db_connection == 1)
language = "We could not connect to the database. Please try again later.";
else
language = lang[27];
else {
if (c_login_url != "")
extraHTML = '
';
}
a("#arrowchat_popout_wrapper").html('
' + language + '
' + extraHTML);
}
function getChatroomTabs(room, focus) {
a.ajax({
url: c_ac_path + "includes/json/receive/receive_chatroom_list.php",
cache: false,
type: "post",
dataType: "json",
success: function (b) {
b && a.each(b, function (i, e) {
if (i == "chatrooms") {
a.each(e, function (l, f) {
cr_name[f.id] = f.n;
cr_desc[f.id] = f.d;
cr_welcome[f.id] = f.welcome;
cr_img[f.id] = f.img;
cr_type[f.id] = f.t;
cr_count[f.id] = f.c;
cr_other[f.id] = f.o;
})
}
});
changePushChannel(room, 1);
if (ac_load_chatroom_id > 0) {
if (cr_type[room] == 2) {
a("#arrowchat_chatroom_password_id").val(room);
a("#arrowchat_chatroom_password_flyout").show("slide", { direction: "up"}, 250, function() {
a("#arrowchat_chatroom_password_input").focus();
});
a("#arrowchat_popout_wrapper").addClass("arrowchat_chatroom_opacity");
} else {
init_open_room[room] = 0;
addChatroomTab(room, focus);
}
} else {
receiveChatroom();
addChatroomTab(room, focus);
}
}
});
}
function lsClick(id, action, acvar) {
if (lsreceive == 0) {
var milliseconds = new Date().getTime();
if (action == "private_message" || action == "chatroom_message" || action == "chatroom_alerts" || action == "send_chatroom_message") {
if (!msieversion()) {
localStorage.setItem(action, id + "/##-" + milliseconds);
}
} else {
if (!msieversion()) {
if (typeof(acvar) == "undefined") {
localStorage.setItem(action, id + "/" + milliseconds);
} else
localStorage.setItem(action, id + "," + acvar + "/" + milliseconds);
}
}
}
}
function msieversion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
return true;
return false;
}
function localStorageFired(e) {
lsreceive = 1;
if (e.key == 'window_focus') {
clearTimeout(dtit3);
document.title = dtit;
}
if (e.key == 'private_message') {
var res = e.newValue.split("/##-");
var data = JSON.parse(res[0]);
receiveMessage(data[0], data[1], data[2], data[3], data[4], 1, 1, 0);
}
if (e.key == 'send_chatroom_message') {
var res = e.newValue.split("/##-");
var data = JSON.parse(res[0]);
addMessageToChatroom(data[0], data[1], data[2], 1, data[3], 0);
a("#arrowchat_popout_text_room_" + data[3]).scrollTop(5E4);
a(".arrowchat_chatboxmessagecontent>div>img,.arrowchat_emoji_text>img").one("load", function() {
a("#arrowchat_popout_text_room_" + data[3]).scrollTop(5E4);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
}
if (c_push_engine != 1) {
if (e.key == 'untyping') {
var res = e.newValue.split("/");
receiveNotTyping(res[0]);
}
if (e.key == 'typing') {
var res = e.newValue.split("/");
receiveTyping(res[0]);
}
if (e.key == 'chatroom_message') {
var res = e.newValue.split("/##-");
var data = JSON.parse(res[0]);
var tester = data[8];
if (tester.substring(0, 3) == "cr-")
tester = tester.substr(3);
addChatroomMessage(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], tester);
}
if (e.key == 'chatroom_alerts') {
var res = e.newValue.split("/##-");
var data = JSON.parse(res[0]);
var tester = data[1];
if (tester.substring(0, 3) == "cr-")
tester = tester.substr(3);
chatroomAlerts(data[0], tester);
}
}
lsreceive = 0;
}
var bounce = 0,
bounce2 = 0,
buddylisttest = 1,
searchxhr,
typingTimeout,
lsreceive = 0,
chatroom_mod = {},
chatroom_admin = {},
count = 0,
V = {},
dtit = document.title,
dtit2 = 1,
dtit3, window_focus = true,
xa = {},
chatroom_list = {},
pending_msg_count = 0,
pending_msg_room_count = 0,
crou = "",
$ = 0,
w = 0,
bli = 1,
isAway = 0,
msgcount = 0,
W = false,
Y, Z, E = 3E3,
Crref2 = -1,
D = E,
K = 1,
ma = 0,
R = 0,
m = "",
Ka = 0,
y = {},
G = {},
aa = {},
ca = {},
history_ids = {},
room_history_loaded = {},
push_room = {},
push_uid,
push_arrowchat,
room_desc = [],
room_limit_msg = [],
room_limit_sec = [],
last_id = {},
last_sent = {},
last_name = {},
init_open = {},
init_open_room = {},
Aa = new Date,
Na = Aa.getDate(),
ab = Math.floor(Aa.getTime() / 1E3),
acsi = 1,
Q = 0,
message_timeout,
fa = -1,
acp = "Powered By
ArrowChat ",
pa = 0,
premade_smiley = [],
B, N;
premade_smiley[0] = [':)','🙂'];
premade_smiley[1] = [':-)','🙂'];
premade_smiley[2] = ['=)','🙂'];
premade_smiley[3] = [':p','😛'];
premade_smiley[4] = [':o','😮'];
premade_smiley[5] = [':|','😐'];
premade_smiley[6] = [':(','☹️'];
premade_smiley[7] = ['=(','☹️'];
premade_smiley[8] = [':D','😃'];
premade_smiley[9] = ['=D','😃'];
premade_smiley[10] = [':/','😕'];
premade_smiley[11] = ['=/','😕'];
premade_smiley[12] = [';)','😉'];
premade_smiley[13] = [':\'(','😢'];
premade_smiley[14] = ['<3','❤️'];
premade_smiley[15] = ['>:(','😡'];
var _ts = "",
_ts2;
for (d = 0; d < Themes.length; d++) {
if (Themes[d][2] == u_theme) {
_ts2 = "selected";
} else {
_ts2 = "";
}
_ts = _ts + "
" + Themes[d][1] + " ";
}
arguments.callee.videoWith = function (b) {
if (c_video_select == 4) {
var win = window.open('https://meet.jit.si/' + b, 'audiovideochat', "status=no,toolbar=no,menubar=no,directories=no,resizable=no,location=no,scrollbars=no,width="+c_video_width+",height="+c_video_height+"");
} else if (c_video_select == 1) {
var win = window.open('https://meet.jit.si/' + b, 'audiovideochat', "status=no,toolbar=no,menubar=no,directories=no,resizable=no,location=no,scrollbars=no,width="+c_video_width+",height="+c_video_height+"");
} else {
var win = window.open(c_ac_path + 'public/video/?rid=' + b, 'audiovideochat', "status=no,toolbar=no,menubar=no,directories=no,resizable=no,location=no,scrollbars=no,width="+c_video_width+",height="+c_video_height+"");
}
win.focus();
};
function runarrowchat() {
a.ajax({
url: c_ac_path + "includes/json/receive/receive_init.php",
cache: false,
type: "get",
dataType: "json",
success: function (b) {}
});
if (!Modernizr.emoji) {
c_disable_smilies = 1;
}
window.addEventListener('storage', localStorageFired, false);
if (c_chat_maintenance != 0 || c_db_connection == 1 || u_id == "" || c_disable_arrowchat == 1) {
buildMaintenance();
} else {
if (c_push_engine == 1) {
push = new Scaledrone(c_push_publish);
}
if (c_push_engine == 1) {
pushSubscribe();
}
a("#arrowchat_popout_left_lists").html("");
a('
').appendTo("#arrowchat_popout_friends");
loadBuddyList();
loadChatroomInit();
loadSelectionButtons();
loadSettingsButton();
u_is_mod == 1 && c_enable_moderation == 1 && buildModButton();
if (c_chatrooms != 1) {
a("#arrowchat_chat_selection_tabs").remove();
a("#arrowchat_popout_left_lists").css("top", "101px");
} else {
if (ac_load_chatroom_id > 0) {
getChatroomTabs(ac_load_chatroom_id, 1);
}
if (ac_select_chatroom > 0 || c_online_list == 0) {
a("#arrowchat_room_selection").click();
}
if (c_online_list == 0) {
a("#arrowchat_user_selection").css("visibility", "hidden");
a("#arrowchat_room_selection").addClass("arrowchat_selection_tab_selected");
}
}
M();
a(window).bind("resize", M);
a("#arrowchat_popout_left_lists").perfectScrollbar();
var chatrooms_exist = false;
for (var d = (focus_chat.length-1); d >= 0; d--) {
if (typeof(focus_chat[d] != "undefined")) {
if (focus_is_room[d] == "1" ) {
if (c_chatrooms != 0 && ac_load_chatroom_id != focus_chat[d]) {
init_open_room[focus_chat[d]] = 0;
changePushChannel(focus_chat[d], 1);
if (d == (focus_chat.length-1)) {
addChatroomTab(focus_chat[d], 1);
} else {
addChatroomTab(focus_chat[d], 0);
}
chatrooms_exist = true;
}
} else {
init_open[focus_chat[d]] = 0;
if (d == (focus_chat.length-1)) {
receiveUser(focus_chat[d], uc_name[focus_chat[d]], uc_status[focus_chat[d]], uc_avatar[focus_chat[d]], uc_link[focus_chat[d]], "0");
} else {
receiveUser(focus_chat[d], uc_name[focus_chat[d]], uc_status[focus_chat[d]], uc_avatar[focus_chat[d]], uc_link[focus_chat[d]], "1");
}
}
}
}
for (var d = 0; d < unfocus_chat.length; d++) {
if (typeof(unfocus_chat[d] != "undefined")) {
if (unfocus_is_room[d] == "1") {
if (c_chatrooms != 0 && ac_load_chatroom_id != unfocus_chat[d]) {
changePushChannel(unfocus_chat[d], 1);
addChatroomTab(unfocus_chat[d], 0);
chatrooms_exist = true;
}
} else {
receiveUser(unfocus_chat[d], uc_name[unfocus_chat[d]], uc_status[unfocus_chat[d]], uc_avatar[unfocus_chat[d]], uc_link[unfocus_chat[d]], "1");
}
}
}
if (chatrooms_exist) {
receiveChatroom();
}
receiveCore();
a(document).bind("idle.idleTimer", function () {
setUserStatus("away");
isAway = 1;
});
a(document).bind("active.idleTimer", function () {
setUserStatus("available");
isAway = 0;
});
window.onblur = function () {
window_focus = false
};
window.onfocus = function () {
window_focus = true
};
a.idleTimer(60000 * c_idle_time);
ion.sound({
sounds: [
{
name: "new_message"
}
],
volume: 1.0,
path: c_ac_path + "themes/" + u_theme + "/sounds/",
preload: true
});
}
}
a.ajaxSetup({
scriptCharset: "utf-8",
cache: false
});
arguments.callee.runarrowchat = function () {
runarrowchat()
};
arguments.callee.chatWith = function (b) {
receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], "0")
};
}
})(jqac);
(jqac);
jqac(document).ready(function () {
jqac.arrowchat();
jqac.arrowchat.runarrowchat()
});