This commit is contained in:
alexadam 2016-08-18 14:48:50 +03:00
parent a5c547c011
commit 9446f47d44
2 changed files with 13 additions and 5 deletions

View file

@ -32,6 +32,13 @@ Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera We
3. Select the extension's directory
```
## Convert .epub to .mobi
```
sudo apt-get install calibre
ebook-convert "book.epub" "book.mobi"
```
## To-Do
- fix all 'epubcheck' errors (https://github.com/IDPF/epubcheck)
- * there are some issues with relative URLs
@ -47,6 +54,7 @@ Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera We
- add settings & options page (ui/ux)
## Credits
- http://ebooks.stackexchange.com/questions/1183/what-is-the-minimum-required-content-for-a-valid-epub
- https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
- https://stuk.github.io/jszip/
- http://johnny.github.io/jquery-sortable/

View file

@ -2,7 +2,7 @@ var cssFileName = 'ebook.css';
function getImagesIndex(allImages) {
return allImages.reduce(function(prev, elem, index) {
return prev + '\n' + '<item href="images/' + elem.filename + '" id="img' + index + '" media-type="image/' + getFileExtension(elem.filename) + '"/>';
return prev + '\n' + '<item href="images/' + elem.filename + '" id="img' + elem.filename + '" media-type="image/' + getFileExtension(elem.filename) + '"/>';
}, '');
}
@ -76,7 +76,7 @@ function _buildEbook(allPages) {
'<meta name="dtb:depth" content="1"/>' +
'</head>' +
'<docTitle>' +
'<text></text>' +
'<text>' + ebookName + '</text>' +
'</docTitle>' +
'<navMap>' +
allPages.reduce(function(prev, page, index) {
@ -99,7 +99,7 @@ function _buildEbook(allPages) {
'<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">' +
'<head>' +
'<title>' + page.title + '</title>' +
'<link href="' + cssFileName + '" rel="stylesheet" type="text/css" />' +
'<link href="../' + cssFileName + '" rel="stylesheet" type="text/css" />' +
'</head><body>' +
page.content +
'</body></html>'
@ -110,9 +110,9 @@ function _buildEbook(allPages) {
'<?xml version="1.0" encoding="UTF-8" ?>' +
'<package xmlns="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="db-id" version="3.0">' +
'<metadata>' +
'<dc:title id="t1">Title</dc:title>' +
'<dc:title id="t1">'+ ebookName + '</dc:title>' +
'<dc:identifier id="db-id">isbn</dc:identifier>' +
'<meta property="dcterms:modified">2014-03-27T09:14:09Z</meta>' +
'<meta property="dcterms:modified">' + new Date().toISOString() + '</meta>' +
'<dc:language>en</dc:language>' +
'</metadata>' +
'<manifest>' +