Skip to content

Commit

Permalink
allow overriding the social-share link for all
Browse files Browse the repository at this point in the history
this allows injecting a dedicated target link for all the supported social-media platforms -- not only github and telemark
  • Loading branch information
marc-portier committed Aug 8, 2023
1 parent 9bd8539 commit 9722d17
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions assets/gitbook/gitbook-plugin-sharing/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,13 @@ require(['gitbook', 'jquery'], function(gitbook, $) {
if (!opts[sideId]) return;

var onClick = site.onClick;

if (sideId === "github" && opts["github_link"] !== undefined && opts["github_link"] !== "") {
onClick = function(e) {
e.preventDefault();
window.open(opts["github_link"]);
}
}
if (sideId === "telegram" && opts["telegram_link"] !== undefined && opts["telegram_link"] !== "") {

// override target link with provided link
var side_link = opts[`${sideId}_link`]
if (side_link !== undefined && side_link !== "") {
onClick = function(e) {
e.preventDefault();
window.open(opts["telegram_link"]);
window.open(side_link);
}
}

Expand Down

0 comments on commit 9722d17

Please sign in to comment.