Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitriid/c5d9bac269d5898e1ab0b1816f6a2781 to your computer and use it in GitHub Desktop.
Save dmitriid/c5d9bac269d5898e1ab0b1816f6a2781 to your computer and use it in GitHub Desktop.
<div class="toast toast-success" id='status-color'>
  <button class="btn btn-clear float-right" id='start-stop-button'>START!</button>
  <span id='status-text'>Retrieving status...</span>
</div>
// где-то в фетче статуса

var statusToastEl = document.getElementById('status-color');
var statusTextEl = document.getElementById('status-text');
var runButtonEl = document.getElementById('start-stop-button');


if(!running) {
  statusToastEl.className = 'toast toast-error';
  statusTextEl.innerHTML = 'NOT RUNNING';
  runButtonEl.style.display = 'block'; // показываем кнопку
} else {
  statusToastEl.className = 'toast toast-success';
  statusTextEl.innerHTML = 'RUNNING';
  runButtonEl.style.display = 'none'; // прячем кнопку
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment