Compare commits

..

No commits in common. "73bebb8eee97f14cf88fda61b87c15cac49378eb" and "d51379df1a9295f0a8d25fb91cf8927bb336d659" have entirely different histories.

5 changed files with 52 additions and 5 deletions

View file

@ -19,7 +19,7 @@ description: >- # this means to ignore newlines until "baseurl:"
Blog and portfolio for Em (Ethan) Ruszanowski. Blog and portfolio for Em (Ethan) Ruszanowski.
github_username: emrusz github_username: emrusz
minimal_mistakes_skin: dark minimal_mistakes_skin: dark
search: true search: false
# Build settings # Build settings
markdown: kramdown markdown: kramdown
@ -57,9 +57,8 @@ plugins:
author: author:
name: "Em (Ethan) Ruszanowski" name: "Em (Ethan) Ruszanowski"
avatar: "/assets/images/avatar.jpg" avatar: "/assets/images/avatar.png"
bio: "Data engineer, polyglot developer, and RIT Computing and Information Technologies alum." bio: "Data engineer, polyglot developer, and RIT Computing and Information Technologies alum."
location: "Rochester, NY"
links: links:
- label: "Email" - label: "Email"
icon: "fas fa-fw fa-envelope" icon: "fas fa-fw fa-envelope"
@ -92,6 +91,9 @@ footer:
icon: "fas fa-fw fa-heartbeat" icon: "fas fa-fw fa-heartbeat"
url: "https://status.rusz.dev" url: "https://status.rusz.dev"
after_footer_scripts:
- assets/js/clipboard.js
social: social:
type: type:
names: names:
@ -119,8 +121,6 @@ defaults:
layout: single layout: single
author_profile: true author_profile: true
enable_copy_code_button: true
category_archive: category_archive:
type: liquid type: liquid
path: /categories/ path: /categories/

View file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 KiB

BIN
assets/images/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

47
assets/js/clipboard.js Normal file
View file

@ -0,0 +1,47 @@
/*
* A nice little clipboard script provided by crykn. Thanks!
*/
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function onClickEffect(btn, style) {
btn.removeClass("btn-light");
btn.addClass(style);
await sleep(250);
btn.removeClass(style);
btn.addClass("btn-light");
}
$(document).ready(function() {
// Create butons
$(".page__content pre > code").each(function() {
$(this).parent().prepend(
$(document.createElement('button')).prop({
type: 'button',
innerHTML: '<i class="far fa-copy"></i>',
})
.attr('title', 'Copy to clipboard')
.addClass('btn')
.addClass('btn--primary')
.css('position', 'absolute')
.css('right', '1em')
// Click listener
.on('click', function() {
let codeElement = $(this).parent().children('code').first();
if (!codeElement) {
throw new Error("Unexpected error! No corresponding code block was found for this button.");
}
// Blink effect
onClickEffect($(this), "btn--success")
// Copy to clipoard function
navigator.clipboard.writeText($(codeElement).text()).then(() => true, () => true);
return true;
})
);
});
});