Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김유현
/
How much are you earning now
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김유현
2019-12-11 02:42:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2787fe1b9582ff62687fb6de2dd4b93b67359511
2787fe1b
1 parent
1868d85c
Modify graph
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
14 deletions
index.js
public/graph.html
index.js
View file @
2787fe1
...
...
@@ -20,7 +20,7 @@ app.get('/graph', function(req, res){
var
workDay
=
req
.
query
.
workDay
var
workTime
=
req
.
query
.
workTime
var
offWork
=
req
.
query
.
offWork
console
.
log
(
payDay
,
salary
,
workDay
,
workTime
,
offWork
);
//
console.log(payDay, salary,workDay,workTime, offWork);
res
.
sendFile
(
__dirname
+
'/public/graph.html'
);
//res.send(`payDay : ${payDay}, salary : ${salary}, workDay : ${workDay}, workTime : ${workTime}, offWork : ${offWork}`);
})
...
...
public/graph.html
View file @
2787fe1
<html>
<head>
<meta
charset=
"utf-8"
>
</head>
<body>
<link
rel=
"stylesheet"
href=
"css/graph_style.css"
>
<div
id =
"dpTime"
></div>
<div
style =
"padding: 20px"
class=
"out"
>
<div
id =
"dpTime"
class=
"in"
></div>
<br>
<div
id =
"salary"
class=
"in"
></div>
<br>
<div
id =
"moneyPerSec"
class=
"in"
></div>
</div>
<div
class=
"progress-bar"
></div>
<h1
class=
"count"
></h1>
</body>
<script>
var
body
=
document
.
querySelector
(
'body'
),
bar
=
document
.
querySelector
(
'.progress-bar'
),
counter
=
document
.
querySelector
(
'.count'
),
i
=
0
,
throttle
=
0.4
;
// 0-1
<script
charset=
"utf-8"
>
function
getParam
(
sname
)
{
var
params
=
location
.
search
.
substr
(
location
.
search
.
indexOf
(
"?"
)
+
1
);
var
sval
=
""
;
params
=
params
.
split
(
"&"
);
for
(
var
i
=
0
;
i
<
params
.
length
;
i
++
)
{
temp
=
params
[
i
].
split
(
"="
);
if
([
temp
[
0
]]
==
sname
)
{
sval
=
temp
[
1
];
}
}
return
sval
;
}
//document.getElementById("payDay").innerHTML = "pay day : " + getParam("payDay");
var
salary
=
Number
(
getParam
(
"salary"
));
var
workTime
=
Number
(
getParam
(
"workTime"
));
var
offWork
=
Number
(
getParam
(
"offWork"
));
var
workingDayNum
=
getParam
(
"workDay"
).
length
/
9
;
document
.
getElementById
(
"salary"
).
innerHTML
=
"salary : "
+
salary
;
//document.getElementById("workDay").innerHTML = "working day : " + getParam("workDay");
//document.getElementById("workTime").innerHTML = "working time : " + workTime;
//document.getElementById("offWork").innerHTML = "time of work : " + offWork;
//document.getElementById("workedHour").innerHTML = "worked hour : " + String(offWork - workTime);
var
moneyPerSec
=
0
;
setInterval
(
"dpTime()"
,
1
);
function
dpTime
(){
var
now
=
new
Date
();
...
...
@@ -31,19 +58,45 @@
}
if
(
seconds
<
10
){
seconds
=
"0"
+
seconds
;
}
document
.
getElementById
(
"dpTime"
).
innerHTML
=
ampm
+
hours
+
":"
+
minutes
+
":"
+
seconds
;
}
document
.
getElementById
(
"dpTime"
).
innerHTML
=
"현재 시간 : "
+
ampm
+
hours
+
":"
+
minutes
+
":"
+
seconds
;
if
(
hours
<
workTime
){
document
.
getElementById
(
"moneyPerSec"
).
innerHTML
=
"출근할 때 까지 "
+
String
(
workTime
-
hours
)
+
"시간 남았당"
;
}
else
{
moneyPerSec
+=
salary
/
(
60
*
60
*
(
offWork
-
workTime
)
*
workingDayNum
*
30
);
document
.
getElementById
(
"moneyPerSec"
).
innerHTML
=
moneyPerSec
.
toFixed
(
3
)
+
"원 버는중.."
;
}
}
//document.getElementById("workedHour").innerHTML = "Hours worked : " + parseInt(Number(getParam("offWork")))-parseInt(Number(getParam("workTime")));
//document.getElementById("workTime").innerHTML = "working time : " + escape(getParam("workTime"));
//document.getElementById("offWork").innerHTML = "time of work : " + getParam("offWork");
var
body
=
document
.
querySelector
(
'body'
),
bar
=
document
.
querySelector
(
'.progress-bar'
),
counter
=
document
.
querySelector
(
'.count'
),
i
=
0
,
throttle
=
0.4
;
// 0-1
(
function
draw
()
{
if
(
i
<=
100
)
{
var
r
=
Math
.
random
();
//
var r = Math.random();
requestAnimationFrame
(
draw
);
bar
.
style
.
width
=
i
+
'%'
;
counter
.
innerHTML
=
Math
.
round
(
i
)
+
'%'
;
if
(
hours
<
workTime
){
bar
.
style
.
width
=
0
+
'%'
;
counter
.
innerHTML
=
'출근 안했당'
;
if
(
r
<
throttle
)
{
// Simulate d/l speed and uneven bitrate
i
=
i
+
r
;
}
else
{
bar
.
style
.
width
=
i
+
'%'
;
counter
.
innerHTML
=
i
.
toFixed
(
4
)
+
'%'
;
i
=
moneyPerSec
/
salary
*
100
}
//if(r < throttle) { // Simulate d/l speed and uneven bitrate
// i = i + r;
//}
}
else
{;
bar
.
className
+=
" done"
;
}
...
...
Please
register
or
login
to post a comment