Skip to content

Commit 9784e5e

Browse files
committed
Revert "Changes to be committed:"
This reverts commit e4c8539.
1 parent 3536c71 commit 9784e5e

File tree

3 files changed

+29
-128
lines changed

3 files changed

+29
-128
lines changed

index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<option class="options" value="ExchangeSort">Exchange Sort</option>
2727
<option class="options" value="InsertionSort">Insertion Sort</option>
2828
<option class="options" value="ShakerSort">Shaker Sort</option>
29-
<option class="options" value="OddEvenSort">Odd-Even Sort</option>
3029
</select>
3130
</div>
3231
</div>
@@ -75,15 +74,14 @@
7574

7675
</main>
7776

78-
77+
7978

8079
<script type="text/javascript" src="./js/main.js"></script>
8180
<script type="text/javascript" src="./js/bubble_sort.js"></script>
8281
<script type="text/javascript" src="./js/selection_sort.js"></script>
8382
<script type="text/javascript" src="./js/exchange_sort.js"></script>
8483
<script type="text/javascript" src="./js/insertion_sort.js"></script>
8584
<script type="text/javascript" src="./js/shaker_sort.js"></script>
86-
<script type="text/javascript" src="./js/odd_even_sort.js"></script>
8785
<script type="text/javascript" src="./js/test.js"></script>
8886
</body>
8987
</html>

js/odd_even_sort.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

js/test.js

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,36 @@ window.onload = function(){
3030

3131
function algoChosen(){
3232

33-
try{
34-
35-
algo = algoSelector.value;
36-
if(algo === null || algo === 'none'){
37-
clearInputDashBoard();
38-
allDisable([algoSelector]);
33+
algo = algoSelector.value;
34+
if(algo === null || algo === 'none'){
35+
clearInputDashBoard();
36+
allDisable([algoSelector]);
37+
}
38+
else{
39+
if(algo === 'BubbleSort'){
40+
one = new BubbleSort();
41+
classOne = BubbleSort;
3942
}
40-
else{
41-
if(algo === 'BubbleSort'){
42-
one = new BubbleSort();
43-
classOne = BubbleSort;
44-
}
45-
else if(algo === 'SelectionSort'){
46-
one = new SelectionSort();
47-
classOne = SelectionSort;
48-
}
49-
else if(algo === 'ExchangeSort'){
50-
one = new ExchangeSort();
51-
classOne = ExchangeSort;
52-
}
53-
else if(algo === 'InsertionSort'){
54-
one = new InsertionSort();
55-
classOne = InsertionSort;
56-
}
57-
else if(algo === 'ShakerSort'){
58-
one = new ShakerSort();
59-
classOne = ShakerSort;
60-
}
61-
else if(algo === 'OddEvenSort'){
62-
one = new OddEvenSort();
63-
classOne = OddEvenSort;
64-
}
65-
else{
66-
window.alert('演算法系統錯誤,\n請按 F5 重新整理系統,再次使用。');
67-
// refresh();
68-
}
69-
70-
allEnable([goBtn])
43+
else if(algo === 'SelectionSort'){
44+
one = new SelectionSort();
45+
classOne = SelectionSort;
7146
}
47+
else if(algo === 'ExchangeSort'){
48+
one = new ExchangeSort();
49+
classOne = ExchangeSort;
50+
}
51+
else if(algo === 'InsertionSort'){
52+
one = new InsertionSort();
53+
classOne = InsertionSort;
54+
}
55+
else if(algo === 'ShakerSort'){
56+
one = new ShakerSort();
57+
classOne = ShakerSort;
58+
}
59+
60+
allEnable([goBtn])
7261
}
73-
catch(e){
74-
}
62+
7563
}
7664

7765
function clearInputDashBoard(){
@@ -133,7 +121,7 @@ function inputInvalid(entryNum , mspfNum){
133121
}
134122
return false;
135123
}
136-
124+
137125
function prepareForRun(){
138126
one.entryNum = isCountInputValid( parseInt(countInput.value, 10) );
139127
one.milliSecPerFrame = isMspfInputValid( parseInt(mspfInput.value, 10));

0 commit comments

Comments
 (0)