diff --git a/annotator.html b/annotator.html
index bf304a8..9cef62e 100755
--- a/annotator.html
+++ b/annotator.html
@@ -7,18 +7,14 @@
-
+
-
-
-
-
-
+
-
+
-
-
-
-
-
-
+
+
-
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -89,10 +86,11 @@
–
+
‹
›
-
+
diff --git a/dist/.DS_Store b/dist/.DS_Store
index 340701b..6754093 100644
Binary files a/dist/.DS_Store and b/dist/.DS_Store differ
diff --git a/dist/hooks/hooks.min.js b/dist/hooks/hooks.min.js
index 762d464..0272970 100644
--- a/dist/hooks/hooks.min.js
+++ b/dist/hooks/hooks.min.js
@@ -1,2 +1,2 @@
-/*! FuturePress - v0.1.0 - 2013-03-28 */
-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?st.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()};
\ No newline at end of file
+/*! 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,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?st.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()};
\ No newline at end of file
diff --git a/dist/reader.min.js b/dist/reader.min.js
index 5fd8236..2e1734e 100644
--- a/dist/reader.min.js
+++ b/dist/reader.min.js
@@ -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("");var i=e(" "),s=e("Extra Small Small Medium Large Extra Large ");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(""),i=n==1?"chapter":"section";return t.forEach(function(t){var s,o=e(""),u=e(""+t.label+" ");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}});
\ No newline at end of file
diff --git a/dist/render.min.js b/dist/render.min.js
index 6b5317d..f7f18b4 100644
--- a/dist/render.min.js
+++ b/dist/render.min.js
@@ -1,2 +1,2 @@
-/*! FuturePress - v0.1.0 - 2013-03-28 */
-var FP=FP||{};FP.VERSION="0.1.5",FP.plugins=FP.plugins||{},FP.filePath=FP.filePath||"/fpjs/",FP.Book=function(e,t){typeof e=="string"?this.el=FP.core.getEl(e):this.el=e,this.events=new FP.Events(this,this.el),this.createEvent("book:tocReady"),this.createEvent("book:metadataReady"),this.createEvent("book:spineReady"),this.createEvent("book:bookReady"),this.createEvent("book:chapterReady"),this.createEvent("book:chapterDisplayed"),this.createEvent("book:chapterDestroy"),this.createEvent("book:resized"),this.createEvent("book:stored"),this.createEvent("book:online"),this.createEvent("book:offline"),this.createEvent("book:pageChanged"),this.hooks={beforeChapterDisplay:[]},this.getHooks(),this.useHash=!0,this.initialize(this.el),this.online=navigator.onLine,this.listeners(),FP.storage=new fileStorage.storage(FP.storageOverride),t&&this.display(t)},FP.Book.prototype.initialize=function(e){this.iframe=document.createElement("iframe"),this.resizeIframe(!1,this.el.clientWidth,this.el.clientHeight),this.listen("book:resized",this.resizeIframe,this),this.el.appendChild(this.iframe)},FP.Book.prototype.listeners=function(){var e=this;window.addEventListener("resize",e.onResized.bind(this),!1),window.addEventListener("offline",function(t){e.online=!1,e.tell("book:offline")},!1),window.addEventListener("online",function(t){e.online=!0,e.tell("book:online")},!1),window.addEventListener("hashchange",e.route.bind(this),!1)},FP.Book.prototype.start=function(e){var t=window.location,n=t.pathname,r=e.search("://")!=-1,i=n[0]=="/",s=[],o="/",u,a;e[e.length-1]!="/"&&(e+="/");if(this.isContained(e)){this.bookPath=e,this.bookUrl="",this.contained=!0,this.tell("book:offline"),this.online&&this.unarchive(e);return}this.bookPath=e,u=t.origin||t.protocol+"//"+t.host,r&&(this.bookUrl=e),!r&&i&&(this.bookUrl=u+"/"+e),!r&&!i&&(n.split("/").forEach(function(e){e.indexOf(".")==-1&&s.push(e)}),o=s.join("/")+"/",this.bookUrl=u+o+e);if(!this.isSaved()){if(!this.online){console.error("Not Online");return}this.parseContainer()}else this.tell("book:tocReady"),this.tell("book:metadataReady"),this.tell("book:spineReady"),this.startDisplay()},FP.Book.prototype.unarchive=function(e){var t;this.isSaved()?(this.tell("book:tocReady"),this.tell("book:metadataReady"),this.tell("book:spineReady"),this.startDisplay()):t=new FP.Unarchiver(e,function(){FP.storage.get("META-INF/container.xml",function(e){this.parseContainer(e)}.bind(this))}.bind(this))},FP.Book.prototype.isSaved=function(e){return localStorage.getItem("bookPath")!=this.bookPath||localStorage.getItem("fpjs-version")!=FP.VERSION||e==1?(localStorage.setItem("fpjs-version",FP.VERSION),localStorage.setItem("bookPath",this.bookPath),localStorage.setItem("stored",0),localStorage.setItem("spinePos",0),localStorage.setItem("chapterPos",0),localStorage.setItem("displayedPages",0),this.spinePos=0,this.stored=0,!1):(this.spinePos=parseInt(localStorage.getItem("spinePos"))||0,this.stored=parseInt(localStorage.getItem("stored"))||0,this.basePath=localStorage.getItem("basePath"),this.contentsPath=localStorage.getItem("contentsPath"),this.metadata=JSON.parse(localStorage.getItem("metadata")),this.assets=JSON.parse(localStorage.getItem("assets")),this.spine=JSON.parse(localStorage.getItem("spine")),this.spineIndexByURL=JSON.parse(localStorage.getItem("spineIndexByURL")),this.toc=JSON.parse(localStorage.getItem("toc")),this.prevChapterPos=parseInt(localStorage.getItem("chapterPos")),this.prevDisplayedPages=parseInt(localStorage.getItem("displayedPages")),!this.assets||!this.spine||!this.spineIndexByURL||!this.toc?(this.stored=0,!1):!0)},FP.Book.prototype.isContained=function(e){var t=/\.[0-9a-z]+$/i,n=t.exec(e);return!n||n[0]!=".epub"&&n[0]!=".zip"?!1:!0},FP.Book.prototype.onResized=function(){this.tell("book:resized",{width:this.el.clientWidth,height:this.el.clientHeight})},FP.Book.prototype.resizeIframe=function(e,t,n){var r,i;e?(r=e.msg.width,i=e.msg.height):(r=t,i=n),this.iframe.height=i,r%2!=0&&(r+=1),this.iframe.width=r},FP.Book.prototype.parseContainer=function(e){var t=this,n=e||this.bookUrl+"META-INF/container.xml";FP.core.loadXML(n,function(e){var n;rootfile=e.querySelector("rootfile"),n=rootfile.getAttribute("full-path").split("/"),n[1]?(t.basePath=t.bookUrl+n[0]+"/",t.contentsPath=t.basePath+n[1]):(t.basePath=t.bookUrl,t.contentsPath=t.bookUrl+n),t.contained&&(t.basePath=n[0]+"/"),localStorage.setItem("basePath",t.basePath),localStorage.setItem("contentsPath",t.contentsPath),t.contained?FP.storage.get(t.contentsPath,function(e){t.parseContents(e)}):t.parseContents()})},FP.Book.prototype.parseContents=function(e){var t=this,n=e||this.contentsPath;FP.core.loadXML(n,function(e){var n=e.querySelector("metadata"),r=e.querySelector("manifest"),i=e.querySelector("spine");t.parseMetadata(n),t.parseManifest(r),t.parseSpine(i),t.startDisplay()})},FP.Book.prototype.parseMetadata=function(e){var t=this,n=e.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/","title")[0];creator=e.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/","creator")[0],this.metadata={},this.metadata.bookTitle=n?n.childNodes[0].nodeValue:"",this.metadata.creator=creator?creator.childNodes[0].nodeValue:"",localStorage.setItem("metadata",JSON.stringify(this.metadata)),this.tell("book:metadataReady")},FP.Book.prototype.parseManifest=function(e){var t=this;this.assets={},items=Array.prototype.slice.call(e.querySelectorAll("item")),items.forEach(function(e){var n=e.getAttribute("id"),r=e.getAttribute("href");t.assets[n]=t.basePath+r,e.getAttribute("media-type")=="application/x-dtbncx+xml"&&(t.contained?FP.storage.get(t.basePath+r,function(e){t.parseTOC(e)}):t.parseTOC(t.basePath+r))}),localStorage.setItem("assets",JSON.stringify(this.assets))},FP.Book.prototype.parseSpine=function(e){var t=this;this.spine=[],this.spineIndexByID={},this.spineIndexByURL={},items=Array.prototype.slice.call(e.getElementsByTagName("itemref")),items.forEach(function(e,n){var r=e.getAttribute("idref"),i=t.assets[r];t.spine.push({id:r,href:i}),t.spineIndexByID[r]=n,t.spineIndexByURL[i]=n}),localStorage.setItem("spine",JSON.stringify(this.spine)),localStorage.setItem("spineIndexByURL",JSON.stringify(this.spineIndexByURL)),this.tell("book:spineReady")},FP.Book.prototype.parseTOC=function(e){var t=this,n=e;this.toc=[],FP.core.loadXML(n,function(e){function s(e,t){var n=[];return items=Array.prototype.slice.call(e),items.forEach(function(e){var r=e.getAttribute("id"),i=e.querySelector("content"),o=i.getAttribute("src"),u=o.split("#"),a=e.querySelector("navLabel"),f=a.textContent?a.textContent:"",l=e.querySelectorAll("navPoint")||!1,c=!1,h=e.parentNode==t;if(!h)return;l&&(c=s(l,e)),n.push({id:r,href:o,label:f,subitems:c||!1})}),n}var n=e.querySelector("navMap"),r=e.querySelector("meta[name='cover']"),i;r&&(i=r.getAttribute("content"),t.toc.push({id:i,href:t.assets[i],label:i})),t.toc=t.toc.concat(s(n.querySelectorAll("navPoint"),n)),localStorage.setItem("toc",JSON.stringify(t.toc)),t.tell("book:tocReady")})},FP.Book.prototype.destroy=function(){window.removeEventListener("resize",this.onResized,!1)},FP.Book.prototype.getTitle=function(){return this.metadata.bookTitle},FP.Book.prototype.getCreator=function(){return this.metadata.creator},FP.Book.prototype.chapterTitle=function(){return this.spine[this.spinePos].id},FP.Book.prototype.startDisplay=function(e){var t,n=this.spinePos,r=function(e){this.prevChapterPos&&n==e.pos&&this.prevDisplayedPages==e.displayedPages&&e.page(this.prevChapterPos),this.online&&!this.contained&&this.storeOffline()}.bind(this);this.tell("book:bookReady"),this.useHash&&(t=this.route(!1,r)),(!this.useHash||!t)&&this.displayChapter(this.spinePos,r)},FP.Book.prototype.show=function(e,t){var n=e.split("#"),r=n[0],i=n[1]||!1,s=r.search("://")==-1?this.basePath+r:r,o=this.spineIndexByURL[s];r||(o=this.spinePos);if(typeof o!="number")return!1;o!=this.spinePos||!this.currentChapter?this.displayChapter(o,function(e){i&&e.section(i),t&&t(e)}):(i&&this.currentChapter.section(i),t&&t(this.currentChapter))},FP.Book.prototype.displayChapter=function(e,t){var n=this;if(e>=this.spine.length)return console.log("Reached End of Book"),!1;if(e<0)return console.log("Reached Start of Book"),!1;localStorage.setItem("spinePos",e),this.spinePos=e,this.currentChapter&&this.tell("book:chapterDestroy",this.currentChapter.getID()),this.currentChapter=new FP.Chapter(this),this.currentChapter.afterLoaded=function(e){n.tell("book:chapterReady",e.getID()),t&&t(e)}},FP.Book.prototype.nextPage=function(){var e=this.currentChapter.nextPage();e||this.nextChapter()},FP.Book.prototype.prevPage=function(){var e=this.currentChapter.prevPage();e||this.prevChapter()},FP.Book.prototype.nextChapter=function(){this.spinePos++,this.displayChapter(this.spinePos)},FP.Book.prototype.prevChapter=function(){this.spinePos--,this.displayChapter(this.spinePos,function(e){e.goToChapterEnd()})},FP.Book.prototype.getTOC=function(){return this.toc},FP.Book.prototype.storeOffline=function(e){var t=FP.core.toArray(this.assets);FP.storage.batch(t,function(){this.stored=1,localStorage.setItem("stored",1),this.tell("book:stored"),e&&e()}.bind(this))},FP.Book.prototype.availableOffline=function(){return this.stored>0?!0:!1},FP.Book.prototype.fromStorage=function(e){if(this.contained)return;e?this.availableOffline?(this.online=!1,this.tell("book:offline")):this.storeOffline(function(){this.online=!1,this.tell("book:offline")}.bind(this)):(this.online=!0,this.tell("book:online"))},FP.Book.prototype.route=function(e,t){var n=window.location.hash.replace("#/","");return this.useHash&&n.length&&n!=this.prevLocation?(this.show(n,t),this.prevLocation=n,!0):!1},FP.Book.prototype.hideHashChanges=function(){this.useHash=!1},FP.Book.prototype.getHooks=function(){var e=this;plugTypes=FP.core.toArray(this.hooks),plugTypes.forEach(function(t){var n=t.ident;plugs=FP.core.toArray(FP.Hooks[n]),plugs.forEach(function(t){e.registerHook(n,t)})})},FP.Book.prototype.registerHook=function(e,t){var n=this;typeof this.hooks[e]!="undefined"?typeof t=="function"?this.hooks[e].push(t):Array.isArray(t)&&t.forEach(function(t){n.hooks[e].push(t)}):this.hooks[e]=[func]},FP.Book.prototype.triggerHooks=function(e,t,n){function s(){i--,i<=0&&t&&t()}var r,i;if(typeof this.hooks[e]=="undefined")return!1;r=this.hooks[e],i=r.length,r.forEach(function(e){e(s,n)})},FP.Chapter=function(e,t){return this.book=e,this.iframe=this.book.iframe,this.pos=t||this.book.spinePos,this.chapInfo=this.book.spine[this.pos],this.path=this.chapInfo.href,this.ID=this.chapInfo.id,this.chapterPos=1,this.leftPos=0,localStorage.setItem("chapterPos",this.chapterPos),this.book.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this)]),this.load(),this},FP.Chapter.prototype.load=function(){var e=this.path;this.book.online&&!this.book.contained?this.setIframeSrc(e):this.loadFromStorage(e)},FP.Chapter.prototype.loadFromStorage=function(e){var t=FP.storage.get(e,this.setIframeSrc.bind(this))},FP.Chapter.prototype.setIframeSrc=function(e){var t=this;this.visible(!1),this.iframe.src=e,this.iframe.onload=function(){t.doc=t.iframe.contentDocument,t.bodyEl=t.doc.body,t.formatSpread(),t.beforeDisplay(function(){t.calcPages(),t.book.tell("book:chapterDisplayed"),t.visible(!0)}),t.afterLoaded(t),t.book.listen("book:resized",t.formatSpread,t)}},FP.Chapter.prototype.afterLoaded=function(e){},FP.Chapter.prototype.error=function(e){console.log("error",error)},FP.Chapter.prototype.formatSpread=function(){var e=2,t=800;this.colWidth&&(this.OldcolWidth=this.colWidth,this.OldspreadWidth=this.spreadWidth),this.elWidth=this.iframe.width,this.gap=this.gap||Math.ceil(this.elWidth/8),this.elWidth1?(this.chapterPos--,this.leftPos-=this.spreadWidth,this.setLeft(this.leftPos),localStorage.setItem("chapterPos",this.chapterPos),this.book.tell("book:pageChanged",this.chapterPos),this.chapterPos):!1},FP.Chapter.prototype.chapterEnd=function(){this.page(this.displayedPages)},FP.Chapter.prototype.setLeft=function(e){this.bodyEl.style.marginLeft=-e+"px"},FP.Chapter.prototype.replaceLinks=function(e){var t=this.doc.querySelectorAll("[href]"),n=Array.prototype.slice.call(t),r=this;n.forEach(function(e){var t,n=e.getAttribute("href"),i=n.search("://"),s=n[0]=="#";i!=-1?e.setAttribute("target","_blank"):e.onclick=function(){r.book.useHash?window.location.hash="#/"+n:r.book.show(n)}}),e&&e()},FP.Chapter.prototype.replaceResources=function(e){var t,n,r;if(this.book.online&&!this.book.contained||FP.storage.getStorageType()=="filesystem")return e&&e(),!1;t=this.doc.querySelectorAll("[src]"),n=Array.prototype.slice.call(t),r=n.length,n.forEach(function(t){var n=t.getAttribute("src"),i=this.book.basePath+n;FP.storage.get(i,function(n){t.setAttribute("src",n),r--,r<=0&&e&&e()})}.bind(this))},FP.Chapter.prototype.getID=function(){return this.ID},FP.Chapter.prototype.page=function(e){return e>=1&&e<=this.displayedPages?(this.chapterPos=e,this.leftPos=this.spreadWidth*(e-1),this.setLeft(this.leftPos),localStorage.setItem("chapterPos",e),!0):!1},FP.Chapter.prototype.section=function(e){var t=this.doc.getElementById(e),n,r;t&&(n=this.leftPos+t.getBoundingClientRect().left,r=Math.floor(n/this.spreadWidth)+1,this.page(r))},FP.Chapter.prototype.beforeDisplay=function(e){this.book.triggerHooks("beforeChapterDisplay",e.bind(this),this)};var FP=FP||{};FP.core={},FP.core.getEl=function(e){return document.getElementById(e)},FP.core.getEls=function(e){return document.getElementsByClassName(e)},FP.core.loadXML=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.overrideMimeType("text/xml"),n.onload=function(e){this.status==200&&t(this.responseXML)},n.send()},FP.core.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}},FP.core.crossBrowserColumnCss=function(){var e=function(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")};FP.core.columnAxis=Modernizr.prefixed("columnAxis")||"columnAxis",FP.core.columnGap=Modernizr.prefixed("columnGap")||"columnGap",FP.core.columnWidth=Modernizr.prefixed("columnWidth")||"columnWidth"},FP.core.toArray=function(e){var t=[];for(member in e){var n;e.hasOwnProperty(member)&&(n=e[member],n.ident=member,t.push(n))}return t},FP.core.dataURLToBlob=function(e){var t=";base64,";if(e.indexOf(t)==-1){var n=e.split(","),r=n[0].split(":")[1],i=n[1];return new Blob([i],{type:r})}var n=e.split(t),r=n[0].split(":")[1],i=window.atob(n[1]),s=i.length,o=new Uint8Array(s);for(var u=0;u=this.spine.length)return console.log("Reached End of Book"),!1;if(e<0)return console.log("Reached Start of Book"),!1;localStorage.setItem("spinePos",e),this.spinePos=e,this.currentChapter&&this.tell("book:chapterDestroy",this.currentChapter.getID()),this.currentChapter=new FP.Chapter(this),this.currentChapter.afterLoaded=function(e){n.tell("book:chapterReady",e.getID()),t&&t(e)}},FP.Book.prototype.nextPage=function(){var e=this.currentChapter.nextPage();e||this.nextChapter()},FP.Book.prototype.prevPage=function(){var e=this.currentChapter.prevPage();e||this.prevChapter()},FP.Book.prototype.nextChapter=function(){this.spinePos++,this.displayChapter(this.spinePos)},FP.Book.prototype.prevChapter=function(){this.spinePos--,this.displayChapter(this.spinePos,function(e){e.goToChapterEnd()})},FP.Book.prototype.getTOC=function(){return this.toc},FP.Book.prototype.storeOffline=function(e){var t=FP.core.toArray(this.assets);FP.storage.batch(t,function(){this.stored=1,localStorage.setItem("stored",1),this.tell("book:stored"),e&&e()}.bind(this))},FP.Book.prototype.availableOffline=function(){return this.stored>0?!0:!1},FP.Book.prototype.fromStorage=function(e){if(this.contained)return;e?this.availableOffline?(this.online=!1,this.tell("book:offline")):this.storeOffline(function(){this.online=!1,this.tell("book:offline")}.bind(this)):(this.online=!0,this.tell("book:online"))},FP.Book.prototype.route=function(e,t){var n=window.location.hash.replace("#/","");return this.useHash&&n.length&&n!=this.prevLocation?(this.show(n,t),this.prevLocation=n,!0):!1},FP.Book.prototype.hideHashChanges=function(){this.useHash=!1},FP.Book.prototype.getHooks=function(){var e=this;plugTypes=FP.core.toArray(this.hooks),plugTypes.forEach(function(t){var n=t.ident;plugs=FP.core.toArray(FP.Hooks[n]),plugs.forEach(function(t){e.registerHook(n,t)})})},FP.Book.prototype.registerHook=function(e,t){var n=this;typeof this.hooks[e]!="undefined"?typeof t=="function"?this.hooks[e].push(t):Array.isArray(t)&&t.forEach(function(t){n.hooks[e].push(t)}):this.hooks[e]=[func]},FP.Book.prototype.triggerHooks=function(e,t,n){function s(){i--,i<=0&&t&&t()}var r,i;if(typeof this.hooks[e]=="undefined")return!1;r=this.hooks[e],i=r.length,r.forEach(function(e){e(s,n)})},FP.Chapter=function(e,t){return this.book=e,this.iframe=this.book.iframe,this.pos=t||this.book.spinePos,this.chapInfo=this.book.spine[this.pos],this.path=this.chapInfo.href,this.ID=this.chapInfo.id,this.chapterPos=1,this.leftPos=0,localStorage.setItem("chapterPos",this.chapterPos),this.book.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this)]),this.load(),this},FP.Chapter.prototype.load=function(){var e=this.path;this.book.online&&!this.book.contained?this.setIframeSrc(e):this.loadFromStorage(e)},FP.Chapter.prototype.loadFromStorage=function(e){var t=FP.storage.get(e,this.setIframeSrc.bind(this))},FP.Chapter.prototype.setIframeSrc=function(e){var t=this;this.visible(!1),this.iframe.src=e,this.iframe.onload=function(){t.doc=t.iframe.contentDocument,t.bodyEl=t.doc.body,t.formatSpread(),t.beforeDisplay(function(){t.calcPages(),t.book.tell("book:chapterDisplayed"),t.visible(!0)}),t.afterLoaded(t),t.book.listen("book:resized",t.formatSpread,t)}},FP.Chapter.prototype.afterLoaded=function(e){},FP.Chapter.prototype.error=function(e){console.log("error",error)},FP.Chapter.prototype.formatSpread=function(){var e=2,t=800;this.colWidth&&(this.OldcolWidth=this.colWidth,this.OldspreadWidth=this.spreadWidth),this.elWidth=this.iframe.width,this.gap=this.gap||Math.ceil(this.elWidth/8),this.elWidth1?(this.chapterPos--,this.leftPos-=this.spreadWidth,this.setLeft(this.leftPos),localStorage.setItem("chapterPos",this.chapterPos),this.book.tell("book:pageChanged",this.chapterPos),this.chapterPos):!1},FP.Chapter.prototype.chapterEnd=function(){this.page(this.displayedPages)},FP.Chapter.prototype.setLeft=function(e){this.bodyEl.style.marginLeft=-e+"px"},FP.Chapter.prototype.replaceLinks=function(e){var t=this.doc.querySelectorAll("[href]"),n=Array.prototype.slice.call(t),r=this;n.forEach(function(e){var t,n=e.getAttribute("href"),i=n.search("://"),s=n[0]=="#";i!=-1?e.setAttribute("target","_blank"):e.onclick=function(){r.book.useHash?window.location.hash="#/"+n:r.book.show(n)}}),e&&e()},FP.Chapter.prototype.replaceResources=function(e){var t,n,r;if(this.book.online&&!this.book.contained||FP.storage.getStorageType()=="filesystem")return e&&e(),!1;t=this.doc.querySelectorAll("[src]"),n=Array.prototype.slice.call(t),r=n.length,n.forEach(function(t){var n=t.getAttribute("src"),i=this.book.basePath+n;FP.storage.get(i,function(n){t.setAttribute("src",n),r--,r<=0&&e&&e()})}.bind(this))},FP.Chapter.prototype.getID=function(){return this.ID},FP.Chapter.prototype.page=function(e){return e>=1&&e<=this.displayedPages?(this.chapterPos=e,this.leftPos=this.spreadWidth*(e-1),this.setLeft(this.leftPos),localStorage.setItem("chapterPos",e),!0):!1},FP.Chapter.prototype.section=function(e){var t=this.doc.getElementById(e),n,r;t&&(n=this.leftPos+t.getBoundingClientRect().left,r=Math.floor(n/this.spreadWidth)+1,this.page(r))},FP.Chapter.prototype.beforeDisplay=function(e){this.book.triggerHooks("beforeChapterDisplay",e.bind(this),this)};var FP=FP||{};FP.core={},FP.core.getEl=function(e){return document.getElementById(e)},FP.core.getEls=function(e){return document.getElementsByClassName(e)},FP.core.loadXML=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.overrideMimeType("text/xml"),n.onload=function(e){this.status==200&&t(this.responseXML)},n.send()},FP.core.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}},FP.core.crossBrowserColumnCss=function(){var e=function(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")};FP.core.columnAxis=Modernizr.prefixed("columnAxis")||"columnAxis",FP.core.columnGap=Modernizr.prefixed("columnGap")||"columnGap",FP.core.columnWidth=Modernizr.prefixed("columnWidth")||"columnWidth"},FP.core.toArray=function(e){var t=[];for(member in e){var n;e.hasOwnProperty(member)&&(n=e[member],n.ident=member,t.push(n))}return t},FP.core.dataURLToBlob=function(e){var t=";base64,";if(e.indexOf(t)==-1){var n=e.split(","),r=n[0].split(":")[1],i=n[1];return new Blob([i],{type:r})}var n=e.split(t),r=n[0].split(":")[1],i=window.atob(n[1]),s=i.length,o=new Uint8Array(s);for(var u=0;u iheight / 2.5) {
maxHeight = iheight / 2.5;
@@ -93,7 +94,7 @@ FP.Hooks.register("beforeChapterDisplay").endnotes = function(callback, chapter)
}
//-- switch above / below
- if(poppos.height + top >= iheight - 25) {
+ if(popRect.height + top >= iheight - 25) {
pop.style.top = top - popRect.height + "px";
pop.classList.add("above");
}else{
diff --git a/fpjs/hooks/extras/example.js b/fpjs/hooks/extras/example.js
new file mode 100644
index 0000000..ace6c5a
--- /dev/null
+++ b/fpjs/hooks/extras/example.js
@@ -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);
+
+}
+
+
diff --git a/fpjs/render/chapter.js b/fpjs/render/chapter.js
index 811ff59..0da93bd 100644
--- a/fpjs/render/chapter.js
+++ b/fpjs/render/chapter.js
@@ -136,9 +136,29 @@ FP.Chapter.prototype.formatSpread = function(){
//-- Go to current page after resize
if(this.OldcolWidth){
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(){
this.chapterEnd();
}
diff --git a/fpjs/render/core.js b/fpjs/render/core.js
index e2ffb86..8f0063f 100644
--- a/fpjs/render/core.js
+++ b/fpjs/render/core.js
@@ -165,7 +165,7 @@ FP.core.dataURLToBlob = function(dataURL) {
}
//-- 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;
r = false;
s = document.createElement('script');
@@ -184,7 +184,7 @@ FP.core.loadScript = function(src, callback, target) {
target.appendChild(s);
}
- FP.core.loadScripts = function(srcArr, callback, target) {
+ FP.core.addScripts = function(srcArr, callback, target) {
var total = srcArr.length,
curr = 0,
cb = function(){
@@ -199,7 +199,7 @@ FP.core.loadScript = function(src, callback, target) {
// srcArr.forEach(function(src){
// FP.core.loadScript(src, cb, target);
// });
- FP.core.loadScript(srcArr[curr], cb, target);
+ FP.core.addScript(srcArr[curr], cb, target);
}