Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2645:130ae66c3b25
First work on #9. Using showdown-js (https://github.com/showdownjs/showdown)
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 19 Jan 2017 15:46:17 +0000 |
parents | 52e51b15f808 |
children | dc08127a5084 |
comparison
equal
deleted
inserted
replaced
2644:9c84c368f4a8 | 2645:130ae66c3b25 |
---|---|
593 this.popup.style.left = (window.innerWidth / 2) - 250 + 'px'; | 593 this.popup.style.left = (window.innerWidth / 2) - 250 + 'px'; |
594 this.popup.style.top = (window.innerHeight / 2) - 125 + 'px'; | 594 this.popup.style.top = (window.innerHeight / 2) - 125 + 'px'; |
595 | 595 |
596 this.popupContent = document.getElementById('popupContent'); | 596 this.popupContent = document.getElementById('popupContent'); |
597 | 597 |
598 this.popupTitle = document.getElementById('popupTitle'); | 598 this.popupTitle = document.getElementById('popupTitleHolder'); |
599 | 599 |
600 this.popupResponse = document.getElementById('popupResponse'); | 600 this.popupResponse = document.getElementById('popupResponse'); |
601 | 601 |
602 this.buttonProceed = document.getElementById('popup-proceed'); | 602 this.buttonProceed = document.getElementById('popup-proceed'); |
603 this.buttonProceed.onclick = function () { | 603 this.buttonProceed.onclick = function () { |
632 } | 632 } |
633 }; | 633 }; |
634 | 634 |
635 this.postNode = function () { | 635 this.postNode = function () { |
636 // This will take the node from the popupOptions and display it | 636 // This will take the node from the popupOptions and display it |
637 var node = this.popupOptions[this.currentIndex]; | 637 var node = this.popupOptions[this.currentIndex], |
638 converter = new showdown.Converter(); | |
638 this.popupResponse.innerHTML = ""; | 639 this.popupResponse.innerHTML = ""; |
639 this.popupTitle.textContent = node.specification.statement; | 640 this.popupTitle = converter.makeHtml(node.specification.statement); |
640 if (node.specification.type == 'question') { | 641 if (node.specification.type == 'question') { |
641 var textArea = document.createElement('textarea'); | 642 var textArea = document.createElement('textarea'); |
642 switch (node.specification.boxsize) { | 643 switch (node.specification.boxsize) { |
643 case 'small': | 644 case 'small': |
644 textArea.cols = "20"; | 645 textArea.cols = "20"; |
1120 this.currentIndex++; | 1121 this.currentIndex++; |
1121 if (this.currentIndex < this.popupOptions.length) { | 1122 if (this.currentIndex < this.popupOptions.length) { |
1122 this.postNode(); | 1123 this.postNode(); |
1123 } else { | 1124 } else { |
1124 // Reached the end of the popupOptions | 1125 // Reached the end of the popupOptions |
1125 this.popupTitle.textContent = ""; | 1126 this.popupTitle.innerHTML = ""; |
1126 this.popupResponse.innerHTML = ""; | 1127 this.popupResponse.innerHTML = ""; |
1127 this.hidePopup(); | 1128 this.hidePopup(); |
1128 for (var node of this.popupOptions) { | 1129 for (var node of this.popupOptions) { |
1129 this.store.postResult(node); | 1130 this.store.postResult(node); |
1130 } | 1131 } |