-
Notifications
You must be signed in to change notification settings - Fork 1
/
quicksort.html
197 lines (196 loc) · 5.74 KB
/
quicksort.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html>
<head>
<title>Data Structure Visualiser</title>
<script type= "text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<style>
* {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
#canvas {
position:relative;
overflow-x: auto;
overflow-y: auto;
}
body{
background-color: #F9F9F9;
margin: 0px;
}
#header{
height: 55px;
margin: 0px;
text-align: center;
}
#header h1{
text-align: center;
padding-top: 30px;
margin: 0px;
color: #212121;
}
#content{
min-width: 600px;
width: 90%;
margin: auto;
margin-top: 30px;
padding: 20px;
background-color: #FFF;
box-shadow: 0px 4px 15px #666;
border-radius: 4px;
}
#controls {
text-align: center;
}
#snapshot-counter {
font-family: "Courier New", Courier, monospace;
position:absolute;
bottom: 0;
right: 0;
text-align:right;
}
.small-link {
font-size: 13px;
margin-top:15px;
text-align:center;
}
.node circle {
fill: #fff;
stroke: seagreen;
stroke-width: 1.5px;
}
.tree-node {
font-size: 10px;
}
.array-node {
font-size: 25px;
}
.array-node .highlighted {
stroke: #B4B4B4;
stroke-width: 5;
}
.link {
fill: none;
stroke: #ccc;
stroke-width: 1.5px;
}
/* Slider CSS http://cssscript.com/simple-flat-html5-and-css3-range-slider/ */
input {
-webkit-appearance: none;
width: 160px;
height: 20px;
margin: 10px 50px;
background: linear-gradient(to right, #DBDBDB 0%, #DBDBDB 100%);
background-size: 150px 5px;
background-position: center;
background-repeat: no-repeat;
vertical-align: middle;
overflow: hidden;
outline: none;
margin: 5px;
}
input::-webkit-slider-thumb {
-webkit-appearance: none;
width: 10px;
height: 20px;
background: #AAA;
position: relative;
z-index: 3;
}
input::-webkit-slider-thumb:after {
content: " ";
width: 160px;
height: 8px;
position: absolute;
z-index: 1;
right:10px;
top: 6px;
background: #AAA;
}
/* Pure CSS Buttons http://purecss.io/buttons/ */
.pure-button {
font-family: inherit;
font-size: 100%;
padding: .5em 1em;
color: #444;
color: rgba(0,0,0,.8);
border: 1px solid #999;
border: 0 rgba(0,0,0,0);
background-color: #EFEFEF;
text-decoration: none;
outline: none;
border-radius: 2px;
}
.pure-button-hover,
.pure-button:hover{
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10)));
background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10));
background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10));
background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10));
background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10));
}
.pure-button {
display: inline-block;
zoom: 1;
line-height: normal;
white-space: nowrap;
vertical-align: middle;
text-align: center;
cursor: pointer;
-webkit-user-drag: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.pure-button[disabled],
.pure-button-disabled,
.pure-button-disabled:hover,
.pure-button-disabled:focus,
.pure-button-disabled:active {
border: none;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
filter: alpha(opacity=40);
-khtml-opacity: 0.40;
-moz-opacity: 0.40;
opacity: 0.40;
cursor: not-allowed;
box-shadow: none;
}
.speed-container {
color: #444;
background-color: #EFEFEF;
padding: .5em 1em;
}
</style>
</head>
<body>
<div id="header">
<h1>Data Structure Visualiser</h1></span>
</div>
<div id="content">
<div id="canvas"><div id="snapshot-counter"></div></div>
<div id="controls" style="margin-top: 10px;">
<input type="range" id="snapshot-slider" min="0" max="100" step="1" oninput="sliderMove(this)" value="0"><br />
<button onclick = "next(false)" id="previous" class="pure-button direction">« Prev</button>
<button onclick = "play()" id="play" class="pure-button direction">▶</button>
<button onclick = "next(true)" id="next" class="pure-button direction">Next »</button>
</div>
</div>
<div id="content">
<div id="controls">
<button onclick = "reset()" id="reset" class="pure-button">Reset</button>
<button onclick = "toggleWeightedColors()" id="colors" class="pure-button">Enable Weighted Colors</button>
<span class="speed-container">Speed: <span id="speed-value">100ms</span><input type="range" id="speed" value="100" min="50" max="1000" step="50" onchange="changeSpeed(this.value)"></span>
</div>
</div>
<div class="small-link">[<a href="index.html" title="Default Implementation">Back to Default</a>]</div>
<!-- Please keep script.js call at bottom of body tag -->
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">load("quicksort.json");toggleWeightedColors();</script>
</body>
</html>