-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcounterScript.js
64 lines (62 loc) · 1.77 KB
/
counterScript.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var counterText;
var html;
var css;
var js;
var ts;
var htmlChars;
var cssChars;
var jsChars;
var tsChars;
var htmlWords;
var cssWords;
var tsWords;
var jsWords;
var htmlLines;
var cssLines;
var tsLines;
var jsLines;
fetch('CounterFile.txt')
.then((response) => response.text())
.then((text) => (counterText = text))
.then((text) => {
counterText = counterText.split(';');
console.log(counterText);
console.log(typeof counterText);
var lenght = counterText.length;
html = counterText[lenght - 7];
css = counterText[lenght - 6];
js = counterText[lenght - 5];
ts = counterText[lenght - 4];
console.log(html);
html = html.split(' ');
css = css.split(' ');
js = js.split(' ');
ts = ts.split(' ');
console.log(css[0].substring(1));
console.log(js);
htmlChars = html[0];
htmlWords = html[3];
htmlLines = html[6];
cssChars = css[0].substring(1);
cssWords = css[3];
cssLines = css[6];
jsChars = js[0].substring(1);
jsWords = js[3];
jsLines = js[6];
tsChars = ts[0].substring(1);
tsChars = ts[0];
tsWords = ts[3];
tsLines = ts[6];
document.getElementById('htmlChars').innerHTML += htmlChars;
document.getElementById('htmlWords').innerHTML += htmlWords;
document.getElementById('htmlLines').innerHTML += htmlLines;
document.getElementById('cssChars').innerHTML += cssChars;
document.getElementById('cssWords').innerHTML += cssWords;
document.getElementById('cssLines').innerHTML += cssLines;
document.getElementById('jsChars').innerHTML += jsChars;
document.getElementById('jsWords').innerHTML += jsWords;
document.getElementById('jsLines').innerHTML += jsLines;
document.getElementById('tsChars').innerHTML += tsChars;
document.getElementById('tsWords').innerHTML += tsWords;
document.getElementById('tsLines').innerHTML += tsLines;
});