1
Fork 0

Use shareon for social links

This commit is contained in:
Jake Howard 2021-07-03 12:02:28 +01:00
parent 2c604dafcb
commit ce63774cbd
Signed by: jake
GPG key ID: 57AFB45680EDD477
6 changed files with 33 additions and 87 deletions

View file

@ -11,6 +11,7 @@
{{ partial "style.html" "scss/style.scss" }}
{{ partial "style.html" "css/font-awesome.css" }}
{{ partial "style.html" "css/highlight.css" }}
{{ partial "style.html" "css/shareon.css" }}
{{ if eq .Params.layout "flickr" }}
{{ partial "style.html" "css/lightgallery.css" }}

View file

@ -1,11 +1,19 @@
{{ if .Section }}
<div class="container mt-5 text-center">
<small>Share this page</small>
<h3>
<a href="https://twitter.com/intent/tweet?text={{ .Permalink }}" title="Share on Twitter"><i class="mx-1 fab fa-twitter" aria-hidden="true"></i></a>
<a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" class="Share on Facebook"><i class="mx-1 fab fa-facebook" aria-hidden="true"></i></a>
<a href="http://www.reddit.com/submit?url={{ .Permalink }}" title="Share on Reddit"><i class="mx-1 fab fa-reddit" aria-hidden="true"></i></a>
<a href="{{ .Permalink }}" data-clipboard-text="{{ .Permalink }}" title="Copy link to clipboard"><i class="mx-1 fas fa-copy" aria-hidden="true"></i></a>
</h3>
<div class="shareon" data-title="{{ .Title }}" data-url="{{ .Permalink }}">
<a class="facebook"></a>
<a class="linkedin"></a>
<a class="mastodon"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="pocket"></a>
<button class="reddit"></button>
<button class="telegram"></button>
<button class="twitter" data-via="{{ .Site.Data.social.accounts.twitter.username }}"></button>
<button class="viber"></button>
<button class="vkontakte"></button>
<button class="whatsapp"></button>
</div>
</div>
{{ end }}

80
package-lock.json generated
View file

@ -9,12 +9,12 @@
"dependencies": {
"@fortawesome/fontawesome-free": "5.15.3",
"bootstrap": "4.6.0",
"clipboard": "2.0.8",
"elevator.js": "1.0.1",
"jquery": "3.6.0",
"lg-thumbnail": "1.2.1",
"lightgallery": "1.10.0",
"lunr": "2.3.9"
"lunr": "2.3.9",
"shareon": "1.6.2"
},
"devDependencies": {
"broken-link-checker-local": "0.2.1",
@ -1348,16 +1348,6 @@
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
"dev": true
},
"node_modules/clipboard": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz",
"integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==",
"dependencies": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"node_modules/cliui": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
@ -1703,11 +1693,6 @@
"node": ">= 0.4"
}
},
"node_modules/delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"node_modules/depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@ -3790,14 +3775,6 @@
"integrity": "sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag=",
"dev": true
},
"node_modules/good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"dependencies": {
"delegate": "^3.1.2"
}
},
"node_modules/graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
@ -6221,11 +6198,6 @@
"integrity": "sha1-8MgtmKOxOah3aogIBQuCRDEIf8o=",
"dev": true
},
"node_modules/select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
@ -6311,6 +6283,11 @@
"sha.js": "bin.js"
}
},
"node_modules/shareon": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-1.6.2.tgz",
"integrity": "sha512-MLvXj3pI+MkixWKWJ0lp0hcq4ep9A3HotIpM/HRRd1j1BedCuTDMxYCf9iHCMA5Dar6UGVgDi6mpeaNJlSxmPg=="
},
"node_modules/shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@ -7090,11 +7067,6 @@
"node": ">=0.6.0"
}
},
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"node_modules/tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@ -8756,16 +8728,6 @@
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
"dev": true
},
"clipboard": {
"version": "2.0.8",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.8.tgz",
"integrity": "sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==",
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"cliui": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
@ -9060,11 +9022,6 @@
"object-keys": "^1.0.12"
}
},
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@ -10831,14 +10788,6 @@
}
}
},
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"requires": {
"delegate": "^3.1.2"
}
},
"graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
@ -12844,11 +12793,6 @@
"integrity": "sha1-8MgtmKOxOah3aogIBQuCRDEIf8o=",
"dev": true
},
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
@ -12924,6 +12868,11 @@
"safe-buffer": "^5.0.1"
}
},
"shareon": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/shareon/-/shareon-1.6.2.tgz",
"integrity": "sha512-MLvXj3pI+MkixWKWJ0lp0hcq4ep9A3HotIpM/HRRd1j1BedCuTDMxYCf9iHCMA5Dar6UGVgDi6mpeaNJlSxmPg=="
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@ -13596,11 +13545,6 @@
"setimmediate": "^1.0.4"
}
},
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",

View file

@ -15,11 +15,11 @@
"dependencies": {
"@fortawesome/fontawesome-free": "5.15.3",
"bootstrap": "4.6.0",
"clipboard": "2.0.8",
"elevator.js": "1.0.1",
"jquery": "3.6.0",
"lg-thumbnail": "1.2.1",
"lightgallery": "1.10.0",
"lunr": "2.3.9"
"lunr": "2.3.9",
"shareon": "1.6.2"
}
}

View file

@ -16,6 +16,7 @@ cp -r $BASEDIR/node_modules/lightgallery/dist/img/* $STATIC_BUILD/img
cp -r $BASEDIR/node_modules/@fortawesome/fontawesome-free/css/all.min.css $STATIC_BUILD/css/font-awesome.css
cp $BASEDIR/node_modules/lightgallery/dist/css/lightgallery.min.css $STATIC_BUILD/css/lightgallery.css
cp -r $BASEDIR/node_modules/@fortawesome/fontawesome-free/webfonts $STATIC_BUILD
cp $BASEDIR/node_modules/shareon/dist/shareon.min.css $STATIC_BUILD/css/shareon.css
cp -r $STATIC_SRC/js/ $STATIC_BUILD/js/
cp $BASEDIR/node_modules/jquery/dist/jquery.min.js $STATIC_BUILD/js/jquery.min.js

View file

@ -1,5 +1,5 @@
const Clipboard = require('clipboard');
const Elevator = require('elevator.js');
const shareon = require('shareon');
function waitFor(obj, property, callback) {
// Wait for a property to exist on window before running callback
@ -22,12 +22,6 @@ $(document).ready(function() {
});
});
new Clipboard('a').on('success', function(e) {
const ele = $(e.trigger);
ele.find('i').attr('class', 'fas fa-check');
alert('Copied "' + ele.data('clipboard-text') + '" to clipboard!');
});
// HACK: ToC has blank li if no initial header
$('#TableOfContents').each(function() {
let ele = $(this);
@ -59,6 +53,8 @@ $(document).ready(function() {
endAudio: '/audio/ding.mp3',
preloadAudio: false,
});
shareon();
});
function scrollTo(offset) {
@ -84,7 +80,3 @@ $('a[href^="#"] ').on('click', function(event) {
scrollTo(target.offset().top);
}
});
$('[data-clipboard-text]').on('click', function(event) {
event.preventDefault();
});