-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
70 lines (50 loc) · 1.67 KB
/
scripts.js
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
var names;
var classes;
function init() {
var c = document.getElementById("namebox");
var canvas = c.getContext("2d");
canvas.fillStyle="black";
canvas.fillRect(0, 0, c.width, c.height);
canvas.textBaseline = "middle";
canvas.textAlign= "center";
canvas.font = "70px Arial";
canvas.fillStyle="white";
canvas.fillText( "Click Here", c.width/2, c.height/2);
$.post("load.py", { type : "classes" },
function( data, status ) {
classes = eval(data);
console.log("classes: " + classes );
var options = "";
for (c in classes) {
console.log("c: " + c);
options+= "<option value=\"" + classes[c] + "\">" + classes[c] + "</option>"
}
$("#cname").html( options );
});
$.post("load.py", { type : "students" },
function( data, status ) {
names = eval(data);
});
}
function loadBox() {
var c = document.getElementById("namebox");
var canvas = c.getContext("2d");
canvas.fillStyle="black";
canvas.fillRect(0, 0, c.width, c.height);
canvas.fillStyle="white";
canvas.fillText( names[Math.floor(Math.random() * names.length)], c.width/2, c.height/2);
}
function changeClass() {
cls = $("#cname option:selected").text();
console.log( cls );
$.post("load.py", { type : "students", section : cls },
function( data, status ) {
names = eval(data);
});
var c = document.getElementById("namebox");
var canvas = c.getContext("2d");
canvas.fillStyle="black";
canvas.fillRect(0, 0, c.width, c.width);
canvas.fillStyle="white";
canvas.fillText( "Click Here", c.width / 2, c.height / 2);
}