diff --git a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/init.js b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/init.js index 7f278a67..1dcc27a4 100644 --- a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/init.js +++ b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/init.js @@ -70,6 +70,7 @@ var setIntervalId; } } + getTelegramBotUsers(); if (telegramBotIsRunning) { getTelegramBotUsers(); setIntervalId = setInterval(getTelegramBotUsers, 1500); diff --git a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/main.js b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/main.js index f91c74de..4b480179 100644 --- a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/main.js +++ b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/main.js @@ -19,10 +19,10 @@ 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; @@ -30,10 +30,10 @@ 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; @@ -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 = ''; diff --git a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/add_or_edit_telegram_bot_command_modal.js b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/add_or_edit_telegram_bot_command_modal.js index 2edf17fb..439028e4 100644 --- a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/add_or_edit_telegram_bot_command_modal.js +++ b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/add_or_edit_telegram_bot_command_modal.js @@ -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 = ''; @@ -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 = ''; diff --git a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/info_about_telegram_bot_modal.js b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/info_about_telegram_bot_modal.js index c6906aad..3a883a55 100644 --- a/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/info_about_telegram_bot_modal.js +++ b/constructor_telegram_bots/static/js/personal_cabinet/telegram_bot_menu/modals/info_about_telegram_bot_modal.js @@ -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'); } }