You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parallel-library/cps/static/js/epub.min.js

2 lines
60 KiB
JavaScript

!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.index<b.index?-1:1}),"value")};var C=function(a,b,c,d){var e={},f=B(b||x.identity);return y(a,function(b,g){var h=f.call(c,b,g,a);d(e,h,b)}),e};x.groupBy=function(a,b,c){return C(a,b,c,function(a,b,c){(x.has(a,b)?a[b]:a[b]=[]).push(c)})},x.countBy=function(a,b,c){return C(a,b,c,function(a,b){x.has(a,b)||(a[b]=0),a[b]++})},x.sortedIndex=function(a,b,c,d){c=null==c?x.identity:B(c);for(var e=c.call(d,b),
},EPUBJS.Book.prototype.prevPage=function(){var a;return this.isRendered?(a=this.render.prevPage(),a?void 0:this.prevChapter()):this._enqueue("prevPage",arguments)},EPUBJS.Book.prototype.nextChapter=function(){return this.spinePos>this.spine.length?void 0:(this.spinePos++,this.displayChapter(this.spinePos))},EPUBJS.Book.prototype.prevChapter=function(){return this.spinePos<1?void 0:(this.spinePos--,this.displayChapter(this.spinePos,!0))},EPUBJS.Book.prototype.getCurrentLocationCfi=function(){return this.isRendered?this.render.currentLocationCfi:!1},EPUBJS.Book.prototype.gotoCfi=function(a){return this.isRendered?this.displayChapter(a):(this.settings.previousLocationCfi=a,void 0)},EPUBJS.Book.prototype.goto=function(a){var b,c,d,e,f=new RSVP.defer;return this.isRendered?(b=a.split("#"),c=b[0],d=b[1]||!1,e=this.spineIndexByURL[c],c||(e=this.chapter?this.chapter.spinePos:0),"number"!=typeof e?!1:this.chapter&&e==this.chapter.spinePos?(d&&this.render.section(d),f.resolve(this.currentChapter),f.promise):this.displayChapter(e).then(function(){d&&this.render.section(d)}.bind(this))):(this.settings.goto=a,void 0)},EPUBJS.Book.prototype.preloadNextChapter=function(){var a,b=this.spinePos+1;return b>=this.spine.length?!1:(a=new EPUBJS.Chapter(this.spine[b]),a&&EPUBJS.core.request(a.absolute),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){return this.isRendered?(this.settings.styles[a]=b,this.render.setStyle(a,b,c),this.render.reformat(),void 0):this._enqueue("setStyle",arguments)},EPUBJS.Book.prototype.removeStyle=function(a){return this.isRendered?(this.render.removeStyle(a),this.render.reformat(),delete this.settings.styles[a],void 0):this._enqueue("removeStyle",arguments)},EPUBJS.Book.prototype.useSpreads=function(a){return this.isRendered?(this.settings.spreads=a,this.render.reformat(),this.trigger("book:spreads",a),void 0):this._enqueue("useSpreads",arguments)},EPUBJS.Book.prototype.unload=function(){this.settings.restore&&this.saveContents(),this.trigger("book:unload")},EPUBJS.Book.prototype.destroy=function(){window.removeEventListener("beforeunload",this.unload),this.currentChapter&&this.currentChapter.unload(),this.unload(),this.render&&this.render.remove()},EPUBJS.Book.prototype._enqueue=function(a,b){this._q.push({command:a,args:b})},EPUBJS.Book.prototype._ready=function(){this.trigger("book:ready")},EPUBJS.Book.prototype._rendered=function(){var a=this;this.isRendered=!0,this.trigger("book:rendered"),this._q.forEach(function(b){a[b.command].apply(a,b.args)})},EPUBJS.Book.prototype.getHooks=function(){var a,b=this;_.values(this.hooks);for(var c in this.hooks)a=_.values(EPUBJS.Hooks[c]),a.forEach(function(a){b.registerHook(c,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),RSVP.on("error",function(){}),RSVP.configure("instrument",!0),RSVP.on("rejected",function(a){console.error(a.detail.message,a.detail.stack)}),EPUBJS.Chapter=function(a){this.href=a.href,this.absolute=a.url,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.defer;return a?(this.tempUrl||(this.tempUrl=a.getUrl(this.absolute)),this.tempUrl):(b.resolve(this.absolute),b.promise)},EPUBJS.Chapter.prototype.setPages=functi