Reader.vue 47 KB

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