[mirotalksfu] - add poll save results btn

هذا الالتزام موجود في:
Miroslav Pejic
2024-07-18 15:06:21 +02:00
الأصل c230627a36
التزام b569880cb4
6 ملفات معدلة مع 56 إضافات و10 حذوفات

عرض الملف

@@ -44,7 +44,7 @@ dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.12
* @version 1.5.13
*
*/

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.5.12",
"version": "1.5.13",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -9,7 +9,7 @@
width: 100%;
height: 100%;
max-width: 600px;
max-height: 600px;
max-height: 700px;
overflow-x: hidden;
}
@@ -160,9 +160,13 @@
color: #fff;
}
#pollCloseBtn {
.poll-header-btns {
display: flex;
gap: 10px;
margin-top: 15px;
margin-bottom: 15px;
position: absolute;
float: right;
right: 20px;
font-size: 1.6rem;
font-size: 1.3rem;
}

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.12
* @version 1.5.13
*
*/
@@ -185,6 +185,7 @@ const pollsContainer = getId('pollsContainer');
const addOptionButton = getId('addOptionButton');
const delOptionButton = getId('delOptionButton');
const optionsContainer = getId('optionsContainer');
const pollSaveResultsButton = getId('pollSaveResultsButton');
const selectedOptions = {};
let pollOpen = false;
@@ -345,6 +346,7 @@ function initClient() {
setTippy('chatShowParticipantsList', 'Toggle participants list', 'bottom');
setTippy('chatMaxButton', 'Maximize', 'bottom');
setTippy('chatMinButton', 'Minimize', 'bottom');
setTippy('pollSaveResultsButton', 'Save results', 'left');
setTippy('pollCloseBtn', 'Close', 'bottom');
setTippy('addOptionButton', 'Add option', 'top');
setTippy('delOptionButton', 'Delete option', 'top');
@@ -1581,6 +1583,9 @@ function handleButtons() {
pollCloseBtn.onclick = () => {
rc.togglePoll();
};
pollSaveResultsButton.onclick = () => {
rc.pollSaveResults();
};
addOptionButton.onclick = () => {
rc.pollAddOptions();
};
@@ -2956,7 +2961,6 @@ function saveObjToJsonFile(dataObj, name) {
a.click();
setTimeout(() => {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 100);
sound('download');
}
@@ -4275,7 +4279,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.5.12',
title: 'WebRTC SFU v1.5.13',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.5.12
* @version 1.5.13
*
*/
@@ -7955,6 +7955,41 @@ class RoomClient {
return options;
}
pollSaveResults() {
const polls = document.querySelectorAll('.poll');
const results = [];
polls.forEach((poll, index) => {
const question = poll.querySelector('.poll-h3').textContent;
const options = poll.querySelectorAll('.options div label');
const optionsText = Array.from(options)
.map((option) => option.textContent)
.join(', ');
const votersList = poll.querySelector('ul');
const voters = Array.from(votersList.querySelectorAll('li'))
.map((li) => li.textContent)
.join('\n');
results.push({
Poll: `${index + 1}`,
question: question,
options: optionsText,
voters: voters,
});
});
results.lengh > 0
? saveObjToJsonFile(results, 'Poll')
: this.userLog('info', 'No polling data available to save', 'top-end');
}
getPollFileName() {
const dateTime = getDataTimeStringFormat();
const roomName = this.room_id.trim();
return `Poll_${roomName}_${dateTime}.txt`;
}
sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}

عرض الملف

@@ -1441,8 +1441,11 @@ access to use this app.
<section id="pollRoom" class="pls-container fadein hidden">
<div id="pollHeader" class="poll-header">
<h2 class="poll-h2">Create a Poll</h2>
<div class="poll-header-btns">
<button id="pollSaveResultsButton" class="fas fa-floppy-disk"></button>
<button id="pollCloseBtn" class="fas fa-times"></button>
</div>
</div>
<div id="pollForm" class="poll-creation">
<form id="createPollForm" class="form">
<div class="form-group">