1515 * @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616 * @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18- * @version 1.8.51
18+ * @version 1.8.52
1919 *
2020 */
2121
@@ -80,7 +80,7 @@ const className = {
8080 shareVideoAudio: 'fab fa-youtube',
8181 kickOut: 'fas fa-sign-out-alt',
8282 chatOn: 'fas fa-comment',
83- chatOff: 'fas fa-comment-slash ',
83+ chatOff: 'fas fa-comment',
8484 ghost: 'fas fa-ghost',
8585 undo: 'fas fa-undo',
8686 captionOn: 'fas fa-closed-captioning',
@@ -688,6 +688,7 @@ let isCaptionPinned = false;
688688let isChatRoomVisible = false;
689689let isParticipantsVisible = false;
690690let isChatOpenedByParticipantsBtn = false;
691+ let isOpeningParticipants = false;
691692let isCaptionBoxVisible = false;
692693let isChatEmojiVisible = false;
693694let isChatMarkdownOn = false;
@@ -6324,13 +6325,15 @@ function setChatRoomBtn() {
63246325 setActiveConversation('public');
63256326 msgerDraggable.classList.remove('msger-pinned-sidebar-open');
63266327 msgerCPBtn.classList.remove('active');
6328+ syncChatToolbarButtons();
63276329 msgerInput.focus();
63286330 msgerChat.scrollTop = msgerChat.scrollHeight;
63296331 });
63306332
63316333 msgerSidebarCloseBtn?.addEventListener('click', () => {
63326334 msgerDraggable.classList.remove('msger-pinned-sidebar-open');
63336335 msgerCPBtn.classList.remove('active');
6336+ syncChatToolbarButtons();
63346337 closeAllMsgerParticipantDropdownMenus();
63356338 });
63366339
@@ -6361,12 +6364,7 @@ function setChatRoomBtn() {
63616364
63626365 // open hide chat room
63636366 chatRoomBtn.addEventListener('click', (e) => {
6364- if (!isChatRoomVisible) {
6365- showChatRoomDraggable();
6366- } else {
6367- hideChatRoomAndEmojiPicker();
6368- e.target.className = className.chatOn;
6369- }
6367+ !isChatRoomVisible ? showChatRoomDraggable() : hideChatRoomAndEmojiPicker();
63706368 });
63716369
63726370 // pin/unpin
@@ -6404,6 +6402,7 @@ function setChatRoomBtn() {
64046402 if (isChatPinned) {
64056403 const isOpen = msgerDraggable.classList.toggle('msger-pinned-sidebar-open');
64066404 msgerCPBtn.classList.toggle('active', isOpen);
6405+ syncChatToolbarButtons();
64076406 if (isOpen) {
64086407 searchPeerBarName?.focus();
64096408 } else {
@@ -6570,16 +6569,18 @@ function setParticipantsBtn() {
65706569
65716570 msgerDraggable.classList.remove('msger-pinned-sidebar-open');
65726571 msgerCPBtn.classList.remove('active');
6572+ syncChatToolbarButtons();
65736573 closeAllMsgerParticipantDropdownMenus();
65746574 screenReaderAccessibility.announceMessage('Participants list closed');
65756575 return;
65766576 }
65776577
65786578 msgerDraggable.classList.add('msger-pinned-sidebar-open');
65796579
6580- if (!isChatRoomVisible) {
6581- showChatRoomDraggable();
6582- }
6580+ isOpeningParticipants = true;
6581+ msgerCPBtn.classList.add('active');
6582+
6583+ !isChatRoomVisible ? showChatRoomDraggable() : syncChatToolbarButtons();
65836584
65846585 isChatOpenedByParticipantsBtn = openedChatForParticipants;
65856586
@@ -6591,6 +6592,8 @@ function setParticipantsBtn() {
65916592 await sleep(500);
65926593
65936594 msgerCPBtn.classList.add('active');
6595+ isOpeningParticipants = false;
6596+ syncChatToolbarButtons();
65946597 searchPeerBarName?.focus();
65956598 screenReaderAccessibility.announceMessage('Participants list opened');
65966599 return;
@@ -9911,20 +9914,37 @@ function showChatRoomDraggable() {
99119914 //chatLeftCenter();
99129915 chatCenter();
99139916
9914- chatRoomBtn.className = className.chatOff;
99159917 isChatRoomVisible = true;
99169918
99179919 if (!isMobileDevice && canBePinned() && pinChatByDefault && !isChatPinned && !isCaptionPinned) {
99189920 chatPin();
99199921 }
99209922
99219923 syncParticipantsPanelVisibility();
9924+ syncChatToolbarButtons();
99229925
99239926 setTippy(chatRoomBtn, 'Close the chat (C)', bottomButtonsPlacement);
9924- if (chatRoomBtn && chatRoomBtn.setAttribute) chatRoomBtn.setAttribute('aria-pressed', 'true');
99259927 screenReaderAccessibility.announceMessage('Chat opened');
99269928}
99279929
9930+ /**
9931+ * Sync the active visual state of the chat / participants toolbar buttons
9932+ * with the current chat & participants panel visibility.
9933+ */
9934+ function syncChatToolbarButtons() {
9935+ const participantsActive = isOpeningParticipants || !!(msgerCPBtn && msgerCPBtn.classList.contains('active'));
9936+ const chatActive = !!isChatRoomVisible && !participantsActive;
9937+ if (chatRoomBtn) {
9938+ chatRoomBtn.classList.toggle('is-active', chatActive);
9939+ chatRoomBtn.setAttribute('aria-pressed', chatActive ? 'true' : 'false');
9940+ }
9941+ if (participantsBtn) {
9942+ participantsBtn.classList.toggle('is-active', participantsActive);
9943+ participantsBtn.setAttribute('aria-pressed', participantsActive ? 'true' : 'false');
9944+ participantsBtn.setAttribute('aria-expanded', participantsActive ? 'true' : 'false');
9945+ }
9946+ }
9947+
99289948function shouldDockParticipantsPanel() {
99299949 return !isMobileDevice && window.innerWidth > 1200;
99309950}
@@ -9966,6 +9986,7 @@ function syncParticipantsPanelVisibility(forceVisible = null) {
99669986 msgerCPBtn.classList.remove('active');
99679987 closeAllMsgerParticipantDropdownMenus();
99689988 isParticipantsVisible = false;
9989+ syncChatToolbarButtons();
99699990 return;
99709991 }
99719992
@@ -9987,6 +10008,7 @@ function syncParticipantsPanelVisibility(forceVisible = null) {
998710008 }
998810009
998910010 isParticipantsVisible = shouldShow;
10011+ syncChatToolbarButtons();
999010012 toggleMsgerParticipantsEmptyNotice();
999110013}
999210014
@@ -10418,13 +10440,12 @@ function hideChatRoomAndEmojiPicker() {
1041810440 elemDisplay(msgerCP, false);
1041910441 elemDisplay(msgerEmojiPicker, false);
1042010442 setColor(msgerEmojiBtn, '#FFFFFF');
10421- chatRoomBtn.className = className.chatOn;
1042210443 isChatRoomVisible = false;
1042310444 isParticipantsVisible = false;
1042410445 isChatOpenedByParticipantsBtn = false;
1042510446 isChatEmojiVisible = false;
1042610447 setTippy(chatRoomBtn, 'Open the chat (C)', bottomButtonsPlacement);
10427- if (chatRoomBtn && chatRoomBtn.setAttribute) chatRoomBtn.setAttribute('aria-pressed', 'false' );
10448+ syncChatToolbarButtons( );
1042810449 screenReaderAccessibility.announceMessage('Chat closed');
1042910450}
1043010451
@@ -15873,7 +15894,7 @@ function showAbout() {
1587315894 Swal.fire({
1587415895 background: swBg,
1587515896 position: 'center',
15876- title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.51 ',
15897+ title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.52 ',
1587715898 imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1587815899 customClass: { image: 'img-about' },
1587915900 html: renderRoomTemplate('tpl-about-modal', {
0 commit comments