1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00

added source maps, hypothes.is examples, removed documentup page

This commit is contained in:
Fred Chasen 2014-04-01 12:35:26 -07:00
parent d414cac540
commit b441cf8ac0
34 changed files with 6187 additions and 19873 deletions

View file

@ -7,37 +7,54 @@ module.exports = function(grunt) {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */' '<%= grunt.template.today("yyyy-mm-dd") %> */'
}, },
concat : { concat_sourcemap : {
'build/epub_no_underscore.js': ['<banner>', 'libs/rsvp/rsvp.js', 'src/*.js'], '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/epub.js': ['<banner>', 'libs/underscore/underscore-min.js', 'libs/rsvp/rsvp.js', 'src/*.js'],
'build/reader.js': ['<banner>', 'reader/reader.js', 'reader/controllers/*.js'], 'build/reader.js': ['<banner>', 'reader/reader.js', 'reader/controllers/*.js'],
'build/hooks.js': ['<banner>', 'hooks/default/*.js'], 'build/hooks.js': ['<banner>', 'hooks/default/*.js']
'demo/js/libs/fileStorage.min.js': 'libs/fileStorage/fileStorage.min.js', // 'demo/js/libs/fileStorage.min.js': 'libs/fileStorage/fileStorage.min.js',
'demo/js/libs/loader_filesystem.min.js': 'libs/fileStorage/workers/loader_filesystem.min.js', // 'demo/js/libs/loader_filesystem.min.js': 'libs/fileStorage/workers/loader_filesystem.min.js',
'demo/js/libs/jquery-2.0.3.min.js': 'libs/jquery/jquery-2.0.3.min.js', // 'demo/js/libs/inflate.js': 'libs/zip/inflate.js',
'demo/js/libs/inflate.js': 'libs/zip/inflate.js', },
'demo/js/libs/screenfull.min.js': 'libs/screenfull.min.js',
'demo/js/plugins/search.js': 'reader/plugins/search.js'
},
uglify: { uglify: {
options: {
preserveComments: 'some'
},
my_target: { my_target: {
options: {
preserveComments: 'some',
sourceMap: true
},
files: { files: {
'demo/js/epub.min.js': ['build/epub.js'], // 'demo/js/epub.min.js': ['build/epub.js'],
'build/epub.min.js': ['build/epub.js'], 'build/epub.min.js': ['build/epub.js'],
'demo/js/reader.min.js': ['build/reader.js'], 'build/reader.min.js': ['build/reader.js'],
'demo/js/hooks.min.js': ['build/hooks.js'], // 'demo/js/hooks.min.js': ['build/hooks.js'],
'build/hooks.min.js': ['build/hooks.js'], 'build/hooks.min.js': ['build/hooks.js'],
'demo/js/libs/zip.min.js': ['libs/zip/zip.js', 'libs/zip/zip-fs.js', 'libs/zip/zip-ext.js', 'libs/zip/mime-types.js'], // 'demo/js/libs/zip.min.js': ['libs/zip/zip.js', 'libs/zip/zip-fs.js', 'libs/zip/zip-ext.js', 'libs/zip/mime-types.js'],
'demo/js/libs/inflate.min.js': ['libs/zip/inflate.js'], // 'demo/js/libs/inflate.min.js': ['libs/zip/inflate.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/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'], 'build/libs/inflate.js': ['libs/zip/inflate.js']
'build/libs/screenfull.min.js': ['libs/screenfull.min.js'] // 'build/libs/screenfull.min.js': ['libs/screenfull.min.js']
} }
} }
}, },
copy: {
main: {
files: [
{src: 'build/epub.js', dest: 'demo/js/epub.min.js'},
{src: 'build/hooks.min.js', dest: 'demo/js/hooks.min.js'},
{src: 'build/reader.min.js', dest: 'demo/js/reader.min.js'},
{src: 'build/epub.min.map', dest: 'demo/js/epub.js.map'},
{src: 'build/hooks.min.map', dest: 'demo/js/hooks.js.map'},
{src: 'build/reader.js.map', dest: 'demo/js/hooks.js.map'},
{src: 'build/zip/*', dest: 'demo/js/libs/', filter: 'isFile'},
{src: 'libs/jquery/jquery-2.1.0.min.js', dest:'demo/js/libs/jquery-2.1.0.min.js'},
{src: 'libs/screenfull.min.js', dest: 'demo/js/libs/screenfull.min.js'},
{src: 'reader/plugins/search.js', dest: 'demo/js/plugins/search.js'},
{src: 'reader/plugins/hypothesis.js', dest: 'demo/js/plugins/hypothesis.js'},
{src: 'hooks/extensions/highlight.js', dest: 'demo/js/hooks/extensions/highlight.js'}
]
},
},
jshint: { jshint: {
all: ['src/**/*.js'],//, 'reader/**/*.js'] all: ['src/**/*.js'],//, 'reader/**/*.js']
options : { options : {
@ -74,7 +91,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-concat-sourcemap');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task(s). // Default task(s).
grunt.registerTask('default', ['jshint', 'concat', 'uglify']); grunt.registerTask('default', ['jshint', 'concat_sourcemap', 'uglify', 'copy']);
}; };

View file

@ -5689,7 +5689,7 @@ EPUBJS.replace.stylesheets = function(_store, full) {
EPUBJS.replace.cssUrls = function(_store, base, text){ EPUBJS.replace.cssUrls = function(_store, base, text){
var deferred = new RSVP.defer(), var deferred = new RSVP.defer(),
promises = [], promises = [],
matches = text.match(/url\(\'?\"?([^\'|^\"|^\)]*)\'?\"?\)/g); matches = text.match(/url\(\'?\"?([^\'|^\"^\)]*)\'?\"?\)/g);
if(!_store) return; if(!_store) return;
@ -5853,3 +5853,5 @@ EPUBJS.Unarchiver.prototype.saveEntryFileToStorage = function(entry, callback){
EPUBJS.storage.save(entry.filename, blob, callback); EPUBJS.storage.save(entry.filename, blob, callback);
}); });
}; };
//# sourceMappingURL=epub.js.map

7
build/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -5688,7 +5688,7 @@ EPUBJS.replace.stylesheets = function(_store, full) {
EPUBJS.replace.cssUrls = function(_store, base, text){ EPUBJS.replace.cssUrls = function(_store, base, text){
var deferred = new RSVP.defer(), var deferred = new RSVP.defer(),
promises = [], promises = [],
matches = text.match(/url\(\'?\"?([^\'|^\"|^\)]*)\'?\"?\)/g); matches = text.match(/url\(\'?\"?([^\'|^\"^\)]*)\'?\"?\)/g);
if(!_store) return; if(!_store) return;
@ -5852,3 +5852,5 @@ EPUBJS.Unarchiver.prototype.saveEntryFileToStorage = function(entry, callback){
EPUBJS.storage.save(entry.filename, blob, callback); EPUBJS.storage.save(entry.filename, blob, callback);
}); });
}; };
//# sourceMappingURL=epub_no_underscore.js.map

View file

@ -314,3 +314,5 @@ EPUBJS.Hooks.register("beforeChapterDisplay").transculsions = function(callback,
} }
//# sourceMappingURL=hooks.js.map

3
build/hooks.min.js vendored
View file

@ -1 +1,2 @@
EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.contents.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g=EPUBJS.core.folder(location.pathname),h=g+EPUBJS.cssPath||g,i={};EPUBJS.core.addCss(h+"popup.css",!1,b.render.document.head),d.forEach(function(a){function c(){var c,e,f=b.height,j=b.width,p=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),i[k]||(i[k]=document.createElement("div"),i[k].setAttribute("class","popup"),pop_content=document.createElement("div"),i[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.render.document.body.appendChild(i[k]),i[k].addEventListener("mouseover",d,!1),i[k].addEventListener("mouseout",g,!1),b.on("renderer:pageChanged",h,this),b.on("renderer:pageChanged",g,this)),c=i[k],e=a.getBoundingClientRect(),m=e.left,n=e.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",p>f/2.5&&(p=f/2.5,pop_content.style.maxHeight=p+"px"),popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),m-popRect.width<=0?(c.style.left=m+"px",c.classList.add("left")):c.classList.remove("left"),m+popRect.width/2>=j?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),c.classList.add("right")):c.classList.remove("right")}function d(){i[k].classList.add("on")}function g(){i[k].classList.remove("on")}function h(){setTimeout(function(){i[k].classList.remove("show")},100)}var j,k,l,m,n,o,p=a.getAttribute(e);p==f&&(j=a.getAttribute("href"),k=j.replace("#",""),l=b.render.document.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",h,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").mathml=function(a,b){if(-1!==b.currentChapter.manifestProperties.indexOf("mathml")){b.iframe.contentWindow.mathmlCallback=a;var c=document.createElement("script");c.type="text/x-mathjax-config",c.innerHTML=' MathJax.Hub.Register.StartupHook("End",function () { window.mathmlCallback(); }); MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); ',b.doc.body.appendChild(c),EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",null,b.doc.head)}else a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.contents.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.height;return"reflowable"!=b.layoutSettings.layout?(a(),void 0):(d.forEach(function(a){function c(){var c,d=a.getBoundingClientRect(),f=d.height,g=d.top,h=a.getAttribute("data-height"),i=h||f,j=Number(getComputedStyle(a,"").fontSize.match(/(\d*(\.\d*)?)px/)[1]),k=j?j/2:0;e=b.contents.clientHeight,0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g-k,a.style.maxHeight=c+"px",a.style.width="auto"):(i>e&&(a.style.maxHeight=e+"px",a.style.width="auto",d=a.getBoundingClientRect(),i=d.height),a.style.display="block",a.style.WebkitColumnBreakBefore="always",a.style.breakBefore="column"),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("renderer:resized",c),b.on("renderer:chapterUnloaded",function(){a.removeEventListener("load",c),b.off("renderer:resized",c)}),c()}),a&&a(),void 0)},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.contents.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>chapter.colWidth&&(d=chapter.colWidth/j,j=chapter.colWidth,k*=d),f.width=j,f.height=k}var d,e=a.getAttribute("ref"),f=document.createElement("iframe"),g=a.getAttribute("width"),h=a.getAttribute("height"),i=a.parentNode,j=g,k=h;c(),b.listenUntil("renderer:resized","renderer:chapterUnloaded",c),f.src=e,i.replaceChild(f,a)}),a&&a()}; EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.contents.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g=EPUBJS.core.folder(location.pathname),h=g+EPUBJS.cssPath||g,i={};EPUBJS.core.addCss(h+"popup.css",!1,b.render.document.head),d.forEach(function(a){function c(){var c,e,f=b.height,j=b.width,p=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),i[k]||(i[k]=document.createElement("div"),i[k].setAttribute("class","popup"),pop_content=document.createElement("div"),i[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.render.document.body.appendChild(i[k]),i[k].addEventListener("mouseover",d,!1),i[k].addEventListener("mouseout",g,!1),b.on("renderer:pageChanged",h,this),b.on("renderer:pageChanged",g,this)),c=i[k],e=a.getBoundingClientRect(),m=e.left,n=e.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",p>f/2.5&&(p=f/2.5,pop_content.style.maxHeight=p+"px"),popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),m-popRect.width<=0?(c.style.left=m+"px",c.classList.add("left")):c.classList.remove("left"),m+popRect.width/2>=j?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),c.classList.add("right")):c.classList.remove("right")}function d(){i[k].classList.add("on")}function g(){i[k].classList.remove("on")}function h(){setTimeout(function(){i[k].classList.remove("show")},100)}var j,k,l,m,n,o,p=a.getAttribute(e);p==f&&(j=a.getAttribute("href"),k=j.replace("#",""),l=b.render.document.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",h,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").mathml=function(a,b){if(-1!==b.currentChapter.manifestProperties.indexOf("mathml")){b.iframe.contentWindow.mathmlCallback=a;var c=document.createElement("script");c.type="text/x-mathjax-config",c.innerHTML=' MathJax.Hub.Register.StartupHook("End",function () { window.mathmlCallback(); }); MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); ',b.doc.body.appendChild(c),EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",null,b.doc.head)}else a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.contents.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.height;return"reflowable"!=b.layoutSettings.layout?void a():(d.forEach(function(a){function c(){var c,d=a.getBoundingClientRect(),f=d.height,g=d.top,h=a.getAttribute("data-height"),i=h||f,j=Number(getComputedStyle(a,"").fontSize.match(/(\d*(\.\d*)?)px/)[1]),k=j?j/2:0;e=b.contents.clientHeight,0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g-k,a.style.maxHeight=c+"px",a.style.width="auto"):(i>e&&(a.style.maxHeight=e+"px",a.style.width="auto",d=a.getBoundingClientRect(),i=d.height),a.style.display="block",a.style.WebkitColumnBreakBefore="always",a.style.breakBefore="column"),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("renderer:resized",c),b.on("renderer:chapterUnloaded",function(){a.removeEventListener("load",c),b.off("renderer:resized",c)}),c()}),void(a&&a()))},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.contents.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>chapter.colWidth&&(d=chapter.colWidth/j,j=chapter.colWidth,k*=d),f.width=j,f.height=k}var d,e=a.getAttribute("ref"),f=document.createElement("iframe"),g=a.getAttribute("width"),h=a.getAttribute("height"),i=a.parentNode,j=g,k=h;c(),b.listenUntil("renderer:resized","renderer:chapterUnloaded",c),f.src=e,i.replaceChild(f,a)}),a&&a()};
//# sourceMappingURL=hooks.min.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -300,6 +300,7 @@ EPUBJS.Reader.prototype.selectedRange = function(range){
window.location.hash != cfiFragment) { window.location.hash != cfiFragment) {
// Add CFI fragment to the history // Add CFI fragment to the history
history.pushState({}, '', cfiFragment); history.pushState({}, '', cfiFragment);
this.currentLocationCfi = cfi;
} }
}; };
@ -467,6 +468,8 @@ EPUBJS.reader.ControlsController = function(book) {
.removeClass("icon-bookmark-empty"); .removeClass("icon-bookmark-empty");
} }
reader.currentLocationCfi = cfi;
// Update the History Location // Update the History Location
if(reader.settings.history && if(reader.settings.history &&
window.location.hash != cfiFragment) { window.location.hash != cfiFragment) {
@ -1095,3 +1098,5 @@ EPUBJS.reader.TocController = function(toc) {
"hide" : onHide "hide" : onHide
}; };
}; };
//# sourceMappingURL=reader.js.map

