Skip to content

Commit 3c22cac

Browse files
author
Nir Galon
committed
init
0 parents  commit 3c22cac

47 files changed

Lines changed: 1203 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Copyright (c) 2021 nirgn975 <nir@galon.io> (http://nir.galon.io)
2+
3+
Permission to use, copy, modify, and/or distribute this software for
4+
any purpose with or without fee is hereby granted, provided that the
5+
above copyright notice and this permission notice appear in all
6+
copies.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
10+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
11+
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12+
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
13+
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15+
PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# devRes Theme
2+
3+
Something about the theme.
4+
5+
![Screenshot](images/screenshot.webp)
6+
7+
# Features
8+
9+
foo
10+
11+
# How to use it
12+
13+
bar
14+
15+
# Customization
16+
17+
- You can change the theme colors in the `config.toml` file.
18+
- Your resume data should be added in the `data/content.yaml`.
19+
20+
# Contributing
21+
22+
Post bugs and contributions to the issue tracker. Or make a pull request.

assets/javascript/main.js

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import * as params from '@params';
2+
3+
/**
4+
*
5+
*/
6+
async function getReposData() {
7+
for (repo of params.projects.repos) {
8+
await fetch(`https://api.github.com/repos/${params.projects.githubUsername}/${repo.url}`)
9+
.then(response => response.json())
10+
.then(data => {
11+
repo.value = {
12+
name: data.name,
13+
description: data.description,
14+
url: data.html_url,
15+
stars: data.stargazers_count,
16+
forks: data.forks,
17+
};
18+
});
19+
};
20+
21+
return params.projects.repos;
22+
}
23+
24+
$(document).ready(function() {
25+
const theme = localStorage.getItem('theme');
26+
if (theme == 'dark') {
27+
$('html').attr('data-theme', 'dark');
28+
}
29+
30+
// Get lates blog posts.
31+
fetch(params.blog.sitemapUrl)
32+
.then(response => response.text())
33+
.then(str => new window.DOMParser().parseFromString(str, 'text/xml'))
34+
.then(data => {
35+
const channel = data.childNodes[0].childNodes[0];
36+
37+
let posts = 0;
38+
for (let entity of channel.childNodes.values()) {
39+
if (posts > 3) {
40+
break;
41+
}
42+
43+
if (entity.nodeName == 'item') {
44+
posts += 1;
45+
46+
// Separate the text of the post from it's banner image.
47+
const postText = entity.getElementsByTagName("description")[0].textContent.replace('src="/', `src="${params.blog.url}/`);
48+
const regex = /<div class="featured-image">\n.+\n.+<\/div>/g;
49+
const postImage = postText.match(regex);
50+
const postDescription = postText.replace(regex, '');
51+
let editedPostText = postDescription.split(' ', 60).join(' ');
52+
if (postDescription.split(' ').length > 60) {
53+
editedPostText += ' ...';
54+
}
55+
56+
$('.posts').append(`
57+
<div>
58+
<div class="uk-card uk-card-default">
59+
<div class="uk-card-header">
60+
<div class="uk-grid-small uk-flex-middle" uk-grid>
61+
<div class="uk-width-expand">
62+
<h3 class="uk-card-title uk-margin-remove-bottom"><b>${entity.getElementsByTagName("title")[0].textContent}</b></h3>
63+
<p class="uk-text-meta uk-margin-remove-top">
64+
<time datetime="2016-04-01T19:00">${entity.getElementsByTagName("pubDate")[0].textContent.split(':')[0].slice(0, -2)}</time>
65+
</p>
66+
</div>
67+
</div>
68+
</div>
69+
<div class="uk-card-media-top">
70+
${postImage}
71+
</div>
72+
<div class="uk-card-body">
73+
<p>${editedPostText}</p>
74+
</div>
75+
<div class="uk-card-footer">
76+
<a href="${entity.getElementsByTagName("link")[0].textContent}" target="_blank" class="uk-button uk-button-text">Go to Post</a>
77+
</div>
78+
</div>
79+
</div>
80+
`);
81+
}
82+
}
83+
});
84+
85+
// Get repos data from GitHub.
86+
getReposData()
87+
.then(repos => {
88+
repos.sort((a, b) => (a.value.stars < b.value.stars) ? 1 : -1);
89+
90+
for (repo of repos) {
91+
$('.repos').append(`
92+
<div>
93+
<div class="uk-card uk-card-default">
94+
<div class="uk-card-header">
95+
<div class="uk-grid-small uk-flex-middle" uk-grid>
96+
<div class="uk-width-expand">
97+
<h3 class="uk-card-title uk-margin-remove-bottom"><b>${repo.name}</b></h3>
98+
</div>
99+
</div>
100+
</div>
101+
<div class="uk-card-media-top">
102+
<a href="${repo.value.url}" target="_blank">
103+
<img src="img/projects/${repo.url}.webp">
104+
</a>
105+
</div>
106+
<div class="uk-card-body">
107+
<p>${repo.value.description}</p>
108+
</div>
109+
<div class="uk-card-footer">
110+
<span class="left">
111+
<i class="fas fa-star"></i>
112+
${repo.value.stars}
113+
</span>
114+
<span class="right">
115+
<i class="fal fa-code-merge"></i>
116+
${repo.value.forks}
117+
</span>
118+
</div>
119+
</div>
120+
</div>
121+
`);
122+
};
123+
});
124+
});

0 commit comments

Comments
 (0)