|
|
@ -54,19 +54,28 @@ class Accounts { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_setKeydown() { |
|
|
|
|
|
|
|
var dropdown = this._accountsList.querySelector(".dropdown") |
|
|
|
|
|
|
|
dropdown.addEventListener("keydown", (ev) => { |
|
|
|
|
|
|
|
if (ev.keyCode == 27) { |
|
|
|
|
|
|
|
dropdown.classList.add("hide") |
|
|
|
|
|
|
|
this._accountsButton.focus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_setButton() { |
|
|
|
_setButton() { |
|
|
|
var dropdown = this._accountsList.querySelector(".dropdown") |
|
|
|
var dropdown = this._accountsList.querySelector(".dropdown") |
|
|
|
this._accountsButton.addEventListener("click", (ev) => { |
|
|
|
document.querySelector("#screen").addEventListener("click", (ev) => { |
|
|
|
ev.stopPropagation() |
|
|
|
if (ev.target == this._accountsButton || ev.target.parentElement == this._accountsButton) { |
|
|
|
if (dropdown.classList.contains("hide")) { |
|
|
|
dropdown.classList.toggle("hide") |
|
|
|
dropdown.classList.remove("hide") |
|
|
|
} else |
|
|
|
} else { |
|
|
|
if (ev.target != this._accountsList && ev.target.closest(".dropdown") == null) { |
|
|
|
dropdown.classList.add("hide") |
|
|
|
dropdown.classList.add("hide") |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
var screen = document.querySelector("#screen") |
|
|
|
document.querySelector("#screen").addEventListener("focusin", (ev) => { |
|
|
|
screen.addEventListener("click", (ev) => { |
|
|
|
if (!dropdown.contains(document.activeElement) && document.activeElement != this._accountsButton) { |
|
|
|
if (ev.target != dropdown) { |
|
|
|
|
|
|
|
dropdown.classList.add("hide") |
|
|
|
dropdown.classList.add("hide") |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -86,6 +95,7 @@ class Accounts { |
|
|
|
this._updateOnStartup() |
|
|
|
this._updateOnStartup() |
|
|
|
this._setAccountList() |
|
|
|
this._setAccountList() |
|
|
|
this._setButton() |
|
|
|
this._setButton() |
|
|
|
|
|
|
|
this._setKeydown() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|