Mercurial > hg > webaudioevaluationtool
changeset 2879:061336f961de
Merge pull request #213 from hagenw/fix_sort_button
Fix sort button in MUSHRA
author | nickjillings <nickjillings@users.noreply.github.com> |
---|---|
date | Mon, 19 Jun 2017 13:49:15 +0100 |
parents | 5164a6f53a02 (current diff) 05c7ff06de67 (diff) |
children | 9bbf97cd736d |
files | |
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:49:15 2017 +0100 @@ -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; } }