social_stream 0.21.4 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -5
- data/base/app/assets/stylesheets/cheesecake.css.scss +1 -0
- data/base/app/views/cheesecake/_cheesecake.html.erb +3 -0
- data/base/app/views/cheesecake/_index.html.erb +88 -41
- data/base/app/views/cheesecake/_sector_form.html.erb +12 -12
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/test_helpers/controllers.rb +19 -2
- data/base/lib/tasks/db/populate.rake +190 -165
- data/base/social_stream-base.gemspec +1 -1
- data/base/spec/controllers/posts_controller_spec.rb +19 -1
- data/lib/social_stream/version.rb +1 -1
- data/presence/app/assets/images/status/chat.png +0 -0
- data/presence/app/assets/javascripts/chat_interface_manager.js.erb +42 -45
- data/presence/app/assets/javascripts/chat_parser.js +5 -5
- data/presence/app/assets/javascripts/chat_persistence.js +25 -26
- data/presence/app/assets/javascripts/chat_utilities.js +15 -11
- data/presence/app/assets/javascripts/chat_window_manager.js +129 -26
- data/presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js +22 -3
- data/presence/app/assets/javascripts/social_stream-presence.js +1 -0
- data/presence/app/assets/javascripts/videochat.js.erb +459 -0
- data/presence/app/assets/javascripts/xmpp_client_management.js.erb +303 -65
- data/presence/app/assets/stylesheets/chat.css.scss +42 -1
- data/presence/app/controllers/xmpp_controller.rb +20 -3
- data/presence/app/views/chat/_index.html.erb +7 -2
- data/presence/app/views/xmpp/getOpenTokSessionIDAndToken.xml.builder +6 -0
- data/presence/config/locales/en.yml +22 -1
- data/presence/config/locales/es.yml +23 -2
- data/presence/config/routes.rb +2 -0
- data/presence/ejabberd/conf/ssconfig_example.cfg +4 -3
- data/presence/ejabberd/ejabberd_files.zip +0 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script +22 -12
- data/presence/ejabberd/ejabberd_scripts/development_scripts/show_config.sh +9 -10
- data/presence/ejabberd/ejabberd_scripts/emanagement +275 -178
- data/presence/ejabberd/ejabberd_scripts/manageWebDomains +164 -0
- data/presence/ejabberd/ejabberd_scripts/rest_api_client_script +75 -32
- data/presence/ejabberd/ejabberd_scripts/synchronize_presence_script +81 -34
- data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/presence/ejabberd/mod_sspresence/mod_sspresence.erl +27 -23
- data/presence/lib/OpenTok/Exceptions.rb +11 -0
- data/presence/lib/OpenTok/OpenTokSDK.rb +184 -0
- data/presence/lib/OpenTok/Session.rb +27 -0
- data/presence/lib/generators/social_stream/presence/templates/initializer.rb +8 -2
- data/presence/lib/open_tok.rb +31 -0
- data/presence/lib/opentok.rb +29 -0
- data/presence/lib/social_stream-presence.rb +4 -0
- data/presence/lib/social_stream/presence/models/buddy_manager.rb +1 -1
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/lib/social_stream/presence/xmpp_server_order.rb +96 -76
- data/presence/lib/social_stream/presence/xmpp_ssclient.rb +54 -0
- data/presence/lib/tasks/presence/multidomain.rake +45 -0
- data/presence/lib/tasks/presence/synchronize.rake +18 -4
- data/presence/vendor/assets/javascripts/TB.min.js +4329 -0
- data/social_stream.gemspec +2 -2
- metadata +40 -30
- data/presence/ejabberd/ejabberd_scripts/reset_connection_script +0 -300
- data/presence/ejabberd/ejabberd_scripts/set_script_header.sh +0 -112
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
# Autolink text blocks
|
59
59
|
s.add_runtime_dependency('rails_autolink', '~> 1.0.4')
|
60
60
|
# SocialCheesecake
|
61
|
-
s.add_runtime_dependency('social_cheesecake','~> 0.
|
61
|
+
s.add_runtime_dependency('social_cheesecake','~> 0.4.0')
|
62
62
|
# I18n-js
|
63
63
|
s.add_runtime_dependency('i18n-js','~>2.1.2')
|
64
64
|
|
@@ -25,6 +25,7 @@ describe PostsController do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it_should_behave_like "Allow Creating"
|
28
|
+
it_should_behave_like "Allow Reading"
|
28
29
|
it_should_behave_like "Allow Destroying"
|
29
30
|
|
30
31
|
it "should destroy with js" do
|
@@ -49,6 +50,7 @@ describe PostsController do
|
|
49
50
|
end
|
50
51
|
|
51
52
|
it_should_behave_like "Allow Creating"
|
53
|
+
it_should_behave_like "Allow Reading"
|
52
54
|
it_should_behave_like "Allow Destroying"
|
53
55
|
end
|
54
56
|
|
@@ -63,6 +65,7 @@ describe PostsController do
|
|
63
65
|
end
|
64
66
|
|
65
67
|
it_should_behave_like "Allow Creating"
|
68
|
+
it_should_behave_like "Allow Reading"
|
66
69
|
it_should_behave_like "Allow Destroying"
|
67
70
|
end
|
68
71
|
end
|
@@ -72,9 +75,13 @@ describe PostsController do
|
|
72
75
|
friend = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
73
76
|
|
74
77
|
model_assigned_to @user.contact_to!(friend), friend.relation_custom('friend')
|
78
|
+
@current_model = Factory(:post, :author_id => @user.actor_id,
|
79
|
+
:owner_id => friend.id,
|
80
|
+
:user_author_id => @user.actor_id)
|
75
81
|
end
|
76
82
|
|
77
83
|
it_should_behave_like "Allow Creating"
|
84
|
+
it_should_behave_like "Allow Reading"
|
78
85
|
end
|
79
86
|
|
80
87
|
describe "post to acquaintance" do
|
@@ -87,6 +94,14 @@ describe PostsController do
|
|
87
94
|
it_should_behave_like "Deny Creating"
|
88
95
|
end
|
89
96
|
|
97
|
+
describe "post from other user" do
|
98
|
+
before do
|
99
|
+
@current_model = Factory(:post)
|
100
|
+
end
|
101
|
+
|
102
|
+
it_should_behave_like "Deny Reading"
|
103
|
+
end
|
104
|
+
|
90
105
|
describe "posts represented group" do
|
91
106
|
before do
|
92
107
|
@group = Factory(:member, :contact => Factory(:group_contact, :receiver => @user.actor)).sender_subject
|
@@ -105,6 +120,7 @@ describe PostsController do
|
|
105
120
|
end
|
106
121
|
|
107
122
|
it_should_behave_like "Allow Creating"
|
123
|
+
it_should_behave_like "Allow Reading"
|
108
124
|
it_should_behave_like "Allow Destroying"
|
109
125
|
end
|
110
126
|
|
@@ -125,6 +141,7 @@ describe PostsController do
|
|
125
141
|
end
|
126
142
|
|
127
143
|
it_should_behave_like "Allow Creating"
|
144
|
+
it_should_behave_like "Allow Reading"
|
128
145
|
it_should_behave_like "Allow Destroying"
|
129
146
|
end
|
130
147
|
|
@@ -140,6 +157,7 @@ describe PostsController do
|
|
140
157
|
end
|
141
158
|
|
142
159
|
it_should_behave_like "Allow Creating"
|
160
|
+
it_should_behave_like "Allow Reading"
|
143
161
|
it_should_behave_like "Allow Destroying"
|
144
162
|
end
|
145
163
|
|
@@ -155,11 +173,11 @@ describe PostsController do
|
|
155
173
|
end
|
156
174
|
|
157
175
|
it_should_behave_like "Allow Creating"
|
176
|
+
it_should_behave_like "Allow Reading"
|
158
177
|
it_should_behave_like "Allow Destroying"
|
159
178
|
end
|
160
179
|
end
|
161
180
|
end
|
162
|
-
|
163
181
|
end
|
164
182
|
|
165
183
|
context "creating post in group's wall" do
|
Binary file
|
@@ -91,7 +91,7 @@ function settingChatBoxFunctions(){
|
|
91
91
|
|
92
92
|
if (createChatBox(guest_slug, guest_name, guest_jid, user_name, user_jid)) {
|
93
93
|
} else {
|
94
|
-
|
94
|
+
getChatBoxForSlug(guest_slug).chatbox("option", "boxManager").toggleBox(true);
|
95
95
|
};
|
96
96
|
});
|
97
97
|
|
@@ -268,33 +268,13 @@ function restartAwayTimer(){
|
|
268
268
|
//Update chatWindow Management
|
269
269
|
////////////////////
|
270
270
|
|
271
|
-
function
|
272
|
-
timerCounter++;
|
273
|
-
|
274
|
-
if((timerCounter > cyclesToRefresh)&&(requestContacts)) {
|
275
|
-
requestContacts = false;
|
276
|
-
updateChatWindow();
|
277
|
-
}
|
278
|
-
}
|
279
|
-
|
280
|
-
|
281
|
-
function refreshChatWindow(){
|
282
|
-
if(timerCounter > cyclesToRefresh){
|
283
|
-
updateChatWindow();
|
284
|
-
} else {
|
285
|
-
requestContacts = true;
|
286
|
-
}
|
287
|
-
}
|
288
|
-
|
289
|
-
|
290
|
-
function updateChatWindow(){
|
291
|
-
var stropheConnectedAndOnlineStatus = ((isStropheConnected()) && (userStatus!="offline") && (!disconnectionFlag));
|
271
|
+
function updateChatWindow(){
|
292
272
|
timerCounter=0;
|
293
273
|
|
294
274
|
log("updateChatWindow()");
|
295
|
-
log("Connected " +
|
275
|
+
log("Connected " + isUserConnected());
|
296
276
|
|
297
|
-
if(!
|
277
|
+
if(! isUserConnected()){
|
298
278
|
loadDisconnectionDiv();
|
299
279
|
updateConnectedUsersOfMainChatBox();
|
300
280
|
return;
|
@@ -307,6 +287,7 @@ function updateChatWindow(){
|
|
307
287
|
hideConnectionBoxesFromDisconnectedSlugs();
|
308
288
|
setAllUserFunctions();
|
309
289
|
updateConnectedUsersOfMainChatBox();
|
290
|
+
checkForZeroUsersConnected();
|
310
291
|
if (isStropheConnected()) {
|
311
292
|
if (afterNewConnectionFlag){
|
312
293
|
afterNewConnectionFlag = false;
|
@@ -403,6 +384,7 @@ function updateInterfaceAfterPresenceStanza(slug,available){
|
|
403
384
|
} else {
|
404
385
|
hideConnectionBoxFromSlug(slug);
|
405
386
|
showOfflineChatNotificationForSlug(slug);
|
387
|
+
closeVideoSession(slug);
|
406
388
|
}
|
407
389
|
updateMainChatBoxAfterConnectionBoxChanges();
|
408
390
|
checkForZeroUsersConnected();
|
@@ -510,20 +492,17 @@ function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){
|
|
510
492
|
return;
|
511
493
|
}
|
512
494
|
|
513
|
-
//Check
|
514
|
-
if (existsSlugChatBox(from_slug)) {
|
495
|
+
//Check slugs connectionBox
|
496
|
+
if (!existsSlugChatBox(from_slug)) {
|
515
497
|
//No connectionBox for this user!
|
516
498
|
var from_name = getNameFromSlug(from_slug);
|
517
499
|
if(! isAdminSlug(from_slug)){
|
518
|
-
|
519
|
-
|
500
|
+
updateChatWindow();
|
501
|
+
}
|
520
502
|
} else {
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
var from_name = $('div.user_presence[slug=' + from_slug + ']').attr('name');
|
525
|
-
}
|
526
|
-
|
503
|
+
var from_name = $('div.user_presence[slug=' + from_slug + ']').attr('name');
|
504
|
+
}
|
505
|
+
|
527
506
|
//Create or toggle from_slug's chatBox.
|
528
507
|
if (createChatBox(from_slug, from_name, from_jid, user_name, user_jid)) {
|
529
508
|
} else {
|
@@ -564,16 +543,28 @@ function showChatNotification(notification,type,msg){
|
|
564
543
|
|
565
544
|
function showChatNotificationForSlug(slug,type,msg){
|
566
545
|
var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
|
567
|
-
|
546
|
+
if(notification.length==1){
|
547
|
+
showChatNotification(notification,type,msg);
|
548
|
+
}
|
568
549
|
}
|
569
550
|
|
570
551
|
function showOfflineChatNotificationForSlug(slug){
|
571
|
-
|
572
|
-
if(slug_chat_box!=null){
|
573
|
-
var name = slug_chat_box.attr("name")
|
574
|
-
var msg = name + ' ' + I18n.t('chat.notify.guestOffline');
|
552
|
+
var msg = I18n.t("chat.notify.guestOffline", {name: getNameFromSlug(slug)});
|
575
553
|
showChatNotificationForSlug(slug,"guestOffline",msg);
|
576
|
-
|
554
|
+
}
|
555
|
+
|
556
|
+
function showVideoChatNotificationForSlug(slug,msg){
|
557
|
+
showChatNotificationForSlug(slug,"videochat",msg);
|
558
|
+
}
|
559
|
+
|
560
|
+
function showVideoChatNotificationForSlugClientIssue(slug){
|
561
|
+
var msg = I18n.t("chat.notify.videochat.clientIssue", {name: getNameFromSlug(slug)});
|
562
|
+
showVideoChatNotificationForSlug(slug,msg);
|
563
|
+
}
|
564
|
+
|
565
|
+
function showVideoChatNotificationForSlugClientOffline(slug){
|
566
|
+
var msg = I18n.t("chat.notify.videochat.offline", {name: getNameFromSlug(slug)});
|
567
|
+
showVideoChatNotificationForSlug(slug,msg);
|
577
568
|
}
|
578
569
|
|
579
570
|
function hideChatNotification(notification){
|
@@ -587,8 +578,15 @@ function hideChatNotificationForSlug(slug){
|
|
587
578
|
hideChatNotification(notification);
|
588
579
|
}
|
589
580
|
|
590
|
-
function
|
591
|
-
|
581
|
+
function updateInterfaceAfterUsersDisconnect(){
|
582
|
+
updateNotificationsAfterUserDisconnect();
|
583
|
+
$.each(getAllSlugsWithVisibleVideoBoxes(), function(index, value) {
|
584
|
+
closeVideoSession(value);
|
585
|
+
});
|
586
|
+
}
|
587
|
+
|
588
|
+
function updateNotificationsAfterUserDisconnect(){
|
589
|
+
var notification = $("div.ui-chatbox-notify");
|
592
590
|
var msg = I18n.t('chat.notify.offline');
|
593
591
|
showChatNotification(notification,"userOffline",msg);
|
594
592
|
}
|
@@ -601,7 +599,7 @@ function hideAllNotifications(){
|
|
601
599
|
function updateAllNotifications(){
|
602
600
|
hideAllNotifications();
|
603
601
|
if(disconnectionFlag){
|
604
|
-
|
602
|
+
updateNotificationsAfterUserDisconnect();
|
605
603
|
} else {
|
606
604
|
//Notification for offline contacts
|
607
605
|
$.each(getAllDisconnectedSlugsWithChatBoxes(), function(index, value) {
|
@@ -617,8 +615,7 @@ function updateAllNotifications(){
|
|
617
615
|
|
618
616
|
function updateConnectedUsersOfMainChatBox(){
|
619
617
|
if(mainChatBox!=null){
|
620
|
-
|
621
|
-
if(stropheConnectedAndOnlineStatus){
|
618
|
+
if(isUserConnected()){
|
622
619
|
var connectedUsers = getConnectedSlugsLength();
|
623
620
|
changeMainChatBoxHeaderTitle( I18n.t('chat.title') + " (" + connectedUsers + ")");
|
624
621
|
changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
|
@@ -46,7 +46,7 @@ function parseContent(content){
|
|
46
46
|
return "<pre>" + content + "</pre>"
|
47
47
|
}
|
48
48
|
|
49
|
-
words = content.split(" ");
|
49
|
+
var words = content.split(" ");
|
50
50
|
for(i=0; i<words.length; i++){
|
51
51
|
words[i] = parseWord(words[i]);
|
52
52
|
}
|
@@ -131,18 +131,18 @@ function parseWord(word){
|
|
131
131
|
}
|
132
132
|
|
133
133
|
function splitFirst(word,key){
|
134
|
-
split=[]
|
135
|
-
cut = word.split(key);
|
134
|
+
var split=[]
|
135
|
+
var cut = word.split(key);
|
136
136
|
split[0]=cut[0]
|
137
137
|
cut.shift()
|
138
|
-
paste = cut.join(key)
|
138
|
+
var paste = cut.join(key)
|
139
139
|
split[1]=paste
|
140
140
|
return split
|
141
141
|
}
|
142
142
|
|
143
143
|
function buildIconImage(icon){
|
144
144
|
if (icon in chatIcons){
|
145
|
-
image_file = chatIcons[icon]
|
145
|
+
var image_file = chatIcons[icon]
|
146
146
|
return "<img class=\"chatEmoticon\" src=\"/assets/emoticons/" + image_file + "\"/>";
|
147
147
|
}
|
148
148
|
return icon
|
@@ -10,11 +10,20 @@ function storeChatData(){
|
|
10
10
|
return
|
11
11
|
}
|
12
12
|
|
13
|
+
storeChatStatus();
|
13
14
|
storeUserChatStatus();
|
14
|
-
storeChatConnectionParametres();
|
15
15
|
storeConversations();
|
16
16
|
}
|
17
17
|
|
18
|
+
function storeChatStatus(){
|
19
|
+
//Status of the mainChatBoxWindow
|
20
|
+
if(mainChatBox!=null){
|
21
|
+
sessionStorage.setItem("chat_mainChatBox_status", $(mainChatBox).is(":visible"));
|
22
|
+
} else {
|
23
|
+
sessionStorage.setItem("chat_mainChatBox_status", null);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
18
27
|
function storeConversations() {
|
19
28
|
|
20
29
|
var chatboxes = getAllChatBoxes();
|
@@ -23,8 +32,6 @@ function storeConversations() {
|
|
23
32
|
var visibleMaxSlugs = [];
|
24
33
|
var visibleMinSlugs = [];
|
25
34
|
|
26
|
-
//window[getChatVariableFromSlug("eric-white")].is(":visible")
|
27
|
-
|
28
35
|
//Stored all conversations
|
29
36
|
for (var i=0;i<chatboxes.length;i++){
|
30
37
|
var slug = chatboxes[i].id
|
@@ -62,35 +69,13 @@ function storeConversations() {
|
|
62
69
|
}
|
63
70
|
}
|
64
71
|
|
65
|
-
|
66
|
-
function storeChatConnectionParametres() {
|
67
|
-
if ((sessionStorage.getItem("cookie") == null)||(sessionStorage.getItem("chat_user_name") == null)){
|
68
|
-
if ((typeof cookie != 'undefined')&&(cookie!=null)){
|
69
|
-
sessionStorage.setItem("cookie", cookie);
|
70
|
-
}
|
71
|
-
if ((typeof user_name != 'undefined') && (user_name != null)) {
|
72
|
-
sessionStorage.setItem("chat_user_name", user_name);
|
73
|
-
}
|
74
|
-
if ((typeof user_slug != 'undefined') && (user_slug != null)) {
|
75
|
-
sessionStorage.setItem("chat_user_slug", user_slug);
|
76
|
-
}
|
77
|
-
if ((typeof user_jid != 'undefined') && (user_jid != null)) {
|
78
|
-
sessionStorage.setItem("chat_user_jid", user_jid);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
72
|
function storeUserChatStatus(){
|
84
73
|
sessionStorage.setItem("chat_user_status", userStatus);
|
85
74
|
}
|
86
75
|
|
87
76
|
function removeAllDataStored(){
|
88
|
-
sessionStorage.removeItem("cookie");
|
89
|
-
sessionStorage.removeItem("chat_user_name");
|
90
|
-
sessionStorage.removeItem("chat_user_slug");
|
91
|
-
sessionStorage.removeItem("chat_user_jid");
|
92
|
-
|
93
77
|
sessionStorage.removeItem("chat_user_status");
|
78
|
+
sessionStorage.removeItem("chat_mainChatBox_status");
|
94
79
|
|
95
80
|
sessionStorage.removeItem("slugs_with_stored_log");
|
96
81
|
sessionStorage.removeItem("slugs_with_visible_max_chatbox");
|
@@ -117,9 +102,23 @@ function restoreChatData(){
|
|
117
102
|
if (! window.sessionStorage){
|
118
103
|
return
|
119
104
|
}
|
105
|
+
|
120
106
|
restoreConversations();
|
121
107
|
}
|
122
108
|
|
109
|
+
|
110
|
+
function getRestoreMainChatBoxStatus(){
|
111
|
+
if (!window.sessionStorage) {
|
112
|
+
return false;
|
113
|
+
} else {
|
114
|
+
if(sessionStorage.getItem("chat_mainChatBox_status") == "true"){
|
115
|
+
return true;
|
116
|
+
} else {
|
117
|
+
return false;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
123
122
|
function restoreConversations() {
|
124
123
|
|
125
124
|
//Get Stored slugs
|
@@ -93,7 +93,7 @@ function userChatDataInputControl(){
|
|
93
93
|
////////////////////
|
94
94
|
|
95
95
|
var lastMessageTimes = new Array();
|
96
|
-
//lastMessageTimes['
|
96
|
+
//lastMessageTimes['slug'] = ["timeOfLastMessage",["msgID1","msgID2"]];
|
97
97
|
|
98
98
|
var timeBetweenMessages = 500; //mseconds
|
99
99
|
|
@@ -181,11 +181,6 @@ function floodControl() {
|
|
181
181
|
};
|
182
182
|
|
183
183
|
|
184
|
-
function initControlFlood(){
|
185
|
-
$(".ui-chatbox-input-box")
|
186
|
-
}
|
187
|
-
|
188
|
-
|
189
184
|
////////////////////
|
190
185
|
//Bounce chatbox control
|
191
186
|
////////////////////
|
@@ -193,21 +188,30 @@ var lastBounceTimes = new Array();
|
|
193
188
|
var timeBetweenBounces = 5000; //mseconds
|
194
189
|
|
195
190
|
function mustBounceBoxForChatWindow(jqueryUIChatbox){
|
196
|
-
var from_slug = $($(jqueryUIChatbox.elem.uiChatbox).find(".ui-chatbox-content").children()[0]).attr("id")
|
197
191
|
|
192
|
+
var slug = jqueryUIChatbox.elem.uiChatbox.find(".ui-chatbox-content").find(".ui-chatbox-log").attr("id")
|
193
|
+
|
194
|
+
if (typeof slug == 'undefined') {
|
195
|
+
return false;
|
196
|
+
}
|
197
|
+
|
198
|
+
if((slug in contactsInfo)&&(contactsInfo[slug].videoChatStatus!="disconnected")){
|
199
|
+
return false;
|
200
|
+
}
|
201
|
+
|
198
202
|
var t = (new Date()).getTime();
|
199
203
|
|
200
|
-
if(!(
|
201
|
-
lastBounceTimes[
|
204
|
+
if(!(slug in lastBounceTimes)){
|
205
|
+
lastBounceTimes[slug] = t;
|
202
206
|
return true;
|
203
207
|
}
|
204
208
|
|
205
|
-
var lastBounceTime = lastBounceTimes[
|
209
|
+
var lastBounceTime = lastBounceTimes[slug];
|
206
210
|
|
207
211
|
if (t - lastBounceTime < timeBetweenBounces) {
|
208
212
|
return false;
|
209
213
|
} else {
|
210
|
-
lastBounceTimes[
|
214
|
+
lastBounceTimes[slug] = t;
|
211
215
|
return true;
|
212
216
|
}
|
213
217
|
|
@@ -5,8 +5,8 @@
|
|
5
5
|
var nBox = 0;
|
6
6
|
var maxBox = 5;
|
7
7
|
var chatBoxWidth = 230;
|
8
|
-
var chatBoxHeight =
|
9
|
-
var videoBoxHeight =
|
8
|
+
var chatBoxHeight = 180;
|
9
|
+
var videoBoxHeight = 145;
|
10
10
|
var visibleChatBoxes = new Array();
|
11
11
|
var offsetForFlowBox = 0;
|
12
12
|
var chatBoxSeparation = chatBoxWidth+12;
|
@@ -150,13 +150,66 @@ function getChatBoxForSlug(slug){
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
153
|
+
function getChatBoxHeaderForSlug(slug){
|
154
|
+
var chatBox = getChatBoxForSlug(slug);
|
155
|
+
if(chatBox!=null){
|
156
|
+
return chatBox.parent().parent().find(".ui-chatbox-titlebar")
|
157
|
+
} else {
|
158
|
+
return null;
|
159
|
+
}
|
160
|
+
}
|
153
161
|
|
154
|
-
function
|
155
|
-
var
|
156
|
-
|
162
|
+
function getChatBoxButtonsForSlug(slug){
|
163
|
+
var chatBoxHeader = getChatBoxHeaderForSlug(slug);
|
164
|
+
if(chatBoxHeader!=null){
|
165
|
+
return chatBoxHeader.find(".ui-chatbox-icon");
|
166
|
+
} else {
|
167
|
+
return null;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
function getChatBoxButtonForSlug(slug,button){
|
172
|
+
var chatBoxButtons = getChatBoxButtonsForSlug(slug);
|
173
|
+
if(chatBoxButtons!=null){
|
174
|
+
switch (button){
|
175
|
+
case "close":
|
176
|
+
return chatBoxButtons[0];
|
177
|
+
break;
|
178
|
+
case "min":
|
179
|
+
return chatBoxButtons[1];
|
180
|
+
break;
|
181
|
+
case "video":
|
182
|
+
return chatBoxButtons[2];
|
183
|
+
break;
|
184
|
+
case "videoChange":
|
185
|
+
return chatBoxButtons[3];
|
186
|
+
break;
|
187
|
+
default : return null;
|
188
|
+
}
|
189
|
+
} else {
|
190
|
+
return null;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
function getAllSlugsWithChatOrVideoBoxes(){
|
196
|
+
var slugsWithChatBox = [];
|
197
|
+
var slugsWithVideoBox = [];
|
198
|
+
$.each(getAllChatBoxes(), function(index, value) {
|
199
|
+
if($(value).parent().find(".ui-videobox").is(":visible")){
|
200
|
+
slugsWithVideoBox.push($(value).attr("id"))
|
201
|
+
}
|
157
202
|
slugsWithChatBox.push($(value).attr("id"))
|
158
203
|
});
|
159
|
-
|
204
|
+
return [slugsWithChatBox,slugsWithVideoBox];
|
205
|
+
}
|
206
|
+
|
207
|
+
function getAllSlugsWithChatBoxes(){
|
208
|
+
return getAllSlugsWithChatOrVideoBoxes()[0];
|
209
|
+
}
|
210
|
+
|
211
|
+
function getAllSlugsWithVisibleVideoBoxes(){
|
212
|
+
return getAllSlugsWithChatOrVideoBoxes()[1];
|
160
213
|
}
|
161
214
|
|
162
215
|
function getAllDisconnectedSlugsWithChatBoxes(){
|
@@ -209,41 +262,88 @@ function rotatePriority(guest_slug){
|
|
209
262
|
//Video Window Manager functions
|
210
263
|
////////////////////
|
211
264
|
|
212
|
-
function
|
213
|
-
|
265
|
+
function getVideoBoxForSlug(slug){
|
266
|
+
var videoBox = $("#" + slug).parent().find("div.ui-videobox");
|
267
|
+
if(videoBox.length == 1){
|
268
|
+
return videoBox;
|
269
|
+
} else {
|
270
|
+
return null;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
function getPublisherVideoBoxForSlug(slug){
|
275
|
+
var pubDiv = $("#stream_publish_videochat_" + slug);
|
276
|
+
if (pubDiv.length > 0) {
|
277
|
+
return pubDiv
|
278
|
+
} else {
|
279
|
+
return null;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
function setVideoBoxContent(slug,embed){
|
284
|
+
var videoBox = getVideoBoxForSlug(slug);
|
285
|
+
if(videoBox!=null){
|
286
|
+
videoBox.html(embed);
|
287
|
+
}
|
214
288
|
}
|
215
289
|
|
216
|
-
function
|
217
|
-
|
218
|
-
|
219
|
-
|
290
|
+
function addVideoBoxContent(slug,embed){
|
291
|
+
var videoBox = getVideoBoxForSlug(slug);
|
292
|
+
if(videoBox!=null){
|
293
|
+
videoBox.append(embed);
|
294
|
+
}
|
220
295
|
}
|
221
296
|
|
297
|
+
function showVideoBox(chatBox){
|
298
|
+
chatBox.chatbox("option", "video",videoBoxHeight);
|
299
|
+
}
|
222
300
|
|
223
|
-
function hideVideoBox(
|
224
|
-
|
225
|
-
chatBox.chatbox("option", "video", 0);
|
301
|
+
function hideVideoBox(chatBox){
|
302
|
+
chatBox.chatbox("option", "video", 0);
|
226
303
|
}
|
227
304
|
|
228
305
|
|
229
306
|
//Function called from JQuery UI Plugin
|
230
|
-
function
|
231
|
-
|
232
|
-
|
307
|
+
function toggleVideoBox(uiElement){
|
308
|
+
var slug = $(uiElement.element).attr("id");
|
309
|
+
clickVideoChatButton(slug);
|
233
310
|
}
|
234
311
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
312
|
+
//Function called from JQuery UI Plugin
|
313
|
+
function toggleVideoBoxChange(uiElement){
|
314
|
+
var slug = $(uiElement.element).attr("id");
|
315
|
+
clickVideoChangeChatButton(slug);
|
316
|
+
}
|
317
|
+
|
318
|
+
function toggleVideoBoxForSlug(slug,force){
|
319
|
+
var aux;
|
320
|
+
var chatBox = getChatBoxForSlug(slug);
|
321
|
+
|
322
|
+
if(chatBox==null) {
|
323
|
+
return null;
|
324
|
+
}
|
325
|
+
|
326
|
+
if(typeof force != 'undefined'){
|
327
|
+
aux = force;
|
239
328
|
} else {
|
240
|
-
|
329
|
+
if (chatBox.chatbox("option", "video")==0){
|
330
|
+
aux=true;
|
331
|
+
} else {
|
332
|
+
aux=false;
|
333
|
+
}
|
241
334
|
}
|
335
|
+
|
336
|
+
if (aux){
|
337
|
+
//Show
|
338
|
+
showVideoBox(chatBox);
|
339
|
+
return true;
|
340
|
+
} else {
|
341
|
+
//Hide
|
342
|
+
hideVideoBox(chatBox);
|
343
|
+
return false;
|
344
|
+
}
|
242
345
|
}
|
243
346
|
|
244
|
-
function getVideoEmbedForSlug(slug){
|
245
|
-
return "<img src=\"http://www.batiburrillo.net/wp-content/uploads/2011/03/Freemake.jpg?cda6c1\" width=\"" + (chatBoxWidth-20) + "\"/>"
|
246
|
-
}
|
247
347
|
|
248
348
|
|
249
349
|
|
@@ -304,6 +404,9 @@ function createMainChatBox(){
|
|
304
404
|
$(mainChatBox).css('overflow-x','hidden')
|
305
405
|
$(mainChatBox).css('overflow-y','hidden')
|
306
406
|
|
407
|
+
//Minimize
|
408
|
+
mainChatBox.parent().toggle(getRestoreMainChatBoxStatus());
|
409
|
+
|
307
410
|
//Header title
|
308
411
|
updateConnectedUsersOfMainChatBox();
|
309
412
|
}
|