Skip to content

Instantly share code, notes, and snippets.

@pierrel
Created December 10, 2010 22:01
Show Gist options
  • Select an option

  • Save pierrel/736892 to your computer and use it in GitHub Desktop.

Select an option

Save pierrel/736892 to your computer and use it in GitHub Desktop.
$j('#something').html('fetching');
$j.ajax({
url: '/path/to/epub.epub',
complete: function(response, status, request) {
var the_zip = new JSUnzip(response.responseText);
$j('#something').html('finished with ' + status);
console.log("is it zip?" + the_zip.isZipFile());
var epub = new JSEpub(response.responseText);
epub.processInSteps(function (step, extras) {
var msg = '';
console.log(step);
if (step === 1) {
msg = "Unzipping";
} else if (step === 2) {
msg = "Uncompressing " + extras;
} else if (step === 3) {
msg = "Reading OPF";
} else if (step === 4) {
msg = "Post processing";
} else if (step === 5) {
msg = "Finishing";
alert('done!');
} else {
msg = "Error!";
}
$j('#something').html(msg);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment