[mirotalk] - feat: replace typewriter with shuffle text effect for room name generation
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
# ====================================================
|
||||
# MiroTalk P2P v.1.8.01 - Environment Configuration
|
||||
# MiroTalk P2P v.1.8.02 - Environment Configuration
|
||||
# ====================================================
|
||||
|
||||
# App environment
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* ==============================================
|
||||
* MiroTalk P2P v.1.8.01 - Configuration File
|
||||
* MiroTalk P2P v.1.8.02 - Configuration File
|
||||
* ==============================================
|
||||
*
|
||||
* This file is the central configuration source.
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ dependencies: {
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.8.01
|
||||
* @version 1.8.02
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.01",
|
||||
"version": "1.8.02",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.01",
|
||||
"version": "1.8.02",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@mattermost/client": "11.5.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.8.01",
|
||||
"version": "1.8.02",
|
||||
"description": "A free WebRTC browser-based video call",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -4388,3 +4388,9 @@ body {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Shuffle text effect */
|
||||
.shuffle-active {
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ let brand = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: 'WebRTC P2P v1.8.01',
|
||||
title: 'WebRTC P2P v1.8.02',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.8.01
|
||||
* @version 1.8.02
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -14966,7 +14966,7 @@ function showAbout() {
|
||||
Swal.fire({
|
||||
background: swBg,
|
||||
position: 'center',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.01',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.02',
|
||||
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
|
||||
customClass: { image: 'img-about' },
|
||||
html: `
|
||||
|
||||
+35
-12
@@ -144,27 +144,49 @@ function getRandomNumber(length) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Typing Effect
|
||||
// Shuffle Text Effect
|
||||
|
||||
let i = 0;
|
||||
let txt = num + adjective + noun;
|
||||
let speed = 100;
|
||||
|
||||
/**
|
||||
* Set room name with typewriter effect
|
||||
* Shuffle text effect for input fields
|
||||
* @param {HTMLInputElement} input
|
||||
* @param {string} finalValue
|
||||
* @param {number} duration
|
||||
*/
|
||||
function typeWriter() {
|
||||
if (i < txt.length) {
|
||||
roomName.value += txt.charAt(i);
|
||||
i++;
|
||||
setTimeout(typeWriter, speed);
|
||||
}
|
||||
function shuffleText(input, finalValue, duration = 600) {
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const steps = 10;
|
||||
const interval = duration / steps;
|
||||
let step = 0;
|
||||
|
||||
input.classList.add('shuffle-active');
|
||||
|
||||
const timer = setInterval(() => {
|
||||
step++;
|
||||
const progress = step / steps;
|
||||
let display = '';
|
||||
for (let i = 0; i < finalValue.length; i++) {
|
||||
if (i < finalValue.length * progress) {
|
||||
display += finalValue[i];
|
||||
} else {
|
||||
display += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
}
|
||||
input.value = display;
|
||||
|
||||
if (step >= steps) {
|
||||
clearInterval(timer);
|
||||
input.value = finalValue;
|
||||
setTimeout(() => input.classList.remove('shuffle-active'), 300);
|
||||
}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
const roomName = document.getElementById('roomName');
|
||||
if (roomName) {
|
||||
roomName.value = '';
|
||||
typeWriter();
|
||||
shuffleText(roomName, txt);
|
||||
|
||||
roomName.onkeyup = (e) => {
|
||||
if (e.keyCode === 13) {
|
||||
@@ -223,7 +245,8 @@ if (adultCnt) {
|
||||
}
|
||||
|
||||
function genRoom() {
|
||||
document.getElementById('roomName').value = getUUID4();
|
||||
const input = document.getElementById('roomName');
|
||||
shuffleText(input, getUUID4());
|
||||
}
|
||||
|
||||
function getUUID4() {
|
||||
|
||||
Reference in New Issue
Block a user