Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2c3eaf
Showing
5 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#img img { | ||
border-radius: 50%; | ||
width: 7%; | ||
} | ||
#social i { | ||
border: solid transparent 10px; | ||
color: blue; | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="https://kit.fontawesome.com/83d48be8cc.js" crossorigin="anonymous"></script> | ||
<title>xxx</title> | ||
<link rel="stylesheet" href="/css/style.css"> | ||
<script | ||
src="https://code.jquery.com/jquery-3.6.1.min.js" | ||
integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" | ||
crossorigin="anonymous"></script> | ||
<script src="js/links.js"></script> | ||
</head> | ||
<body> | ||
<header> | ||
<div id="img"><img src=""></div> | ||
<div id="name"> | ||
<h1 /> | ||
</div> | ||
<div id="desc" /> | ||
</header> | ||
<div id="social"> | ||
<h2>Social</h2> | ||
<p /> | ||
</div> | ||
<div id="links"> | ||
<h2>Links</h2> | ||
<ul /> | ||
</div> | ||
<footer> | ||
Made by @davorg. Code on GitHub. | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
$(document).ready( function() { | ||
$.getJSON( "/links.json", function ( data ) { | ||
$('#img').children('img').attr('src', '/img/' + data.image); | ||
$('#name h1').text(data.name + ' / @' + data.handle); | ||
$('title').text(data.name + ' / @' + data.handle); | ||
$('#desc').text(data.desc); | ||
|
||
$.each(data.social, function( index, value ) { | ||
console.log(value); | ||
let link = mk_social_link(value, data.handle); | ||
$('#social p').append( | ||
$('<a>').attr('href', link).append( | ||
$('<i>').attr('class', 'fa-brands fa-' + value.service + ' fa-3x') | ||
) | ||
); | ||
}); | ||
console.log($('#social p').html()); | ||
|
||
$.each(data.links, function( index, value ) { | ||
$('#links ul').append( | ||
$('<li>').append( | ||
$('<a>').attr('href', value.link).append(value.title) | ||
) | ||
); | ||
}); | ||
}) | ||
.fail(function(jqXHR, stat, err) { | ||
console.log( stat + ': ' + err ); | ||
}) | ||
}); | ||
|
||
function mk_social_link (social, default_handle) { | ||
let urls = { | ||
"facebook": "https://facebook.com/", | ||
"twitter": "https://twitter.com/", | ||
"instagram": "https://instagram.com/", | ||
"tiktok": "https://tiktok.com/@", | ||
"linkedin": "https://linkedin.com/in/", | ||
"email": "mailto:", | ||
"substack": "https://XXXX.substack.com/", | ||
"github": "https://github.com/", | ||
"medium": "https://XXXX.medium.com/" | ||
}; | ||
|
||
let handle = social.handle || default_handle; | ||
|
||
let url; | ||
|
||
if (social.service in urls) { | ||
url = urls[social.service]; | ||
} else { | ||
console.log('Unknown social service: ' + social.service); | ||
return ""; | ||
} | ||
|
||
if (url.match('XXXX')) { | ||
url = url.replace('XXXX', handle); | ||
} else { | ||
url = url + handle; | ||
} | ||
|
||
return(url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "Dave Cross", | ||
"handle": "davorg", | ||
"image": "davorg.jpg", | ||
"desc": "I make things from software. Some of them are useful.", | ||
"social": [{ | ||
"service": "facebook" | ||
}, { | ||
"service": "twitter" | ||
}, { | ||
"service": "instagram" | ||
}, { | ||
"service": "tiktok" | ||
}, { | ||
"service": "linkedin" | ||
}, { | ||
"service": "github" | ||
}, { | ||
"service": "medium" | ||
}], | ||
"links": [{ | ||
"title": "dev.to", | ||
"link": "https://dev.to/davorg" | ||
}, { | ||
"title": "Web site", | ||
"link": "https://davecross.co.uk/" | ||
}, { | ||
"title": "Substack", | ||
"link": "https://davecross.substack.com/" | ||
}, { | ||
"title": "Blog", | ||
"link": "https://blog.dave.org.uk/" | ||
}, { | ||
"title": "Email", | ||
"link": "mailto:dave@davecross.co.uk" | ||
}] | ||
} |