Procházet zdrojové kódy

added "url-referrer-flat" template variable

Gildas před 5 roky
rodič
revize
6da851b9d1

+ 3 - 1
extension/ui/pages/help.html

@@ -537,7 +537,9 @@
 						string of the URL (e.g. "url-search-order" will return "ascending" in the previous example)</li>
 					<li><code>{url-hash}</code>: the hash of the URL (e.g. "chapter-2")</li>
 					<li><code>{url-referrer}</code>: the URI of the page that "linked" to the page (e.g.
-						"http_example.com")</li>
+						"http://example.com")</li>
+					<li><code>{url-referrer-flat}</code>: the URI of the page that "linked" to the page with slashed
+						replaced (e.g. "http_example.com")</li>
 					<li><code>{tab-id}</code>: the unique identifier of the tab (e.g. "326")</li>
 					<li><code>{tab-index}</code>: the index of the tab in the window (e.g. "1")</li>
 					<li><code>{digest-sha-256}</code>: the SHA-256 hash value of the entire page content (e.g.

+ 2 - 1
lib/single-file/single-file-core.js

@@ -1450,7 +1450,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 			template = await evalTemplateVariable(template, "url-hostname", () => url.hostname.replace(/\/$/, "") || "No hostname", dontReplaceSlash, options.filenameReplacementCharacter);
 			template = await evalTemplateVariable(template, "url-href", () => decode(url.href) || "No href", dontReplaceSlash === undefined ? true : dontReplaceSlash, options.filenameReplacementCharacter);
 			template = await evalTemplateVariable(template, "url-href-flat", () => decode(url.href) || "No href", false, options.filenameReplacementCharacter);
-			template = await evalTemplateVariable(template, "url-referrer", () => decode(options.referrer) || "No referrer", dontReplaceSlash, options.filenameReplacementCharacter);
+			template = await evalTemplateVariable(template, "url-referrer", () => decode(options.referrer) || "No referrer", dontReplaceSlash === undefined ? true : dontReplaceSlash, options.filenameReplacementCharacter);
+			template = await evalTemplateVariable(template, "url-referrer-flat", () => decode(options.referrer) || "No referrer", dontReplaceSlash, options.filenameReplacementCharacter);
 			template = await evalTemplateVariable(template, "url-password", () => url.password || "No password", dontReplaceSlash, options.filenameReplacementCharacter);
 			template = await evalTemplateVariable(template, "url-pathname", () => decode(url.pathname).replace(/^\//, "").replace(/\/$/, "") || "No pathname", dontReplaceSlash === undefined ? true : dontReplaceSlash, options.filenameReplacementCharacter);
 			template = await evalTemplateVariable(template, "url-pathname-flat", () => decode(url.pathname) || "No pathname", false, options.filenameReplacementCharacter);