Compare commits

...

3 Commits

Author SHA1 Message Date
82033ac3b9 Add mobile styles 2020-11-28 09:21:23 +01:00
eae2282340 Add keyboard controls 2020-11-27 18:31:41 +01:00
238567e5a2 Add more questions 2020-11-27 18:31:28 +01:00
6 changed files with 208 additions and 14 deletions

View File

@ -1,11 +1,16 @@
* {
box-sizing: border-box; }
body {
min-height: 100vh;
height: 100vh;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-family: Roboto;
background-image: url(../img/background.jpg);
background-size: cover; }
background-size: cover;
background-attachment: fixed; }
body .screen {
width: 800px;
max-width: 90vw;
@ -70,7 +75,12 @@ body {
margin-bottom: 2px;
border: 1px solid lightgray;
border-radius: 0;
text-align: left; }
text-align: left;
counter-increment: answer; }
.ingame-screen .question .question-answers .answer::before {
content: counter(answer);
color: lightgray;
padding: 0.5em; }
.ingame-screen .question .question-estimate {
display: grid;
grid-template-columns: 7fr 3fr; }
@ -140,5 +150,36 @@ body {
transform: scale(1.2); }
100% {
transform: scale(1); } }
@media screen and (max-width: 600px) {
body {
margin: 0;
padding: 0; }
body .screen {
width: 100vw;
height: 100vh;
max-width: 100vw;
min-height: 100vh;
overflow-y: scroll; }
body .screen .headline {
text-align: center; }
body .screen .btn-start {
padding: 1rem 2rem;
width: auto; }
body .header {
flex-direction: column; }
body .question-text {
font-size: 14pt; }
body .question.estimate {
max-width: 95vw;
height: auto;
box-sizing: border-box; }
body .question.estimate .question-estimate {
display: block; }
body .question.estimate .input-estimate,
body .question.estimate .btn-submit-estimate {
width: 100%;
padding: 0.5rem 1rem; }
body .question.estimate .question-result {
width: 60%; } }
/*# sourceMappingURL=style.css.map */

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAAA,IAAI;EACF,UAAU,EAAE,KAAK;EACjB,OAAO,EAAE,IAAI;EACb,WAAW,EAAE,MAAM;EACnB,eAAe,EAAE,MAAM;EACvB,WAAW,EAAE,MAAM;EACnB,gBAAgB,EAAE,0BAA0B;EAC5C,eAAe,EA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AAI;IAEf,YAAO;MACL,cAAc,EAAE,MAAM;IAExB,mBAAc;MACZ,SAAS,EAAE,IAAI;IAEjB,uBAAkB;MAChB,SAAS,EAAE,IAAI;MACf,MAAM,EAAE,IAAI;MACZ,UAAU,EAAE,UAAU;MAEtB,0CAAkB;QAChB,OAAO,EAAE,KAAK;MAEhB;kDAAgB;QAEd,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,WAAU;MAErB,wCAAgB;QACd,KAAK,EAAE,GAAG",
"sources": ["style.sass"],
"names": [],
"file": "style.css"

View File

@ -1,11 +1,16 @@
*
box-sizing: border-box
body
min-height: 100vh
height: 100vh
box-sizing: border-box
display: flex
align-items: center
justify-content: center
font-family: Roboto
background-image: url(../img/background.jpg)
background-size: cover
background-attachment: fixed
.screen
width: 800px
@ -91,6 +96,12 @@ body
border: 1px solid lightgray
border-radius: 0
text-align: left
counter-increment: answer
&::before
content: counter(answer)
color: lightgray
padding: .5em
.question-estimate
display: grid
@ -174,3 +185,44 @@ body
transform: scale(1.2)
100%
transform: scale(1)
@media screen and (max-width: 600px)
body
margin: 0
padding: 0
.screen
width: 100vw
height: 100vh
max-width: 100vw
min-height: 100vh
overflow-y: scroll
.headline
text-align: center
.btn-start
padding: 1rem 2rem
width: auto
.header
flex-direction: column
.question-text
font-size: 14pt
.question.estimate
max-width: 95vw
height: auto
box-sizing: border-box
.question-estimate
display: block
.input-estimate,
.btn-submit-estimate
width: 100%
padding: .5rem 1rem
.question-result
width: 60%

