-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
184 lines (169 loc) · 5.58 KB
/
index.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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
let countHistory = 0;
let historyIds = [];
let userLang = navigator.language || navigator.userLanguage;
const isSpanish = () => {
return userLang.startsWith('es');
};
const TAGS = {
NET: "<a class='netcore' href='https://dotnet.microsoft.com/'>.NetCore</a>",
REACT: "<a class='reactjs' href='https://reactjs.org/'>React Js</a>",
LINKEDIN:
"<a class='linkedin' href='https://www.linkedin.com/in/antony-fagundez/'>LinkedIn</a>",
GITHUB: "<a class='text' href='https://github.com/AntonyFagundez'>GitHub</a>",
};
function pushLine(text, severity = 'info', withAdornment = true) {
if (!text) return;
let container = document.getElementById('label');
let className =
severity === 'error'
? 'text error'
: severity === 'warning'
? 'text warning'
: 'text';
let adorment = withAdornment
? '<span class="text"> antonyfagundez /> </span>'
: ' ';
container.insertAdjacentHTML(
'beforebegin',
`<div id="line-${countHistory}">
${adorment} <label class="${className}" >${text}</label>
</div>
`
);
historyIds.push(`line-${countHistory}`);
}
function pushMultiLine(...args) {
args.forEach((line) => pushInfoLine(line));
}
function pushInfoLine(text) {
return pushLine(text, 'info', false);
}
function handleKeyPress(e) {
let key = e.keyCode || e.which;
if (key == 13) {
let text = e.target.value;
pushLine(text);
if (text !== '' && !getCommand(text)) {
if (isSpanish()) {
pushLine('Error: No existe el comando: ' + text, 'error');
} else {
pushLine('Error: The command ' + text + ' does not exist', 'error');
}
}
clearInput();
focus();
}
}
function openInNewTab(url) {
window.open(url, '_blank').focus();
}
function clearInput() {
let input = document.getElementById('input');
input.value = '';
}
function focus() {
let input = document.getElementById('input');
input.focus();
}
const commands = {
about: () => {
let lines = [];
if (isSpanish()) {
lines = [
'Mi nombre es Antony Fagundez',
`Soy desarrollador de software con experiencia en ${TAGS.NET} y ${TAGS.REACT}`,
'Con especial interés acerca de las tecnologías de frontend',
];
} else {
lines = [
'My name is Antony Fagundez',
`I'm a Software developer with experience in ${TAGS.NET} y ${TAGS.REACT}`,
'with special interest in frontend technologies',
];
}
pushMultiLine(...lines);
},
cls: clear,
clear: clear,
exp: () => {
let lines = [];
if (isSpanish()) {
lines = [
'Actualmente cuento con casi 2 años de experiencia como desarrollador',
'He participado en equipos de innovación para la empresa en la que estoy como para clientes',
'He podido destacar por mi empeño y esfuerzo en estar a la vanguardia en las tecnologías',
'cómo también tomar la responsabilidad y referencia acerca de ReactJs en mi equipo actual.',
'He participado en proyectos con Google Maps como en proyectos de administración de Reportes,',
'dichos proyectos han sido Tanto cloud (Azure) como onPremise',
`Todo con el stack: ${TAGS.NET}/${TAGS.REACT}`,
];
} else {
lines = [
'I currently have almost 2 years of experience as a developer',
'I have participated in innovation teams for the company where I am and for clients',
'I have been able to stand out for my determination and effort to be at the forefront of technologies',
'as well as taking responsibility and referral about ReactJs on my current team',
'I have participated in projects with Google Maps as well as in Report administration projects',
'These projects have been both cloud (Azure) and onPremise',
`Everything with the stack: ${TAGS.NET}/${TAGS.REACT}`,
];
}
pushMultiLine(...lines);
},
contact: () => {
let text = isSpanish()
? `Puedes encontrame en ${TAGS.LINKEDIN} o ver este u otros proyectos en: ${TAGS.GITHUB}`
: `You can find me on ${TAGS.LINKEDIN} or see this or other projects on ${TAGS.GITHUB}`;
pushInfoLine(text);
},
educ: () => {
let lines = [];
if (isSpanish()) {
lines = [
'Estudié en el programa de formación de Codo a Codo. (Java)',
'Hice una capacitación del Gobierno de la ciudad como fullStack en UTN Medrano. (Laravel, Node, React)',
'Hice una capacitación en Azure Fundamentals',
'Y actualmente estoy estudiando la tecnicatura en programación en la UTN Avellaneda',
];
} else {
lines = [
'I studied in the Codo a Codo training program. (Java)',
'I did a City Government training as a fullStack at UTN Medrano. (Laravel, Node, React)',
'I did a training on Azure Fundamentals',
'And I am currently studying the technical degree in programming at the UTN Avellaneda',
];
}
pushMultiLine(...lines);
},
'--see github': () => {
openInNewTab('https://github.com/AntonyFagundez');
},
'--see linkedin': () => {
openInNewTab('https://www.linkedin.com/in/antony-fagundez/');
},
'change-language': () => {
if (isSpanish()) {
userLang = 'en';
replaceAll('en');
} else {
userLang = 'es';
replaceAll('es');
}
},
};
function getCommand(text) {
let success = false;
let textToValid = text.toLowerCase();
if (commands.hasOwnProperty(textToValid)) {
commands[textToValid]();
success = true;
}
return success;
}
function clear() {
historyIds.forEach((x) => {
let el = document.getElementById(x);
el.remove();
});
historyIds = [];
}