forked from HeyOmae/Omae
-
Notifications
You must be signed in to change notification settings - Fork 1
/
decking.js
41 lines (37 loc) · 1.63 KB
/
decking.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
function complexFormActivate() {
var form = complexforms[$(this).parent().attr("id")];
//if the complex form has already been activated, then do this stuff
if ($(this).hasClass("active")) {
//remove the active class, and change the + to a -
deactivate($(this));
//the form is turned off
form["formact"] = false;
//return complex form points to buy more forms
forms++;
} else { //If the form isn't on, then its off, so do this stuff
//do you have complex form points to buy more forms?
if (forms > 0) {
//Then add the active class and replace the - with a +
activate($(this));
//turn off complex form
form["formact"] = true;
//reduce form points
forms--;
}
}
displayUpdater();
//@TODO - rename parameter
function activate(x) { //this will highlight and add a + to show that the thing is active
x.addClass("active").empty().append("<strong>+</strong>");
}
//@TODO - rename parameter
function deactivate(x) { //this will turn off the highlight and change the + to a - to show its inactive
x.removeClass("active").empty().append("<strong>-</strong>");
}
}
function setupComplexForms() {
for (var form in complexforms) {
var formhold = complexforms[form];
$(".complexforms").after($("<tr id='" + form + "'class='form'><td class='formact " + form + " button'><strong>-</strong></td><td class='formname " + form + "'>" + formhold["name"] + "</td><td class='formtarget " + form + "'>" + formhold["target"] + "</td><td class='formdur " + form + "'>" + formhold["duration"] + "</td><td class='fading " + form + "'>" + formhold["fading"] + "</td></tr>"));
}
}