浏览代码

added includeBOM option (fix #369)

Former-commit-id: 950b8e809d8f01f93d8bfbaecbd2d458ea33a81b
= 6 年之前
父节点
当前提交
e3420df496
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 2 1
      extension/core/bg/config.js
  2. 3 0
      extension/core/content/content-download.js

+ 2 - 1
extension/core/bg/config.js

@@ -89,7 +89,8 @@ singlefile.extension.core.bg.config = (() => {
 		saveCreatedBookmarks: false,
 		ignoredBookmarkFolders: [],
 		replaceBookmarkURL: true,
-		saveFavicon: true
+		saveFavicon: true,
+		includeBOM: false
 	};
 
 	let configStorage;

+ 3 - 0
extension/core/content/content-download.js

@@ -35,6 +35,9 @@ this.singlefile.extension.core.content.download = this.singlefile.extension.core
 		if (options.includeInfobar) {
 			await singlefile.common.ui.content.infobar.includeScript(pageData);
 		}
+		if (options.includeBOM) {
+			pageData.content = "\ufeff" + pageData.content;
+		}
 		if (options.backgroundSave || options.openEditor || options.saveToGDrive) {
 			for (let blockIndex = 0; blockIndex * MAX_CONTENT_SIZE < pageData.content.length; blockIndex++) {
 				const message = {