Skip to content

Commit 75663ac

Browse files
author
jordanmccullough
committed
Update Timer with Bootstrap modal, styling
1 parent a609ab5 commit 75663ac

File tree

3 files changed

+40
-76
lines changed

3 files changed

+40
-76
lines changed

_javascript/curriculum.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,18 @@ $(function(){
138138

139139
//Time toggle keybinding
140140
$(".timer-label").click(function(){
141-
$(".timer-wrapper").toggleClass("fade-out");
142-
$(".timer-amount").show();
143-
resetTimer();
144-
});
145-
$(".timer-exit").click(function(){
146-
$(".timer-wrapper").toggleClass("fade-out");
147-
$("#timer-check").removeAttr("checked");
148-
// $(".timer-amount").();
149141
resetTimer();
150142
});
151143
$("#start-stop").click(function(){
144+
152145
var timeLeftDisplay = $("#time-left")
153146
var min = $("#minutes").attr("value");
154147
var duration = min*60;
155148

156149
resetTimer();
157150

158-
$(".timer-amount").hide();
151+
$(".time-amount").hide();
152+
$("#start-stop").hide();
159153

160154
timeLeftInterval = setInterval(function(){
161155
timeLeftDisplay.html( Math.floor((duration)/60) + ":" + (duration%60 < 10 ? "0"+duration%60:duration%60) );
@@ -168,6 +162,8 @@ $(function(){
168162
});
169163
function resetTimer(){
170164
clearInterval(timeLeftInterval);
165+
$("#start-stop").show();
166+
$(".time-amount").show();
171167
$("#time-left").html("");
172168
}
173169

_layouts/curriculum.html

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
---
55

66
<!-- Modal -->
7-
<div class="modal fade" id="help" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
7+
<div class="modal fade" id="help" tabindex="-1" role="dialog" aria-labelledby="timerModalLabel" aria-hidden="true">
88
<div class="modal-dialog">
99
<div class="modal-content">
1010
<div class="modal-header">
1111
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
12-
<h4 class="modal-title" id="myModalLabel">Help / Shortcuts</h4>
12+
<h4 class="modal-title" id="timerModalLabel">Help / Shortcuts</h4>
1313
</div>
1414
<div class="modal-body">
1515
<table>
@@ -26,7 +26,7 @@ <h4 class="modal-title" id="myModalLabel">Help / Shortcuts</h4>
2626
<td>Hide/show table of contents</td>
2727
</tr>
2828
</table>
29-
29+
3030
<table>
3131
<tr>
3232
<th>URL Command</th>
@@ -48,16 +48,19 @@ <h4 class="modal-title" id="myModalLabel">Help / Shortcuts</h4>
4848
</div>
4949
</div>
5050

51-
<div class="timer-wrapper fade-out">
52-
<div class="timer">
53-
<div class="timer-exit"><span class="octicon octicon-x"></span></div>
54-
<div class="timer-amount">
55-
<input type="number" id="minutes" name="minutes" min="1" max="20" value="5" placeholder="min" class="form-control">
56-
<!-- <input type="number" id="seconds" name="seconds" min="1" max="60" value="0" placeholder="sec" class="form-control"> -->
57-
<button id="start-stop" type="submit" class="btn btn-default">Start</button>
58-
</div>
59-
<div class="timer-content">
60-
<span class="time-left" id="time-left"></span>
51+
52+
53+
<!-- Modal -->
54+
<div class="modal fade" id="timerModal" tabindex="-1" role="dialog" aria-labelledby="timerModalLabel" aria-hidden="true">
55+
<div class="modal-dialog">
56+
<div class="modal-content text-center">
57+
<input type="number" id="minutes" name="minutes" min="1" max="60" value="5" placeholder="min" class="form-control time-amount">
58+
<div class="time-left" id="time-left"></div>
59+
60+
<div class="modal-footer">
61+
<button id="start-stop" type="submit" class="btn btn-default">Start</button>
62+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
63+
</div>
6164
</div>
6265
</div>
6366
</div>
@@ -121,7 +124,7 @@ <h4>Table of Contents</h4>
121124
<li>
122125
<div class="timer-toggle"></div>
123126
<input type="checkbox" name="timer-check" id="timer-check" class="timer-check" value="true">
124-
<label for="timer-check" class="timer-label">Timer</label>
127+
<label for="timer-check" class="timer-label" data-toggle="modal" data-target="#timerModal">Timer</label>
125128
</li>
126129
</ul>
127130
</div>

_stylesheets/curriculum.scss

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,19 @@ table{
6262
}
6363
}
6464

65-
66-
.fade-out{
67-
background: none !important;
68-
margin-left: 100%;
69-
position: fixed;
70-
left: -35px !important;
71-
72-
.octicon{
73-
font-size: 14px !important;
74-
}
75-
76-
&.timer-wrapper{
77-
background-color: none !important;
78-
}
79-
80-
.timer{
81-
margin: 0 0 !important;
82-
}
83-
84-
.timer-toggle{
85-
padding-left: 0px !important;
86-
opacity: .3;
87-
text-align: left !important;
88-
}
89-
90-
.timer-amount{
91-
visibility: hidden;
92-
}
93-
}
94-
9565
.display-controls{
9666
border-top: solid 2px $gray-lighter;
9767
margin-top: 5px;
9868
padding-top: 10px;
9969
}
10070

10171

72+
.time-amount{
73+
text-align: center;
74+
}
75+
.time-left{
76+
font-size: 88px;
77+
}
10278

10379
.timer-check{
10480
visibility: hidden;
@@ -135,7 +111,6 @@ table{
135111
width: 14px;
136112
height: 14px;
137113
box-shadow: 0 0 0 1px $gray-light;
138-
// padding-top: 1px;
139114
}
140115
}
141116

@@ -218,11 +193,11 @@ table{
218193

219194
.deck{
220195
position: relative;
221-
font-size: 16px;
196+
// font-size: 16px;
222197

223-
.mega-octicon{
224-
font-size: 600%;
225-
}
198+
// .mega-octicon{
199+
// font-size: 600%;
200+
// }
226201

227202
#teacher-avatar{
228203
img{
@@ -252,15 +227,15 @@ table{
252227
background: #ffffff;
253228
display: table;
254229

255-
h2,h3,h4,h5{
256-
text-align: center;
257-
font-size: 400%;
258-
}
230+
// h2,h3,h4,h5{
231+
// text-align: center;
232+
// font-size: 400%;
233+
// }
259234

260-
h1,h2,h3,h4,h5,h6,p,ul,pre,svg{
261-
margin-left: 0;
262-
margin-right: 0;
263-
}
235+
// h1,h2,h3,h4,h5,h6,p,ul,pre,svg{
236+
// margin-left: 0;
237+
// margin-right: 0;
238+
// }
264239

265240
pre{
266241
width: 80%;
@@ -276,16 +251,6 @@ table{
276251
}
277252
}
278253

279-
ul,ol{
280-
display: inline-block;
281-
text-align: left;
282-
}
283-
.lab{
284-
text-align: left;
285-
ul, ol{
286-
display: block;
287-
}
288-
}
289254

290255
.alignment{
291256
display: table-cell;

0 commit comments

Comments
 (0)