Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use jszip v3 in git submodule
  • Loading branch information
belldandu committed Jul 13, 2016
1 parent 5834c76 commit 65df35e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "plugin/jszip"]
path = plugin/jszip
url = https://github.com/Stuk/jszip/
14 changes: 0 additions & 14 deletions plugin/js-lib/jszip.min.js

This file was deleted.

9 changes: 3 additions & 6 deletions plugin/js/EpubPacker.js
Expand Up @@ -30,19 +30,16 @@ EpubPacker.coverImageXhtmlId = function() {
EpubPacker.prototype = {

assembleAndSave: function (fileName, epubItemSupplier) {
let that = this;
that.save(that.assemble(epubItemSupplier), fileName);
},

assemble: function (epubItemSupplier) {
let that = this;
let zipFile = new JSZip();
that.addRequiredFiles(zipFile);
zipFile.file("OEBPS/content.opf", that.buildContentOpf(epubItemSupplier), { compression: "DEFLATE" });
zipFile.file("OEBPS/toc.ncx", that.buildTableOfContents(epubItemSupplier), { compression: "DEFLATE" });
that.packXhtmlFiles(zipFile, epubItemSupplier);
zipFile.file(util.styleSheetFileName(), that.metaInfo.styleSheet, { compression: "DEFLATE" });
return zipFile.generate({ type: "blob" });
zipFile.generateAsync({ type: "blob" }).then(function(content) {
that.save(content, fileName);
});
},

// write blob to "Downloads" directory
Expand Down
1 change: 1 addition & 0 deletions plugin/jszip
Submodule jszip added at 4cbaf0
2 changes: 1 addition & 1 deletion plugin/popup.html
Expand Up @@ -123,7 +123,7 @@
<script src="js/parsers/FanFictionParser.js"></script>
<script src="js/parsers/MuggleNetParser.js"></script>
<script src="js/parsers/RoyalRoadParser.js"></script>
<script src="js-lib/jszip.min.js"></script>
<script src="jszip/dist/jszip.min.js"></script>
<script src="js/EpubItemSupplier.js"></script>
<script src="js/parsers/ImageCollector.js"></script>
<script src="js/parsers/SonakoParser.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion unitTest/Tests.html
Expand Up @@ -23,7 +23,7 @@
<script src="../plugin/js/parsers/BakaTsukiParser.js"></script>
<script src="../plugin/js/parsers/FanFictionParser.js"></script>
<script src="../plugin/js/parsers/MuggleNetParser.js"></script>
<script src="../plugin/js-lib/jszip.min.js"></script>
<script src="../plugin/jszip/dist/jszip.min.js"></script>
<script src="../plugin/js/EpubItemSupplier.js"></script>
<script src="../plugin/js/parsers/ImageCollector.js"></script>
<script src="../plugin/js/EpubPacker.js"></script>
Expand Down
8 changes: 4 additions & 4 deletions unitTest/UtestEpubPacker.js
Expand Up @@ -57,7 +57,7 @@ test("buildContentOpf", function (assert) {
"<manifest>"+
"<item href=\"Text/0000_Title0.xhtml\" id=\"xhtml0000\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"Text/0001_Title1.xhtml\" id=\"xhtml0001\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"" + util.styleSheetFileName() + "\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"Styles/stylesheet.css\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"toc.ncx\" id=\"ncx\" media-type=\"application/x-dtbncx+xml\"/>" +
"</manifest>"+
"<spine toc=\"ncx\">"+
Expand Down Expand Up @@ -89,7 +89,7 @@ test("buildContentOpfWithCover", function (assert) {
"<manifest>" +
"<item href=\"Text/0000_Title0.xhtml\" id=\"xhtml0000\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"Text/0001_Title1.xhtml\" id=\"xhtml0001\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"" + util.styleSheetFileName() + "\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"Styles/stylesheet.css\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"toc.ncx\" id=\"ncx\" media-type=\"application/x-dtbncx+xml\"/>" +
"<item href=\"Text/Cover.xhtml\" id=\"cover\" media-type=\"application/xhtml+xml\"/>" +
"</manifest>" +
Expand Down Expand Up @@ -130,7 +130,7 @@ test("buildContentOpfWithTranslatorAndAuthorFileAs", function (assert) {
"<manifest>" +
"<item href=\"Text/0000_Title0.xhtml\" id=\"xhtml0000\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"Text/0001_Title1.xhtml\" id=\"xhtml0001\" media-type=\"application/xhtml+xml\"/>" +
"<item href=\"" + util.styleSheetFileName() + "\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"Styles/stylesheet.css\" id=\"stylesheet\" media-type=\"text/css\"/>" +
"<item href=\"toc.ncx\" id=\"ncx\" media-type=\"application/x-dtbncx+xml\"/>" +
"</manifest>" +
"<spine toc=\"ncx\">" +
Expand Down Expand Up @@ -239,7 +239,7 @@ test("makeCoverImageXhtmlFile", function (assert) {
"<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
"<title></title>" +
"<link href=\"../"+ util.styleSheetFileName() +"\" type=\"text/css\" rel=\"stylesheet\" />" +
"<link href=\"../Styles/stylesheet.css\" type=\"text/css\" rel=\"stylesheet\" />" +
"</head>" +
"<body>" +
"<div class=\"svg_outer svg_inner\">" +
Expand Down

1 comment on commit 65df35e

@belldandu
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completes #38

Please sign in to comment.