Mercurial > hg > webaudioevaluationtool
changeset 2878:05c7ff06de67
Fix sort button in MUSHRA
author | Hagen Wierstorf <hagen.wierstorf@tu-berlin.de> |
---|---|
date | Mon, 19 Jun 2017 13:35:31 +0200 |
parents | 5164a6f53a02 |
children | 061336f961de |
files | interfaces/mushra.js |
diffstat | 1 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/interfaces/mushra.js Wed May 31 12:02:56 2017 +0100 +++ b/interfaces/mushra.js Mon Jun 19 13:35:31 2017 +0200 @@ -239,20 +239,15 @@ interfaceContext.commentBoxes.showCommentBoxes(feedbackHolder, true); break; case "fragmentSort": - (function () { - var button = document.createElement("button"); + var button = document.getElementById('sort'); + if (button === null) { + button = document.createElement("button"); + button.id = 'sort'; button.textContent = "Sort"; button.style.display = 'inline-block'; var container = document.getElementById("interface-buttons"); var neighbour = container.lastElementChild; - while (neighbour.nodeName !== "BUTTON") { - neighbour = neighbour.previousElementSibling; - } - if (neighbour.nextElementSibling) { - container.insertBefore(button, neighbour.nextElementSibling); - } else { - container.appendChild(button); - } + container.appendChild(button); button.onclick = function () { var sortIndex = interfaceContext.sortFragmentsByScore(); var sliderBox = document.getElementById("slider-holder"); @@ -268,7 +263,7 @@ sliderBox.appendChild(nodes[j].interfaceDOM.holder); } }; - })(); + } break; } }