View file

@ -1,897 +0,0 @@
/* Base Reset
-------------------------------------------------------------------- */
.annotator-notice,
.annotator-filter *,
.annotator-widget * {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
font-weight: normal;
text-align: left;
margin: 0;
padding: 0;
background: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
color: rgb(144, 144, 144);
}
/* Images
-------------------------------------------------------------------- */
.annotator-adder {
background-image: url(../img/annotator-icon-sprite.png);
background-repeat: no-repeat;
}
.annotator-resize,
.annotator-widget::after,
.annotator-editor a::after,
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a,
.annotator-filter .annotator-filter-navigation button::after,
.annotator-filter .annotator-filter-property .annotator-filter-clear {
background-image: url(../img/annotator-glyph-sprite.png);
background-repeat: no-repeat;
}
/* Annotator Highlight
-------------------------------------------------------------------- */
.annotator-hl {
background: rgba(255, 255, 10, 0.3);
}
.annotator-hl-temporary {
background: rgba(0, 124, 255, 0.3);
}
/* Annotator Wrapper
-------------------------------------------------------------------- */
.annotator-wrapper {
position: relative;
}
/* NB: If you change the list of classes for which z-index is set,
you should update Annotator._setupDynamicStyle() */
.annotator-adder,
.annotator-outer,
.annotator-notice {
z-index: 1020;
}
.annotator-filter {
z-index: 1010;
}
.annotator-adder,
.annotator-outer,
.annotator-widget,
.annotator-notice {
position: absolute;
font-size: 10px;
line-height: 1;
}
.annotator-hide {
display: none;
visibility: hidden;
}
/* Annotator Adder
-------------------------------------------------------------------- */
.annotator-adder {
margin-top: -48px;
margin-left: -24px;
width: 48px;
height: 48px;
background-position: left top;
}
.annotator-adder:hover {
background-position: center top;
}
.annotator-adder:active {
background-position: center right;
}
.annotator-adder button {
display: block;
width: 36px;
height: 41px;
margin: 0 auto;
border: none;
background: none;
text-indent: -999em;
cursor: pointer;
}
/* Annotator Widget
This applies to both the Viewer and the Editor
-------------------------------------------------------------------- */
.annotator-outer {
width: 0;
height: 0;
}
.annotator-widget {
margin: 0;
padding: 0;
bottom: 15px;
left: -18px;
min-width: 265px;
background-color: rgba(251, 251, 251, 0.98);
border: 1px solid rgba(122, 122, 122, 0.6);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
/* FRED - removed for fixed pos
.annotator-invert-x .annotator-widget {
left: auto;
right: -18px;
}
.annotator-invert-y .annotator-widget {
bottom: auto;
top: 8px;
} */
.annotator-widget strong {
font-weight: bold;
}
.annotator-widget .annotator-listing,
.annotator-widget .annotator-item {
padding: 0;
margin: 0;
list-style: none;
}
.annotator-widget::after {
content: "";
display: block;
width: 18px;
height: 10px;
background-position: 0 0;
position: absolute;
bottom: -10px;
left: 8px;
}
.annotator-invert-x .annotator-widget::after {
left: auto;
right: 8px;
}
.annotator-invert-y .annotator-widget::after {
background-position: 0 -15px;
bottom: auto;
top: -9px;
}
.annotator-widget .annotator-item,
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
position: relative;
font-size: 12px;
}
.annotator-viewer .annotator-item {
border-top: 2px solid rgba(122, 122, 122, 0.2);
}
.annotator-widget .annotator-item:first-child {
border-top: none;
}
.annotator-editor .annotator-item,
.annotator-viewer div {
border-top: 1px solid rgba(133, 133, 133, 0.11);
}
/* Annotator Viewer
-------------------------------------------------------------------- */
.annotator-viewer div {
padding: 6px 6px;
}
.annotator-viewer .annotator-item ol,
.annotator-viewer .annotator-item ul {
padding: 4px 16px;
}
.annotator-viewer .annotator-item li {
}
.annotator-viewer div:first-of-type,
.annotator-editor .annotator-item:first-child textarea {
padding-top: 12px;
padding-bottom: 12px;
color: rgb(60, 60, 60);
font-size: 13px;
font-style: italic;
line-height: 1.3;
border-top: none;
}
.annotator-viewer .annotator-controls {
position: relative;
top: 5px;
right: 5px;
padding-left: 5px;
opacity: 0;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
-o-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
float: right;
}
.annotator-viewer li:hover .annotator-controls,
.annotator-viewer li .annotator-controls.annotator-visible {
opacity: 1;
}
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a {
cursor: pointer;
display: inline-block;
width: 13px;
height: 13px;
margin-left: 2px;
border: none;
opacity: 0.2;
text-indent: -900em;
background-color: transparent;
outline: none;
}
.annotator-viewer .annotator-controls button:hover,
.annotator-viewer .annotator-controls button:focus,
.annotator-viewer .annotator-controls a:hover,
.annotator-viewer .annotator-controls a:focus {
opacity: 0.9;
}
.annotator-viewer .annotator-controls button:active,
.annotator-viewer .annotator-controls a:active {
opacity: 1;
}
.annotator-viewer .annotator-controls button[disabled] {
display: none;
}
.annotator-viewer .annotator-controls .annotator-edit {
background-position: 0 -60px;
}
.annotator-viewer .annotator-controls .annotator-delete {
background-position: 0 -75px;
}
.annotator-viewer .annotator-controls .annotator-link {
background-position: 0 -270px;
}
/* Annotator Editor
-------------------------------------------------------------------- */
.annotator-editor .annotator-item {
position: relative;
}
.annotator-editor .annotator-item label {
top: 0;
display: inline;
cursor: pointer;
font-size: 12px;
}
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
display: block;
min-width: 100%;
padding: 10px 8px;
border: none;
margin: 0;
color: rgb(60, 60, 60);
background: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
resize: none;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar {
height: 8px;
width: 8px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece {
margin: 13px 0 3px;
background-color: #e5e5e5;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical {
height: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal {
width: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item:first-child textarea {
min-height: 5.5em;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor .annotator-item input:focus,
.annotator-editor .annotator-item textarea:focus{
background-color: rgb(243, 243, 243);
outline: none;
}
.annotator-editor .annotator-item input[type=radio],
.annotator-editor .annotator-item input[type=checkbox] {
width: auto;
min-width: 0;
padding: 0;
display: inline;
margin: 0 4px 0 0;
cursor: pointer;
}
.annotator-editor .annotator-checkbox {
padding: 8px 6px;
}
.annotator-filter,
.annotator-filter .annotator-filter-navigation button,
.annotator-editor .annotator-controls {
text-align: right;
padding: 3px;
border-top: 1px solid rgb(212,212,212);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.6, rgb(220, 220, 220)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-moz-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-o-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.annotator-editor.annotator-invert-y .annotator-controls {
border-top: none;
border-bottom: 1px solid rgb(180, 180, 180);
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor a,
.annotator-filter .annotator-filter-property label {
position: relative;
display: inline-block;
padding: 0 6px 0 22px;
color: rgb(54, 54, 54);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
text-decoration: none;
line-height: 24px;
font-size: 12px;
font-weight: bold;
border: 1px solid rgb(162, 162, 162);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.5, rgb(210, 210, 210)),
color-stop(0.5, rgb(190, 190, 190)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.annotator-editor a::after {
position: absolute;
top: 50%;
left: 5px;
display: block;
content: "";
width: 15px;
height: 15px;
margin-top: -7px;
background-position: 0 -90px;
}
.annotator-editor a:hover,
.annotator-editor a:focus,
.annotator-editor a.annotator-focus,
.annotator-filter .annotator-filter-active label,
.annotator-filter .annotator-filter-navigation button:hover {
outline: none;
border-color: rgb(67, 90, 160);
background-color: rgb(56, 101, 249);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(118, 145, 251)),
color-stop(0.5, rgb(80, 117, 251)),
color-stop(0.5, rgb(56, 101, 249)),
to(rgb(54, 101, 250))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
color: rgb(255, 255, 255);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.42);
}
.annotator-editor a:hover::after,
.annotator-editor a:focus::after {
margin-top: -8px;
background-position: 0 -105px;
}
.annotator-editor a:active,
.annotator-filter .annotator-filter-navigation button:active {
border-color: rgb(112, 12, 73);
background-color: rgb(209, 46, 142);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(252, 124, 202)),
color-stop(0.5, rgb(232, 93, 178)),
color-stop(0.5, rgb(209, 46, 142)),
to(rgb(255, 0, 156))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
}
.annotator-editor a.annotator-save::after {
background-position: 0 -120px;
}
.annotator-editor a.annotator-save:hover::after,
.annotator-editor a.annotator-save:focus::after,
.annotator-editor a.annotator-save.annotator-focus::after {
margin-top: -8px;
background-position: 0 -135px;
}
.annotator-editor .annotator-widget::after {
background-position: 0 -30px;
}
.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls {
background-color: #f2f2f2;
}
.annotator-editor.annotator-invert-y .annotator-widget::after {
background-position: 0 -45px;
height: 11px;
}
.annotator-resize {
position: absolute;
top: 0;
right: 0;
width: 12px;
height: 12px;
background-position: 2px -150px;
}
.annotator-invert-x .annotator-resize {
right: auto;
left: 0;
background-position: 0 -195px;
}
.annotator-invert-y .annotator-resize {
top: auto;
bottom: 0;
background-position: 2px -165px;
}
.annotator-invert-y.annotator-invert-x .annotator-resize {
background-position: 0 -180px;
}
/* Annotator Notification
-------------------------------------------------------------------- */
.annotator-notice {
color: #fff;
position: absolute;
position: fixed;
top: -54px;
left: 0;
width: 100%;
font-size: 14px;
line-height: 50px;
text-align: center;
background: black;
background: rgba(0, 0, 0, 0.9);
border-bottom: 4px solid #d4d4d4;
-webkit-transition: top 0.4s ease-out;
-moz-transition: top 0.4s ease-out;
-o-transition: top 0.4s ease-out;
transition: top 0.4s ease-out;
}
.ie6 .annotator-notice {
position: absolute;
}
.annotator-notice-success {
border-color: #3665f9;
}
.annotator-notice-error {
border-color: #ff7e00;
}
.annotator-notice p {
margin: 0;
}
.annotator-notice a {
color: #fff;
}
.annotator-notice-show {
top: 0;
}
/* Annotator Tags Plugin
-------------------------------------------------------------------- */
.annotator-tags {
margin-bottom: -2px;
}
.annotator-tags .annotator-tag {
display: inline-block;
padding: 0 8px;
margin-bottom: 2px;
line-height: 1.6;
font-weight: bold;
background-color: rgb(230, 230, 230);
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
-o-border-radius: 8px;
border-radius: 8px;
}
/* Annotator Filter Plugin
-------------------------------------------------------------------- */
.annotator-filter {
position: fixed;
top: 0;
right: 0;
left: 0;
text-align: left;
line-height: 0;
border: none;
border-bottom: 1px solid #878787;
padding-left: 10px;
padding-right: 10px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
-webkit-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-moz-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-o-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
}
.annotator-filter strong {
font-size: 12px;
font-weight: bold;
color: #3c3c3c;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
position: relative;
top: -9px;
}
.annotator-filter .annotator-filter-property,
.annotator-filter .annotator-filter-navigation {
position: relative;
display: inline-block;
overflow: hidden;
line-height: 10px;
padding: 2px 0;
margin-right: 8px;
}
.annotator-filter .annotator-filter-property label,
.annotator-filter .annotator-filter-navigation button {
text-align: left;
display: block;
float: left;
line-height: 20px;
-webkit-border-radius: 10px 0 0 10px;
-moz-border-radius: 10px 0 0 10px;
-o-border-radius: 10px 0 0 10px;
border-radius: 10px 0 0 10px;
}
.annotator-filter .annotator-filter-property label {
padding-left: 8px;
}
.annotator-filter .annotator-filter-property input {
display: block;
float: right;
-webkit-appearance: none;
background-color: #fff;
border: 1px solid #878787;
border-left: none;
padding: 2px 4px;
line-height: 16px;
min-height: 16px;
font-size: 12px;
width: 150px;
color: #333;
background-color: #f8f8f8;
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-o-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
}
.annotator-filter .annotator-filter-property input:focus {
outline: none;
background-color: #fff;
}
.annotator-filter .annotator-filter-clear {
position: absolute;
right: 3px;
top: 6px;
border: none;
text-indent: -900em;
width: 15px;
height: 15px;
background-position: 0 -90px;
opacity: 0.4;
}
.annotator-filter .annotator-filter-clear:hover,
.annotator-filter .annotator-filter-clear:focus {
opacity: 0.8;
}
.annotator-filter .annotator-filter-clear:active {
opacity: 1;
}
.annotator-filter .annotator-filter-navigation button {
border: 1px solid rgb(162, 162, 162);
padding: 0;
text-indent: -900px;
width: 20px;
min-height: 22px;
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
}
.annotator-filter .annotator-filter-navigation button,
.annotator-filter .annotator-filter-navigation button:hover,
.annotator-filter .annotator-filter-navigation button:focus {
color: transparent;
}
.annotator-filter .annotator-filter-navigation button::after {
position: absolute;
top: 8px;
left: 8px;
content: "";
display: block;
width: 9px;
height: 9px;
background-position: 0 -210px;
}
.annotator-filter .annotator-filter-navigation button:hover::after {
background-position: 0 -225px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next {
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
border-left: none;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next::after {
left: auto;
right: 7px;
background-position: 0 -240px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover::after {
background-position: 0 -255px;
}
.annotator-hl-active {
background: rgba(255, 255, 10, 0.8);
}
.annotator-hl-filtered {
background-color: transparent;
}
/* FIXED HACK */
.annotator-adder,
.annotator-editor,
.annotator-viewer
{
position: fixed;
}

View file

@ -14,7 +14,7 @@
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="epubjs/libs/jquery-1.9.0.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="epubjs/libs/jquery-1.9.0.min.js"><\/script>')</script>
--> -->
<script src="../libs/jquery/jquery-2.0.3.js"></script> <script src="../libs/jquery/jquery-2.1.0.js"></script>
<script> <script>
"use strict"; "use strict";

View file

@ -12,7 +12,7 @@
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/popup.css"> <link rel="stylesheet" href="css/popup.css">
<script src="js/libs/jquery-2.0.3.min.js"></script> <script src="js/libs/jquery-2.1.0.min.js"></script>
<script src="js/libs/zip.min.js"></script> <script src="js/libs/zip.min.js"></script>

5860
demo/js/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1 +1,2 @@
EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.contents.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g=EPUBJS.core.folder(location.pathname),h=g+EPUBJS.cssPath||g,i={};EPUBJS.core.addCss(h+"popup.css",!1,b.render.document.head),d.forEach(function(a){function c(){var c,e,f=b.height,j=b.width,p=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),i[k]||(i[k]=document.createElement("div"),i[k].setAttribute("class","popup"),pop_content=document.createElement("div"),i[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.render.document.body.appendChild(i[k]),i[k].addEventListener("mouseover",d,!1),i[k].addEventListener("mouseout",g,!1),b.on("renderer:pageChanged",h,this),b.on("renderer:pageChanged",g,this)),c=i[k],e=a.getBoundingClientRect(),m=e.left,n=e.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",p>f/2.5&&(p=f/2.5,pop_content.style.maxHeight=p+"px"),popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),m-popRect.width<=0?(c.style.left=m+"px",c.classList.add("left")):c.classList.remove("left"),m+popRect.width/2>=j?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),c.classList.add("right")):c.classList.remove("right")}function d(){i[k].classList.add("on")}function g(){i[k].classList.remove("on")}function h(){setTimeout(function(){i[k].classList.remove("show")},100)}var j,k,l,m,n,o,p=a.getAttribute(e);p==f&&(j=a.getAttribute("href"),k=j.replace("#",""),l=b.render.document.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",h,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").mathml=function(a,b){if(-1!==b.currentChapter.manifestProperties.indexOf("mathml")){b.iframe.contentWindow.mathmlCallback=a;var c=document.createElement("script");c.type="text/x-mathjax-config",c.innerHTML=' MathJax.Hub.Register.StartupHook("End",function () { window.mathmlCallback(); }); MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); ',b.doc.body.appendChild(c),EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",null,b.doc.head)}else a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.contents.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.height;return"reflowable"!=b.layoutSettings.layout?(a(),void 0):(d.forEach(function(a){function c(){var c,d=a.getBoundingClientRect(),f=d.height,g=d.top,h=a.getAttribute("data-height"),i=h||f,j=Number(getComputedStyle(a,"").fontSize.match(/(\d*(\.\d*)?)px/)[1]),k=j?j/2:0;e=b.contents.clientHeight,0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g-k,a.style.maxHeight=c+"px",a.style.width="auto"):(i>e&&(a.style.maxHeight=e+"px",a.style.width="auto",d=a.getBoundingClientRect(),i=d.height),a.style.display="block",a.style.WebkitColumnBreakBefore="always",a.style.breakBefore="column"),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("renderer:resized",c),b.on("renderer:chapterUnloaded",function(){a.removeEventListener("load",c),b.off("renderer:resized",c)}),c()}),a&&a(),void 0)},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.contents.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>chapter.colWidth&&(d=chapter.colWidth/j,j=chapter.colWidth,k*=d),f.width=j,f.height=k}var d,e=a.getAttribute("ref"),f=document.createElement("iframe"),g=a.getAttribute("width"),h=a.getAttribute("height"),i=a.parentNode,j=g,k=h;c(),b.listenUntil("renderer:resized","renderer:chapterUnloaded",c),f.src=e,i.replaceChild(f,a)}),a&&a()}; EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.contents.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g=EPUBJS.core.folder(location.pathname),h=g+EPUBJS.cssPath||g,i={};EPUBJS.core.addCss(h+"popup.css",!1,b.render.document.head),d.forEach(function(a){function c(){var c,e,f=b.height,j=b.width,p=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),i[k]||(i[k]=document.createElement("div"),i[k].setAttribute("class","popup"),pop_content=document.createElement("div"),i[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.render.document.body.appendChild(i[k]),i[k].addEventListener("mouseover",d,!1),i[k].addEventListener("mouseout",g,!1),b.on("renderer:pageChanged",h,this),b.on("renderer:pageChanged",g,this)),c=i[k],e=a.getBoundingClientRect(),m=e.left,n=e.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",p>f/2.5&&(p=f/2.5,pop_content.style.maxHeight=p+"px"),popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),m-popRect.width<=0?(c.style.left=m+"px",c.classList.add("left")):c.classList.remove("left"),m+popRect.width/2>=j?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=f-25?(c.style.top=n-popRect.height+"px",c.classList.add("above")):c.classList.remove("above"),c.classList.add("right")):c.classList.remove("right")}function d(){i[k].classList.add("on")}function g(){i[k].classList.remove("on")}function h(){setTimeout(function(){i[k].classList.remove("show")},100)}var j,k,l,m,n,o,p=a.getAttribute(e);p==f&&(j=a.getAttribute("href"),k=j.replace("#",""),l=b.render.document.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",h,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").mathml=function(a,b){if(-1!==b.currentChapter.manifestProperties.indexOf("mathml")){b.iframe.contentWindow.mathmlCallback=a;var c=document.createElement("script");c.type="text/x-mathjax-config",c.innerHTML=' MathJax.Hub.Register.StartupHook("End",function () { window.mathmlCallback(); }); MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); ',b.doc.body.appendChild(c),EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML",null,b.doc.head)}else a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.contents.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.height;return"reflowable"!=b.layoutSettings.layout?void a():(d.forEach(function(a){function c(){var c,d=a.getBoundingClientRect(),f=d.height,g=d.top,h=a.getAttribute("data-height"),i=h||f,j=Number(getComputedStyle(a,"").fontSize.match(/(\d*(\.\d*)?)px/)[1]),k=j?j/2:0;e=b.contents.clientHeight,0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g-k,a.style.maxHeight=c+"px",a.style.width="auto"):(i>e&&(a.style.maxHeight=e+"px",a.style.width="auto",d=a.getBoundingClientRect(),i=d.height),a.style.display="block",a.style.WebkitColumnBreakBefore="always",a.style.breakBefore="column"),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("renderer:resized",c),b.on("renderer:chapterUnloaded",function(){a.removeEventListener("load",c),b.off("renderer:resized",c)}),c()}),void(a&&a()))},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.contents.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>chapter.colWidth&&(d=chapter.colWidth/j,j=chapter.colWidth,k*=d),f.width=j,f.height=k}var d,e=a.getAttribute("ref"),f=document.createElement("iframe"),g=a.getAttribute("width"),h=a.getAttribute("height"),i=a.parentNode,j=g,k=h;c(),b.listenUntil("renderer:resized","renderer:chapterUnloaded",c),f.src=e,i.replaceChild(f,a)}),a&&a()};
//# sourceMappingURL=hooks.min.map

File diff suppressed because one or more lines are too long

View file

@ -2161,3 +2161,5 @@
} }
})(this); })(this);
//# sourceMappingURL=inflate.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,3 @@
/*! fileStorage - v0.1.0 - 2013-06-04 */var fileStorage = fileStorage || {}; /*! fileStorage - v0.1.0 - 2013-06-04 */var fileStorage = fileStorage || {};
var _requestFileSystem=self.requestFileSystem||self.webkitRequestFileSystem;const DBSIZE=5242880,DBTYPE=TEMPORARY;self.onmessage=function(e){var t=e.data;self.request(t,function(e){self.save(t,e,function(){self.postMessage(t)})})},self.openFs=function(e){if(self._fs){e&&e(self._fs);return}_requestFileSystem(DBTYPE,DBSIZE,function(t){self._fs=t,e&&e(t)},self.failure)},self.request=function(e,t){var n=new self.loadFile(e);n.succeeded=function(e){t&&t(e)},n.failed=function(e){self.postMessage("failed: "+e.toString())},n.start()},self.save=function(e,t,n){self.openFs(function(r){var i=e.split("/").slice(0,-1);self.createDir(r.root,i),r.root.getFile(e,{create:!0},function(r){r.createWriter(function(r){r.onwriteend=function(e){n(e)},r.onerror=function(t){self.postMessage("write error:"+self.errorHandler(err)+" path="+e)},r.write(t)})},self.failure)})},self.createDir=function(e,t){if(t[0]=="."||t[0]=="")t=t.slice(1);e.getDirectory(t[0],{create:!0},function(e){t.length&&createDir(e,t.slice(1))},self.failure)},self.failure=function(e){self.postMessage("failed: "+self.errorHandler(e))},self.errorHandler=function(e){switch(e.code){case FileError.QUOTA_EXCEEDED_ERR:return"QUOTA_EXCEEDED_ERR";case FileError.NOT_FOUND_ERR:return"NOT_FOUND_ERR";case FileError.SECURITY_ERR:return"SECURITY_ERR";case FileError.INVALID_MODIFICATION_ERR:return"INVALID_MODIFICATION_ERR";case FileError.INVALID_STATE_ERR:return"INVALID_STATE_ERR";default:return"Unknown Error"}},self.loadFile=function(e,t){var n=new XMLHttpRequest;return this.succeeded=function(e){t&&t(e)},this.failed=function(e){console.log("Error:",e)},this.start=function(){var t=this;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){this.status==200&&t.succeeded(this.response)},n.onerror=function(e){t.failed(this.status)},n.send()},{start:this.start,succeeded:this.succeeded,failed:this.failed}},self.openFs(); var _requestFileSystem=self.requestFileSystem||self.webkitRequestFileSystem;const DBSIZE=5242880,DBTYPE=TEMPORARY;self.onmessage=function(e){var t=e.data;self.request(t,function(e){self.save(t,e,function(){self.postMessage(t)})})},self.openFs=function(e){if(self._fs){e&&e(self._fs);return}_requestFileSystem(DBTYPE,DBSIZE,function(t){self._fs=t,e&&e(t)},self.failure)},self.request=function(e,t){var n=new self.loadFile(e);n.succeeded=function(e){t&&t(e)},n.failed=function(e){self.postMessage("failed: "+e.toString())},n.start()},self.save=function(e,t,n){self.openFs(function(r){var i=e.split("/").slice(0,-1);self.createDir(r.root,i),r.root.getFile(e,{create:!0},function(r){r.createWriter(function(r){r.onwriteend=function(e){n(e)},r.onerror=function(t){self.postMessage("write error:"+self.errorHandler(err)+" path="+e)},r.write(t)})},self.failure)})},self.createDir=function(e,t){if(t[0]=="."||t[0]=="")t=t.slice(1);e.getDirectory(t[0],{create:!0},function(e){t.length&&createDir(e,t.slice(1))},self.failure)},self.failure=function(e){self.postMessage("failed: "+self.errorHandler(e))},self.errorHandler=function(e){switch(e.code){case FileError.QUOTA_EXCEEDED_ERR:return"QUOTA_EXCEEDED_ERR";case FileError.NOT_FOUND_ERR:return"NOT_FOUND_ERR";case FileError.SECURITY_ERR:return"SECURITY_ERR";case FileError.INVALID_MODIFICATION_ERR:return"INVALID_MODIFICATION_ERR";case FileError.INVALID_STATE_ERR:return"INVALID_STATE_ERR";default:return"Unknown Error"}},self.loadFile=function(e,t){var n=new XMLHttpRequest;return this.succeeded=function(e){t&&t(e)},this.failed=function(e){console.log("Error:",e)},this.start=function(){var t=this;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){this.status==200&&t.succeeded(this.response)},n.onerror=function(e){t.failed(this.status)},n.send()},{start:this.start,succeeded:this.succeeded,failed:this.failed}},self.openFs();
//# sourceMappingURL=loader_filesystem.min.js.map

File diff suppressed because one or more lines are too long

132
examples/android-patch.html Normal file
View file

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Basic ePubJS Example</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!-- EPUBJS Renderer -->
<!-- zip -->
<script src="../libs/zip/zip.js"></script>
<script src="../libs/zip/zip-fs.js"></script>
<script src="../libs/zip/zip-ext.js"></script>
<script src="../libs/zip/inflate.js"></script>
<script src="../libs/zip/mime-types.js"></script>
<!-- Render -->
<script src="../libs/underscore/underscore.js"></script>
<script src="../libs/rsvp/rsvp.js"></script>
<script src="../libs/fileStorage/fileStorage.min.js"></script>
<script src="../src/base.js"></script>
<script src="../src/core.js"></script>
<script src="../src/unarchiver.js"></script>
<script src="../src/parser.js"></script>
<script src="../src/hooks.js"></script>
<script src="../src/book.js"></script>
<script src="../src/chapter.js"></script>
<script src="../src/renderer.js"></script>
<script src="../src/replace.js"></script>
<script src="../src/epubcfi.js"></script>
<script src="../src/render_iframe.js"></script>
<script src="../src/layout.js"></script>
<script src="../src/pagination.js"></script>
<!-- Hooks -->
<!-- <script src="../hooks/default/transculsions.js"></script> -->
<!-- <script src="../hooks/default/endnotes.js"></script> -->
<script src="../hooks/default/smartimages.js"></script>
<script>
EPUBJS.filePath = "../demo/js/libs/";
EPUBJS.cssPath = "../demo/css/";
</script>
<style type="text/css">
body {
}
#main {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
#area {
width: 80%;
height: 80%;
margin: 5% auto;
max-width: 1250px;
}
#area iframe {
border: none;
}
#prev {
left: 40px;
}
#next {
right: 40px;
}
.arrow {
position: absolute;
top: 50%;
margin-top: -32px;
font-size: 64px;
color: #E2E2E2;
font-family: arial, sans-serif;
font-weight: bold;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.arrow:hover {
color: #777;
}
.arrow:active {
color: #000;
}
</style>
<script>
EPUBJS.Render.Iframe.prototype.setLeft = function(leftPos){
this.document.documentElement.style.WebkitTransform = "translate(-" + leftPos + "px, 0)";
};
</script>
<script>
"use strict";
var Book = ePub("../demo/moby-dick/", {restore: true, reload: true });
</script>
</head>
<body>
<div id="main">
<div id="prev" onclick="Book.prevPage();" class="arrow"></div>
<div id="area"></div>
<div id="next" onclick="Book.nextPage();"class="arrow"></div>
</div>
<script>
Book.renderTo("area");
</script>
</body>
</html>

View file

@ -86,6 +86,7 @@
<li><a href="fixed.html">Fixed</a></li> <li><a href="fixed.html">Fixed</a></li>
<li><a href="custom-elements.html">Custom Element</a></li> <li><a href="custom-elements.html">Custom Element</a></li>
<li><a href="mathml.html">MathML</a></li> <li><a href="mathml.html">MathML</a></li>
<li><a href="annotations.html">Annotations with Hypothes. is</a></li>
</ol> </ol>
</div> </div>

View file

@ -14,7 +14,7 @@
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="epubjs/libs/jquery-1.9.0.min.js"><\/script>')</script> <script>window.jQuery || document.write('<script src="epubjs/libs/jquery-1.9.0.min.js"><\/script>')</script>
--> -->
<script src="../libs/jquery/jquery-2.0.3.js"></script> <script src="../libs/jquery/jquery-2.1.0.js"></script>
<script> <script>
"use strict"; "use strict";

View file

@ -1,10 +1,20 @@
EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, chapter){ // EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, chapter){
//
//
// EPUBJS.core.addScript("https://hypothes.is/app/embed.js", null, chapter.doc.head);
//
// if(callback) callback();
//
// }
//
//
EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, renderer){
if(!renderer) return;
EPUBJS.core.addScript("https://hypothes.is/app/embed.js", null, chapter.doc.head); EPUBJS.core.addScript("https://hypothes.is/app/embed.js?role=guest&light=true", null, renderer.doc.head);
if(callback) callback();
}
EPUBJS.core.addCss("/demo/css/annotations.css", null, renderer.doc.head);
if(callback) callback();
};

