Skip to content

Commit 0767151

Browse files
committed
update package version and ES5 convert, fix firefox join room issue
1 parent 128bc69 commit 0767151

File tree

8 files changed

+115
-123
lines changed

8 files changed

+115
-123
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ep_wrtc_heading",
33
"description": "Video Headings Plugin for Etherpad",
4-
"version": "0.23.9",
4+
"version": "0.25.1",
55
"author": {
66
"name": "Hossein Marzban",
77
"email": "[email protected]"

Diff for: static/js/clientShare.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ exports.getUserFromId = function getUserFromId(userId) {
1919

2020
exports.slugify = function slugify(text) {
2121
return text.toString().toLowerCase().trim().replace(/\s+/g, '-') // Replace spaces with -
22-
.replace(/&/g, '-and-') // Replace & with 'and'
23-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
24-
.replace(/\--+/g, '-') // Replace multiple - with single -
25-
.replace(/^-+/, '') // Trim - from start of text
26-
.replace(/-+$/, ''); // Trim - from end of text
22+
.replace(/&/g, '-and-') // Replace & with 'and'
23+
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
24+
.replace(/\--+/g, '-') // Replace multiple - with single -
25+
.replace(/^-+/, '') // Trim - from start of text
26+
.replace(/-+$/, ''); // Trim - from end of text
2727
};
2828

2929
exports.$body_ace_outer = function $body_ace_outer() {
@@ -73,7 +73,7 @@ exports.notifyNewUserJoined = function notifyNewUserJoined(target, msg, action)
7373
};
7474

7575
exports.roomBoxIconActive = function roomBoxIconActive() {
76-
exports.$body_ace_outer().find('.wbrtc_roomBox').each(function(index, val) {
76+
exports.$body_ace_outer().find('.wbrtc_roomBox').each(function (index, val) {
7777
var textActive = $(val).attr('data-text');
7878
var videoActive = $(val).attr('data-video');
7979
if (textActive || videoActive) {
@@ -89,7 +89,7 @@ exports.appendUserList = function appendUserList(roomInfo, selector) {
8989
var $element = typeof selector === 'string' ? $(document).find(selector) : selector;
9090
$element.empty();
9191
roomInfo.list.forEach(function reOrderUserList(el) {
92-
var userInList = exports.getUserFromId(el.userId) || {colorId: '', name: 'anonymous'};
92+
var userInList = exports.getUserFromId(el.userId) || { colorId: '', name: 'anonymous' };
9393
if (clientVars.ep_profile_list && clientVars.ep_profile_list[el.userId]) {
9494
avatarUrl = clientVars.ep_profile_list[el.userId].imageUrl || clientVars.ep_profile_list[el.userId].img;
9595
}
@@ -121,7 +121,7 @@ exports.wrtcPubsub = {
121121
}
122122

123123
if (this.events[eventName]) {
124-
this.events[eventName].forEach(function(fn) {
124+
this.events[eventName].forEach(function (fn) {
125125
fn.apply(undefined, data);
126126
});
127127
}
@@ -133,7 +133,7 @@ var inlineAvatar = {
133133
var inlineAvatarLimit = clientVars.webrtc.inlineAvatarLimit || 4;
134134
var $element = exports.$body_ace_outer().find('#wbrtc_avatarCol .' + headerId + ' .wrtc_inlineAvatars');
135135
$element.find('.avatar').remove();
136-
$element.parent().css({left: WRTC_Room.getHeaderRoomX($element.parent()) + 'px'});
136+
$element.parent().css({ left: WRTC_Room.getHeaderRoomX($element.parent()) + 'px' });
137137
Object.keys(room).forEach(function reOrderUserList(key, index) {
138138
var userInList = exports.getUserFromId(room[key].userId);
139139
if (clientVars.ep_profile_list && clientVars.ep_profile_list[userInList.userId]) {
@@ -174,8 +174,7 @@ var inlineAvatar = {
174174
}
175175
};
176176

177-
178-
exports.wrtcPubsub.on('update store', function(requestUser, headerId, action, target, roomInfo, callback) {
177+
exports.wrtcPubsub.on('update store', function (requestUser, headerId, action, target, roomInfo, callback) {
179178
if (!requestUser || !headerId || !action || !roomInfo || !target) return false;
180179
var users = exports.wrtcStore[headerId].USERS;
181180
exports.wrtcStore[headerId][target] = roomInfo;
@@ -184,12 +183,12 @@ exports.wrtcPubsub.on('update store', function(requestUser, headerId, action, ta
184183
// remove all users
185184
users = {};
186185

187-
exports.wrtcStore[headerId].TEXT.list.forEach(function(el) {
186+
exports.wrtcStore[headerId].TEXT.list.forEach(function (el) {
188187
if (!users[el.userId]) users[el.userId] = {};
189188
users[el.userId] = el;
190189
});
191190

192-
exports.wrtcStore[headerId].VIDEO.list.forEach(function(el) {
191+
exports.wrtcStore[headerId].VIDEO.list.forEach(function (el) {
193192
if (!users[el.userId]) users[el.userId] = {};
194193
users[el.userId] = el;
195194
});
@@ -250,5 +249,4 @@ exports.wrtcPubsub.on('enable room buttons', function enableRoomButtons(headerId
250249
}
251250
});
252251

253-
254-
/* Helper */
252+
/* Helper */

Diff for: static/js/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ var hooks = {
127127

128128
$('#editorcontainer iframe').ready(function readyObj() {
129129
WRTC.appendInterfaceLayout();
130-
setTimeout(function() {
130+
setTimeout(function () {
131131
WRTC_Room.findTags();
132132
}, 250);
133133
});
@@ -203,4 +203,4 @@ exports.aceSetAuthorStyle = hooks.aceSetAuthorStyle;
203203
exports.userLeave = hooks.userLeave;
204204
exports.handleClientMessage_RTC_MESSAGE = hooks.handleClientMessage_RTC_MESSAGE;
205205
exports.aceSelectionChanged = hooks.aceSelectionChanged;
206-
exports.aceInitialized = hooks.aceInitialized;
206+
exports.aceInitialized = hooks.aceInitialized;

Diff for: static/js/index.mini.js

-1
This file was deleted.

Diff for: static/js/textChat.js

+9-14
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var textChat = (function textChat() {
2020
var timeStr = hours + ':' + minutes;
2121

2222
var userName = $('<b>').text(msg.userName + ': ');
23-
var tim = $('<span>').attr({ class: 'time' }).text(timeStr);
23+
var tim = $('<span>').attr({ 'class': 'time' }).text(timeStr);
2424

2525
var message = $('<p>').attr({
2626
'data-authorid': msg.author
@@ -43,7 +43,6 @@ var textChat = (function textChat() {
4343
createAndAppendMessage(msg);
4444
}
4545

46-
4746
function eventTextChatInput() {
4847
var keycode = event.keyCode || event.which;
4948
// when press Enter key
@@ -108,9 +107,7 @@ var textChat = (function textChat() {
108107
$('body').append(textChatBox);
109108
} else {
110109
// TODO: change this to template
111-
existTextChat.attr({ 'data-id': headerId })
112-
.find('.textChatToolbar b, .btn_leave')
113-
.attr({ 'data-id': headerId });
110+
existTextChat.attr({ 'data-id': headerId }).find('.textChatToolbar b, .btn_leave').attr({ 'data-id': headerId });
114111
existTextChat.find('.nd_title b').text(headTitle);
115112
}
116113

@@ -126,7 +123,7 @@ var textChat = (function textChat() {
126123
});
127124

128125
socket.emit('getTextMessages', padId, headerId, {}, function getTextMessages(data) {
129-
data.forEach(function(el) {
126+
data.forEach(function (el) {
130127
createAndAppendMessage(el);
131128
});
132129
});
@@ -168,7 +165,6 @@ var textChat = (function textChat() {
168165
privateNotifyNewUserJoined('TEXT', privateMsg, 'JOIN');
169166
}
170167

171-
172168
if (data.headerId === currentRoom.headerId && data.userId !== clientVars.userId) {
173169
$.gritter.add({
174170
text: '<span class="author-name">' + user.name + '</span>' + 'has joined the text-chat, <b><i> "' + headTitle + '"</b></i>',
@@ -231,7 +227,6 @@ var textChat = (function textChat() {
231227
privateNotifyNewUserJoined('TEXT', privateMsg, 'LEAVE');
232228
}
233229

234-
235230
if (data.userId === clientVars.userId) {
236231
$headingRoom.removeAttr('data-text');
237232
share.roomBoxIconActive();
@@ -240,7 +235,7 @@ var textChat = (function textChat() {
240235
share.wrtcPubsub.emit('enable room buttons', headerId, 'LEAVE', $joinBtn);
241236
}
242237

243-
share.wrtcPubsub.emit('update store', data, headerId, 'LEAVE', 'TEXT', roomInfo, function() {});
238+
share.wrtcPubsub.emit('update store', data, headerId, 'LEAVE', 'TEXT', roomInfo, function () {});
244239

245240
if (cb && typeof cb === 'function') cb();
246241
}
@@ -275,7 +270,7 @@ var textChat = (function textChat() {
275270
function socketBulkUpdateRooms(rooms, info, target) {
276271
var roomsInfo = {};
277272
// create a roomInfo for each individual room
278-
Object.keys(rooms).forEach(function(headerId) {
273+
Object.keys(rooms).forEach(function (headerId) {
279274
var roomInfo = {
280275
present: rooms[headerId].length,
281276
list: rooms[headerId]
@@ -284,9 +279,9 @@ var textChat = (function textChat() {
284279
});
285280

286281
// bind roomInfo and send user to gateway_userJoin
287-
Object.keys(rooms).forEach(function(headerId) {
288-
rooms[headerId].forEach(function(user) {
289-
textChat.addUserToRoom(user, roomsInfo[headerId], 'text');
282+
Object.keys(rooms).forEach(function (headerId) {
283+
rooms[headerId].forEach(function (user) {
284+
addUserToRoom(user, roomsInfo[headerId], 'text');
290285
});
291286
});
292287
}
@@ -313,4 +308,4 @@ var textChat = (function textChat() {
313308
};
314309
})();
315310

316-
module.exports = textChat;
311+
module.exports = textChat;

Diff for: static/js/videoChat.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var videoChat = (function videoChat() {
4747
}
4848

4949
function isUserMediaAvailable() {
50-
return window.navigator.mediaDevices.getUserMedia({ audio: true, video: true }).catch(function getUserMedia(err) {
50+
return window.navigator.mediaDevices.getUserMedia({ audio: true, video: true })['catch'](function getUserMedia(err) {
5151
WRTC.showUserMediaError(err);
5252
console.error(err);
5353
});
@@ -239,8 +239,8 @@ var videoChat = (function videoChat() {
239239
});
240240

241241
// bind roomInfo and send user to gateway_userJoin
242-
Object.keys(rooms).forEach(function(headerId) {
243-
rooms[headerId].forEach(function(user) {
242+
Object.keys(rooms).forEach(function (headerId) {
243+
rooms[headerId].forEach(function (user) {
244244
videoChat.gateway_userJoin(user, roomsInfo[headerId], true);
245245
});
246246
});
@@ -299,4 +299,4 @@ var videoChat = (function videoChat() {
299299
};
300300
})();
301301

302-
module.exports = videoChat;
302+
module.exports = videoChat;

0 commit comments

Comments
 (0)