1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 " />
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7
+ < link rel ="stylesheet " type ="text/css " href ="./css/main.css " />
8
+ < link href ="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap " rel ="stylesheet " />
9
+ < link rel ="icon " href ="./img/meat.png " />
10
+ < title > TODO - The simple to use ToDo App.</ title >
11
+ </ head >
12
+
13
+ < body >
14
+ < div >
15
+ < img src ="img/checklist.png " width ="80vw " height ="80wh " />
16
+ < div id ="controllsarea " class ="card " style ="
17
+ padding-top: 14px;
18
+ padding-bottom: 14px;
19
+ padding-left: 14px;
20
+ padding-rigth: 14px;
21
+ background-color: #dbf4a7;
22
+ display: inline-block;
23
+ ">
24
+
25
+ < form action ="POST " onsubmit ="event.preventDefault(); formaddTodo(); ">
26
+ < input placeholder ="Classtest , Homework , Publishing this repo to github ... " size ="100 " id ="addformtextinput " class ="longtextarea "
27
+ type ="text " name ="text " id ="textinp " />
28
+ < button id ="addtotobutton " class ="redbutton1 " type ="submit " style ="margin-right: 14px ">
29
+ Add
30
+ </ button >
31
+ </ form >
32
+ </ div >
33
+ < button id ="addtotobutton " class ="redbutton1 " onclick ="saveToCookies(); " style ="text-align: center ">
34
+ Save ToDos in cookies 🍪
35
+ </ button >
36
+
37
+ < div id ="todosarea " class ="card " style ="
38
+ background: linear-gradient(
39
+ to right,
40
+ rgba(3, 133, 153, 1) 0%,
41
+ rgba(219, 244, 167, 1) 100%
42
+ );
43
+ ">
44
+
45
+ < h2 style ="padding-left: 8px; padding-top: 8px; padding-right: 8px ">
46
+ ToDo
47
+ </ h2 >
48
+ < ul id ="todoslist "> </ ul >
49
+ < h2 style ="padding-left: 8px; padding-top: 8px; padding-right: 8px ">
50
+ In Progress
51
+ </ h2 >
52
+ < ul id ="proglist "> </ ul >
53
+ < h2 style ="padding-left: 8px; padding-top: 8px; padding-right: 8px ">
54
+ Done
55
+ </ h2 >
56
+ < ul id ="donelist "> </ ul >
57
+ </ div >
58
+ </ div >
59
+ < div class ="card righter " id ="statsarea " style ="
60
+ background: linear-gradient(to right, #ff7f51 0%, #fffd77 100%);
61
+ margin-top: 8%;
62
+ ">
63
+ < table >
64
+ < tbody >
65
+ < tr >
66
+ < td class ="tg-0lax "> TODO</ td >
67
+ < td class ="tg-0lax " id ="todopercentage "> 100%</ td >
68
+ </ tr >
69
+ < tr >
70
+ < td class ="tg-0lax "> In Progress</ td >
71
+ < td class ="tg-0lax " id ="progpercentage "> 0%</ td >
72
+ </ tr >
73
+ < tr >
74
+ < td class ="tg-0lax "> Done</ td >
75
+ < td class ="tg-0lax " id ="donepercentage "> 0%< br /> </ td >
76
+ </ tr >
77
+ </ tbody >
78
+ </ table >
79
+ </ div >
80
+
81
+ < div class ="footer ">
82
+ < span onclick ="window.open('./info.html',200,400) "> Info</ span >
83
+ </ div >
84
+ < div class ="righter "> < a href ="github.com/clientcrash/stodo "> Github</ a > </ div >
85
+ </ body >
86
+
87
+ </ html >
88
+
89
+ < script >
90
+ setInterval ( function ( ) {
91
+ updateStats ( ) ;
92
+ } , 2000 ) ;
93
+
94
+ function updateStats ( ) {
95
+ console . log ( "updating stats..." ) ;
96
+
97
+ todoamount = document . getElementById ( "todoslist" ) . childElementCount ;
98
+ progamount = document . getElementById ( "proglist" ) . childElementCount ;
99
+ doneamount = document . getElementById ( "donelist" ) . childElementCount ;
100
+ totalamount = todoamount + progamount + doneamount ;
101
+ document . getElementById ( "todopercentage" ) . innerText =
102
+ ( ( todoamount / totalamount ) * 100 ) . toString ( ) + "%" ;
103
+ document . getElementById ( "progpercentage" ) . innerText =
104
+ ( ( progamount / totalamount ) * 100 ) . toString ( ) + "%" ;
105
+ document . getElementById ( "donepercentage" ) . innerText =
106
+ ( ( doneamount / totalamount ) * 100 ) . toString ( ) + "%" ;
107
+ }
108
+
109
+ function addTodo ( text , id , status ) {
110
+ if ( text == "" ) {
111
+ return ;
112
+ }
113
+ switch ( status ) {
114
+ case "todo" :
115
+ document . getElementById ( "todoslist" ) . innerHTML +=
116
+ '<li data-status="' +
117
+ status +
118
+ '" id="' +
119
+ id +
120
+ '"><div class="todo card"><input type="button" onclick="onCheck(' +
121
+ id +
122
+ ')" class="rightal redbutton1" name="Done" id="" style="padding-top:8px;padding-bottom:8px;padding-left:8px;padding-right:8px;margin-left: 8vw;"><span class="rigthal "style="margin-right: 16px;">' +
123
+ text +
124
+ "</span></div></li>" ;
125
+ break ;
126
+ case "prog" :
127
+ document . getElementById ( "proglist" ) . innerHTML +=
128
+ '<li data-status="' +
129
+ status +
130
+ '" id="' +
131
+ id +
132
+ '"><div class="todo card"><input type="button" onclick="onCheck(' +
133
+ id +
134
+ ')" class="rightal redbutton1" name="Done" id="" style="padding-top:8px;padding-bottom:8px;padding-left:8px;padding-right:8px;margin-left: 8vw;"><span class="rigthal "style="margin-right: 16px;">' +
135
+ text +
136
+ "</span></div></li>" ;
137
+ break ;
138
+ case "done" :
139
+ document . getElementById ( "donelist" ) . innerHTML +=
140
+ '<li data-status="' +
141
+ status +
142
+ '" id="' +
143
+ id +
144
+ '"><div class="todo card"><input type="button" onclick="onCheck(' +
145
+ id +
146
+ ')" class="rightal redbutton1" name="Done" id="" style="padding-top:8px;padding-bottom:8px;padding-left:8px;padding-right:8px;margin-left: 8vw;"><span class="rigthal "style="margin-right: 16px;">' +
147
+ text +
148
+ "</span></div></li>" ;
149
+ break ;
150
+ default :
151
+ break ;
152
+ }
153
+ }
154
+
155
+ function formaddTodo ( ) {
156
+ elem3 = document . getElementById ( "addformtextinput" ) ;
157
+ text = elem3 . value ;
158
+ console . log ( text ) ;
159
+ addTodo ( ( text = text ) , ( id = Date . now ( ) . toString ( ) ) , ( status = "todo" ) ) ;
160
+ elem3 . value = "" ;
161
+ return true ;
162
+ }
163
+
164
+ function onCheck ( id ) {
165
+ id = id . toString ( ) ;
166
+ console . log ( "THE ID IS => " + id ) ;
167
+ elem = document . getElementById ( id ) ;
168
+ console . log ( "THE ELEMENT IS => " ) ;
169
+ console . log ( elem ) ;
170
+ status = elem . getAttribute ( "data-status" ) ;
171
+ console . log ( "THE STATUS IS " + status ) ;
172
+ text = elem
173
+ . getElementsByTagName ( "div" ) [ 0 ]
174
+ . getElementsByTagName ( "span" ) [ 0 ] . innerText ;
175
+ console . log ( "THE TEXT IS " + text ) ;
176
+ switch ( status ) {
177
+ case "todo" :
178
+ document . getElementById ( id ) . remove ( ) ;
179
+ addTodo ( text , id , "prog" ) ;
180
+ console . log ( "IS TODO MOVED TO PROG" ) ;
181
+ break ;
182
+ case "prog" :
183
+ document . getElementById ( id ) . remove ( ) ;
184
+ addTodo ( text , id , "done" ) ;
185
+ break ;
186
+ case "done" :
187
+ document . getElementById ( id ) . remove ( ) ;
188
+ break ;
189
+ default :
190
+ break ;
191
+ }
192
+ }
193
+
194
+ function saveToCookies ( ) {
195
+ alert ( "Not Supported!" ) ;
196
+ }
197
+
198
+ function loadFromCookies ( ) { }
199
+ </ script >
0 commit comments