Repository navigation
Expand file tree
/
Copy pathquiz2.php
More file actions
157 lines (134 loc) · 3.89 KB
/
Copy pathquiz2.php
File metadata and controls
157 lines (134 loc) · 3.89 KB
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
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Rokkitt:400,700' rel='stylesheet' type='text/css'>
<style type="text/css">
body{
font-family:Rokkitt;
font-size:20px;
}
#container{
}
#timer{
margin:auto;
width:100%;
}
#timer table{
width:100%;
font-size:2.5em;
}
#timer td{
text-align:center;
width:50%;
}
#timer span{
font-weight:bold;
font-size:3.0em;
}
#notes{
margin:auto;
font-size:1.8em;
width:95%;
}
#notes div, #notes p{
text-align:center;
}
#notes span{
font-size:2.0em;
font-weight:700;
border-bottom:5px solid black;
}
#notes-title{
text-align:center;
}
#note-finish{
font-size:1.1em;
font-weight:bold;
}
</style>
</head>
<body>
<div id="container">
<div id="timer">
<table><tr>
<td>
<b>Current Time</b><br /><span id="timeCurr"></span>
</td>
<td>
<b>Time Remaining</b><br /><span id="timeRemaining"></span>
</td>
</tr></table>
</div>
<br />
<div id="notes">
<!--
<div><span id="notes-title">Quiz Notes / Corrections</span></div>
<ul>
<li><b>Q3a</b>: Print out the source code of the file <b>HelloWorld.java</b> in the sequence of commands.</li>
<li><b>Q6</b>: Circle the appropriate answer.</li>
</ul>
-->
<p id="note-finish">When you're done, you can hand in your quiz up front and head on out!</p>
</div>
</div>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
updateMargin();
updateTime();
$(window).resize(function(){
updateMargin();
});
function updateTime(){
var targetDateTime = new Date(2013, 9, 22, 10, 55, 0);
var currentDateTime = new Date();
// Time Math
var timeRemaining = (targetDateTime.getTime() - currentDateTime.getTime()) / 1000;
if(timeRemaining >= 0){
// Formatting
var timeRemaining_seconds = Math.floor(timeRemaining % 60);
timeRemaining /= 60;
var timeRemaining_minutes = Math.floor(timeRemaining % 60);
timeRemaining /= 60;
var timeRemaining_hours = Math.floor(timeRemaining % 60);
timeRemaining /= 60;
if(timeRemaining_hours < 10)
timeRemaining_hours = "0" + timeRemaining_hours;
if(timeRemaining_minutes < 10)
timeRemaining_minutes = "0" + timeRemaining_minutes;
if(timeRemaining_seconds < 10)
timeRemaining_seconds = "0" + timeRemaining_seconds;
} else{
var timeRemaining_seconds = "00";
var timeRemaining_minutes = "00";
var timeRemaining_hours = "00";
}
var currentTime_hours = currentDateTime.getHours();
var currentTime_minutes = currentDateTime.getMinutes();
var currentTime_seconds = currentDateTime.getSeconds();
if(currentTime_hours > 12){
currentTime_hours = currentTime_hours % 12;
}
if(currentTime_hours < 10){
currentTime_hours = "0" + currentTime_hours;
}
if(currentTime_minutes < 10)
currentTime_minutes = "0" + currentTime_minutes;
if(currentTime_seconds < 10)
currentTime_seconds = "0" + currentTime_seconds;
// Display Time
// console.log(timeRemaining_minutes + ":" + timeRemaining_seconds);
$('#timeCurr').text(currentTime_hours + ":" + currentTime_minutes + ":" + currentTime_seconds);
$('#timeRemaining').text(timeRemaining_hours + ":" + timeRemaining_minutes + ":" + timeRemaining_seconds);
if(timeRemaining * 60 * 60 * 60 <= 300){
$('#timeRemaining').css('color', '#FF0000');
}
setTimeout(function(){updateTime()}, 1000);
}
function updateMargin(){
var margin = Math.ceil(($(window).height() - $('#container').height()) / 2.5);
$('#container').css('margin-top', margin + "px");
}
});
</script>
</body>
</head>