-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_es.js
78 lines (68 loc) · 2.38 KB
/
code_es.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
'use strict';
/**
* @author DANIEL GIMÉNEZ LÓPEZ-TORRES
*/
import { projects } from './projects_es.js';
import { experiences } from './experiences_es.js';
import { expandImage, writeYear, loadProjects, loadExperiences, copyableCredentials } from './code.js';
// Code to execute on page load.
window.onload = () => {
// Loads the projects.
const projectsSection = document.getElementById( 'projects' );
if( projectsSection ){
const projectsSubsections = projectsSection.getElementsByTagName( 'SECTION' );
if( projectsSubsections &&
projectsSubsections.length === 2 /* 3 */ ){
/* loadProjects(
projectsSubsections[ 0 ],
projects.work
); */
loadProjects(
projectsSubsections[ 0 /* 1 */ ],
projects.student
);
loadProjects(
projectsSubsections[ 1 /* 2 */ ],
projects.own
);
} else {
console.error( 'ERROR: Failed to fetch the projects subsections (must have 3), got ', projectsSubsections );
}
} else {
console.error( 'ERROR: Failed to fetch the main projects section' );
}
// Loads the experiences.
const workSection = document.getElementById( 'experiences' );
const educationSection = document.getElementById( 'educations' );
if( workSection && educationSection ){
loadExperiences(
workSection,
experiences.work,
'work'
);
loadExperiences(
educationSection,
experiences.education,
'education'
);
} else {
console.error( 'ERROR: Failed to fetch either the work or educational experience sections, got ', workSection, educationSection );
}
// Writes the current year on the last TIME element.
writeYear( document.getElementById( 'curYear' ) );
// Adds an `onclick` event to images in order to make them expandable.
const expandableImgs = document.getElementsByClassName( 'expandable' );
for( const expandableImg of expandableImgs ){
expandableImg.addEventListener(
'click',
() => {
expandImage( expandableImg )
}
);
}
// Makes credentials copyable
copyableCredentials(
'credential-copiada',
'credential-fallada'
);
};