-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.js
More file actions
153 lines (135 loc) · 3.39 KB
/
data.js
File metadata and controls
153 lines (135 loc) · 3.39 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
const exp = require("express");
const app = exp();
const BP = require("body-parser");
const cheerio = require("cheerio");
const path = require("path");
const fs = require("fs");
const $ = cheerio.load(fs.readFileSync(__dirname + "/Step4.html"));
var year_or_month,which_pack;
var adon1,adon2,adon3;
app.use(BP.json());
app.use(BP.urlencoded({extended:true}));
app.use(exp.static(path.join("public")));
app.get("/" , function(req,res)
{
res.sendFile(__dirname + "/index.html");
})
app.get("/Step2.html" , function(req,res)
{
res.sendFile(__dirname + "/Step2.html");
})
app.post("/Step3.html" , function(req,res)
{
year_or_month = req.body.YR_MO;
which_pack = req.body.PACKAGE;
})
app.get("/Step3.html" , function(req,res)
{
res.sendFile(__dirname + "/Step3.html");
})
app.post("/Step4.html" ,function(req,res)
{
adon1=req.body.AD1;
adon2=req.body.AD2;
adon3=req.body.AD3;
})
app.get("/Step4.html" , function(req,res)
{
var tmp,mainrate,rate1,rate2,rate3;
if (year_or_month == "yr")
{
tmp = "yearly";
}
else
{
tmp = "monthly";
}
$("#pcpack").text(which_pack + " (" + tmp + ")");
$("#mobpack").text(which_pack + " (" + tmp + ")");
if (year_or_month == "yr")
{
if (which_pack == "Arcade")
{
mainrate = 90;
}
else if (which_pack == "Advanced")
{
mainrate = 120;
}
else
{
mainrate = 150;
}
$("#pcrate").text("$"+mainrate+"/yr");
$("#mobrate").text("$"+mainrate+"/yr");
}
else
{
if (which_pack == "Arcade")
{
mainrate = 9;
}
else if (which_pack == "Advanced")
{
mainrate = 12;
}
else
{
mainrate = 15;
}
$("#pcrate").text("$"+mainrate+"/mo");
$("#mobrate").text("$"+mainrate+"/mo");
}
$("#pcadditional").html("");
$("#mobadditional").html("");
if (adon1 == "ok")
{
$("#pcadditional").append('<div><p>Online service</p><p>+$1/mo</p></div>');
$("#mobadditional").append('<div><p>Online service</p><p>+$1/mo</p></div>');
rate1=1;
}
else
{
rate1=0;
}
if (adon2 == "ok")
{
$("#pcadditional").append('<div><p>Larger storage</p><p>+$2/mo</p></div>');
$("#mobadditional").append('<div><p>Larger storage</p><p>+$2/mo</p></div>');
rate2=2;
}
else
{
rate2=0;
}
if (adon3 == "ok")
{
$("#pcadditional").append('<div><p>Customizable profile</p><p>+$2/mo</p></div>');
$("#mobadditional").append('<div><p>Customizable profile</p><p>+$2/mo</p></div>');
rate3=2;
}
else
{
rate3=0;
}
$("#pcfinal").html("");
$("#pcmob").html("");
var tot=mainrate+(rate1*12)+(rate2*12)+(rate3*12);
var mtot=mainrate+rate1+rate2+rate3;
if (tmp=="monthly")
{
$("#pcfinal").html("<p>Total (per month)</p><p>+$" + mtot + "/" + "mo");
$("#mobfinal").html("<p>Total (per month)</p><p>+$" + mtot + "/" + "mo");
}
else
{
$("#pcfinal").html("<p>Total (per year)</p><p>+$" + tot + "/" + "yr");
$("#mobfinal").html("<p>Total (per year)</p><p>+$" + tot + "/" + "yr");
}
res.send($.html());
})
app.get("/ty.html" , function(req,res)
{
res.sendFile(__dirname + "/ty.html");
})
app.listen(3000);