Merge branch 'pull/4985'
This commit is contained in:
commit
7e7ede890e
13 changed files with 211 additions and 0 deletions
21
app/assets/javascripts/social_share_button.js
Normal file
21
app/assets/javascripts/social_share_button.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
function openShareUrl(url, initialWidth = 640, initialHeight = 480) {
|
||||
const width = Math.max(100, Math.min(screen.width, initialWidth));
|
||||
const height = Math.max(100, Math.min(screen.height, initialHeight));
|
||||
|
||||
const left = (screen.width / 2) - (width / 2);
|
||||
const top = (screen.height * 0.3) - (height / 2);
|
||||
const opts = `width=${width},height=${height},left=${left},top=${top},menubar=no,status=no,location=no`;
|
||||
|
||||
window.open(url, "popup", opts);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".ssb-icon").on("click", function (e) {
|
||||
const shareUrl = $(this).attr("href");
|
||||
if (!shareUrl.startsWith("mailto:")) {
|
||||
e.preventDefault();
|
||||
openShareUrl(shareUrl);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue