anki/qt/aqt/data/web/js/toolbar.ts

30 lines
775 B
TypeScript
Raw Normal View History

2021-04-13 10:57:08 +02:00
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
2021-10-18 07:20:00 +02:00
/* eslint
@typescript-eslint/no-unused-vars: "off",
*/
enum SyncState {
NoChanges = 0,
Normal,
Full,
}
function updateSyncColor(state: SyncState) {
const elem = document.getElementById("sync");
switch (state) {
case SyncState.NoChanges:
elem.classList.remove("full-sync", "normal-sync");
break;
case SyncState.Normal:
elem.classList.add("normal-sync");
elem.classList.remove("full-sync");
break;
case SyncState.Full:
elem.classList.add("full-sync");
elem.classList.remove("normal-sync");
break;
}
}