forked from andrewcmyers/civs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.js
executable file
·66 lines (58 loc) · 2.02 KB
/
results.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
function newSettings() {
document.changeSettings.submit();
}
function setup() {
// don't need the "update" button if we have JavaScript
// working.
var button = document.getElementById("recomplete");
if (button != null)
button.parentNode.removeChild(button);
}
function hide_details() {
document.getElementById("details").style.display = "none";
document.getElementById("show_details").style.display = "block";
}
function show_details() {
document.getElementById("details").style.display = "block";
document.getElementById("show_details").style.display = "none";
}
function edit_description() {
var para = document.getElementById("description");
var texta = document.getElementById("description_edit");
para.style.display = 'none';
texta.style.display = 'block';
document.getElementById("edit_description_button").style.display = 'none';
document.getElementById("save_description_button").style.display = 'block';
texta.value = para.innerHTML;
}
function save_description() {
var para = document.getElementById("description");
var texta = document.getElementById("description_edit");
para.innerHTML = texta.value;
texta.style.display = 'none';
para.style.display = 'block';
document.getElementById("edit_description_button").style.display = 'block';
document.getElementById("save_description_button").style.display = 'none';
post_new_description(para.innerHTML);
}
function clear(node) {
if (node == undefined) return;
while (node.firstChild) node.removeChild(node.firstChild);
}
function popup(id, msg) {
var elem = document.getElementById(id);
clear(elem);
app(elem, msg);
elem.style.display = 'inline';
setTimeout(function() {
document.getElementById(id).style.display = 'none';
}, 1000);
}
function post_new_description(desc) {
post_to_url("edit_poll@PERLEXT@",
{ id: election_id, key: control_key, description: desc },
function(response) {
popup("save_popup", "saved");
},
function(err) { alert(err); });
}