diff --git a/README.md b/README.md index 0764bd2..895767e 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ names of which match the names of the social networks (or `copy-url`, for the + @@ -139,12 +140,13 @@ Apart from the URL and title, some networks support extra parameters: even possible - add `data-media` to an Odnoklassniki, Pinterest, or VK button to customize the pinned picture -- add `data-text` to a WhatsApp, Mastodon, Telegram, or Viber button to add +- add `data-text` to a Mastodon, Telegram, Tumblr, Viber, or WhatsApp button to add custom message text -- add `data-via` to a Twitter or Mastodon button to mention a user -- add `data-hashtags` to a Twitter or Facebook button to include hashtags in the shared post. - - Twitter supports multiple hashtags, and you need to specify them with out `#` and seperated with `,`, it shoule be something like this `ai,technologies,aigc`. - - Facebook only supports a single hashtag. If you pass multiple hashtags with `,` seperated, the library will only use the first one. +- add `data-via` to a Mastodon, Tumblr, or Twitter button to mention a user +- add `data-hashtags` to a Facebook, Tumblr, or Twitter button to include hashtags in the shared post. + - should be a comma-separated string, for example `stuff,tech,buttons` + - Twitter & Tumblr support multiple hashtags + - Facebook only supports a single hashtag; only the first one will be used Here are all custom parameters: @@ -154,6 +156,7 @@ Here are all custom parameters: Pin + Send diff --git a/index.html b/index.html index 9cca2e3..bde6cca 100644 --- a/index.html +++ b/index.html @@ -39,6 +39,7 @@ + @@ -60,6 +61,7 @@ + @@ -86,6 +88,7 @@ + @@ -108,6 +111,7 @@ + Tweet
diff --git a/src/icons/tumblr.svg b/src/icons/tumblr.svg new file mode 100644 index 0000000..6d46ad6 --- /dev/null +++ b/src/icons/tumblr.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/shareon.css b/src/shareon.css index bb6a646..8339582 100644 --- a/src/shareon.css +++ b/src/shareon.css @@ -140,6 +140,13 @@ background-image: url("icons/reddit.svg"); } +.shareon > .teams { + background-color: #6264a7; +} +.shareon > .teams:before { + background-image: url("icons/teams.svg"); +} + .shareon > .telegram { background-color: #26a5e4; } @@ -147,11 +154,11 @@ background-image: url("icons/telegram.svg"); } -.shareon > .teams { - background-color: #6264a7; +.shareon > .tumblr { + background-color: #36465d; } -.shareon > .teams:before { - background-image: url("icons/teams.svg"); +.shareon > .tumblr:before { + background-image: url("icons/tumblr.svg"); } .shareon > .twitter { diff --git a/src/shareon.js b/src/shareon.js index 47f9b31..d5ce29f 100644 --- a/src/shareon.js +++ b/src/shareon.js @@ -27,6 +27,7 @@ const urlBuilderMap = { reddit: (d) => `https://www.reddit.com/submit?title=${d.title}&url=${d.url}`, teams: (d) => `https://teams.microsoft.com/share?href=${d.url}${d.text ? `&msgText=${d.text}` : ''}`, telegram: (d) => `https://telegram.me/share/url?url=${d.url}${d.text ? `&text=${d.text}` : ''}`, + tumblr: (d) => `https://www.tumblr.com/widgets/share/tool?posttype=link${d.hashtags? `&tags=${d.hashtags}` : ''}&title=${d.title}&content=${d.url}&canonicalUrl=${d.url}${d.text? `&caption=${d.text}`:''}${d.via? `&show-via=${d.via}`:''}`, twitter: (d) => `https://twitter.com/intent/tweet?url=${d.url}&text=${d.title}${d.via ? `&via=${d.via}` : ''}${d.hashtags? `&hashtags=${d.hashtags}` : ''}`, viber: (d) => `viber://forward?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}`, vkontakte: (d) => `https://vk.com/share.php?url=${d.url}&title=${d.title}${d.media ? `&image=${d.media}` : ''}`,