Explorar o código

integrated lazy-loader into frame-tree

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
5e0bcca98e
Modificáronse 3 ficheiros con 7 adicións e 4 borrados
  1. 2 3
      extension/core/bg/script-loader.js
  2. 4 1
      lib/single-file/frame-tree.js
  3. 1 0
      manifest.json

+ 2 - 3
extension/core/bg/script-loader.js

@@ -29,6 +29,7 @@ singlefile.scriptLoader = (() => {
 		"/lib/single-file/vendor/html-srcset-parser.js",
 		"/lib/single-file/doc-helper.js",
 		"/lib/fetch/content/fetch.js",
+		"/lib/lazy/content-lazy-loader.js",
 		"/lib/single-file/single-file-core.js",
 		"/lib/single-file/single-file-browser.js",
 		"/extension/index.js",
@@ -43,6 +44,7 @@ singlefile.scriptLoader = (() => {
 		"/lib/single-file/doc-helper.js",
 		"/lib/single-file/util/timeout.js",
 		"/lib/fetch/content/fetch.js",
+		"/lib/lazy/content-lazy-loader.js",
 		"/lib/single-file/frame-tree.js",
 		"/extension/core/content/content-frame.js"
 	];
@@ -70,9 +72,6 @@ singlefile.scriptLoader = (() => {
 			"/lib/single-file/css-matched-rules.js",
 			"/lib/single-file/css-rules-minifier.js",
 			"/lib/single-file/css-fonts-minifier.js"
-		],
-		lazyLoadImages: [
-			"/lib/lazy/content-lazy-loader.js"
 		]
 	};
 

+ 4 - 1
lib/single-file/frame-tree.js

@@ -18,7 +18,7 @@
  *   along with SingleFile.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* global window, top, document, addEventListener, docHelper, timeout, MessageChannel, superFetch, fetch, TextDecoder, DOMParser */
+/* global window, top, document, addEventListener, docHelper, timeout, MessageChannel, superFetch, fetch, TextDecoder, DOMParser, lazyLoader */
 
 this.frameTree = this.frameTree || (() => {
 
@@ -45,6 +45,9 @@ this.frameTree = this.frameTree || (() => {
 			if (!TOP_WINDOW && message.method == INIT_REQUEST_MESSAGE) {
 				window.stop();
 				initRequest(message);
+				if (message.options.lazyLoadImages && window.lazyLoader) {
+					lazyLoader.process();
+				}
 			} else if (message.method == INIT_RESPONSE_MESSAGE) {
 				const port = event.ports[0];
 				port.onmessage = event => initResponse(event.data);

+ 1 - 0
manifest.json

@@ -22,6 +22,7 @@
 				"lib/single-file/doc-helper.js",
 				"lib/single-file/util/timeout.js",
 				"lib/fetch/content/fetch.js",
+				"/lib/lazy/content-lazy-loader.js",
 				"lib/single-file/frame-tree.js",
 				"extension/core/content/content-frame.js"
 			],