Skip to content

Commit

Permalink
Updated JS code in static/js/personal_cabinet/telegram_bot_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
EXG1O committed Apr 26, 2023
1 parent 05c7483 commit 2490a9e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var setIntervalId;
}
}

getTelegramBotUsers();
if (telegramBotIsRunning) {
getTelegramBotUsers();
setIntervalId = setInterval(getTelegramBotUsers, 1500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
clearInterval(setIntervalId)

cardHeader.innerHTML = 'Telegram бот выключен';
cardHeader.setAttribute('class', cardHeader.getAttribute('class').replace('success', 'danger'));
cardHeader.classList.replace('bg-success', 'bg-danger');

startOrStopTelegramBotButton.innerHTML = 'Включить Telegram бота';
startOrStopTelegramBotButton.setAttribute('class', startOrStopTelegramBotButton.getAttribute('class').replace('danger', 'success'));
startOrStopTelegramBotButton.classList.replace('btn-outline-danger', 'btn-outline-success');
} else {
telegramBotIsRunning = true;

getTelegramBotUsers();
setIntervalId = setInterval(getTelegramBotUsers, 1500);

cardHeader.innerHTML = 'Telegram бот включен';
cardHeader.setAttribute('class', cardHeader.getAttribute('class').replace('danger', 'success'));
cardHeader.classList.replace('bg-danger', 'bg-success');

startOrStopTelegramBotButton.innerHTML = 'Выключить Telegram бота';
startOrStopTelegramBotButton.setAttribute('class', startOrStopTelegramBotButton.getAttribute('class').replace('success', 'danger'));
startOrStopTelegramBotButton.classList.replace('btn-outline-success', 'btn-outline-danger');
}

startOrStopTelegramBotButton.disabled = false;
Expand Down Expand Up @@ -114,7 +114,7 @@
if (telegramBotCommandKeyboard[0] != 'offKeyboard') {
document.querySelector(`#${telegramBotCommandKeyboard[0]}Radio`).checked = true;

keyboard.setAttribute('class', keyboard.getAttribute('class').replace(' d-none', ''));
keyboard.classList.remove('d-none');
keyboard.id = telegramBotCommandKeyboard[0];
keyboardButtons.innerHTML = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

function offKeyboard() {
if (keyboard.id != 'offKeyboard') {
keyboard.setAttribute('class', `${keyboard.getAttribute('class')} d-none`);
keyboard.classList.add('d-none');
keyboard.id = 'offKeyboard';

keyboardButtons.innerHTML = '';
Expand All @@ -96,7 +96,7 @@
let keyboardType = keyboardRadios[i].id.replace('Radio', '');

if (keyboard.id != keyboardType) {
keyboard.setAttribute('class', keyboard.getAttribute('class').replace(' d-none', ''));
keyboard.classList.remove('d-none');
keyboard.id = keyboardType;
keyboardButtons.innerHTML = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

if (telegramBotPrivateCheckBox.checked) {
for (let i = 0; i < telegramBotAllowedUserButtons.length; i++) {
telegramBotAllowedUserButtons[i].setAttribute('class', telegramBotAllowedUserButtons[i].getAttribute('class').replace(' d-none', ''));
telegramBotAllowedUserButtons[i].classList.remove('d-none');
}
} else {
for (let i = 0; i < telegramBotAllowedUserButtons.length; i++) {
telegramBotAllowedUserButtons[i].setAttribute('class', `${telegramBotAllowedUserButtons[i].getAttribute('class')} d-none`);
telegramBotAllowedUserButtons[i].classList.add('d-none');
}
}

Expand Down

0 comments on commit 2490a9e

Please sign in to comment.