forked from futurepress/epub.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
430 changed files
with
2,032 additions
and
95,451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.DS_Store | ||
*/**/.DS_Store | ||
node_modules/ | ||
components | ||
components | ||
node_modules | ||
bower_components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// API | ||
|
||
// Epub Rendition | ||
// > Package (book) | ||
// - Manifest (files) | ||
// - Metadata (info) | ||
// - Spine (order) | ||
// - Navagation (toc) | ||
|
||
// Need to split out rendering and book completely | ||
// Something like | ||
var epub = ePub("moby-dick.epub"); | ||
var epub = ePub("s3path/ip/moby-dick.opf"); | ||
|
||
var rendition = ePub.Paginate(epub); | ||
|
||
var rendition = ePub.Render.Paginated(book); | ||
var rendition = ePub.Render.Scrolling(book); | ||
|
||
ePub.renderer.register(EPUBJS.Paginate); | ||
|
||
// Returns a Scroll Controller, Attachs to a document (or window?) | ||
var epub = ePub("moby-dick.epub"); | ||
|
||
var epub = ePub(); | ||
var book = epub.open(_url) | ||
return epub | ||
|
||
// Creates a Book Package object, parses manifest | ||
var book = epub.open("moby-dick.epub"); | ||
var book = epub.open("META-INF/container.xml"); | ||
var book = epub.open("package.opf"); //-- maybe, not in spec? | ||
// Set the store | ||
|
||
// Unzip if needed | ||
|
||
// Get the container | ||
|
||
// Get the package path | ||
book = new Book("path/to/book/package.opf", store); | ||
unpacked = book.unpack(); | ||
|
||
return unpacked | ||
|
||
book.unpack() | ||
book.manifest | ||
book.metadata | ||
book.spine | ||
book.navigation.toc | ||
// book.navigation.landmarks | ||
// book.navigation.lot | ||
return book | ||
|
||
// Loads a chapter of the Book | ||
var section = book.spine.get(1); | ||
var section = book.spine.get("chap1.html"); | ||
var section = book.spine.get("#id1234"); | ||
|
||
// Alias for spine | ||
var section = book.section("epubcfi(/6/30[id-id2640702])"); | ||
var section = book.section(1); | ||
|
||
book.loaded.navigation.then() | ||
book.navigation.get() | ||
book.navigation.get("#toc-chap-1") | ||
book.navigation.get("chap1.html") | ||
|
||
// Returns the straight html of the chapter | ||
//-- When does the chapter content processing happen? | ||
section.render() | ||
|
||
// Returns a new renderer | ||
var rendition = epub.renderer(book, type); | ||
return new Renderer(book, type) | ||
|
||
// Render to a div | ||
rendition.attachTo("elementID"); | ||
// or | ||
body.appendChild(rendition.container); | ||
|
||
// Display the provided chapter | ||
rendition.display(chapter); | ||
|
||
// Rendering sugar ? | ||
epub.renderTo("elementID", _type); | ||
rendition = epub.renderer(book, _type); | ||
rendition.attachTo("elementID"); | ||
epub.display(); | ||
return rendition; | ||
|
||
epub.display(); | ||
epub.display(1); | ||
epub.display("chapt1.html#something"); | ||
epub.display("epubcfi(/6/30[id-id2640702]!2/4/1:0)"); | ||
section = book.section(_arg); | ||
rendition.display(section); | ||
section.render(); | ||
section.load(); | ||
return rendition; | ||
|
||
epub.rendition.backwards(); | ||
epub.rendition.forwards(); | ||
|
||
epub.rendition.addStyle(); | ||
epub.rendition.addStyles(); | ||
|
||
|
||
epub.find("query"); | ||
section.find("query"); | ||
|
||
epub.on("noAuth", function(){ | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,32 @@ | ||
module.exports = function(grunt) { | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: '<json:package.json>', | ||
meta: { | ||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + | ||
'<%= grunt.template.today("yyyy-mm-dd") %> */' | ||
}, | ||
concat_sourcemap : { | ||
'build/epub_no_underscore.js': ['<banner>', 'libs/rsvp/rsvp.js', 'src/*.js'], | ||
'build/epub.js': ['<banner>', 'libs/underscore/underscore-min.js', 'libs/rsvp/rsvp.js', 'src/*.js'], | ||
'build/reader.js': ['<banner>', 'reader_src/reader.js', 'reader_src/controllers/*.js'], | ||
'build/hooks.js': ['<banner>', 'hooks/default/*.js'] | ||
}, | ||
uglify: { | ||
my_target: { | ||
options: { | ||
preserveComments: 'some', | ||
sourceMap: true | ||
}, | ||
files: { | ||
'build/epub.min.js': ['build/epub.js'], | ||
'build/reader.min.js': ['build/reader.js'], | ||
'build/hooks.min.js': ['build/hooks.js'], | ||
'build/libs/zip.min.js': ['libs/zip/zip.js', 'libs/zip/zip-fs.js', 'libs/zip/zip-ext.js', 'libs/zip/mime-types.js'], | ||
'build/libs/inflate.js': ['libs/zip/inflate.js'] | ||
} | ||
} | ||
}, | ||
copy: { | ||
main: { | ||
files: [ | ||
{src: 'build/epub.js', dest: 'reader/js/epub.min.js'}, | ||
{src: 'build/hooks.min.js', dest: 'reader/js/hooks.min.js'}, | ||
{src: 'build/reader.min.js', dest: 'reader/js/reader.min.js'}, | ||
{src: 'build/epub.min.map', dest: 'reader/js/epub.js.map'}, | ||
{src: 'build/hooks.min.map', dest: 'reader/js/hooks.js.map'}, | ||
{src: 'build/reader.js.map', dest: 'reader/js/hooks.js.map'}, | ||
{src: 'build/zip/*', dest: 'reader/js/libs/', filter: 'isFile'}, | ||
{src: 'libs/jquery/jquery-2.1.0.min.js', dest:'reader/js/libs/jquery-2.1.0.min.js'}, | ||
{src: 'libs/screenfull.min.js', dest: 'reader/js/libs/screenfull.min.js'}, | ||
{src: 'reader_src/plugins/search.js', dest: 'reader/js/plugins/search.js'}, | ||
{src: 'reader_src/plugins/hypothesis.js', dest: 'reader/js/plugins/hypothesis.js'}, | ||
{src: 'hooks/extensions/highlight.js', dest: 'reader/js/hooks/extensions/highlight.js'} | ||
|
||
] | ||
}, | ||
}, | ||
jshint: { | ||
all: ['src/**/*.js'],//, 'reader/**/*.js'] | ||
options : { | ||
// Environments | ||
"browser": true, | ||
"devel": true, | ||
"worker": true, | ||
|
||
// Enforcing | ||
//"maxlen": 80, | ||
//"quotmark": "single", | ||
"trailing": true, | ||
"strict": false, | ||
|
||
// Relaxing | ||
"boss": true, | ||
"funcscope": true, | ||
"globalstrict": true, | ||
"loopfunc": true, | ||
"maxerr": 1000, | ||
"nonstandard": true, | ||
"sub": true, | ||
"validthis": true, | ||
|
||
"globals": { | ||
"_": false, | ||
"define" : false, | ||
"module" : false | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-concat-sourcemap'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
|
||
// Default task(s). | ||
grunt.registerTask('default', ['jshint', 'concat_sourcemap', 'uglify', 'copy']); | ||
}; | ||
// Project configuration. | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | ||
}, | ||
build: { | ||
src: 'src/<%= pkg.name %>.js', | ||
dest: 'build/<%= pkg.name %>.min.js' | ||
} | ||
}, | ||
connect: { | ||
server: { | ||
options: { | ||
port: 9001, | ||
base: '.' | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
|
||
// Default task(s). | ||
grunt.registerTask('default', ['uglify']); | ||
grunt.registerTask('serve', ['connect']); | ||
|
||
}; |
Oops, something went wrong.