Add select field to select game files
parent
6a8b0425fa
commit
6b887c7029
|
@ -23,6 +23,14 @@ class Nikoli.Game
|
||||||
|
|
||||||
buttons_div.appendChild button
|
buttons_div.appendChild button
|
||||||
|
|
||||||
|
files_select = document.createElement 'select'
|
||||||
|
files_select.classList.add 'files'
|
||||||
|
files_select.addEventListener('change', (evt) =>
|
||||||
|
@file = evt.target.value
|
||||||
|
@newgame())
|
||||||
|
|
||||||
|
buttons_div.appendChild files_select
|
||||||
|
|
||||||
@board.appendChild buttons_div
|
@board.appendChild buttons_div
|
||||||
|
|
||||||
@board.querySelector('.check').addEventListener('click', @check.bind(this))
|
@board.querySelector('.check').addEventListener('click', @check.bind(this))
|
||||||
|
@ -92,6 +100,15 @@ class Nikoli.Game
|
||||||
@files = files
|
@files = files
|
||||||
@file = @files[0]
|
@file = @files[0]
|
||||||
|
|
||||||
|
select = @board.querySelector('select')
|
||||||
|
select.innerHTML = ''
|
||||||
|
@files.forEach((file) ->
|
||||||
|
option = document.createElement('option')
|
||||||
|
option.text = file
|
||||||
|
select.appendChild option
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@newgame() unless @game?
|
@newgame() unless @game?
|
||||||
|
|
||||||
newgame: ->
|
newgame: ->
|
||||||
|
|
Loading…
Reference in New Issue