Mercurial > hg > webaudioevaluationtool
changeset 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 | 9c84c368f4a8 |
children | dc08127a5084 |
files | index.html js/core.js test.html |
diffstat | 3 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/index.html Thu Jan 19 15:38:14 2017 +0000 +++ b/index.html Thu Jan 19 15:46:17 2017 +0000 @@ -17,6 +17,7 @@ <link rel='stylesheet' type='text/css' href='css/core.css'> <!-- Use jQuery hosted from Google CDN --> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>--> + <script type="text/javascript" src="https://cdn.rawgit.com/showdownjs/showdown/1.6.0/dist/showdown.min.js"></script> <script type="text/javascript" src="js/jquery-2.1.4.js"></script> <script type="text/javascript" src="js/loader.js"></script> </head> @@ -43,9 +44,7 @@ </div> <div id="popupHolder" class="popupHolder" style="visibility: hidden"> <div id="popupContent"> - <div id="popupTitleHolder"> - <span id="popupTitle"></span> - </div> + <div id="popupTitleHolder"></div> <div id="popupResponse"></div> </div> <button id="popup-proceed" class="popupButton">Next</button>
--- a/js/core.js Thu Jan 19 15:38:14 2017 +0000 +++ b/js/core.js Thu Jan 19 15:46:17 2017 +0000 @@ -595,7 +595,7 @@ this.popupContent = document.getElementById('popupContent'); - this.popupTitle = document.getElementById('popupTitle'); + this.popupTitle = document.getElementById('popupTitleHolder'); this.popupResponse = document.getElementById('popupResponse'); @@ -634,9 +634,10 @@ this.postNode = function () { // This will take the node from the popupOptions and display it - var node = this.popupOptions[this.currentIndex]; + var node = this.popupOptions[this.currentIndex], + converter = new showdown.Converter(); this.popupResponse.innerHTML = ""; - this.popupTitle.textContent = node.specification.statement; + this.popupTitle = converter.makeHtml(node.specification.statement); if (node.specification.type == 'question') { var textArea = document.createElement('textarea'); switch (node.specification.boxsize) { @@ -1122,7 +1123,7 @@ this.postNode(); } else { // Reached the end of the popupOptions - this.popupTitle.textContent = ""; + this.popupTitle.innerHTML = ""; this.popupResponse.innerHTML = ""; this.hidePopup(); for (var node of this.popupOptions) {
--- a/test.html Thu Jan 19 15:38:14 2017 +0000 +++ b/test.html Thu Jan 19 15:46:17 2017 +0000 @@ -17,6 +17,7 @@ <link rel='stylesheet' type='text/css' href='css/core.css'> <!-- Use jQuery hosted from Google CDN --> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>--> + <script type="text/javascript" src="https://cdn.rawgit.com/showdownjs/showdown/1.6.0/dist/showdown.min.js"></script> <script type="text/javascript" src="js/jquery-2.1.4.js"></script> <script type="text/javascript" src="js/loader.js"></script> </head> @@ -29,9 +30,7 @@ </div> <div id="popupHolder" class="popupHolder" style="visibility: hidden"> <div id="popupContent"> - <div id="popupTitleHolder"> - <span id="popupTitle"></span> - </div> + <div id="popupTitleHolder"></div> <div id="popupResponse"></div> </div> <button id="popup-proceed" class="popupButton">Next</button>