Skip to content

Commit

Permalink
[mirotalkwebrtc] - add settings/language
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Dec 1, 2024
1 parent d9d96ed commit 13b0c70
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 2 deletions.
34 changes: 34 additions & 0 deletions frontend/css/client.css
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ iframe {
}
}

.settingsDiv,
.accountDiv,
.addRowDiv {
position: fixed;
Expand All @@ -555,6 +556,7 @@ iframe {
color: var(--text-color);
}

.settingsDiv label,
.accountDiv label,
.addRowDiv label {
display: block;
Expand All @@ -563,6 +565,20 @@ iframe {
font-size: 16px;
}

.settingsDiv select {
margin-top: 10px !important;
width: 100%;
padding: 12px;
border-radius: 5px;
border: 0.1px solid var(--border-color);
background: var(--body-color);
color: var(--text-color);
color-scheme: var(--input-color-schema);
font-size: 16px;
outline: none;
cursor: pointer;
}

.accountDiv input,
.addRowDiv input {
padding: 12px;
Expand Down Expand Up @@ -591,11 +607,13 @@ iframe {
width: auto;
}

.settingsDiv i,
.accountDiv i,
.addRowDiv i {
cursor: pointer;
}

.settingsDiv i:hover,
.accountDiv i:hover,
.addRowDiv i:hover {
color: var(--color-hover);
Expand Down Expand Up @@ -831,6 +849,19 @@ tr:nth-child(even) {
background: transparent;
}

/* google translate */
.skiptranslate iframe,
.goog-te-banner-frame.skiptranslate {
display: none !important;
position: absolute !important;
top: -10000px !important;
}

#google_translate_element select {
background: var(--secondary-color) !important;
color: var(--text-color) !important;
}

.fadeIn {
-webkit-animation: fadeIn ease-in 1;
-moz-animation: fadeIn ease-in 1;
Expand Down Expand Up @@ -934,6 +965,9 @@ tr:nth-child(even) {
.accountDiv {
width: 100%;
}
.settingsDiv {
width: 100%;
}
.dash-content .boxes {
display: flex;
}
Expand Down
13 changes: 13 additions & 0 deletions frontend/html/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<script defer src="../js/swal.js"></script>
<script defer src="../js/api.js"></script>
<script defer src="../js/client.js"></script>
<script defer src="../js/translate.js"></script>
</head>

<body>
Expand Down Expand Up @@ -110,6 +111,12 @@
<span class="link-name">Account</span>
</a>
</li>
<li>
<a id="navSet" href="javascript:void(0)">
<i class="uil uil-setting"></i>
<span class="link-name">Settings</span>
</a>
</li>
<li class="mode">
<a href="javascript:void(0)">
<i class="uil uil-moon"></i>
Expand Down Expand Up @@ -307,6 +314,12 @@
<button id="account-delete">Delete</button>
</div>

<div id="settingsDiv" class="settingsDiv hidden">
<i id="settings-close-btn" class="uil uil-multiply"></i>
<label for="google_translate_element">Language</label>
<div id="google_translate_element"></div>
</div>

<div id="p2p" class="dash-iframe fadeIn">
<iframe
id="p2p-iframe"
Expand Down
26 changes: 25 additions & 1 deletion frontend/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license For private project or commercial purposes contact us at: [email protected] or purchase it directly via Code Canyon:
* @license https://codecanyon.net/item/a-selfhosted-mirotalks-webrtc-rooms-scheduler-server/42643313
* @author Miroslav Pejic - [email protected]
* @version 1.1.21
* @version 1.1.22
*/

const isMobile = !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i.test(
Expand All @@ -28,6 +28,7 @@ const navSFU = document.getElementById('navSFU');
const navBRO = document.getElementById('navBRO');
const navSup = document.getElementById('navSup');
const navAcc = document.getElementById('navAcc');
const navSet = document.getElementById('navSet');

const myProfile = document.getElementById('myProfile');

Expand Down Expand Up @@ -83,6 +84,9 @@ const accountServicesAllowed = document.getElementById('account-services-allowed
const accountRoomsAllowed = document.getElementById('account-rooms-allowed');
const accountDelete = document.getElementById('account-delete');

const settingsDiv = document.getElementById('settingsDiv');
const settingsClose = document.getElementById('settings-close-btn');

const addRowDiv = document.getElementById('addRowDiv');
const openAddBtn = document.getElementById('open-add-btn');
const closeAddBtn = document.getElementById('add-close-btn');
Expand Down Expand Up @@ -360,10 +364,15 @@ navBRO.addEventListener('click', () => {
navSup.addEventListener('click', () => {
openURL(config.Author.Support, true);
});

navAcc.addEventListener('click', () => {
getMyAccount();
});

navSet.addEventListener('click', () => {
toggleSettings();
});

hideBoxesDS.addEventListener('click', () => {
toggleBoxesDS(false);
});
Expand Down Expand Up @@ -401,6 +410,10 @@ accountDelete.addEventListener('click', () => {
delMyAccount();
});

settingsClose.addEventListener('click', () => {
toggleSettings();
});

function navShow(elements = []) {
elemDisplay(search, false);
elemDisplay(dsDash, false);
Expand Down Expand Up @@ -453,6 +466,17 @@ function toggleAccount() {
}
}

function toggleSettings() {
if (settingsDiv.classList.contains('show')) {
animateCSS(settingsDiv, 'fadeOutRight').then((ok) => {
settingsDiv.classList.toggle('show');
});
} else {
settingsDiv.classList.toggle('show');
animateCSS(settingsDiv, 'fadeInRight');
}
}

async function showDataTable() {
navDash.click();

Expand Down
10 changes: 10 additions & 0 deletions frontend/js/translate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

const trScript = document.createElement('script');
trScript.setAttribute('async', '');
trScript.setAttribute('src', 'https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit');
document.head.appendChild(trScript);

function googleTranslateElementInit() {
new google.translate.TranslateElement({ pageLanguage: 'en' }, 'google_translate_element');
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalkwebrtc",
"version": "1.1.21",
"version": "1.1.22",
"description": "MiroTalk WebRTC admin",
"main": "server.js",
"scripts": {
Expand Down

0 comments on commit 13b0c70

Please sign in to comment.