quickview.js
5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//******************************** CHAT MENU SIDEBAR ******************************//
angular.module('newApp')
.factory('quickViewService', [function () {
function quickviewSidebar() {
function toggleqQuickview() {
$('#quickview-toggle').click(function (e) {//
e.preventDefault();
e.stopPropagation();//
if ($('#quickview-sidebar').hasClass('open'))
$('#builder').removeClass('open');
else
$('#quickview-sidebar').addClass('open');
});
}
$('.chat-back').on('click', function () {
$('.chat-conversation').removeClass('current');
$('.chat-body').addClass('current');
});
$('.chat-list').on('click', 'li', function () {
var chat_name = $(this).find('.user-name').html();
var chat_txt = $(this).find('.user-txt').html();
var chat_status = $(this).find('.user-status').html();
var chat_img = $(this).find('img').attr('src');
$('.chat-conversation .user-name').html(chat_name);
$('.chat-conversation .user-txt').html(chat_txt);
$('.chat-conversation .user-status').html(chat_status);
$('.chat-conversation .user-img img').attr("src", chat_img);
$('.chat-conversation .conversation-body .conversation-img img').attr("src", chat_img);
$('.chat-body').removeClass('current');
$('.chat-conversation').addClass('current');
});
/* Open / Close right sidebar */
$('#quickview-toggle').on('click', function () {//
$('#chat-notification').hide();
setTimeout(function () {
$('.mm-panel .badge-danger').each(function () {
$(this).removeClass('hide').addClass('animated bounceIn');
});
}, 1000);
});
/* Remove current message when opening */
$('.have-message').on('click', function () {
$(this).removeClass('have-message');
$(this).find('.badge-danger').fadeOut();
});
/* Send messages */
$('.send-message').keypress(function (e) {
if (e.keyCode == 13) {
var chat_message = '<li class="img">' +
'<span>' +
'<div class="chat-detail chat-right">' +
'<img src="../images/avatars/avatar1.png" data-retina-src="../images/avatars/avatar1_2x.png"/>' +
'<div class="chat-detail">' +
'<div class="chat-bubble">' +
$(this).val() +
'</div>' +
'</div>' +
'</div>' +
'</span>' +
'</li>';
$(chat_message).hide().appendTo($(this).parent().parent().parent().find('.conversation-body ul')).fadeIn();
$(this).val("");
quickviewHeight();
customScroll();
}
});
$('.main-content').click(function (ev) {
chatSidebar = document.getElementById('quickview-sidebar');
var target = ev.target;
if (target !== chatSidebar) {
if ($('#quickview-sidebar').hasClass('open')) {
$('#quickview-sidebar').addClass('closing');
$('#quickview-sidebar').removeClass('open');
setTimeout(function () {
$('#quickview-sidebar').removeClass('closing');
}, 400);
}
}
});
if ($('.settings-chart .progress-bar').length) {
$('.settings-tab').on('click', function () {
setTimeout(function () {
$('.settings-chart .setting1').progressbar();
window.myRadar = new Chart(document.getElementById("setting-chart").getContext("2d")).Radar(radarChartData, {
responsive: true,
tooltipCornerRadius: 0,
animationSteps: 60,
});
}, 200);
setTimeout(function () {
$('.settings-chart .setting2').progressbar();
}, 400);
});
};
/* Radar Chart */
var radarChartData = {
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
datasets: [
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [38, 48, 40, 89, 96, 27, 90]
}
]
};
toggleqQuickview();
}
function quickviewHeight() {
$('.chat-conversation').height('');
chatConversationHeight = $('.chat-conversation').height();
windowHeight = $(window).height();
if (chatConversationHeight < windowHeight) {
$('.chat-conversation').height($(window).height() - 50);
}
}
/**** On Resize Functions ****/
$(window).resize(function () {
noteTextarea();
quickviewHeight();
});
return {
init: function () {
quickviewSidebar();
quickviewHeight();
}
}
}]);