|
|
@@ -21,7 +21,7 @@
|
|
|
* Source.
|
|
|
*/
|
|
|
|
|
|
-/* global browser, document, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node */
|
|
|
+/* global browser, document, prompt, getComputedStyle, addEventListener, removeEventListener, requestAnimationFrame, setTimeout, getSelection, Node, URL */
|
|
|
|
|
|
const singlefile = globalThis.singlefile;
|
|
|
|
|
|
@@ -172,7 +172,9 @@ function getSelectedLinks() {
|
|
|
if (range.startContainer != range.endContainer || range.startOffset != range.endOffset) {
|
|
|
selectionFound = true;
|
|
|
if (treeWalker.currentNode.tagName == "A" && treeWalker.currentNode.href) {
|
|
|
- links.push(treeWalker.currentNode.href);
|
|
|
+ const url = new URL(treeWalker.currentNode.href);
|
|
|
+ url.hash = "";
|
|
|
+ links.push(url.href);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -185,7 +187,9 @@ function getSelectedLinks() {
|
|
|
if (selectionFound && treeWalker.currentNode == range.endContainer && treeWalker.currentNode.querySelectorAll) {
|
|
|
treeWalker.currentNode.querySelectorAll("*").forEach(descendantElement => {
|
|
|
if (descendantElement.tagName == "A" && descendantElement.href) {
|
|
|
- links.push(treeWalker.currentNode.href);
|
|
|
+ const url = new URL(descendantElement.href);
|
|
|
+ url.hash = "";
|
|
|
+ links.push(url.href);
|
|
|
}
|
|
|
});
|
|
|
}
|