Reader.vue 48 KB

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