View File

@ -12,7 +12,7 @@
<section v-if="mode === STARTSCREEN" class="start-screen screen">
<img class="logo" src="img/wiai-logo.png" alt="Logo der Fachschaft WIAI"/>
<h1 class="headline">Willkommen zum WIAI-Weihnachtsquiz!</h1>
<button v-on:click="enterGame" class="btn-start" tabindex="0" v-on:keyup.enter="enterGame">Starten</button>
<button v-on:click="enterGame" class="btn-start" v-focus v-on:keyup.enter="enterGame">Starten</button>
</section>
<section v-if="mode === INGAME" class="ingame-screen screen">
@ -33,6 +33,7 @@
<div class="question-answers">
<button
v-for="answer in currentQuestion.answers"
v-bind:disabled="currentQuestionAnswered"
@click="evaluateChoice(answer.id)"
v-bind:class="{ correct: isCorrectAnswer(answer.id), answer: true, chosen: isUserChoice(answer.id) }">
{{answer.text}}
@ -43,8 +44,8 @@
<article v-if="isEstimate" class="question estimate" v-bind:class="{revealed: currentQuestionAnswered}">
<h2 class="question-text">{{currentQuestion.text}}</h2>
<div class="question-estimate">
<input v-bind:value="currentEstimate" id="input-estimate" type="number"
min="0" class="input-estimate" @v-keyup.enter="evaluateEstimate" v-bind:disabled="currentQuestionAnswered"/>
<input value="" id="input-estimate" type="number"
min="0" class="input-estimate" @v-on:keyup.enter="evaluateEstimate" v-bind:disabled="currentQuestionAnswered" v-focus/>
<input type="submit" @click="evaluateEstimate" class="btn-submit-estimate" v-bind:disabled="currentQuestionAnswered" value="Auswerten"/>
</div>

View File

