-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreak.html
More file actions
171 lines (143 loc) · 4.24 KB
/
Copy pathbreak.html
File metadata and controls
171 lines (143 loc) · 4.24 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/fontawesome/fontawesome-all.min.css">
<script>
class BreakFront {
constructor(time, context, restricted) {
this.time = time;
this.paused = false;
if(restricted) {
document.querySelector("div.actions").classList.add("restricted");
}
document.querySelector("div.close").addEventListener("click", () => Data.send("close", context));
document.querySelector("div.pauseplay").addEventListener("click", () => {
Data.send("pauseplay", context)
if(!this.paused) {
document.querySelector("div.circle").classList.add("paused");
} else {
document.querySelector("div.circle").classList.remove("paused");
}
this.paused = !this.paused;
});
}
tick() {
let time = "";
if(this.time / 60 < 10) {
time += '0' + Math.floor(this.time / 60);
}
else {
time += Math.floor(this.time / 60);
}
time += ":";
if(this.time % 60 < 10) {
time += '0' + this.time % 60;
}
else {
time += this.time % 60;
}
document.getElementById("time").innerText = time;
this.time--;
}
}
class Data {
static send(type, context) {
nw.Window.get().window.dispatchEvent(new Event(type))
}
}
</script>
<style>
@keyframes glow {
0% {box-shadow: 0 0px 4px 0 rgba(255, 2155, 255, 0.4);}
50% {box-shadow: 0 0px 8px 8px rgba(255, 2155, 255, 0.6);}
100% {box-shadow: 0 0px 4px 0 rgba(255, 2155, 255, 0.4);}
}
body {
background-color: black;
color: white;
}
.circle {
width: 300px;
height: 300px;
position: relative;
margin: calc(50vh - 150px) auto auto auto;
border-radius: 50%;
text-align: center;
box-shadow: 0 0 4px 2px rgba(255, 2155, 255, 0.4);
animation: glow linear 5s infinite;
}
.circle.paused {
animation-play-state: paused;
}
.times {
line-height: 280px;
font-size: 60px;
color: white;
}
.message {
width: 280px;
position: absolute;
bottom: 65px;
padding: 10px;
font-size: 24px;
color: white;
}
.actions.restricted {
display: none;
}
.actions div {
width: 40px;
height: 40px;
position: absolute;
bottom: 30px;
line-height: 40px;
border-radius: 50%;
cursor: pointer;
transition: 0.5s;
}
.close {
left:100px;
font-size: 25px;
border: 1px solid red;
}
.close:hover {
background-color: red;
}
.pauseplay {
right: 100px;
font-size: 15px;
border: 1px solid white;
}
.pauseplay .play {
display: none;
}
.pauseplay:hover {
color: black;
background-color: white;
}
.circle.paused .pauseplay .play {
display: inline-block;
}
.circle.paused .pauseplay .pause {
display: none;
}
</style>
</head>
<body>
<div class="circle">
<span class="times" id="time">00:00</span>
<div class="message">
<p>Take a break!</p>
</div>
<div class="actions">
<div class="close">
<span>×</span>
</div>
<div class="pauseplay">
<span class="pause"><i class="fas fa-pause"></i></span>
<span class="play"><i class="fas fa-play"></i></span>
</div>
</div>
</div>
</body>
</html>