diff --git a/build/epub.js b/build/epub.js index be62fc3..7ca5101 100644 --- a/build/epub.js +++ b/build/epub.js @@ -1055,7 +1055,8 @@ EPUBJS.EpubCFI = function(cfiStr){ EPUBJS.EpubCFI.prototype.generateChapter = function(spineNodeIndex, pos, id) { - var spineNodeIndex = spineNodeIndex + 1, + var pos = parseInt(pos), + spineNodeIndex = spineNodeIndex + 1, cfi = '/'+spineNodeIndex+'/'; cfi += (pos + 1) * 2; @@ -1739,8 +1740,8 @@ EPUBJS.Renderer.prototype.setIframeSrc = function(url){ renderer.currentLocationCfi = renderer.getPageCfi(); - renderer.trigger("renderer:chapterDisplayed"); - renderer.book.trigger("renderer:chapterDisplayed"); + renderer.trigger("renderer:chapterDisplayed", renderer.currentChapter); + renderer.book.trigger("renderer:chapterDisplayed", renderer.currentChapter); renderer.visible(true); @@ -1795,7 +1796,7 @@ EPUBJS.Renderer.prototype.formatSpread = function(){ this.spreadWidth = (this.colWidth + this.gap) * divisor; - if(this.bodyEl) this.bodyEl.style.margin = 0; + // if(this.bodyEl) this.bodyEl.style.margin = 0; // this.bodyEl.style.fontSize = localStorage.getItem("fontSize") || "medium"; //-- Clear Margins diff --git a/build/epub.min.js b/build/epub.min.js index a6ae7e8..6d40c85 100644 --- a/build/epub.min.js +++ b/build/epub.min.js @@ -1,2 +1,2 @@ -!function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?(this._wrapped=a,void 0):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.4.4";var y=x.each=x.forEach=function(a,b,d){if(null!=a)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?null:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;d.computed>g&&(d={value:a,computed:g})}),d.value},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return x.isFunction(a)?a:function(b){return b[a]}};x.sortBy=function(a,b,c){var d=B(b);return x.pluck(x.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;e>c.call(d,a[h])?f=h+1:g=h}return f},x.toArray=function(a){return a?x.isArray(a)?h.call(a):a.length===+a.length?x.map(a,x.identity):x.values(a):[]},x.size=function(a){return null==a?0:a.length===+a.length?a.length:x.keys(a).length},x.first=x.head=x.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return y(a,function(a){x.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(i.apply(d,arguments))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.indexOf(b,a)>=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=h.call(arguments),b=x.max(x.pluck(a,"length")),c=Array(b),d=0;b>d;d++)c[d]=x.pluck(a,""+d);return c},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);d>e;)f[e++]=a,a+=c;return f},x.bind=function(a,b){if(a.bind===w&&w)return w.apply(a,h.call(arguments,1));var c=h.call(arguments,2);return function(){return a.apply(b,c.concat(h.call(arguments)))}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);return 0===b.length&&(b=x.functions(a)),y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},x.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&(b[b.length]=c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var E=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==b+"";case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=E(a[g],b[g],c,d)););}else{var i=a.constructor,k=b.constructor;if(i!==k&&!(x.isFunction(i)&&i instanceof i&&x.isFunction(k)&&k instanceof k))return!1;for(var l in a)if(x.has(a,l)&&(g++,!(h=x.has(b,l)&&E(a[l],b[l],c,d))))break;if(h){for(l in b)if(x.has(b,l)&&!g--)break;h=!g}}return c.pop(),d.pop(),h};x.isEqual=function(a,b){return E(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};F.unescape=x.invert(F.escape);var G={escape:RegExp("["+x.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(F.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(G[a],function(b){return F[a][b]})}}),x.result=function(a,b){if(null==a)return null;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),L.call(this,c.apply(x,a))}})};var H=0;x.uniqueId=function(a){var b=++H+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=RegExp([(c.escape||I).source,(c.interpolate||I).source,(c.evaluate||I).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(K,function(a){return"\\"+J[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var L=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],L.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return L.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){"use strict";function b(a,b){f.async(function(){a.trigger("promise:resolved",{detail:b}),a.isResolved=!0,a.resolvedValue=b})}function c(a,b){f.async(function(){a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedValue=b})}function d(a){var b,c=[],d=new p,e=a.length;0===e&&d.resolve([]);var f=function(a){return function(b){g(a,b)}},g=function(a,b){c[a]=b,0===--e&&d.resolve(c)},h=function(a){d.reject(a)};for(b=0;e>b;b++)a[b].then(f(b),h);return d}function e(a,b){f[a]=b}var f={},g="undefined"!=typeof window?window:{},h=g.MutationObserver||g.WebKitMutationObserver;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))f.async=function(a,b){process.nextTick(function(){a.call(b)})};else if(h){var i=[],j=new h(function(){var a=i.slice();i=[],a.forEach(function(a){var b=a[0],c=a[1];b.call(c)})}),k=document.createElement("div");j.observe(k,{attributes:!0}),window.addEventListener("unload",function(){j.disconnect(),j=null}),f.async=function(a,b){i.push([a,b]),k.setAttribute("drainQueue","drainQueue")}}else f.async=function(a,b){setTimeout(function(){a.call(b)},1)};var l=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},m=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},n=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},o={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,c){var d,e,f=n(this);for(a=a.split(/\s+/),c=c||this;e=a.shift();)d=f[e],d||(d=f[e]=[]),-1===m(d,b)&&d.push([b,c])},off:function(a,b){var c,d,e,f=n(this);for(a=a.split(/\s+/);d=a.shift();)b?(c=f[d],e=m(c,b),-1!==e&&c.splice(e,1)):f[d]=[]},trigger:function(a,b){var c,d,e,f,g,h=n(this);if(c=h[a])for(var i=0,j=c.length;j>i;i++)d=c[i],e=d[0],f=d[1],"object"!=typeof b&&(b={detail:b}),g=new l(a,b),e.call(f,g)}},p=function(){this.on("promise:resolved",function(a){this.trigger("success",{detail:a.detail})},this),this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this)},q=function(){},r=function(a,b,c,d){var e,f,g,h,i="function"==typeof c;if(i)try{e=c(d.detail),g=!0}catch(j){h=!0,f=j}else e=d.detail,g=!0;e&&"function"==typeof e.then?e.then(function(a){b.resolve(a)},function(a){b.reject(a)}):i&&g?b.resolve(e):h?b.reject(f):b[a](e)};p.prototype={then:function(a,b){var c=new p;return this.isResolved&&f.async(function(){r("resolve",c,a,{detail:this.resolvedValue})},this),this.isRejected&&f.async(function(){r("reject",c,b,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(b){r("resolve",c,a,b)}),this.on("promise:failed",function(a){r("reject",c,b,a)}),c},resolve:function(a){b(this,a),this.resolve=q,this.reject=q},reject:function(a){c(this,a),this.resolve=q,this.reject=q}},o.mixin(p.prototype),a.Promise=p,a.Event=l,a.EventTarget=o,a.all=d,a.configure=e}(window.RSVP={});var EPUBJS=EPUBJS||{};EPUBJS.VERSION="0.1.5",EPUBJS.plugins=EPUBJS.plugins||{},EPUBJS.filePath=EPUBJS.filePath||"/epubjs/",EPUBJS.Book=function(a,b){var c=this;this.settings=_.defaults(b||{},{storage:!1,fromStorage:!1,saved:!1,online:!0,contained:!1,width:!1,height:!1,spreads:!0,fixedLayout:!1,responsive:!0,version:1,restore:!1,reload:!1,styles:{}}),this.settings.EPUBJSVERSION=EPUBJS.VERSION,this.spinePos=0,this.stored=!1,this.hooks={beforeChapterDisplay:[]},this.getHooks(),this.online=this.settings.online||navigator.onLine,this.networkListeners(),0!=this.settings.storage&&(this.storage=new fileStorage.storage(this.settings.storage)),this.ready={manifest:new RSVP.Promise,spine:new RSVP.Promise,metadata:new RSVP.Promise,cover:new RSVP.Promise,toc:new RSVP.Promise},this.ready.all=RSVP.all(_.values(this.ready)),this.ready.all.then(function(){this.trigger("book:ready")}.bind(this)),a&&(this.opened=this.open(a)),window.addEventListener("beforeunload",function(){c.settings.restore&&(c.saveSettings(),c.saveContents()),c.trigger("book:unload")},!1)},EPUBJS.Book.prototype.open=function(a,b){var c,d=this,e=this.isSaved(a);return this.settings.bookPath=a,this.bookUrl=this.urlFrom(a),e&&!b&&this.applySavedSettings(),this.settings.contained||this.isContained(a)?(this.settings.contained=this.contained=!0,this.bookUrl="",c=this.unarchive(a).then(function(){return e&&d.settings.restore&&!b?d.restore():d.unpack()})):c=e&&this.settings.restore&&!b?this.restore():this.unpack(),this.online&&this.settings.storage&&!this.settings.contained&&(this.settings.stored||c.then(d.storeOffline())),c},EPUBJS.Book.prototype.unpack=function(a){var b=this,c=new EPUBJS.Parser,a=a||"META-INF/container.xml";return b.loadXml(b.bookUrl+a).then(function(a){return c.container(a)}).then(function(a){return b.settings.contentsPath=b.bookUrl+a.basePath,b.settings.packageUrl=b.bookUrl+a.packagePath,b.loadXml(b.settings.packageUrl)}).then(function(a){return c.package(a,b.settings.contentsPath)}).then(function(a){return b.contents=a,b.manifest=b.contents.manifest,b.spine=b.contents.spine,b.spineIndexByURL=b.contents.spineIndexByURL,b.metadata=b.contents.metadata,b.cover=b.contents.cover=b.settings.contentsPath+a.coverPath,b.spineNodeIndex=b.contents.spineNodeIndex=a.spineNodeIndex,b.ready.manifest.resolve(b.contents.manifest),b.ready.spine.resolve(b.contents.spine),b.ready.metadata.resolve(b.contents.metadata),b.ready.cover.resolve(b.contents.cover),b.settings.tocUrl=b.settings.contentsPath+a.tocPath,b.loadXml(b.settings.tocUrl)}).then(function(a){return c.toc(a)}).then(function(a){b.toc=b.contents.toc=a,b.ready.toc.resolve(b.contents.toc)}).then(null,function(a){console.error(a)})},EPUBJS.Book.prototype.getMetadata=function(){return this.ready.metadata},EPUBJS.Book.prototype.getToc=function(){return this.ready.toc},EPUBJS.Book.prototype.networkListeners=function(){var a=this;window.addEventListener("offline",function(){a.online=!1,a.trigger("book:offline")},!1),window.addEventListener("online",function(){a.online=!0,a.trigger("book:online")},!1)},EPUBJS.Book.prototype.loadXml=function(a){return this.settings.fromStorage?this.storage.getXml(a):this.settings.contained?this.zip.getXml(a):EPUBJS.core.request(a,"xml")},EPUBJS.Book.prototype.urlFrom=function(a){var b=-1!=a.search("://"),c="/"==a[0],d=window.location,e=d.origin||d.protocol+"//"+d.host;return b?a:!b&&c?e+a:b||c?void 0:e+EPUBJS.core.folder(d.pathname)+a},EPUBJS.Book.prototype.unarchive=function(a){return this.zip=new EPUBJS.Unarchiver,this.zip.openZip(a)},EPUBJS.Book.prototype.isContained=function(a){var b=a.lastIndexOf("."),c=a.slice(b+1);return!c||"epub"!=c&&"zip"!=c?!1:!0},EPUBJS.Book.prototype.isSaved=function(a){var b=a+":"+this.settings.version,c=localStorage.getItem(b);return localStorage&&null!==c?!0:!1},EPUBJS.Book.prototype.removeSavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;localStorage.removeItem(a),this.settings.stored=!1},EPUBJS.Book.prototype.applySavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;return stored=JSON.parse(localStorage.getItem(a)),EPUBJS.VERSION!=stored.EPUBJSVERSION?!1:(this.settings=_.defaults(this.settings,stored),void 0)},EPUBJS.Book.prototype.saveSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;this.render&&(this.settings.previousLocationCfi=this.render.currentLocationCfi),localStorage.setItem(a,JSON.stringify(this.settings))},EPUBJS.Book.prototype.saveContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.setItem(a,JSON.stringify(this.contents))},EPUBJS.Book.prototype.removeSavedContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.removeItem(a)},EPUBJS.Book.prototype.renderTo=function(a){var b=this;if(_.isElement(a))this.element=a;else{if("string"!=typeof a)return console.error("Not an Element"),void 0;this.element=EPUBJS.core.getEl(a)}return this.opened.then(function(){return b.render=new EPUBJS.Renderer(b),b.startDisplay()})},EPUBJS.Book.prototype.startDisplay=function(){var a;return a=this.settings.restore&&this.settings.previousLocationCfi?this.displayChapter(this.settings.previousLocationCfi):this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.restore=function(a){var b=this,c=this.settings.bookPath+":contents:"+this.settings.version,d=new RSVP.Promise,e=["manifest","spine","metadata","cover","toc","spineNodeIndex","spineIndexByURL"],a=a||!1,f=localStorage.getItem(c);return this.settings.clearSaved&&(a=!0),a||"undefined"==f||"null"==f||(this.contents=JSON.parse(f),e.forEach(function(c){b[c]=b.contents[c],b[c]||(a=!0)})),!a&&f&&this.contents&&this.settings.contentsPath?(this.ready.manifest.resolve(this.manifest),this.ready.spine.resolve(this.spine),this.ready.metadata.resolve(this.metadata),this.ready.cover.resolve(this.cover),this.ready.toc.resolve(this.toc),d.resolve(),d):this.open(this.settings.bookPath,!0)},EPUBJS.Book.prototype.displayChapter=function(a,b){var c,d,e,f=this;return _.isNumber(a)?e=a:(d=new EPUBJS.EpubCFI(a),e=d.spinePos),e>=this.spine.length?!1:0>e?!1:(this.spinePos=e,this.chapter=new EPUBJS.Chapter(this.spine[e]),c=f.render.chapter(this.chapter),d?c.then(function(b){b.currentLocationCfi=a,b.gotoCfiFragment(d)}):b&&c.then(function(a){a.gotoChapterEnd()}),this.settings.fromStorage||this.settings.contained||c.then(function(){f.preloadNextChapter()}),c)},EPUBJS.Book.prototype.nextPage=function(){var a=this.render.nextPage();return a?void 0:this.nextChapter()},EPUBJS.Book.prototype.prevPage=function(){var a=this.render.prevPage();return a?void 0:this.prevChapter()},EPUBJS.Book.prototype.nextChapter=function(){return this.spinePos++,this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.prevChapter=function(){return this.spinePos--,this.displayChapter(this.spinePos,!0)},EPUBJS.Book.prototype.goto=function(a){var b,c=a.split("#"),d=c[0],e=c[1]||!1,f=-1==d.search("://")?this.settings.contentsPath+d:d,g=this.spineIndexByURL[f];return d||(g=this.chapter.spinePos),"number"!=typeof g?!1:g==this.chapter.spinePos&&this.chapter?(e&&this.render.section(e),(new RSVP.Promise).resolve(this.currentChapter)):this.displayChapter(g).then(function(){e&&b.render.section(e)})},EPUBJS.Book.prototype.preloadNextChapter=function(){return document.createElement("iframe"),this.spinePos>=this.spine.length?!1:(next=new EPUBJS.Chapter(this.spine[this.spinePos+1]),EPUBJS.core.request(next.href),void 0)},EPUBJS.Book.prototype.storeOffline=function(){var a=this,b=_.values(this.manifest);return EPUBJS.storage.batch(b).then(function(){a.settings.stored=!0,a.trigger("book:stored")})},EPUBJS.Book.prototype.availableOffline=function(){return this.settings.stored>0?!0:!1},EPUBJS.Book.prototype.setStyle=function(a,b,c){this.render.setStyle(a,b,c),this.settings.styles[a]=b},EPUBJS.Book.prototype.removeStyle=function(a){this.render.removeStyle(a),delete this.settings.styles[a]},EPUBJS.Book.prototype.getHooks=function(){var a,b=this;plugTypes=_.values(this.hooks);for(plugType in this.hooks)a=_.values(EPUBJS.Hooks[plugType]),a.forEach(function(a){b.registerHook(plugType,a)})},EPUBJS.Book.prototype.registerHook=function(a,b,c){var d=this;"undefined"!=typeof this.hooks[a]?"function"==typeof b?c?this.hooks[a].unshift(b):this.hooks[a].push(b):Array.isArray(b)&&b.forEach(function(b){c?d.hooks[a].unshift(b):d.hooks[a].push(b)}):this.hooks[a]=[func]},EPUBJS.Book.prototype.triggerHooks=function(a,b,c){function d(){f--,0>=f&&b&&b()}var e,f;return"undefined"==typeof this.hooks[a]?!1:(e=this.hooks[a],f=e.length,e.forEach(function(a){a(d,c)}),void 0)},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),EPUBJS.Chapter=function(a){this.href=a.href,this.id=a.id,this.spinePos=a.index,this.properties=a.properties,this.linear=a.linear,this.pages=1},EPUBJS.Chapter.prototype.contents=function(a){return a?a.get(href):EPUBJS.core.request(href,"xml")},EPUBJS.Chapter.prototype.url=function(a){var b=new RSVP.Promise;return a?(this.tempUrl||(this.tempUrl=a.getUrl(this.href)),this.tempUrl):(b.resolve(this.href),b)},EPUBJS.Chapter.prototype.setPages=function(a){this.pages=a},EPUBJS.Chapter.prototype.getPages=function(){return this.pages},EPUBJS.Chapter.prototype.getID=function(){return this.ID},EPUBJS.Chapter.prototype.unload=function(a){this.tempUrl&&a&&(a.revokeUrl(this.tempUrl),this.tempUrl=!1)};var EPUBJS=EPUBJS||{};EPUBJS.core={},EPUBJS.core.getEl=function(a){return document.getElementById(a)},EPUBJS.core.getEls=function(a){return document.getElementsByClassName(a)},EPUBJS.core.request=function(a,b){function c(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var a;a="xml"==b?this.responseXML:"json"==b?JSON.parse(this.response):this.response,d.resolve(a)}else d.reject(this)}var d=new RSVP.Promise,e=new XMLHttpRequest;return e.open("GET",a),e.onreadystatechange=c,"blob"==b&&(e.responseType=b),"json"==b&&e.setRequestHeader("Accept","application/json"),"xml"==b&&e.overrideMimeType("text/xml"),e.send(),d},EPUBJS.core.toArray=function(a){var b=[];for(member in a){var c;a.hasOwnProperty(member)&&(c=a[member],c.ident=member,b.push(c))}return b},EPUBJS.core.folder=function(a){var b=a.lastIndexOf("/"),c=a.slice(0,b+1);return-1==b&&(c=""),c},EPUBJS.core.dataURLToBlob=function(a){var b=";base64,";if(-1==a.indexOf(b)){var c=a.split(","),d=c[0].split(":")[1],e=c[1];return new Blob([e],{type:d})}for(var c=a.split(b),d=c[0].split(":")[1],e=window.atob(c[1]),f=e.length,g=new Uint8Array(f),h=0;f>h;++h)g[h]=e.charCodeAt(h);return new Blob([g],{type:d})},EPUBJS.core.addScript=function(a,b,c){var d,e;e=!1,d=document.createElement("script"),d.type="text/javascript",d.async=!1,d.src=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.addScripts=function(a,b,c){var d=a.length,e=0,f=function(){e++,d==e?b&&b():EPUBJS.core.loadScript(a[e],f,c)};EPUBJS.core.addScript(a[e],f,c)},EPUBJS.core.addCss=function(a,b,c){var d,e;e=!1,d=document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.prefixed=function(a){var b=["Webkit","Moz","O","ms"],c=a[0].toUpperCase()+a.slice(1),d=b.length,e=0;if("undefined"!=typeof document.body.style[a])return a;for(;d>e;e++)if("undefined"!=typeof document.body.style[b[e]+c])return b[e]+c;return a},EPUBJS.core.resolveUrl=function(a,b){var c,d,e=[],f=a.split("/");return f.pop(),d=b.split("/"),d.forEach(function(a){".."===a?f.pop():e.push(a)}),c=f.concat(e),c.join("/")},EPUBJS.EpubCFI=function(a){return a?this.parse(a):void 0},EPUBJS.EpubCFI.prototype.generateChapter=function(a,b,c){var a=a+1,d="/"+a+"/";return d+=2*(b+1),c&&(d+="["+c+"]"),d+="!"},EPUBJS.EpubCFI.prototype.generateFragment=function(a,b){var c=this.pathTo(a),d=[];return b&&d.push(b),c.forEach(function(a){d.push(2*(a.index+1)),a.id&&"EPUBJS"!=a.id.slice(0,6)&&d.push("["+a.id+"]")}),d.join("/")},EPUBJS.EpubCFI.prototype.pathTo=function(a){for(var b,c=[];a&&null!==a.parentNode;)b=a.parentNode.children,c.unshift({id:a.id,tagName:a.tagName,index:b?Array.prototype.indexOf.call(b,a):0}),a=a.parentNode;return c},EPUBJS.EpubCFI.prototype.getChapter=function(a){var b=a.split("!");return b[0]},EPUBJS.EpubCFI.prototype.getFragment=function(a){var b=a.split("!");return b[1]},EPUBJS.EpubCFI.prototype.getOffset=function(a){var b=a.split(":");return[b[0],b[1]]},EPUBJS.EpubCFI.prototype.parse=function(a){var b,c,d,e,f={};return f.chapter=this.getChapter(a),f.fragment=this.getFragment(a),f.spinePos=parseInt(f.chapter.split("/")[2])/2-1||0,b=f.chapter.match(/\[(.*)\]/),f.spineId=b[1]||!1,c=f.fragment.split("/"),d=c[c.length-1],f.sections=[],parseInt(d)%2&&(e=this.getOffset(),f.text=parseInt(e[0]),f.character=parseInt(e[1]),c.pop()),c.forEach(function(a){var b,c,d;a&&(b=parseInt(a)/2-1,c=a.match(/\[(.*)\]/),c&&c[1]&&(d=c[1]),f.sections.push({index:b,id:d||!1}))}),f},EPUBJS.EpubCFI.prototype.getElement=function(a,b){var c,b=b||document,d=a.sections,e=b.getElementsByTagName("html")[0],f=Array.prototype.slice.call(e.children);for(d.shift();d.length>0;)c=d.shift(),c.id?e=b.querySelector("#"+c.id):(e=f[c.index],f||console.error("No Kids",e)),e||console.error("No Element For",c),f=Array.prototype.slice.call(e.children);return e},EPUBJS.Events=function(a,b){return this.events={},this.el=b?b:document.createElement("div"),a.createEvent=this.createEvent,a.tell=this.tell,a.listen=this.listen,a.deafen=this.deafen,a.listenUntil=this.listenUntil,this},EPUBJS.Events.prototype.createEvent=function(a){var b=new CustomEvent(a);return this.events[a]=b,b},EPUBJS.Events.prototype.tell=function(a,b){var c;this.events[a]?c=this.events[a]:(console.warn("No event:",a,"defined yet, creating."),c=this.createEvent(a)),b&&(c.msg=b),this.el.dispatchEvent(c)},EPUBJS.Events.prototype.listen=function(a,b,c){return this.events[a]?(c?this.el.addEventListener(a,b.bind(c),!1):this.el.addEventListener(a,b,!1),void 0):(console.warn("No event:",a,"defined yet, creating."),this.createEvent(a),void 0)},EPUBJS.Events.prototype.deafen=function(a,b){this.el.removeEventListener(a,b,!1)},EPUBJS.Events.prototype.listenUntil=function(a,b,c,d){function e(){this.deafen(a,c),this.deafen(b,e)}this.listen(a,c,d),this.listen(b,e,this)},EPUBJS.Hooks=function(){"use strict";return{register:function(a){if(void 0===this[a]&&(this[a]={}),"object"!=typeof this[a])throw"Already registered: "+a;return this[a]}}}(),EPUBJS.Parser=function(a){this.baseUrl=a||""},EPUBJS.Parser.prototype.container=function(a){var b=a.querySelector("rootfile"),c=b.getAttribute("full-path"),d=EPUBJS.core.folder(c);return{packagePath:c,basePath:d}},EPUBJS.Parser.prototype.package=function(a,b){var c=this;b&&(this.baseUrl=b);var d=a.querySelector("metadata"),e=a.querySelector("manifest"),f=a.querySelector("spine"),g=c.manifest(e),h=c.findTocPath(e),i=c.findCoverPath(e),j=Array.prototype.indexOf.call(f.parentNode.childNodes,f),k=c.spine(f,g),l={};return k.forEach(function(a){l[a.href]=a.index}),{metadata:c.metadata(d),spine:k,manifest:g,tocPath:h,coverPath:i,spineNodeIndex:j,spineIndexByURL:l}},EPUBJS.Parser.prototype.findTocPath=function(a){var b=a.querySelector("item[media-type='application/x-dtbncx+xml']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.findCoverPath=function(a){var b=a.querySelector("item[properties='cover-image']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.metadata=function(a){var b={},c=this;return b.bookTitle=c.getElementText(a,"title"),b.creator=c.getElementText(a,"creator"),b.description=c.getElementText(a,"description"),b.pubdate=c.getElementText(a,"date"),b.publisher=c.getElementText(a,"publisher"),b.identifier=c.getElementText(a,"identifier"),b.language=c.getElementText(a,"language"),b.rights=c.getElementText(a,"rights"),b.modified_date=c.querySelectorText(a,"meta[property='dcterms:modified']"),b.layout=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.orientation=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.spread=c.querySelectorText(a,"meta[property='rendition:spread']"),b -},EPUBJS.Parser.prototype.getElementText=function(a,b){var c,d=a.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",b);return d&&0!=d.length?(c=d[0],c.childNodes.length?c.childNodes[0].nodeValue:""):""},EPUBJS.Parser.prototype.querySelectorText=function(a,b){var c=a.querySelector(b);return c&&c.childNodes.length?c.childNodes[0].nodeValue:""},EPUBJS.Parser.prototype.manifest=function(a){var b=this.baseUrl,c={},d=a.querySelectorAll("item"),e=Array.prototype.slice.call(d);return e.forEach(function(a){var d=a.getAttribute("id"),e=a.getAttribute("href")||"",f=a.getAttribute("media-type")||"";c[d]={href:b+e,type:f}}),c},EPUBJS.Parser.prototype.spine=function(a,b){var c=[],d=a.getElementsByTagName("itemref"),e=Array.prototype.slice.call(d);return e.forEach(function(a,d){var e=a.getAttribute("idref"),f={id:e,linear:a.getAttribute("linear")||"",properties:a.getAttribute("properties")||"",href:b[e].href,index:d};c.push(f)}),c},EPUBJS.Parser.prototype.toc=function(a){function b(a){var c,d=[],e=[],f=a.childNodes,g=Array.prototype.slice.call(f),h=g.length,i=h;if(0==h)return!1;for(;i--;)c=g[i],"navPoint"===c.nodeName&&e.push(c);return e.forEach(function(a){var c=a.getAttribute("id"),e=a.querySelector("content"),f=e.getAttribute("src"),g=(f.split("#"),a.querySelector("navLabel")),h=g.textContent?g.textContent:"",i=b(a);d.unshift({id:c,href:f,label:h,subitems:i})}),d}var c=a.querySelector("navMap");return b(c)},EPUBJS.Renderer=function(a){this.el=a.element,this.book=a,this.settings=a.settings,a.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this),this.replaceHead.bind(this)],!0),this.crossBrowserColumnCss(),this.epubcfi=new EPUBJS.EpubCFI,this.initialize(),this.listeners()},EPUBJS.Renderer.prototype.initialize=function(){this.iframe=document.createElement("iframe"),this.settings.width||this.settings.height?this.resizeIframe(!1,this.settings.width||this.el.clientWidth,this.settings.height||this.el.clientHeight):(this.resizeIframe(!1,this.el.clientWidth,this.el.clientHeight),this.on("renderer:resized",this.resizeIframe,this)),this.el.appendChild(this.iframe)},EPUBJS.Renderer.prototype.listeners=function(){this.resized=_.debounce(this.onResized.bind(this),10),window.addEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.chapter=function(a){var b=this,c=!1;return this.book.settings.contained&&(c=this.book.zip),this.currentChapter&&(this.currentChapter.unload(),this.trigger("renderer:chapterUnloaded"),this.book.trigger("renderer:chapterUnloaded")),this.currentChapter=a,this.chapterPos=1,this.pageIds={},this.leftPos=0,this.currentChapterCfi=this.epubcfi.generateChapter(this.book.spineNodeIndex,a.spinePos,a.id),this.visibileEl=!1,a.url(c).then(function(a){return b.setIframeSrc(a)})},EPUBJS.Renderer.prototype.onResized=function(){var a={width:this.el.clientWidth,height:this.el.clientHeight};this.trigger("renderer:resized",a),this.book.trigger("book:resized",a),this.reformat()},EPUBJS.Renderer.prototype.reformat=function(){var a=this;a.book.settings.fixedLayout?a.fixedLayout():a.formatSpread(),setTimeout(function(){a.calcPages(),a.currentLocationCfi&&a.gotoCfiFragment(a.currentLocationCfi)},10)},EPUBJS.Renderer.prototype.destroy=function(){window.removeEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.resizeIframe=function(a,b,c){var d,e;a?(d=a.width,e=a.height):(d=b,e=c),this.iframe.height=e,0!=d%2&&(d+=1),this.iframe.width=d},EPUBJS.Renderer.prototype.crossBrowserColumnCss=function(){EPUBJS.Renderer.columnAxis=EPUBJS.core.prefixed("columnAxis"),EPUBJS.Renderer.columnGap=EPUBJS.core.prefixed("columnGap"),EPUBJS.Renderer.columnWidth=EPUBJS.core.prefixed("columnWidth"),EPUBJS.Renderer.transform=EPUBJS.core.prefixed("transform")},EPUBJS.Renderer.prototype.setIframeSrc=function(a){var b=this,c=new RSVP.Promise;return this.visible(!1),this.iframe.src=a,this.iframe.onload=function(){b.doc=b.iframe.contentDocument,b.docEl=b.doc.documentElement,b.bodyEl=b.doc.body,b.applyStyles(),b.book.settings.fixedLayout?b.fixedLayout():b.formatSpread(),b.beforeDisplay(function(){b.calcPages(),c.resolve(b),b.currentLocationCfi=b.getPageCfi(),b.trigger("renderer:chapterDisplayed"),b.book.trigger("renderer:chapterDisplayed"),b.visible(!0)})},c},EPUBJS.Renderer.prototype.formatSpread=function(){var a=2,b=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),this.currentLocationCfi=this.getPageCfi(),this.book.trigger("book:pageChanged",this.currentLocationCfi),this.chapterPos):!1},EPUBJS.Renderer.prototype.chapterEnd=function(){this.page(this.displayedPages),this.currentLocationCfi=this.getPageCfi()},EPUBJS.Renderer.prototype.setLeft=function(a){this.doc.defaultView.scrollTo(a,0)},EPUBJS.Renderer.prototype.replace=function(a,b,c){var d,e,f;d=this.doc.querySelectorAll(a),e=Array.prototype.slice.call(d),f=e.length,e.forEach(function(a){b(a,function(){f--,0>=f&&c&&c()})}.bind(this)),0===f&&c()},EPUBJS.Renderer.prototype.determineStore=function(){return this.book.fromStorage?"filesystem"==this.book.storage.getStorageType()?!1:this.book.store:this.book.contained?this.book.zip:!1},EPUBJS.Renderer.prototype.replaceHead=function(a){var b,c,d,e,f={},g=this,h=this.determineStore(),i=function(a,b){a.setAttribute("href",b),a.onload=function(){d--,0>=d&&j()}},j=function(){a&&a(),_.each(e,function(a){h.revokeUrl(a)}),g.urlCache=f};return h?(b=this.doc.head.querySelectorAll("[href]"),c=Array.prototype.slice.call(b),d=c.length,this.urlCache||(this.urlCache={}),e=_.clone(this.urlCache),c.forEach(function(a){var b=a.getAttribute("href"),c=this.book.settings.contentsPath+b;c in e?(i(a,e[c]),f[c]=e[c],delete e[c]):"stylesheet"===a.getAttribute("rel")?h.getText(c).then(function(b){g.replaceUrlsInCss(c,b).then(function(b){var d=window.URL||window.webkitURL||window.mozURL,e=new Blob([b],{type:"text/css"}),g=d.createObjectURL(e);i(a,g),f[c]=g},function(a){console.error(a)})}):h.getUrl(c).then(function(b){i(a,b),f[c]=b})}.bind(this)),0===d&&j(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.replaceUrlsInCss=function(a,b){var c=new RSVP.Promise,d=[],e=this.determineStore(),f=b.match(/url\(\'?\"?([^\'|^\"]*)\'?\"?\)/g);return f?(f.forEach(function(c){var f=EPUBJS.core.resolveUrl(a,c.replace(/url\(|[|\)|\'|\"]/g,""));replaced=e.getUrl(f).then(function(a){b=b.replace(c,'url("'+a+'")')},function(a){console.error(a)}),d.push(replaced)}),RSVP.all(d).then(function(){c.resolve(b)}),c):(c.resolve(b),c)},EPUBJS.Renderer.prototype.replaceLinks=function(a){var b=this.doc.querySelectorAll("a"),c=Array.prototype.slice.call(b),d=this;c.forEach(function(a){var b,c,e=a.getAttribute("href");e&&(b=e.search("://"),c="#"==e[0],-1!=b?a.setAttribute("target","_blank"):a.onclick=function(){return d.book.goto(e),!1})}),a&&a()},EPUBJS.Renderer.prototype.replaceResources=function(a){var b,c,d,e=this.determineStore();return e?(b=this.doc.querySelectorAll("[src]"),c=Array.prototype.slice.call(b),d=c.length,c.forEach(function(b){var c=b.getAttribute("src"),f=this.book.settings.contentsPath+c;e.getUrl(f).then(function(c){b.src=c,b.onload=function(){d--,0>=d&&a&&a()}})}.bind(this)),0===d&&a(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.page=function(a){return a>=1&&a<=this.displayedPages?(this.chapterPos=a,this.leftPos=this.spreadWidth*(a-1),this.setLeft(this.leftPos),!0):!1},EPUBJS.Renderer.prototype.section=function(a){var b=this.doc.getElementById(a);b&&this.pageByElement(b)},EPUBJS.Renderer.prototype.pageByElement=function(a){var b,c;a&&(b=this.leftPos+a.getBoundingClientRect().left,c=Math.floor(b/this.spreadWidth)+1,this.page(c))},EPUBJS.Renderer.prototype.beforeDisplay=function(a){this.book.triggerHooks("beforeChapterDisplay",a.bind(this),this)},EPUBJS.Renderer.prototype.walk=function(a){for(var b,a,c,d,e,f=a,g=[f],h=1e4,i=0;!b&&g.length;){if(a=g.shift(),this.isElementVisible(a)&&(b=a),!b&&a&&a.childElementCount>0){c=a.children,d=c.length;for(var j=0;d>j;j++)c[j]!=e&&g.push(c[j])}if(!b&&0==g.length&&f&&null!==f.parentNode&&(g.push(f.parentNode),e=f,f=f.parentNode),i++,i>h){console.error("ENDLESS LOOP");break}}return b},EPUBJS.Renderer.prototype.getPageCfi=function(){var a=this.visibileEl;return this.visibileEl=this.findFirstVisible(a),this.visibileEl.id||(this.visibileEl.id="EPUBJS-PAGE-"+this.chapterPos),this.pageIds[this.chapterPos]=this.visibileEl.id,this.epubcfi.generateFragment(this.visibileEl,this.currentChapterCfi)},EPUBJS.Renderer.prototype.gotoCfiFragment=function(a){var b;_.isString(a)&&(a=this.epubcfi.parse(a)),b=this.epubcfi.getElement(a,this.doc),this.pageByElement(b)},EPUBJS.Renderer.prototype.findFirstVisible=function(a){var b,c=a||this.bodyEl;return b=this.walk(c),b?b:a},EPUBJS.Renderer.prototype.isElementVisible=function(a){var b;return a&&"function"==typeof a.getBoundingClientRect&&(b=a.getBoundingClientRect().left,b>=0&&be;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?null:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;d.computed>g&&(d={value:a,computed:g})}),d.value},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return x.isFunction(a)?a:function(b){return b[a]}};x.sortBy=function(a,b,c){var d=B(b);return x.pluck(x.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;e>c.call(d,a[h])?f=h+1:g=h}return f},x.toArray=function(a){return a?x.isArray(a)?h.call(a):a.length===+a.length?x.map(a,x.identity):x.values(a):[]},x.size=function(a){return null==a?0:a.length===+a.length?a.length:x.keys(a).length},x.first=x.head=x.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return y(a,function(a){x.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(i.apply(d,arguments))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.indexOf(b,a)>=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=h.call(arguments),b=x.max(x.pluck(a,"length")),c=Array(b),d=0;b>d;d++)c[d]=x.pluck(a,""+d);return c},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);d>e;)f[e++]=a,a+=c;return f},x.bind=function(a,b){if(a.bind===w&&w)return w.apply(a,h.call(arguments,1));var c=h.call(arguments,2);return function(){return a.apply(b,c.concat(h.call(arguments)))}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);return 0===b.length&&(b=x.functions(a)),y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},x.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&(b[b.length]=c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var E=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==b+"";case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=E(a[g],b[g],c,d)););}else{var i=a.constructor,k=b.constructor;if(i!==k&&!(x.isFunction(i)&&i instanceof i&&x.isFunction(k)&&k instanceof k))return!1;for(var l in a)if(x.has(a,l)&&(g++,!(h=x.has(b,l)&&E(a[l],b[l],c,d))))break;if(h){for(l in b)if(x.has(b,l)&&!g--)break;h=!g}}return c.pop(),d.pop(),h};x.isEqual=function(a,b){return E(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};F.unescape=x.invert(F.escape);var G={escape:RegExp("["+x.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(F.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(G[a],function(b){return F[a][b]})}}),x.result=function(a,b){if(null==a)return null;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),L.call(this,c.apply(x,a))}})};var H=0;x.uniqueId=function(a){var b=++H+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=RegExp([(c.escape||I).source,(c.interpolate||I).source,(c.evaluate||I).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(K,function(a){return"\\"+J[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var L=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],L.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return L.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){"use strict";function b(a,b){f.async(function(){a.trigger("promise:resolved",{detail:b}),a.isResolved=!0,a.resolvedValue=b})}function c(a,b){f.async(function(){a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedValue=b})}function d(a){var b,c=[],d=new p,e=a.length;0===e&&d.resolve([]);var f=function(a){return function(b){g(a,b)}},g=function(a,b){c[a]=b,0===--e&&d.resolve(c)},h=function(a){d.reject(a)};for(b=0;e>b;b++)a[b].then(f(b),h);return d}function e(a,b){f[a]=b}var f={},g="undefined"!=typeof window?window:{},h=g.MutationObserver||g.WebKitMutationObserver;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))f.async=function(a,b){process.nextTick(function(){a.call(b)})};else if(h){var i=[],j=new h(function(){var a=i.slice();i=[],a.forEach(function(a){var b=a[0],c=a[1];b.call(c)})}),k=document.createElement("div");j.observe(k,{attributes:!0}),window.addEventListener("unload",function(){j.disconnect(),j=null}),f.async=function(a,b){i.push([a,b]),k.setAttribute("drainQueue","drainQueue")}}else f.async=function(a,b){setTimeout(function(){a.call(b)},1)};var l=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},m=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},n=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},o={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,c){var d,e,f=n(this);for(a=a.split(/\s+/),c=c||this;e=a.shift();)d=f[e],d||(d=f[e]=[]),-1===m(d,b)&&d.push([b,c])},off:function(a,b){var c,d,e,f=n(this);for(a=a.split(/\s+/);d=a.shift();)b?(c=f[d],e=m(c,b),-1!==e&&c.splice(e,1)):f[d]=[]},trigger:function(a,b){var c,d,e,f,g,h=n(this);if(c=h[a])for(var i=0,j=c.length;j>i;i++)d=c[i],e=d[0],f=d[1],"object"!=typeof b&&(b={detail:b}),g=new l(a,b),e.call(f,g)}},p=function(){this.on("promise:resolved",function(a){this.trigger("success",{detail:a.detail})},this),this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this)},q=function(){},r=function(a,b,c,d){var e,f,g,h,i="function"==typeof c;if(i)try{e=c(d.detail),g=!0}catch(j){h=!0,f=j}else e=d.detail,g=!0;e&&"function"==typeof e.then?e.then(function(a){b.resolve(a)},function(a){b.reject(a)}):i&&g?b.resolve(e):h?b.reject(f):b[a](e)};p.prototype={then:function(a,b){var c=new p;return this.isResolved&&f.async(function(){r("resolve",c,a,{detail:this.resolvedValue})},this),this.isRejected&&f.async(function(){r("reject",c,b,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(b){r("resolve",c,a,b)}),this.on("promise:failed",function(a){r("reject",c,b,a)}),c},resolve:function(a){b(this,a),this.resolve=q,this.reject=q},reject:function(a){c(this,a),this.resolve=q,this.reject=q}},o.mixin(p.prototype),a.Promise=p,a.Event=l,a.EventTarget=o,a.all=d,a.configure=e}(window.RSVP={});var EPUBJS=EPUBJS||{};EPUBJS.VERSION="0.1.5",EPUBJS.plugins=EPUBJS.plugins||{},EPUBJS.filePath=EPUBJS.filePath||"/epubjs/",EPUBJS.Book=function(a,b){var c=this;this.settings=_.defaults(b||{},{storage:!1,fromStorage:!1,saved:!1,online:!0,contained:!1,width:!1,height:!1,spreads:!0,fixedLayout:!1,responsive:!0,version:1,restore:!1,reload:!1,styles:{}}),this.settings.EPUBJSVERSION=EPUBJS.VERSION,this.spinePos=0,this.stored=!1,this.hooks={beforeChapterDisplay:[]},this.getHooks(),this.online=this.settings.online||navigator.onLine,this.networkListeners(),0!=this.settings.storage&&(this.storage=new fileStorage.storage(this.settings.storage)),this.ready={manifest:new RSVP.Promise,spine:new RSVP.Promise,metadata:new RSVP.Promise,cover:new RSVP.Promise,toc:new RSVP.Promise},this.ready.all=RSVP.all(_.values(this.ready)),this.ready.all.then(function(){this.trigger("book:ready")}.bind(this)),a&&(this.opened=this.open(a)),window.addEventListener("beforeunload",function(){c.settings.restore&&(c.saveSettings(),c.saveContents()),c.trigger("book:unload")},!1)},EPUBJS.Book.prototype.open=function(a,b){var c,d=this,e=this.isSaved(a);return this.settings.bookPath=a,this.bookUrl=this.urlFrom(a),e&&!b&&this.applySavedSettings(),this.settings.contained||this.isContained(a)?(this.settings.contained=this.contained=!0,this.bookUrl="",c=this.unarchive(a).then(function(){return e&&d.settings.restore&&!b?d.restore():d.unpack()})):c=e&&this.settings.restore&&!b?this.restore():this.unpack(),this.online&&this.settings.storage&&!this.settings.contained&&(this.settings.stored||c.then(d.storeOffline())),c},EPUBJS.Book.prototype.unpack=function(a){var b=this,c=new EPUBJS.Parser,a=a||"META-INF/container.xml";return b.loadXml(b.bookUrl+a).then(function(a){return c.container(a)}).then(function(a){return b.settings.contentsPath=b.bookUrl+a.basePath,b.settings.packageUrl=b.bookUrl+a.packagePath,b.loadXml(b.settings.packageUrl)}).then(function(a){return c.package(a,b.settings.contentsPath)}).then(function(a){return b.contents=a,b.manifest=b.contents.manifest,b.spine=b.contents.spine,b.spineIndexByURL=b.contents.spineIndexByURL,b.metadata=b.contents.metadata,b.cover=b.contents.cover=b.settings.contentsPath+a.coverPath,b.spineNodeIndex=b.contents.spineNodeIndex=a.spineNodeIndex,b.ready.manifest.resolve(b.contents.manifest),b.ready.spine.resolve(b.contents.spine),b.ready.metadata.resolve(b.contents.metadata),b.ready.cover.resolve(b.contents.cover),b.settings.tocUrl=b.settings.contentsPath+a.tocPath,b.loadXml(b.settings.tocUrl)}).then(function(a){return c.toc(a)}).then(function(a){b.toc=b.contents.toc=a,b.ready.toc.resolve(b.contents.toc)}).then(null,function(a){console.error(a)})},EPUBJS.Book.prototype.getMetadata=function(){return this.ready.metadata},EPUBJS.Book.prototype.getToc=function(){return this.ready.toc},EPUBJS.Book.prototype.networkListeners=function(){var a=this;window.addEventListener("offline",function(){a.online=!1,a.trigger("book:offline")},!1),window.addEventListener("online",function(){a.online=!0,a.trigger("book:online")},!1)},EPUBJS.Book.prototype.loadXml=function(a){return this.settings.fromStorage?this.storage.getXml(a):this.settings.contained?this.zip.getXml(a):EPUBJS.core.request(a,"xml")},EPUBJS.Book.prototype.urlFrom=function(a){var b=-1!=a.search("://"),c="/"==a[0],d=window.location,e=d.origin||d.protocol+"//"+d.host;return b?a:!b&&c?e+a:b||c?void 0:e+EPUBJS.core.folder(d.pathname)+a},EPUBJS.Book.prototype.unarchive=function(a){return this.zip=new EPUBJS.Unarchiver,this.zip.openZip(a)},EPUBJS.Book.prototype.isContained=function(a){var b=a.lastIndexOf("."),c=a.slice(b+1);return!c||"epub"!=c&&"zip"!=c?!1:!0},EPUBJS.Book.prototype.isSaved=function(a){var b=a+":"+this.settings.version,c=localStorage.getItem(b);return localStorage&&null!==c?!0:!1},EPUBJS.Book.prototype.removeSavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;localStorage.removeItem(a),this.settings.stored=!1},EPUBJS.Book.prototype.applySavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;return stored=JSON.parse(localStorage.getItem(a)),EPUBJS.VERSION!=stored.EPUBJSVERSION?!1:(this.settings=_.defaults(this.settings,stored),void 0)},EPUBJS.Book.prototype.saveSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;this.render&&(this.settings.previousLocationCfi=this.render.currentLocationCfi),localStorage.setItem(a,JSON.stringify(this.settings))},EPUBJS.Book.prototype.saveContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.setItem(a,JSON.stringify(this.contents))},EPUBJS.Book.prototype.removeSavedContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.removeItem(a)},EPUBJS.Book.prototype.renderTo=function(a){var b=this;if(_.isElement(a))this.element=a;else{if("string"!=typeof a)return console.error("Not an Element"),void 0;this.element=EPUBJS.core.getEl(a)}return this.opened.then(function(){return b.render=new EPUBJS.Renderer(b),b.startDisplay()})},EPUBJS.Book.prototype.startDisplay=function(){var a;return a=this.settings.restore&&this.settings.previousLocationCfi?this.displayChapter(this.settings.previousLocationCfi):this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.restore=function(a){var b=this,c=this.settings.bookPath+":contents:"+this.settings.version,d=new RSVP.Promise,e=["manifest","spine","metadata","cover","toc","spineNodeIndex","spineIndexByURL"],a=a||!1,f=localStorage.getItem(c);return this.settings.clearSaved&&(a=!0),a||"undefined"==f||"null"==f||(this.contents=JSON.parse(f),e.forEach(function(c){b[c]=b.contents[c],b[c]||(a=!0)})),!a&&f&&this.contents&&this.settings.contentsPath?(this.ready.manifest.resolve(this.manifest),this.ready.spine.resolve(this.spine),this.ready.metadata.resolve(this.metadata),this.ready.cover.resolve(this.cover),this.ready.toc.resolve(this.toc),d.resolve(),d):this.open(this.settings.bookPath,!0)},EPUBJS.Book.prototype.displayChapter=function(a,b){var c,d,e,f=this;return _.isNumber(a)?e=a:(d=new EPUBJS.EpubCFI(a),e=d.spinePos),e>=this.spine.length?!1:0>e?!1:(this.spinePos=e,this.chapter=new EPUBJS.Chapter(this.spine[e]),c=f.render.chapter(this.chapter),d?c.then(function(b){b.currentLocationCfi=a,b.gotoCfiFragment(d)}):b&&c.then(function(a){a.gotoChapterEnd()}),this.settings.fromStorage||this.settings.contained||c.then(function(){f.preloadNextChapter()}),c)},EPUBJS.Book.prototype.nextPage=function(){var a=this.render.nextPage();return a?void 0:this.nextChapter()},EPUBJS.Book.prototype.prevPage=function(){var a=this.render.prevPage();return a?void 0:this.prevChapter()},EPUBJS.Book.prototype.nextChapter=function(){return this.spinePos++,this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.prevChapter=function(){return this.spinePos--,this.displayChapter(this.spinePos,!0)},EPUBJS.Book.prototype.goto=function(a){var b,c=a.split("#"),d=c[0],e=c[1]||!1,f=-1==d.search("://")?this.settings.contentsPath+d:d,g=this.spineIndexByURL[f];return d||(g=this.chapter.spinePos),"number"!=typeof g?!1:g==this.chapter.spinePos&&this.chapter?(e&&this.render.section(e),(new RSVP.Promise).resolve(this.currentChapter)):this.displayChapter(g).then(function(){e&&b.render.section(e)})},EPUBJS.Book.prototype.preloadNextChapter=function(){return document.createElement("iframe"),this.spinePos>=this.spine.length?!1:(next=new EPUBJS.Chapter(this.spine[this.spinePos+1]),EPUBJS.core.request(next.href),void 0)},EPUBJS.Book.prototype.storeOffline=function(){var a=this,b=_.values(this.manifest);return EPUBJS.storage.batch(b).then(function(){a.settings.stored=!0,a.trigger("book:stored")})},EPUBJS.Book.prototype.availableOffline=function(){return this.settings.stored>0?!0:!1},EPUBJS.Book.prototype.setStyle=function(a,b,c){this.render.setStyle(a,b,c),this.settings.styles[a]=b},EPUBJS.Book.prototype.removeStyle=function(a){this.render.removeStyle(a),delete this.settings.styles[a]},EPUBJS.Book.prototype.getHooks=function(){var a,b=this;plugTypes=_.values(this.hooks);for(plugType in this.hooks)a=_.values(EPUBJS.Hooks[plugType]),a.forEach(function(a){b.registerHook(plugType,a)})},EPUBJS.Book.prototype.registerHook=function(a,b,c){var d=this;"undefined"!=typeof this.hooks[a]?"function"==typeof b?c?this.hooks[a].unshift(b):this.hooks[a].push(b):Array.isArray(b)&&b.forEach(function(b){c?d.hooks[a].unshift(b):d.hooks[a].push(b)}):this.hooks[a]=[func]},EPUBJS.Book.prototype.triggerHooks=function(a,b,c){function d(){f--,0>=f&&b&&b()}var e,f;return"undefined"==typeof this.hooks[a]?!1:(e=this.hooks[a],f=e.length,e.forEach(function(a){a(d,c)}),void 0)},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),EPUBJS.Chapter=function(a){this.href=a.href,this.id=a.id,this.spinePos=a.index,this.properties=a.properties,this.linear=a.linear,this.pages=1},EPUBJS.Chapter.prototype.contents=function(a){return a?a.get(href):EPUBJS.core.request(href,"xml")},EPUBJS.Chapter.prototype.url=function(a){var b=new RSVP.Promise;return a?(this.tempUrl||(this.tempUrl=a.getUrl(this.href)),this.tempUrl):(b.resolve(this.href),b)},EPUBJS.Chapter.prototype.setPages=function(a){this.pages=a},EPUBJS.Chapter.prototype.getPages=function(){return this.pages},EPUBJS.Chapter.prototype.getID=function(){return this.ID},EPUBJS.Chapter.prototype.unload=function(a){this.tempUrl&&a&&(a.revokeUrl(this.tempUrl),this.tempUrl=!1)};var EPUBJS=EPUBJS||{};EPUBJS.core={},EPUBJS.core.getEl=function(a){return document.getElementById(a)},EPUBJS.core.getEls=function(a){return document.getElementsByClassName(a)},EPUBJS.core.request=function(a,b){function c(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var a;a="xml"==b?this.responseXML:"json"==b?JSON.parse(this.response):this.response,d.resolve(a)}else d.reject(this)}var d=new RSVP.Promise,e=new XMLHttpRequest;return e.open("GET",a),e.onreadystatechange=c,"blob"==b&&(e.responseType=b),"json"==b&&e.setRequestHeader("Accept","application/json"),"xml"==b&&e.overrideMimeType("text/xml"),e.send(),d},EPUBJS.core.toArray=function(a){var b=[];for(member in a){var c;a.hasOwnProperty(member)&&(c=a[member],c.ident=member,b.push(c))}return b},EPUBJS.core.folder=function(a){var b=a.lastIndexOf("/"),c=a.slice(0,b+1);return-1==b&&(c=""),c},EPUBJS.core.dataURLToBlob=function(a){var b=";base64,";if(-1==a.indexOf(b)){var c=a.split(","),d=c[0].split(":")[1],e=c[1];return new Blob([e],{type:d})}for(var c=a.split(b),d=c[0].split(":")[1],e=window.atob(c[1]),f=e.length,g=new Uint8Array(f),h=0;f>h;++h)g[h]=e.charCodeAt(h);return new Blob([g],{type:d})},EPUBJS.core.addScript=function(a,b,c){var d,e;e=!1,d=document.createElement("script"),d.type="text/javascript",d.async=!1,d.src=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.addScripts=function(a,b,c){var d=a.length,e=0,f=function(){e++,d==e?b&&b():EPUBJS.core.loadScript(a[e],f,c)};EPUBJS.core.addScript(a[e],f,c)},EPUBJS.core.addCss=function(a,b,c){var d,e;e=!1,d=document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.prefixed=function(a){var b=["Webkit","Moz","O","ms"],c=a[0].toUpperCase()+a.slice(1),d=b.length,e=0;if("undefined"!=typeof document.body.style[a])return a;for(;d>e;e++)if("undefined"!=typeof document.body.style[b[e]+c])return b[e]+c;return a},EPUBJS.core.resolveUrl=function(a,b){var c,d,e=[],f=a.split("/");return f.pop(),d=b.split("/"),d.forEach(function(a){".."===a?f.pop():e.push(a)}),c=f.concat(e),c.join("/")},EPUBJS.EpubCFI=function(a){return a?this.parse(a):void 0},EPUBJS.EpubCFI.prototype.generateChapter=function(a,b,c){var b=parseInt(b),a=a+1,d="/"+a+"/";return d+=2*(b+1),c&&(d+="["+c+"]"),d+="!"},EPUBJS.EpubCFI.prototype.generateFragment=function(a,b){var c=this.pathTo(a),d=[];return b&&d.push(b),c.forEach(function(a){d.push(2*(a.index+1)),a.id&&"EPUBJS"!=a.id.slice(0,6)&&d.push("["+a.id+"]")}),d.join("/")},EPUBJS.EpubCFI.prototype.pathTo=function(a){for(var b,c=[];a&&null!==a.parentNode;)b=a.parentNode.children,c.unshift({id:a.id,tagName:a.tagName,index:b?Array.prototype.indexOf.call(b,a):0}),a=a.parentNode;return c},EPUBJS.EpubCFI.prototype.getChapter=function(a){var b=a.split("!");return b[0]},EPUBJS.EpubCFI.prototype.getFragment=function(a){var b=a.split("!");return b[1]},EPUBJS.EpubCFI.prototype.getOffset=function(a){var b=a.split(":");return[b[0],b[1]]},EPUBJS.EpubCFI.prototype.parse=function(a){var b,c,d,e,f={};return f.chapter=this.getChapter(a),f.fragment=this.getFragment(a),f.spinePos=parseInt(f.chapter.split("/")[2])/2-1||0,b=f.chapter.match(/\[(.*)\]/),f.spineId=b[1]||!1,c=f.fragment.split("/"),d=c[c.length-1],f.sections=[],parseInt(d)%2&&(e=this.getOffset(),f.text=parseInt(e[0]),f.character=parseInt(e[1]),c.pop()),c.forEach(function(a){var b,c,d;a&&(b=parseInt(a)/2-1,c=a.match(/\[(.*)\]/),c&&c[1]&&(d=c[1]),f.sections.push({index:b,id:d||!1}))}),f},EPUBJS.EpubCFI.prototype.getElement=function(a,b){var c,b=b||document,d=a.sections,e=b.getElementsByTagName("html")[0],f=Array.prototype.slice.call(e.children);for(d.shift();d.length>0;)c=d.shift(),c.id?e=b.querySelector("#"+c.id):(e=f[c.index],f||console.error("No Kids",e)),e||console.error("No Element For",c),f=Array.prototype.slice.call(e.children);return e},EPUBJS.Events=function(a,b){return this.events={},this.el=b?b:document.createElement("div"),a.createEvent=this.createEvent,a.tell=this.tell,a.listen=this.listen,a.deafen=this.deafen,a.listenUntil=this.listenUntil,this},EPUBJS.Events.prototype.createEvent=function(a){var b=new CustomEvent(a);return this.events[a]=b,b},EPUBJS.Events.prototype.tell=function(a,b){var c;this.events[a]?c=this.events[a]:(console.warn("No event:",a,"defined yet, creating."),c=this.createEvent(a)),b&&(c.msg=b),this.el.dispatchEvent(c)},EPUBJS.Events.prototype.listen=function(a,b,c){return this.events[a]?(c?this.el.addEventListener(a,b.bind(c),!1):this.el.addEventListener(a,b,!1),void 0):(console.warn("No event:",a,"defined yet, creating."),this.createEvent(a),void 0)},EPUBJS.Events.prototype.deafen=function(a,b){this.el.removeEventListener(a,b,!1)},EPUBJS.Events.prototype.listenUntil=function(a,b,c,d){function e(){this.deafen(a,c),this.deafen(b,e)}this.listen(a,c,d),this.listen(b,e,this)},EPUBJS.Hooks=function(){"use strict";return{register:function(a){if(void 0===this[a]&&(this[a]={}),"object"!=typeof this[a])throw"Already registered: "+a;return this[a]}}}(),EPUBJS.Parser=function(a){this.baseUrl=a||""},EPUBJS.Parser.prototype.container=function(a){var b=a.querySelector("rootfile"),c=b.getAttribute("full-path"),d=EPUBJS.core.folder(c);return{packagePath:c,basePath:d}},EPUBJS.Parser.prototype.package=function(a,b){var c=this;b&&(this.baseUrl=b);var d=a.querySelector("metadata"),e=a.querySelector("manifest"),f=a.querySelector("spine"),g=c.manifest(e),h=c.findTocPath(e),i=c.findCoverPath(e),j=Array.prototype.indexOf.call(f.parentNode.childNodes,f),k=c.spine(f,g),l={};return k.forEach(function(a){l[a.href]=a.index}),{metadata:c.metadata(d),spine:k,manifest:g,tocPath:h,coverPath:i,spineNodeIndex:j,spineIndexByURL:l}},EPUBJS.Parser.prototype.findTocPath=function(a){var b=a.querySelector("item[media-type='application/x-dtbncx+xml']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.findCoverPath=function(a){var b=a.querySelector("item[properties='cover-image']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.metadata=function(a){var b={},c=this;return b.bookTitle=c.getElementText(a,"title"),b.creator=c.getElementText(a,"creator"),b.description=c.getElementText(a,"description"),b.pubdate=c.getElementText(a,"date"),b.publisher=c.getElementText(a,"publisher"),b.identifier=c.getElementText(a,"identifier"),b.language=c.getElementText(a,"language"),b.rights=c.getElementText(a,"rights"),b.modified_date=c.querySelectorText(a,"meta[property='dcterms:modified']"),b.layout=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.orientation=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.spread=c.querySelectorText(a,"meta[property='rendition:spread']"),b +},EPUBJS.Parser.prototype.getElementText=function(a,b){var c,d=a.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",b);return d&&0!=d.length?(c=d[0],c.childNodes.length?c.childNodes[0].nodeValue:""):""},EPUBJS.Parser.prototype.querySelectorText=function(a,b){var c=a.querySelector(b);return c&&c.childNodes.length?c.childNodes[0].nodeValue:""},EPUBJS.Parser.prototype.manifest=function(a){var b=this.baseUrl,c={},d=a.querySelectorAll("item"),e=Array.prototype.slice.call(d);return e.forEach(function(a){var d=a.getAttribute("id"),e=a.getAttribute("href")||"",f=a.getAttribute("media-type")||"";c[d]={href:b+e,type:f}}),c},EPUBJS.Parser.prototype.spine=function(a,b){var c=[],d=a.getElementsByTagName("itemref"),e=Array.prototype.slice.call(d);return e.forEach(function(a,d){var e=a.getAttribute("idref"),f={id:e,linear:a.getAttribute("linear")||"",properties:a.getAttribute("properties")||"",href:b[e].href,index:d};c.push(f)}),c},EPUBJS.Parser.prototype.toc=function(a){function b(a){var c,d=[],e=[],f=a.childNodes,g=Array.prototype.slice.call(f),h=g.length,i=h;if(0==h)return!1;for(;i--;)c=g[i],"navPoint"===c.nodeName&&e.push(c);return e.forEach(function(a){var c=a.getAttribute("id"),e=a.querySelector("content"),f=e.getAttribute("src"),g=(f.split("#"),a.querySelector("navLabel")),h=g.textContent?g.textContent:"",i=b(a);d.unshift({id:c,href:f,label:h,subitems:i})}),d}var c=a.querySelector("navMap");return b(c)},EPUBJS.Renderer=function(a){this.el=a.element,this.book=a,this.settings=a.settings,a.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this),this.replaceHead.bind(this)],!0),this.crossBrowserColumnCss(),this.epubcfi=new EPUBJS.EpubCFI,this.initialize(),this.listeners()},EPUBJS.Renderer.prototype.initialize=function(){this.iframe=document.createElement("iframe"),this.settings.width||this.settings.height?this.resizeIframe(!1,this.settings.width||this.el.clientWidth,this.settings.height||this.el.clientHeight):(this.resizeIframe(!1,this.el.clientWidth,this.el.clientHeight),this.on("renderer:resized",this.resizeIframe,this)),this.el.appendChild(this.iframe)},EPUBJS.Renderer.prototype.listeners=function(){this.resized=_.debounce(this.onResized.bind(this),10),window.addEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.chapter=function(a){var b=this,c=!1;return this.book.settings.contained&&(c=this.book.zip),this.currentChapter&&(this.currentChapter.unload(),this.trigger("renderer:chapterUnloaded"),this.book.trigger("renderer:chapterUnloaded")),this.currentChapter=a,this.chapterPos=1,this.pageIds={},this.leftPos=0,this.currentChapterCfi=this.epubcfi.generateChapter(this.book.spineNodeIndex,a.spinePos,a.id),this.visibileEl=!1,a.url(c).then(function(a){return b.setIframeSrc(a)})},EPUBJS.Renderer.prototype.onResized=function(){var a={width:this.el.clientWidth,height:this.el.clientHeight};this.trigger("renderer:resized",a),this.book.trigger("book:resized",a),this.reformat()},EPUBJS.Renderer.prototype.reformat=function(){var a=this;a.book.settings.fixedLayout?a.fixedLayout():a.formatSpread(),setTimeout(function(){a.calcPages(),a.currentLocationCfi&&a.gotoCfiFragment(a.currentLocationCfi)},10)},EPUBJS.Renderer.prototype.destroy=function(){window.removeEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.resizeIframe=function(a,b,c){var d,e;a?(d=a.width,e=a.height):(d=b,e=c),this.iframe.height=e,0!=d%2&&(d+=1),this.iframe.width=d},EPUBJS.Renderer.prototype.crossBrowserColumnCss=function(){EPUBJS.Renderer.columnAxis=EPUBJS.core.prefixed("columnAxis"),EPUBJS.Renderer.columnGap=EPUBJS.core.prefixed("columnGap"),EPUBJS.Renderer.columnWidth=EPUBJS.core.prefixed("columnWidth"),EPUBJS.Renderer.transform=EPUBJS.core.prefixed("transform")},EPUBJS.Renderer.prototype.setIframeSrc=function(a){var b=this,c=new RSVP.Promise;return this.visible(!1),this.iframe.src=a,this.iframe.onload=function(){b.doc=b.iframe.contentDocument,b.docEl=b.doc.documentElement,b.bodyEl=b.doc.body,b.applyStyles(),b.book.settings.fixedLayout?b.fixedLayout():b.formatSpread(),b.beforeDisplay(function(){b.calcPages(),c.resolve(b),b.currentLocationCfi=b.getPageCfi(),b.trigger("renderer:chapterDisplayed",b.currentChapter),b.book.trigger("renderer:chapterDisplayed",b.currentChapter),b.visible(!0)})},c},EPUBJS.Renderer.prototype.formatSpread=function(){var a=2,b=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),this.currentLocationCfi=this.getPageCfi(),this.book.trigger("book:pageChanged",this.currentLocationCfi),this.chapterPos):!1},EPUBJS.Renderer.prototype.chapterEnd=function(){this.page(this.displayedPages),this.currentLocationCfi=this.getPageCfi()},EPUBJS.Renderer.prototype.setLeft=function(a){this.doc.defaultView.scrollTo(a,0)},EPUBJS.Renderer.prototype.replace=function(a,b,c){var d,e,f;d=this.doc.querySelectorAll(a),e=Array.prototype.slice.call(d),f=e.length,e.forEach(function(a){b(a,function(){f--,0>=f&&c&&c()})}.bind(this)),0===f&&c()},EPUBJS.Renderer.prototype.determineStore=function(){return this.book.fromStorage?"filesystem"==this.book.storage.getStorageType()?!1:this.book.store:this.book.contained?this.book.zip:!1},EPUBJS.Renderer.prototype.replaceHead=function(a){var b,c,d,e,f={},g=this,h=this.determineStore(),i=function(a,b){a.setAttribute("href",b),a.onload=function(){d--,0>=d&&j()}},j=function(){a&&a(),_.each(e,function(a){h.revokeUrl(a)}),g.urlCache=f};return h?(b=this.doc.head.querySelectorAll("[href]"),c=Array.prototype.slice.call(b),d=c.length,this.urlCache||(this.urlCache={}),e=_.clone(this.urlCache),c.forEach(function(a){var b=a.getAttribute("href"),c=this.book.settings.contentsPath+b;c in e?(i(a,e[c]),f[c]=e[c],delete e[c]):"stylesheet"===a.getAttribute("rel")?h.getText(c).then(function(b){g.replaceUrlsInCss(c,b).then(function(b){var d=window.URL||window.webkitURL||window.mozURL,e=new Blob([b],{type:"text/css"}),g=d.createObjectURL(e);i(a,g),f[c]=g},function(a){console.error(a)})}):h.getUrl(c).then(function(b){i(a,b),f[c]=b})}.bind(this)),0===d&&j(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.replaceUrlsInCss=function(a,b){var c=new RSVP.Promise,d=[],e=this.determineStore(),f=b.match(/url\(\'?\"?([^\'|^\"]*)\'?\"?\)/g);return f?(f.forEach(function(c){var f=EPUBJS.core.resolveUrl(a,c.replace(/url\(|[|\)|\'|\"]/g,""));replaced=e.getUrl(f).then(function(a){b=b.replace(c,'url("'+a+'")')},function(a){console.error(a)}),d.push(replaced)}),RSVP.all(d).then(function(){c.resolve(b)}),c):(c.resolve(b),c)},EPUBJS.Renderer.prototype.replaceLinks=function(a){var b=this.doc.querySelectorAll("a"),c=Array.prototype.slice.call(b),d=this;c.forEach(function(a){var b,c,e=a.getAttribute("href");e&&(b=e.search("://"),c="#"==e[0],-1!=b?a.setAttribute("target","_blank"):a.onclick=function(){return d.book.goto(e),!1})}),a&&a()},EPUBJS.Renderer.prototype.replaceResources=function(a){var b,c,d,e=this.determineStore();return e?(b=this.doc.querySelectorAll("[src]"),c=Array.prototype.slice.call(b),d=c.length,c.forEach(function(b){var c=b.getAttribute("src"),f=this.book.settings.contentsPath+c;e.getUrl(f).then(function(c){b.src=c,b.onload=function(){d--,0>=d&&a&&a()}})}.bind(this)),0===d&&a(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.page=function(a){return a>=1&&a<=this.displayedPages?(this.chapterPos=a,this.leftPos=this.spreadWidth*(a-1),this.setLeft(this.leftPos),!0):!1},EPUBJS.Renderer.prototype.section=function(a){var b=this.doc.getElementById(a);b&&this.pageByElement(b)},EPUBJS.Renderer.prototype.pageByElement=function(a){var b,c;a&&(b=this.leftPos+a.getBoundingClientRect().left,c=Math.floor(b/this.spreadWidth)+1,this.page(c))},EPUBJS.Renderer.prototype.beforeDisplay=function(a){this.book.triggerHooks("beforeChapterDisplay",a.bind(this),this)},EPUBJS.Renderer.prototype.walk=function(a){for(var b,a,c,d,e,f=a,g=[f],h=1e4,i=0;!b&&g.length;){if(a=g.shift(),this.isElementVisible(a)&&(b=a),!b&&a&&a.childElementCount>0){c=a.children,d=c.length;for(var j=0;d>j;j++)c[j]!=e&&g.push(c[j])}if(!b&&0==g.length&&f&&null!==f.parentNode&&(g.push(f.parentNode),e=f,f=f.parentNode),i++,i>h){console.error("ENDLESS LOOP");break}}return b},EPUBJS.Renderer.prototype.getPageCfi=function(){var a=this.visibileEl;return this.visibileEl=this.findFirstVisible(a),this.visibileEl.id||(this.visibileEl.id="EPUBJS-PAGE-"+this.chapterPos),this.pageIds[this.chapterPos]=this.visibileEl.id,this.epubcfi.generateFragment(this.visibileEl,this.currentChapterCfi)},EPUBJS.Renderer.prototype.gotoCfiFragment=function(a){var b;_.isString(a)&&(a=this.epubcfi.parse(a)),b=this.epubcfi.getElement(a,this.doc),this.pageByElement(b)},EPUBJS.Renderer.prototype.findFirstVisible=function(a){var b,c=a||this.bodyEl;return b=this.walk(c),b?b:a},EPUBJS.Renderer.prototype.isElementVisible=function(a){var b;return a&&"function"==typeof a.getBoundingClientRect&&(b=a.getBoundingClientRect().left,b>=0&&be;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?null:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;d.computed>g&&(d={value:a,computed:g})}),d.value},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return x.isFunction(a)?a:function(b){return b[a]}};x.sortBy=function(a,b,c){var d=B(b);return x.pluck(x.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;e>c.call(d,a[h])?f=h+1:g=h}return f},x.toArray=function(a){return a?x.isArray(a)?h.call(a):a.length===+a.length?x.map(a,x.identity):x.values(a):[]},x.size=function(a){return null==a?0:a.length===+a.length?a.length:x.keys(a).length},x.first=x.head=x.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return y(a,function(a){x.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(i.apply(d,arguments))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.indexOf(b,a)>=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=h.call(arguments),b=x.max(x.pluck(a,"length")),c=Array(b),d=0;b>d;d++)c[d]=x.pluck(a,""+d);return c},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);d>e;)f[e++]=a,a+=c;return f},x.bind=function(a,b){if(a.bind===w&&w)return w.apply(a,h.call(arguments,1));var c=h.call(arguments,2);return function(){return a.apply(b,c.concat(h.call(arguments)))}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);return 0===b.length&&(b=x.functions(a)),y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},x.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&(b[b.length]=c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var E=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==b+"";case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=E(a[g],b[g],c,d)););}else{var i=a.constructor,k=b.constructor;if(i!==k&&!(x.isFunction(i)&&i instanceof i&&x.isFunction(k)&&k instanceof k))return!1;for(var l in a)if(x.has(a,l)&&(g++,!(h=x.has(b,l)&&E(a[l],b[l],c,d))))break;if(h){for(l in b)if(x.has(b,l)&&!g--)break;h=!g}}return c.pop(),d.pop(),h};x.isEqual=function(a,b){return E(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};F.unescape=x.invert(F.escape);var G={escape:RegExp("["+x.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(F.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(G[a],function(b){return F[a][b]})}}),x.result=function(a,b){if(null==a)return null;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),L.call(this,c.apply(x,a))}})};var H=0;x.uniqueId=function(a){var b=++H+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=RegExp([(c.escape||I).source,(c.interpolate||I).source,(c.evaluate||I).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(K,function(a){return"\\"+J[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var L=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],L.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return L.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){"use strict";function b(a,b){f.async(function(){a.trigger("promise:resolved",{detail:b}),a.isResolved=!0,a.resolvedValue=b})}function c(a,b){f.async(function(){a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedValue=b})}function d(a){var b,c=[],d=new p,e=a.length;0===e&&d.resolve([]);var f=function(a){return function(b){g(a,b)}},g=function(a,b){c[a]=b,0===--e&&d.resolve(c)},h=function(a){d.reject(a)};for(b=0;e>b;b++)a[b].then(f(b),h);return d}function e(a,b){f[a]=b}var f={},g="undefined"!=typeof window?window:{},h=g.MutationObserver||g.WebKitMutationObserver;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))f.async=function(a,b){process.nextTick(function(){a.call(b)})};else if(h){var i=[],j=new h(function(){var a=i.slice();i=[],a.forEach(function(a){var b=a[0],c=a[1];b.call(c)})}),k=document.createElement("div");j.observe(k,{attributes:!0}),window.addEventListener("unload",function(){j.disconnect(),j=null}),f.async=function(a,b){i.push([a,b]),k.setAttribute("drainQueue","drainQueue")}}else f.async=function(a,b){setTimeout(function(){a.call(b)},1)};var l=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},m=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},n=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},o={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,c){var d,e,f=n(this);for(a=a.split(/\s+/),c=c||this;e=a.shift();)d=f[e],d||(d=f[e]=[]),-1===m(d,b)&&d.push([b,c])},off:function(a,b){var c,d,e,f=n(this);for(a=a.split(/\s+/);d=a.shift();)b?(c=f[d],e=m(c,b),-1!==e&&c.splice(e,1)):f[d]=[]},trigger:function(a,b){var c,d,e,f,g,h=n(this);if(c=h[a])for(var i=0,j=c.length;j>i;i++)d=c[i],e=d[0],f=d[1],"object"!=typeof b&&(b={detail:b}),g=new l(a,b),e.call(f,g)}},p=function(){this.on("promise:resolved",function(a){this.trigger("success",{detail:a.detail})},this),this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this)},q=function(){},r=function(a,b,c,d){var e,f,g,h,i="function"==typeof c;if(i)try{e=c(d.detail),g=!0}catch(j){h=!0,f=j}else e=d.detail,g=!0;e&&"function"==typeof e.then?e.then(function(a){b.resolve(a)},function(a){b.reject(a)}):i&&g?b.resolve(e):h?b.reject(f):b[a](e)};p.prototype={then:function(a,b){var c=new p;return this.isResolved&&f.async(function(){r("resolve",c,a,{detail:this.resolvedValue})},this),this.isRejected&&f.async(function(){r("reject",c,b,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(b){r("resolve",c,a,b)}),this.on("promise:failed",function(a){r("reject",c,b,a)}),c},resolve:function(a){b(this,a),this.resolve=q,this.reject=q},reject:function(a){c(this,a),this.resolve=q,this.reject=q}},o.mixin(p.prototype),a.Promise=p,a.Event=l,a.EventTarget=o,a.all=d,a.configure=e}(window.RSVP={});var EPUBJS=EPUBJS||{};EPUBJS.VERSION="0.1.5",EPUBJS.plugins=EPUBJS.plugins||{},EPUBJS.filePath=EPUBJS.filePath||"/epubjs/",EPUBJS.Book=function(a,b){var c=this;this.settings=_.defaults(b||{},{storage:!1,fromStorage:!1,saved:!1,online:!0,contained:!1,width:!1,height:!1,spreads:!0,fixedLayout:!1,responsive:!0,version:1,restore:!1,reload:!1,styles:{}}),this.settings.EPUBJSVERSION=EPUBJS.VERSION,this.spinePos=0,this.stored=!1,this.hooks={beforeChapterDisplay:[]},this.getHooks(),this.online=this.settings.online||navigator.onLine,this.networkListeners(),0!=this.settings.storage&&(this.storage=new fileStorage.storage(this.settings.storage)),this.ready={manifest:new RSVP.Promise,spine:new RSVP.Promise,metadata:new RSVP.Promise,cover:new RSVP.Promise,toc:new RSVP.Promise},this.ready.all=RSVP.all(_.values(this.ready)),this.ready.all.then(function(){this.trigger("book:ready")}.bind(this)),a&&(this.opened=this.open(a)),window.addEventListener("beforeunload",function(){c.settings.restore&&(c.saveSettings(),c.saveContents()),c.trigger("book:unload")},!1)},EPUBJS.Book.prototype.open=function(a,b){var c,d=this,e=this.isSaved(a);return this.settings.bookPath=a,this.bookUrl=this.urlFrom(a),e&&!b&&this.applySavedSettings(),this.settings.contained||this.isContained(a)?(this.settings.contained=this.contained=!0,this.bookUrl="",c=this.unarchive(a).then(function(){return e&&d.settings.restore&&!b?d.restore():d.unpack()})):c=e&&this.settings.restore&&!b?this.restore():this.unpack(),this.online&&this.settings.storage&&!this.settings.contained&&(this.settings.stored||c.then(d.storeOffline())),c},EPUBJS.Book.prototype.unpack=function(a){var b=this,c=new EPUBJS.Parser,a=a||"META-INF/container.xml";return b.loadXml(b.bookUrl+a).then(function(a){return c.container(a)}).then(function(a){return b.settings.contentsPath=b.bookUrl+a.basePath,b.settings.packageUrl=b.bookUrl+a.packagePath,b.loadXml(b.settings.packageUrl)}).then(function(a){return c.package(a,b.settings.contentsPath)}).then(function(a){return b.contents=a,b.manifest=b.contents.manifest,b.spine=b.contents.spine,b.spineIndexByURL=b.contents.spineIndexByURL,b.metadata=b.contents.metadata,b.cover=b.contents.cover=b.settings.contentsPath+a.coverPath,b.spineNodeIndex=b.contents.spineNodeIndex=a.spineNodeIndex,b.ready.manifest.resolve(b.contents.manifest),b.ready.spine.resolve(b.contents.spine),b.ready.metadata.resolve(b.contents.metadata),b.ready.cover.resolve(b.contents.cover),b.settings.tocUrl=b.settings.contentsPath+a.tocPath,b.loadXml(b.settings.tocUrl)}).then(function(a){return c.toc(a)}).then(function(a){b.toc=b.contents.toc=a,b.ready.toc.resolve(b.contents.toc)}).then(null,function(a){console.error(a)})},EPUBJS.Book.prototype.getMetadata=function(){return this.ready.metadata},EPUBJS.Book.prototype.getToc=function(){return this.ready.toc},EPUBJS.Book.prototype.networkListeners=function(){var a=this;window.addEventListener("offline",function(){a.online=!1,a.trigger("book:offline")},!1),window.addEventListener("online",function(){a.online=!0,a.trigger("book:online")},!1)},EPUBJS.Book.prototype.loadXml=function(a){return this.settings.fromStorage?this.storage.getXml(a):this.settings.contained?this.zip.getXml(a):EPUBJS.core.request(a,"xml")},EPUBJS.Book.prototype.urlFrom=function(a){var b=-1!=a.search("://"),c="/"==a[0],d=window.location,e=d.origin||d.protocol+"//"+d.host;return b?a:!b&&c?e+a:b||c?void 0:e+EPUBJS.core.folder(d.pathname)+a},EPUBJS.Book.prototype.unarchive=function(a){return this.zip=new EPUBJS.Unarchiver,this.zip.openZip(a)},EPUBJS.Book.prototype.isContained=function(a){var b=a.lastIndexOf("."),c=a.slice(b+1);return!c||"epub"!=c&&"zip"!=c?!1:!0},EPUBJS.Book.prototype.isSaved=function(a){var b=a+":"+this.settings.version,c=localStorage.getItem(b);return localStorage&&null!==c?!0:!1},EPUBJS.Book.prototype.removeSavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;localStorage.removeItem(a),this.settings.stored=!1},EPUBJS.Book.prototype.applySavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;return stored=JSON.parse(localStorage.getItem(a)),EPUBJS.VERSION!=stored.EPUBJSVERSION?!1:(this.settings=_.defaults(this.settings,stored),void 0)},EPUBJS.Book.prototype.saveSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;this.render&&(this.settings.previousLocationCfi=this.render.currentLocationCfi),localStorage.setItem(a,JSON.stringify(this.settings))},EPUBJS.Book.prototype.saveContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.setItem(a,JSON.stringify(this.contents))},EPUBJS.Book.prototype.removeSavedContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.removeItem(a)},EPUBJS.Book.prototype.renderTo=function(a){var b=this;if(_.isElement(a))this.element=a;else{if("string"!=typeof a)return console.error("Not an Element"),void 0;this.element=EPUBJS.core.getEl(a)}return this.opened.then(function(){return b.render=new EPUBJS.Renderer(b),b.startDisplay()})},EPUBJS.Book.prototype.startDisplay=function(){var a;return a=this.settings.restore&&this.settings.previousLocationCfi?this.displayChapter(this.settings.previousLocationCfi):this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.restore=function(a){var b=this,c=this.settings.bookPath+":contents:"+this.settings.version,d=new RSVP.Promise,e=["manifest","spine","metadata","cover","toc","spineNodeIndex","spineIndexByURL"],a=a||!1,f=localStorage.getItem(c);return this.settings.clearSaved&&(a=!0),a||"undefined"==f||"null"==f||(this.contents=JSON.parse(f),e.forEach(function(c){b[c]=b.contents[c],b[c]||(a=!0)})),!a&&f&&this.contents&&this.settings.contentsPath?(this.ready.manifest.resolve(this.manifest),this.ready.spine.resolve(this.spine),this.ready.metadata.resolve(this.metadata),this.ready.cover.resolve(this.cover),this.ready.toc.resolve(this.toc),d.resolve(),d):this.open(this.settings.bookPath,!0)},EPUBJS.Book.prototype.displayChapter=function(a,b){var c,d,e,f=this;return _.isNumber(a)?e=a:(d=new EPUBJS.EpubCFI(a),e=d.spinePos),e>=this.spine.length?!1:0>e?!1:(this.spinePos=e,this.chapter=new EPUBJS.Chapter(this.spine[e]),c=f.render.chapter(this.chapter),d?c.then(function(b){b.currentLocationCfi=a,b.gotoCfiFragment(d)}):b&&c.then(function(a){a.gotoChapterEnd()}),this.settings.fromStorage||this.settings.contained||c.then(function(){f.preloadNextChapter()}),c)},EPUBJS.Book.prototype.nextPage=function(){var a=this.render.nextPage();return a?void 0:this.nextChapter()},EPUBJS.Book.prototype.prevPage=function(){var a=this.render.prevPage();return a?void 0:this.prevChapter()},EPUBJS.Book.prototype.nextChapter=function(){return this.spinePos++,this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.prevChapter=function(){return this.spinePos--,this.displayChapter(this.spinePos,!0)},EPUBJS.Book.prototype.goto=function(a){var b,c=a.split("#"),d=c[0],e=c[1]||!1,f=-1==d.search("://")?this.settings.contentsPath+d:d,g=this.spineIndexByURL[f];return d||(g=this.chapter.spinePos),"number"!=typeof g?!1:g==this.chapter.spinePos&&this.chapter?(e&&this.render.section(e),(new RSVP.Promise).resolve(this.currentChapter)):this.displayChapter(g).then(function(){e&&b.render.section(e)})},EPUBJS.Book.prototype.preloadNextChapter=function(){return document.createElement("iframe"),this.spinePos>=this.spine.length?!1:(next=new EPUBJS.Chapter(this.spine[this.spinePos+1]),EPUBJS.core.request(next.href),void 0)},EPUBJS.Book.prototype.storeOffline=function(){var a=this,b=_.values(this.manifest);return EPUBJS.storage.batch(b).then(function(){a.settings.stored=!0,a.trigger("book:stored")})},EPUBJS.Book.prototype.availableOffline=function(){return this.settings.stored>0?!0:!1},EPUBJS.Book.prototype.setStyle=function(a,b,c){this.render.setStyle(a,b,c),this.settings.styles[a]=b},EPUBJS.Book.prototype.removeStyle=function(a){this.render.removeStyle(a),delete this.settings.styles[a]},EPUBJS.Book.prototype.getHooks=function(){var a,b=this;plugTypes=_.values(this.hooks);for(plugType in this.hooks)a=_.values(EPUBJS.Hooks[plugType]),a.forEach(function(a){b.registerHook(plugType,a)})},EPUBJS.Book.prototype.registerHook=function(a,b,c){var d=this;"undefined"!=typeof this.hooks[a]?"function"==typeof b?c?this.hooks[a].unshift(b):this.hooks[a].push(b):Array.isArray(b)&&b.forEach(function(b){c?d.hooks[a].unshift(b):d.hooks[a].push(b)}):this.hooks[a]=[func]},EPUBJS.Book.prototype.triggerHooks=function(a,b,c){function d(){f--,0>=f&&b&&b()}var e,f;return"undefined"==typeof this.hooks[a]?!1:(e=this.hooks[a],f=e.length,e.forEach(function(a){a(d,c)}),void 0)},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),EPUBJS.Chapter=function(a){this.href=a.href,this.id=a.id,this.spinePos=a.index,this.properties=a.properties,this.linear=a.linear,this.pages=1},EPUBJS.Chapter.prototype.contents=function(a){return a?a.get(href):EPUBJS.core.request(href,"xml")},EPUBJS.Chapter.prototype.url=function(a){var b=new RSVP.Promise;return a?(this.tempUrl||(this.tempUrl=a.getUrl(this.href)),this.tempUrl):(b.resolve(this.href),b)},EPUBJS.Chapter.prototype.setPages=function(a){this.pages=a},EPUBJS.Chapter.prototype.getPages=function(){return this.pages},EPUBJS.Chapter.prototype.getID=function(){return this.ID},EPUBJS.Chapter.prototype.unload=function(a){this.tempUrl&&a&&(a.revokeUrl(this.tempUrl),this.tempUrl=!1)};var EPUBJS=EPUBJS||{};EPUBJS.core={},EPUBJS.core.getEl=function(a){return document.getElementById(a)},EPUBJS.core.getEls=function(a){return document.getElementsByClassName(a)},EPUBJS.core.request=function(a,b){function c(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var a;a="xml"==b?this.responseXML:"json"==b?JSON.parse(this.response):this.response,d.resolve(a)}else d.reject(this)}var d=new RSVP.Promise,e=new XMLHttpRequest;return e.open("GET",a),e.onreadystatechange=c,"blob"==b&&(e.responseType=b),"json"==b&&e.setRequestHeader("Accept","application/json"),"xml"==b&&e.overrideMimeType("text/xml"),e.send(),d},EPUBJS.core.toArray=function(a){var b=[];for(member in a){var c;a.hasOwnProperty(member)&&(c=a[member],c.ident=member,b.push(c))}return b},EPUBJS.core.folder=function(a){var b=a.lastIndexOf("/"),c=a.slice(0,b+1);return-1==b&&(c=""),c},EPUBJS.core.dataURLToBlob=function(a){var b=";base64,";if(-1==a.indexOf(b)){var c=a.split(","),d=c[0].split(":")[1],e=c[1];return new Blob([e],{type:d})}for(var c=a.split(b),d=c[0].split(":")[1],e=window.atob(c[1]),f=e.length,g=new Uint8Array(f),h=0;f>h;++h)g[h]=e.charCodeAt(h);return new Blob([g],{type:d})},EPUBJS.core.addScript=function(a,b,c){var d,e;e=!1,d=document.createElement("script"),d.type="text/javascript",d.async=!1,d.src=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.addScripts=function(a,b,c){var d=a.length,e=0,f=function(){e++,d==e?b&&b():EPUBJS.core.loadScript(a[e],f,c)};EPUBJS.core.addScript(a[e],f,c)},EPUBJS.core.addCss=function(a,b,c){var d,e;e=!1,d=document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.prefixed=function(a){var b=["Webkit","Moz","O","ms"],c=a[0].toUpperCase()+a.slice(1),d=b.length,e=0;if("undefined"!=typeof document.body.style[a])return a;for(;d>e;e++)if("undefined"!=typeof document.body.style[b[e]+c])return b[e]+c;return a},EPUBJS.core.resolveUrl=function(a,b){var c,d,e=[],f=a.split("/");return f.pop(),d=b.split("/"),d.forEach(function(a){".."===a?f.pop():e.push(a)}),c=f.concat(e),c.join("/")},EPUBJS.EpubCFI=function(a){return a?this.parse(a):void 0},EPUBJS.EpubCFI.prototype.generateChapter=function(a,b,c){var a=a+1,d="/"+a+"/";return d+=2*(b+1),c&&(d+="["+c+"]"),d+="!"},EPUBJS.EpubCFI.prototype.generateFragment=function(a,b){var c=this.pathTo(a),d=[];return b&&d.push(b),c.forEach(function(a){d.push(2*(a.index+1)),a.id&&"EPUBJS"!=a.id.slice(0,6)&&d.push("["+a.id+"]")}),d.join("/")},EPUBJS.EpubCFI.prototype.pathTo=function(a){for(var b,c=[];a&&null!==a.parentNode;)b=a.parentNode.children,c.unshift({id:a.id,tagName:a.tagName,index:b?Array.prototype.indexOf.call(b,a):0}),a=a.parentNode;return c},EPUBJS.EpubCFI.prototype.getChapter=function(a){var b=a.split("!");return b[0]},EPUBJS.EpubCFI.prototype.getFragment=function(a){var b=a.split("!");return b[1]},EPUBJS.EpubCFI.prototype.getOffset=function(a){var b=a.split(":");return[b[0],b[1]]},EPUBJS.EpubCFI.prototype.parse=function(a){var b,c,d,e,f={};return f.chapter=this.getChapter(a),f.fragment=this.getFragment(a),f.spinePos=parseInt(f.chapter.split("/")[2])/2-1||0,b=f.chapter.match(/\[(.*)\]/),f.spineId=b[1]||!1,c=f.fragment.split("/"),d=c[c.length-1],f.sections=[],parseInt(d)%2&&(e=this.getOffset(),f.text=parseInt(e[0]),f.character=parseInt(e[1]),c.pop()),c.forEach(function(a){var b,c,d;a&&(b=parseInt(a)/2-1,c=a.match(/\[(.*)\]/),c&&c[1]&&(d=c[1]),f.sections.push({index:b,id:d||!1}))}),f},EPUBJS.EpubCFI.prototype.getElement=function(a,b){var c,b=b||document,d=a.sections,e=b.getElementsByTagName("html")[0],f=Array.prototype.slice.call(e.children);for(d.shift();d.length>0;)c=d.shift(),c.id?e=b.querySelector("#"+c.id):(e=f[c.index],f||console.error("No Kids",e)),e||console.error("No Element For",c),f=Array.prototype.slice.call(e.children);return e},EPUBJS.Events=function(a,b){return this.events={},this.el=b?b:document.createElement("div"),a.createEvent=this.createEvent,a.tell=this.tell,a.listen=this.listen,a.deafen=this.deafen,a.listenUntil=this.listenUntil,this},EPUBJS.Events.prototype.createEvent=function(a){var b=new CustomEvent(a);return this.events[a]=b,b},EPUBJS.Events.prototype.tell=function(a,b){var c;this.events[a]?c=this.events[a]:(console.warn("No event:",a,"defined yet, creating."),c=this.createEvent(a)),b&&(c.msg=b),this.el.dispatchEvent(c)},EPUBJS.Events.prototype.listen=function(a,b,c){return this.events[a]?(c?this.el.addEventListener(a,b.bind(c),!1):this.el.addEventListener(a,b,!1),void 0):(console.warn("No event:",a,"defined yet, creating."),this.createEvent(a),void 0)},EPUBJS.Events.prototype.deafen=function(a,b){this.el.removeEventListener(a,b,!1)},EPUBJS.Events.prototype.listenUntil=function(a,b,c,d){function e(){this.deafen(a,c),this.deafen(b,e)}this.listen(a,c,d),this.listen(b,e,this)},EPUBJS.Hooks=function(){"use strict";return{register:function(a){if(void 0===this[a]&&(this[a]={}),"object"!=typeof this[a])throw"Already registered: "+a;return this[a]}}}(),EPUBJS.Parser=function(a){this.baseUrl=a||""},EPUBJS.Parser.prototype.container=function(a){var b=a.querySelector("rootfile"),c=b.getAttribute("full-path"),d=EPUBJS.core.folder(c);return{packagePath:c,basePath:d}},EPUBJS.Parser.prototype.package=function(a,b){var c=this;b&&(this.baseUrl=b);var d=a.querySelector("metadata"),e=a.querySelector("manifest"),f=a.querySelector("spine"),g=c.manifest(e),h=c.findTocPath(e),i=c.findCoverPath(e),j=Array.prototype.indexOf.call(f.parentNode.childNodes,f),k=c.spine(f,g),l={};return k.forEach(function(a){l[a.href]=a.index}),{metadata:c.metadata(d),spine:k,manifest:g,tocPath:h,coverPath:i,spineNodeIndex:j,spineIndexByURL:l}},EPUBJS.Parser.prototype.findTocPath=function(a){var b=a.querySelector("item[media-type='application/x-dtbncx+xml']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.findCoverPath=function(a){var b=a.querySelector("item[properties='cover-image']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.metadata=function(a){var b={},c=this;return b.bookTitle=c.getElementText(a,"title"),b.creator=c.getElementText(a,"creator"),b.description=c.getElementText(a,"description"),b.pubdate=c.getElementText(a,"date"),b.publisher=c.getElementText(a,"publisher"),b.identifier=c.getElementText(a,"identifier"),b.language=c.getElementText(a,"language"),b.rights=c.getElementText(a,"rights"),b.modified_date=c.querySelectorText(a,"meta[property='dcterms:modified']"),b.layout=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.orientation=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.spread=c.querySelectorText(a,"meta[property='rendition:spread']"),b -},EPUBJS.Parser.prototype.getElementText=function(a,b){var c,d=a.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",b);return d&&0!=d.length?(c=d[0],c.childNodes.length?c.childNodes[0].nodeValue:""):""},EPUBJS.Parser.prototype.querySelectorText=function(a,b){var c=a.querySelector(b);return c&&c.childNodes.length?c.childNodes[0].nodeValue:""},EPUBJS.Parser.prototype.manifest=function(a){var b=this.baseUrl,c={},d=a.querySelectorAll("item"),e=Array.prototype.slice.call(d);return e.forEach(function(a){var d=a.getAttribute("id"),e=a.getAttribute("href")||"",f=a.getAttribute("media-type")||"";c[d]={href:b+e,type:f}}),c},EPUBJS.Parser.prototype.spine=function(a,b){var c=[],d=a.getElementsByTagName("itemref"),e=Array.prototype.slice.call(d);return e.forEach(function(a,d){var e=a.getAttribute("idref"),f={id:e,linear:a.getAttribute("linear")||"",properties:a.getAttribute("properties")||"",href:b[e].href,index:d};c.push(f)}),c},EPUBJS.Parser.prototype.toc=function(a){function b(a){var c,d=[],e=[],f=a.childNodes,g=Array.prototype.slice.call(f),h=g.length,i=h;if(0==h)return!1;for(;i--;)c=g[i],"navPoint"===c.nodeName&&e.push(c);return e.forEach(function(a){var c=a.getAttribute("id"),e=a.querySelector("content"),f=e.getAttribute("src"),g=(f.split("#"),a.querySelector("navLabel")),h=g.textContent?g.textContent:"",i=b(a);d.unshift({id:c,href:f,label:h,subitems:i})}),d}var c=a.querySelector("navMap");return b(c)},EPUBJS.Renderer=function(a){this.el=a.element,this.book=a,this.settings=a.settings,a.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this),this.replaceHead.bind(this)],!0),this.crossBrowserColumnCss(),this.epubcfi=new EPUBJS.EpubCFI,this.initialize(),this.listeners()},EPUBJS.Renderer.prototype.initialize=function(){this.iframe=document.createElement("iframe"),this.settings.width||this.settings.height?this.resizeIframe(!1,this.settings.width||this.el.clientWidth,this.settings.height||this.el.clientHeight):(this.resizeIframe(!1,this.el.clientWidth,this.el.clientHeight),this.on("renderer:resized",this.resizeIframe,this)),this.el.appendChild(this.iframe)},EPUBJS.Renderer.prototype.listeners=function(){this.resized=_.debounce(this.onResized.bind(this),10),window.addEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.chapter=function(a){var b=this,c=!1;return this.book.settings.contained&&(c=this.book.zip),this.currentChapter&&(this.currentChapter.unload(),this.trigger("renderer:chapterUnloaded"),this.book.trigger("renderer:chapterUnloaded")),this.currentChapter=a,this.chapterPos=1,this.pageIds={},this.leftPos=0,this.currentChapterCfi=this.epubcfi.generateChapter(this.book.spineNodeIndex,a.spinePos,a.id),this.visibileEl=!1,a.url(c).then(function(a){return b.setIframeSrc(a)})},EPUBJS.Renderer.prototype.onResized=function(){var a={width:this.el.clientWidth,height:this.el.clientHeight};this.trigger("renderer:resized",a),this.book.trigger("book:resized",a),this.reformat()},EPUBJS.Renderer.prototype.reformat=function(){var a=this;a.book.settings.fixedLayout?a.fixedLayout():a.formatSpread(),setTimeout(function(){a.calcPages(),a.currentLocationCfi&&a.gotoCfiFragment(a.currentLocationCfi)},10)},EPUBJS.Renderer.prototype.destroy=function(){window.removeEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.resizeIframe=function(a,b,c){var d,e;a?(d=a.width,e=a.height):(d=b,e=c),this.iframe.height=e,0!=d%2&&(d+=1),this.iframe.width=d},EPUBJS.Renderer.prototype.crossBrowserColumnCss=function(){EPUBJS.Renderer.columnAxis=EPUBJS.core.prefixed("columnAxis"),EPUBJS.Renderer.columnGap=EPUBJS.core.prefixed("columnGap"),EPUBJS.Renderer.columnWidth=EPUBJS.core.prefixed("columnWidth"),EPUBJS.Renderer.transform=EPUBJS.core.prefixed("transform")},EPUBJS.Renderer.prototype.setIframeSrc=function(a){var b=this,c=new RSVP.Promise;return this.visible(!1),this.iframe.src=a,this.iframe.onload=function(){b.doc=b.iframe.contentDocument,b.docEl=b.doc.documentElement,b.bodyEl=b.doc.body,b.applyStyles(),b.book.settings.fixedLayout?b.fixedLayout():b.formatSpread(),b.beforeDisplay(function(){b.calcPages(),c.resolve(b),b.currentLocationCfi=b.getPageCfi(),b.trigger("renderer:chapterDisplayed"),b.book.trigger("renderer:chapterDisplayed"),b.visible(!0)})},c},EPUBJS.Renderer.prototype.formatSpread=function(){var a=2,b=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),this.currentLocationCfi=this.getPageCfi(),this.book.trigger("book:pageChanged",this.currentLocationCfi),this.chapterPos):!1},EPUBJS.Renderer.prototype.chapterEnd=function(){this.page(this.displayedPages),this.currentLocationCfi=this.getPageCfi()},EPUBJS.Renderer.prototype.setLeft=function(a){this.doc.defaultView.scrollTo(a,0)},EPUBJS.Renderer.prototype.replace=function(a,b,c){var d,e,f;d=this.doc.querySelectorAll(a),e=Array.prototype.slice.call(d),f=e.length,e.forEach(function(a){b(a,function(){f--,0>=f&&c&&c()})}.bind(this)),0===f&&c()},EPUBJS.Renderer.prototype.determineStore=function(){return this.book.fromStorage?"filesystem"==this.book.storage.getStorageType()?!1:this.book.store:this.book.contained?this.book.zip:!1},EPUBJS.Renderer.prototype.replaceHead=function(a){var b,c,d,e,f={},g=this,h=this.determineStore(),i=function(a,b){a.setAttribute("href",b),a.onload=function(){d--,0>=d&&j()}},j=function(){a&&a(),_.each(e,function(a){h.revokeUrl(a)}),g.urlCache=f};return h?(b=this.doc.head.querySelectorAll("[href]"),c=Array.prototype.slice.call(b),d=c.length,this.urlCache||(this.urlCache={}),e=_.clone(this.urlCache),c.forEach(function(a){var b=a.getAttribute("href"),c=this.book.settings.contentsPath+b;c in e?(i(a,e[c]),f[c]=e[c],delete e[c]):"stylesheet"===a.getAttribute("rel")?h.getText(c).then(function(b){g.replaceUrlsInCss(c,b).then(function(b){var d=window.URL||window.webkitURL||window.mozURL,e=new Blob([b],{type:"text/css"}),g=d.createObjectURL(e);i(a,g),f[c]=g},function(a){console.error(a)})}):h.getUrl(c).then(function(b){i(a,b),f[c]=b})}.bind(this)),0===d&&j(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.replaceUrlsInCss=function(a,b){var c=new RSVP.Promise,d=[],e=this.determineStore(),f=b.match(/url\(\'?\"?([^\'|^\"]*)\'?\"?\)/g);return f?(f.forEach(function(c){var f=EPUBJS.core.resolveUrl(a,c.replace(/url\(|[|\)|\'|\"]/g,""));replaced=e.getUrl(f).then(function(a){b=b.replace(c,'url("'+a+'")')},function(a){console.error(a)}),d.push(replaced)}),RSVP.all(d).then(function(){c.resolve(b)}),c):(c.resolve(b),c)},EPUBJS.Renderer.prototype.replaceLinks=function(a){var b=this.doc.querySelectorAll("a"),c=Array.prototype.slice.call(b),d=this;c.forEach(function(a){var b,c,e=a.getAttribute("href");e&&(b=e.search("://"),c="#"==e[0],-1!=b?a.setAttribute("target","_blank"):a.onclick=function(){return d.book.goto(e),!1})}),a&&a()},EPUBJS.Renderer.prototype.replaceResources=function(a){var b,c,d,e=this.determineStore();return e?(b=this.doc.querySelectorAll("[src]"),c=Array.prototype.slice.call(b),d=c.length,c.forEach(function(b){var c=b.getAttribute("src"),f=this.book.settings.contentsPath+c;e.getUrl(f).then(function(c){b.src=c,b.onload=function(){d--,0>=d&&a&&a()}})}.bind(this)),0===d&&a(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.page=function(a){return a>=1&&a<=this.displayedPages?(this.chapterPos=a,this.leftPos=this.spreadWidth*(a-1),this.setLeft(this.leftPos),!0):!1},EPUBJS.Renderer.prototype.section=function(a){var b=this.doc.getElementById(a);b&&this.pageByElement(b)},EPUBJS.Renderer.prototype.pageByElement=function(a){var b,c;a&&(b=this.leftPos+a.getBoundingClientRect().left,c=Math.floor(b/this.spreadWidth)+1,this.page(c))},EPUBJS.Renderer.prototype.beforeDisplay=function(a){this.book.triggerHooks("beforeChapterDisplay",a.bind(this),this)},EPUBJS.Renderer.prototype.walk=function(a){for(var b,a,c,d,e,f=a,g=[f],h=1e4,i=0;!b&&g.length;){if(a=g.shift(),this.isElementVisible(a)&&(b=a),!b&&a&&a.childElementCount>0){c=a.children,d=c.length;for(var j=0;d>j;j++)c[j]!=e&&g.push(c[j])}if(!b&&0==g.length&&f&&null!==f.parentNode&&(g.push(f.parentNode),e=f,f=f.parentNode),i++,i>h){console.error("ENDLESS LOOP");break}}return b},EPUBJS.Renderer.prototype.getPageCfi=function(){var a=this.visibileEl;return this.visibileEl=this.findFirstVisible(a),this.visibileEl.id||(this.visibileEl.id="EPUBJS-PAGE-"+this.chapterPos),this.pageIds[this.chapterPos]=this.visibileEl.id,this.epubcfi.generateFragment(this.visibileEl,this.currentChapterCfi)},EPUBJS.Renderer.prototype.gotoCfiFragment=function(a){var b;_.isString(a)&&(a=this.epubcfi.parse(a)),b=this.epubcfi.getElement(a,this.doc),this.pageByElement(b)},EPUBJS.Renderer.prototype.findFirstVisible=function(a){var b,c=a||this.bodyEl;return b=this.walk(c),b?b:a},EPUBJS.Renderer.prototype.isElementVisible=function(a){var b;return a&&"function"==typeof a.getBoundingClientRect&&(b=a.getBoundingClientRect().left,b>=0&&be;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?null:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;d.computed>g&&(d={value:a,computed:g})}),d.value},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return x.isFunction(a)?a:function(b){return b[a]}};x.sortBy=function(a,b,c){var d=B(b);return x.pluck(x.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.indexf;){var h=f+g>>>1;e>c.call(d,a[h])?f=h+1:g=h}return f},x.toArray=function(a){return a?x.isArray(a)?h.call(a):a.length===+a.length?x.map(a,x.identity):x.values(a):[]},x.size=function(a){return null==a?0:a.length===+a.length?a.length:x.keys(a).length},x.first=x.head=x.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return y(a,function(a){x.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(i.apply(d,arguments))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.indexOf(b,a)>=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=h.call(arguments),b=x.max(x.pluck(a,"length")),c=Array(b),d=0;b>d;d++)c[d]=x.pluck(a,""+d);return c},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);d>e;)f[e++]=a,a+=c;return f},x.bind=function(a,b){if(a.bind===w&&w)return w.apply(a,h.call(arguments,1));var c=h.call(arguments,2);return function(){return a.apply(b,c.concat(h.call(arguments)))}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);return 0===b.length&&(b=x.functions(a)),y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},x.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&(b[b.length]=c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var E=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==b+"";case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=E(a[g],b[g],c,d)););}else{var i=a.constructor,k=b.constructor;if(i!==k&&!(x.isFunction(i)&&i instanceof i&&x.isFunction(k)&&k instanceof k))return!1;for(var l in a)if(x.has(a,l)&&(g++,!(h=x.has(b,l)&&E(a[l],b[l],c,d))))break;if(h){for(l in b)if(x.has(b,l)&&!g--)break;h=!g}}return c.pop(),d.pop(),h};x.isEqual=function(a,b){return E(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};F.unescape=x.invert(F.escape);var G={escape:RegExp("["+x.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(F.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(G[a],function(b){return F[a][b]})}}),x.result=function(a,b){if(null==a)return null;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),L.call(this,c.apply(x,a))}})};var H=0;x.uniqueId=function(a){var b=++H+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=RegExp([(c.escape||I).source,(c.interpolate||I).source,(c.evaluate||I).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(K,function(a){return"\\"+J[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var L=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],L.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return L.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){"use strict";function b(a,b){f.async(function(){a.trigger("promise:resolved",{detail:b}),a.isResolved=!0,a.resolvedValue=b})}function c(a,b){f.async(function(){a.trigger("promise:failed",{detail:b}),a.isRejected=!0,a.rejectedValue=b})}function d(a){var b,c=[],d=new p,e=a.length;0===e&&d.resolve([]);var f=function(a){return function(b){g(a,b)}},g=function(a,b){c[a]=b,0===--e&&d.resolve(c)},h=function(a){d.reject(a)};for(b=0;e>b;b++)a[b].then(f(b),h);return d}function e(a,b){f[a]=b}var f={},g="undefined"!=typeof window?window:{},h=g.MutationObserver||g.WebKitMutationObserver;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))f.async=function(a,b){process.nextTick(function(){a.call(b)})};else if(h){var i=[],j=new h(function(){var a=i.slice();i=[],a.forEach(function(a){var b=a[0],c=a[1];b.call(c)})}),k=document.createElement("div");j.observe(k,{attributes:!0}),window.addEventListener("unload",function(){j.disconnect(),j=null}),f.async=function(a,b){i.push([a,b]),k.setAttribute("drainQueue","drainQueue")}}else f.async=function(a,b){setTimeout(function(){a.call(b)},1)};var l=function(a,b){this.type=a;for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])},m=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c][0]===b)return c;return-1},n=function(a){var b=a._promiseCallbacks;return b||(b=a._promiseCallbacks={}),b},o={mixin:function(a){return a.on=this.on,a.off=this.off,a.trigger=this.trigger,a},on:function(a,b,c){var d,e,f=n(this);for(a=a.split(/\s+/),c=c||this;e=a.shift();)d=f[e],d||(d=f[e]=[]),-1===m(d,b)&&d.push([b,c])},off:function(a,b){var c,d,e,f=n(this);for(a=a.split(/\s+/);d=a.shift();)b?(c=f[d],e=m(c,b),-1!==e&&c.splice(e,1)):f[d]=[]},trigger:function(a,b){var c,d,e,f,g,h=n(this);if(c=h[a])for(var i=0,j=c.length;j>i;i++)d=c[i],e=d[0],f=d[1],"object"!=typeof b&&(b={detail:b}),g=new l(a,b),e.call(f,g)}},p=function(){this.on("promise:resolved",function(a){this.trigger("success",{detail:a.detail})},this),this.on("promise:failed",function(a){this.trigger("error",{detail:a.detail})},this)},q=function(){},r=function(a,b,c,d){var e,f,g,h,i="function"==typeof c;if(i)try{e=c(d.detail),g=!0}catch(j){h=!0,f=j}else e=d.detail,g=!0;e&&"function"==typeof e.then?e.then(function(a){b.resolve(a)},function(a){b.reject(a)}):i&&g?b.resolve(e):h?b.reject(f):b[a](e)};p.prototype={then:function(a,b){var c=new p;return this.isResolved&&f.async(function(){r("resolve",c,a,{detail:this.resolvedValue})},this),this.isRejected&&f.async(function(){r("reject",c,b,{detail:this.rejectedValue})},this),this.on("promise:resolved",function(b){r("resolve",c,a,b)}),this.on("promise:failed",function(a){r("reject",c,b,a)}),c},resolve:function(a){b(this,a),this.resolve=q,this.reject=q},reject:function(a){c(this,a),this.resolve=q,this.reject=q}},o.mixin(p.prototype),a.Promise=p,a.Event=l,a.EventTarget=o,a.all=d,a.configure=e}(window.RSVP={});var EPUBJS=EPUBJS||{};EPUBJS.VERSION="0.1.5",EPUBJS.plugins=EPUBJS.plugins||{},EPUBJS.filePath=EPUBJS.filePath||"/epubjs/",EPUBJS.Book=function(a,b){var c=this;this.settings=_.defaults(b||{},{storage:!1,fromStorage:!1,saved:!1,online:!0,contained:!1,width:!1,height:!1,spreads:!0,fixedLayout:!1,responsive:!0,version:1,restore:!1,reload:!1,styles:{}}),this.settings.EPUBJSVERSION=EPUBJS.VERSION,this.spinePos=0,this.stored=!1,this.hooks={beforeChapterDisplay:[]},this.getHooks(),this.online=this.settings.online||navigator.onLine,this.networkListeners(),0!=this.settings.storage&&(this.storage=new fileStorage.storage(this.settings.storage)),this.ready={manifest:new RSVP.Promise,spine:new RSVP.Promise,metadata:new RSVP.Promise,cover:new RSVP.Promise,toc:new RSVP.Promise},this.ready.all=RSVP.all(_.values(this.ready)),this.ready.all.then(function(){this.trigger("book:ready")}.bind(this)),a&&(this.opened=this.open(a)),window.addEventListener("beforeunload",function(){c.settings.restore&&(c.saveSettings(),c.saveContents()),c.trigger("book:unload")},!1)},EPUBJS.Book.prototype.open=function(a,b){var c,d=this,e=this.isSaved(a);return this.settings.bookPath=a,this.bookUrl=this.urlFrom(a),e&&!b&&this.applySavedSettings(),this.settings.contained||this.isContained(a)?(this.settings.contained=this.contained=!0,this.bookUrl="",c=this.unarchive(a).then(function(){return e&&d.settings.restore&&!b?d.restore():d.unpack()})):c=e&&this.settings.restore&&!b?this.restore():this.unpack(),this.online&&this.settings.storage&&!this.settings.contained&&(this.settings.stored||c.then(d.storeOffline())),c},EPUBJS.Book.prototype.unpack=function(a){var b=this,c=new EPUBJS.Parser,a=a||"META-INF/container.xml";return b.loadXml(b.bookUrl+a).then(function(a){return c.container(a)}).then(function(a){return b.settings.contentsPath=b.bookUrl+a.basePath,b.settings.packageUrl=b.bookUrl+a.packagePath,b.loadXml(b.settings.packageUrl)}).then(function(a){return c.package(a,b.settings.contentsPath)}).then(function(a){return b.contents=a,b.manifest=b.contents.manifest,b.spine=b.contents.spine,b.spineIndexByURL=b.contents.spineIndexByURL,b.metadata=b.contents.metadata,b.cover=b.contents.cover=b.settings.contentsPath+a.coverPath,b.spineNodeIndex=b.contents.spineNodeIndex=a.spineNodeIndex,b.ready.manifest.resolve(b.contents.manifest),b.ready.spine.resolve(b.contents.spine),b.ready.metadata.resolve(b.contents.metadata),b.ready.cover.resolve(b.contents.cover),b.settings.tocUrl=b.settings.contentsPath+a.tocPath,b.loadXml(b.settings.tocUrl)}).then(function(a){return c.toc(a)}).then(function(a){b.toc=b.contents.toc=a,b.ready.toc.resolve(b.contents.toc)}).then(null,function(a){console.error(a)})},EPUBJS.Book.prototype.getMetadata=function(){return this.ready.metadata},EPUBJS.Book.prototype.getToc=function(){return this.ready.toc},EPUBJS.Book.prototype.networkListeners=function(){var a=this;window.addEventListener("offline",function(){a.online=!1,a.trigger("book:offline")},!1),window.addEventListener("online",function(){a.online=!0,a.trigger("book:online")},!1)},EPUBJS.Book.prototype.loadXml=function(a){return this.settings.fromStorage?this.storage.getXml(a):this.settings.contained?this.zip.getXml(a):EPUBJS.core.request(a,"xml")},EPUBJS.Book.prototype.urlFrom=function(a){var b=-1!=a.search("://"),c="/"==a[0],d=window.location,e=d.origin||d.protocol+"//"+d.host;return b?a:!b&&c?e+a:b||c?void 0:e+EPUBJS.core.folder(d.pathname)+a},EPUBJS.Book.prototype.unarchive=function(a){return this.zip=new EPUBJS.Unarchiver,this.zip.openZip(a)},EPUBJS.Book.prototype.isContained=function(a){var b=a.lastIndexOf("."),c=a.slice(b+1);return!c||"epub"!=c&&"zip"!=c?!1:!0},EPUBJS.Book.prototype.isSaved=function(a){var b=a+":"+this.settings.version,c=localStorage.getItem(b);return localStorage&&null!==c?!0:!1},EPUBJS.Book.prototype.removeSavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;localStorage.removeItem(a),this.settings.stored=!1},EPUBJS.Book.prototype.applySavedSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;return stored=JSON.parse(localStorage.getItem(a)),EPUBJS.VERSION!=stored.EPUBJSVERSION?!1:(this.settings=_.defaults(this.settings,stored),void 0)},EPUBJS.Book.prototype.saveSettings=function(){var a=this.settings.bookPath+":"+this.settings.version;this.render&&(this.settings.previousLocationCfi=this.render.currentLocationCfi),localStorage.setItem(a,JSON.stringify(this.settings))},EPUBJS.Book.prototype.saveContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.setItem(a,JSON.stringify(this.contents))},EPUBJS.Book.prototype.removeSavedContents=function(){var a=this.settings.bookPath+":contents:"+this.settings.version;localStorage.removeItem(a)},EPUBJS.Book.prototype.renderTo=function(a){var b=this;if(_.isElement(a))this.element=a;else{if("string"!=typeof a)return console.error("Not an Element"),void 0;this.element=EPUBJS.core.getEl(a)}return this.opened.then(function(){return b.render=new EPUBJS.Renderer(b),b.startDisplay()})},EPUBJS.Book.prototype.startDisplay=function(){var a;return a=this.settings.restore&&this.settings.previousLocationCfi?this.displayChapter(this.settings.previousLocationCfi):this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.restore=function(a){var b=this,c=this.settings.bookPath+":contents:"+this.settings.version,d=new RSVP.Promise,e=["manifest","spine","metadata","cover","toc","spineNodeIndex","spineIndexByURL"],a=a||!1,f=localStorage.getItem(c);return this.settings.clearSaved&&(a=!0),a||"undefined"==f||"null"==f||(this.contents=JSON.parse(f),e.forEach(function(c){b[c]=b.contents[c],b[c]||(a=!0)})),!a&&f&&this.contents&&this.settings.contentsPath?(this.ready.manifest.resolve(this.manifest),this.ready.spine.resolve(this.spine),this.ready.metadata.resolve(this.metadata),this.ready.cover.resolve(this.cover),this.ready.toc.resolve(this.toc),d.resolve(),d):this.open(this.settings.bookPath,!0)},EPUBJS.Book.prototype.displayChapter=function(a,b){var c,d,e,f=this;return _.isNumber(a)?e=a:(d=new EPUBJS.EpubCFI(a),e=d.spinePos),e>=this.spine.length?!1:0>e?!1:(this.spinePos=e,this.chapter=new EPUBJS.Chapter(this.spine[e]),c=f.render.chapter(this.chapter),d?c.then(function(b){b.currentLocationCfi=a,b.gotoCfiFragment(d)}):b&&c.then(function(a){a.gotoChapterEnd()}),this.settings.fromStorage||this.settings.contained||c.then(function(){f.preloadNextChapter()}),c)},EPUBJS.Book.prototype.nextPage=function(){var a=this.render.nextPage();return a?void 0:this.nextChapter()},EPUBJS.Book.prototype.prevPage=function(){var a=this.render.prevPage();return a?void 0:this.prevChapter()},EPUBJS.Book.prototype.nextChapter=function(){return this.spinePos++,this.displayChapter(this.spinePos)},EPUBJS.Book.prototype.prevChapter=function(){return this.spinePos--,this.displayChapter(this.spinePos,!0)},EPUBJS.Book.prototype.goto=function(a){var b,c=a.split("#"),d=c[0],e=c[1]||!1,f=-1==d.search("://")?this.settings.contentsPath+d:d,g=this.spineIndexByURL[f];return d||(g=this.chapter.spinePos),"number"!=typeof g?!1:g==this.chapter.spinePos&&this.chapter?(e&&this.render.section(e),(new RSVP.Promise).resolve(this.currentChapter)):this.displayChapter(g).then(function(){e&&b.render.section(e)})},EPUBJS.Book.prototype.preloadNextChapter=function(){return document.createElement("iframe"),this.spinePos>=this.spine.length?!1:(next=new EPUBJS.Chapter(this.spine[this.spinePos+1]),EPUBJS.core.request(next.href),void 0)},EPUBJS.Book.prototype.storeOffline=function(){var a=this,b=_.values(this.manifest);return EPUBJS.storage.batch(b).then(function(){a.settings.stored=!0,a.trigger("book:stored")})},EPUBJS.Book.prototype.availableOffline=function(){return this.settings.stored>0?!0:!1},EPUBJS.Book.prototype.setStyle=function(a,b,c){this.render.setStyle(a,b,c),this.settings.styles[a]=b},EPUBJS.Book.prototype.removeStyle=function(a){this.render.removeStyle(a),delete this.settings.styles[a]},EPUBJS.Book.prototype.getHooks=function(){var a,b=this;plugTypes=_.values(this.hooks);for(plugType in this.hooks)a=_.values(EPUBJS.Hooks[plugType]),a.forEach(function(a){b.registerHook(plugType,a)})},EPUBJS.Book.prototype.registerHook=function(a,b,c){var d=this;"undefined"!=typeof this.hooks[a]?"function"==typeof b?c?this.hooks[a].unshift(b):this.hooks[a].push(b):Array.isArray(b)&&b.forEach(function(b){c?d.hooks[a].unshift(b):d.hooks[a].push(b)}):this.hooks[a]=[func]},EPUBJS.Book.prototype.triggerHooks=function(a,b,c){function d(){f--,0>=f&&b&&b()}var e,f;return"undefined"==typeof this.hooks[a]?!1:(e=this.hooks[a],f=e.length,e.forEach(function(a){a(d,c)}),void 0)},RSVP.EventTarget.mixin(EPUBJS.Book.prototype),EPUBJS.Chapter=function(a){this.href=a.href,this.id=a.id,this.spinePos=a.index,this.properties=a.properties,this.linear=a.linear,this.pages=1},EPUBJS.Chapter.prototype.contents=function(a){return a?a.get(href):EPUBJS.core.request(href,"xml")},EPUBJS.Chapter.prototype.url=function(a){var b=new RSVP.Promise;return a?(this.tempUrl||(this.tempUrl=a.getUrl(this.href)),this.tempUrl):(b.resolve(this.href),b)},EPUBJS.Chapter.prototype.setPages=function(a){this.pages=a},EPUBJS.Chapter.prototype.getPages=function(){return this.pages},EPUBJS.Chapter.prototype.getID=function(){return this.ID},EPUBJS.Chapter.prototype.unload=function(a){this.tempUrl&&a&&(a.revokeUrl(this.tempUrl),this.tempUrl=!1)};var EPUBJS=EPUBJS||{};EPUBJS.core={},EPUBJS.core.getEl=function(a){return document.getElementById(a)},EPUBJS.core.getEls=function(a){return document.getElementsByClassName(a)},EPUBJS.core.request=function(a,b){function c(){if(this.readyState===this.DONE)if(200===this.status||this.responseXML){var a;a="xml"==b?this.responseXML:"json"==b?JSON.parse(this.response):this.response,d.resolve(a)}else d.reject(this)}var d=new RSVP.Promise,e=new XMLHttpRequest;return e.open("GET",a),e.onreadystatechange=c,"blob"==b&&(e.responseType=b),"json"==b&&e.setRequestHeader("Accept","application/json"),"xml"==b&&e.overrideMimeType("text/xml"),e.send(),d},EPUBJS.core.toArray=function(a){var b=[];for(member in a){var c;a.hasOwnProperty(member)&&(c=a[member],c.ident=member,b.push(c))}return b},EPUBJS.core.folder=function(a){var b=a.lastIndexOf("/"),c=a.slice(0,b+1);return-1==b&&(c=""),c},EPUBJS.core.dataURLToBlob=function(a){var b=";base64,";if(-1==a.indexOf(b)){var c=a.split(","),d=c[0].split(":")[1],e=c[1];return new Blob([e],{type:d})}for(var c=a.split(b),d=c[0].split(":")[1],e=window.atob(c[1]),f=e.length,g=new Uint8Array(f),h=0;f>h;++h)g[h]=e.charCodeAt(h);return new Blob([g],{type:d})},EPUBJS.core.addScript=function(a,b,c){var d,e;e=!1,d=document.createElement("script"),d.type="text/javascript",d.async=!1,d.src=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.addScripts=function(a,b,c){var d=a.length,e=0,f=function(){e++,d==e?b&&b():EPUBJS.core.loadScript(a[e],f,c)};EPUBJS.core.addScript(a[e],f,c)},EPUBJS.core.addCss=function(a,b,c){var d,e;e=!1,d=document.createElement("link"),d.type="text/css",d.rel="stylesheet",d.href=a,d.onload=d.onreadystatechange=function(){e||this.readyState&&"complete"!=this.readyState||(e=!0,b&&b())},c=c||document.body,c.appendChild(d)},EPUBJS.core.prefixed=function(a){var b=["Webkit","Moz","O","ms"],c=a[0].toUpperCase()+a.slice(1),d=b.length,e=0;if("undefined"!=typeof document.body.style[a])return a;for(;d>e;e++)if("undefined"!=typeof document.body.style[b[e]+c])return b[e]+c;return a},EPUBJS.core.resolveUrl=function(a,b){var c,d,e=[],f=a.split("/");return f.pop(),d=b.split("/"),d.forEach(function(a){".."===a?f.pop():e.push(a)}),c=f.concat(e),c.join("/")},EPUBJS.EpubCFI=function(a){return a?this.parse(a):void 0},EPUBJS.EpubCFI.prototype.generateChapter=function(a,b,c){var b=parseInt(b),a=a+1,d="/"+a+"/";return d+=2*(b+1),c&&(d+="["+c+"]"),d+="!"},EPUBJS.EpubCFI.prototype.generateFragment=function(a,b){var c=this.pathTo(a),d=[];return b&&d.push(b),c.forEach(function(a){d.push(2*(a.index+1)),a.id&&"EPUBJS"!=a.id.slice(0,6)&&d.push("["+a.id+"]")}),d.join("/")},EPUBJS.EpubCFI.prototype.pathTo=function(a){for(var b,c=[];a&&null!==a.parentNode;)b=a.parentNode.children,c.unshift({id:a.id,tagName:a.tagName,index:b?Array.prototype.indexOf.call(b,a):0}),a=a.parentNode;return c},EPUBJS.EpubCFI.prototype.getChapter=function(a){var b=a.split("!");return b[0]},EPUBJS.EpubCFI.prototype.getFragment=function(a){var b=a.split("!");return b[1]},EPUBJS.EpubCFI.prototype.getOffset=function(a){var b=a.split(":");return[b[0],b[1]]},EPUBJS.EpubCFI.prototype.parse=function(a){var b,c,d,e,f={};return f.chapter=this.getChapter(a),f.fragment=this.getFragment(a),f.spinePos=parseInt(f.chapter.split("/")[2])/2-1||0,b=f.chapter.match(/\[(.*)\]/),f.spineId=b[1]||!1,c=f.fragment.split("/"),d=c[c.length-1],f.sections=[],parseInt(d)%2&&(e=this.getOffset(),f.text=parseInt(e[0]),f.character=parseInt(e[1]),c.pop()),c.forEach(function(a){var b,c,d;a&&(b=parseInt(a)/2-1,c=a.match(/\[(.*)\]/),c&&c[1]&&(d=c[1]),f.sections.push({index:b,id:d||!1}))}),f},EPUBJS.EpubCFI.prototype.getElement=function(a,b){var c,b=b||document,d=a.sections,e=b.getElementsByTagName("html")[0],f=Array.prototype.slice.call(e.children);for(d.shift();d.length>0;)c=d.shift(),c.id?e=b.querySelector("#"+c.id):(e=f[c.index],f||console.error("No Kids",e)),e||console.error("No Element For",c),f=Array.prototype.slice.call(e.children);return e},EPUBJS.Events=function(a,b){return this.events={},this.el=b?b:document.createElement("div"),a.createEvent=this.createEvent,a.tell=this.tell,a.listen=this.listen,a.deafen=this.deafen,a.listenUntil=this.listenUntil,this},EPUBJS.Events.prototype.createEvent=function(a){var b=new CustomEvent(a);return this.events[a]=b,b},EPUBJS.Events.prototype.tell=function(a,b){var c;this.events[a]?c=this.events[a]:(console.warn("No event:",a,"defined yet, creating."),c=this.createEvent(a)),b&&(c.msg=b),this.el.dispatchEvent(c)},EPUBJS.Events.prototype.listen=function(a,b,c){return this.events[a]?(c?this.el.addEventListener(a,b.bind(c),!1):this.el.addEventListener(a,b,!1),void 0):(console.warn("No event:",a,"defined yet, creating."),this.createEvent(a),void 0)},EPUBJS.Events.prototype.deafen=function(a,b){this.el.removeEventListener(a,b,!1)},EPUBJS.Events.prototype.listenUntil=function(a,b,c,d){function e(){this.deafen(a,c),this.deafen(b,e)}this.listen(a,c,d),this.listen(b,e,this)},EPUBJS.Hooks=function(){"use strict";return{register:function(a){if(void 0===this[a]&&(this[a]={}),"object"!=typeof this[a])throw"Already registered: "+a;return this[a]}}}(),EPUBJS.Parser=function(a){this.baseUrl=a||""},EPUBJS.Parser.prototype.container=function(a){var b=a.querySelector("rootfile"),c=b.getAttribute("full-path"),d=EPUBJS.core.folder(c);return{packagePath:c,basePath:d}},EPUBJS.Parser.prototype.package=function(a,b){var c=this;b&&(this.baseUrl=b);var d=a.querySelector("metadata"),e=a.querySelector("manifest"),f=a.querySelector("spine"),g=c.manifest(e),h=c.findTocPath(e),i=c.findCoverPath(e),j=Array.prototype.indexOf.call(f.parentNode.childNodes,f),k=c.spine(f,g),l={};return k.forEach(function(a){l[a.href]=a.index}),{metadata:c.metadata(d),spine:k,manifest:g,tocPath:h,coverPath:i,spineNodeIndex:j,spineIndexByURL:l}},EPUBJS.Parser.prototype.findTocPath=function(a){var b=a.querySelector("item[media-type='application/x-dtbncx+xml']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.findCoverPath=function(a){var b=a.querySelector("item[properties='cover-image']");return b?b.getAttribute("href"):!1},EPUBJS.Parser.prototype.metadata=function(a){var b={},c=this;return b.bookTitle=c.getElementText(a,"title"),b.creator=c.getElementText(a,"creator"),b.description=c.getElementText(a,"description"),b.pubdate=c.getElementText(a,"date"),b.publisher=c.getElementText(a,"publisher"),b.identifier=c.getElementText(a,"identifier"),b.language=c.getElementText(a,"language"),b.rights=c.getElementText(a,"rights"),b.modified_date=c.querySelectorText(a,"meta[property='dcterms:modified']"),b.layout=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.orientation=c.querySelectorText(a,"meta[property='rendition:orientation']"),b.spread=c.querySelectorText(a,"meta[property='rendition:spread']"),b +},EPUBJS.Parser.prototype.getElementText=function(a,b){var c,d=a.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",b);return d&&0!=d.length?(c=d[0],c.childNodes.length?c.childNodes[0].nodeValue:""):""},EPUBJS.Parser.prototype.querySelectorText=function(a,b){var c=a.querySelector(b);return c&&c.childNodes.length?c.childNodes[0].nodeValue:""},EPUBJS.Parser.prototype.manifest=function(a){var b=this.baseUrl,c={},d=a.querySelectorAll("item"),e=Array.prototype.slice.call(d);return e.forEach(function(a){var d=a.getAttribute("id"),e=a.getAttribute("href")||"",f=a.getAttribute("media-type")||"";c[d]={href:b+e,type:f}}),c},EPUBJS.Parser.prototype.spine=function(a,b){var c=[],d=a.getElementsByTagName("itemref"),e=Array.prototype.slice.call(d);return e.forEach(function(a,d){var e=a.getAttribute("idref"),f={id:e,linear:a.getAttribute("linear")||"",properties:a.getAttribute("properties")||"",href:b[e].href,index:d};c.push(f)}),c},EPUBJS.Parser.prototype.toc=function(a){function b(a){var c,d=[],e=[],f=a.childNodes,g=Array.prototype.slice.call(f),h=g.length,i=h;if(0==h)return!1;for(;i--;)c=g[i],"navPoint"===c.nodeName&&e.push(c);return e.forEach(function(a){var c=a.getAttribute("id"),e=a.querySelector("content"),f=e.getAttribute("src"),g=(f.split("#"),a.querySelector("navLabel")),h=g.textContent?g.textContent:"",i=b(a);d.unshift({id:c,href:f,label:h,subitems:i})}),d}var c=a.querySelector("navMap");return b(c)},EPUBJS.Renderer=function(a){this.el=a.element,this.book=a,this.settings=a.settings,a.registerHook("beforeChapterDisplay",[this.replaceLinks.bind(this),this.replaceResources.bind(this),this.replaceHead.bind(this)],!0),this.crossBrowserColumnCss(),this.epubcfi=new EPUBJS.EpubCFI,this.initialize(),this.listeners()},EPUBJS.Renderer.prototype.initialize=function(){this.iframe=document.createElement("iframe"),this.settings.width||this.settings.height?this.resizeIframe(!1,this.settings.width||this.el.clientWidth,this.settings.height||this.el.clientHeight):(this.resizeIframe(!1,this.el.clientWidth,this.el.clientHeight),this.on("renderer:resized",this.resizeIframe,this)),this.el.appendChild(this.iframe)},EPUBJS.Renderer.prototype.listeners=function(){this.resized=_.debounce(this.onResized.bind(this),10),window.addEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.chapter=function(a){var b=this,c=!1;return this.book.settings.contained&&(c=this.book.zip),this.currentChapter&&(this.currentChapter.unload(),this.trigger("renderer:chapterUnloaded"),this.book.trigger("renderer:chapterUnloaded")),this.currentChapter=a,this.chapterPos=1,this.pageIds={},this.leftPos=0,this.currentChapterCfi=this.epubcfi.generateChapter(this.book.spineNodeIndex,a.spinePos,a.id),this.visibileEl=!1,a.url(c).then(function(a){return b.setIframeSrc(a)})},EPUBJS.Renderer.prototype.onResized=function(){var a={width:this.el.clientWidth,height:this.el.clientHeight};this.trigger("renderer:resized",a),this.book.trigger("book:resized",a),this.reformat()},EPUBJS.Renderer.prototype.reformat=function(){var a=this;a.book.settings.fixedLayout?a.fixedLayout():a.formatSpread(),setTimeout(function(){a.calcPages(),a.currentLocationCfi&&a.gotoCfiFragment(a.currentLocationCfi)},10)},EPUBJS.Renderer.prototype.destroy=function(){window.removeEventListener("resize",this.resized,!1)},EPUBJS.Renderer.prototype.resizeIframe=function(a,b,c){var d,e;a?(d=a.width,e=a.height):(d=b,e=c),this.iframe.height=e,0!=d%2&&(d+=1),this.iframe.width=d},EPUBJS.Renderer.prototype.crossBrowserColumnCss=function(){EPUBJS.Renderer.columnAxis=EPUBJS.core.prefixed("columnAxis"),EPUBJS.Renderer.columnGap=EPUBJS.core.prefixed("columnGap"),EPUBJS.Renderer.columnWidth=EPUBJS.core.prefixed("columnWidth"),EPUBJS.Renderer.transform=EPUBJS.core.prefixed("transform")},EPUBJS.Renderer.prototype.setIframeSrc=function(a){var b=this,c=new RSVP.Promise;return this.visible(!1),this.iframe.src=a,this.iframe.onload=function(){b.doc=b.iframe.contentDocument,b.docEl=b.doc.documentElement,b.bodyEl=b.doc.body,b.applyStyles(),b.book.settings.fixedLayout?b.fixedLayout():b.formatSpread(),b.beforeDisplay(function(){b.calcPages(),c.resolve(b),b.currentLocationCfi=b.getPageCfi(),b.trigger("renderer:chapterDisplayed",b.currentChapter),b.book.trigger("renderer:chapterDisplayed",b.currentChapter),b.visible(!0)})},c},EPUBJS.Renderer.prototype.formatSpread=function(){var a=2,b=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),this.currentLocationCfi=this.getPageCfi(),this.book.trigger("book:pageChanged",this.currentLocationCfi),this.chapterPos):!1},EPUBJS.Renderer.prototype.chapterEnd=function(){this.page(this.displayedPages),this.currentLocationCfi=this.getPageCfi()},EPUBJS.Renderer.prototype.setLeft=function(a){this.doc.defaultView.scrollTo(a,0)},EPUBJS.Renderer.prototype.replace=function(a,b,c){var d,e,f;d=this.doc.querySelectorAll(a),e=Array.prototype.slice.call(d),f=e.length,e.forEach(function(a){b(a,function(){f--,0>=f&&c&&c()})}.bind(this)),0===f&&c()},EPUBJS.Renderer.prototype.determineStore=function(){return this.book.fromStorage?"filesystem"==this.book.storage.getStorageType()?!1:this.book.store:this.book.contained?this.book.zip:!1},EPUBJS.Renderer.prototype.replaceHead=function(a){var b,c,d,e,f={},g=this,h=this.determineStore(),i=function(a,b){a.setAttribute("href",b),a.onload=function(){d--,0>=d&&j()}},j=function(){a&&a(),_.each(e,function(a){h.revokeUrl(a)}),g.urlCache=f};return h?(b=this.doc.head.querySelectorAll("[href]"),c=Array.prototype.slice.call(b),d=c.length,this.urlCache||(this.urlCache={}),e=_.clone(this.urlCache),c.forEach(function(a){var b=a.getAttribute("href"),c=this.book.settings.contentsPath+b;c in e?(i(a,e[c]),f[c]=e[c],delete e[c]):"stylesheet"===a.getAttribute("rel")?h.getText(c).then(function(b){g.replaceUrlsInCss(c,b).then(function(b){var d=window.URL||window.webkitURL||window.mozURL,e=new Blob([b],{type:"text/css"}),g=d.createObjectURL(e);i(a,g),f[c]=g},function(a){console.error(a)})}):h.getUrl(c).then(function(b){i(a,b),f[c]=b})}.bind(this)),0===d&&j(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.replaceUrlsInCss=function(a,b){var c=new RSVP.Promise,d=[],e=this.determineStore(),f=b.match(/url\(\'?\"?([^\'|^\"]*)\'?\"?\)/g);return f?(f.forEach(function(c){var f=EPUBJS.core.resolveUrl(a,c.replace(/url\(|[|\)|\'|\"]/g,""));replaced=e.getUrl(f).then(function(a){b=b.replace(c,'url("'+a+'")')},function(a){console.error(a)}),d.push(replaced)}),RSVP.all(d).then(function(){c.resolve(b)}),c):(c.resolve(b),c)},EPUBJS.Renderer.prototype.replaceLinks=function(a){var b=this.doc.querySelectorAll("a"),c=Array.prototype.slice.call(b),d=this;c.forEach(function(a){var b,c,e=a.getAttribute("href");e&&(b=e.search("://"),c="#"==e[0],-1!=b?a.setAttribute("target","_blank"):a.onclick=function(){return d.book.goto(e),!1})}),a&&a()},EPUBJS.Renderer.prototype.replaceResources=function(a){var b,c,d,e=this.determineStore();return e?(b=this.doc.querySelectorAll("[src]"),c=Array.prototype.slice.call(b),d=c.length,c.forEach(function(b){var c=b.getAttribute("src"),f=this.book.settings.contentsPath+c;e.getUrl(f).then(function(c){b.src=c,b.onload=function(){d--,0>=d&&a&&a()}})}.bind(this)),0===d&&a(),void 0):(a&&a(),!1)},EPUBJS.Renderer.prototype.page=function(a){return a>=1&&a<=this.displayedPages?(this.chapterPos=a,this.leftPos=this.spreadWidth*(a-1),this.setLeft(this.leftPos),!0):!1},EPUBJS.Renderer.prototype.section=function(a){var b=this.doc.getElementById(a);b&&this.pageByElement(b)},EPUBJS.Renderer.prototype.pageByElement=function(a){var b,c;a&&(b=this.leftPos+a.getBoundingClientRect().left,c=Math.floor(b/this.spreadWidth)+1,this.page(c))},EPUBJS.Renderer.prototype.beforeDisplay=function(a){this.book.triggerHooks("beforeChapterDisplay",a.bind(this),this)},EPUBJS.Renderer.prototype.walk=function(a){for(var b,a,c,d,e,f=a,g=[f],h=1e4,i=0;!b&&g.length;){if(a=g.shift(),this.isElementVisible(a)&&(b=a),!b&&a&&a.childElementCount>0){c=a.children,d=c.length;for(var j=0;d>j;j++)c[j]!=e&&g.push(c[j])}if(!b&&0==g.length&&f&&null!==f.parentNode&&(g.push(f.parentNode),e=f,f=f.parentNode),i++,i>h){console.error("ENDLESS LOOP");break}}return b},EPUBJS.Renderer.prototype.getPageCfi=function(){var a=this.visibileEl;return this.visibileEl=this.findFirstVisible(a),this.visibileEl.id||(this.visibileEl.id="EPUBJS-PAGE-"+this.chapterPos),this.pageIds[this.chapterPos]=this.visibileEl.id,this.epubcfi.generateFragment(this.visibileEl,this.currentChapterCfi)},EPUBJS.Renderer.prototype.gotoCfiFragment=function(a){var b;_.isString(a)&&(a=this.epubcfi.parse(a)),b=this.epubcfi.getElement(a,this.doc),this.pageByElement(b)},EPUBJS.Renderer.prototype.findFirstVisible=function(a){var b,c=a||this.bodyEl;return b=this.walk(c),b?b:a},EPUBJS.Renderer.prototype.isElementVisible=function(a){var b;return a&&"function"==typeof a.getBoundingClientRect&&(b=a.getBoundingClientRect().left,b>=0&&b - + diff --git a/examples/basic.html b/examples/basic.html index e959bbf..8fe87c4 100644 --- a/examples/basic.html +++ b/examples/basic.html @@ -10,7 +10,7 @@ - + -
- - - diff --git a/examples/polymer/epub-reader.html b/examples/polymer/epub-reader.html deleted file mode 100644 index 213976e..0000000 --- a/examples/polymer/epub-reader.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - diff --git a/examples/polymer/epub-reader/assets/add.png b/examples/polymer/epub-reader/assets/add.png new file mode 100644 index 0000000..aab6ab5 Binary files /dev/null and b/examples/polymer/epub-reader/assets/add.png differ diff --git a/examples/polymer/epub-reader/assets/fullscreen.png b/examples/polymer/epub-reader/assets/fullscreen.png new file mode 100755 index 0000000..e4fcbb6 Binary files /dev/null and b/examples/polymer/epub-reader/assets/fullscreen.png differ diff --git a/examples/polymer/epub-reader/assets/settings.png b/examples/polymer/epub-reader/assets/settings.png new file mode 100644 index 0000000..42288a0 Binary files /dev/null and b/examples/polymer/epub-reader/assets/settings.png differ diff --git a/examples/polymer/epub-reader/epub-controls.html b/examples/polymer/epub-reader/epub-controls.html new file mode 100644 index 0000000..2014409 --- /dev/null +++ b/examples/polymer/epub-reader/epub-controls.html @@ -0,0 +1,53 @@ + + + + diff --git a/examples/polymer/epub-reader/epub-js.html b/examples/polymer/epub-reader/epub-js.html new file mode 100644 index 0000000..c10eca6 --- /dev/null +++ b/examples/polymer/epub-reader/epub-js.html @@ -0,0 +1,108 @@ + + + + + + + + diff --git a/examples/polymer/epub-reader/epub-reader.html b/examples/polymer/epub-reader/epub-reader.html new file mode 100644 index 0000000..2958c5d --- /dev/null +++ b/examples/polymer/epub-reader/epub-reader.html @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + diff --git a/examples/polymer/epub-settings.html b/examples/polymer/epub-reader/epub-settings.html similarity index 100% rename from examples/polymer/epub-settings.html rename to examples/polymer/epub-reader/epub-settings.html diff --git a/examples/polymer/epub-reader/epub-sidebar.html b/examples/polymer/epub-reader/epub-sidebar.html new file mode 100644 index 0000000..87f87cd --- /dev/null +++ b/examples/polymer/epub-reader/epub-sidebar.html @@ -0,0 +1,38 @@ + + + + + + + + diff --git a/examples/polymer/epub-reader/epub-titlebar.html b/examples/polymer/epub-reader/epub-titlebar.html new file mode 100644 index 0000000..4ced939 --- /dev/null +++ b/examples/polymer/epub-reader/epub-titlebar.html @@ -0,0 +1,44 @@ + + + + diff --git a/examples/polymer/epub-reader/epub-toc.html b/examples/polymer/epub-reader/epub-toc.html new file mode 100644 index 0000000..fd7f5f7 --- /dev/null +++ b/examples/polymer/epub-reader/epub-toc.html @@ -0,0 +1,144 @@ + + + + + + + diff --git a/examples/polymer/epub-viewer.html b/examples/polymer/epub-reader/epub-viewer.html similarity index 60% rename from examples/polymer/epub-viewer.html rename to examples/polymer/epub-reader/epub-viewer.html index d18fea1..c0f9137 100644 --- a/examples/polymer/epub-viewer.html +++ b/examples/polymer/epub-reader/epub-viewer.html @@ -36,7 +36,8 @@ .arrow:hover { color: #777; } - + + .arrow.active, .arrow:active { color: #000; } @@ -45,7 +46,7 @@ position: absolute; width: 1px; border-right: 1px #000 solid; - height: 80%; + height: 82%; z-index: 1; left: 50%; top: 10%; @@ -66,28 +67,30 @@ margin: -33px 0 0 -33px; } + +
- + on-book-unloaded="bookUnloaded" > + -
+
- diff --git a/examples/polymer/epub-titlebar.html b/examples/polymer/epub-titlebar.html deleted file mode 100644 index 415b366..0000000 --- a/examples/polymer/epub-titlebar.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/examples/polymer/epub-toc.html b/examples/polymer/epub-toc.html deleted file mode 100644 index 83fff1d..0000000 --- a/examples/polymer/epub-toc.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - diff --git a/examples/polymer/index.html b/examples/polymer/index.html index 538205e..d81f60b 100644 --- a/examples/polymer/index.html +++ b/examples/polymer/index.html @@ -6,15 +6,15 @@ - + - + diff --git a/examples/polymer/polymer-elements/AUTHORS b/examples/polymer/polymer-elements/AUTHORS new file mode 100644 index 0000000..0617765 --- /dev/null +++ b/examples/polymer/polymer-elements/AUTHORS @@ -0,0 +1,9 @@ +# Names should be added to this file with this pattern: +# +# For individuals: +# Name +# +# For organizations: +# Organization +# +Google Inc. <*@google.com> diff --git a/examples/polymer/polymer-elements/LICENSE b/examples/polymer/polymer-elements/LICENSE new file mode 100644 index 0000000..92d60b0 --- /dev/null +++ b/examples/polymer/polymer-elements/LICENSE @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Polymer Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/polymer/polymer-elements/PATENTS b/examples/polymer/polymer-elements/PATENTS new file mode 100644 index 0000000..e120963 --- /dev/null +++ b/examples/polymer/polymer-elements/PATENTS @@ -0,0 +1,23 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Polymer project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Polymer, where such license applies only to those +patent claims, both currently owned or controlled by Google and acquired +in the future, licensable by Google that are necessarily infringed by +this implementation of Polymer. This grant does not include claims +that would be infringed only as a consequence of further modification of +this implementation. If you or your agent or exclusive licensee +institute or order or agree to the institution of patent litigation +against any entity (including a cross-claim or counterclaim in a +lawsuit) alleging that this implementation of Polymer or any code +incorporated within this implementation of Polymer constitutes +direct or contributory patent infringement, or inducement of patent +infringement, then any patent rights granted to you under this License +for this implementation of Polymer shall terminate as of the date +such litigation is filed. diff --git a/examples/polymer/polymer-elements/polymer-ajax/index.html b/examples/polymer/polymer-elements/polymer-ajax/index.html new file mode 100644 index 0000000..d206222 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-ajax/index.html @@ -0,0 +1,30 @@ + + + + polymer-ajax + + + + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-ajax/polymer-ajax.html b/examples/polymer/polymer-elements/polymer-ajax/polymer-ajax.html new file mode 100644 index 0000000..d9ad2b8 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-ajax/polymer-ajax.html @@ -0,0 +1,179 @@ + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-ajax/polymer-xhr.html b/examples/polymer/polymer-elements/polymer-ajax/polymer-xhr.html new file mode 100644 index 0000000..90d058e --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-ajax/polymer-xhr.html @@ -0,0 +1,96 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/index.html b/examples/polymer/polymer-elements/polymer-animation/index.html new file mode 100644 index 0000000..eff2cdf --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/index.html @@ -0,0 +1,86 @@ + + + + Polymer Animation Components + + + + + + + + + + + + +
animated!
+
+ + raw + + + + + + + + raw group + + + + + + + + + + + + + + + + bounce + shake + shake forever + flip X + flip Y + blink + fade in + fade out +
+ + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-animation-group.html b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-group.html new file mode 100644 index 0000000..d371787 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-group.html @@ -0,0 +1,100 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-animation-keyframe.html b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-keyframe.html new file mode 100644 index 0000000..56b9f58 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-keyframe.html @@ -0,0 +1,41 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-animation-prop.html b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-prop.html new file mode 100644 index 0000000..d67a889 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-animation-prop.html @@ -0,0 +1,25 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-animation.html b/examples/polymer/polymer-elements/polymer-animation/polymer-animation.html new file mode 100644 index 0000000..2e9ae28 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-animation.html @@ -0,0 +1,295 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-blink.html b/examples/polymer/polymer-elements/polymer-animation/polymer-blink.html new file mode 100644 index 0000000..b7c348b --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-blink.html @@ -0,0 +1,14 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-bounce.html b/examples/polymer/polymer-elements/polymer-animation/polymer-bounce.html new file mode 100644 index 0000000..58d2d7c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-bounce.html @@ -0,0 +1,31 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-fadein.html b/examples/polymer/polymer-elements/polymer-animation/polymer-fadein.html new file mode 100644 index 0000000..50f09ac --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-fadein.html @@ -0,0 +1,17 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-fadeout.html b/examples/polymer/polymer-elements/polymer-animation/polymer-fadeout.html new file mode 100644 index 0000000..75670dc --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-fadeout.html @@ -0,0 +1,13 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-flip.html b/examples/polymer/polymer-elements/polymer-animation/polymer-flip.html new file mode 100644 index 0000000..fdd91df --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-flip.html @@ -0,0 +1,46 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-shake.html b/examples/polymer/polymer-elements/polymer-animation/polymer-shake.html new file mode 100644 index 0000000..208d0af --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-shake.html @@ -0,0 +1,59 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/polymer-translate.html b/examples/polymer/polymer-elements/polymer-animation/polymer-translate.html new file mode 100644 index 0000000..77ad25a --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/polymer-translate.html @@ -0,0 +1,41 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-animation/web-animations.html b/examples/polymer/polymer-elements/polymer-animation/web-animations.html new file mode 100644 index 0000000..293d224 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-animation/web-animations.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/polymer/polymer-elements/polymer-collapse/index.html b/examples/polymer/polymer-elements/polymer-collapse/index.html new file mode 100644 index 0000000..55115fe --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-collapse/index.html @@ -0,0 +1,52 @@ + + + + polymer-collapse + + + + + +
+ +
+
Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem
+
+ +
+
+ +
+
Coercuit iunctarum vix sic aberant spisso imagine litem cetera nubes ambitae tanta usu circumfuso fulminibus umentia rectumque iuga pluviaque meis semina regat ne campoque meis coeperunt nix cura iunctarum ligavit: secant ventos seductaque permisit sic iunctarum locoque his coeptis tum terras animalia recepta aethera cornua invasit tollere videre tonitrua humanas otia tuba alta dissociata sanctius adsiduis inclusum caesa ita onus sine pluviaque litem manebat fixo extendi ubi inposuit cum sublime membra undas orba forma deducite aethera turba coercuit retinebat obliquis bracchia nisi mentisque origine peregrinum manebat
+
+ +
+
Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem
+
+ +
+
Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem
+
+ +
+
+ +
+
Obstabatque cingebant nitidis rapidisque cepit moderantum discordia habentia frigore solidumque fert inter caecoque sine coeperunt corpore quarum fluminaque coercuit vultus animal austro quem os sectamque animus origo solidumque quoque melioris adspirate recepta utramque rapidisque caelumque orba unus pluviaque erant mutastis gravitate illic quisque alta calidis speciem mixtam ante contraria duae
+
+ +
+ + diff --git a/examples/polymer/polymer-elements/polymer-collapse/polymer-collapse.html b/examples/polymer/polymer-elements/polymer-collapse/polymer-collapse.html new file mode 100644 index 0000000..46478ba --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-collapse/polymer-collapse.html @@ -0,0 +1,188 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-file/index.html b/examples/polymer/polymer-elements/polymer-file/index.html new file mode 100644 index 0000000..bba5f5c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-file/index.html @@ -0,0 +1,27 @@ + + + + polymer-file + + + + + + +

Read result:

+ + + + + diff --git a/examples/polymer/polymer-elements/polymer-file/polymer-file.html b/examples/polymer/polymer-elements/polymer-file/polymer-file.html new file mode 100644 index 0000000..94590d3 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-file/polymer-file.html @@ -0,0 +1,138 @@ + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-flex-layout/index.html b/examples/polymer/polymer-elements/polymer-flex-layout/index.html new file mode 100644 index 0000000..0da82fb --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-flex-layout/index.html @@ -0,0 +1,129 @@ + + + + polymer-flex-layout + + + + + + + + + + + + + + + + + + +

Using CSS class from polymer-flex-layout.css

+ +
+

polymer-flex-layout as a flexbox container

+ +
+

Using polymer-flex-layout to add flexbox behavior to the parent node

+ + + diff --git a/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.css b/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.css new file mode 100644 index 0000000..6b41a08 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.css @@ -0,0 +1,179 @@ +.flexbox { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: -moz-flex !important; + display: -webkit-flex !important; + display: flex !important; +} + +.flexbox.row { + -webkit-box-orient: horizontal; + -ms-flex-direction: row; + -moz-flex-direction: row; + -webkit-flex-direction: row; + flex-direction: row; +} + +.flexbox.column { + -webkit-box-orient: vertical; + -ms-flex-direction: column; + -moz-flex-direction: column; + -webkit-flex-direction: column; + flex-direction: column; +} + +.flex, [flex], [fit] { + -webkit-box-flex: 1; + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; +} + +content::-webkit-distributed(.flex), +content::-webkit-distributed([flex]), +content::-webkit-distributed([fit]) { + -webkit-box-flex: 1; + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; +} + +.flexbox.align-start { + -webkit-box-align: start; + -ms-flex-align: start; + -moz-align-items: flex-start; + -webkit-align-items: flex-start; + align-items: flex-start; +} + +.flexbox.align-end { + -webkit-box-align: end; + -ms-flex-align: end; + -moz-align-items: flex-end; + -webkit-align-items: flex-end; + align-items: flex-end; +} + +.flexbox.align-center { + -webkit-box-align: center; + -ms-flex-align: center; + -moz-align-items: center; + -webkit-align-items: center; + align-items: center; +} + +.flexbox.justify-start { + -webkit-box-pack: start; + -ms-flex-pack: start; + -moz-justify-content: flex-start; + -webkit-justify-content: flex-start; + justify-content: flex-start; +} + +.flexbox.justify-end { + -webkit-box-pack: end; + -ms-flex-pack: end; + -moz-justify-content: flex-end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} + +.flexbox.justify-center { + -webkit-box-pack: center; + -ms-flex-pack: center; + -moz-justify-content: center; + -webkit-justify-content: center; + justify-content: center; +} + +.flexbox.justify-between { + -webkit-box-pack: justify; + -ms-flex-pack: justify; + -moz-justify-content: space-between; + -webkit-justify-content: space-between; + justify-content: space-between; +} + +@host { + .flexbox { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: -moz-flex !important; + display: -webkit-flex !important; + display: flex !important; + } + + .flexbox.row { + -webkit-box-orient: horizontal; + -ms-flex-direction: row; + -moz-flex-direction: row; + -webkit-flex-direction: row; + flex-direction: row; + } + + .flexbox.column { + -webkit-box-orient: vertical; + -ms-flex-direction: column; + -moz-flex-direction: column; + -webkit-flex-direction: column; + flex-direction: column; + } + + .flexbox.align-start { + -webkit-box-align: start; + -ms-flex-align: start; + -moz-align-items: flex-start; + -webkit-align-items: flex-start; + align-items: flex-start; + } + + .flexbox.align-end { + -webkit-box-align: end; + -ms-flex-align: end; + -moz-align-items: flex-end; + -webkit-align-items: flex-end; + align-items: flex-end; + } + + .flexbox.align-center { + -webkit-box-align: center; + -ms-flex-align: center; + -moz-align-items: center; + -webkit-align-items: center; + align-items: center; + } + + .flexbox.justify-start { + -webkit-box-pack: start; + -ms-flex-pack: start; + -moz-justify-content: flex-start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + } + + .flexbox.justify-end { + -webkit-box-pack: end; + -ms-flex-pack: end; + -moz-justify-content: flex-end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + } + + .flexbox.justify-center { + -webkit-box-pack: center; + -ms-flex-pack: center; + -moz-justify-content: center; + -webkit-justify-content: center; + justify-content: center; + } + + .flexbox.justify-between { + -webkit-box-pack: justify; + -ms-flex-pack: justify; + -moz-justify-content: space-between; + -webkit-justify-content: space-between; + justify-content: space-between; + } +} diff --git a/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.html b/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.html new file mode 100644 index 0000000..3578056 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-flex-layout/polymer-flex-layout.html @@ -0,0 +1,47 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-google-jsapi/index.html b/examples/polymer/polymer-elements/polymer-google-jsapi/index.html new file mode 100644 index 0000000..7483f1b --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-google-jsapi/index.html @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-google-jsapi/polymer-google-jsapi.html b/examples/polymer/polymer-elements/polymer-google-jsapi/polymer-google-jsapi.html new file mode 100644 index 0000000..0818078 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-google-jsapi/polymer-google-jsapi.html @@ -0,0 +1,56 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-jsonp/index.html b/examples/polymer/polymer-elements/polymer-jsonp/index.html new file mode 100644 index 0000000..d5f0b94 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-jsonp/index.html @@ -0,0 +1,28 @@ + + + + polymer-jsonp + + + + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-jsonp/polymer-jsonp.html b/examples/polymer/polymer-elements/polymer-jsonp/polymer-jsonp.html new file mode 100644 index 0000000..5edd3b6 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-jsonp/polymer-jsonp.html @@ -0,0 +1,93 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-key-helper/polymer-key-helper.html b/examples/polymer/polymer-elements/polymer-key-helper/polymer-key-helper.html new file mode 100644 index 0000000..6e63b33 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-key-helper/polymer-key-helper.html @@ -0,0 +1,13 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-layout/index.html b/examples/polymer/polymer-elements/polymer-layout/index.html new file mode 100644 index 0000000..2e6b39f --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-layout/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + +
+ +
Hi I'm some content
+
Click Me First
+
Click Me Second
+
+ +
Gribble gribble
+
Click Me
+
Squids!
+
Click Me
+
More is more
+
Squids are larger than they appear.
+
+
Click me
+ +
+ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-layout/polymer-layout.html b/examples/polymer/polymer-elements/polymer-layout/polymer-layout.html new file mode 100644 index 0000000..0860d65 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-layout/polymer-layout.html @@ -0,0 +1,125 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-layout/polymer-slide.html b/examples/polymer/polymer-elements/polymer-layout/polymer-slide.html new file mode 100644 index 0000000..7a0a370 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-layout/polymer-slide.html @@ -0,0 +1,155 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-localstorage/index.html b/examples/polymer/polymer-elements/polymer-localstorage/index.html new file mode 100644 index 0000000..9a35ceb --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-localstorage/index.html @@ -0,0 +1,22 @@ + + + + polymer-localstorage + + + + + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-localstorage/polymer-localstorage.html b/examples/polymer/polymer-elements/polymer-localstorage/polymer-localstorage.html new file mode 100644 index 0000000..202501c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-localstorage/polymer-localstorage.html @@ -0,0 +1,75 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-media-query/index.html b/examples/polymer/polymer-elements/polymer-media-query/index.html new file mode 100644 index 0000000..42de218 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-media-query/index.html @@ -0,0 +1,36 @@ + + + + + Polymer match media + + + + + + + + + + + +
+  Log of 'mediachange' events on document, from polymer-match-media:
+  
+ + + + diff --git a/examples/polymer/polymer-elements/polymer-media-query/polymer-media-query.html b/examples/polymer/polymer-elements/polymer-media-query/polymer-media-query.html new file mode 100644 index 0000000..811a11c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-media-query/polymer-media-query.html @@ -0,0 +1,43 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-meta/index.html b/examples/polymer/polymer-elements/polymer-meta/index.html new file mode 100644 index 0000000..446ebb3 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-meta/index.html @@ -0,0 +1,35 @@ + + + + polymer-meta + + + + + + + + + + + + +
+ + + + diff --git a/examples/polymer/polymer-elements/polymer-meta/polymer-meta.html b/examples/polymer/polymer-elements/polymer-meta/polymer-meta.html new file mode 100644 index 0000000..5278c9c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-meta/polymer-meta.html @@ -0,0 +1,55 @@ + + + + + diff --git a/examples/polymer/polymer-elements/polymer-overlay/index.html b/examples/polymer/polymer-elements/polymer-overlay/index.html new file mode 100644 index 0000000..232273c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-overlay/index.html @@ -0,0 +1,126 @@ + + + + polymer-overlay + + + + + + + ( open styling: + , + + + ) +
+
+ +

Dialog

+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed fringilla sapien sed enim sollicitudin laoreet. Suspendisse suscipit, metus ac volutpat sodales, libero magna semper lacus, molestie fringilla massa orci ut arcu. Nullam sodales urna sit amet odio vehicula mattis.


+
Ut aliquam vulputate congue. Vestibulum pretium pretium nulla quis sollicitudin. Praesent lacinia congue erat nec mattis. Fusce commodo lacus est. Duis turpis eros, ultrices sed aliquet non, blandit egestas velit. Integer a augue nec lorem tristique hendrerit. Curabitur imperdiet risus id enim bibendum vestibulum. Integer id magna at arcu faucibus fermentum vel a augue. Sed fringilla venenatis dolor, in blandit magna molestie luctus. Vestibulum dignissim posuere ultrices. Aenean urna nisl, tincidunt vitae iaculis ut, pharetra nec eros.


+
+
+ I agree with this wholeheartedly. +
+ + Thank you. +
+


+ +
+ +

+ + + +
+ +
+

Dialog 2

+ I'm dizzy. +
+

+ +
+ + + diff --git a/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay-global.css b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay-global.css new file mode 100644 index 0000000..021c67d --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay-global.css @@ -0,0 +1,129 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +.polymer-overlay { + position: fixed; + z-index: 10; + outline: none; + display: none; + opacity: 0.99; + -webkit-transition: opacity 0.001s; + transition: opacity 0.001s; +} + +/* + The revealed class exists because it's necessary to 'show' a node + before applying a transition. When an overlay is opened, it is + immediately revealed (display: block) and then asynchronously the + opened or closing classes are added. + + Because we don't want to actually show the node before a transition + or animation is applied, when the node is + revealed, it is made display: block but visibility: hidden. + It is then made visibility: visible when it is opened. +*/ + +.polymer-overlay.revealed { + display: block; + visibility: hidden; +} + +.polymer-overlay.revealed.opened { + opacity: 1; + display: block; + visibility: visible; +} + +.polymer-overlay.revealed.closing { + display: block; + visibility: visible; +} + +@-webkit-keyframes polymer-overlay-shakeFadeIn { + 0% { + opacity: 0; + -webkit-transform: translateX(0); + } + 10% { + -webkit-transform: translateX(-50px); + } + 30% { + -webkit-transform: translateX(50px); + } + 50% { + -webkit-transform: translateX(-25px); + } + 70% { + -webkit-transform: translateX(25px); + } + 90% { + -webkit-transform: translateX(-13px); + } + 100% { + -webkit-transform: translateX(0); + opacity: 1; + } +} + +@keyframes polymer-overlay-shakeFadeIn { + 0% { + opacity: 0; + transform: translateX(0); + } + 10% { + transform: translateX(-50px); + } + 30% { + transform: translateX(50px); + } + 50% { + transform: translateX(-25px); + } + 70% { + transform: translateX(25px); + } + 90% { + transform: translateX(-13px); + } + 100% { + transform: translateX(0); + opacity: 1; + } +} + +@-webkit-keyframes polymer-overlay-shakeFadeOut { + 0% { + opacity: 1; + -webkit-transform: translateX(0); + } + 10% { + -webkit-transform: translateX(-50px); + } + 30% { + -webkit-transform: translateX(50px); + } + 100% { + -webkit-transform: translateX(-100%); + opacity: 0; + } +} + +@keyframes polymer-overlay-shakeFadeOut { + 0% { + opacity: 1; + transform: translateX(0); + } + 10% { + transform: translateX(-50px); + } + 30% { + transform: translateX(50px); + } + 100% { + transform: translateX(-100%); + opacity: 0; + } +} diff --git a/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.css b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.css new file mode 100644 index 0000000..821b061 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.css @@ -0,0 +1,131 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +/* + TODO(sorvell): include a reasonable set of default overlay opening + animations. What's here right now is ad hoc. +*/ + + /* + Styling a polymer-overlay: + + 1. use the 'opened' class to style the overlay when it is open. + A transition or animation can be applied to animate the overlay into place. + Note: there's no need to set the display property of an overlay. That's + managed automatically. + + 2. To apply a different animation when the overlay closes, use the + 'closing' class. + */ + +/* Note that trbl: 0 + position: fixed will not 'fit to window' +if a transform is applied to a parent of this element. That parent +becomes the containing block; see: +http://dev.w3.org/csswg/css3-transforms/#transform-rendering +We address this by using script based positioning =( +*/ +@host { + * { + position: fixed; + z-index: 10; + outline: none; + display: none; + opacity: 0.99; + -webkit-transition: opacity 0.001s; + transition: opacity 0.001s; + } + + /* + The revealed class exists because it's necessary to 'show' a node + before applying a transition. When an overlay is opened, it is + immediately revealed (display: block) and then asynchronously the + opened or closing classes are added. + + Because we don't want to actually show the node before a transition + or animation is applied, when the node is + revealed, it is made display: block but visibility: hidden. + It is then made visibility: visible when it is opened. + */ + + .revealed { + display: block; + visibility: hidden; + } + + .revealed.opened { + opacity: 1; + display: block; + visibility: visible; + } + + .revealed.closing { + display: block; + visibility: visible; + } + + /* + When an animation is detected (via an animationstart event) this class + is applied to remove any transition. This ensures only 1 animation end event + will be processed. + + NOTE: if a rule such as a media query changes an overlay from using a css + animation to a transition, the animation class must be altered or removed. + */ + .animation { + -webkit-transition: none; + transition: none; + } + + .polymer-overlay-fade { + opacity: 0; + -webkit-transition: all 0.218s; + transition: all 0.218s; + } + + .polymer-overlay-fade.opened { + opacity: 1; + } + + .polymer-overlay-scale-slideup { + opacity: 0.0; + -webkit-transform: scale(1.05); + transform: scale(1.05); + } + + .polymer-overlay-scale-slideup.opened { + opacity: 1.0; + -webkit-transform: scale(1.0); + transform: scale(1.0); + -webkit-transition: all 0.218s; + transition: all 0.218s; + } + + .polymer-overlay-scale-slideup.closing { + opacity: 0; + -webkit-transform: translateY(-100%); + transform: translateY(-100%); + -webkit-transition: all 0.4s; + transition: all 0.4s; + } + + .polymer-overlay-shake.opened { + -webkit-animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: polymer-overlay-shakeFadeIn; + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: polymer-overlay-shakeFadeIn; + } + + .polymer-overlay-shake.closing { + -webkit-animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: polymer-overlay-shakeFadeOut; + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: polymer-overlay-shakeFadeOut; + } +} diff --git a/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.html b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.html new file mode 100644 index 0000000..6b8e186 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-overlay/polymer-overlay.html @@ -0,0 +1,330 @@ + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-page/polymer-page.html b/examples/polymer/polymer-elements/polymer-page/polymer-page.html new file mode 100644 index 0000000..2bef02c --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-page/polymer-page.html @@ -0,0 +1,17 @@ + + + + diff --git a/examples/polymer/polymer-elements/polymer-selector/index.html b/examples/polymer/polymer-elements/polymer-selector/index.html new file mode 100644 index 0000000..6c22f34 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-selector/index.html @@ -0,0 +1,45 @@ + + + + polymer-selector + + + + + + +
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
+

Multi-select

+ +
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
+ + diff --git a/examples/polymer/polymer-elements/polymer-selector/polymer-selection.html b/examples/polymer/polymer-elements/polymer-selector/polymer-selection.html new file mode 100644 index 0000000..318a61e --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-selector/polymer-selection.html @@ -0,0 +1,64 @@ + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-selector/polymer-selector.html b/examples/polymer/polymer-elements/polymer-selector/polymer-selector.html new file mode 100644 index 0000000..4018fd6 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-selector/polymer-selector.html @@ -0,0 +1,197 @@ + + + + + + + + diff --git a/examples/polymer/polymer-elements/polymer-view-source-link/index.html b/examples/polymer/polymer-elements/polymer-view-source-link/index.html new file mode 100644 index 0000000..9eacd53 --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-view-source-link/index.html @@ -0,0 +1,20 @@ + + + + + polymer-view-source-link + + + + + + + + + View Source + + diff --git a/examples/polymer/polymer-elements/polymer-view-source-link/polymer-view-source-link.html b/examples/polymer/polymer-elements/polymer-view-source-link/polymer-view-source-link.html new file mode 100644 index 0000000..164c6fb --- /dev/null +++ b/examples/polymer/polymer-elements/polymer-view-source-link/polymer-view-source-link.html @@ -0,0 +1,15 @@ + + + + diff --git a/examples/polymer/polymer-ui-elements/AUTHORS b/examples/polymer/polymer-ui-elements/AUTHORS new file mode 100644 index 0000000..0617765 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/AUTHORS @@ -0,0 +1,9 @@ +# Names should be added to this file with this pattern: +# +# For individuals: +# Name +# +# For organizations: +# Organization +# +Google Inc. <*@google.com> diff --git a/examples/polymer/polymer-ui-elements/LICENSE b/examples/polymer/polymer-ui-elements/LICENSE new file mode 100644 index 0000000..92d60b0 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/LICENSE @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Polymer Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/examples/polymer/polymer-ui-elements/PATENTS b/examples/polymer/polymer-ui-elements/PATENTS new file mode 100644 index 0000000..e120963 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/PATENTS @@ -0,0 +1,23 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Polymer project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Polymer, where such license applies only to those +patent claims, both currently owned or controlled by Google and acquired +in the future, licensable by Google that are necessarily infringed by +this implementation of Polymer. This grant does not include claims +that would be infringed only as a consequence of further modification of +this implementation. If you or your agent or exclusive licensee +institute or order or agree to the institution of patent litigation +against any entity (including a cross-claim or counterclaim in a +lawsuit) alleging that this implementation of Polymer or any code +incorporated within this implementation of Polymer constitutes +direct or contributory patent infringement, or inducement of patent +infringement, then any patent rights granted to you under this License +for this implementation of Polymer shall terminate as of the date +such litigation is filed. diff --git a/examples/polymer/polymer-ui-elements/assets/action-icons.pdn b/examples/polymer/polymer-ui-elements/assets/action-icons.pdn new file mode 100644 index 0000000..2199846 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/assets/action-icons.pdn differ diff --git a/examples/polymer/polymer-ui-elements/assets/action-icons.png b/examples/polymer/polymer-ui-elements/assets/action-icons.png new file mode 100644 index 0000000..174fc92 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/assets/action-icons.png differ diff --git a/examples/polymer/polymer-ui-elements/assets/ribbon-icons.pdn b/examples/polymer/polymer-ui-elements/assets/ribbon-icons.pdn new file mode 100644 index 0000000..c60d247 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/assets/ribbon-icons.pdn differ diff --git a/examples/polymer/polymer-ui-elements/assets/ribbon-icons.png b/examples/polymer/polymer-ui-elements/assets/ribbon-icons.png new file mode 100644 index 0000000..19eaf0c Binary files /dev/null and b/examples/polymer/polymer-ui-elements/assets/ribbon-icons.png differ diff --git a/examples/polymer/polymer-ui-elements/basic.css b/examples/polymer/polymer-ui-elements/basic.css new file mode 100644 index 0000000..51a26e1 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/basic.css @@ -0,0 +1,70 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ +.polymer-ui-full-bleed { + height: 100%; + overflow: hidden; + margin: 0; +} + +.polymer-ui-fit { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.polymer-ui-light-bg { + background: #f2f2f2 -webkit-linear-gradient(left, rgba(197,197,197,0), rgba(197,197,197,0.05)); + background: #f2f2f2 -moz-linear-gradient(left, rgba(197,197,197,0), rgba(197,197,197,0.05)); + background: #f2f2f2 -ms-linear-gradient(left, rgba(197,197,197,0), rgba(197,197,197,0.05)); + background: #f2f2f2 linear-gradient(left, rgba(197,197,197,0), rgba(197,197,197,0.05)); + color: #333333; +} + +.polymer-ui-dark-bg { + background: #333333 -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.35)); + background: #333333 -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.35)); + background: #333333 -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.35)); + background: #333333 linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.35)); + color: #ededed; +} + +.polymer-ui-body-text { + font: 16px 'Helvetica Neue', Helvetica, Arial, Roboto; +} + +/* +.polymer-ui-light-bg { + background-color: #d9d9d9; + color: #333; +} + +.polymer-ui-dark-bg { + background-color: #262626; + color: #eee; +} + +.polymer-ui-bg-gray { + background-color: #d9d9d9; +} + +.polymer-ui-bg-jl-dark-theme { + background-color: #4d4d4d; +} + +.polymer-ui-header-gray { + background-color: #262626; +} + +.polymer-ui-header-jl-dark-theme { + background-color: #262626; +} + +.polymer-ui-header { + background-color: #f3f3f0; +} +*/ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-accordion/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/index.html new file mode 100644 index 0000000..1b826b6 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/index.html @@ -0,0 +1,55 @@ + + + + + + polymer-ui-accordion + + + + + + + + +
Header 1
+
+ Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem +
+
+ +
Header 2
+
+ Coercuit iunctarum vix sic aberant spisso imagine litem cetera nubes ambitae tanta usu circumfuso fulminibus umentia rectumque iuga pluviaque meis semina regat ne campoque meis coeperunt nix cura iunctarum ligavit: secant ventos seductaque permisit sic iunctarum locoque his coeptis tum terras animalia recepta aethera cornua invasit tollere videre tonitrua humanas otia tuba alta dissociata sanctius adsiduis inclusum caesa ita onus sine pluviaque litem manebat fixo extendi ubi inposuit cum sublime membra undas orba forma deducite aethera turba coercuit retinebat obliquis bracchia nisi mentisque origine peregrinum manebat +
+
+ +
Header 3
+
+ Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque +
+
+
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.css b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.css new file mode 100644 index 0000000..ceb10a5 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.css @@ -0,0 +1,11 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: block; + } +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.html b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.html new file mode 100644 index 0000000..6f38306 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.html @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/index.html new file mode 100644 index 0000000..ee6281f --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/index.html @@ -0,0 +1,40 @@ + + + + + polymer-ui-collapsible + + + + + + + +
Header 1
+
+ Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem +
+
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.css b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.css new file mode 100644 index 0000000..e5129bf --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.css @@ -0,0 +1,15 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: block; + } +} + +#collapsibleBody { + height: 0; +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.html b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.html new file mode 100644 index 0000000..d2cdf6f --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.html @@ -0,0 +1,48 @@ + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/btn_light.png b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/btn_light.png new file mode 100644 index 0000000..122af8d Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/btn_light.png differ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/index.html new file mode 100644 index 0000000..15e9ff4 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/index.html @@ -0,0 +1,55 @@ + + + + + + polymer-ui-icon-button + + + + + + + + + + +
+ + + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.css b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.css new file mode 100644 index 0000000..8c32c02 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.css @@ -0,0 +1,35 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ +@host { + * { + display: inline-block; + box-sizing: border-box; + -moz-box-sizing: border-box; + width: 44px; + height: 44px; + padding: 10px; + vertical-align: middle; + cursor: pointer; + background: url(btn_light.png) top left no-repeat; + background-size: cover; + } + + *:hover { + background-position: 0 -44px; + } + + *.selected { + background-position: 0 -88px; + } + + *:active, *.selected:active { + background-position: 0 -132px; + } +} + +polymer-ui-icon { + display: block !important; +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.html b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.html new file mode 100644 index 0000000..d209fff --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon-button/polymer-ui-icon-button.html @@ -0,0 +1,77 @@ + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-icon/index.html new file mode 100644 index 0000000..8db1dee --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon/index.html @@ -0,0 +1,55 @@ + + + + + + polymer-ui-icon + + + + + + + + + + +
+ + + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.css b/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.css new file mode 100644 index 0000000..351f625 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.css @@ -0,0 +1,25 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ +@host { + * { + display: inline-block; + vertical-align: middle; + cursor: pointer; + background-repeat: no-repeat; + } + + .polymer-ui-dark-icon, .polymer-ui-light-theme { + background-position: -24px 0; + } + + .polymer-ui-light-icon, .polymer-ui-dark-theme { + background-position: -72px 0; + } + + .polymer-ui-icons { + background-image: url(../assets/action-icons.png); + } +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.html b/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.html new file mode 100644 index 0000000..b143297 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-icon/polymer-ui-icon.html @@ -0,0 +1,116 @@ + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/index.html new file mode 100644 index 0000000..9e6be63 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/index.html @@ -0,0 +1,33 @@ + + + + + + polymer-ui-menu-item + + + + + + +

polymer-ui-light-theme

+
+ + +
+

polymer-ui-dark-theme

+
+ + +
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.css b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.css new file mode 100644 index 0000000..30a155c --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.css @@ -0,0 +1,81 @@ +/* +Copyright 2013 The Toolkitchen Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: block; + } +} + +/* item */ +#item { + display: block; + box-sizing: border-box; + -moz-box-sizing: border-box; + height: 40px; + line-height: 35px; + padding: 0 10px; + border: 1px solid transparent; + border-radius: 3px; + white-space: nowrap; + cursor: pointer; + opacity: 0.5; +} + +#item:hover { + opacity: 0.9; +} + +#item[active] { + opacity: 1; +} + +#item.polymer-ui-light-theme[active] { + background: #f2f2f2; + border: 1px solid rgba(0, 0, 0, 0.15); +} + +#item.polymer-ui-dark-theme { + color: #b3b3b3; +} + +#item.polymer-ui-dark-theme:hover { + color: rgba(255, 255, 255, 0.9); +} + +#item.polymer-ui-dark-theme[active] { + background-color: #000; + border: 1px solid rgba(255, 255, 255, 0.2); + color: rgba(255, 255, 255, 0.9); +} + +#item[active].no-active-bg { + background-color: transparent; + border: 1px solid transparent; +} + +/* icon and label */ +polymer-ui-icon:not([showing]) { + display: none !important; +} + +#item polymer-ui-icon { + margin-right: 16px; +} + +#label { + vertical-align: middle; + padding-right: 20px; +} + +/* menu */ +#menu { + margin-left: 44px; + height: 0; + /* override @host style on polymer-ui-menu */ + background-image: none !important; + padding: 0 !important; +} diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.html b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.html new file mode 100644 index 0000000..d38062b --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.html @@ -0,0 +1,68 @@ + + + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-menu/index.html new file mode 100644 index 0000000..19ed21d --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu/index.html @@ -0,0 +1,53 @@ + + + + + + polymer-ui-menu + + + + + + + +

polymer-ui-light-theme

+ + + + + +

polymer-ui-dark-theme

+ + + + + +

no icons

+ + + + + +

sub-menu

+ + + + + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.css b/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.css new file mode 100644 index 0000000..b14e8e8 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.css @@ -0,0 +1,29 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + /* technical */ + display: block; + box-sizing: border-box; + -moz-box-sizing: border-box; + /* size */ + padding: 10px; + font-size: 15px; + font-weight: bold; + } + + .polymer-ui-light-theme { + color: #333333; + } + + .polymer-ui-dark-theme { + background: -webkit-linear-gradient(-60deg, #3d3d3d, #353535); + background: -moz-linear-gradient(-60deg, #3d3d3d, #353535); + background: -ms-linear-gradient(-60deg, #3d3d3d, #353535); + color: #ededed; + } +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.html b/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.html new file mode 100644 index 0000000..11771ad --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.html @@ -0,0 +1,90 @@ + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/index.html new file mode 100644 index 0000000..04a6316 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/index.html @@ -0,0 +1,64 @@ + + + + + + polymer-ui-nav-arrow + + + + + + + +
+ +
Item 1
+
Item 2
+
Item 3
+
Item 4
+
Item 5
+
+ +
+ + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.css b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.css new file mode 100644 index 0000000..b107e97 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.css @@ -0,0 +1,26 @@ +/* +Copyright 2013 The Toolkitchen Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: none; + position: absolute; + top: 0; + right: 0; + width: 0; + height: 0; + margin-top: -8px; + border-top: 9px solid transparent; + border-bottom: 9px solid transparent; + border-right: 9px solid white; + -webkit-transition: -webkit-transform 0.5s; + transition: transform 0.5s; + } + + .show { + display: inline; + } +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.html b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.html new file mode 100644 index 0000000..a8cd901 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-nav-arrow/polymer-ui-nav-arrow.html @@ -0,0 +1,42 @@ + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-ratings/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/index.html new file mode 100644 index 0000000..a7b74b9 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/index.html @@ -0,0 +1,23 @@ + + + + + + polymer-ui-ratings + + + + + + + + + +

+ + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.css b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.css new file mode 100644 index 0000000..bba8420 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.css @@ -0,0 +1,29 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: inline-block; + white-space: nowrap; + -webkit-user-select: none; + -moz-user-select: none; + } +} + +#star { + display: inline-block; + vertical-align: middle; + width: 24px; + height: 24px; + margin: 0 5px; + background-size: 100% 100%; + background-image: url('star_blank.png'); + cursor: pointer; +} + +#star.full { + background-image: url('star_full.png'); +} diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.html b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.html new file mode 100644 index 0000000..b3abb92 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/polymer-ui-ratings.html @@ -0,0 +1,74 @@ + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_blank.png b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_blank.png new file mode 100644 index 0000000..f034646 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_blank.png differ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_full.png b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_full.png new file mode 100644 index 0000000..911b822 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-ratings/star_full.png differ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/index.html new file mode 100644 index 0000000..1e49ba3 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/index.html @@ -0,0 +1,68 @@ + + + + + + polymer-ui-sidebar-menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.css b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.css new file mode 100644 index 0000000..8c28cf5 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.css @@ -0,0 +1,35 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + position: relative; + box-shadow: inset -8px 0px 8px -4px rgba(0, 0, 0, 0.4); + padding: 0; + } + + .polymer-ui-light-theme { + box-shadow: inset -8px 0px 8px -4px rgba(0, 0, 0, 0.15); + } +} + +polymer-ui-toolbar { + /* override @host styles on polymer-ui-toolbar */ + padding: 0 12px !important; + border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important; + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02); +} + +.sidebar-title { + font-size: 21px; + opacity: 0.8; + text-shadow: -1px -1px rgba(0, 0, 0, 0.2); +} + +.sidebar-menu { + padding: 0 10px; + margin: 10px 0; +} diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.html b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.html new file mode 100644 index 0000000..9730667 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-sidebar-menu/polymer-ui-sidebar-menu.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle.png b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle.png new file mode 100644 index 0000000..1edb011 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle.png differ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle_horiz.png b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle_horiz.png new file mode 100644 index 0000000..0a8b6dc Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/handle_horiz.png differ diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-splitter/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/index.html new file mode 100644 index 0000000..de27e44 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/index.html @@ -0,0 +1,72 @@ + + + + + + polymer-ui-splitter + + + + + + + +
+
left
+ +
right
+
+
+
+
top
+ +
bottom
+
+
+
+
1
+ +
+
2
+ +
3
+
+
+
+
+
left
+ +
center
+ +
right
+
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.css b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.css new file mode 100644 index 0000000..2f7ff6e --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.css @@ -0,0 +1,27 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + display: block; + width: 10px; + background: #efefef url(handle.png) no-repeat center; + box-shadow: inset 0 0 2px 1px #ccc; + opacity: 0.9; + cursor: col-resize; + } + + .horizontal { + width: auto; + height: 10px; + cursor: row-resize; + background-image: url(handle_horiz.png); + } + + :hover, .active { + background-color: #ddd; + } +} \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.html b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.html new file mode 100644 index 0000000..34dbda6 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-splitter/polymer-ui-splitter.html @@ -0,0 +1,91 @@ + + + + + + \ No newline at end of file diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-tabs/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-tabs/index.html new file mode 100644 index 0000000..4ec0932 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-tabs/index.html @@ -0,0 +1,29 @@ + + + + + + polymer-ui-tabs + + + + + + + + + + + + One + Two + Three + Four + Five + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-tabs/polymer-ui-tabs.html b/examples/polymer/polymer-ui-elements/polymer-ui-tabs/polymer-ui-tabs.html new file mode 100644 index 0000000..dfc9431 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-tabs/polymer-ui-tabs.html @@ -0,0 +1,65 @@ + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html b/examples/polymer/polymer-ui-elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html new file mode 100644 index 0000000..91f4a47 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-theme-aware/polymer-ui-theme-aware.html @@ -0,0 +1,30 @@ + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/index.html new file mode 100644 index 0000000..648384f --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/index.html @@ -0,0 +1,25 @@ + + + + + + polymer-ui-toggle-button + + + + + + + + + + + +

+ + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.css b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.css new file mode 100644 index 0000000..d25e44d --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.css @@ -0,0 +1,96 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ +@host { + * { + display: inline-block; + position: relative; + width: 70px; + height: 30px; + overflow: hidden; + border: 1px solid #b6b6b6; + border-radius: 3px; + box-shadow: inset 0px 0px 1px 0 rgba(0,0,0,0.1); + -webkit-user-select: none; + -moz-user-select: none; + -webkit-transition: border 0.130s ease-out; + transition: border 0.130s ease-out; + cursor: pointer; + } + + *.on { + border: 1px solid #4584f2; + } +} + +.toggle { + position: absolute; + left: -42px; + width: 112px; + height: 100%; + overflow: hidden; + white-space: nowrap; + -webkit-transition: left 0.130s ease-out; + transition: left 0.130s ease-out; +} + +.toggle.dragging { + -webkit-transition: all 0; + transition: all 0; +} + +.toggle.on { + left: 0; +} + +.toggle > * { + float: left; +} + +.on-label, .off-label { + width: 50%; + height: 100%; + line-height: 30px; + box-sizing: border-box; + -moz-box-sizing: border-box; + text-align: center; + font-family: 'Helvetica Neue', Helvetica, Arial, 'open sans', sans-serif; + font-size: 10px; +} + +.on-label { + padding-right: 14px; + background-color: #488afd; + color: white; +} + +.off-label { + padding-left: 14px; + background-color: #bfbfbf; + color: #716f6f; +} + +.thumb { + position: absolute; + left: 42px; + width: 28px; + height: 100%; + border-radius: 2px; + background-color: white; +} + +.thumb::after { + content: ""; + position: absolute; + display: block; + top: 10px; + left: 11px; + height: 10px; + width: 8px; + background-image: -webkit-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-image: -moz-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-image: -ms-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-size: 4px; +} diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.html b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.html new file mode 100644 index 0000000..98fd958 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toggle-button/polymer-ui-toggle-button.html @@ -0,0 +1,72 @@ + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/index.html b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/index.html new file mode 100644 index 0000000..c402bbe --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/index.html @@ -0,0 +1,81 @@ + + + + + + polymer-ui-toolbar + + + + + + + + + + + + + + + +
Toolbar: naked
+ +
+
+ + + +
Toolbar: polymer-ui-light-theme
+ +
+
+ + + +
Toolbar: polymer-ui-dark-theme
+ +
+
+ + + +
Toolbar: responsive
+ + + + + +
+
+
+
+ + + +
Toolbar: container theme
+ +
+
+
+
+
+

below here, not so much with the working

+
+

color/font work via style inheritance only, cannot affect the icon without some other support ... pseudo?

+ + +
Toolbar: custom
+ +
+ + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.css b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.css new file mode 100644 index 0000000..3b2d958 --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.css @@ -0,0 +1,59 @@ +/* +Copyright 2013 The Polymer Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file. +*/ + +@host { + * { + /* technical */ + display: block; + box-sizing: border-box; + -moz-box-sizing: border-box; + /* border/shadow */ + border-bottom: 1px solid rgba(0, 0, 0, 0.28); + /* size */ + height: 60px; + font-size: 21px; + } + + .polymer-ui-light-theme { + background: #f2f2f2 -webkit-linear-gradient(top, rgba(197,197,197,0), rgba(197,197,197,0.15)); + background: #f2f2f2 -moz-linear-gradient(top, rgba(197,197,197,0), rgba(197,197,197,0.15)); + background: #f2f2f2 -ms-linear-gradient(top, rgba(197,197,197,0), rgba(197,197,197,0.15)); + color: #333333; + } + + .polymer-ui-dark-theme { + background: #333333 -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.9)); + background: #333333 -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.9)); + background: #333333 -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.9)); + color: #ededed; + } + + .narrow-layout[responsive] { + position: fixed; + right: 0; + bottom: 0; + left: 0; + z-index: 1; + border: 0; + border-top: 1px solid rgba(0, 0, 0, 0.28); + } +} + +/*@polyfill @host > * */ +content::-webkit-distributed(> *) { + margin: 0 8px; +} + +/*@polyfill @host > polymer-ui-toolbar */ +content::-webkit-distributed(> polymer-ui-toolbar) { + margin: 0; +} + +/*@polyfill @host > polymer-ui-toolbar:not(.narrow-layout[responsive]) */ +content::-webkit-distributed(> polymer-ui-toolbar:not(.narrow-layout[responsive])) { + border: 0; + background: transparent; +} diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.html b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.html new file mode 100644 index 0000000..0d947cf --- /dev/null +++ b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/polymer-ui-toolbar.html @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/star.png b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/star.png new file mode 100644 index 0000000..2496b80 Binary files /dev/null and b/examples/polymer/polymer-ui-elements/polymer-ui-toolbar/star.png differ diff --git a/examples/polymer/toolkit-ui/elements/animation/all.html b/examples/polymer/toolkit-ui/elements/animation/all.html new file mode 100644 index 0000000..f86e9cb --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/all.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-animation-group.html b/examples/polymer/toolkit-ui/elements/animation/g-animation-group.html new file mode 100644 index 0000000..9606fb1 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-animation-group.html @@ -0,0 +1,100 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-animation.html b/examples/polymer/toolkit-ui/elements/animation/g-animation.html new file mode 100644 index 0000000..4bce078 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-animation.html @@ -0,0 +1,366 @@ + + + + + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-blink.html b/examples/polymer/toolkit-ui/elements/animation/g-blink.html new file mode 100644 index 0000000..0760d13 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-blink.html @@ -0,0 +1,16 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-bounce.html b/examples/polymer/toolkit-ui/elements/animation/g-bounce.html new file mode 100644 index 0000000..8126b18 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-bounce.html @@ -0,0 +1,33 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-fadein.html b/examples/polymer/toolkit-ui/elements/animation/g-fadein.html new file mode 100644 index 0000000..e14e8b9 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-fadein.html @@ -0,0 +1,17 @@ + + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-fadeout.html b/examples/polymer/toolkit-ui/elements/animation/g-fadeout.html new file mode 100644 index 0000000..5d05f06 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-fadeout.html @@ -0,0 +1,13 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-flip.html b/examples/polymer/toolkit-ui/elements/animation/g-flip.html new file mode 100644 index 0000000..eb2f6d4 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-flip.html @@ -0,0 +1,47 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-shake.html b/examples/polymer/toolkit-ui/elements/animation/g-shake.html new file mode 100644 index 0000000..c55b76f --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-shake.html @@ -0,0 +1,61 @@ + + + + + diff --git a/examples/polymer/toolkit-ui/elements/animation/g-translate.html b/examples/polymer/toolkit-ui/elements/animation/g-translate.html new file mode 100644 index 0000000..41ef642 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/animation/g-translate.html @@ -0,0 +1,41 @@ + + + + + diff --git a/examples/polymer/toolkit-ui/elements/css/g-flex-layout.css b/examples/polymer/toolkit-ui/elements/css/g-flex-layout.css new file mode 100644 index 0000000..1a6a10a --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-flex-layout.css @@ -0,0 +1,220 @@ +.flexbox { + display: -ms-flexbox; + display: -moz-flex; + display: -webkit-flex; + display: flex; +} +.inline-flexbox { + display: -ms-inline-flexbox; + display: -moz-inline-flex; + display: -webkit-inline-flex; + display: inline-flex; +} +.flexbox.row { + -ms-flex-direction: row; + -moz-flex-direction: row; + -webkit-flex-direction: row; + flex-direction: row; +} +.flexbox.col { + -ms-flex-direction: column; + -moz-flex-direction: column; + -webkit-flex-direction: column; + flex-direction: column; +} +.flexbox.justify-start { + -ms-flex-pack: start; + -moz-justify-content: flex-start; + -webkit-justify-content: flex-start; + justify-content: flex-start; +} +.flexbox.justify-end { + -ms-flex-pack: end; + -moz-justify-content: flex-end; + -webkit-justify-content: flex-end; + justify-content: flex-end; +} +.flexbox.justify-center { + -ms-flex-pack: center; + -moz-justify-content: center; + -webkit-justify-content: center; + justify-content: center; +} +.flexbox.justify-between { + -ms-flex-pack: justify; + -moz-justify-content: space-between; + -webkit-justify-content: space-between; + justify-content: space-between; +} +.flexbox.align-start { + -ms-flex-align: start; + -moz-align-items: flex-start; + -webkit-align-items: flex-start; + align-items: flex-start; +} +.flexbox.align-end { + -ms-flex-align: end; + -moz-align-items: flex-end; + -webkit-align-items: flex-end; + align-items: flex-end; +} +.flexbox.align-center { + -ms-flex-align: center; + -moz-align-items: center; + -webkit-align-items: center; + align-items: center; +} +.flexbox.flex-all > *, +[flex] { + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; +} +.flexbox > content[flex]::-webkit-distributed(*) { + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; +} +.flexbox > .align-start { + -moz-align-self: flex-start; + -webkit-align-self: flex-start; + align-self: flex-start; +} +.flexbox > content::-webkit-distributed(.align-start) { + -moz-align-self: flex-start; + -webkit-align-self: flex-start; + align-self: flex-start; +} +.flexbox > .align-end { + -moz-align-self: flex-end; + -webkit-align-self: flex-end; + align-self: flex-end; +} +.flexbox > content::-webkit-distributed(.align-end) { + -moz-align-self: flex-end; + -webkit-align-self: flex-end; + align-self: flex-end; +} +.flexbox > .align-center { + -moz-align-self: center; + -webkit-align-self: center; + align-self: center; +} +.flexbox > content::-webkit-distributed(.align-center) { + -moz-align-self: center; + -webkit-align-self: center; + align-self: center; +} +@host { + .flexbox { + display: -ms-flexbox; + display: -moz-flex; + display: -webkit-flex; + display: flex; + } + .inline-flexbox { + display: -ms-inline-flexbox; + display: -moz-inline-flex; + display: -webkit-inline-flex; + display: inline-flex; + } + .flexbox.row { + -ms-flex-direction: row; + -moz-flex-direction: row; + -webkit-flex-direction: row; + flex-direction: row; + } + .flexbox.col { + -ms-flex-direction: column; + -moz-flex-direction: column; + -webkit-flex-direction: column; + flex-direction: column; + } + .flexbox.justify-start { + -ms-flex-pack: start; + -moz-justify-content: flex-start; + -webkit-justify-content: flex-start; + justify-content: flex-start; + } + .flexbox.justify-end { + -ms-flex-pack: end; + -moz-justify-content: flex-end; + -webkit-justify-content: flex-end; + justify-content: flex-end; + } + .flexbox.justify-center { + -ms-flex-pack: center; + -moz-justify-content: center; + -webkit-justify-content: center; + justify-content: center; + } + .flexbox.justify-between { + -ms-flex-pack: justify; + -moz-justify-content: space-between; + -webkit-justify-content: space-between; + justify-content: space-between; + } + .flexbox.align-start { + -ms-flex-align: start; + -moz-align-items: flex-start; + -webkit-align-items: flex-start; + align-items: flex-start; + } + .flexbox.align-end { + -ms-flex-align: end; + -moz-align-items: flex-end; + -webkit-align-items: flex-end; + align-items: flex-end; + } + .flexbox.align-center { + -ms-flex-align: center; + -moz-align-items: center; + -webkit-align-items: center; + align-items: center; + } + .flexbox.flex-all > *, + [flex] { + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; + } + .flexbox > content[flex]::-webkit-distributed(*) { + -ms-flex: 1; + -moz-flex: 1; + -webkit-flex: 1; + flex: 1; + } + .flexbox > .align-start { + -moz-align-self: flex-start; + -webkit-align-self: flex-start; + align-self: flex-start; + } + .flexbox > content::-webkit-distributed(.align-start) { + -moz-align-self: flex-start; + -webkit-align-self: flex-start; + align-self: flex-start; + } + .flexbox > .align-end { + -moz-align-self: flex-end; + -webkit-align-self: flex-end; + align-self: flex-end; + } + .flexbox > content::-webkit-distributed(.align-end) { + -moz-align-self: flex-end; + -webkit-align-self: flex-end; + align-self: flex-end; + } + .flexbox > .align-center { + -moz-align-self: center; + -webkit-align-self: center; + align-self: center; + } + .flexbox > content::-webkit-distributed(.align-center) { + -moz-align-self: center; + -webkit-align-self: center; + align-self: center; + } +} diff --git a/examples/polymer/toolkit-ui/elements/css/g-menu-button.css b/examples/polymer/toolkit-ui/elements/css/g-menu-button.css new file mode 100644 index 0000000..26a836e --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-menu-button.css @@ -0,0 +1,99 @@ +@host { + * { + display: inline-block; + box-sizing: border-box; + -moz-box-sizing: border-box; + width: 44px; + height: 44px; + } +} + +#overlay { + background: white; + border: 1px solid rgba(0, 0, 0, 0.15); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); + margin: 9px 0 0 22px; + -webkit-transform: translateX(-50%); + transform: translateX(-50%); +} + +[valign=right] #overlay { + -webkit-transform: translateX(-90%); + transform: translateX(-90%); +} + +[valign=left] #overlay { + -webkit-transform: translateX(-10%); + transform: translateX(-10%); +} + +.arrow { + height: 1px; + width: 0; + margin: -17px auto 0; + border-color: transparent transparent #cfcfcf transparent; + border-style: solid; + border-width: 8px; +} + +.arrow-inner { + border-bottom-color: white; + margin-top: -16px; +} + +[valign=right] .arrow { + position: relative; + left: -7px; + margin-left: 90%; +} + +[valign=left] .arrow { + position: relative; + left: -7px; + margin-left: 10%; +} + +#overlayMenu { + display: block; + box-sizing: border-box; + -moz-box-sizing: border-box; +} + +/* TODO(ffu): adding responsive class won't work in native; to work in native +automatically we'll need to add a feature to detect if we're in a responsive +container */ +@media screen and (max-width: 800px) { + [responsive=true] .arrow-border, .arrow { + display: none; + } + + [responsive=true] #overlayMenu { + width: 100%; + } + + [responsive=true] #overlay { + /* override g-overlay @host rule style */ + position: absolute !important; + -webkit-transform: translateX(0); + transform: translateX(0); + right: 0; + bottom: 0; + left: 0; + margin: 0; + border-bottom: 0; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1); + } + + [responsive=true] #overlay.slideup { + -webkit-transform: translateY(100%); + transform: translateY(100%); + /* override g-overlay @host rule style */ + -webkit-transition: -webkit-transform 0.218s !important; + transition: transform 0.218s !important; + } + + [responsive=true] #overlay.slideup.opened { + -webkit-transform: translateY(0); + transform: translateY(0); + } +} \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-overlay-global.css b/examples/polymer/toolkit-ui/elements/css/g-overlay-global.css new file mode 100644 index 0000000..f149ea7 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-overlay-global.css @@ -0,0 +1,91 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +@-webkit-keyframes g-overlay-shakeFadeIn { + 0% { + opacity: 0; + -webkit-transform: translateX(0); + } + 10% { + -webkit-transform: translateX(-50px); + } + 30% { + -webkit-transform: translateX(50px); + } + 50% { + -webkit-transform: translateX(-25px); + } + 70% { + -webkit-transform: translateX(25px); + } + 90% { + -webkit-transform: translateX(-13px); + } + 100% { + -webkit-transform: translateX(0); + opacity: 1; + } +} + +@keyframes g-overlay-shakeFadeIn { + 0% { + opacity: 0; + transform: translateX(0); + } + 10% { + transform: translateX(-50px); + } + 30% { + transform: translateX(50px); + } + 50% { + transform: translateX(-25px); + } + 70% { + transform: translateX(25px); + } + 90% { + transform: translateX(-13px); + } + 100% { + transform: translateX(0); + opacity: 1; + } +} + +@-webkit-keyframes g-overlay-shakeFadeOut { + 0% { + opacity: 1; + -webkit-transform: translateX(0); + } + 10% { + -webkit-transform: translateX(-50px); + } + 30% { + -webkit-transform: translateX(50px); + } + 100% { + -webkit-transform: translateX(-100%); + opacity: 0; + } +} + +@keyframes g-overlay-shakeFadeOut { + 0% { + opacity: 1; + transform: translateX(0); + } + 10% { + transform: translateX(-50px); + } + 30% { + transform: translateX(50px); + } + 100% { + transform: translateX(-100%); + opacity: 0; + } +} \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-overlay.css b/examples/polymer/toolkit-ui/elements/css/g-overlay.css new file mode 100644 index 0000000..302bbe8 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-overlay.css @@ -0,0 +1,131 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +/* + TODO(sorvell): include a reasonable set of default overlay opening + animations. What's here right now is ad hoc. +*/ + + /* + Styling a g-overlay: + + 1. use the 'opened' class to style the overlay when it is open. + A transition or animation can be applied to animate the overlay into place. + Note: there's no need to set the display property of an overlay. That's + managed automatically. + + 2. To apply a different animation when the overlay closes, use the + 'closing' class. + */ + +/* Note that trbl: 0 + position: fixed will not 'fit to window' +if a transform is applied to a parent of this element. That parent +becomes the containing block; see: +http://dev.w3.org/csswg/css3-transforms/#transform-rendering +We address this by using script based positioning =( +*/ +@host { + * { + position: fixed; + z-index: 10; + outline: none; + display: none; + opacity: 0.99; + -webkit-transition: opacity 0.001s; + transition: opacity 0.001s; + } + + /* + The revealed class exists because it's necessary to 'show' a node + before applying a transition. When an overlay is opened, it is + immediately revealed (display: block) and then asynchronously the + opened or closing classes are added. + + Because we don't want to actually show the node before a transition + or animation is applied, when the node is + revealed, it is made display: block but visibility: hidden. + It is then made visibility: visible when it is opened. + */ + + .revealed { + display: block; + visibility: hidden; + } + + .revealed.opened { + opacity: 1; + display: block; + visibility: visible; + } + + .revealed.closing { + display: block; + visibility: visible; + } + + /* + When an animation is detected (via an animationstart event) this class + is applied to remove any transition. This ensures only 1 animation end event + will be processed. + + NOTE: if a rule such as a media query changes an overlay from using a css + animation to a transition, the animation class must be altered or removed. + */ + .animation { + -webkit-transition: none; + transition: none; + } + + .g-overlay-fade { + opacity: 0; + -webkit-transition: all 0.218s; + transition: all 0.218s; + } + + .g-overlay-fade.opened { + opacity: 1; + } + + .g-overlay-scale-slideup { + opacity: 0.0; + -webkit-transform: scale(1.05); + transform: scale(1.05); + } + + .g-overlay-scale-slideup.opened { + opacity: 1.0; + -webkit-transform: scale(1.0); + transform: scale(1.0); + -webkit-transition: all 0.218s; + transition: all 0.218s; + } + + .g-overlay-scale-slideup.closing { + opacity: 0; + -webkit-transform: translateY(-100%); + transform: translateY(-100%); + -webkit-transition: all 0.4s; + transition: all 0.4s; + } + + .g-overlay-shake.opened { + -webkit-animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: g-overlay-shakeFadeIn; + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: g-overlay-shakeFadeIn; + } + + .g-overlay-shake.closing { + -webkit-animation-duration: 0.5s; + -webkit-animation-fill-mode: both; + -webkit-animation-name: g-overlay-shakeFadeOut; + animation-duration: 0.5s; + animation-fill-mode: both; + animation-name: g-overlay-shakeFadeOut; + } +} diff --git a/examples/polymer/toolkit-ui/elements/css/g-panels-controller.css b/examples/polymer/toolkit-ui/elements/css/g-panels-controller.css new file mode 100644 index 0000000..d756731 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-panels-controller.css @@ -0,0 +1,218 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +/* Styling to apply to component children based on conditional +host styling. This should be removed when the ::shadow pseudo +selector is available. */ +/* + TODO(sorvell): include a reasonable set of default panel + animations. +*/ +/* +TODO(sorvell): remove when this issue is addressed: + https://www.w3.org/Bugs/Public/show_bug.cgi?id=21389 + +*/ +g-panels > * { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + -webkit-transform: translateZ(0); + transform: translateZ(0); +} + +g-panels > g-panels { + position: absolute; +} + +g-panels > .transition { + -webkit-transition: all 0.218s ease-in-out; + transition: all 0.218s ease-in-out; +} + +g-panels > .animate { + -webkit-animation-duration: 0.218s; + -webkit-animation-fill-mode: both; + animation-duration: 0.218s; + animation-fill-mode: both; +} + +/* fade */ +g-panels > .panels-ascending-from, g-panels > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeOut; + animation: 0.218s both; + animation-name: g-panels-fadeOut; +} +g-panels > .panels-ascending-to, g-panels > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeIn; + animation: 0.218s both; + animation-name: g-panels-fadeIn; +} + +/* +TODO(sorvell): remove host conditional styling when this issue is addressed: + https://www.w3.org/Bugs/Public/show_bug.cgi?id=21390 +*/ +g-panels-hslide > .panels-ascending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideLeft; + animation: 0.218s both; + animation-name: g-panels-slideLeft; +} +.g-panels-hslide > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromRight; + animation: 0.218s both; + animation-name: g-panels-slideFromRight; +} +.g-panels-hslide > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideRight; + animation: 0.218s both; + animation-name: g-panels-slideRight; +} +.g-panels-hslide > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromLeft; + animation: 0.218s both; + animation-name: g-panels-slideFromLeft; +} + +/* vslide */ +.g-panels-vslide > .panels-ascending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideTop; + animation: 0.218s both; + animation-name: g-panels-slideTop; +} +.g-panels-vslide > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromBottom; + animation: 0.218s both; + animation-name: g-panels-slideFromBottom; +} +.g-panels-vslide > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideBottom; + animation: 0.218s both; + animation-name: g-panels-slideBottom; +} +.g-panels-vslide > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromTop; + animation: 0.218s both; + animation-name: g-panels-slideFromTop; +} + +/* hslideover */ +.g-panels-hslideover > .panels-ascending-from, +.g-panels-hslideover > .panels-descending-from { + -webkit-animation-name: none; + animation-name: none; +} +.g-panels-hslideover > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromRight; + animation: 0.218s both; + animation-name: g-panels-slideFromRight; +} +.g-panels-hslideover > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromLeft; + animation: 0.218s both; + animation-name: g-panels-slideFromLeft; +} + +/* vslideover */ +.g-panels-vslideover > .panels-ascending-from, +.g-panels-vslideover > .panels-descending-from { + -webkit-animation-name: none; + animation-name: none; +} +.g-panels-vslideover > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromBottom; + animation: 0.218s both; + animation-name: g-panels-slideFromBottom; +} +.g-panels-vslideover > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromTop; + animation: 0.218s both; + animation-name: g-panels-slideFromTop; +} + +/* explode */ +.g-panels-explode > .panels-ascending-from, +.g-panels-explode > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-explodeOut; + animation: 0.218s both; + animation-name: g-panels-explodeOut; +} +.g-panels-explode > .panels-ascending-to, +.g-panels-explode > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-explodeIn; + animation: 0.218s both; + animation-name: g-panels-explodeIn; +} + +/* scale-slide */ +.g-panels-scale-slide > .panels-ascending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeScaleOut; + animation: 0.218s both; + animation-name: g-panels-fadeScaleOut; +} +.g-panels-scale-slide > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideFromRight; + animation: 0.218s both; + animation-name: g-panels-slideFromRight; +} +.g-panels-scale-slide > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-slideRight; + animation: 0.218s both; + animation-name: g-panels-slideRight; +} +.g-panels-scale-slide > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeScaleIn; + animation: 0.218s both; + animation-name: g-panels-fadeScaleIn; +} + +/* fly-up-right */ +.g-panels-fly-up-right > .panels-ascending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-flyOutRight; + animation: 0.218s both; + animation-name: g-panels-flyOutRight; +} +.g-panels-fly-up-right > .panels-ascending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeInPartial; + animation: 0.218s both; + animation-name: g-panels-fadeInPartial; +} +.g-panels-fly-up-right > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeOutPartial; + animation: 0.218s both; + animation-name: g-panels-fadeOutPartial; +} +.g-panels-fly-up-right > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-flyInLeft; + animation: 0.218s both; + animation-name: g-panels-flyInLeft; +} \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-panels-global.css b/examples/polymer/toolkit-ui/elements/css/g-panels-global.css new file mode 100644 index 0000000..b0ddd54 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-panels-global.css @@ -0,0 +1,412 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ +@-webkit-keyframes g-panels-fadeOut { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +@keyframes g-panels-fadeOut { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} + +@-webkit-keyframes g-panels-fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +@keyframes g-panels-fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +@-webkit-keyframes g-panels-fadeInPartial { + 0% { + opacity: 0.25; + } + 100% { + opacity: 1; + } +} + +@keyframes g-panels-fadeInPartial { + 0% { + opacity: 0.25; + } + 100% { + opacity: 1; + } +} + +@-webkit-keyframes g-panels-fadeOutPartial { + 0% { + opacity: 1; + } + 100% { + opacity: 0.25; + } +} + +@keyframes g-panels-fadeOutPartial { + 0% { + opacity: 1; + } + 100% { + opacity: 0.25; + } +} + +@-webkit-keyframes g-panels-fadeScaleIn { + 0% { + z-index: 0; + opacity: 0.5; + -webkit-transform: scale(0.9) translateZ(0); + } + 20% { + z-index: 0; + -webkit-transform: scale(0.9) translateZ(0); + } + 100% { + z-index: 0; + opacity: 1; + -webkit-transform: scale(1) translateZ(0); + } +} + +@keyframes g-panels-fadeScaleIn { + 0% { + z-index: 0; + opacity: 0.5; + transform: scale(0.9) translateZ(0); + } + 20% { + z-index: 0; + transform: scale(0.9) translateZ(0); + } + 100% { + z-index: 0; + opacity: 1; + transform: scale(1) translateZ(0); + } +} + +@-webkit-keyframes g-panels-fadeScaleOut { + 0% { + z-index: 0; + opacity: 1; + -webkit-transform: scale(1) translateZ(0); + } + 20% { + z-index: 0; + -webkit-transform: scale(0.9) translateZ(0); + } + 100% { + z-index: 0; + opacity: 0.5; + -webkit-transform: scale(0.9) translateZ(0); + } +} + +@keyframes g-panels-fadeScaleOut { + 0% { + z-index: 0; + opacity: 1; + transform: scale(1) translateZ(0); + } + 20% { + z-index: 0; + transform: scale(0.9) translateZ(0); + } + 100% { + z-index: 0; + opacity: 0.5; + transform: scale(0.9) translateZ(0); + } +} + +@-webkit-keyframes g-panels-slideRight { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(100%, 0, 0); + } +} + +@keyframes g-panels-slideRight { + 0% { + z-index: 1; + transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(100%, 0, 0); + } +} + +@-webkit-keyframes g-panels-slideFromRight { + 0% { + z-index: 1; + -webkit-transform: translate3d(100%, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes g-panels-slideFromRight { + 0% { + z-index: 1; + transform: translate3d(100%, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, 0, 0); + } +} + +@-webkit-keyframes g-panels-slideLeft { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(-100%, 0, 0); + } +} + +@keyframes g-panels-slideLeft { + 0% { + z-index: 1; + transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(-100%, 0, 0); + } +} + +@-webkit-keyframes g-panels-slideFromLeft { + 0% { + z-index: 1; + -webkit-transform: translate3d(-100%, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes g-panels-slideFromLeft { + 0% { + z-index: 1; + transform: translate3d(-100%, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, 0, 0); + } +} + +@-webkit-keyframes g-panels-slideBottom { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, 100%, 0); + } +} + +@keyframes g-panels-slideBottom { + 0% { + z-index: 1; + transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, 100%, 0); + } +} + +@-webkit-keyframes g-panels-slideFromBottom { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, 100%, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes g-panels-slideFromBottom { + 0% { + z-index: 1; + transform: translate3d(0, 100%, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, 0, 0); + } +} + +@-webkit-keyframes g-panels-slideTop { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, -100%, 0); + } +} + +@keyframes g-panels-slideTop { + 0% { + z-index: 1; + transform: translate3d(0, 0, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, -100%, 0); + } +} + +@-webkit-keyframes g-panels-slideFromTop { + 0% { + z-index: 1; + -webkit-transform: translate3d(0, -100%, 0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0, 0, 0); + } +} + +@keyframes g-panels-slideFromTop { + 0% { + z-index: 1; + transform: translate3d(0, -100%, 0); + } + 100% { + z-index: 1; + transform: translate3d(0, 0, 0); + } +} + +@-webkit-keyframes g-panels-explodeOut { + 0% { + -webkit-transform: scale(1) translateZ(0); + opacity: 1; + } + 100% { + -webkit-transform: scale(0) translateZ(0); + opacity: 0; + } +} + +@keyframes g-panels-explodeOut { + 0% { + transform: scale(1) translateZ(0); + opacity: 1; + } + 100% { + transform: scale(0) translateZ(0); + opacity: 0; + } +} + +@-webkit-keyframes g-panels-explodeIn { + 0% { + z-index: 1; + -webkit-transform: scale(0) translateZ(0); + opacity: 0; + } + 100% { + z-index: 1; + -webkit-transform: scale(1) translateZ(0); + opacity: 1; + } +} + +@keyframes g-panels-explodeIn { + 0% { + z-index: 1; + transform: scale(0) translateZ(0); + opacity: 0; + } + 100% { + z-index: 1; + transform: scale(1) translateZ(0); + opacity: 1; + } +} + +@-webkit-keyframes g-panels-flyOutRight { + 0% { + z-index: 1; + -webkit-transform: translate3d(0,0,0) rotate(0); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(10%, -110%, 0) rotate(5deg); + } +} + +@keyframes g-panels-flyOutRight { + 0% { + z-index: 1; + transform: translate3d(0,0,0) rotate(0); + } + 100% { + z-index: 1; + transform: translate3d(10%, -110%, 0) rotate(5deg); + } +} + +@-webkit-keyframes g-panels-flyInLeft { + 0% { + z-index: 1; + -webkit-transform: translate3d(10%, -110%, 0) rotate(5deg); + } + 100% { + z-index: 1; + -webkit-transform: translate3d(0,0,0) rotate(0deg); + } +} + +@keyframes g-panels-flyInLeft { + 0% { + z-index: 1; + transform: translate3d(10%, -110%, 0) rotate(5deg); + } + 100% { + z-index: 1; + transform: translate3d(0,0,0) rotate(0deg); + } +} \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-panels.css b/examples/polymer/toolkit-ui/elements/css/g-panels.css new file mode 100644 index 0000000..a345322 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-panels.css @@ -0,0 +1,43 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ +@host { + * { + display: block; + position: relative; + outline: none; + overflow: hidden; + } +} + +/* TODO(sorvell): need to style only distributed children. + (*) styles children and all descendants. + Filed related issue + https://www.w3.org/Bugs/Public/show_bug.cgi?id=21389 +*/ + +/* +content::-webkit-distributed(*) { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + -webkit-transform: translateZ(0); +} + +content::-webkit-distributed(g-panels), g-panels > g-panels { + position: absolute; +} + +content::-webkit-distributed(.transition), g-panels > .transition { + -webkit-transition: all 0.218s ease-in-out; +} + +content::-webkit-distributed(.animate), g-panels > .animate { + -webkit-animation-duration: 0.218s; + -webkit-animation-fill-mode: both; +} +*/ \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-tabpanels-controller.css b/examples/polymer/toolkit-ui/elements/css/g-tabpanels-controller.css new file mode 100644 index 0000000..8836c29 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-tabpanels-controller.css @@ -0,0 +1,53 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + + +/*@polyfill #container > * */ +g-tabpanels > * { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + -webkit-transform: translateZ(0); + transform: translateZ(0); +} + +/*@polyfill #container > g-panels */ +g-tabpanels > g-panels { + position: absolute; +} + +/*@polyfill #container > .transition */ +g-tabpanels > .transition { + -webkit-transition: all 0.218s ease-in-out; + transition: all 0.218s ease-in-out; +} + +/*@polyfill #container > .animate */ +g-tabpanels > .animate { + -webkit-animation-duration: 0.218s; + -webkit-animation-fill-mode: both; + animation-duration: 0.218s; + animation-fill-mode: both; +} + +/* fade */ +/*@polyfill #container > .panels-ascending-from, #container > .panels-descending-from */ +g-tabpanels > .panels-ascending-from, g-tabpanels > .panels-descending-from { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeOut; + animation: 0.218s both; + animation-name: g-panels-fadeOut; +} + +/*@polyfill #container > .panels-ascending-to, #container > .panels-descending-to */ +g-tabpanels > .panels-ascending-to, g-tabpanels > .panels-descending-to { + -webkit-animation: 0.218s both; + -webkit-animation-name: g-panels-fadeIn; + animation: 0.218s both; + animation-name: g-panels-fadeIn; +} \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/css/g-togglebutton.css b/examples/polymer/toolkit-ui/elements/css/g-togglebutton.css new file mode 100644 index 0000000..d25e44d --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/css/g-togglebutton.css @@ -0,0 +1,96 @@ +/* + * Copyright 2013 The Polymer Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ +@host { + * { + display: inline-block; + position: relative; + width: 70px; + height: 30px; + overflow: hidden; + border: 1px solid #b6b6b6; + border-radius: 3px; + box-shadow: inset 0px 0px 1px 0 rgba(0,0,0,0.1); + -webkit-user-select: none; + -moz-user-select: none; + -webkit-transition: border 0.130s ease-out; + transition: border 0.130s ease-out; + cursor: pointer; + } + + *.on { + border: 1px solid #4584f2; + } +} + +.toggle { + position: absolute; + left: -42px; + width: 112px; + height: 100%; + overflow: hidden; + white-space: nowrap; + -webkit-transition: left 0.130s ease-out; + transition: left 0.130s ease-out; +} + +.toggle.dragging { + -webkit-transition: all 0; + transition: all 0; +} + +.toggle.on { + left: 0; +} + +.toggle > * { + float: left; +} + +.on-label, .off-label { + width: 50%; + height: 100%; + line-height: 30px; + box-sizing: border-box; + -moz-box-sizing: border-box; + text-align: center; + font-family: 'Helvetica Neue', Helvetica, Arial, 'open sans', sans-serif; + font-size: 10px; +} + +.on-label { + padding-right: 14px; + background-color: #488afd; + color: white; +} + +.off-label { + padding-left: 14px; + background-color: #bfbfbf; + color: #716f6f; +} + +.thumb { + position: absolute; + left: 42px; + width: 28px; + height: 100%; + border-radius: 2px; + background-color: white; +} + +.thumb::after { + content: ""; + position: absolute; + display: block; + top: 10px; + left: 11px; + height: 10px; + width: 8px; + background-image: -webkit-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-image: -moz-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-image: -ms-linear-gradient(left, #d4d3d3 40%, transparent 40%); + background-size: 4px; +} diff --git a/examples/polymer/toolkit-ui/elements/g-ajax.html b/examples/polymer/toolkit-ui/elements/g-ajax.html new file mode 100644 index 0000000..ca2c94f --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-ajax.html @@ -0,0 +1,183 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-app.html b/examples/polymer/toolkit-ui/elements/g-app.html new file mode 100644 index 0000000..ab7402c --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-app.html @@ -0,0 +1,137 @@ + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-checkbox.html b/examples/polymer/toolkit-ui/elements/g-checkbox.html new file mode 100644 index 0000000..1f82934 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-checkbox.html @@ -0,0 +1,33 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-field.html b/examples/polymer/toolkit-ui/elements/g-field.html new file mode 100644 index 0000000..fd57770 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-field.html @@ -0,0 +1,69 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-form.html b/examples/polymer/toolkit-ui/elements/g-form.html new file mode 100644 index 0000000..5999887 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-form.html @@ -0,0 +1,17 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-icon-button.html b/examples/polymer/toolkit-ui/elements/g-icon-button.html new file mode 100644 index 0000000..d08e970 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-icon-button.html @@ -0,0 +1,86 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-icon.html b/examples/polymer/toolkit-ui/elements/g-icon.html new file mode 100644 index 0000000..e89d611 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-icon.html @@ -0,0 +1,68 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-jsonp.html b/examples/polymer/toolkit-ui/elements/g-jsonp.html new file mode 100644 index 0000000..3dd3344 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-jsonp.html @@ -0,0 +1,93 @@ + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-menu-button.html b/examples/polymer/toolkit-ui/elements/g-menu-button.html new file mode 100644 index 0000000..8674db6 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-menu-button.html @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-menu-item.html b/examples/polymer/toolkit-ui/elements/g-menu-item.html new file mode 100644 index 0000000..2f3496b --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-menu-item.html @@ -0,0 +1,64 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-menu.html b/examples/polymer/toolkit-ui/elements/g-menu.html new file mode 100644 index 0000000..21108b9 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-menu.html @@ -0,0 +1,65 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-overlay-webanimations.html b/examples/polymer/toolkit-ui/elements/g-overlay-webanimations.html new file mode 100644 index 0000000..b778ae2 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-overlay-webanimations.html @@ -0,0 +1,111 @@ + + + + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-overlay.html b/examples/polymer/toolkit-ui/elements/g-overlay.html new file mode 100644 index 0000000..5d80bdc --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-overlay.html @@ -0,0 +1,288 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-panels.html b/examples/polymer/toolkit-ui/elements/g-panels.html new file mode 100644 index 0000000..ccf450f --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-panels.html @@ -0,0 +1,475 @@ + + + + + + + + + \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/g-progress.html b/examples/polymer/toolkit-ui/elements/g-progress.html new file mode 100644 index 0000000..8948215 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-progress.html @@ -0,0 +1,39 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-radio.html b/examples/polymer/toolkit-ui/elements/g-radio.html new file mode 100644 index 0000000..7f420f4 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-radio.html @@ -0,0 +1,27 @@ + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-ratings.html b/examples/polymer/toolkit-ui/elements/g-ratings.html new file mode 100644 index 0000000..31cf8c1 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-ratings.html @@ -0,0 +1,94 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-ribbon.html b/examples/polymer/toolkit-ui/elements/g-ribbon.html new file mode 100644 index 0000000..aaaaa4c --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-ribbon.html @@ -0,0 +1,117 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-select.html b/examples/polymer/toolkit-ui/elements/g-select.html new file mode 100644 index 0000000..076fa0f --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-select.html @@ -0,0 +1,56 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-selection.html b/examples/polymer/toolkit-ui/elements/g-selection.html new file mode 100644 index 0000000..36a8737 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-selection.html @@ -0,0 +1,64 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-selector.html b/examples/polymer/toolkit-ui/elements/g-selector.html new file mode 100644 index 0000000..1f18f72 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-selector.html @@ -0,0 +1,180 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-sidebar.html b/examples/polymer/toolkit-ui/elements/g-sidebar.html new file mode 100644 index 0000000..12d401f --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-sidebar.html @@ -0,0 +1,88 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-tabpanels.html b/examples/polymer/toolkit-ui/elements/g-tabpanels.html new file mode 100644 index 0000000..01bd064 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-tabpanels.html @@ -0,0 +1,65 @@ + + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-tabs.html b/examples/polymer/toolkit-ui/elements/g-tabs.html new file mode 100644 index 0000000..a9c1d26 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-tabs.html @@ -0,0 +1,65 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-togglebutton.html b/examples/polymer/toolkit-ui/elements/g-togglebutton.html new file mode 100644 index 0000000..20b5060 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-togglebutton.html @@ -0,0 +1,73 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-toolbar.html b/examples/polymer/toolkit-ui/elements/g-toolbar.html new file mode 100644 index 0000000..5824ac9 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-toolbar.html @@ -0,0 +1,90 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/g-xhr.html b/examples/polymer/toolkit-ui/elements/g-xhr.html new file mode 100644 index 0000000..4fd05d0 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/g-xhr.html @@ -0,0 +1,92 @@ + + + + + + \ No newline at end of file diff --git a/examples/polymer/toolkit-ui/elements/images/btn_light.png b/examples/polymer/toolkit-ui/elements/images/btn_light.png new file mode 100644 index 0000000..122af8d Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/btn_light.png differ diff --git a/examples/polymer/toolkit-ui/elements/images/dark_check.png b/examples/polymer/toolkit-ui/elements/images/dark_check.png new file mode 100644 index 0000000..6cd51a3 Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/dark_check.png differ diff --git a/examples/polymer/toolkit-ui/elements/images/light_check.png b/examples/polymer/toolkit-ui/elements/images/light_check.png new file mode 100644 index 0000000..4f141a1 Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/light_check.png differ diff --git a/examples/polymer/toolkit-ui/elements/images/ribbon_bg.png b/examples/polymer/toolkit-ui/elements/images/ribbon_bg.png new file mode 100644 index 0000000..d4d4d31 Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/ribbon_bg.png differ diff --git a/examples/polymer/toolkit-ui/elements/images/star_blank.png b/examples/polymer/toolkit-ui/elements/images/star_blank.png new file mode 100644 index 0000000..f034646 Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/star_blank.png differ diff --git a/examples/polymer/toolkit-ui/elements/images/star_full.png b/examples/polymer/toolkit-ui/elements/images/star_full.png new file mode 100644 index 0000000..911b822 Binary files /dev/null and b/examples/polymer/toolkit-ui/elements/images/star_full.png differ diff --git a/examples/polymer/toolkit-ui/elements/panel-transitions/g-flow-panel-transition.html b/examples/polymer/toolkit-ui/elements/panel-transitions/g-flow-panel-transition.html new file mode 100644 index 0000000..e4317bb --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/panel-transitions/g-flow-panel-transition.html @@ -0,0 +1,155 @@ + + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/panel-transitions/g-keyframe-panel-transition.html b/examples/polymer/toolkit-ui/elements/panel-transitions/g-keyframe-panel-transition.html new file mode 100644 index 0000000..78660e5 --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/panel-transitions/g-keyframe-panel-transition.html @@ -0,0 +1,47 @@ + + + + + + diff --git a/examples/polymer/toolkit-ui/elements/panel-transitions/g-panel-transition.html b/examples/polymer/toolkit-ui/elements/panel-transitions/g-panel-transition.html new file mode 100644 index 0000000..895aa2b --- /dev/null +++ b/examples/polymer/toolkit-ui/elements/panel-transitions/g-panel-transition.html @@ -0,0 +1,97 @@ + + + + + + + + + \ No newline at end of file diff --git a/examples/promises.html b/examples/promises.html index eb6e7b8..d3f2af4 100644 --- a/examples/promises.html +++ b/examples/promises.html @@ -11,7 +11,7 @@ - + + diff --git a/src/epubcfi.js b/src/epubcfi.js index c8ffff0..a10cada 100644 --- a/src/epubcfi.js +++ b/src/epubcfi.js @@ -4,7 +4,8 @@ EPUBJS.EpubCFI = function(cfiStr){ EPUBJS.EpubCFI.prototype.generateChapter = function(spineNodeIndex, pos, id) { - var spineNodeIndex = spineNodeIndex + 1, + var pos = parseInt(pos), + spineNodeIndex = spineNodeIndex + 1, cfi = '/'+spineNodeIndex+'/'; cfi += (pos + 1) * 2; diff --git a/src/renderer.js b/src/renderer.js index 9988bb0..2ea098b 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -216,8 +216,8 @@ EPUBJS.Renderer.prototype.setIframeSrc = function(url){ renderer.currentLocationCfi = renderer.getPageCfi(); - renderer.trigger("renderer:chapterDisplayed"); - renderer.book.trigger("renderer:chapterDisplayed"); + renderer.trigger("renderer:chapterDisplayed", renderer.currentChapter); + renderer.book.trigger("renderer:chapterDisplayed", renderer.currentChapter); renderer.visible(true); @@ -272,7 +272,7 @@ EPUBJS.Renderer.prototype.formatSpread = function(){ this.spreadWidth = (this.colWidth + this.gap) * divisor; - if(this.bodyEl) this.bodyEl.style.margin = 0; + // if(this.bodyEl) this.bodyEl.style.margin = 0; // this.bodyEl.style.fontSize = localStorage.getItem("fontSize") || "medium"; //-- Clear Margins