Fix copyURLPath

This commit is contained in:
Maddison Hellstrom 2017-11-18 00:11:22 -08:00
parent 41ad899577
commit e4aebe5a33
1 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ mapkey('=D', "Lookup all information for domain", dnsVerbose, ri);
mapkey(';se', "#11Edit Settings", editSettings, ri); mapkey(';se', "#11Edit Settings", editSettings, ri);
mapkey(';pd', "Toggle PDF viewer from SurfingKeys", togglePdfViewer, ri); mapkey(';pd', "Toggle PDF viewer from SurfingKeys", togglePdfViewer, ri);
mapkey('gi', "Edit current URL with vim editor", vimEditURL, ri); mapkey('gi', "Edit current URL with vim editor", vimEditURL, ri);
mapkey('yp', "Copy URL path of current page", copyURLPath, ri); mapkey('yp', "Copy URL path of current page", () => copyURLPath(), ri);
const siteleader = "<Space>"; const siteleader = "<Space>";
@ -229,9 +229,9 @@ function togglePdfViewer() {
} }
function getURLPath(count, domain) { function getURLPath(count, domain) {
var path = window.location.pathname; var path = window.location.pathname.slice(1);
if (count) { if (count) {
path = path.split('/').slice(1,1+count).join('/'); path = path.split('/').slice(0, count).join('/');
} }
if (domain) { if (domain) {
path = window.location.hostname + '/' + path; path = window.location.hostname + '/' + path;