Skip to content

Commit

Permalink
Merge pull request #19 from nzzdev/release-1.1.4
Browse files Browse the repository at this point in the history
Release 1.1.4
  • Loading branch information
fuenkchen authored Jun 27, 2017
2 parents 879f642 + 65b78e8 commit ae20542
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nzz/q-quiz",
"version": "1.1.3",
"version": "1.1.4",
"description": "Q quiz",
"keywords": [
"storytelling",
Expand Down
10 changes: 10 additions & 0 deletions routes/locales.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const localesDir = __dirname + '/../resources/locales/';

module.exports = {
method: 'GET',
path:'/locales/{lng}/translation.json',
handler: function(request, reply) {
reply.file(localesDir + request.params.lng + '/translation.json')
.type('application/json');
}
}
3 changes: 2 additions & 1 deletion routes/routes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = [
require('./rendering-info/html-js.js'),
require('./stylesheet.js'),
require('./schema.js')
require('./schema.js'),
require('./locales.js')
]
.concat(
require('./scripts.js'),
Expand Down
8 changes: 5 additions & 3 deletions script_src/NumberGuessHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ export default class NumberGuessHandler {
this.data = data;
this.quizId = quizId;
this.toolBaseUrl = toolBaseUrl;
this.correctAnswer = data.correctAnswer;
this.correctAnswer = parseFloat(data.correctAnswer);
}

renderInput() {
const labelContainer = this.inputElement.parentNode.firstChild;
let label = labelContainer.querySelector('.s-input-range-position-label');
this.inputElement.setAttribute('value', this.defaultInputValue);
this.defaultInputValue = this.inputElement.value;
label.textContent = this.defaultInputValue;

this.inputElement.addEventListener('input', () => {
label.textContent = this.inputElement.value;
Expand All @@ -39,10 +38,13 @@ export default class NumberGuessHandler {
label.textContent = this.inputElement.value;
label.setAttribute('style', `left: ${(this.inputElement.value - this.min) / (this.max - this.min) * 100}%;`);
});

label.innerHTML = this.defaultInputValue;
label.setAttribute('style', `left: ${(this.inputElement.value - this.min) / (this.max - this.min) * 100}%;`);
}

getValue(event) {
return this.inputElement.value;
return parseFloat(this.inputElement.value);
}

isAnswerValid() {
Expand Down

0 comments on commit ae20542

Please sign in to comment.