1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00
added emojis 👀🙌👌🔥
This commit is contained in:
imfunny 2019-05-09 21:49:54 +05:30 committed by GitHub
parent 61387b9cf7
commit 98e2524e1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1746 additions and 1721 deletions

View file

@ -74,6 +74,10 @@ body{
font-family: 'Questrial', sans-serif;
}
.emoji {
width:18px;
height:18px;
}
#profile_img_blog {
border-radius:50%;

View file

@ -6,7 +6,7 @@ options = {
};
program
.version('0.1.0')
.version('0.1.1')
.option('-t, --title [title]', 'give blog a title')
.parse(process.argv);

View file

@ -1,13 +1,14 @@
const program = require('commander');
const fs = require('fs');
const got = require('got');
const emoji = require('github-emoji');
const jsdom = require('jsdom').JSDOM,
options = {
resources: "usable"
};
program
.version('0.1.0')
.version('0.1.1')
.option('-n, --name [username]', 'get username')
.option('-d, --dark', 'enable dark mode')
.option('-b, --background [background]', 'set background image')
@ -46,6 +47,20 @@ if (program.background) {
populateCSS();
}
function convertToEmoji(text){
if (text == null) return;
text = text.toString();
if(text.match(/\:(.*)\:/) != null){
var str = text.match(/\:(.*)\:/)[1];
var output = emoji.of(str);
var emojiImage = output.url.replace("assets-cdn.github", "github.githubassets");
text = text.replace(/\:(.*)\:/, `<img src="${emojiImage}" class="emoji">`);
return text;
}else{
return text;
}
}
function populateHTML(username){
//add data to assets/index.html
jsdom.fromFile("./assets/index.html", options).then(function (dom) {
@ -62,7 +77,7 @@ jsdom.fromFile("./assets/index.html", options).then(function (dom) {
<section>
<div class="section_title">${repos[i].name}</div>
<div class="about_section">
${repos[i].description}
${convertToEmoji(repos[i].description)}
</div>
<div class="bottom_section">
<span><i class="fas fa-code"></i>&nbsp; ${repos[i].language}</span>
@ -84,7 +99,7 @@ jsdom.fromFile("./assets/index.html", options).then(function (dom) {
document.getElementById("profile_img").style.background = `url('${user.avatar_url}') center center`
document.getElementById("username").innerHTML = `<span>${user.name}</span><br>@${user.login}`;
//document.getElementById("github_link").href = `https://github.com/${user.login}`;
document.getElementById("userbio").innerHTML = user.bio;
document.getElementById("userbio").innerHTML = convertToEmoji(user.bio);
document.getElementById("userbio").style.display = user.bio == null || !user.bio ? 'none' : 'block';
document.getElementById("about").innerHTML = `
<span style="display:${user.email == null || !user.email ? 'none' : 'block'};"><i class="fas fa-envelope"></i> &nbsp; ${user.email}</span>

5
package-lock.json generated
View file

@ -315,6 +315,11 @@
"assert-plus": "^1.0.0"
}
},
"github-emoji": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/github-emoji/-/github-emoji-1.1.0.tgz",
"integrity": "sha512-FCs0tDDtX/pwkXN6sQE5lUC6B4PIIFC+rv7IZAw8956Mtvo5NQSWHEBJvExl+B8+ahqNVU0W33hMrXSIEFSUvA=="
},
"got": {
"version": "9.6.0",
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",

View file

@ -1,6 +1,6 @@
{
"name": "gitfolio",
"version": "1.0.0",
"version": "0.1.1",
"description": "portfolio website for showcasing your work",
"main": "build.js",
"scripts": {
@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"commander": "^2.20.0",
"github-emoji": "^1.1.0",
"got": "^9.6.0",
"jsdom": "^15.0.0"
}