-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathui_combinacoes.js
55 lines (53 loc) · 2.13 KB
/
ui_combinacoes.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
/**
* @constructor
*/
function UI_combinacoes(id)
{
var self = this;
var d2 = document.getElementById(id);
d2.className = "ui_combinacoes";
self.selecao_atual = document.createElement("input");
self.selecao_atual.value = 0;
self.selecao_atual.onchange = function () { self.cb_changed(this.value); };
d2.appendChild(document.createTextNode("Combina\u00e7\u00f5es "));
var button = document.createElement("span");
button.innerHTML = "<strong> < </strong>";
button.title = "combinação anterior";
button.onselectstart = function () { return false; };
button.onclick = function () { self.cb_previous(); return false; };
if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
button.ondblclick = function () { self.cb_previous(); };
}
d2.appendChild(button);
d2.appendChild(document.createTextNode(" "));
d2.appendChild(self.selecao_atual);
d2.appendChild(document.createTextNode("/"));
var numero_selecoes = document.createTextNode("0");
d2.appendChild(numero_selecoes);
d2.appendChild(document.createTextNode(" "));
var button = document.createElement("span");
button.innerHTML = "<strong> > </strong>";
button.title = "próxima combinação";
button.onselectstart = function () { return false; };
button.onclick = function () { self.cb_next(); return false; };
if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
button.ondblclick = function () { self.cb_next(); };
}
d2.appendChild(button);
d2.appendChild(document.createTextNode(" Créditos por semana: "));
var horas_aula = document.createTextNode("0");
d2.appendChild(horas_aula);
/* procedures */
self.set_current = function(n) { self.selecao_atual.value = n; };
self.set_total = function(n) { numero_selecoes.nodeValue = n; };
self.set_horas_aula = function(n) { horas_aula.nodeValue = n; };
self.reset = function() {
self.set_current(0);
self.set_total(0);
self.set_horas_aula(0);
};
/* callbacks */
self.cb_previous = null;
self.cb_next = null;
self.cb_changed = null;
}