Mercurial > hg > webaudioevaluationtool
comparison interfaces/mushra.js @ 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 | 97a52e326464 |
children | 2706f3dd82e6 |
comparison
equal
deleted
inserted
replaced
2877:5164a6f53a02 | 2878:05c7ff06de67 |
---|---|
237 break; | 237 break; |
238 case "comments": | 238 case "comments": |
239 interfaceContext.commentBoxes.showCommentBoxes(feedbackHolder, true); | 239 interfaceContext.commentBoxes.showCommentBoxes(feedbackHolder, true); |
240 break; | 240 break; |
241 case "fragmentSort": | 241 case "fragmentSort": |
242 (function () { | 242 var button = document.getElementById('sort'); |
243 var button = document.createElement("button"); | 243 if (button === null) { |
244 button = document.createElement("button"); | |
245 button.id = 'sort'; | |
244 button.textContent = "Sort"; | 246 button.textContent = "Sort"; |
245 button.style.display = 'inline-block'; | 247 button.style.display = 'inline-block'; |
246 var container = document.getElementById("interface-buttons"); | 248 var container = document.getElementById("interface-buttons"); |
247 var neighbour = container.lastElementChild; | 249 var neighbour = container.lastElementChild; |
248 while (neighbour.nodeName !== "BUTTON") { | 250 container.appendChild(button); |
249 neighbour = neighbour.previousElementSibling; | |
250 } | |
251 if (neighbour.nextElementSibling) { | |
252 container.insertBefore(button, neighbour.nextElementSibling); | |
253 } else { | |
254 container.appendChild(button); | |
255 } | |
256 button.onclick = function () { | 251 button.onclick = function () { |
257 var sortIndex = interfaceContext.sortFragmentsByScore(); | 252 var sortIndex = interfaceContext.sortFragmentsByScore(); |
258 var sliderBox = document.getElementById("slider-holder"); | 253 var sliderBox = document.getElementById("slider-holder"); |
259 var nodes = audioEngineContext.audioObjects.filter(function (ao) { | 254 var nodes = audioEngineContext.audioObjects.filter(function (ao) { |
260 return ao.specification.type !== "outside-reference"; | 255 return ao.specification.type !== "outside-reference"; |
266 for (i = 0; i < nodes.length; i++) { | 261 for (i = 0; i < nodes.length; i++) { |
267 var j = sortIndex[i]; | 262 var j = sortIndex[i]; |
268 sliderBox.appendChild(nodes[j].interfaceDOM.holder); | 263 sliderBox.appendChild(nodes[j].interfaceDOM.holder); |
269 } | 264 } |
270 }; | 265 }; |
271 })(); | 266 } |
272 break; | 267 break; |
273 } | 268 } |
274 } | 269 } |
275 }); | 270 }); |
276 | 271 |