mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
fixed endnotes bounding rects
This commit is contained in:
parent
2d81246827
commit
b2c7b76b27
10 changed files with 85 additions and 41 deletions
|
@ -7,18 +7,14 @@
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/normalize.css">
|
<link rel="stylesheet" href="css/normalize.css">
|
||||||
<link rel="stylesheet" href="css/main.css">
|
<link rel="stylesheet" href="css/main.css">
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/annotator.css">
|
|
||||||
|
|
||||||
<!-- <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="fpjs/libs/jquery-1.9.0.min.js"><\/script>')</script>
|
<script>window.jQuery || document.write('<script src="fpjs/libs/jquery-1.9.0.min.js"><\/script>')</script>
|
||||||
-->
|
-->
|
||||||
<script src="fpjs/libs/jquery-1.9.0.js"></script>
|
<script src="fpjs/libs/jquery-1.9.0.js"></script>
|
||||||
<script src="fpjs/libs/jquery-migrate-1.1.1.js"></script>
|
<script src="fpjs/libs/jquery-migrate-1.1.1.js"></script>
|
||||||
|
|
||||||
<script src="fpjs/libs/modernizr-2.6.2.min.js"></script>
|
<script src="fpjs/libs/modernizr-2.6.2.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -28,47 +24,48 @@
|
||||||
document.onreadystatechange = function () {
|
document.onreadystatechange = function () {
|
||||||
if (document.readyState == "complete") {
|
if (document.readyState == "complete") {
|
||||||
FP.filePath = "/fpjs/";
|
FP.filePath = "/fpjs/";
|
||||||
|
fileStorage.filePath = FP.filePath + "libs/";
|
||||||
|
|
||||||
|
FP.VERSION = "0.1.5";
|
||||||
FPR.app.init();
|
FPR.app.init();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--<script async src="fpjs/libs/jquery.touchy.min.js"></script>-->
|
<!--<script async src="fpjs/libs/jquery.touchy.min.js"></script>-->
|
||||||
|
|
||||||
<!-- Render -->
|
<!-- Render -->
|
||||||
<script src="fpjs/render/base.js"></script>
|
<script src="fpjs/render/base.js"></script>
|
||||||
<script src="fpjs/render/core.js"></script>
|
<script src="fpjs/render/core.js"></script>
|
||||||
<script src="fpjs/render/queue.js"></script>
|
|
||||||
<script src="fpjs/render/unarchiver.js"></script>
|
<script src="fpjs/render/unarchiver.js"></script>
|
||||||
<script src="fpjs/render/storage.js"></script>
|
<script src="fpjs/libs/fileStorage.min.js"></script>
|
||||||
<script src="fpjs/render/storage_ram.js"></script>
|
|
||||||
<script src="fpjs/render/storage_websql.js"></script>
|
|
||||||
<script src="fpjs/render/storage_indexeddb.js"></script>
|
|
||||||
<script src="fpjs/render/storage_filesystem.js"></script>
|
|
||||||
<script src="fpjs/render/events.js"></script>
|
<script src="fpjs/render/events.js"></script>
|
||||||
<script src="fpjs/render/hooks.js"></script>
|
<script src="fpjs/render/hooks.js"></script>
|
||||||
<script src="fpjs/render/book.js"></script>
|
<script src="fpjs/render/book.js"></script>
|
||||||
<script src="fpjs/render/chapter.js"></script>
|
<script src="fpjs/render/chapter.js"></script>
|
||||||
|
|
||||||
<!-- Plugins -->
|
<!-- Plugins -->
|
||||||
<script async src="fpjs/hooks/transculsions.js"></script>
|
<script async src="fpjs/hooks/transculsions.js"></script>
|
||||||
|
<script async src="fpjs/hooks/endnotes.js"></script>
|
||||||
|
<script async src="fpjs/hooks/smartimages.js"></script>
|
||||||
|
|
||||||
|
<!-- <script async src="fpjs/hooks/extras/music.js"></script> -->
|
||||||
<script async src="fpjs/hooks/extras/annotate.js"></script>
|
<script async src="fpjs/hooks/extras/annotate.js"></script>
|
||||||
|
|
||||||
<!-- Reader -->
|
|
||||||
<script async src="fpjs/reader/utils.js"></script>
|
|
||||||
<script async src="fpjs/reader/app.js"></script>
|
|
||||||
|
|
||||||
<!-- Annotator -->
|
<!-- Annotator -->
|
||||||
<script async src="fpjs/libs/annotator-full.js"></script>
|
<script async src="fpjs/libs/annotator-full.js"></script>
|
||||||
|
|
||||||
|
<!-- Reader -->
|
||||||
|
<script async src="fpjs/reader/utils.js"></script>
|
||||||
|
<script async src="fpjs/reader/app.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
|
|
||||||
<input id="search" placeholder="search">
|
<input id="search" placeholder="search">
|
||||||
<a id="network"><img id="store" src="img/save.png"></a>
|
<a id="network"><img id="store" src="img/save.png"></a>
|
||||||
<a id="setting"><img id="settings" src="img/settings.png"></a>
|
<a id="setting"><img id="settings" src="img/settings.png"></a>
|
||||||
|
@ -78,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsPanel">
|
<div id="settingsPanel">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<div id="opener">
|
<div id="opener">
|
||||||
|
@ -89,10 +86,11 @@
|
||||||
<span id="title-seperator"> – </span>
|
<span id="title-seperator"> – </span>
|
||||||
<span id="chapter-title"> </span>
|
<span id="chapter-title"> </span>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="divider"></div>
|
||||||
<div id="prev" class="arrow">‹</div>
|
<div id="prev" class="arrow">‹</div>
|
||||||
<div id="area"></div>
|
<div id="area"></div>
|
||||||
<div id="next" class="arrow">›</div>
|
<div id="next" class="arrow">›</div>
|
||||||
<div id="divider"></div>
|
|
||||||
<div id="loader"><img src="img/loader.gif"></div>
|
<div id="loader"><img src="img/loader.gif"></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
BIN
dist/.DS_Store
vendored
BIN
dist/.DS_Store
vendored
Binary file not shown.
4
dist/hooks/hooks.min.js
vendored
4
dist/hooks/hooks.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
/*! FuturePress - v0.1.0 - 2013-03-28 */
|
/*! FuturePress - v0.1.0 - 2013-04-01 */
|
||||||
FP.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={};FP.core.addCss("css/popup.css",!1,t.doc.head),r.forEach(function(e){function d(){var n,r=t.iframe.height,i=t.iframe.width,s,f,d=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=l.left,h=l.top,f.classList.add("show"),f.style.left=c-itemRect.width/2+"px",f.style.top=h+"px",popRect=f.getBoundingClientRect(),d>r/2.5&&(d=r/2.5,pop_content.style.maxHeight=d+"px"),n.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()},FP.Hooks.register("beforeChapterDisplay").smartimages=function(e,t){var n=t.doc.querySelectorAll("img"),r=Array.prototype.slice.call(n),i=t.iframe.height,s;r.forEach(function(e){function n(){var n=e.getBoundingClientRect(),r=n.height,s=n.top;i=t.iframe.height,r+s>=i?s<i/2?e.style.maxHeight=i-s+"px":(e.style.maxHeight=(r<i?r:i)+"px",e.style.marginTop=i-s+"px"):(e.style.removeProperty("max-height"),e.style.removeProperty("margin-top"))}t.book.listenUntil("book:resized","book:chapterDestroy",n),n()}),e&&e()},FP.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()};
|
FP.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={};FP.core.addCss("css/popup.css",!1,t.doc.head),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()},FP.Hooks.register("beforeChapterDisplay").smartimages=function(e,t){var n=t.doc.querySelectorAll("img"),r=Array.prototype.slice.call(n),i=t.iframe.height,s;r.forEach(function(e){function n(){var n=e.getBoundingClientRect(),r=n.height,s=n.top;i=t.iframe.height,r+s>=i?s<i/2?e.style.maxHeight=i-s+"px":(e.style.maxHeight=(r<i?r:i)+"px",e.style.marginTop=i-s+"px"):(e.style.removeProperty("max-height"),e.style.removeProperty("margin-top"))}t.book.listenUntil("book:resized","book:chapterDestroy",n),n()}),e&&e()},FP.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()};
|
2
dist/reader.min.js
vendored
2
dist/reader.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
/*! FuturePress - v0.1.0 - 2013-03-28 */
|
/*! FuturePress - v0.1.0 - 2013-04-01 */
|
||||||
var FPR=FPR||{};FPR.app={},FPR.app.init=function(e){"use strict";function s(n){var s=window.location.search.match(/book=(.*)/),n=n||(s?s[1]:"moby-dick");FP.core.crossBrowserColumnCss(),i=e(window).width(),i>550?e("#main").width(i-r):e("#main").width(i),a(),t=new FP.Book("area"),t.listen("book:metadataReady",o),t.listen("book:tocReady",u),t.listen("book:bookReady",l),t.listen("book:chapterReady",p),t.listen("book:online",c),t.listen("book:offline",h),t.start(n),e(function(){d()})}function o(){var n=t.getTitle(),r=t.getCreator(),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(){var n=t.getTOC(),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.useHash||(t.show(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","img/save.png")}function h(){var t=e("#store");n=!0,t.attr("src","img/saved.png")}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","img/close.png")}function b(){a.css("pointer-events","visible"),f.removeClass("open"),u.removeClass("closed"),c.attr("src","img/menu-icon.png")}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()}),m.bind("touchy-swipe",function(e,n,r,i){(i.direction="left")&&t.nextPage(),(i.direction="right")&&t.prevPage()});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 FPR=FPR||{};FPR.app={},FPR.app.init=function(e){"use strict";function s(n){var s=window.location.search.match(/book=(.*)/),n=n||(s?s[1]:"moby-dick");FP.core.crossBrowserColumnCss(),i=e(window).width(),i>550?e("#main").width(i-r):e("#main").width(i),a(),t=new FP.Book("area"),t.listen("book:metadataReady",o),t.listen("book:tocReady",u),t.listen("book:bookReady",l),t.listen("book:chapterReady",p),t.listen("book:online",c),t.listen("book:offline",h),t.start(n),e(function(){d()})}function o(){var n=t.getTitle(),r=t.getCreator(),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(){var n=t.getTOC(),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.useHash||(t.show(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","img/save.png")}function h(){var t=e("#store");n=!0,t.attr("src","img/saved.png")}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","img/close.png")}function b(){a.css("pointer-events","visible"),f.removeClass("open"),u.removeClass("closed"),c.attr("src","img/menu-icon.png")}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()}),m.bind("touchy-swipe",function(e,n,r,i){(i.direction="left")&&t.nextPage(),(i.direction="right")&&t.prevPage()});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}});
|
4
dist/render.min.js
vendored
4
dist/render.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/workers/loader_filesystem.js
vendored
Normal file
2
dist/workers/loader_filesystem.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/*! FuturePress - v0.1.0 - 2013-03-27 */
|
||||||
|
;
|
|
@ -1,7 +1,7 @@
|
||||||
FP.Hooks.register("beforeChapterDisplay").endnotes = function(callback, chapter){
|
FP.Hooks.register("beforeChapterDisplay").endnotes = function(callback, chapter){
|
||||||
|
|
||||||
var notes = chapter.doc.querySelectorAll('a[href]'),
|
var notes = chapter.doc.querySelectorAll('a[href]'),
|
||||||
items = Array.prototype.slice.call(notes),
|
items = Array.prototype.slice.call(notes), //[].slice.call()
|
||||||
attr = "epub:type",
|
attr = "epub:type",
|
||||||
type = "noteref",
|
type = "noteref",
|
||||||
popups = {};
|
popups = {};
|
||||||
|
@ -73,19 +73,20 @@ FP.Hooks.register("beforeChapterDisplay").endnotes = function(callback, chapter)
|
||||||
|
|
||||||
//-- get location of item
|
//-- get location of item
|
||||||
itemRect = item.getBoundingClientRect();
|
itemRect = item.getBoundingClientRect();
|
||||||
left = pos.left;
|
left = itemRect.left;
|
||||||
top = pos.top;
|
top = itemRect.top;
|
||||||
|
|
||||||
//-- show the popup
|
//-- show the popup
|
||||||
pop.classList.add("show");
|
pop.classList.add("show");
|
||||||
|
|
||||||
//-- position the popup
|
|
||||||
pop.style.left = left - itemRect.width / 2 + "px";
|
|
||||||
pop.style.top = top + "px";
|
|
||||||
|
|
||||||
//-- checking to keep within current column
|
//-- locations of popup
|
||||||
popRect = pop.getBoundingClientRect();
|
popRect = pop.getBoundingClientRect();
|
||||||
|
|
||||||
|
//-- position the popup
|
||||||
|
pop.style.left = left - popRect.width / 2 + "px";
|
||||||
|
pop.style.top = top + "px";
|
||||||
|
|
||||||
|
|
||||||
//-- Adjust max height
|
//-- Adjust max height
|
||||||
if(maxHeight > iheight / 2.5) {
|
if(maxHeight > iheight / 2.5) {
|
||||||
maxHeight = iheight / 2.5;
|
maxHeight = iheight / 2.5;
|
||||||
|
@ -93,7 +94,7 @@ FP.Hooks.register("beforeChapterDisplay").endnotes = function(callback, chapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-- switch above / below
|
//-- switch above / below
|
||||||
if(poppos.height + top >= iheight - 25) {
|
if(popRect.height + top >= iheight - 25) {
|
||||||
pop.style.top = top - popRect.height + "px";
|
pop.style.top = top - popRect.height + "px";
|
||||||
pop.classList.add("above");
|
pop.classList.add("above");
|
||||||
}else{
|
}else{
|
||||||
|
|
23
fpjs/hooks/extras/example.js
Normal file
23
fpjs/hooks/extras/example.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FP.Hooks.register("beforeChapterDisplay").example = function(callback, chapter){
|
||||||
|
|
||||||
|
FP.core.addCss("css/annotator.css", false, chapter.doc.head);
|
||||||
|
|
||||||
|
FP.core.addScript(FP.filePath + "libs/annotator-full.js", function() {
|
||||||
|
|
||||||
|
//-- Config script
|
||||||
|
var s = document.createElement("script");
|
||||||
|
s.type = 'text/javascript';
|
||||||
|
|
||||||
|
a = "var content = $('body').annotator().annotator('setupPlugins', {}, {Filter:false});";
|
||||||
|
|
||||||
|
s.innerHTML = a;
|
||||||
|
chapter.doc.body.appendChild(s);
|
||||||
|
|
||||||
|
//-- Continue to other hooks
|
||||||
|
if(callback) callback();
|
||||||
|
|
||||||
|
}, chapter.doc.head);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,9 +136,29 @@ FP.Chapter.prototype.formatSpread = function(){
|
||||||
//-- Go to current page after resize
|
//-- Go to current page after resize
|
||||||
if(this.OldcolWidth){
|
if(this.OldcolWidth){
|
||||||
this.setLeft((this.chapterPos - 1 ) * this.spreadWidth);
|
this.setLeft((this.chapterPos - 1 ) * this.spreadWidth);
|
||||||
|
this.fixedLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FP.Chapter.prototype.fixedLayout = function(){
|
||||||
|
this.paginated = false;
|
||||||
|
console.log("off")
|
||||||
|
this.setLeft(0);
|
||||||
|
|
||||||
|
this.bodyEl.style.width = this.elWidth;
|
||||||
|
|
||||||
|
//-- Adjust height
|
||||||
|
this.bodyEl.style.height = "auto";
|
||||||
|
|
||||||
|
//-- Remove columns
|
||||||
|
this.bodyEl.style[FP.core.columnWidth] = "auto";
|
||||||
|
|
||||||
|
//-- Scroll
|
||||||
|
this.bodyEl.style.overflow = "auto";
|
||||||
|
|
||||||
|
this.displayedPages = 1;
|
||||||
|
}
|
||||||
|
|
||||||
FP.Chapter.prototype.goToChapterEnd = function(){
|
FP.Chapter.prototype.goToChapterEnd = function(){
|
||||||
this.chapterEnd();
|
this.chapterEnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ FP.core.dataURLToBlob = function(dataURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-- Load scripts async: http://stackoverflow.com/questions/7718935/load-scripts-asynchronously
|
//-- Load scripts async: http://stackoverflow.com/questions/7718935/load-scripts-asynchronously
|
||||||
FP.core.loadScript = function(src, callback, target) {
|
FP.core.addScript = function(src, callback, target) {
|
||||||
var s, r;
|
var s, r;
|
||||||
r = false;
|
r = false;
|
||||||
s = document.createElement('script');
|
s = document.createElement('script');
|
||||||
|
@ -184,7 +184,7 @@ FP.core.loadScript = function(src, callback, target) {
|
||||||
target.appendChild(s);
|
target.appendChild(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
FP.core.loadScripts = function(srcArr, callback, target) {
|
FP.core.addScripts = function(srcArr, callback, target) {
|
||||||
var total = srcArr.length,
|
var total = srcArr.length,
|
||||||
curr = 0,
|
curr = 0,
|
||||||
cb = function(){
|
cb = function(){
|
||||||
|
@ -199,7 +199,7 @@ FP.core.loadScript = function(src, callback, target) {
|
||||||
// srcArr.forEach(function(src){
|
// srcArr.forEach(function(src){
|
||||||
// FP.core.loadScript(src, cb, target);
|
// FP.core.loadScript(src, cb, target);
|
||||||
// });
|
// });
|
||||||
FP.core.loadScript(srcArr[curr], cb, target);
|
FP.core.addScript(srcArr[curr], cb, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue