$.browser = {};
(function () {
$.browser.msie = false;
$.browser.version = 0;
if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
$.browser.msie = true;
$.browser.version = RegExp.$1;
}
})();
$(document).ready(function(){
$("#tabs" ).tabs();
$('.dropdown-toggle').on('click', function (e) {
$(this).next('.dropdown-menu').toggle();
e.stopPropagation();
});
});
$('#deleteall_btn').on('click', function (e) {
$('.popover').toggleClass('show');
e.stopPropagation();
});
$(".profile-sec-dropdown").mouseenter(function() {
$(".profile-dropdown-menu").show();
}).mouseleave(function() {
$(".profile-dropdown-menu").hide();
});
$(".numbers").keydown(function (e) {
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110]) !== -1 ||
// Allow: Ctrl+A, Command+A
(e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
// Allow: home, end, left, right, down, up
(e.keyCode >= 35 && e.keyCode <= 40)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
// ===== Scroll to Top ====
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(200); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(200); // Else fade out the arrow
}
});
$('#return-to-top').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
var showChar = 50;
var ellipsestext = "...";
var moretext = "more";
var lesstext = "less";
$('.full-chat-history').each(function() {
var content = $(this).html();
if(content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar-1, content.length - showChar);
var html = c + '' + ellipsestext+ ' ' + h + ' ' + moretext + '';
$(this).html(html);
}
});
$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});