Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button for Hacker News #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h2><code>&lt;a&gt;</code></h2>
<div class="shareon">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand All @@ -56,6 +57,7 @@ <h2><code>&lt;button&gt;</code></h2>
<div class="shareon">
<button class="facebook"></button>
<button class="fediverse"></button>
<button class="hackernews"></button>
<button class="linkedin"></button>
<button class="mastodon"></button>
<button class="messenger" data-fb-app-id="3619024578167617"></button>
Expand Down Expand Up @@ -86,6 +88,7 @@ <h2><code>&lt;a&gt;</code> with custom params</h2>
>
<a class="facebook"></a>
<a class="fediverse" data-s2f-instance="share2fedi.vercel.app"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon" data-via="@[email protected]"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand All @@ -110,6 +113,7 @@ <h2>Specimen</h2>
<div class="shareon specimen">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon">Toot</a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand Down
1 change: 1 addition & 0 deletions src/icons/hackernews.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/shareon.css
kytta marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
background-image: url("icons/fediverse.svg");
}

.shareon > .hackernews {
background-color: #fb651e;
}
.shareon > .hackernews:before {
background-image: url("icons/hackernews.svg");
}

.shareon > .linkedin {
background-color: #0a66c2;
}
Expand Down
1 change: 1 addition & 0 deletions src/shareon.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const urlBuilderMap = {
facebook: (d) => `https://www.facebook.com/sharer/sharer.php?u=${d.url}${d.hashtags ? `&hashtag=%23${d.hashtags.split('%2C')[0]}` : ''}`,
fediverse: (d) => `https://${d.s2fInstance}/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
email: (d) => `mailto:?subject=${d.title}&body=${d.url}`,
hackernews: (d) => `https://news.ycombinator.com/submitlink?u=${d.url}&t=${d.title}`,
linkedin: (d) => `https://www.linkedin.com/sharing/share-offsite/?url=${d.url}`,
mastodon: (d) => `https://toot.kytta.dev/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
messenger: (d) => `https://www.facebook.com/dialog/send?app_id=${d.fbAppId}&link=${d.url}&redirect_uri=${d.url}`,
Expand Down
Loading