diff --git a/public/static/js/maps.js b/public/static/js/maps.js index 394c6c8..6d4199f 100644 --- a/public/static/js/maps.js +++ b/public/static/js/maps.js @@ -73,4 +73,40 @@ window.onresize = function () { Maps.calculateDescriptionDivHeights(); }; + + document.getElementById('multiForm').onsubmit = function (e) { + e.preventDefault(); + + var roomId = this.elements.roomId.value; + if (roomId.length !== 6) { + return; + } + + window.location.href = '/multiGame/' + this.elements.roomId.value; + }; + + document.getElementById('multiButton').onclick = function () { + MapGuesser.showModal('multi'); + document.getElementById('createNewRoomButton').href = '/multiGame/new/' + this.dataset.mapId; + document.getElementById('multiForm').elements.roomId.select(); + } + + document.getElementById('closePlayModeButton').onclick = function () { + MapGuesser.hideModal(); + }; + + document.getElementById('closeMultiButton').onclick = function () { + MapGuesser.hideModal(); + }; + + var buttons = document.getElementById('mapContainer').getElementsByClassName('playButton'); + for (var i = 0; i < buttons.length; i++) { + var button = buttons[i]; + + button.onclick = function () { + MapGuesser.showModal('playMode'); + document.getElementById('singleButton').href = '/game/' + this.dataset.mapId; + document.getElementById('multiButton').dataset.mapId = this.dataset.mapId; + }; + } })(); diff --git a/views/maps.php b/views/maps.php index d7b7df1..52822ab 100644 --- a/views/maps.php +++ b/views/maps.php @@ -5,6 +5,32 @@ TODO: condition! @extends(templates/layout_normal) +@section(pagemodal) + + +@endsection + @section(main)
@@ -35,15 +61,15 @@ TODO: condition!

- -
- Play this map +
+ + Edit -
- - Play this map - + + + +