Просмотр исходного кода

split extension/index.js

Former-commit-id: 3e4f24614071a25fba04adecc24ef86867cfb5da
Gildas 6 лет назад
Родитель
Сommit
a1aa22a1e5

+ 1 - 1
extension/core/bg/autosave.js

@@ -118,7 +118,7 @@ singlefile.extension.core.bg.autosave = (() => {
 		options.incognito = tab.incognito;
 		options.tabId = tabId;
 		options.tabIndex = tab.index;
-		const pageData = await singlefile.extension.getPageData(options, null, null);
+		const pageData = await singlefile.extension.lib.getPageData(options, null, null);
 		if (options.includeInfobar) {
 			await singlefile.common.ui.content.infobar.includeScript(pageData);
 		}

+ 3 - 0
extension/core/bg/business.js

@@ -34,6 +34,9 @@ singlefile.extension.core.bg.business = (() => {
 	const extensionScriptFiles = [
 		"common/index.js",
 		"common/ui/content/content-infobar.js",
+		"extension/index.js",
+		"extension/core/index.js",
+		"extension/ui/index.js",
 		"extension/core/content/content-main.js",
 		"extension/ui/content/content-ui-main.js"
 	];

+ 27 - 0
extension/core/index.js

@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010-2019 Gildas Lormeau
+ * contact : gildas.lormeau <at> gmail.com
+ * 
+ * This file is part of SingleFile.
+ *
+ *   The code in this file is free software: you can redistribute it and/or 
+ *   modify it under the terms of the GNU Affero General Public License 
+ *   (GNU AGPL) as published by the Free Software Foundation, either version 3
+ *   of the License, or (at your option) any later version.
+ * 
+ *   The code in this file is distributed in the hope that it will be useful, 
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 
+ *   General Public License for more details.
+ *
+ *   As additional permission under GNU AGPL version 3 section 7, you may 
+ *   distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU 
+ *   AGPL normally required by section 4, provided you include this license 
+ *   notice and a URL through which recipients can access the Corresponding 
+ *   Source.
+ */
+
+this.singlefile.extension.core = this.singlefile.extension.core || {
+	bg: {},
+	content: {}
+};

+ 1 - 28
extension/index.js

@@ -21,31 +21,4 @@
  *   Source.
  */
 
-this.singlefile.extension = this.singlefile.extension || {
-	core: {
-		common: {},
-		bg: {},
-		content: {}
-	},
-	ui: {
-		bg: {},
-		content: {}
-	},
-	lib: {
-		core: {
-			bg: {}
-		},
-		fetch: {
-			bg: {},
-			content: {}
-		},
-		frameTree: {
-			bg: {}
-		},
-		lazy: {
-			bg: {}
-		},
-	},
-	injectScript: (tabId, options) => this.singlefile.extension.lib.core.bg.scripts.inject(tabId, options),
-	getPageData: (options, doc, win) => this.singlefile.lib.getPageData(options, { fetch: this.singlefile.extension.lib.fetch.content.resources.fetch }, doc, win)
-};
+this.singlefile.extension = this.singlefile.extension || {};

+ 2 - 0
extension/lib/single-file/core/bg/scripts.js

@@ -49,6 +49,7 @@ singlefile.extension.lib.core.bg.scripts = (() => {
 		"lib/single-file/processors/lazy/content/content-lazy-loader.js",
 		"lib/single-file/processors/hooks/content/content-hooks.js",
 		"extension/index.js",
+		"extension/lib/single-file/index.js",
 		"extension/lib/single-file/browser-polyfill/chrome-browser-polyfill.js",
 		"extension/lib/single-file/fetch/content/content-fetch.js",
 	];
@@ -59,6 +60,7 @@ singlefile.extension.lib.core.bg.scripts = (() => {
 		"lib/single-file/processors/hooks/content/content-hooks-frames.js",
 		"lib/single-file/processors/frame-tree/content/content-frame-tree.js",
 		"extension/index.js",
+		"extension/lib/single-file/index.js",
 		"extension/lib/single-file/browser-polyfill/chrome-browser-polyfill.js",
 		"extension/lib/single-file/fetch/content/content-fetch.js"
 	];

+ 40 - 0
extension/lib/single-file/index.js

@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010-2019 Gildas Lormeau
+ * contact : gildas.lormeau <at> gmail.com
+ * 
+ * This file is part of SingleFile.
+ *
+ *   The code in this file is free software: you can redistribute it and/or 
+ *   modify it under the terms of the GNU Affero General Public License 
+ *   (GNU AGPL) as published by the Free Software Foundation, either version 3
+ *   of the License, or (at your option) any later version.
+ * 
+ *   The code in this file is distributed in the hope that it will be useful, 
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 
+ *   General Public License for more details.
+ *
+ *   As additional permission under GNU AGPL version 3 section 7, you may 
+ *   distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU 
+ *   AGPL normally required by section 4, provided you include this license 
+ *   notice and a URL through which recipients can access the Corresponding 
+ *   Source.
+ */
+
+this.singlefile.extension.lib = this.singlefile.extension.lib || {
+	core: {
+		bg: {}
+	},
+	fetch: {
+		bg: {},
+		content: {}
+	},
+	frameTree: {
+		bg: {}
+	},
+	lazy: {
+		bg: {}
+	},
+	injectScript: (tabId, options) => this.singlefile.extension.lib.core.bg.scripts.inject(tabId, options),
+	getPageData: (options, doc, win) => this.singlefile.lib.getPageData(options, { fetch: this.singlefile.extension.lib.fetch.content.resources.fetch }, doc, win)
+};

+ 27 - 0
extension/ui/index.js

@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010-2019 Gildas Lormeau
+ * contact : gildas.lormeau <at> gmail.com
+ * 
+ * This file is part of SingleFile.
+ *
+ *   The code in this file is free software: you can redistribute it and/or 
+ *   modify it under the terms of the GNU Affero General Public License 
+ *   (GNU AGPL) as published by the Free Software Foundation, either version 3
+ *   of the License, or (at your option) any later version.
+ * 
+ *   The code in this file is distributed in the hope that it will be useful, 
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 
+ *   General Public License for more details.
+ *
+ *   As additional permission under GNU AGPL version 3 section 7, you may 
+ *   distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU 
+ *   AGPL normally required by section 4, provided you include this license 
+ *   notice and a URL through which recipients can access the Corresponding 
+ *   Source.
+ */
+
+this.singlefile.extension.ui = this.singlefile.extension.ui || {
+	bg: {},
+	content: {}
+};

+ 5 - 0
manifest.json

@@ -19,6 +19,7 @@
 			"js": [
 				"lib/single-file/index.js",
 				"extension/index.js",
+				"extension/lib/single-file/index.js",
 				"extension/lib/single-file/browser-polyfill/chrome-browser-polyfill.js",
 				"lib/single-file/single-file-helper.js",
 				"lib/single-file/processors/hooks/content/content-hooks-frames.js",
@@ -44,6 +45,7 @@
 				"lib/single-file/index.js",
 				"lib/single-file/processors/hooks/content/content-hooks.js",
 				"extension/index.js",
+				"extension/core/index.js",
 				"extension/core/content/content-bootstrap.js"
 			]
 		}
@@ -52,6 +54,9 @@
 		"scripts": [
 			"lib/single-file/index.js",
 			"extension/index.js",
+			"extension/core/index.js",
+			"extension/ui/index.js",
+			"extension/lib/single-file/index.js",
 			"extension/lib/single-file/browser-polyfill/chrome-browser-polyfill.js",
 			"lib/single-file/vendor/css-minifier.js",
 			"lib/single-file/vendor/css-tree.js",