@ -1,3 +1,9 @@
Vue.directive('focus', {
inserted: function (el) {
el.focus()
}
})
const app = new Vue({
el: '#app',
data: {
@ -27,12 +33,36 @@ const app = new Vue({
beforeMount () {
this.questions = []
const questionCandidates = questionCatalog.slice()
for (let i = 0; i < Math.min(20, questionCatalog.length); i++) {
for (let i = 0; i < Math.min(9, questionCatalog.length); i++) {
const index = Math.floor(Math.random() * questionCandidates.length)
this.questions.push(questionCandidates[index])
questionCandidates.splice(index, 1)
}
},
mounted: function () {
window.addEventListener('keypress', e => {
switch (e.key) {
case '1':
this.isChoice && !this.currentQuestionAnswered && this.evaluateChoice(0)
return
case '2':
this.isChoice && !this.currentQuestionAnswered && this.evaluateChoice(1)
return
case '3':
this.isChoice && !this.currentQuestionAnswered && this.evaluateChoice(2)
return
case 'Enter':
if (this.currentQuestionAnswered) {
this.showNextQuestion()
} else if (this.isEstimate && document.querySelector('#input-estimate').value !== '') {
this.evaluateEstimate()
}
default:
console.log(e.key)
return
}
})
},
methods: {
enterGame: function (event) {
this.mode = this.INGAME
@ -52,7 +82,7 @@ const app = new Vue({
this.currentQuestionAnswerID = answerID
}
},
evaluateEstimate: function (value) {
evaluateEstimate: function () {
if (!this.currentQuestionAnswered) {
const estimateInput = document.querySelector('#input-estimate')
@ -95,17 +125,22 @@ const app = new Vue({
}
}
},
showNextQuestion: function (event) {
showNextQuestion: function () {
if (this.currentQuestionAnswered) {
if (this.currentQuestion.type === 'estimate') {
document.querySelector('#input-estimate').value = ''
}
this.currentQuestionAnswered = false
this.currentQuestionAnswerID = null
if (this.currentQuestionID + 1 < this.questions.length) {
this.currentQuestionID++
this.$forceUpdate
} else {
this.mode = this.ENDSCREEN
}
}
event.stopPropagation()
},
isCorrectAnswer: function (answerID) {
return this.currentQuestion.correctAnswerID === answerID

View File

@ -21,7 +21,7 @@ const questionCatalog = [
},
{
type: 'choice',
text: 'Wie hoch ist der Bamberger Kaiserdom?',
text: 'Wie hoch ist der Bamberger Dom?',
correctAnswerID: 1,
answers: [
{ id: 2, text: 'ca. 62 Meter' },
@ -39,6 +39,71 @@ const questionCatalog = [
{ id: 2, text: 'Honorius III. (12161227)' }
]
},
{
type: 'choice',
text: 'In welcher Straße befindet sich die Außenfassade des Hauses von Herrn Taschenbier in der Verfilmung von „Das Sams“ durch den holländischen Regisseur Ben Verbong?',
correctAnswerID: 2,
answers: [
{ id: 0, text: 'Kleberstraße 30' },
{ id: 1, text: 'Grüner Markt 13' },
{ id: 2, text: 'Judenstraße 16' }
]
},
{
type: 'choice',
text: 'In welchem Jahr wurde nach einem Großbrand im Bamberger Dom ein kompletter Neubau erforderlich?',
correctAnswerID: 1,
answers: [
{ id: 0, text: '1081 n. Chr.' },
{ id: 1, text: '1185 n. Chr.' },
{ id: 2, text: '1020 n. Chr.' }
]
},
{
type: 'estimate',
text: 'Wie viele für Studierende zugängliche Toiletten („Porzellanthröne”) gibt es an der Weberei?',
correctAnswer: 109
},
{
type: 'estimate',
text: 'Wie viele Professor:innen lehren und forschen aktuell an der Fakultät WIAI?',
correctAnswer: 16
},
{
type: 'estimate',
text: 'Wie viele Studierende sind im Wintersemester 2020/21 insgesamt aktuell an der Universität Bamberg eingeschrieben? (Stand: 29.10.2020)',
correctAnswer: 12475
},
{
type: 'estimate',
text: 'Wie viele Personen studieren aktuell an der Fakultät WIAI? (Stand: 29.10.2020)',
correctAnswer: 2105
},
{
type: 'estimate',
text: 'Wie viele neue Studierende haben dieses Wintersemester trotz Corona an der Fakultät WIAI ein Studium begonnen? (Stand: 29.10.2020)',
correctAnswer: 334
},
{
type: 'estimate',
text: 'Wie hoch über dem Meeresspiegel liegt die Altenburg und überblickt somit ungehindert ganz Bamberg?',
correctAnswer: 390
},
{
type: 'estimate',
text: 'Auf wie viele Standorte ist die Universität Bamberg verteilt? (einschließlich Prüfungsräume wie den “Volkspark”)',
correctAnswer: 57
},
{
type: 'estimate',
text: 'Wie viele eigene (Teil-)Bibliotheken hat die Universität Bamberg?',
correctAnswer: 7
},
{
type: 'estimate',
text: 'Wie viele Jahre vergingen zwischen der Grundsteinlegung des Bamberger Doms und seiner Weihe?',
correctAnswer: 8
},
{
type: 'estimate',
text: 'Wie viele wissenschaftliche Mitarbeiter:innen und Postdocs treiben die Forschung und die Lehre an unserer Fakultät voran? (externe Doktorand:innen ausgeschlossen)',