mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-04 16:55:51 +01:00
Preserve fragment ID when yanking short URLs.
This commit is contained in:
@@ -624,11 +624,20 @@ var Buffer = Module("Buffer", {
|
|||||||
get shortURL() {
|
get shortURL() {
|
||||||
let { uri, doc } = this;
|
let { uri, doc } = this;
|
||||||
|
|
||||||
|
function hashify(url) {
|
||||||
|
let newURI = util.newURI(url);
|
||||||
|
|
||||||
|
if (uri.hasRef && !newURI.hasRef)
|
||||||
|
newURI.ref = uri.ref;
|
||||||
|
|
||||||
|
return newURI.spec;
|
||||||
|
}
|
||||||
|
|
||||||
for each (let shortener in Buffer.uriShorteners)
|
for each (let shortener in Buffer.uriShorteners)
|
||||||
try {
|
try {
|
||||||
let shortened = shortener(uri, doc);
|
let shortened = shortener(uri, doc);
|
||||||
if (shortened)
|
if (shortened)
|
||||||
return shortened.spec;
|
return hashify(shortened.spec);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
util.reportError(e);
|
util.reportError(e);
|
||||||
@@ -637,7 +646,7 @@ var Buffer = Module("Buffer", {
|
|||||||
let link = DOM("link[href][rev=canonical], \
|
let link = DOM("link[href][rev=canonical], \
|
||||||
link[href][rel=shortlink]", doc);
|
link[href][rel=shortlink]", doc);
|
||||||
if (link)
|
if (link)
|
||||||
return link.attr("href");
|
return hashify(link.attr("href"));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user