-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathscript.js
119 lines (98 loc) · 2.9 KB
/
script.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
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
//Main script file. All necessary script files are imported here
import { greenBtn, yellowBtn, redBtn, themeBtn } from "./scripts/buttons.js";
import {
fetchGithubSocialStats, fetchLinkedInStats, fetchLeetCodeStats, fetchGithubStats,
connections,
githubStats,
followers, following,
ranking, totalSolved, easySolved, mediumSolved, hardSolved,
} from "./scripts/fetchStats.js";
import { getContributors, getBlogs, getIPDetails, getRepo, contributors, userBlogs, IpDetails, userRepos } from "./scripts/getDetails.js";
import {
neofetch,
removeNeoFetch,
getInputValue,
new_line,
removeInput,
trueValue,
falseValue,
createText,
createCode,
downloadFile,
calc
} from "./scripts/functions.js";
import { setTheme } from "./scripts/themeSetter.js";
export let commandsList = [
"help",
"ls",
"clear",
"about",
"social",
"projects",
"repos",
"cheer",
"ipconfig",
"contributors",
"neofetch",
"download",
"calc",
"blog",
"contact",
"github",
"experience",
"skills",
"history",
"typing",
"reset"
];
let delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const app = document.querySelector("#app");
const bodyContainer = document.querySelector("#bodyContainer");
const greenButton = document.querySelector("#greenButton");
greenButton.addEventListener("click", greenBtn);
const yellowButton = document.querySelector("#yellowButton");
yellowButton.addEventListener("click", yellowBtn);
const redButton = document.querySelector("#redButton");
redButton.addEventListener("click", redBtn);
const themeButton = document.querySelector("#themeButton");
themeButton.addEventListener("click", themeBtn);
//function to set up and start the terminal
async function openTerminal() {
await createText("Welcome to the Terminal");
await delay(500);
await createText("Starting up...");
await delay(800);
await createText("You can now interact with the Terminal");
await createCode("Type help", "for a list of commands");
await delay(500);
new_line();
}
//fetch statisticss from ./scripts/fetchStats.js
fetchGithubSocialStats();
fetchLinkedInStats();
fetchLeetCodeStats();
fetchGithubStats();
//open the terminal
openTerminal();
//get Details from ./scripts/getDetails.js
getContributors();
// get the Blogs
getBlogs();
// ip lookup --> https://ipapi.co/json
getIPDetails();
// get user github repositories
getRepo();
// Themes Switcher
let switches = document.getElementsByClassName("main-switch");
let style = localStorage.getItem("style");
if (style == null) {
setTheme("default");
} else {
setTheme(style);
}
for (let i of switches) {
i.addEventListener("click", function () {
let theme = this.dataset.theme;
setTheme(theme);
});
}