1 line
184 KiB
JavaScript
1 line
184 KiB
JavaScript
|
|
(function (a) {
a.arrowchat = function () {
var $body = a('body');
var $base;
var $maintenance;
var $popout_chat_button;
var $chatrooms_button;
var $buddy_list_tab;
var $open_windows;
var $closed_windows;
var $userstab_popup;
var $tooltip = null;
var $tooltip_content;
var $chatrooms_popup;
var $users = {};
var $user_popups = {};
var $chatrooms = {};
var $chatrooms_popups = {};
var $unseen_users;
function addHover($elements, classes) {
$elements.each( function (i, element) {
a(element).hover(
function () {
a(this).addClass(classes);
}, function () {
a(this).removeClass(classes);
}
);
});
}
function preventScrolling($target) {
$target.bind('mousewheel DOMMouseScroll', function (e) {
var e0 = e.originalEvent,
delta = e0.wheelDelta || -e0.deltaY || -e0.detail;
this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
e.preventDefault();
});
}
function closePopup($popup, $button, hidden) {
if ($popup !== undefined) {
if (hidden == 1) {
$popup.addClass("arrowchat_tabopen_hidden");
} else{
$popup.removeClass("arrowchat_tabopen");
}
}
if ($button !== undefined) {
$button.removeClass("arrowchat_tabclick arrowchat_userstabclick arrowchat_trayclick arrowchat_usertabclick");
}
}
function hideTooltip() {
if ($tooltip) {
$tooltip.hide();
}
}
function showTooltip($target, text, is_left, custom_left, custom_top, is_sideways, is_sideways_right) {
if ($tooltip === null) {
$tooltip = a('<div id="arrowchat_tooltip"><div class="arrowchat_tooltip_content"></div></div>').appendTo($body);
$tooltip_content = a('.arrowchat_tooltip_content', $tooltip);
}
$tooltip_content.html(text);
var target_offset = $target.offset();
var target_width = $target.width();
var target_height = $target.height();
var tooltip_width = $tooltip.width();
if (!custom_left) {
custom_left = 0;
}
if (!custom_top) {
custom_top = 0;
}
if (is_left) {
$tooltip.css({
top : target_offset.top - a(window).scrollTop() - target_height - 5 - custom_top,
left : target_offset.left + target_width - 16 - custom_left,
display : "block",
'padding-right' : "0px",
'padding-left' : "0px"
}).addClass("arrowchat_tooltip_left");
} else if (is_sideways_right) {
$tooltip.css({
top : target_offset.top - a(window).scrollTop() + (target_height/2) - 10 - custom_top,
left : target_offset.left + target_width + 28 - custom_left,
display : "block",
'padding-right' : "0px",
'padding-left' : "6px"
}).removeClass("arrowchat_tooltip_left");
} else if (is_sideways) {
$tooltip.css({
top : target_offset.top - a(window).scrollTop() + (target_height/2) - 10 - custom_top,
left : target_offset.left + target_width - tooltip_width + 18 - custom_left,
display : "block",
'background-position' : tooltip_width - 128 + "px -58px",
'padding-right' : "6px",
'padding-left' : "0px"
}).removeClass("arrowchat_tooltip_left");
} else {
$tooltip.css({
top : target_offset.top - a(window).scrollTop() - target_height - 5 - custom_top,
left : target_offset.left + target_width - tooltip_width + 18 - custom_left,
display : "block",
'padding-right' : "0px",
'padding-left' : "0px"
}).removeClass("arrowchat_tooltip_left");
}
if (W) {
$tooltip.css("position", "absolute");
$tooltip.css(
"top",
parseInt(a(window).height()) - parseInt($tooltip.css("bottom")) - parseInt($tooltip.height()) + a(window).scrollTop() + "px"
);
}
}
function replaceURLWithHTMLLinks(text) {
return anchorme.js(text);
}
RegExp.escape = function(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
};
function youTubeEmbed(mess) {
var regExp = /^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?([^\s]+)$/mi;
var match = mess.match(regExp);
if (match && match[1].length == 11) {
mess = '<span style="mar
|