|
|
@@ -463,6 +463,17 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
(infobarContent ? " \n info: " + infobarContent : "") + "\n");
|
|
|
this.doc.documentElement.insertBefore(commentNode, this.doc.documentElement.firstChild);
|
|
|
}
|
|
|
+ if (this.options.insertCanonicalLink) {
|
|
|
+ let canonicalLink = this.doc.querySelector("link[rel=canonical]");
|
|
|
+ if (!canonicalLink) {
|
|
|
+ canonicalLink = this.doc.createElement("link");
|
|
|
+ canonicalLink.setAttribute("rel", "canonical");
|
|
|
+ this.doc.head.appendChild(canonicalLink);
|
|
|
+ }
|
|
|
+ if (canonicalLink && !canonicalLink.href) {
|
|
|
+ canonicalLink.href = this.options.saveUrl;
|
|
|
+ }
|
|
|
+ }
|
|
|
let size;
|
|
|
if (this.options.displayStats) {
|
|
|
size = util.getContentSize(this.doc.documentElement.outerHTML);
|
|
|
@@ -958,6 +969,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
|
|
|
async function initializeProcessor(frameData, frameElement, frameWindowId, batchRequest, options) {
|
|
|
options.insertSingleFileComment = false;
|
|
|
+ options.insertCanonicalLink = false;
|
|
|
options.saveFavicon = false;
|
|
|
options.doc = null;
|
|
|
options.win = null;
|
|
|
@@ -1045,6 +1057,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
linkElement.removeAttribute("href");
|
|
|
const options = Object.create(this.options);
|
|
|
options.insertSingleFileComment = false;
|
|
|
+ options.insertCanonicalLink = false;
|
|
|
options.saveFavicon = false;
|
|
|
options.removeUnusedStyles = false;
|
|
|
options.removeAlternativeMedias = false;
|