From d842a2f62e674787581f8b15e1e23ab6be1bd41a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 16 Jul 2013 23:48:29 -0700 Subject: [PATCH] Allow /test and /perf to change dropdown values if the other dropdown has a custom entry. Former-commit-id: d56880e7c588b14ae4c65cacc37f042352e5eee1 --- perf/perf-ui.js | 9 ++++++--- test/test-ui.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/perf/perf-ui.js b/perf/perf-ui.js index ca8c9c482..add0f896b 100644 --- a/perf/perf-ui.js +++ b/perf/perf-ui.js @@ -79,7 +79,10 @@ // initialize controls addListener(window, 'load', function() { function eventHandler(event) { - var search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, ''); + var buildIndex = buildList.selectedIndex, + otherIndex = otherList.selectedIndex, + search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, ''); + if (event.stopPropagation) { event.stopPropagation(); } else { @@ -88,8 +91,8 @@ location.href = location.href.split('?')[0] + '?' + (search ? search + '&' : '') + - 'build=' + buildList[buildList.selectedIndex].value + '&' + - 'other=' + otherList[otherList.selectedIndex].value; + 'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + + 'other=' + (otherIndex < 0 ? other : otherList[otherIndex].value); } var span1 = document.createElement('span'); diff --git a/test/test-ui.js b/test/test-ui.js index 319d55852..62f7eaf2f 100644 --- a/test/test-ui.js +++ b/test/test-ui.js @@ -76,7 +76,10 @@ // initialize controls addListener(window, 'load', function() { function eventHandler(event) { - var search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, ''); + var buildIndex = buildList.selectedIndex, + loaderIndex = loaderList.selectedIndex, + search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, ''); + if (event.stopPropagation) { event.stopPropagation(); } else { @@ -85,8 +88,8 @@ location.href = location.href.split('?')[0] + '?' + (search ? search + '&' : '') + - 'build=' + buildList[buildList.selectedIndex].value + '&' + - 'loader=' + loaderList[loaderList.selectedIndex].value; + 'build=' + (buildIndex < 0 ? build : buildList[buildIndex].value) + '&' + + 'loader=' + (loaderIndex < 0 ? loader : loaderList[loaderIndex].value); } function init() {