Jelajahi Sumber

renamed methods

Gildas 7 tahun lalu
induk
melakukan
a453d30ee9
2 mengubah file dengan 21 tambahan dan 21 penghapusan
  1. 14 14
      lib/single-file/single-file-browser.js
  2. 7 7
      lib/single-file/single-file-core.js

+ 14 - 14
lib/single-file/single-file-browser.js

@@ -131,31 +131,27 @@ this.SingleFile = this.SingleFile || (() => {
 			return new Blob([content]).size;
 		}
 
-		static htmlminiProcess(doc, options) {
+		static minifyHTML(doc, options) {
 			return htmlmini.process(doc, options);
 		}
 
-		static htmlminiPostProcess(doc) {
+		static postMinifyHTML(doc) {
 			return htmlmini.postProcess(doc);
 		}
 
-		static lazyLoader(doc) {
+		static lazyLoad(doc) {
 			return lazyLoader.process(doc);
 		}
 
-		static lazyLoaderImageSelectors() {
-			return lazyLoader.imageSelectors;
-		}
-
-		static cssMinifier(doc) {
+		static minifyCSS(doc) {
 			return cssMinifier.process(doc);
 		}
 
-		static fontsMinifier(doc, secondPass) {
+		static minifyFonts(doc, secondPass) {
 			return fontsMinifier.process(doc, secondPass);
 		}
 
-		static uglifycss(content, options) {
+		static cssCompressor(content, options) {
 			return uglifycss.processString(content, options);
 		}
 
@@ -163,10 +159,6 @@ this.SingleFile = this.SingleFile || (() => {
 			return parseSrcset.process(srcset);
 		}
 
-		static serialize(doc, compressHTML) {
-			return serializer.process(doc, compressHTML);
-		}
-
 		static preProcessDoc(doc, win, options) {
 			return docHelper.preProcessDoc(doc, win, options);
 		}
@@ -175,6 +167,14 @@ this.SingleFile = this.SingleFile || (() => {
 			docHelper.postProcessDoc(doc, options);
 		}
 
+		static serialize(doc, compressHTML) {
+			return serializer.process(doc, compressHTML);
+		}
+
+		static lazyLoaderImageSelectors() {
+			return lazyLoader.imageSelectors;
+		}
+
 		static windowIdAttributeName(sessionId) {
 			return docHelper.windowIdAttributeName(sessionId);
 		}

+ 7 - 7
lib/single-file/single-file-core.js

@@ -303,7 +303,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		}
 
 		lazyLoadImages() {
-			DOM.lazyLoader(this.doc);
+			DOM.lazyLoad(this.doc);
 		}
 
 		removeDiscardedResources() {
@@ -383,13 +383,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		}
 
 		removeUnusedStyles() {
-			const stats = DOM.cssMinifier(this.doc);
+			const stats = DOM.minifyCSS(this.doc);
 			this.stats.set("processed", "cssRules", stats.processed);
 			this.stats.set("discarded", "cssRules", stats.discarded);
 		}
 
 		removeAlternativeFonts(secondPass) {
-			DOM.fontsMinifier(this.doc, secondPass);
+			DOM.minifyFonts(this.doc, secondPass);
 		}
 
 		removeHiddenElements(sessionId) {
@@ -404,7 +404,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				if (this.options.displayStats) {
 					size = DOM.getContentSize(this.doc.documentElement.outerHTML);
 				}
-				DOM.htmlminiPostProcess(this.doc);
+				DOM.postMinifyHTML(this.doc);
 				if (this.options.displayStats) {
 					this.stats.add("discarded", "htmlBytes", size - DOM.getContentSize(this.doc.documentElement.outerHTML));
 				}
@@ -413,7 +413,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 				if (this.options.displayStats) {
 					size = DOM.getContentSize(this.doc.documentElement.outerHTML);
 				}
-				DOM.htmlminiProcess(this.doc, { preservedSpaceAttributeName: DOM.preservedSpaceAttributeName(this.options.sessionId) });
+				DOM.minifyHTML(this.doc, { preservedSpaceAttributeName: DOM.preservedSpaceAttributeName(this.options.sessionId) });
 				if (this.options.displayStats) {
 					this.stats.add("discarded", "htmlBytes", size - DOM.getContentSize(this.doc.documentElement.outerHTML));
 				}
@@ -423,11 +423,11 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		compressCSS() {
 			this.doc.querySelectorAll("style").forEach(styleElement => {
 				if (styleElement) {
-					styleElement.textContent = DOM.uglifycss(styleElement.textContent);
+					styleElement.textContent = DOM.cssCompressor(styleElement.textContent);
 				}
 			});
 			this.doc.querySelectorAll("[style]").forEach(element => {
-				element.setAttribute("style", DOM.uglifycss(element.getAttribute("style")));
+				element.setAttribute("style", DOM.cssCompressor(element.getAttribute("style")));
 			});
 		}