1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-732174cc"],{"11cc":function(t,e,n){"use strict";n("2570")},"154f":function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"playing-item-wrapper"},t._l(t.styles,(function(t,e){return n("div",{key:e,ref:"playingItem",refInFor:!0,staticClass:"playing-item",style:t})})),0)},a=[],s=(n("ac6a"),n("c5f6"),n("fa7d")),o={props:{number:Number},computed:{styles:function(){for(var t=new Array(this.number),e=0;e<t.length;e++)t[e]={height:Object(s["c"])(this.random())+"rem"};return t}},methods:{startAnimation:function(){var t=this;this.task=setInterval((function(){t.$refs.playingItem.forEach((function(e){e.style.height=Object(s["c"])(t.random())+"rem"}))}),200)},stopAnimation:function(){this.task&&clearInterval(this.task)},random:function(){return Math.ceil(10*Math.random())}}},r=o,c=(n("310c"),n("2877")),l=Object(c["a"])(r,i,a,!1,null,"05e64438",null);e["a"]=l.exports},2125:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"bottom-wrapper",class:{"hide-play":!t.showPlay}},[t.showPlay?n("div",{staticClass:"bottom-playing-wrapper",on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.onPlayingCardClick.apply(null,arguments)}}},[n("div",{staticClass:"bottom-playing-left"},[n("div",{staticClass:"icon-play-wrapper",on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.togglePlay.apply(null,arguments)}}},[t.isPlaying?n("span",{staticClass:"icon-play_pause"}):n("span",{staticClass:"icon-play_go"})])]),n("div",{staticClass:"bottom-playing-right"},[n("div",{staticClass:"bottom-playing-chapter-text"},[n("span",{staticClass:"chapter-label"},[t._v(t._s(t.chapter?t.chapter.label:""))]),t.currentSectionIndex&&t.currentSectionTotal?n("span",{staticClass:"bottom-playing-page-text"},[t._v("( "+t._s(t.currentSectionIndex)+" / "+t._s(t.currentSectionTotal)+" )")]):t._e()]),n("div",{staticClass:"bottom-playing-page-text"},[t._v(t._s(t.playInfo?t.playInfo.currentMinute:"00")+":"+t._s(t.playInfo?t.playInfo.currentSecond:"00")+" / "+t._s(t.playInfo?t.playInfo.totalMinute:"00")+":"+t._s(t.playInfo?t.playInfo.totalSecond:"00"))])])]):t._e(),n("div",{staticClass:"bottom-btn-wrapper"},[n("span",{staticClass:"bottom-btn-text"},[t._v(t._s(t.$t("detail.addOrRemoveShelf")))])])])},a=[],s=(n("c5f6"),{props:{chapter:Object,currentSectionIndex:Number,currentSectionTotal:Number,showPlay:Boolean,isPlaying:Boolean,playInfo:Object},methods:{togglePlay:function(){this.$parent.togglePlay()},onPlayingCardClick:function(){this.$emit("onPlayingCardClick")}}}),o=s,r=(n("d52c"),n("2877")),c=Object(r["a"])(o,i,a,!1,null,"f53ea660",null);e["a"]=c.exports},24447:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"book-speak-mask-wrapper",on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.hide.apply(null,arguments)}}},[n("transition",{attrs:{name:"popup-slide-up"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.speakCardVisible,expression:"speakCardVisible"}],staticClass:"book-speak-mask-card-wrapper",on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.hide.apply(null,arguments)}}},[n("div",{staticClass:"pulldown-icon-wrapper",on:{click:t.hide}},[n("span",{staticClass:"icon-pull_down"})]),n("div",{staticClass:"card-title-wrapper"},[n("div",{staticClass:"icon-speak-wrapper"},[n("span",{staticClass:"icon-speak"})]),n("div",{staticClass:"speak-title-wrapper"},[n("span",{staticClass:"speak-title"},[t._v(t._s(t.$t("speak.voice")))])]),n("div",{staticClass:"read-fulltext-wrapper"},[n("span",{staticClass:"read-fulltext"},[t._v(t._s(t.$t("speak.read")))])])]),n("div",{staticClass:"card-section-title-wrapper"},[n("div",{staticClass:"card-section-title-text"},[t._v(t._s(t.title))]),t.currentSectionIndex?n("div",{staticClass:"card-section-sub-title-text"},[t._v(t._s(t.currentSectionIndex)+" /\n "+t._s(t.currentSectionTotal)+"\n ")]):t._e()]),n("div",{staticClass:"setting-progress"},[n("div",{staticClass:"progress-wrapper"},[n("input",{ref:"progress",staticClass:"progress",attrs:{type:"range",max:"100",min:"0",step:"1"},domProps:{value:t.progress},on:{change:function(e){return t.onProgressChange(e.target.value)},input:function(e){return t.onProgressInput(e.target.value)}}})]),n("div",{staticClass:"progress-text"},[n("div",{staticClass:"progress-text-current"},[t._v(t._s(t.playInfo?t.playInfo.currentMinute:"00")+":"+t._s(t.playInfo?t.playInfo.currentSecond:"00")+"\n ")]),n("div",{staticClass:"progress-text-left"},[t._v("-"+t._s(t.playInfo?t.playInfo.leftMinute:"00")+":"+t._s(t.playInfo?t.playInfo.leftSecond:"00")+"\n ")])])]),n("div",{staticClass:"playing-wrapper"},[n("div",{staticClass:"icon-settings-wrapper"},[n("span",{staticClass:"icon-settings"}),n("div",{staticClass:"settings-text"},[t._v(t._s(t.$t("speak.settings")))])]),n("span",{staticClass:"icon-play_backward",class:{"not-use":t.currentSectionIndex<=1},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.prev.apply(null,arguments)}}}),n("div",{staticClass:"icon-play-wrapper",on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.togglePlay.apply(null,arguments)}}},[t.isPlaying?n("span",{staticClass:"icon-play_pause"}):n("span",{staticClass:"icon-play_go"})]),n("span",{staticClass:"icon-play_forward",class:{"not-use":t.currentSectionIndex>=t.currentSectionTotal},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),t.next.apply(null,arguments)}}}),n("div",{staticClass:"icon-clock-wrapper"},[n("span",{staticClass:"icon-clock"}),n("div",{staticClass:"clock-text"},[t._v(t._s(t.$t("speak.timing")))])])]),n("div",{staticClass:"read-apply-wrapper"},[t._v("\n "+t._s(t.$t("speak.apply"))+"\n ")]),n("div",{staticClass:"read-title-wrapper"},[n("span",{staticClass:"line"}),n("div",{staticClass:"read-title-text"},[t._v(t._s(t.$t("speak.current")))]),n("span",{staticClass:"line"})]),n("div",{ref:"bookWrapper",staticClass:"book-wrapper"},[n("div",{attrs:{id:"book-read"}})])])])],1)])},a=[],s=(n("6b54"),n("a481"),n("c5f6"),n("fa7d")),o={props:{title:String,book:Object,section:Object,currentSectionIndex:Number,currentSectionTotal:Number,isPlaying:Boolean,playInfo:Object},data:function(){return{visible:!1,speakCardVisible:!1,progress:0,readHeight:0}},methods:{refreshProgress:function(t){this.progress=t,this.$refs.progress.style.backgroundSize="".concat(this.progress,"% 100%")},updateText:function(t){var e=this;t.then((function(){var t=e.rendition.currentLocation(),n=e.section.cfiBase,i=t.start.cfi.replace(/.*!/,"").replace(/\)/,""),a=t.end.cfi.replace(/.*!/,"").replace(/\)/,"");e.book.getRange("epubcfi(".concat(n,"!,").concat(i,",").concat(a,")")).then((function(t){var n=t.toString();n=n.replace(/\s(2,)/g,""),n=n.replace(/\r/g,""),n=n.replace(/\n/g,""),n=n.replace(/\t/g,""),n=n.replace(/\f/g,""),e.$emit("updateText",n)}))}))},togglePlay:function(){this.$parent.togglePlay()},prev:function(){var t=this;this.currentSectionIndex>1&&(this.updateText(this.rendition.prev()),this.$emit("update:currentSectionIndex",this.currentSectionIndex-1),this.$parent.resetPlay(),setTimeout((function(){t.$parent.togglePlay()}),500))},next:function(){var t=this;this.currentSectionIndex<this.currentSectionTotal&&(this.updateText(this.rendition.next()),this.$emit("update:currentSectionIndex",this.currentSectionIndex+1),this.$parent.resetPlay(),setTimeout((function(){t.$parent.togglePlay()}),500))},display:function(){this.rendition||(this.rendition=this.book.renderTo("book-read",{width:window.innerWidth>640?640:window.innerWidth,height:this.readHeight,method:"default"})),this.displayed=this.rendition.display(this.section.href)},onProgressChange:function(t){},onProgressInput:function(t){this.progress=t,this.$refs.progress.style.backgroundSize="".concat(this.progress,"% 100%")},hide:function(){this.speakCardVisible=!1,this.visible=!1},show:function(){var t=this;this.visible=!0,this.speakCardVisible=!0,this.refresh(),this.$nextTick((function(){t.display()}))},refresh:function(){this.readHeight=.9*window.innerHeight-Object(s["d"])(40)-Object(s["d"])(54)-Object(s["d"])(46)-Object(s["d"])(48)-Object(s["d"])(60)-Object(s["d"])(44),this.$refs.bookWrapper.style.height=this.readHeight+"px"}}},r=o,c=(n("d361"),n("2877")),l=Object(c["a"])(r,i,a,!1,null,"572a0c28",null);e["a"]=l.exports},2570:function(t,e,n){},"310c":function(t,e,n){"use strict";n("fc82")},"375e":function(t,e,n){},3846:function(t,e,n){n("9e1e")&&"g"!=/./g.flags&&n("86cc").f(RegExp.prototype,"flags",{configurable:!0,get:n("0bfb")})},5968:function(t,e,n){"use strict";(function(t){n("a481"),n("ac6a");var i=n("4785"),a=n("7da0"),s=n("4e1b"),o=n("154f"),r=n("2125"),c=n("24447"),l=n("ad72"),p=n("5de6"),u=n("b067"),d=n("101f"),h=n("fa7d"),f=n("a211");t.ePub=f["a"],e["a"]={components:{DetailTitle:i["a"],BookInfo:a["a"],Scroll:s["a"],SpeakPlaying:o["a"],Bottom:r["a"],SpeakWindow:c["a"],Toast:l["a"]},computed:{currentMinute:function(){var t=Math.floor(this.currentPlayingTime/60);return t<10?"0"+t:t},currentSecond:function(){var t=Math.floor(this.currentPlayingTime-60*parseInt(this.currentMinute));return t<10?"0"+t:t},totalMinute:function(){var t=Math.floor(this.totalPlayingTime/60);return t<10?"0"+t:t},totalSecond:function(){var t=Math.floor(this.totalPlayingTime-60*parseInt(this.totalMinute));return t<10?"0"+t:t},leftMinute:function(){var t=Math.floor((this.totalPlayingTime-this.currentPlayingTime)/60);return t<10?"0"+t:t},leftSecond:function(){var t=Math.floor(this.totalPlayingTime-this.currentPlayingTime-60*parseInt(this.leftMinute));return t<10?"0"+t:t},playInfo:function(){return this.audioCanPlay?{currentMinute:this.currentMinute,currentSecond:this.currentSecond,totalMinute:this.totalMinute,totalSecond:this.totalSecond,leftMinute:this.leftMinute,leftSecond:this.leftSecond}:null},lang:function(){return this.metadata?this.metadata.language:""},disableScroll:function(){return!!this.$refs.speakWindow&&this.$refs.speakWindow.visible},showPlay:function(){return this.playingIndex>=0},scrollBottom:function(){return this.showPlay?116:52},chapter:function(){return this.flatNavigation[this.playingIndex]},desc:function(){return this.description?this.description.substring(0,100):""},flatNavigation:function(){return this.navigation?Array.prototype.concat.apply([],Array.prototype.concat.apply([],this.doFlatNavigation(this.navigation.toc))):[]},category:function(){return this.bookItem?Object(p["h"])(this.bookItem.category):""},title:function(){return this.metadata?this.metadata.title:""},author:function(){return this.metadata?this.metadata.creator:""}},data:function(){return{bookItem:null,book:null,rendition:null,metadata:null,cover:null,navigation:null,description:null,ifShowContent:!0,playingIndex:-1,paragraph:null,currentSectionIndex:null,currentSectionTotal:null,section:null,isPlaying:!1,audio:null,audioCanPlay:!1,currentPlayingTime:0,totalPlayingTime:0,playStatus:0,toastText:"",isOnline:!1}},methods:{onAudioEnded:function(){this.resetPlay(),this.currentPlayingTime=this.$refs.audio.currentTime;var t=Math.floor(this.currentPlayingTime/this.totalPlayingTime*100);this.$refs.speakWindow.refreshProgress(t)},onTimeUpdate:function(){this.currentPlayingTime=this.$refs.audio.currentTime;var t=Math.floor(this.currentPlayingTime/this.totalPlayingTime*100);this.$refs.speakWindow.refreshProgress(t)},onCanPlay:function(){this.audioCanPlay=!0,this.currentPlayingTime=this.$refs.audio.currentTime,this.totalPlayingTime=this.$refs.audio.duration},findBookFromList:function(t){var e=this;Object(u["c"])().then((function(n){if(200===n.status){var i=n.data.data.filter((function(e){return e.fileName===t}));i&&i.length>0&&(e.bookItem=i[0],e.init())}}))},init:function(){var t=this,e=this.$route.query.fileName;this.bookItem||(this.bookItem=Object(p["f"])(e)),this.bookItem?Object(d["b"])(e,(function(e,n){if(e||!n){t.isOnline=!0;var i=t.$route.query.opf;i&&t.parseBook(i)}else t.isOnline=!1,t.parseBook(n)})):this.findBookFromList(e)},downloadBook:function(t){var e=this;Object(u["b"])(this.bookItem,(function(){Object(d["b"])(t,(function(t,n){t||e.parseBook(n)}))}))},parseBook:function(t){var e=this;this.book=new f["a"](t),this.book.loaded.metadata.then((function(t){e.metadata=t})),this.isOnline?this.book.coverUrl().then((function(t){e.cover=t})):this.book.loaded.cover.then((function(t){e.book.archive.createUrl(t).then((function(t){e.cover=t}))})),this.book.loaded.navigation.then((function(t){e.navigation=t})),this.display()},back:function(){this.$router.go(-1)},onScroll:function(t){t>Object(h["d"])(42)?this.$refs.title.showShadow():this.$refs.title.hideShadow()},toggleContent:function(){this.ifShowContent=!this.ifShowContent},display:function(){var t=.9*window.innerHeight-Object(h["d"])(40)-Object(h["d"])(54)-Object(h["d"])(46)-Object(h["d"])(48)-Object(h["d"])(60)-Object(h["d"])(44);this.rendition=this.book.renderTo("read",{width:window.innerWidth,height:t,method:"default"}),this.rendition.display()},doFlatNavigation:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[];return t.forEach((function(t){t.deep=n,i.push(t),t.subitems&&t.subitems.length>0&&i.push(e.doFlatNavigation(t.subitems,n+1))})),i},speak:function(t,e){var n=this;this.resetPlay(),this.playingIndex=e,this.$nextTick((function(){n.$refs.scroll.refresh()})),this.chapter&&(this.section=this.book.spine.get(this.chapter.href),this.rendition.display(this.section.href).then((function(t){var e=n.rendition.currentLocation(),i=t.cfiBase,a=e.start.cfi.replace(/.*!/,"").replace(/\)/,""),s=e.end.cfi.replace(/.*!/,"").replace(/\)/,"");n.currentSectionIndex=e.start.displayed.page,n.currentSectionTotal=e.start.displayed.total;var o="epubcfi(".concat(i,"!,").concat(a,",").concat(s,")");n.book.getRange(o).then((function(t){var e=t.toLocaleString();e=e.replace(/\s(2,)/g,""),e=e.replace(/\r/g,""),e=e.replace(/\n/g,""),e=e.replace(/\t/g,""),e=e.replace(/\f/g,""),n.updateText(e)}))})))},showToast:function(t){this.toastText=t,this.$refs.toast.show()},togglePlay:function(){this.isPlaying?this.pausePlay():0===this.playStatus?this.play():2===this.playStatus&&this.continuePlay()},resetPlay:function(){1===this.playStatus&&this.pausePlay(),this.isPlaying=!1,this.playStatus=0},play:function(){this.createVoice(this.paragraph)},continuePlay:function(){var t=this;this.$refs.audio.play().then((function(){t.$refs.speakPlaying[0].startAnimation(),t.isPlaying=!0,t.playStatus=1}))},pausePlay:function(){this.$refs.audio.pause(),this.$refs.speakPlaying[0].stopAnimation(),this.isPlaying=!1,this.playStatus=2},onPlayingCardClick:function(){this.$refs.speakWindow.show()},updateText:function(t){this.paragraph=t},createVoice:function(t){var e=new XMLHttpRequest;e.open("GET","".concat("http://47.99.166.157:3000","/voice?text=").concat(t,"&lang=").concat(this.lang.toLowerCase()),!1),e.send();var n=e.responseText;if(n){var i=JSON.parse(n);i.path?(this.$refs.audio.src=i.path,this.continuePlay()):this.showToast("播放失败,未生成链接")}else this.showToast("播放失败")}},mounted:function(){this.init()}}}).call(this,n("c8ba"))},"5ba8":function(t,e,n){},"6b54":function(t,e,n){"use strict";n("3846");var i=n("cb7c"),a=n("0bfb"),s=n("9e1e"),o="toString",r=/./[o],c=function(t){n("2aba")(RegExp.prototype,o,t,!0)};n("79e5")((function(){return"/a/b"!=r.call({source:"a",flags:"b"})}))?c((function(){var t=i(this);return"/".concat(t.source,"/","flags"in t?t.flags:!s&&t instanceof RegExp?a.call(t):void 0)})):r.name!=o&&c((function(){return r.call(this)}))},d361:function(t,e,n){"use strict";n("5ba8")},d52c:function(t,e,n){"use strict";n("375e")},d740:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"book-speaking"},[n("detail-title",{ref:"title",on:{back:t.back}}),n("scroll",{ref:"scroll",staticClass:"content-wrapper",attrs:{top:42,bottom:t.scrollBottom,ifNoScroll:t.disableScroll},on:{onScroll:t.onScroll}},[n("book-info",{attrs:{cover:t.cover,title:t.title,author:t.author,desc:t.desc}}),n("div",{staticClass:"book-speak-title-wrapper"},[n("div",{staticClass:"icon-speak-wrapper"},[n("span",{staticClass:"icon-speak"})]),n("div",{staticClass:"speak-title-wrapper"},[n("span",{staticClass:"speak-title"},[t._v(t._s(t.$t("speak.voice")))])]),n("div",{staticClass:"icon-down-wrapper",on:{click:t.toggleContent}},[n("span",{class:{"icon-down2":!t.ifShowContent,"icon-up":t.ifShowContent}})])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.ifShowContent,expression:"ifShowContent"}],staticClass:"book-detail-content-wrapper"},[n("div",{staticClass:"book-detail-content-list-wrapper"},[this.navigation?t._e():n("div",{staticClass:"loading-text-wrapper"},[n("span",{staticClass:"loading-text"},[t._v(t._s(t.$t("detail.loading")))])]),n("div",{staticClass:"book-detail-content-item-wrapper"},t._l(t.flatNavigation,(function(e,i){return n("div",{key:i,staticClass:"book-detail-content-item",on:{click:function(n){return t.speak(e,i)}}},[t.playingIndex===i?n("speak-playing",{ref:"speakPlaying",refInFor:!0,attrs:{number:5}}):t._e(),e.label?n("div",{staticClass:"book-detail-content-navigation-text",class:{"is-playing":t.playingIndex===i}},[t._v(t._s(e.label)+"\n ")]):t._e()],1)})),0)])]),n("audio",{ref:"audio",on:{canplay:t.onCanPlay,timeupdate:t.onTimeUpdate,ended:t.onAudioEnded}})],1),n("bottom",{attrs:{chapter:t.chapter,currentSectionIndex:t.currentSectionIndex,currentSectionTotal:t.currentSectionTotal,showPlay:t.showPlay,isPlaying:t.isPlaying,playInfo:t.playInfo},on:{"update:isPlaying":function(e){t.isPlaying=e},"update:is-playing":function(e){t.isPlaying=e},onPlayingCardClick:t.onPlayingCardClick}}),t._m(0),n("speak-window",{ref:"speakWindow",attrs:{title:this.chapter?this.chapter.label:"",book:t.book,section:t.section,currentSectionIndex:t.currentSectionIndex,currentSectionTotal:t.currentSectionTotal,isPlaying:t.isPlaying,playInfo:t.playInfo},on:{"update:currentSectionIndex":function(e){t.currentSectionIndex=e},"update:current-section-index":function(e){t.currentSectionIndex=e},"update:isPlaying":function(e){t.isPlaying=e},"update:is-playing":function(e){t.isPlaying=e},updateText:t.updateText}}),n("toast",{ref:"toast",attrs:{text:t.toastText}})],1)},a=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"book-wrapper"},[n("div",{attrs:{id:"read"}})])}],s=n("5968"),o=s["a"],r=(n("11cc"),n("2877")),c=Object(r["a"])(o,i,a,!1,null,"60b6a3e1",null);e["default"]=c.exports},fc82:function(t,e,n){}}]); |