'+lang[245]+'');
}
if (times == 1) {
a(".arrowchat_image_msg img,.arrowchat_emoji_text img").one("load", function() {
a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(5E4);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
}
}
}
})
}
function showTimeAndTooltip() {
a(".arrowchat_chatboxmessagecontent").mouseenter(function () {
if (a(this).parent().parent().hasClass('arrowchat_image_msg'))
showTooltip(a(this), a(this).attr("data-id"), false, a(this).parent().width() + 23, 6, 1, false);
else
showTooltip(a(this), a(this).attr("data-id"), false, a(this).parent().width() - 5, -3, 1, false);
});
a(".arrowchat_chatboxmessagecontent").mouseleave(function () {
hideTooltip();
});
a(".arrowchat_chatboxmessage").mouseenter(function () {
a(this).children(".arrowchat_ts").show();
});
a(".arrowchat_chatboxmessage").mouseleave(function () {
a(this).children(".arrowchat_ts").hide();
});
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 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 setAvatarVisibility(b) {
if (b == 1) {
a(".arrowchat_closed_windows_wrapper[data-id] .arrowchat_closed_image img").addClass("arrowchat_hide_avatars");
a(".arrowchat_tabpopup[data-id] .arrowchat_avatarbox img").addClass("arrowchat_hide_avatars");
a(".arrowchat_tab_letter").css('display', 'flex');
a(".arrowchat_userlist_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_closed_windows_wrapper[data-id] .arrowchat_closed_image").removeClass("arrowchat_white_background");
a(".arrowchat_chatboxmessagefrom").removeClass("arrowchat_white_background");
a(".arrowchat_avatarbox").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");
} else {
a(".arrowchat_closed_windows_wrapper[data-id] .arrowchat_closed_image img").removeClass("arrowchat_hide_avatars");
a(".arrowchat_tabpopup[data-id] .arrowchat_avatarbox img").removeClass("arrowchat_hide_avatars");
a(".arrowchat_tab_letter").hide();
a(".arrowchat_userlist_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_closed_windows_wrapper[data-id] .arrowchat_closed_image").addClass("arrowchat_white_background");
a(".arrowchat_chatboxmessagefrom").addClass("arrowchat_white_background");
a(".arrowchat_avatarbox").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");
}
}
function buildBuddyListTab() {
var d = "";
$buddy_list_tab = a("
").attr("id", "arrowchat_buddy_list_tab").html(ArrowChat.Templates.buddylist_tab()).appendTo($base);
$open_windows = a("
").attr("id", "arrowchat_open_windows").appendTo($base);
$closed_windows = a("
").attr("id", "arrowchat_closed_windows").appendTo($base);
$userstab_popup = a("
").attr("id", "arrowchat_userstab_popup").addClass("arrowchat_tabpopup").html(ArrowChat.Templates.buddylist_window(d, acp)).appendTo($open_windows);
if (c_disable_avatars == 1) {
a("#arrowchat_name_box").hide();
a("#arrowchat_setting_names_only").parent("li").hide();
}
a(".arrowchat_powered_by").css("display", "none");
a(".arrowchat_search_friends_text").placeholder();
if (u_sounds == 1) {
a("#arrowchat_setting_sound .arrowchat_switch :input").prop("checked", true)
} else {
a("#arrowchat_setting_sound").addClass("arrowchat_menu_unchecked");
a("#arrowchat_setting_sound .arrowchat_switch :input").prop("checked", false)
}
if (u_blist_open == 1) {
a("#arrowchat_setting_window_open .arrowchat_switch :input").prop("checked", true)
} else {
a("#arrowchat_setting_window_open").addClass("arrowchat_menu_unchecked");
a("#arrowchat_setting_window_open .arrowchat_switch :input").prop("checked", false)
}
if (u_no_avatars == 1) {
a("#arrowchat_setting_names_only .arrowchat_switch :input").prop("checked", true)
} else {
a("#arrowchat_setting_names_only").addClass("arrowchat_menu_unchecked");
a("#arrowchat_setting_names_only .arrowchat_switch :input").prop("checked", false);
}
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(a("#arrowchat_buddylist_message_flyout"), data, "error");
a(".arrowchat_enter_name_wrapper").fadeOut('fast');
} else {
displayMessage(a("#arrowchat_buddylist_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").placeholder();
a(".arrowchat_guest_name_input").keydown(function (h) {
if (h.keyCode == 13) {
guestNameInput();
}
});
a("#arrowchat_guest_name_button").click(function() {
guestNameInput();
});
}
a(".arrowchat_search_friends_text").keyup(function () {
if (typeof(searchxhr) != "undefined") searchxhr.abort();
a(".arrowchat_search_not_found").remove();
a("#arrowchat_userscontent").children('div').not('.arrowchat_userslist_offline').hide();
a("
").attr("class", "arrowchat_search_not_found arrowchat_nofriends").html('
').prependTo("#arrowchat_userscontent");
clearTimeout(Z);
adjustSizes();
var i = 0,
c = "",
d = "",
f = a(this).val();
if (f.length < 2) {
a(".arrowchat_search_not_found").remove();
a("#arrowchat_userscontent").children('div').not('#arrowchat_userslist_offline').show();
if (buddylisttest == 2) loadBuddyList();
buddylisttest = 1;
} else {
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 (l) {
receiveUserFromUserlist(l.target)
});
}
}
adjustSizes();
}
});
}
adjustSizes();
});
a(document).bind("idle.idleTimer", function () {
if (w != 1) {
clearUserStatus();
setUserStatus("away");
isAway = 1;
}
});
a(document).bind("active.idleTimer", function () {
if (w != 1) {
clearUserStatus();
setUserStatus("available");
isAway = 0;
}
});
a.idleTimer(60000 * ArrowChat.IdleTime);
a("#arrowchat_setting_sound").click(function () {
lsClick("#arrowchat_setting_sound", 'ac_click');
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_window_open").click(function () {
a(this).toggleClass("arrowchat_menu_unchecked");
if (a("#arrowchat_setting_window_open :input").is(":checked")) {
a("#arrowchat_setting_window_open :input").prop("checked", false);
_windowcheck = -1
} else {
a("#arrowchat_setting_window_open :input").prop("checked", true);
_windowcheck = 1
}
a.post(c_ac_path + "includes/json/send/send_settings.php", {
window: _windowcheck
}, function () {
});
});
a("#arrowchat_setting_names_only").click(function () {
lsClick("#arrowchat_setting_names_only", 'ac_click');
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 () {
});
});
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_unblock_button").click(function () {
a(".arrowchat_more_button").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();
});
}
});
preventScrolling(a("#arrowchat_userscontent"));
a("#arrowchat_mobiletab").mouseleave(function () {
a(this).removeClass("arrowchat_mobiletab_hover");
});
a("#arrowchat_mobiletab").mouseenter(function () {
a(this).addClass("arrowchat_mobiletab_hover");
});
a(".arrowchat_close_button", $userstab_popup).mouseenter(function () {
showTooltip(a(this), lang[299], 0, 10, 0);
a(this).addClass("arrowchat_close_button_hover");
});
a(".arrowchat_close_button", $userstab_popup).mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_close_button_hover");
});
a(".arrowchat_close_button", $userstab_popup).click(function () {
hideTooltip();
$buddy_list_tab.click();
});
a("#arrowchat_block_back", $userstab_popup).click(function () {
a("#arrowchat_options_flyout .arrowchat_inner_menu", $userstab_popup).show();
a(".arrowchat_block_menu").hide();
});
a("#arrowchat_user_selection", $userstab_popup).click(function () {
if (a(this).hasClass("arrowchat_selection_tab_selected")){}else{
a("#arrowchat_userscontent").children('div').not('#arrowchat_userslist_offline').show();
a(".arrowchat_search_friends_text").val('');
a(this).addClass("arrowchat_selection_tab_selected");
a("#arrowchat_room_selection", $userstab_popup).removeClass("arrowchat_selection_tab_selected");
a(".arrowchat_chatroom_full_content").hide();
a("#arrowchat_userscontent").show();
loadBuddyList();
lsClick("#arrowchat_user_selection", 'ac_click');
}
});
a(".arrowchat_search_friends_text", $userstab_popup).keydown(function() {
a("#arrowchat_user_selection").click();
});
a(".arrowchat_more_button").mouseenter(function () {
showTooltip(a(this), lang[23], 0, 10, 0);
a(this).addClass("arrowchat_more_button_hover");
}).children().mouseenter(function () {
return false;
});
a(".arrowchat_more_button").mouseleave(function () {
hideTooltip();
a(this).removeClass("arrowchat_more_button_hover");
}).children().mouseleave(function () {
return false;
});
a(".arrowchat_more_button").click(function () {
hideTooltip();
a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
a(this).toggleClass("arrowchat_more_button_selected");
a("#arrowchat_options_flyout").children(".arrowchat_inner_menu").show();
a(".arrowchat_block_menu").hide();
}).children().click(function () {
return false;
});
a('body').click(function(evt){
if(a(evt.target).closest('.arrowchat_more_button').length)
return;
a("#arrowchat_options_flyout").removeClass("arrowchat_options_flyout_display");
});
addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
a("#arrowchat_gooffline").click(function () {
lsClick("#arrowchat_gooffline", 'ac_click');
a(".arrowchat_more_button").click();
pushCancelAll();
cancelJSONP();
a.idleTimer("destroy");
clearTimeout(Z);
clearTimeout(Crref2);
showUserOffline();
});
$buddy_list_tab.mouseover(function () {
if ($userstab_popup.hasClass("arrowchat_tabopen")){} else {
if (!a("#arrowchat_welcome").is(":visible")) {
showTooltip($buddy_list_tab, lang[306], false, a(this).width() + 25, 6, 1, false);
}
a(this).addClass("arrowchat_tabmouseover");
}
});
$buddy_list_tab.mouseout(function () {
a(this).removeClass("arrowchat_tabmouseover");
hideTooltip();
});
$buddy_list_tab.click(function () {
lsClick("#arrowchat_buddy_list_tab", 'ac_openclose');
hideTooltip();
if (w == 1 || bli == 1) {
clearTimeout(Z);
loadBuddyList();
bli = 0;
}
if (c_first_time_message_viewed == 1) {
a("#arrowchat_welcome").hide();
a.post(c_ac_path + "includes/json/send/send_settings.php", {
welcome: 1
}, function () {});
c_first_time_message_viewed = 0;
}
if (w == 1) {
w = 0;
a("#arrowchat_mobiletab_count").html(R);
receiveCore();
pushSubscribe();
if (Object.keys($chatrooms).length > 0) {
receiveChatroom();
}
a.idleTimer(60000 * ArrowChat.IdleTime);
setUserStatus("available");
a("#arrowchat_mobiletab").removeClass("arrowchat_mobiletab_offline");
$open_windows.show();
$closed_windows.show();
}
if ($buddy_list_tab.hasClass("arrowchat_tabclick")){}else{
$userstab_popup.detach();
$userstab_popup.prependTo($open_windows);
}
a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
$userstab_popup.toggleClass("arrowchat_tabopen");
if (a(".arrowchat_enter_name_wrapper").is(":visible")) {
a(".arrowchat_guest_name_input").focus();
}
adjustSizes();
});
}
function buildUnseenUsers() {
$unseen_users = a(ArrowChat.Templates.unseen_chat_tab()).appendTo($closed_windows);
$unseen_users.mouseenter(function() {
a("#arrowchat_unseen_flyout").show();
});
$unseen_users.mouseleave(function() {
a("#arrowchat_unseen_flyout").hide();
});
preventScrolling(a("#arrowchat_unseen_flyout"));
}
function adjustClosedWindows() {
if (typeof($closed_windows) == "undefined")
return false;
var us_count = 0;
var us_avatar = "";
var totalAmount = 0;
a("#arrowchat_unseen_list").html("");
$closed_windows.children().each(function(i) {
if (!a(this).hasClass('arrowchat_tabclick') && !a(this).hasClass('arrowchat_unseen_users_tabs')) {
us_count++;
var amount = 0;
var count_class = "";
if (us_count >= c_num_closed_windows) {
if (a(this).children('.arrowchat_tabalert').length > 0) {
amount = parseInt(a(this).children('.arrowchat_tabalert').html());
if (amount > 0)
count_class = " arrowchat_show";
}
totalAmount = totalAmount + amount;
a(this).hide();
var id = a(this).attr('data-id');
var room_id = a(this).attr('data-room-id');
if (typeof room_id !== 'undefined' && room_id !== false) {
a("
").attr('data-room-id', room_id).addClass('arrowchat_unseen_user_list').html('
'+cr_name[room_id]+''+amount+'
').appendTo(a("#arrowchat_unseen_list"));
} else {
a("
").attr('data-id', id).addClass('arrowchat_unseen_user_list').html('
'+uc_name[id]+''+amount+'
').appendTo(a("#arrowchat_unseen_list"));
}
} else {
a(this).show();
}
if (us_count == c_num_closed_windows) {
us_avatar = a(this).children('.arrowchat_closed_image').html();
}
}
});
if (totalAmount > 0) {
a(".arrowchat_unseen_tabalert").html(totalAmount).show();
} else {
a(".arrowchat_unseen_tabalert").html('0').hide();
}
if (us_count >= c_num_closed_windows) {
a(".arrowchat_unseen_count", $unseen_users).html("+" + (us_count-(c_num_closed_windows-1)));
a(".arrowchat_closed_image", $unseen_users).html(us_avatar);
a(".arrowchat_unseen_user_list").mouseenter(function (e) {
if(e.target == this){
a(".arrowchat_unseen_user_list").removeClass('arrowchat_unseen_user_list_hover');
a(this).addClass('arrowchat_unseen_user_list_hover');
}
});
a(".arrowchat_unseen_user_list").mouseleave(function (e) {
if(e.target == this){
a(this).removeClass('arrowchat_unseen_user_list_hover');
}
});
a(".arrowchat_unseen_user_list").click(function(e) {
var id = a(this).attr('data-id');
var room_id = a(this).attr('data-room-id');
a(this).removeClass('arrowchat_unseen_user_list_hover');
a("#arrowchat_unseen_flyout").hide();
if (typeof room_id !== 'undefined' && room_id !== false) {
$chatrooms[room_id].click();
} else {
$users[id].click();
}
});
a(".arrowchat_unseen_close").mouseenter(function (e) {
if(e.target == this){
a(".arrowchat_unseen_close").removeClass('arrowchat_unseen_close_hover');
a(this).addClass('arrowchat_unseen_close_hover');
}
});
a(".arrowchat_unseen_close").mouseleave(function (e) {
if(e.target == this){
a(this).removeClass('arrowchat_unseen_close_hover');
}
});
a(".arrowchat_unseen_close").click(function(e) {
var id = a(this).parent().attr('data-id');
var room_id = a(this).parent().attr('data-room-id');
a(this).removeClass('arrowchat_unseen_close_hover');
a("#arrowchat_unseen_flyout").hide();
if (typeof room_id !== 'undefined' && room_id !== false) {
a(".arrowchat_closebox_bottom", $chatrooms[room_id]).click();
} else {
a(".arrowchat_closebox_bottom", $users[id]).click();
}
});
$unseen_users.show();
} else {
$unseen_users.hide();
}
}
function adjustChatWindows() {
if (typeof($open_windows) == "undefined")
return false;
var op_width = a("#arrowchat_open_windows").outerWidth();
var chat_tab_width = a("#arrowchat_buddy_list_tab").outerWidth();
var window_width = a(window).width();
c_window_left_padding = parseInt(c_window_left_padding);
if (window_width - (op_width + chat_tab_width) < c_window_left_padding) {
if ($open_windows.children('.arrowchat_tabopen').length > 1) {
var id = $open_windows.children('.arrowchat_tabopen').last().attr('data-id');
var room_id = $open_windows.children('.arrowchat_tabopen').last().attr('data-room-id');
if (typeof id !== 'undefined' && id !== false) {
$users[id].detach();
$users[id].prependTo($closed_windows);
$users[id].removeClass('arrowchat_tabclick').removeClass('arrowchat_usertabclick').show();
}
if (typeof room_id !== 'undefined' && room_id !== false) {
$chatrooms[room_id].detach();
$chatrooms[room_id].prependTo($closed_windows);
$chatrooms[room_id].removeClass('arrowchat_tabclick').removeClass('arrowchat_usertabclick').show();
}
$open_windows.children('.arrowchat_tabopen').last().removeClass('arrowchat_tabopen').addClass('arrowchat_temporary_hide');
}
} else if (window_width - (op_width + chat_tab_width) > ((c_window_left_padding + 20) + a('.arrowchat_tabopen').outerWidth())) {
var id = $open_windows.children('.arrowchat_temporary_hide').first().attr('data-id');
var room_id = $open_windows.children('.arrowchat_temporary_hide').first().attr('data-room-id');
if (typeof id !== 'undefined' && id !== false) {
$users[id].addClass('arrowchat_tabclick').addClass('arrowchat_usertabclick').hide();
if (a(".arrowchat_tabalert", $users[id]).length > 0) {
a(".arrowchat_tabalert", $users[id]).remove();
$users[id].removeClass("arrowchat_tab_new_message");
G[id] = 0;
y[id] = 0;
}
}
if (typeof room_id !== 'undefined' && room_id !== false) {
$chatrooms[room_id].addClass('arrowchat_tabclick').addClass('arrowchat_usertabclick').hide();
if (a(".arrowchat_tabalert", $chatrooms[room_id]).length > 0) {
a(".arrowchat_tabalert", $chatrooms[room_id]).remove();
$chatrooms[room_id].removeClass("arrowchat_tab_new_message");
}
}
$open_windows.children('.arrowchat_temporary_hide').first().addClass('arrowchat_tabopen').removeClass('arrowchat_temporary_hide');
}
}
function adjustSizes() {
adjustChatWindows();
adjustClosedWindows();
}
function set(b, c) {
V[b] = c
}
function get(b) {
return V[b] ? V[b] : ""
}
function getStatus(b) {
return xa[b] ? xa[b] : ""
}
function receiveUserFromUserlist(b) {
if (a(b).attr("id")) var c = a(b).attr("id").substr(19);
else var c = "";
if (c == "") c = a(b).parent().attr("id").substr(19);
receiveUser(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c]);
lsClick("#arrowchat_userlist_" + c, 'ac_click');
}
function chatroomListClicked(b, length) {
c = "";
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_chatroom_full_content").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_chatroom_full_content").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_chatroom_full_content").addClass("arrowchat_chatroom_opacity");
}
}
} else {
a(".arrowchat_chatroom_full_content").removeClass("arrowchat_chatroom_opacity");
if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
a("#arrowchat_chatroom_password_flyout").hide("slide", { direction: "up"}, 250);
}
loadChatroom(c, "")
}
}
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_tabcontenttext", $chatrooms_popups[id]).append('
' + c + '

