mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
updated grunt file to compress zip in correct order
This commit is contained in:
parent
f1eb2d8707
commit
ec377d9132
22 changed files with 2347 additions and 100 deletions
|
@ -14,6 +14,8 @@
|
|||
|
||||
<script src="js/libs/jquery-1.9.0.min.js"></script>
|
||||
|
||||
<script src="js/libs/zip.min.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
|
@ -21,14 +23,14 @@
|
|||
if (document.readyState == "complete") {
|
||||
EPUBJS.VERSION = "0.1.6";
|
||||
|
||||
EPUBJS.filePath = "js/";
|
||||
EPUBJS.filePath = "js/libs/";
|
||||
fileStorage.filePath = EPUBJS.filePath + "libs/";
|
||||
|
||||
EPUBJSR.app.init("moby-dick/");
|
||||
EPUBJSR.app.init("moby-dick.epub");
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<!-- Render -->
|
||||
<script src="js/epub.min.js"></script>
|
||||
|
|
3
demo/js/epub.min.js
vendored
3
demo/js/epub.min.js
vendored
File diff suppressed because one or more lines are too long
2
demo/js/hooks.min.js
vendored
2
demo/js/hooks.min.js
vendored
|
@ -1 +1 @@
|
|||
EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(e,t){var n=t.doc.querySelectorAll("a[href]"),r=Array.prototype.slice.call(n),i="epub:type",s="noteref",o={};r.forEach(function(e){function d(){var n,r=t.iframe.height,i=t.iframe.width,s,f,l=225;p||(f=a.cloneNode(!0),p=f.querySelector("p")),o[u]||(o[u]=document.createElement("div"),o[u].setAttribute("class","popup"),pop_content=document.createElement("div"),o[u].appendChild(pop_content),pop_content.appendChild(p),pop_content.setAttribute("class","pop_content"),t.bodyEl.appendChild(o[u]),o[u].addEventListener("mouseover",v,!1),o[u].addEventListener("mouseout",m,!1),t.book.listenUntil("book:pageChanged","book:chapterDestroy",g),t.book.listenUntil("book:pageChanged","book:chapterDestroy",m)),f=o[u],itemRect=e.getBoundingClientRect(),c=itemRect.left,h=itemRect.top,f.classList.add("show"),popRect=f.getBoundingClientRect(),f.style.left=c-popRect.width/2+"px",f.style.top=h+"px",l>r/2.5&&(l=r/2.5,pop_content.style.maxHeight=l+"px"),popRect.height+h>=r-25?(f.style.top=h-popRect.height+"px",f.classList.add("above")):f.classList.remove("above"),c-popRect.width<=0?(f.style.left=c+"px",f.classList.add("left")):f.classList.remove("left"),c+popRect.width/2>=i?(f.style.left=c-300+"px",popRect=f.getBoundingClientRect(),f.style.left=c-popRect.width+"px",popRect.height+h>=r-25?(f.style.top=h-popRect.height+"px",f.classList.add("above")):f.classList.remove("above"),f.classList.add("right")):f.classList.remove("right")}function v(){o[u].classList.add("on")}function m(){o[u].classList.remove("on")}function g(){setTimeout(function(){o[u].classList.remove("show")},100)}var n=e.getAttribute(i),r,u,a,f,l,c,h,p;if(n!=s)return;r=e.getAttribute("href"),u=r.replace("#",""),a=t.doc.getElementById(u),e.addEventListener("mouseover",d,!1),e.addEventListener("mouseout",g,!1)}),e&&e()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(e,t){var n=t.doc.querySelectorAll("img"),r=Array.prototype.slice.call(n),i=t.height(),s;r.forEach(function(e){function n(){var n=e.getBoundingClientRect(),r=n.height,s=n.top,o=e.getAttribute("data-height"),u=o||r,a;i=t.height(),s<0&&(s=0),u+s>=i?(s<i/2?(a=i-s,e.style.maxHeight=a+"px",e.style.width="auto"):(u=u<i?u:i,e.style.maxHeight=a+"px",e.style.marginTop=i-s+"px",e.style.width="auto"),e.setAttribute("data-height",a)):(e.style.removeProperty("max-height"),e.style.removeProperty("margin-top"))}e.addEventListener("load",n,!1),t.on("book:resized",n),t.on("book:chapterDestroyed",function(){e.removeEventListener("load",n),t.off("book:resized",n)}),n()}),e&&e()},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(e,t){var n=t.doc.querySelectorAll("[transclusion]"),r=Array.prototype.slice.call(n);r.forEach(function(e){function l(){u=i,a=s,u>t.colWidth&&(f=t.colWidth/u,u=t.colWidth,a*=f),r.width=u,r.height=a}var n=e.getAttribute("ref"),r=document.createElement("iframe"),i=e.getAttribute("width"),s=e.getAttribute("height"),o=e.parentNode,u=i,a=s,f;l(),t.book.listenUntil("book:resized","book:chapterDestroy",l),r.src=n,o.replaceChild(r,e)}),e&&e()};
|
||||
EPUBJS.Hooks.register("beforeChapterDisplay").endnotes=function(a,b){var c=b.doc.querySelectorAll("a[href]"),d=Array.prototype.slice.call(c),e="epub:type",f="noteref",g={};EPUBJS.core.addCss("../demo/css/popup.css",!1,b.doc.head),d.forEach(function(a){function c(){var c,e=b.iframe.height,f=b.iframe.width,j=225;o||(c=l.cloneNode(!0),o=c.querySelector("p")),g[k]||(g[k]=document.createElement("div"),g[k].setAttribute("class","popup"),pop_content=document.createElement("div"),g[k].appendChild(pop_content),pop_content.appendChild(o),pop_content.setAttribute("class","pop_content"),b.bodyEl.appendChild(g[k]),g[k].addEventListener("mouseover",d,!1),g[k].addEventListener("mouseout",h,!1),b.book.on("book:pageChanged",i,this),b.book.on("book:pageChanged",h,this)),c=g[k],itemRect=a.getBoundingClientRect(),m=itemRect.left,n=itemRect.top,c.classList.add("show"),popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width/2+"px",c.style.top=n+"px",j>e/2.5&&(j=e/2.5,pop_content.style.maxHeight=j+"px"),popRect.height+n>=e-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>=f?(c.style.left=m-300+"px",popRect=c.getBoundingClientRect(),c.style.left=m-popRect.width+"px",popRect.height+n>=e-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(){g[k].classList.add("on")}function h(){g[k].classList.remove("on")}function i(){setTimeout(function(){g[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.doc.getElementById(k),a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",i,!1))}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").smartimages=function(a,b){var c=b.doc.querySelectorAll("img"),d=Array.prototype.slice.call(c),e=b.height();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;e=b.height(),0>g&&(g=0),i+g>=e?(e/2>g?(c=e-g,a.style.maxHeight=c+"px",a.style.width="auto"):(i=e>i?i:e,a.style.maxHeight=c+"px",a.style.marginTop=e-g+"px",a.style.width="auto"),a.setAttribute("data-height",c)):(a.style.removeProperty("max-height"),a.style.removeProperty("margin-top"))}a.addEventListener("load",c,!1),b.on("book:resized",c),b.on("book:chapterDestroyed",function(){a.removeEventListener("load",c),b.off("book:resized",c)}),c()}),a&&a()},EPUBJS.Hooks.register("beforeChapterDisplay").transculsions=function(a,b){var c=b.doc.querySelectorAll("[transclusion]"),d=Array.prototype.slice.call(c);d.forEach(function(a){function c(){j=g,k=h,j>b.colWidth&&(d=b.colWidth/j,j=b.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.book.listenUntil("book:resized","book:chapterDestroy",c),f.src=e,i.replaceChild(f,a)}),a&&a()};
|
2163
demo/js/libs/inflate.js
Normal file
2163
demo/js/libs/inflate.js
Normal file
File diff suppressed because it is too large
Load diff
2
demo/js/libs/inflate.min.js
vendored
2
demo/js/libs/inflate.min.js
vendored
File diff suppressed because one or more lines are too long
30
demo/js/libs/zip.min.js
vendored
30
demo/js/libs/zip.min.js
vendored
File diff suppressed because one or more lines are too long
2
demo/js/reader.min.js
vendored
2
demo/js/reader.min.js
vendored
|
@ -1 +1 @@
|
|||
var EPUBJSR=EPUBJSR||{};EPUBJSR.app={},EPUBJSR.app.init=function(e){"use strict";function s(n){var s=window.location.search.match(/book=(.*)/),n=n||(s?s[1]:"moby-dick");i=e(window).width(),i>550?e("#main").width(i-r):e("#main").width(i),t=new EPUBJS.Book(n),t.on("book:online",c),t.on("book:offline",h),t.getMetadata().then(o),t.getToc().then(u),t.ready.all.then(l),t.renderTo("area"),e(function(){d()})}function o(t){var n=t.bookTitle,r=t.creator,i=e("#book-title"),s=e("#chapter-title"),o=e("#title-seperator");document.title=n+" – "+r,i.html(n),s.html(r),o.show()}function u(n){var r=e("#toc"),i,s;r.empty(),s=f(n,1),r.append(s),i=e(".toc_link"),i.on("click",function(n){var r=e(this),i=r.data("url");e(".openChapter").removeClass("openChapter"),r.parents("li").addClass("openChapter"),t.goto(i),n.preventDefault()})}function a(){var n="";localStorage.getItem("fontSize")?n=localStorage.getItem("fontSize"):(n="medium",localStorage.setItem("fontSize",n));var r=e("#settingsPanel");r.append("<ul></ul>");var i=e("<li><h3></h3></li>"),s=e("<input type='radio' name='fontSize' value='x-small'><span class='xsmall'>Extra Small</span><br><input type='radio' name='fontSize' value='small'><span class='small'>Small</span><br><input type='radio' name='fontSize' value='medium'><span class='medium'>Medium</span><br><input type='radio' name='fontSize' value='large'><span class='large'>Large</span><br><input type='radio' name='fontSize' value='x-large'><span class='xlarge'>Extra Large</span>");i.find("h3").text("Font Size").after(s),r.find("ul").append(i);var o=e('input[name="fontSize"]');o.each(function(){e(this).attr("value")==n&&e(this).attr("checked","checked"),e(this).on("click",function(){localStorage.setItem("fontSize",e(this).attr("value")),t.iframe.contentDocument.location.reload(!0)})})}function f(t,n){var r=e("<ul>"),i=n==1?"chapter":"section";return t.forEach(function(t){var s,o=e("<li id='toc-"+t.id+"'>"),u=e("<a class='toc_link "+i+"' href='#/"+t.href+"' data-url='"+t.href+"'>"+t.label+"</a>");o.append(u),t.subitems&&t.subitems.length&&(n++,s=f(t.subitems,n),o.append(s)),r.append(o)}),r}function l(){var n=e("#divider"),r=e("#loader");r.hide(),t.single||n.addClass("show")}function c(){var t=e("#store");n=!1,t.attr("src",t.data("save"))}function h(){var t=e("#store");n=!0,t.attr("src",t.data("saved"))}function p(t){var n=t.msg,r=e("#toc-"+n),i=e(".currentChapter");r.length&&(i.removeClass("currentChapter"),r.addClass("currentChapter"))}function d(){function y(){f.addClass("open"),u.addClass("closed"),c.attr("src",c.data("close"))}function b(){a.css("pointer-events","visible"),f.removeClass("open"),u.removeClass("closed"),c.attr("src",c.data("open"))}function w(){v.hide(),d.show()}function E(){d.hide(),v.show()}var s=e("#next"),o=e("#prev"),u=e("#main"),a=e("#area"),f=e("#sidebar"),l=e("#open"),c=l.find("img"),h=e("#network"),p=e("#setting"),d=e("#settingsPanel"),v=e("#toc"),m=e(window);m.on("resize",function(){i=e(window).width(),i>550?u.width(i-r):u.width(i)}),s.on("click",function(){t.nextPage()}),o.on("click",function(){t.prevPage()}),p.on("click",function(){d.is(":visible")?E():w()});var g=!1;e(document).keydown(function(e){if(g)return;if(e.keyCode==37)return o.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1;if(e.keyCode==39)return s.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1}),l.on("click",function(){f.hasClass("open")?b():y()}),h.on("click",function(){n=!n,t.fromStorage(n)})}var t,n=!1,r=0,i;return s}(jQuery),jQuery.fn.extend({clickOutside:function(e,t){var n=this;return jQuery(document).on("click.offer",function(r){if(t&&jQuery.inArray(r.target,t)>-1)return;if(jQuery.contains(n[0],r.target))return;jQuery(document).off("click.offer"),e(r,n)}),this}});
|
||||
var EPUBJSR=EPUBJSR||{};EPUBJSR.app={},EPUBJSR.app.init=function(a){"use strict";function b(b){var e=window.location.search.match(/book=(.*)/),b=b||(e?e[1]:"moby-dick");return k=a(window).width(),k>550?a("#main").width(k-m):a("#main").width(k),j=new EPUBJS.Book(b),j.on("book:online",g),j.on("book:offline",h),j.getMetadata().then(c),j.getToc().then(d),j.ready.all.then(f),j.renderTo("area"),a(function(){i()}),j}function c(b){var c=b.bookTitle,d=b.creator,e=a("#book-title"),f=a("#chapter-title"),g=a("#title-seperator");document.title=c+" – "+d,e.html(c),f.html(d),g.show()}function d(b){var c,d,f=a("#toc");f.empty(),d=e(b,1),f.append(d),c=a(".toc_link"),c.on("click",function(b){var c=a(this),d=c.data("url");a(".openChapter").removeClass("openChapter"),c.parents("li").addClass("openChapter"),j.goto(d),b.preventDefault()})}function e(b,c){var d=a("<ul>"),f=1==c?"chapter":"section";return b.forEach(function(b){var g,h=a("<li id='toc-"+b.id+"'>"),i=a("<a class='toc_link "+f+"' href='#/"+b.href+"' data-url='"+b.href+"'>"+b.label+"</a>");h.append(i),b.subitems&&b.subitems.length&&(c++,g=e(b.subitems,c),h.append(g)),d.append(h)}),d}function f(){var b=a("#divider"),c=a("#loader");c.hide(),j.single||b.addClass("show")}function g(){var b=a("#store");l=!1,b.attr("src",b.data("save"))}function h(){var b=a("#store");l=!0,b.attr("src",b.data("saved"))}function i(){function b(){n.addClass("open"),h.addClass("closed"),p.attr("src",p.data("close"))}function c(){i.css("pointer-events","visible"),n.removeClass("open"),h.removeClass("closed"),p.attr("src",p.data("open"))}function d(){t.hide(),s.show()}function e(){s.hide(),t.show()}var f=a("#next"),g=a("#prev"),h=a("#main"),i=a("#area"),n=a("#sidebar"),o=a("#open"),p=o.find("img"),q=a("#network"),r=a("#setting"),s=a("#settingsPanel"),t=a("#toc"),u=a(window);u.on("resize",function(){k=a(window).width(),k>550?h.width(k-m):h.width(k)}),f.on("click",function(){j.nextPage()}),g.on("click",function(){j.prevPage()}),r.on("click",function(){s.is(":visible")?e():d()});var v=!1;a(document).keydown(function(a){return v?void 0:37==a.keyCode?(g.trigger("click"),v=!0,setTimeout(function(){v=!1},100),!1):39==a.keyCode?(f.trigger("click"),v=!0,setTimeout(function(){v=!1},100),!1):void 0}),o.on("click",function(){n.hasClass("open")?c():b()}),q.on("click",function(){l=!l,j.fromStorage(l)})}var j,k,l=!1,m=0;return b}(jQuery),jQuery.fn.extend({clickOutside:function(a,b){var c=this;return jQuery(document).on("click.offer",function(d){b&&jQuery.inArray(d.target,b)>-1||jQuery.contains(c[0],d.target)||(jQuery(document).off("click.offer"),a(d,c))}),this}});
|
Loading…
Add table
Add a link
Reference in a new issue