View file

@ -1,12 +1,98 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html class="no-js">
<head> <head>
<script> <meta charset="utf-8">
this.DocumentUp={},DocumentUp.document=function(a){var b;"string"==typeof a?(b=a,a=null):(b=a.repo,delete a.repo),window.callback=function(b){b.status===200&&(document.open(),document.write(b.html),document.close(),a&&a.afterRender&&typeof a.afterRender=="function"&&a.afterRender())};var c=document.createElement("script");c.src="http://documentup.com/"+b,a?c.src+="?config="+encodeURIComponent(JSON.stringify(a))+"&callback=callback":c.src+="?callback=callback",document.getElementsByTagName("head")[0].appendChild(c)} <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</script> <title>ePubJS Examples</title>
<script> <meta name="description" content="">
DocumentUp.document("fchasen/epub.js"); <meta name="viewport" content="width=device-width">
</script> <meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body></body> <style type="text/css">
</html>
body {
overflow: auto;
background: #eee;
}
#wrapper {
width: 480px;
height: 640px;
overflow: hidden;
border: 1px solid #ccc;
margin: 28px auto;
background: #fff;
border-radius: 0 5px 5px 0;
}
#area {
width: 480px;
height: 660px;
margin: -30px auto;
-moz-box-shadow: inset 10px 0 20px rgba(0,0,0,.1);
-webkit-box-shadow: inset 10px 0 20px rgba(0,0,0,.1);
box-shadow: inset 10px 0 20px rgba(0,0,0,.1);
}
#area iframe {
padding: 40px 40px;
}
body {
font-size: 1em;
line-height: 1.33em;
font-family: serif;
}
h1 {
text-align: center
font-size: 1.5em;
line-height: 1.33em;
text-align: center;
padding-bottom: 0em;
text-align: center;
text-transform: uppercase;
font-weight: normal;
letter-spacing: 4px;
padding-top: 60px;
}
ol {
width: 350px;
margin: 50px auto;
/*font-family: sans-serif;*/
}
a {
font-size: 1.2em;
line-height: 1.33em;
color: #000;
}
</style>
</head>
<body>
<div id="main">
<div id="wrapper">
<div id="area">
<h1>EPUB.js<br>Examples</h1>
<ol>
<li><a href="examples/single.html">Single</a></li>
<li><a href="examples/basic.html">Basic</a></li>
<li><a href="examples/contained.html">Contained</a></li>
<li><a href="examples/promises.html">Promises</a></li>
<li><a href="examples/fixed.html">Fixed</a></li>
<li><a href="examples/custom-elements.html">Custom Element</a></li>
<li><a href="examples/mathml.html">MathML</a></li>
<li><a href="examples/annotations.html">Annotations with Hypothes. is</a></li>
</ol>
</div>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,511 +0,0 @@
/*!
* jQuery Migrate - v1.1.1 - 2013-02-16
* https://github.com/jquery/jquery-migrate
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
var warnedAbout = {};
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;
// Show a message on the console so devs know we're active
if ( !jQuery.migrateMute && window.console && console.log ) {
console.log("JQMIGRATE: Logging is active");
}
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg) {
if ( !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( window.console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
if ( Object.defineProperty ) {
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
// allow property to be overwritten in case some other plugin wants it
try {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
});
return;
} catch( err ) {
// IE8 is a dope about Object.defineProperty, can't warn there
}
}
// Non-ES5 (or broken) browser; just set the property
jQuery._definePropertyBroken = true;
obj[ prop ] = value;
}
if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
function() { return null; },
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
function() { return undefined; },
rnoType = /^(?:input|button)$/i,
rnoAttrNodeType = /^[238]$/,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
ruseDefault = /^(?:checked|selected)$/i;
// jQuery.attrFn
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
// Since pass is used internally, we only warn for new jQuery
// versions where there isn't a pass arg in the formal params
if ( oldAttr.length < 4 ) {
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
}
if ( elem && !rnoAttrNodeType.test( nType ) &&
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
return jQuery( elem )[ name ]( value );
}
}
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
}
// Restore boolHook for boolean property/attribute synchronization
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
jQuery.attrHooks[ lowerName ] = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" &&
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// Warn only for attributes that can remain distinct from their properties post-1.9
if ( ruseDefault.test( lowerName ) ) {
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
}
}
return oldAttr.call( jQuery, elem, name, value );
};
// attrHooks: value
jQuery.attrHooks.value = {
get: function( elem, name ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrGet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrSet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldParseJSON = jQuery.parseJSON,
// Note this does NOT include the #9521 XSS fix from 1.7!
rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match;
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( selector )) && match[1] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( selector.charAt( 0 ) !== "<" ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
// Now process using loose rules; let pre-1.8 play too
if ( context && context.context ) {
// jQuery object as context; parseHTML expects a DOM object
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
context, rootjQuery );
}
}
return oldInit.apply( this, arguments );
};
jQuery.fn.init.prototype = jQuery.fn;
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json && json !== null ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
return oldParseJSON.apply( this, arguments );
};
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
// Don't clobber any existing jQuery.browser in case it's different
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
// Warn if the code tries to get jQuery.browser
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
migrateWarn( "jQuery.sub() is deprecated" );
return jQuerySub;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
converters: {
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
jQuery.fn.data = function( name ) {
var ret, evt,
elem = this[0];
// Handles 1.7 which has this behavior and 1.8 which doesn't
if ( elem && name === "events" && arguments.length === 1 ) {
ret = jQuery.data( elem, name );
evt = jQuery._data( elem, name );
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
return evt;
}
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i,
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
return oldSelf.apply( this, arguments );
};
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
if ( !jQuery.clean ) {
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
migrateWarn("jQuery.clean() is deprecated");
var i, elem, handleScript, jsTags,
ret = [];
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
// Complex logic lifted directly from jQuery 1.8
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
oldToggle = jQuery.fn.toggle,
oldLive = jQuery.fn.live,
oldDie = jQuery.fn.die,
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
return events;
}
if ( rhoverHack.test( events ) ) {
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
}
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
// Event props removed in 1.9, put them back if needed; no practical way to warn them
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
}
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
if ( jQuery.event.dispatch ) {
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
}
// Support for 'hover' pseudo-event and ajax event warnings
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( elem !== document && rajaxEvent.test( types ) ) {
migrateWarn( "AJAX events should be attached to document: " + types );
}
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
};
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
};
jQuery.fn.error = function() {
var args = Array.prototype.slice.call( arguments, 0);
migrateWarn("jQuery.fn.error() is deprecated");
args.splice( 0, 0, "error" );
if ( arguments.length ) {
return this.bind.apply( this, args );
}
// error event should not bubble to window, although it does pre-1.7
this.triggerHandler.apply( this, args );
return this;
};
jQuery.fn.toggle = function( fn, fn2 ) {
// Don't mess with animation or css toggles
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
return oldToggle.apply( this, arguments );
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
};
jQuery.fn.live = function( types, data, fn ) {
migrateWarn("jQuery.fn.live() is deprecated");
if ( oldLive ) {
return oldLive.apply( this, arguments );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
};
jQuery.fn.die = function( types, fn ) {
migrateWarn("jQuery.fn.die() is deprecated");
if ( oldDie ) {
return oldDie.apply( this, arguments );
}
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
};
// Turn global events into document-triggered events
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
if ( !elem && !rajaxEvent.test( event ) ) {
migrateWarn( "Global events are undocumented and deprecated" );
}
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
};
jQuery.each( ajaxEvents.split("|"),
function( _, name ) {
jQuery.event.special[ name ] = {
setup: function() {
var elem = this;
// The document needs no shimming; must be !== for oldIE
if ( elem !== document ) {
jQuery.event.add( document, name + "." + jQuery.guid, function() {
jQuery.event.trigger( name, null, elem, true );
});
jQuery._data( this, name, jQuery.guid++ );
}
return false;
},
teardown: function() {
if ( this !== document ) {
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
}
return false;
}
};
}
);
})( jQuery, window );

View file

@ -10,7 +10,9 @@
"optimist": "~0.6.0", "optimist": "~0.6.0",
"portfinder": "~0.2.1", "portfinder": "~0.2.1",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.2", "grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-jshint": "~0.8.0" "grunt-contrib-jshint": "~0.8.0",
"grunt-concat-sourcemap": "~0.4.1",
"grunt-contrib-copy": "~0.5.0"
} }
} }

View file

@ -93,6 +93,8 @@ EPUBJS.reader.ControlsController = function(book) {
.removeClass("icon-bookmark-empty"); .removeClass("icon-bookmark-empty");
} }
reader.currentLocationCfi = cfi;
// Update the History Location // Update the History Location
if(reader.settings.history && if(reader.settings.history &&
window.location.hash != cfiFragment) { window.location.hash != cfiFragment) {

View file

@ -300,6 +300,7 @@ EPUBJS.Reader.prototype.selectedRange = function(range){
window.location.hash != cfiFragment) { window.location.hash != cfiFragment) {
// Add CFI fragment to the history // Add CFI fragment to the history
history.pushState({}, '', cfiFragment); history.pushState({}, '', cfiFragment);
this.currentLocationCfi = cfi;
} }
}; };