' + d + '
' + pending_icon + '
');
a(".arrowchat_tabcontenttext", $chatrooms_popups[id]).scrollTop(5E4)
}
if (id != 0) {
showChatroomTime();
modDeleteControls(id);
}
}
function addMessageToContent(b, c) {
if (uc_name[b] == null || uc_name[b] == "") setTimeout(function () {
addMessageToContent(b, c)
}, 500);
else {
a(".arrowchat_tabcontenttext", $user_popups[b]).append("
" + c + "
");
a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(5E4);
G[b] = 1
}
}
function loadChatroomList(id, password) {
if (typeof(id) == "undefined") id = 0;
if (typeof(password) == "undefined") password = "";
a.ajax({
url: c_ac_path + "includes/json/receive/receive_chatroom_list.php",
cache: false,
type: "post",
dataType: "json",
success: function (b) {
buildChatroomList(b);
if (id != 0) {
toggleUserChatTab(id, 0, true, password);
}
}
});
}
function buildChatroomList(b) {
a(".arrowchat_nofriends").remove();
a(".arrowchat_chatroom_full_content").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_chatroom_full_content");
}
if (featured_list != "") {
a('
' + lang[227] + '
').appendTo(a(".arrowchat_chatroom_full_content"));
a(featured_list).appendTo(a(".arrowchat_chatroom_full_content"));
}
if (other_list != "") {
a('
' + lang[228] + '
').appendTo(a(".arrowchat_chatroom_full_content"));
a(other_list).appendTo(a(".arrowchat_chatroom_full_content"));
}
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 receiveChatroom() {
if (c_chatrooms != 1) {
return false;
}
clearTimeout(Crref2);
var admin_markup = "";
var rooms_string = "";
for (var i in $chatrooms) {
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_tabpopup').attr('data-room-id');
}
data.room_data && a.each(data.room_data, function (i, room) {
if (room.error != 0) {
no_error = false;
if (typeof($chatrooms[room.id]) != "undefined") {
a(".arrowchat_closebox_bottom", $chatrooms[room.id]).click();
}
loadChatroomList();
displayMessage(a("#arrowchat_chatroom_message_flyout"), room.error_msg, "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_room_userlist", $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]);
}
userCount == 0 && a(".arrowchat_chatroom_line_users", $chatrooms_popups[room.id]).hide();
adminCount == 0 && a(".arrowchat_chatroom_line_admins", $chatrooms_popups[room.id]).hide();
modCount == 0 && a(".arrowchat_chatroom_line_mods", $chatrooms_popups[room.id]).hide();
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', $chatrooms[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();
}
preventScrolling(a(".arrowchat_room_userlist"));
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 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_tabpopup').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_tabpopup').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_tabpopup').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(a(".arrowchat_message_box", $chatrooms_popups[chatroom_id]), 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_tabpopup').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(a(".arrowchat_message_box", $chatrooms_popups[chatroom_id]), 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_tabpopup').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_tabpopup').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_tabpopup').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], "_self");
});
a(".arrowchat_chatroom_user").unbind('click');
a(".arrowchat_chatroom_user").click(function () {
var chatroom_id = a(this).parents('.arrowchat_tabpopup').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 loadBuddyList() {
clearTimeout(Z);
a.ajax({
url: c_ac_path + "includes/json/receive/receive_buddylist.php",
cache: false,
type: "get",
dataType: "json",
success: function (b) {
buildBuddyList(b);
if (c_disable_avatars == 1) {
a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars")
}
}
});
if (typeof c_list_heart_beat != "undefined") {
var BLHT = c_list_heart_beat * 1000;
} else {
var BLHT = 60000;
}
Z = setTimeout(function () {
loadBuddyList()
}, BLHT)
}
function buildBuddyList(b) {
var c = {},
d = "";
c.available = "";
c.busy = "";
c.offline = "";
c.invisible = "";
c.away = "";
onlineNumber = buddylistreceived = 0;
b && a.each(b, function (i, e) {
if (i == "buddylist") {
buddylistreceived = 1;
totalFriendsNumber = onlineNumber = 0;
a.each(e, function (l, f) {
longname = renderHTMLString(f.n);
if (G[f.id] != null) {
a(".arrowchat_closed_status", $users[f.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + f.s);
a(".arrowchat_chat_window_status", $user_popups[f.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + f.s);
$users[f.id].removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + f.s);
if (typeof($user_popups[f.id]) != "undefined") {
a(".arrowchat_tabsubtitle .arrowchat_message", $user_popups[f.id]).html(f.m);
}
if (f.s == "offline" || (f.s == "busy" && c_video_select != 2 && c_video_select != 3))
a(".arrowchat_tabtitle .arrowchat_video_icon", $user_popups[f.id]).addClass("arrowchat_video_unavailable");
else
a(".arrowchat_tabtitle .arrowchat_video_icon", $user_popups[f.id]).removeClass("arrowchat_video_unavailable");
}
if (f.s == "available" || f.s == "away" || f.s == "busy") onlineNumber++;
totalFriendsNumber++;
if (a("#arrowchat_setting_names_only :input").is(":checked")) d = "arrowchat_hide_avatars";
var icon = ' fas fa-circle';
if (f.s == 'away')
icon = ' fas fa-moon';
else if (f.s == 'busy')
icon = ' far fa-mobile-screen';
c[f.s] += '
' + longname + '';
uc_status[f.id] = f.s;
uc_name[f.id] = f.n;
uc_avatar[f.id] = f.a;
uc_link[f.id] = f.l
})
}
if (buddylistreceived == 1 && bli == 0) {
for (buddystatus in c) {
if (c.hasOwnProperty(buddystatus)) {
if (c[buddystatus] == "") {
a("#arrowchat_userslist_" + buddystatus).html("")
} else {
a("#arrowchat_userslist_" + buddystatus).html("
" + c[buddystatus] + "
");
}
}
}
a(".arrowchat_userlist").click(function (l) {
if (!a(this).hasClass('arrowchat_jabber_user'))
receiveUserFromUserlist(l.target)
});
a("#arrowchat_mobiletab_count").html(onlineNumber);
R = onlineNumber;
totalFriendsNumber == 0 && a("#arrowchat_userslist_available").html('
' + lang[8] + "
");
R == 0 && a("#arrowchat_userslist_available").html('
' + lang[8] + "
");
buddylistreceived = 0
} else {
a("#arrowchat_mobiletab_count").html(onlineNumber);
}
a(".arrowchat_buddylist_admin_1").css("background-color", "#"+c_admin_bg);
a(".arrowchat_buddylist_admin_1").css("color", "#"+c_admin_txt);
})
}
function cancelJSONP() {
if (typeof CHA != "undefined") {
clearTimeout(CHA);
}
if (typeof xOptions != "undefined") {
xOptions.abort();
}
};
function receiveCore() {
cancelJSONP();
var chatroom_string = "";
if (!a.isEmptyObject(chatroom_list)) {
for (var i in chatroom_list) {
chatroom_string = chatroom_string + "&room[]=" + chatroom_list[i];
}
}
var url = c_ac_path + "includes/json/receive/receive_core.php?hash=" + u_hash_id + "&init=" + acsi + chatroom_string;
xOptions = a.ajax({
url: url,
dataType: "jsonp",
success: function (b) {
var c = "",
d = {};
d.available = "";
d.busy = "";
d.offline = "";
d.away = "";
onlineNumber = buddylistreceived = 0;
if (b && b != null) {
var i = 0;
a.each(b, function (e, l) {
if (e == "typing") {
a.each(l, function (f, h) {
if (h.is_typing == "1") {
lsClick(h.typing_id, 'typing');
receiveTyping(h.typing_id);
} else {
lsClick(h.typing_id, 'untyping');
receiveNotTyping(h.typing_id);
}
});
}
if (e == "announcements") {
a.each(l, function (f, h) {
receiveAnnouncement(h);
});
}
if (e == "warnings") {
a.each(l, function (f, h) {
receiveWarning(h);
});
}
if (e == "chatroom") {
var alert_count = [],
room_data = [],
play_chatroom_sound = 0;
a.each(l, function (f, h) {
if (h.action == 1) {
a("#arrowchat_chatroom_message_" + h.m + " .arrowchat_chatroom_msg").html(lang[159] + h.n);
} else {
if (typeof(blockList[h.userid]) == "undefined") {
addChatroomMessage(h.id, h.n, h.m, h.userid, h.t, h.global, h.mod, h.admin, h.chatroomid);
var data_array = [h.id, h.n, h.m, h.userid, h.t, h.global, h.mod, h.admin, h.chatroomid];
lsClick(JSON.stringify(data_array), 'chatroom_message');
}
if (!a(".arrowchat_chatroom_message_input").is(":focus") && h.userid != u_id)
play_chatroom_sound = 1;
room_data[h.chatroomid] = h;
if (typeof(alert_count[h.chatroomid]) != "undefined")
alert_count[h.chatroomid] = alert_count[h.chatroomid] + 1;
else
alert_count[h.chatroomid] = 1;
}
});
if (room_data.length > 0) {
showChatroomTime();
for (var key in room_data) {
if (typeof(blockList[room_data[key].userid]) == "undefined") {
chatroomAlerts(alert_count[key], room_data[key].chatroomid);
var data_array = [alert_count[key], room_data[key].chatroomid];
lsClick(JSON.stringify(data_array), 'chatroom_alerts');
}
}
u_chatroom_sound == 1 && play_chatroom_sound ==1 && playNewMessageSound();
}
}
if (e == "notifications") {
var markup2 = "";
a.each(l, function (f, h) {
addNotification(h.alert_id, h.markup);
markup2 = h.markup;
});
notificationAlerts(markup2);
}
if (e == "messages") {
var play_sound = 0;
a.each(l, function (f, h) {
receiveMessage(h.id, h.from, h.message, h.sent, h.self, h.old, 0, 0);
if (!a(".arrowchat_textarea", $user_popups[h.from]).is(":focus")) {
play_sound = 1;
}
});
K = 1;
D = E;
j != "" && i > 0 && addMessageToContent(j, c);
showTimeAndTooltip();
d != 1 && u_sounds == 1 && play_sound == 1 && acsi != 1 && playNewMessageSound();
}
});
}
set("initialize", "0");
set("currenttime", "0");
if ($ != 1 && w != 1) {
K++;
if (K > 4) {
D *= 2;
K = 1
}
if (D > 12E3) D = 12E3
}
acsi++;
}
});
if (isAway == 1) {
var CHT = c_heart_beat * 1000 * 3;
} else {
var CHT = c_heart_beat * 1000;
}
if (c_push_engine != 1) {
CHA = setTimeout(function () {
receiveCore()
}, CHT);
}
}
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_tabcontenttext", $chatrooms_popups[chatroomid])[0].scrollHeight - a(".arrowchat_tabcontenttext", $chatrooms_popups[chatroomid]).scrollTop() - 10;
var container2 = a(".arrowchat_tabcontenttext", $chatrooms_popups[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_chatroom_msg").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(a(".arrowchat_tabcontenttext", $chatrooms_popups[chatroomid]));
receiveChatroom();
} else {
var noAvatarColor = getRandomColor(name);
a("
").attr("id", "arrowchat_chatroom_message_" + id).addClass(important).addClass(image_msg).addClass(l).addClass("arrowchat_chatroom_box_message").html('
' + name + '
' + noAvatarColor["character"] + '' + message + '
').appendTo(a(".arrowchat_tabcontenttext", $chatrooms_popups[chatroomid]));
}
if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
setAvatarVisibility(1);
}
if (container <= container2) {
a(".arrowchat_tabcontenttext", $chatrooms_popups[chatroomid]).scrollTop(5E4);
a(".arrowchat_image_msg img,.arrowchat_emoji_text img").one("load", function() {
setTimeout(function () {
a(".arrowchat_tabcontenttext", $chatrooms_popups[chatroomid]).scrollTop(5E4);
}, 500);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
} else {
displayMessage(a(".arrowchat_message_box", $chatrooms_popups[chatroomid]), lang[134], "notice");
}
showChatroomTime();
modDeleteControls(chatroomid);
}
}
function chatroomAlerts(nw_count, from) {
if (typeof($chatrooms[from]) != "undefined") {
if ($chatrooms[from].hasClass("arrowchat_tabclick")) {
return false;
}
if (a(".arrowchat_tabalert", $chatrooms[from]).length > 0) {
nw_count = parseInt(a(".arrowchat_tabalert", $chatrooms[from]).html()) + parseInt(nw_count);
}
if (nw_count == 0) {
$chatrooms[from].removeClass("arrowchat_tab_new_message");
a(".arrowchat_tabalert", $chatrooms[from]).remove()
} else {
if (a(".arrowchat_tabalert", $chatrooms[from]).length > 0) {
a(".arrowchat_tabalert", $chatrooms[from]).html(nw_count);
} else a("
").addClass("arrowchat_tabalert").html(nw_count).appendTo($chatrooms[from]);
$chatrooms[from].removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message")
}
adjustSizes();
}
}
function receiveAnnouncement(h) {
if (h.read == 0 && h.data != "") {
a("#arrowchat_announcement").remove();
$body.append(ArrowChat.Templates.announcements_display(h));
if (a("#arrowchat_warnings").length) {
var nb = parseInt(a(window).height() - a("#arrowchat_warnings").position().top);
a("#arrowchat_announcement").css("bottom", nb + 5 + "px");
}
a("#arrowchat_announcement .arrowchat_announce_close").click(function () {
a("#arrowchat_announcement").remove();
if (a("#arrowchat_warnings").length)
var bottom_num = parseInt(a("#arrowchat_mobiletab").outerHeight() + parseInt(a("#arrowchat_mobiletab").css("bottom")) + 3);
a("#arrowchat_warnings").css("bottom", bottom_num + "px");
a.post(c_ac_path + "includes/json/send/send_settings.php", {
announce: 1
}, function () {});
});
} else {
a("#arrowchat_announcement").remove();
}
}
function addNotification(alert_id, markup) {
a("
").attr("id", "arrowchat_alert_" + alert_id).attr("class", "arrowchat_notification_message_div").html(markup).appendTo(a("#arrowchat_notifications_content"));
a(".arrowchat_notifications_divider").removeClass("arrowchat_notifications_divider_last");
a("#arrowchat_notifications_content div:last-child .arrowchat_notifications_divider").addClass("arrowchat_notifications_divider_last");
Q++;
}
function notificationAlerts(markup) {
if (a("#arrowchat_bell_flyout").hasClass("arrowchat_bell_flyout_display")) {
} else {
var na_count = parseInt(a(".arrowchat_mobiletab_new_count").html()) + Q;
a(".arrowchat_mobiletab_new_count").html(na_count);
a("#arrowchat_mobiletab_new").show();
a("#arrowchat_bell_notification").show().html(Q);
}
if (Q > 0) {
a("#arrowchat_no_new_notifications").css("display", "none");
}
}
function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\0/g,'\0');
str=str.replace(/\\\\/g,'\\');
return str;
}
function notifyNewMessage(from, nw_count) {
if (uc_name[from] == null || uc_name[from] == "") setTimeout(function () {
notifyNewMessage(from, nw_count)
}, 500);
else {
if (typeof($users[from]) != "undefined") {
if ($users[from].hasClass("arrowchat_tabclick")) {
return false;
}
if (a(".arrowchat_tabalert", $users[from]).length > 0) {
nw_count = parseInt(a(".arrowchat_tabalert", $users[from]).html()) + parseInt(nw_count);
}
if (nw_count == 0) {
$users[from].removeClass("arrowchat_tab_new_message");
a(".arrowchat_tabalert", $users[from]).remove()
} else {
if (a(".arrowchat_tabalert", $users[from]).length > 0) {
a(".arrowchat_tabalert", $users[from]).html(nw_count);
} else a("
").addClass("arrowchat_tabalert").html(nw_count).appendTo($users[from]);
$users[from].removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message")
}
y[from] = nw_count;
}
}
adjustSizes();
}
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 && c_push_engine != 1) {
var data_array = [id, from, message, sent, self, old];
acsi > 2 && 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_tabcontenttext", $user_popups[from])[0].scrollHeight - a(".arrowchat_tabcontenttext", $user_popups[from]).scrollTop() - 10;
var container2 = a(".arrowchat_tabcontenttext", $user_popups[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:not(.arrowchat_pending_error)", $user_popups[from]).hide();
a(".arrowchat_tabcontenttext div .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_tabcontenttext", $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);
}
showTimeAndTooltip();
}
if (container <= container2 || !$users[from].hasClass("arrowchat_tabclick")) {
a(".arrowchat_tabcontenttext", $user_popups[from]).scrollTop(5E4);
a(".arrowchat_image_msg img,.arrowchat_emoji_text img").one("load", function() {
setTimeout(function () {
a(".arrowchat_tabcontenttext", $user_popups[from]).scrollTop(5E4);
}, 500);
}).each(function() {
if(this.complete) a(this).trigger('load');
});
} else {
displayMessage(a(".arrowchat_message_box", $user_popups[from]), lang[134], "notice");
}
notifyNewMessage(from, 1);
}
}
function receiveTyping(id) {
if (typeof($users[id]) != "undefined") {
var container = a(".arrowchat_tabcontenttext", $user_popups[id])[0].scrollHeight - a(".arrowchat_tabcontenttext", $user_popups[id]).scrollTop() - 10;
var container2 = a(".arrowchat_tabcontenttext", $user_popups[id]).outerHeight();
a(".arrowchat_is_typing", $users[id]).show();
if (a("#arrowchat_typing_message_" + id, $user_popups[id]).length) {
a("#arrowchat_typing_message_" + id, $user_popups[id]).remove();
}
var noAvatarColor = getRandomColor(uc_name[id]);
a(".arrowchat_tabcontenttext", $user_popups[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_tabclick")) {
a(".arrowchat_tabcontenttext", $user_popups[id]).scrollTop(5E4);
}
clearTimeout(typingTimeout);
typingTimeout = setTimeout(function () {
lsClick(id, 'untyping');
receiveNotTyping(id)
}, 30000);
}
}
function receiveNotTyping(id) {
if (typeof($users[id]) != "undefined") {
clearTimeout(typingTimeout);
if (a("#arrowchat_typing_message_" + id, $user_popups[id]).length) {
a("#arrowchat_typing_message_" + id, $user_popups[id]).remove();
}
a(".arrowchat_is_typing", $users[id]).hide();
}
}
function pushCancelAll() {
if (c_push_engine == 1) {
push_uid.unsubscribe();
push_arrowchat.unsubscribe();
if (Object.keys(chatroom_list).length > 0) {
a.each(chatroom_list, function(index, value) {
push_room[value].unsubscribe();
});
}
}
}
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 ("warning" in data) {
receiveWarning(data.warning);
}
if ("notification" in data) {
var markup2;
addNotification(data.notification.alert_id, data.notification.markup);
notificationAlerts(markup2);
}
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);
var data_array = [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];
lsClick(JSON.stringify(data_array), 'chatroom_message');
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_chatroom_message_input").is(":focus") && playNewMessageSound();
}
}
}
}
if ("typing" in data) {
lsClick(data.typing.id, 'typing');
receiveTyping(data.typing.id);
}
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", $user_popups[data.messages.from]).is(":focus") && playNewMessageSound();
showTimeAndTooltip();
K = 1;
D = E;
}
if ("chatroomban" in data) {
a(".arrowchat_closebox_bottom", $chatroos[data.chatroomban.id]).click();
displayMessage(a("#arrowchat_chatroom_message_flyout"), data.chatroomban.error2, "error");
}
}
function DTitChange(name) {
name = renderHTMLString(name);
if (dtit2 != 2) {
document.title = lang[30] + " " + name + "!";
dtit2 = 2
} else {
document.title = dtit;
dtit2 = 1
}
if (window_focus == false) {
dtit3 = setTimeout(function () {
DTitChange(name)
}, 1000)
} else {
document.title = dtit;
clearTimeout(dtit3);
setTimeout(function(){lsClick("body", 'window_focus')},500);
}
}
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 lsClick(id, action, acvar) {
if (lsreceive == 0) {
var milliseconds = new Date().getTime();
if (action == "ac_openclose") {
if (typeof(acvar) == "undefined") {
if (a(id).hasClass("arrowchat_tabclick"))
localStorage.setItem("ac_close", id + "/" + milliseconds);
else
localStorage.setItem("ac_open", id + "/" + milliseconds);
} else {
eval("var temp=$"+acvar+";");
if (id == " ") {
if (temp.hasClass("arrowchat_tabclick"))
localStorage.setItem("ac_close", id + "," + acvar + "/" + milliseconds);
else
localStorage.setItem("ac_open", id + "," + acvar + "/" + milliseconds);
} else {
if (a(id, acvar).hasClass("arrowchat_tabclick"))
localStorage.setItem("ac_close", id + "," + acvar + "/" + milliseconds);
else
localStorage.setItem("ac_open", id + "," + acvar + "/" + milliseconds);
}
}
} else 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 == 'ac_open' || e.key == 'ac_close' || e.key == 'ac_click') {
var res = e.newValue.split("/");
var res2 = res[0].split(",");
if (typeof(res2[1]) == "undefined") {
if (e.key == 'ac_click')
a(res2[0]).click();
else if (!a(res2[0]).hasClass("arrowchat_tabclick") && e.key == 'ac_open')
a(res2[0]).click();
else if (a(res2[0]).hasClass("arrowchat_tabclick") && e.key == 'ac_close')
a(res2[0]).click();
} else {
eval("var temp=$"+res2[1]+";");
if (res2[0] == " ") {
if (typeof(temp) != "undefined" && e.key == 'ac_click')
temp.click();
else if (typeof(temp) != "undefined" && !temp.hasClass("arrowchat_tabclick") && e.key == 'ac_open')
temp.click();
else if (typeof(temp) != "undefined" && temp.hasClass("arrowchat_tabclick") && e.key == 'ac_close')
temp.click();
} else {
if (a(res2[0], temp).length && e.key == 'ac_click')
a(res2[0], temp).click();
else if (a(res2[0], temp).length && !a(res2[0], temp).hasClass("arrowchat_tabclick") && e.key == 'ac_open')
a(res2[0], temp).click();
else if (a(res2[0], temp).length && a(res2[0], temp).hasClass("arrowchat_tabclick") && e.key == 'ac_close')
a(res2[0], temp).click();
}
}
}
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 == 'open_chatroom') {
var res = e.newValue.split("/");
loadChatroom(res[0], "");
}
if (e.key == 'send_chatroom_message') {
var res = e.newValue.split("/##-");
var data = JSON.parse(res[0]);
var tester = data[3];
if (tester.substring(0, 3) == "cr-")
tester = tester.substr(3);
addMessageToChatroom(data[0], data[1], data[2], 1, tester, 0);
a(".arrowchat_tabcontenttext", $chatrooms_popups[tester]).scrollTop(a(".arrowchat_tabcontenttext", $chatrooms_popups[tester])[0].scrollHeight);
a(".arrowchat_image_msg img,.arrowchat_emoji_text img").one("load", function() {
a(".arrowchat_tabcontenttext", $chatrooms_popups[tester]).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;
}
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.emoji2) {
c_disable_smilies = 1;
}
$base = a("
").attr("id", "arrowchat_base").appendTo($body);
window.addEventListener('storage', localStorageFired, false);
if (c_push_engine == 1) {
push = new Scaledrone(c_push_publish);
}
if (c_chat_maintenance != 0 || c_db_connection == 1 || (c_guests_login_msg != 0 && u_id == "")) {
buildMaintenance();
} else {
buildBuddyListTab();
if (c_chatrooms != 0) {
buildChatroomsButton();
} else {
a("#arrowchat_room_selection").hide();
}
buildOptionsButton();
u_is_mod == 1 && c_enable_moderation == 1 && buildModButton();
buildUnseenUsers();
}
if (c_online_list == 0) {
a("#arrowchat_buddy_list_tab").hide();
a("#arrowchat_closed_windows").addClass("arrowchat_online_list_hidden");
}
$body.append('
');
a(window).bind("resize", adjustSizes);
a(window).on('resize', function(){
clearTimeout(windowresize_timeout);
windowresize_timeout = setTimeout(function () {
adjustSizes();
}, 500);
});
set("buddylist", "1");
set("initialize", "1");
set("currenttime", ab);
a(window).focus(function() {
window_focus = true;
lsClick("body", 'window_focus');
}).blur(function() {
window_focus = false;
});
if (typeof document.body.style.maxHeight === "undefined") {
W = true;
$base.css("position", "absolute");
$tooltip.css("position", "absolute");
$userstab_popup.css("position", "absolute");
}
if (u_status == "offline") {
w = 1;
clearUserStatus();
a("#arrowchat_mobiletab").addClass("arrowchat_mobiletab_offline");
$buddy_list_tab.removeClass("arrowchat_tabclick").removeClass("arrowchat_userstabclick");
$userstab_popup.removeClass("arrowchat_tabopen");
$open_windows.hide();
$closed_windows.hide();
a.idleTimer("destroy");
} else if (c_chat_maintenance != 1 && c_db_connection != 1 && u_id != "") {
if (c_push_engine == 1) {
pushSubscribe();
}
var chatrooms_exist = false;
for (var d = 0; d < focus_chat.length; d++) {
if (typeof(focus_chat[d] != "undefined")) {
if (focus_is_room[d] == "1") {
if (c_chatrooms != 0) {
init_open_room[focus_chat[d]] = 0;
changePushChannel(focus_chat[d], 1);
toggleUserChatTab(focus_chat[d], "0", true, "");
chatrooms_exist = true;
}
} else {
init_open[focus_chat[d]] = 0;
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");
}
}
}
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) {
changePushChannel(unfocus_chat[d], 1);
toggleUserChatTab(unfocus_chat[d], "1", true, "");
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();
displayWelcome();
a("#arrowchat_userslist_available").html('
');
if (u_blist_open == 1 && c_online_list != 0)
$buddy_list_tab.click();
else
loadBuddyList();
}
adjustSizes();
ion.sound({
sounds: [
{
name: "new_message"
}
],
volume: 1.0,
path: c_ac_path + "themes/" + u_theme + "/sounds/",
preload: true
});
}
function playNewMessageSound() {
ion.sound.play("new_message");
}
function renderHTMLString(string) {
var new_render = string;
if (typeof(string) != "undefined") {
var render = a("
").attr("id", "arrowchat_render").html(string).appendTo('body');
new_render = a("#arrowchat_render").html();
render.remove();
}
return new_render;
}
var bounce2 = 1,
bounce3 = 1,
buddylisttest = 1,
searchxhr,
typingTimeout,
lsreceive = 0,
chatroom_mod = {},
chatroom_admin = {},
count = 0,
V = {},
dtit = document.title,
dtit2 = 1,
dtit3 = 1,
window_focus = true,
xa = {},
chatroom_list = {},
j = "",
$ = 0,
w = 0,
bli = 1,
isAway = 0,
W = false,
Y, Z, E = 3E3,
Crref2 = -1,
Ccr = -1,
open_report = -1,
message_timeout,
windowresize_timeout,
pending_msg_count = 0,
pending_msg_room_count = 0,
D = E,
K = 1,
R = 0,
Ka = 0,
y = {},
G = {},
aa = {},
ca = {},
init_open = {},
init_open_room = {},
room_history_loaded = {},
last_id = {},
last_sent = {},
last_name = {},
history_ids = {},
push_room = {},
push_uid,
push_arrowchat,
room_desc = [],
room_limit_msg = [],
room_limit_sec = [],
visibleTab = [],
Aa = new Date,
Na = Aa.getDate(),
ab = Math.floor(Aa.getTime() / 1E3),
acsi = 1,
Q = 0,
fa = -1,
acp = "Powered By
ArrowChat",
pa = 0,
B,
orig_txt_size = 32,
push,
session_var = '',
onlineNumber = 0,
errorCount = 0,
premade_smiley = [],
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] = ['>:(','😡'];
a.ajaxSetup({
scriptCharset: "utf-8",
cache: false
});
a.expr[":"].icontains = function (b, c, d) {
return (b.textContent || b.innerText || jqac(b).text() || "").toLowerCase().indexOf(d[3].toLowerCase()) >= 0
};
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();
};
arguments.callee.runarrowchat = runarrowchat;
arguments.callee.chatroom = function (b) {
loadChatroom(b, "");
};
arguments.callee.chatWith = function (b) {
receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b])
};
arguments.callee.getUser = function (b, c) {
a.ajax({
url: c_ac_path + "includes/json/receive/receive_user.php",
data: {
userid: b
},
type: "post",
cache: false,
dataType: "json",
success: function (o) {
if (o) {
window[c](o);
} else {
window[c](0);
}
}
});
};
arguments.callee.sendMessage = function (b, c) {
c != "" && a.post(c_ac_path + "includes/json/send/send_message.php", {
to: b,
message: c
}, function (d) {
if (d) {
if (!a.isNumeric(d)) {
a.each(d, function (i, q) {
if (i == "error") {
a.each(q, function (l, f) {
displayMessage(a(".arrowchat_message_box", $user_popups[b]), f.m, "error");
});
}
});
} else {
addMessageToChatbox(b, c, 1, 1, d, 1, 1);
}
a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight)
}
K = 1;
})
};
arguments.callee.getBaseUrl = function () {
return k
};
arguments.callee.logout = function () {
clearTimeout(Z);
clearTimeout(Crref2);
Crref2 = -1;
a.idleTimer("destroy");
pushCancelAll();
cancelJSONP();
c_guests_login_msg = 1;
u_id = "";
a("#arrowchat_buddy_list_tab").remove();
$open_windows.remove();
$closed_windows.remove();
buildMaintenance();
};
}
})(jqac);
jqac(document).ready(function () {
if (u_logged_in != 1 && c_disable_arrowchat != 1) {
jqac.arrowchat();
jqac.arrowchat.runarrowchat();
}
});