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>
<div id="PinryNav" class="navbar-menu" :class="{ 'is-active': active}"> <div id="PinryNav" class="navbar-menu" :class="{ 'is-active': active}">
<div class="navbar-start"> <div class="navbar-start">
<a class="navbar-item"> <a class="navbar-item" :href="bookmarkLet">
BookmarkLet BookmarkLet
</a> </a>
<div <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: { methods: {
toggleMenu() { toggleMenu() {
this.active = !this.active; this.active = !this.active;

View File

@@ -10,6 +10,10 @@ module.exports = {
target: 'http://localhost:8000/', target: 'http://localhost:8000/',
changeOrigin: true, changeOrigin: true,
}, },
'/static/js/': {
target: 'http://localhost:8000/',
changeOrigin: true,
},
}, },
}, },
}; };