mirror of
https://github.com/koel/koel
synced 2024-11-28 15:00:42 +00:00
Arrayify querySelectorAll() results
This commit is contained in:
parent
e9645bb408
commit
94a54bd182
4 changed files with 9 additions and 11 deletions
|
@ -126,18 +126,16 @@ export default {
|
|||
* Update the current user's profile.
|
||||
*/
|
||||
update () {
|
||||
const passwordFields = Array.from(
|
||||
document.querySelectorAll('#inputProfilePassword, #inputProfileConfirmPassword')
|
||||
)
|
||||
// A little validation put in a small place.
|
||||
if ((this.pwd || this.confirmPwd) && this.pwd !== this.confirmPwd) {
|
||||
each(
|
||||
document.querySelectorAll('#inputProfilePassword, #inputProfileConfirmPassword'),
|
||||
el => $.addClass(el, 'error')
|
||||
)
|
||||
each(passwordFields, el => $.addClass(el, 'error'))
|
||||
return
|
||||
}
|
||||
|
||||
each(document.querySelectorAll('#inputProfilePassword, #inputProfileConfirmPassword'), el => {
|
||||
$.removeClass(el, 'error')
|
||||
})
|
||||
each(passwordFields, el => $.removeClass(el, 'error'))
|
||||
|
||||
userStore.updateProfile(this.pwd).then(() => {
|
||||
this.pwd = ''
|
||||
|
|
|
@ -149,7 +149,7 @@ export default {
|
|||
* they don't appear off-screen.
|
||||
*/
|
||||
mounted () {
|
||||
each(this.$el.querySelectorAll('.has-sub'), item => {
|
||||
each(Array.from(this.$el.querySelectorAll('.has-sub')), item => {
|
||||
const submenu = item.querySelector('.submenu')
|
||||
if (!submenu) {
|
||||
return
|
||||
|
|
|
@ -135,7 +135,7 @@ export default {
|
|||
*/
|
||||
createSliders () {
|
||||
const config = equalizerStore.get()
|
||||
each(document.querySelectorAll('#equalizer .slider'), (el, i) => {
|
||||
each(Array.from(document.querySelectorAll('#equalizer .slider')), (el, i) => {
|
||||
nouislider.create(el, {
|
||||
connect: [false, true],
|
||||
// the first element is the preamp. The rest are gains.
|
||||
|
@ -192,7 +192,7 @@ export default {
|
|||
* Load a preset when the user select it from the dropdown.
|
||||
*/
|
||||
loadPreset (preset) {
|
||||
each(document.querySelectorAll('#equalizer .slider'), (el, i) => {
|
||||
each(Array.from(document.querySelectorAll('#equalizer .slider')), (el, i) => {
|
||||
// We treat our preamp slider differently.
|
||||
if ($.is(el.parentNode, '.preamp')) {
|
||||
this.changePreampGain(preset.preamp)
|
||||
|
|
|
@ -24,7 +24,7 @@ export default {
|
|||
* Close all submenus.
|
||||
*/
|
||||
close () {
|
||||
each(this.$el.querySelectorAll('.submenu'), el => {
|
||||
each(Array.from(this.$el.querySelectorAll('.submenu')), el => {
|
||||
el.style.display = 'none'
|
||||
})
|
||||
this.shown = false
|
||||
|
|
Loading…
Reference in a new issue