Feature: Add bookmarklet link generation in PHeader

This commit is contained in:
winkidney
2019-12-08 14:37:13 +08:00
committed by Isaac Bythewood
parent 2c92cf45b7
commit 55d7d61b17
2 changed files with 12 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
</div>
<div id="PinryNav" class="navbar-menu" :class="{ 'is-active': active}">
<div class="navbar-start">
<a class="navbar-item">
<a class="navbar-item" :href="bookmarkLet">
BookmarkLet
</a>
<div
@@ -117,6 +117,13 @@ export default {
},
};
},
computed: {
bookmarkLet() {
const url = new URL(window.location);
const host = url.origin;
return `javascript:void((function(d){var s=d.createElement('script');s.id='pinry-bookmarklet';s.src='${host}/static/js/bookmarklet.js?'+Math.random()*10000000000000000;d.body.appendChild(s)})(document));`;
},
},
methods: {
toggleMenu() {
this.active = !this.active;