Reader.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  1. <template>
  2. <div class="column no-wrap">
  3. <div v-show="toolBarActive" ref="header" class="header">
  4. <div ref="buttons" class="row justify-between no-wrap">
  5. <div>
  6. <button ref="loader" v-ripple class="tool-button" :class="buttonActiveClass('loader')" @click="buttonClick('loader')">
  7. <q-icon name="la la-arrow-left" size="32px" />
  8. <q-tooltip :delay="1500" anchor="bottom right" content-style="font-size: 80%">
  9. {{ rstore.readerActions['loader'] }}
  10. </q-tooltip>
  11. </button>
  12. </div>
  13. <div>
  14. <button v-show="showToolButton['undoAction']" ref="undoAction" v-ripple class="tool-button" :class="buttonActiveClass('undoAction')" @click="buttonClick('undoAction')">
  15. <q-icon name="la la-angle-left" size="32px" />
  16. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  17. {{ rstore.readerActions['undoAction'] }}
  18. </q-tooltip>
  19. </button>
  20. <button v-show="showToolButton['redoAction']" ref="redoAction" v-ripple class="tool-button" :class="buttonActiveClass('redoAction')" @click="buttonClick('redoAction')">
  21. <q-icon name="la la-angle-right" size="32px" />
  22. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  23. {{ rstore.readerActions['redoAction'] }}
  24. </q-tooltip>
  25. </button>
  26. <div class="space"></div>
  27. <button v-show="showToolButton['fullScreen']" ref="fullScreen" v-ripple class="tool-button" :class="buttonActiveClass('fullScreen')" @click="buttonClick('fullScreen')">
  28. <q-icon :name="(fullScreenActive ? 'la la-compress-arrows-alt': 'la la-expand-arrows-alt')" size="32px" />
  29. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  30. {{ rstore.readerActions['fullScreen'] }}
  31. </q-tooltip>
  32. </button>
  33. <button v-show="showToolButton['scrolling']" ref="scrolling" v-ripple class="tool-button" :class="buttonActiveClass('scrolling')" @click="buttonClick('scrolling')">
  34. <q-icon name="la la-film" size="32px" />
  35. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  36. {{ rstore.readerActions['scrolling'] }}
  37. </q-tooltip>
  38. </button>
  39. <button v-show="showToolButton['setPosition']" ref="setPosition" v-ripple class="tool-button" :class="buttonActiveClass('setPosition')" @click="buttonClick('setPosition')">
  40. <q-icon name="la la-angle-double-right" size="32px" />
  41. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  42. {{ rstore.readerActions['setPosition'] }}
  43. </q-tooltip>
  44. </button>
  45. <button v-show="showToolButton['search']" ref="search" v-ripple class="tool-button" :class="buttonActiveClass('search')" @click="buttonClick('search')">
  46. <q-icon name="la la-search" size="32px" />
  47. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  48. {{ rstore.readerActions['search'] }}
  49. </q-tooltip>
  50. </button>
  51. <button v-show="showToolButton['copyText']" ref="copyText" v-ripple class="tool-button" :class="buttonActiveClass('copyText')" @click="buttonClick('copyText')">
  52. <q-icon name="la la-copy" size="32px" />
  53. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  54. {{ rstore.readerActions['copyText'] }}
  55. </q-tooltip>
  56. </button>
  57. <button v-show="showToolButton['convOptions']" ref="convOptions" v-ripple class="tool-button" :class="buttonActiveClass('convOptions')" @click="buttonClick('convOptions')">
  58. <q-icon name="la la-magic" size="32px" />
  59. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  60. {{ rstore.readerActions['convOptions'] }}
  61. </q-tooltip>
  62. </button>
  63. <button v-show="showToolButton['refresh']" ref="refresh" v-ripple class="tool-button" :class="buttonActiveClass('refresh')" @click="buttonClick('refresh')">
  64. <q-icon name="la la-sync" size="32px" :class="{clear: !showRefreshIcon}" />
  65. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  66. {{ rstore.readerActions['refresh'] }}
  67. </q-tooltip>
  68. </button>
  69. <div class="space"></div>
  70. <button v-show="showToolButton['contents']" ref="contents" v-ripple class="tool-button" :class="buttonActiveClass('contents')" @click="buttonClick('contents')">
  71. <q-icon name="la la-list" size="32px" />
  72. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  73. {{ rstore.readerActions['contents'] }}
  74. </q-tooltip>
  75. </button>
  76. <button v-show="mode == 'liberama.top' && showToolButton['libs']" ref="libs" v-ripple class="tool-button" :class="buttonActiveClass('libs')" @click="buttonClick('libs')">
  77. <q-icon name="la la-sitemap" size="32px" />
  78. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  79. {{ rstore.readerActions['libs'] }}
  80. </q-tooltip>
  81. </button>
  82. <button v-show="showToolButton['recentBooks']" ref="recentBooks" v-ripple class="tool-button" :class="buttonActiveClass('recentBooks')" @click="buttonClick('recentBooks')">
  83. <q-icon name="la la-book-open" size="32px" />
  84. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  85. {{ rstore.readerActions['recentBooks'] }}
  86. </q-tooltip>
  87. </button>
  88. </div>
  89. <div>
  90. <button v-show="showToolButton['offlineMode']" ref="offlineMode" v-ripple class="tool-button" :class="buttonActiveClass('offlineMode')" @click="buttonClick('offlineMode')">
  91. <q-icon name="la la-unlink" size="32px" />
  92. <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
  93. {{ rstore.readerActions['offlineMode'] }}
  94. </q-tooltip>
  95. </button>
  96. <button ref="settings" v-ripple class="tool-button" :class="buttonActiveClass('settings')" @click="buttonClick('settings')">
  97. <q-icon name="la la-cog" size="32px" />
  98. <q-tooltip :delay="1500" anchor="bottom left" content-style="font-size: 80%">
  99. {{ rstore.readerActions['settings'] }}
  100. </q-tooltip>
  101. </button>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="main col row relative-position">
  106. <keep-alive>
  107. <component
  108. :is="activePage"
  109. ref="page"
  110. class="col"
  111. @load-book="loadBook"
  112. @load-file="loadFile"
  113. @book-pos-changed="bookPosChanged"
  114. @do-action="doAction"
  115. ></component>
  116. </keep-alive>
  117. <SetPositionPage v-if="setPositionActive" ref="setPositionPage" @set-position-toggle="setPositionToggle" @book-pos-changed="bookPosChanged"></SetPositionPage>
  118. <SearchPage
  119. v-show="searchActive"
  120. ref="searchPage"
  121. @do-action="doAction"
  122. @book-pos-changed="bookPosChanged"
  123. @start-text-search="startTextSearch"
  124. @stop-text-search="stopTextSearch"
  125. ></SearchPage>
  126. <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
  127. <LibsPage v-show="hidden" ref="libsPage" @load-book="loadBook" @libs-close="libsClose" @do-action="doAction"></LibsPage>
  128. <RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
  129. <SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
  130. <HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
  131. <ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
  132. <ContentsPage v-show="contentsActive" ref="contentsPage" :book-pos="bookPos" :is-visible="contentsActive" @do-action="doAction" @book-pos-changed="bookPosChanged"></ContentsPage>
  133. <ServerStorage v-show="hidden" ref="serverStorage"></ServerStorage>
  134. <ReaderDialogs ref="dialogs" @donate-toggle="donateToggle" @version-history-toggle="versionHistoryToggle"></ReaderDialogs>
  135. </div>
  136. </div>
  137. </template>
  138. <script>
  139. //-----------------------------------------------------------------------------
  140. import vueComponent from '../vueComponent.js';
  141. import _ from 'lodash';
  142. import {Buffer} from 'safe-buffer';
  143. import LoaderPage from './LoaderPage/LoaderPage.vue';
  144. import TextPage from './TextPage/TextPage.vue';
  145. import ProgressPage from './ProgressPage/ProgressPage.vue';
  146. import SetPositionPage from './SetPositionPage/SetPositionPage.vue';
  147. import SearchPage from './SearchPage/SearchPage.vue';
  148. import CopyTextPage from './CopyTextPage/CopyTextPage.vue';
  149. import LibsPage from './LibsPage/LibsPage.vue';
  150. import RecentBooksPage from './RecentBooksPage/RecentBooksPage.vue';
  151. import SettingsPage from './SettingsPage/SettingsPage.vue';
  152. import HelpPage from './HelpPage/HelpPage.vue';
  153. import ClickMapPage from './ClickMapPage/ClickMapPage.vue';
  154. import ContentsPage from './ContentsPage/ContentsPage.vue';
  155. import ServerStorage from './ServerStorage/ServerStorage.vue';
  156. import ReaderDialogs from './ReaderDialogs/ReaderDialogs.vue';
  157. import bookManager from './share/bookManager';
  158. import wallpaperStorage from './share/wallpaperStorage';
  159. import dynamicCss from '../../share/dynamicCss';
  160. import rstore from '../../store/modules/reader';
  161. import readerApi from '../../api/reader';
  162. import miscApi from '../../api/misc';
  163. import {versionHistory} from './versionHistory';
  164. import * as utils from '../../share/utils';
  165. const componentOptions = {
  166. components: {
  167. LoaderPage,
  168. TextPage,
  169. ProgressPage,
  170. SetPositionPage,
  171. SearchPage,
  172. CopyTextPage,
  173. LibsPage,
  174. RecentBooksPage,
  175. SettingsPage,
  176. HelpPage,
  177. ClickMapPage,
  178. ContentsPage,
  179. ServerStorage,
  180. ReaderDialogs,
  181. },
  182. watch: {
  183. bookPos: function(newValue) {
  184. if (newValue !== undefined && this.activePage == 'TextPage') {
  185. const textPage = this.$refs.page;
  186. if (textPage.bookPos != newValue) {
  187. textPage.bookPos = newValue;
  188. }
  189. if (!this.scrollingActive)
  190. this.debouncedSetRecentBook(newValue);
  191. else
  192. this.scrollingSetRecentBook(newValue);
  193. }
  194. },
  195. routeParamPos: function(newValue) {
  196. if (!this.paramPosIgnore && newValue !== undefined && newValue != this.bookPos) {
  197. this.bookPos = newValue;
  198. }
  199. },
  200. routeParamUrl: function(newValue) {
  201. if (newValue !== '' && newValue !== this.mostRecentBook().url) {
  202. this.loadBook({url: newValue, bookPos: this.routeParamPos});
  203. }
  204. },
  205. settings: function() {
  206. this.loadSettings();
  207. this.updateRoute();
  208. },
  209. loaderActive: function(newValue) {
  210. (async() => {
  211. const recent = this.mostRecentBook();
  212. if (!newValue && !this.loading && recent && !await bookManager.hasBookParsed(recent)) {
  213. this.loadBook(recent);
  214. }
  215. })();
  216. },
  217. dualPageMode(newValue) {
  218. if (newValue)
  219. this.stopScrolling();
  220. },
  221. },
  222. };
  223. class Reader {
  224. _options = componentOptions;
  225. rstore = {};
  226. loaderActive = false;
  227. fullScreenActive = false;
  228. setPositionActive = false;
  229. searchActive = false;
  230. copyTextActive = false;
  231. convOptionsActive = false;
  232. refreshActive = false;
  233. contentsActive = false;
  234. libsActive = false;
  235. recentBooksActive = false;
  236. offlineModeActive = false;
  237. settingsActive = false;
  238. clickMapActive = false;
  239. helpActive = false;
  240. scrollingActive = false;
  241. progressActive = false;
  242. bookPos = null;
  243. allowUrlParamBookPos = false;
  244. showRefreshIcon = true;
  245. mostRecentBookReactive = null;
  246. showToolButton = {};
  247. actionList = [];
  248. actionCur = -1;
  249. hidden = false;
  250. whatsNewVisible = false;
  251. whatsNewContent = '';
  252. donationVisible = false;
  253. dualPageMode = false;
  254. created() {
  255. this.rstore = rstore;
  256. this.loading = true;
  257. this.commit = this.$store.commit;
  258. this.reader = this.$store.state.reader;
  259. this.config = this.$store.state.config;
  260. this.$root.addEventHook('key', this.keyHook);
  261. this.lastActivePage = false;
  262. this.$watch(
  263. () => this.$route.path,
  264. (newValue) => {
  265. if (newValue == '/reader') {
  266. this.updateRoute();
  267. }
  268. }
  269. );
  270. this.debouncedSetRecentBook = _.debounce(async(newValue) => {
  271. const recent = this.mostRecentBook();
  272. if (recent && (recent.bookPos != newValue || recent.bookPosSeen !== this.bookPosSeen)) {
  273. await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
  274. if (this.actionCur < 0 || (this.actionCur >= 0 && this.actionList[this.actionCur] != newValue))
  275. this.addAction(newValue);
  276. this.paramPosIgnore = true;
  277. this.updateRoute();
  278. await this.$nextTick();
  279. this.paramPosIgnore = false;
  280. }
  281. }, 250, {maxWait: 5000});
  282. this.scrollingSetRecentBook = _.debounce((newValue) => {
  283. this.debouncedSetRecentBook(newValue);
  284. }, 15000, {maxWait: 20000});
  285. document.addEventListener('fullscreenchange', () => {
  286. this.fullScreenActive = (document.fullscreenElement !== null);
  287. });
  288. this.loadSettings();
  289. }
  290. mounted() {
  291. this.updateHeaderMinWidth();
  292. (async() => {
  293. await wallpaperStorage.init();
  294. await bookManager.init(this.settings);
  295. bookManager.addEventListener(this.bookManagerEvent);
  296. if (this.$root.getRootRoute() == '/reader') {
  297. if (this.routeParamUrl) {
  298. await this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos, force: this.routeParamRefresh});
  299. } else {
  300. this.loaderActive = true;
  301. }
  302. }
  303. await this.$refs.serverStorage.init();
  304. this.checkSetStorageAccessKey();
  305. this.checkActivateDonateHelpPage();
  306. this.loading = false;
  307. //проверим состояние Settings, и обновим, если надо
  308. const newSettings = rstore.addDefaultsToSettings(this.settings);
  309. if (newSettings) {
  310. this.commit('reader/setSettings', newSettings);
  311. }
  312. this.updateRoute();
  313. await this.$refs.dialogs.init();
  314. })();
  315. (async() => {
  316. this.isFirstNeedUpdateNotify = true;
  317. //вечный цикл, запрашиваем периодически конфиг для проверки выхода новой версии читалки
  318. while (true) {// eslint-disable-line no-constant-condition
  319. await this.checkNewVersionAvailable();
  320. await utils.sleep(3600*1000); //каждый час
  321. }
  322. //дальше кода нет
  323. })();
  324. }
  325. loadSettings() {
  326. const settings = this.settings;
  327. this.allowUrlParamBookPos = settings.allowUrlParamBookPos;
  328. this.copyFullText = settings.copyFullText;
  329. this.showClickMapPage = settings.showClickMapPage;
  330. this.clickControl = settings.clickControl;
  331. this.blinkCachedLoad = settings.blinkCachedLoad;
  332. this.showToolButton = settings.showToolButton;
  333. this.enableSitesFilter = settings.enableSitesFilter;
  334. this.showNeedUpdateNotify = settings.showNeedUpdateNotify;
  335. this.splitToPara = settings.splitToPara;
  336. this.djvuQuality = settings.djvuQuality;
  337. this.pdfAsText = settings.pdfAsText;
  338. this.pdfQuality = settings.pdfQuality;
  339. this.dualPageMode = settings.dualPageMode;
  340. this.userWallpapers = settings.userWallpapers;
  341. this.readerActionByKeyCode = utils.userHotKeysObjectSwap(settings.userHotKeys);
  342. this.$root.readerActionByKeyEvent = (event) => {
  343. return this.readerActionByKeyCode[utils.keyEventToCode(event)];
  344. }
  345. this.updateHeaderMinWidth();
  346. this.loadWallpapers();//no await
  347. }
  348. //wallpaper css
  349. async loadWallpapers() {
  350. const wallpaperDataLength = await wallpaperStorage.getLength();
  351. if (wallpaperDataLength !== this.wallpaperDataLength) {//оптимизация
  352. this.wallpaperDataLength = wallpaperDataLength;
  353. let newCss = '';
  354. for (const wp of this.userWallpapers) {
  355. const data = await wallpaperStorage.getData(wp.cssClass);
  356. if (!data) {
  357. //здесь будем восстанавливать данные с сервера
  358. }
  359. if (data) {
  360. newCss += `.${wp.cssClass} {background: url(${data}) center; background-size: 100% 100%;}`;
  361. }
  362. }
  363. dynamicCss.replace('wallpapers', newCss);
  364. }
  365. }
  366. async checkNewVersionAvailable() {
  367. if (!this.checkingNewVersion && this.showNeedUpdateNotify) {
  368. this.checkingNewVersion = true;
  369. try {
  370. await utils.sleep(15*1000); //подождем 15 секунд, чтобы прогрузился ServiceWorker при выходе новой версии
  371. const config = await miscApi.loadConfig();
  372. this.commit('config/setConfig', config);
  373. let againMes = '';
  374. if (this.isFirstNeedUpdateNotify) {
  375. againMes = ' еще один раз';
  376. }
  377. if (this.version != this.clientVersion)
  378. this.$root.notify.info(`Вышла новая версия (v${this.version}) читалки.<br>Пожалуйста, обновите страницу${againMes}.`, 'Обновление');
  379. } catch(e) {
  380. console.error(e);
  381. } finally {
  382. this.checkingNewVersion = false;
  383. }
  384. this.isFirstNeedUpdateNotify = false;
  385. }
  386. }
  387. updateHeaderMinWidth() {
  388. const showButtonCount = Object.values(this.showToolButton).reduce((a, b) => a + (b ? 1 : 0), 0);
  389. if (this.$refs.buttons)
  390. this.$refs.buttons.style.minWidth = 65*showButtonCount + 'px';
  391. (async() => {
  392. await utils.sleep(1000);
  393. if (this.$refs.header)
  394. this.$refs.header.style.overflowX = 'auto';
  395. })();
  396. }
  397. checkSetStorageAccessKey() {
  398. const q = this.$route.query;
  399. if (q['setStorageAccessKey']) {
  400. this.$router.replace(`/reader`);
  401. this.settingsToggle();
  402. this.$nextTick(() => {
  403. this.$refs.settingsPage.enterServerStorageKey(
  404. Buffer.from(utils.fromBase58(q['setStorageAccessKey'])).toString()
  405. );
  406. });
  407. }
  408. }
  409. checkActivateDonateHelpPage() {
  410. const q = this.$route.query;
  411. if (q['donate']) {
  412. this.$router.replace(`/reader`);
  413. this.helpToggle();
  414. this.$nextTick(() => {
  415. this.$refs.helpPage.activateDonateHelpPage();
  416. });
  417. }
  418. }
  419. checkBookPosPercent() {
  420. const q = this.$route.query;
  421. if (q['__pp']) {
  422. let pp = q['__pp'];
  423. if (pp) {
  424. pp = parseFloat(pp) || 0;
  425. const recent = this.mostRecentBook();
  426. (async() => {
  427. await utils.sleep(100);
  428. this.bookPos = Math.floor(recent.textLength*pp/100);
  429. })();
  430. }
  431. }
  432. }
  433. get routeParamPos() {
  434. let result = undefined;
  435. const q = this.$route.query;
  436. if (q['__p']) {
  437. result = q['__p'];
  438. if (Array.isArray(result))
  439. result = result[0];
  440. }
  441. return (result ? parseInt(result, 10) || 0 : result);
  442. }
  443. updateRoute(isNewRoute) {
  444. if (this.loading)
  445. return;
  446. const recent = this.mostRecentBook();
  447. const pos = (recent && recent.bookPos && this.allowUrlParamBookPos ? `__p=${recent.bookPos}&` : '');
  448. const url = (recent ? `url=${recent.url}` : '');
  449. if (isNewRoute)
  450. this.$router.push(`/reader?${pos}${url}`).catch(() => {});
  451. else
  452. this.$router.replace(`/reader?${pos}${url}`).catch(() => {});
  453. }
  454. get mode() {
  455. return this.$store.state.config.mode;
  456. }
  457. get version() {
  458. return this.$store.state.config.version;
  459. }
  460. get clientVersion() {
  461. let v = versionHistory[0].header;
  462. v = v.split(' ')[0];
  463. return v;
  464. }
  465. get routeParamUrl() {
  466. let result = '';
  467. const path = this.$route.fullPath;
  468. const i = path.indexOf('url=');
  469. if (i >= 0) {
  470. result = path.substr(i + 4);
  471. }
  472. return decodeURIComponent(result);
  473. }
  474. get routeParamRefresh() {
  475. const q = this.$route.query;
  476. return !!q['__refresh'];
  477. }
  478. bookPosChanged(event) {
  479. if (event.bookPosSeen !== undefined)
  480. this.bookPosSeen = event.bookPosSeen;
  481. this.bookPos = event.bookPos;
  482. }
  483. async bookManagerEvent(eventName, value) {
  484. if (eventName == 'set-recent' || eventName == 'recent-deleted') {
  485. const oldBook = (this.textPage ? this.textPage.lastBook : null);
  486. const oldPos = (this.textPage ? this.textPage.bookPos : null);
  487. const newBook = bookManager.mostRecentBook();
  488. if (!(oldBook && newBook && oldBook.key == newBook.key)) {
  489. this.mostRecentBook();
  490. }
  491. if (oldBook && newBook) {
  492. if (oldBook.key != newBook.key || oldBook.path != newBook.path) {
  493. this.loadingBook = true;
  494. try {
  495. await this.loadBook(newBook);
  496. } finally {
  497. this.loadingBook = false;
  498. }
  499. } else if (oldPos != newBook.bookPos) {
  500. while (this.loadingBook) await utils.sleep(100);
  501. this.bookPosChanged({bookPos: newBook.bookPos});
  502. }
  503. }
  504. }
  505. if (eventName == 'recent-changed') {
  506. if (this.recentBooksActive) {
  507. await this.$refs.recentBooksPage.updateTableData();
  508. }
  509. //сохранение в serverStorage
  510. if (value) {
  511. await utils.sleep(500);
  512. try {
  513. await this.$refs.serverStorage.saveRecent(value);
  514. } catch (e) {
  515. this.$root.notify.error(e.message);
  516. }
  517. }
  518. }
  519. }
  520. get toolBarActive() {
  521. return this.reader.toolBarActive;
  522. }
  523. mostRecentBook() {
  524. const result = bookManager.mostRecentBook();
  525. this.mostRecentBookReactive = result;
  526. return result;
  527. }
  528. get settings() {
  529. return this.$store.state.reader.settings;
  530. }
  531. addAction(pos) {
  532. let a = this.actionList;
  533. if (!a.length || a[a.length - 1] != pos) {
  534. a.push(pos);
  535. if (a.length > 20)
  536. a.shift();
  537. this.actionCur = a.length - 1;
  538. }
  539. }
  540. toolBarToggle() {
  541. this.commit('reader/setToolBarActive', !this.toolBarActive);
  542. this.$root.eventHook('resize');
  543. }
  544. fullScreenToggle() {
  545. this.fullScreenActive = !this.fullScreenActive;
  546. if (this.fullScreenActive) {
  547. this.$q.fullscreen.request();
  548. } else {
  549. this.$q.fullscreen.exit();
  550. }
  551. }
  552. closeAllWindows() {
  553. this.setPositionActive = false;
  554. this.copyTextActive = false;
  555. this.recentBooksActive = false;
  556. this.settingsActive = false;
  557. this.stopScrolling();
  558. this.stopSearch();
  559. this.helpActive = false;
  560. this.contentsActive = false;
  561. }
  562. loaderToggle() {
  563. this.loaderActive = !this.loaderActive;
  564. if (this.loaderActive) {
  565. this.closeAllWindows();
  566. }
  567. }
  568. setPositionToggle() {
  569. this.setPositionActive = !this.setPositionActive;
  570. const page = this.$refs.page;
  571. if (this.setPositionActive && this.activePage == 'TextPage' && page.parsed) {
  572. this.closeAllWindows();
  573. this.setPositionActive = true;
  574. this.$nextTick(() => {
  575. const recent = this.mostRecentBook();
  576. this.$refs.setPositionPage.init(recent.bookPos, recent.textLength - 1);
  577. });
  578. } else {
  579. this.setPositionActive = false;
  580. }
  581. }
  582. stopScrolling() {
  583. if (this.scrollingActive)
  584. this.scrollingToggle();
  585. }
  586. scrollingToggle() {
  587. this.scrollingActive = !this.scrollingActive;
  588. if (this.activePage == 'TextPage') {
  589. const page = this.$refs.page;
  590. if (this.scrollingActive) {
  591. page.startTextScrolling();
  592. } else {
  593. page.stopTextScrolling();
  594. }
  595. }
  596. if (!this.scrollingActive) {
  597. this.scrollingSetRecentBook.flush();
  598. }
  599. }
  600. stopSearch() {
  601. if (this.searchActive)
  602. this.searchToggle();
  603. }
  604. startTextSearch(opts) {
  605. if (this.activePage == 'TextPage')
  606. this.$refs.page.startSearch(opts.needle);
  607. }
  608. stopTextSearch() {
  609. if (this.activePage == 'TextPage')
  610. this.$refs.page.stopSearch();
  611. }
  612. searchToggle() {
  613. this.searchActive = !this.searchActive;
  614. const page = this.$refs.page;
  615. if (this.searchActive && this.activePage == 'TextPage' && page.parsed) {
  616. this.closeAllWindows();
  617. this.searchActive = true;
  618. this.$nextTick(() => {
  619. this.$refs.searchPage.init(page.parsed);
  620. });
  621. } else {
  622. this.stopTextSearch();
  623. this.searchActive = false;
  624. }
  625. }
  626. copyTextToggle() {
  627. this.copyTextActive = !this.copyTextActive;
  628. const page = this.$refs.page;
  629. if (this.copyTextActive && this.activePage == 'TextPage' && page.parsed) {
  630. this.closeAllWindows();
  631. this.copyTextActive = true;
  632. this.$nextTick(() => {
  633. this.$refs.copyTextPage.init(this.mostRecentBook().bookPos, page.parsed, this.copyFullText);
  634. });
  635. } else {
  636. this.copyTextActive = false;
  637. }
  638. }
  639. recentBooksClose() {
  640. this.recentBooksActive = false;
  641. }
  642. recentBooksToggle() {
  643. this.recentBooksActive = !this.recentBooksActive;
  644. if (this.recentBooksActive) {
  645. this.closeAllWindows();
  646. this.$refs.recentBooksPage.init();
  647. this.recentBooksActive = true;
  648. } else {
  649. this.recentBooksActive = false;
  650. }
  651. }
  652. contentsPageToggle() {
  653. this.contentsActive = !this.contentsActive;
  654. const page = this.$refs.page;
  655. if (this.contentsActive && this.activePage == 'TextPage' && page.parsed) {
  656. this.closeAllWindows();
  657. this.contentsActive = true;
  658. this.$nextTick(() => {
  659. this.$refs.contentsPage.init(this.mostRecentBook(), page.parsed);
  660. });
  661. } else {
  662. this.contentsActive = false;
  663. }
  664. }
  665. libsClose() {
  666. if (this.libsActive)
  667. this.libsToogle();
  668. }
  669. libsToogle() {
  670. this.libsActive = !this.libsActive;
  671. if (this.libsActive) {
  672. this.$refs.libsPage.init();
  673. } else {
  674. this.$refs.libsPage.done();
  675. }
  676. }
  677. offlineModeToggle() {
  678. this.offlineModeActive = !this.offlineModeActive;
  679. this.$refs.serverStorage.offlineModeActive = this.offlineModeActive;
  680. }
  681. settingsToggle() {
  682. this.settingsActive = !this.settingsActive;
  683. if (this.settingsActive) {
  684. this.closeAllWindows();
  685. this.settingsActive = true;
  686. this.$nextTick(() => {
  687. this.$refs.settingsPage.init();
  688. });
  689. } else {
  690. this.settingsActive = false;
  691. }
  692. }
  693. convOptionsToggle() {
  694. this.settingsToggle();
  695. if (this.settingsActive)
  696. this.$refs.settingsPage.selectedTab = 'convert';
  697. }
  698. helpToggle() {
  699. this.helpActive = !this.helpActive;
  700. if (this.helpActive) {
  701. this.closeAllWindows();
  702. this.helpActive = true;
  703. }
  704. }
  705. donateToggle() {
  706. this.helpToggle();
  707. if (this.helpActive) {
  708. this.$nextTick(() => {
  709. this.$refs.helpPage.activateDonateHelpPage();
  710. });
  711. }
  712. }
  713. versionHistoryToggle() {
  714. this.helpToggle();
  715. if (this.helpActive) {
  716. this.$nextTick(() => {
  717. this.$refs.helpPage.activateVersionHistoryHelpPage();
  718. });
  719. }
  720. }
  721. refreshBook() {
  722. const mrb = this.mostRecentBook();
  723. this.loadBook({url: mrb.url, uploadFileName: mrb.uploadFileName, force: true});
  724. }
  725. undoAction() {
  726. if (this.actionCur > 0) {
  727. this.actionCur--;
  728. this.bookPosChanged({bookPos: this.actionList[this.actionCur]});
  729. }
  730. }
  731. redoAction() {
  732. if (this.actionCur < this.actionList.length - 1) {
  733. this.actionCur++;
  734. this.bookPosChanged({bookPos: this.actionList[this.actionCur]});
  735. }
  736. }
  737. buttonClick(action) {
  738. const activeClass = this.buttonActiveClass(action);
  739. this.$refs[action].blur();
  740. if (activeClass['tool-button-disabled'])
  741. return;
  742. this.doAction({action});
  743. }
  744. buttonActiveClass(action) {
  745. const classActive = { 'tool-button-active': true, 'tool-button-active:hover': true };
  746. const classDisabled = { 'tool-button-disabled': true, 'tool-button-disabled:hover': true };
  747. let classResult = {};
  748. switch (action) {
  749. case 'loader':
  750. case 'fullScreen':
  751. case 'setPosition':
  752. case 'search':
  753. case 'copyText':
  754. case 'convOptions':
  755. case 'refresh':
  756. case 'contents':
  757. case 'libs':
  758. case 'recentBooks':
  759. case 'offlineMode':
  760. case 'settings':
  761. if (this.progressActive) {
  762. classResult = classDisabled;
  763. } else if (this[`${action}Active`]) {
  764. classResult = classActive;
  765. }
  766. break;
  767. case 'scrolling':
  768. if (this.progressActive || this.dualPageMode) {
  769. classResult = classDisabled;
  770. } else if (this[`${action}Active`]) {
  771. classResult = classActive;
  772. }
  773. break;
  774. case 'undoAction':
  775. if (this.actionCur <= 0)
  776. classResult = classDisabled;
  777. break;
  778. case 'redoAction':
  779. if (this.actionCur == this.actionList.length - 1)
  780. classResult = classDisabled;
  781. break;
  782. }
  783. if (this.activePage == 'LoaderPage' || !this.mostRecentBookReactive) {
  784. switch (action) {
  785. case 'undoAction':
  786. case 'redoAction':
  787. case 'setPosition':
  788. case 'scrolling':
  789. case 'search':
  790. case 'copyText':
  791. case 'contents':
  792. classResult = classDisabled;
  793. break;
  794. case 'refresh':
  795. case 'recentBooks':
  796. if (!this.mostRecentBookReactive)
  797. classResult = classDisabled;
  798. break;
  799. }
  800. }
  801. return classResult;
  802. }
  803. async activateClickMapPage() {
  804. if (this.clickControl && this.showClickMapPage && !this.clickMapActive) {
  805. this.clickMapActive = true;
  806. await this.$refs.clickMapPage.slowDisappear();
  807. this.clickMapActive = false;
  808. }
  809. }
  810. get activePage() {
  811. let result = undefined;
  812. if (this.progressActive)
  813. result = 'ProgressPage';
  814. else if (this.loaderActive)
  815. result = 'LoaderPage';
  816. else if (this.mostRecentBookReactive)
  817. result = 'TextPage';
  818. if (!result && !this.loading) {
  819. this.loaderActive = true;
  820. result = 'LoaderPage';
  821. }
  822. if (result != 'TextPage') {
  823. this.$root.setAppTitle();
  824. }
  825. // на LoaderPage всегда показываем toolBar
  826. if (result == 'LoaderPage' && !this.toolBarActive) {
  827. this.toolBarToggle();
  828. }
  829. if (this.lastActivePage != result && result == 'TextPage') {
  830. //акивируем страницу с текстом
  831. this.$nextTick(async() => {
  832. const last = this.mostRecentBookReactive;
  833. const isParsed = await bookManager.hasBookParsed(last);
  834. if (!isParsed) {
  835. this.$root.setAppTitle();
  836. return;
  837. }
  838. this.updateRoute();
  839. const textPage = this.$refs.page;
  840. if (textPage.showBook) {
  841. this.textPage = textPage;
  842. textPage.lastBook = last;
  843. textPage.bookPos = (last.bookPos !== undefined ? last.bookPos : 0);
  844. textPage.showBook();
  845. }
  846. });
  847. }
  848. this.lastActivePage = result;
  849. return result;
  850. }
  851. async loadBook(opts) {
  852. if (!opts || !opts.url) {
  853. this.mostRecentBook();
  854. return;
  855. }
  856. this.closeAllWindows();
  857. let url = encodeURI(decodeURI(opts.url));
  858. //TODO: убрать конвертирование 'file://' после 06.2021
  859. if (url.length == 71 && url.indexOf('file://') == 0)
  860. url = url.replace(/^file/, 'disk');
  861. if ((url.indexOf('http://') != 0) && (url.indexOf('https://') != 0) &&
  862. (url.indexOf('disk://') != 0))
  863. url = 'http://' + url;
  864. // уже просматривается сейчас
  865. const lastBook = (this.textPage ? this.textPage.lastBook : null);
  866. if (!opts.force && lastBook && lastBook.url == url &&
  867. (!opts.path || opts.path == lastBook.path) &&
  868. await bookManager.hasBookParsed(lastBook)) {
  869. this.loaderActive = false;
  870. return;
  871. }
  872. this.progressActive = true;
  873. await this.$nextTick();
  874. const progress = this.$refs.page;
  875. this.actionList = [];
  876. this.actionCur = -1;
  877. try {
  878. progress.show();
  879. progress.setState({state: 'parse'});
  880. // есть ли среди недавних
  881. const key = bookManager.keyFromUrl(url);
  882. let wasOpened = await bookManager.getRecentBook({key});
  883. wasOpened = (wasOpened ? wasOpened : {});
  884. const bookPos = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos);
  885. const bookPosSeen = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen);
  886. const uploadFileName = (opts.uploadFileName ? opts.uploadFileName : '');
  887. let book = null;
  888. if (!opts.force) {
  889. // пытаемся загрузить и распарсить книгу в менеджере из локального кэша
  890. const bookParsed = await bookManager.getBook({url, path: opts.path}, (prog) => {
  891. progress.setState({progress: prog});
  892. });
  893. // если есть в локальном кэше
  894. if (bookParsed) {
  895. await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookParsed));
  896. this.mostRecentBook();
  897. this.addAction(bookPos);
  898. this.loaderActive = false;
  899. progress.hide(); this.progressActive = false;
  900. this.blinkCachedLoadMessage();
  901. this.checkBookPosPercent();
  902. await this.activateClickMapPage();
  903. return;
  904. }
  905. // иначе идем на сервер
  906. // пытаемся загрузить готовый файл с сервера
  907. if (wasOpened.path) {
  908. progress.setState({totalSteps: 5});
  909. try {
  910. const resp = await readerApi.loadCachedBook(wasOpened.path, (state) => {
  911. progress.setState(state);
  912. });
  913. book = Object.assign({}, wasOpened, {data: resp.data});
  914. } catch (e) {
  915. //молчим
  916. }
  917. }
  918. }
  919. progress.setState({totalSteps: 5});
  920. // не удалось, скачиваем книгу полностью с конвертацией
  921. let loadCached = true;
  922. if (!book) {
  923. book = await readerApi.loadBook({
  924. url,
  925. uploadFileName,
  926. enableSitesFilter: this.enableSitesFilter,
  927. skipHtmlCheck: (this.splitToPara ? true : false),
  928. isText: (this.splitToPara ? true : false),
  929. djvuQuality: this.djvuQuality,
  930. pdfAsText: this.pdfAsText,
  931. pdfQuality: this.pdfQuality,
  932. },
  933. (state) => {
  934. progress.setState(state);
  935. }
  936. );
  937. loadCached = false;
  938. }
  939. // добавляем в bookManager
  940. progress.setState({state: 'parse', step: 5});
  941. const addedBook = await bookManager.addBook(book, (prog) => {
  942. progress.setState({progress: prog});
  943. });
  944. // добавляем в историю
  945. await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen, uploadFileName}, addedBook));
  946. this.mostRecentBook();
  947. this.addAction(bookPos);
  948. this.updateRoute(true);
  949. this.loaderActive = false;
  950. progress.hide(); this.progressActive = false;
  951. if (loadCached) {
  952. this.blinkCachedLoadMessage();
  953. } else
  954. this.stopBlink = true;
  955. this.checkBookPosPercent();
  956. await this.activateClickMapPage();
  957. } catch (e) {
  958. progress.hide(); this.progressActive = false;
  959. this.loaderActive = true;
  960. this.$root.stdDialog.alert(e.message, 'Ошибка', {color: 'negative'});
  961. } finally {
  962. this.checkNewVersionAvailable();
  963. }
  964. }
  965. async loadFile(opts) {
  966. this.progressActive = true;
  967. await this.$nextTick();
  968. const progress = this.$refs.page;
  969. try {
  970. progress.show();
  971. progress.setState({state: 'upload'});
  972. const url = await readerApi.uploadFile(opts.file, this.config.maxUploadFileSize, (state) => {
  973. progress.setState(state);
  974. });
  975. progress.hide(); this.progressActive = false;
  976. await this.loadBook({url, uploadFileName: opts.file.name, force: true});
  977. } catch (e) {
  978. progress.hide(); this.progressActive = false;
  979. this.loaderActive = true;
  980. this.$root.stdDialog.alert(e.message, 'Ошибка', {color: 'negative'});
  981. }
  982. }
  983. blinkCachedLoadMessage() {
  984. if (!this.blinkCachedLoad)
  985. return;
  986. this.blinkCount = 30;
  987. if (!this.inBlink) {
  988. this.inBlink = true;
  989. this.stopBlink = false;
  990. this.$nextTick(async() => {
  991. let page = this.$refs.page;
  992. while (this.blinkCount) {
  993. this.showRefreshIcon = !this.showRefreshIcon;
  994. if (page && page.blinkCachedLoadMessage)
  995. page.blinkCachedLoadMessage(this.showRefreshIcon);
  996. await utils.sleep(500);
  997. if (this.stopBlink)
  998. break;
  999. this.blinkCount--;
  1000. page = this.$refs.page;
  1001. }
  1002. this.showRefreshIcon = true;
  1003. this.inBlink = false;
  1004. if (page && page.blinkCachedLoadMessage)
  1005. page.blinkCachedLoadMessage('finish');
  1006. });
  1007. }
  1008. }
  1009. doAction(opts) {
  1010. let result = true;
  1011. let {action = '', event = false} = opts;
  1012. switch (action) {
  1013. case 'loader':
  1014. this.loaderToggle();
  1015. break;
  1016. case 'help':
  1017. this.helpToggle();
  1018. break;
  1019. case 'undoAction':
  1020. this.undoAction();
  1021. break;
  1022. case 'redoAction':
  1023. this.redoAction();
  1024. break;
  1025. case 'fullScreen':
  1026. this.fullScreenToggle();
  1027. break;
  1028. case 'scrolling':
  1029. this.scrollingToggle();
  1030. break;
  1031. case 'stopScrolling':
  1032. this.stopScrolling();
  1033. break;
  1034. case 'setPosition':
  1035. this.setPositionToggle();
  1036. break;
  1037. case 'search':
  1038. this.searchToggle();
  1039. break;
  1040. case 'copyText':
  1041. this.copyTextToggle();
  1042. break;
  1043. case 'convOptions':
  1044. this.convOptionsToggle();
  1045. break;
  1046. case 'refresh':
  1047. this.refreshBook();
  1048. break;
  1049. case 'contents':
  1050. this.contentsPageToggle();
  1051. break;
  1052. case 'libs':
  1053. this.libsToogle();
  1054. break;
  1055. case 'recentBooks':
  1056. this.recentBooksToggle();
  1057. break;
  1058. case 'offlineMode':
  1059. this.offlineModeToggle();
  1060. break;
  1061. case 'settings':
  1062. this.settingsToggle();
  1063. break;
  1064. case 'switchToolbar':
  1065. this.toolBarToggle();
  1066. break;
  1067. case 'donate':
  1068. this.donateToggle();
  1069. break;
  1070. default:
  1071. result = false;
  1072. break;
  1073. }
  1074. if (!result && this.activePage == 'TextPage' && this.$refs.page) {
  1075. result = true;
  1076. const textPage = this.$refs.page;
  1077. switch (action) {
  1078. case 'bookBegin':
  1079. textPage.doHome();
  1080. break;
  1081. case 'bookEnd':
  1082. textPage.doEnd();
  1083. break;
  1084. case 'pageBack':
  1085. textPage.doPageUp();
  1086. break;
  1087. case 'pageForward':
  1088. textPage.doPageDown();
  1089. break;
  1090. case 'lineBack':
  1091. textPage.doUp();
  1092. break;
  1093. case 'lineForward':
  1094. textPage.doDown();
  1095. break;
  1096. case 'incFontSize':
  1097. textPage.doFontSizeInc();
  1098. break;
  1099. case 'decFontSize':
  1100. textPage.doFontSizeDec();
  1101. break;
  1102. case 'scrollingSpeedUp':
  1103. textPage.doScrollingSpeedUp();
  1104. break;
  1105. case 'scrollingSpeedDown':
  1106. textPage.doScrollingSpeedDown();
  1107. break;
  1108. default:
  1109. result = false;
  1110. break;
  1111. }
  1112. }
  1113. if (result && event) {
  1114. event.preventDefault();
  1115. event.stopPropagation();
  1116. }
  1117. return result;
  1118. }
  1119. keyHook(event) {
  1120. let result = false;
  1121. if (this.$root.getRootRoute() == '/reader') {
  1122. if (this.$root.stdDialog.active)
  1123. return result;
  1124. if (!result)
  1125. result = this.$refs.dialogs.keyHook(event);
  1126. if (!result && this.helpActive)
  1127. result = this.$refs.helpPage.keyHook(event);
  1128. if (!result && this.settingsActive)
  1129. result = this.$refs.settingsPage.keyHook(event);
  1130. if (!result && this.recentBooksActive)
  1131. result = this.$refs.recentBooksPage.keyHook(event);
  1132. if (!result && this.setPositionActive)
  1133. result = this.$refs.setPositionPage.keyHook(event);
  1134. if (!result && this.searchActive)
  1135. result = this.$refs.searchPage.keyHook(event);
  1136. if (!result && this.copyTextActive)
  1137. result = this.$refs.copyTextPage.keyHook(event);
  1138. if (!result && this.contentsActive)
  1139. result = this.$refs.contentsPage.keyHook(event);
  1140. if (!result && this.$refs.page && this.$refs.page.keyHook)
  1141. result = this.$refs.page.keyHook(event);
  1142. if (!result && event.type == 'keydown') {
  1143. const action = this.$root.readerActionByKeyEvent(event);
  1144. if (action == 'loader') {
  1145. result = this.doAction({action, event});
  1146. }
  1147. if (!result && this.activePage == 'TextPage') {
  1148. result = this.doAction({action, event});
  1149. }
  1150. }
  1151. }
  1152. return result;
  1153. }
  1154. }
  1155. export default vueComponent(Reader);
  1156. //-----------------------------------------------------------------------------
  1157. </script>
  1158. <style scoped>
  1159. .header {
  1160. padding-left: 5px;
  1161. padding-right: 5px;
  1162. background-color: #1B695F;
  1163. color: #000;
  1164. overflow: hidden;
  1165. height: 50px;
  1166. }
  1167. .main {
  1168. background-color: #EBE2C9;
  1169. color: #000;
  1170. }
  1171. .tool-button {
  1172. margin: 0px 2px 0 2px;
  1173. padding: 0;
  1174. color: #3E843E;
  1175. background-color: #E6EDF4;
  1176. margin-top: 5px;
  1177. height: 38px;
  1178. width: 38px;
  1179. border: 0;
  1180. border-radius: 6px;
  1181. box-shadow: 3px 3px 5px black;
  1182. outline: 0;
  1183. }
  1184. .tool-button:hover {
  1185. background-color: white;
  1186. cursor: pointer;
  1187. }
  1188. .tool-button-active {
  1189. box-shadow: 0 0 0;
  1190. color: white;
  1191. background-color: #8AB45F;
  1192. position: relative;
  1193. top: 1px;
  1194. left: 1px;
  1195. }
  1196. .tool-button-active:hover {
  1197. color: white;
  1198. background-color: #81C581;
  1199. cursor: pointer;
  1200. }
  1201. .tool-button-disabled {
  1202. color: lightgray;
  1203. background-color: gray;
  1204. cursor: default;
  1205. }
  1206. .tool-button-disabled:hover {
  1207. color: lightgray;
  1208. background-color: gray;
  1209. cursor: default;
  1210. }
  1211. .space {
  1212. width: 10px;
  1213. display: inline-block;
  1214. }
  1215. .clear {
  1216. color: rgba(0,0,0,0);
  1217. }
  1218. </style>