Reader.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. <template>
  2. <el-container>
  3. <el-header v-show="toolBarActive" height='50px'>
  4. <div class="header">
  5. <el-tooltip content="Загрузить книгу" :open-delay="1000" effect="light">
  6. <el-button ref="loader" class="tool-button" :class="buttonActiveClass('loader')" @click="buttonClick('loader')"><i class="el-icon-back"></i></el-button>
  7. </el-tooltip>
  8. <div>
  9. <el-tooltip content="Действие назад" :open-delay="1000" effect="light">
  10. <el-button ref="undoAction" class="tool-button" :class="buttonActiveClass('undoAction')" @click="buttonClick('undoAction')" ><i class="el-icon-arrow-left"></i></el-button>
  11. </el-tooltip>
  12. <el-tooltip content="Действие вперед" :open-delay="1000" effect="light">
  13. <el-button ref="redoAction" class="tool-button" :class="buttonActiveClass('redoAction')" @click="buttonClick('redoAction')" ><i class="el-icon-arrow-right"></i></el-button>
  14. </el-tooltip>
  15. <div class="space"></div>
  16. <el-tooltip content="На весь экран" :open-delay="1000" effect="light">
  17. <el-button ref="fullScreen" class="tool-button" :class="buttonActiveClass('fullScreen')" @click="buttonClick('fullScreen')"><i class="el-icon-rank"></i></el-button>
  18. </el-tooltip>
  19. <el-tooltip content="Плавный скроллинг" :open-delay="1000" effect="light">
  20. <el-button ref="scrolling" class="tool-button" :class="buttonActiveClass('scrolling')" @click="buttonClick('scrolling')"><i class="el-icon-sort"></i></el-button>
  21. </el-tooltip>
  22. <el-tooltip content="Прокрутка книги" :open-delay="1000" effect="light">
  23. <el-button ref="setPosition" class="tool-button" :class="buttonActiveClass('setPosition')" @click="buttonClick('setPosition')"><i class="el-icon-d-arrow-right"></i></el-button>
  24. </el-tooltip>
  25. <el-tooltip content="Найти в тексте" :open-delay="1000" effect="light">
  26. <el-button ref="search" class="tool-button" :class="buttonActiveClass('search')" @click="buttonClick('search')"><i class="el-icon-search"></i></el-button>
  27. </el-tooltip>
  28. <el-tooltip content="Скопировать текст со страницы" :open-delay="1000" effect="light">
  29. <el-button ref="copyText" class="tool-button" :class="buttonActiveClass('copyText')" @click="buttonClick('copyText')"><i class="el-icon-edit-outline"></i></el-button>
  30. </el-tooltip>
  31. <el-tooltip content="Принудительно обновить книгу в обход кеша" :open-delay="1000" effect="light">
  32. <el-button ref="refresh" class="tool-button" :class="buttonActiveClass('refresh')" @click="buttonClick('refresh')">
  33. <i class="el-icon-refresh" :class="{clear: !showRefreshIcon}"></i>
  34. </el-button>
  35. </el-tooltip>
  36. <div class="space"></div>
  37. <el-tooltip content="Открыть недавние" :open-delay="1000" effect="light">
  38. <el-button ref="history" class="tool-button" :class="buttonActiveClass('history')" @click="buttonClick('history')"><i class="el-icon-document"></i></el-button>
  39. </el-tooltip>
  40. </div>
  41. <el-tooltip content="Настроить" :open-delay="1000" effect="light">
  42. <el-button ref="settings" class="tool-button" :class="buttonActiveClass('settings')" @click="buttonClick('settings')"><i class="el-icon-setting"></i></el-button>
  43. </el-tooltip>
  44. </div>
  45. </el-header>
  46. <el-main>
  47. <keep-alive>
  48. <component ref="page" :is="activePage"
  49. @load-book="loadBook"
  50. @book-pos-changed="bookPosChanged"
  51. @tool-bar-toggle="toolBarToggle"
  52. @full-screen-toogle="fullScreenToggle"
  53. @stop-scrolling="stopScrolling"
  54. @scrolling-toggle="scrollingToggle"
  55. ></component>
  56. </keep-alive>
  57. <SetPositionPage v-if="setPositionActive" ref="setPositionPage" @set-position-toggle="setPositionToggle" @book-pos-changed="bookPosChanged"></SetPositionPage>
  58. <SearchPage v-show="searchActive" ref="searchPage"
  59. @search-toggle="searchToggle"
  60. @book-pos-changed="bookPosChanged"
  61. @start-text-search="startTextSearch"
  62. @stop-text-search="stopTextSearch">
  63. </SearchPage>
  64. <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>
  65. <HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
  66. <SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
  67. </el-main>
  68. </el-container>
  69. </template>
  70. <script>
  71. //-----------------------------------------------------------------------------
  72. import Vue from 'vue';
  73. import Component from 'vue-class-component';
  74. import LoaderPage from './LoaderPage/LoaderPage.vue';
  75. import TextPage from './TextPage/TextPage.vue';
  76. import ProgressPage from './ProgressPage/ProgressPage.vue';
  77. import SetPositionPage from './SetPositionPage/SetPositionPage.vue';
  78. import SearchPage from './SearchPage/SearchPage.vue';
  79. import CopyTextPage from './CopyTextPage/CopyTextPage.vue';
  80. import HistoryPage from './HistoryPage/HistoryPage.vue';
  81. import SettingsPage from './SettingsPage/SettingsPage.vue';
  82. import bookManager from './share/bookManager';
  83. import readerApi from '../../api/reader';
  84. import _ from 'lodash';
  85. import {sleep} from '../../share/utils';
  86. export default @Component({
  87. components: {
  88. LoaderPage,
  89. TextPage,
  90. ProgressPage,
  91. SetPositionPage,
  92. SearchPage,
  93. CopyTextPage,
  94. HistoryPage,
  95. SettingsPage,
  96. },
  97. watch: {
  98. bookPos: function(newValue) {
  99. if (newValue !== undefined && this.activePage == 'TextPage') {
  100. const textPage = this.$refs.page;
  101. if (textPage.bookPos != newValue) {
  102. textPage.bookPos = newValue;
  103. }
  104. this.debouncedSetRecentBook(newValue);
  105. }
  106. },
  107. routeParamPos: function(newValue) {
  108. if (newValue !== undefined && newValue != this.bookPos) {
  109. this.bookPos = newValue;
  110. }
  111. },
  112. routeParamUrl: function(newValue) {
  113. if (newValue !== '' && newValue !== this.mostRecentBook().url) {
  114. this.loadBook({url: newValue, bookPos: this.routeParamPos});
  115. }
  116. },
  117. settings: function(newValue) {
  118. this.allowUrlParamBookPos = newValue.allowUrlParamBookPos;
  119. this.copyFullText = newValue.copyFullText;
  120. this.updateRoute();
  121. },
  122. },
  123. })
  124. class Reader extends Vue {
  125. loaderActive = false;
  126. progressActive = false;
  127. fullScreenActive = false;
  128. scrollingActive = false;
  129. setPositionActive = false;
  130. searchActive = false;
  131. copyTextActive = false;
  132. historyActive = false;
  133. settingsActive = false;
  134. bookPos = null;
  135. allowUrlParamBookPos = false;
  136. showRefreshIcon = true;
  137. created() {
  138. this.commit = this.$store.commit;
  139. this.dispatch = this.$store.dispatch;
  140. this.reader = this.$store.state.reader;
  141. this.$root.addKeyHook(this.keyHook);
  142. this.lastActivePage = false;
  143. this.debouncedUpdateRoute = _.debounce(() => {
  144. this.updateRoute();
  145. }, 1000);
  146. this.debouncedSetRecentBook = _.debounce(async(newValue) => {
  147. const recent = this.mostRecentBook();
  148. if (recent && recent.bookPos != newValue) {
  149. await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
  150. }
  151. }, 500);
  152. document.addEventListener('fullscreenchange', () => {
  153. this.fullScreenActive = (document.fullscreenElement !== null);
  154. });
  155. this.allowUrlParamBookPos = this.settings.allowUrlParamBookPos;
  156. this.copyFullText = this.settings.copyFullText;
  157. }
  158. mounted() {
  159. (async() => {
  160. await bookManager.init();
  161. if (this.$root.rootRoute == '/reader') {
  162. if (this.routeParamUrl) {
  163. this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos});
  164. } else if (this.mostRecentBook()) {
  165. this.loadBook({url: this.mostRecentBook().url});
  166. } else {
  167. this.loaderActive = true;
  168. }
  169. }
  170. })();
  171. }
  172. get routeParamPos() {
  173. let result = undefined;
  174. const q = this.$route.query;
  175. if (q['__p']) {
  176. result = q['__p'];
  177. if (Array.isArray(result))
  178. result = result[0];
  179. }
  180. return (result ? parseInt(result, 10) || 0 : result);
  181. }
  182. updateRoute(isNewRoute) {
  183. const pos = (this.bookPos != undefined && this.allowUrlParamBookPos ? `__p=${this.bookPos}&` : '');
  184. const url = (this.mostRecentBook() ? `url=${this.mostRecentBook().url}` : '');
  185. if (isNewRoute)
  186. this.$router.push(`/reader?${pos}${url}`);
  187. else
  188. this.$router.replace(`/reader?${pos}${url}`);
  189. }
  190. get routeParamUrl() {
  191. let result = '';
  192. const path = this.$route.fullPath;
  193. const i = path.indexOf('url=');
  194. if (i >= 0) {
  195. result = path.substr(i + 4);
  196. }
  197. return decodeURIComponent(result);
  198. }
  199. bookPosChanged(event) {
  200. if (event.bookPosSeen !== undefined)
  201. this.bookPosSeen = event.bookPosSeen;
  202. this.bookPos = event.bookPos;
  203. this.debouncedUpdateRoute();
  204. }
  205. get toolBarActive() {
  206. return this.reader.toolBarActive;
  207. }
  208. mostRecentBook() {
  209. const result = bookManager.mostRecentBook();
  210. if (!result)
  211. this.closeAllTextPages();
  212. return result;
  213. }
  214. get settings() {
  215. return this.$store.state.reader.settings;
  216. }
  217. toolBarToggle() {
  218. this.commit('reader/setToolBarActive', !this.toolBarActive);
  219. this.$root.$emit('resize');
  220. }
  221. fullScreenToggle() {
  222. this.fullScreenActive = !this.fullScreenActive;
  223. if (this.fullScreenActive) {
  224. const element = document.documentElement;
  225. if (element.requestFullscreen) {
  226. element.requestFullscreen();
  227. } else if (element.webkitrequestFullscreen) {
  228. element.webkitRequestFullscreen();
  229. } else if (element.mozRequestFullscreen) {
  230. element.mozRequestFullScreen();
  231. }
  232. } else {
  233. if (document.cancelFullScreen) {
  234. document.cancelFullScreen();
  235. } else if (document.mozCancelFullScreen) {
  236. document.mozCancelFullScreen();
  237. } else if (document.webkitCancelFullScreen) {
  238. document.webkitCancelFullScreen();
  239. }
  240. }
  241. }
  242. closeAllTextPages() {
  243. this.setPositionActive = false;
  244. this.copyTextActive = false;
  245. this.historyActive = false;
  246. this.settingsActive = false;
  247. this.stopScrolling();
  248. this.stopSearch();
  249. }
  250. loaderToggle() {
  251. this.loaderActive = !this.loaderActive;
  252. if (this.loaderActive) {
  253. this.closeAllTextPages();
  254. }
  255. }
  256. setPositionToggle() {
  257. this.setPositionActive = !this.setPositionActive;
  258. if (this.setPositionActive && this.activePage == 'TextPage' && this.mostRecentBook()) {
  259. this.closeAllTextPages();
  260. this.setPositionActive = true;
  261. this.$nextTick(() => {
  262. this.$refs.setPositionPage.sliderMax = this.mostRecentBook().textLength - 1;
  263. this.$refs.setPositionPage.sliderValue = this.mostRecentBook().bookPos;
  264. });
  265. } else {
  266. this.setPositionActive = false;
  267. }
  268. }
  269. stopScrolling() {
  270. if (this.scrollingActive)
  271. this.scrollingToggle();
  272. }
  273. scrollingToggle() {
  274. this.scrollingActive = !this.scrollingActive;
  275. if (this.activePage == 'TextPage') {
  276. const page = this.$refs.page;
  277. if (this.scrollingActive) {
  278. page.startTextScrolling();
  279. } else {
  280. page.stopTextScrolling();
  281. }
  282. }
  283. }
  284. stopSearch() {
  285. if (this.searchActive)
  286. this.searchToggle();
  287. }
  288. startTextSearch(opts) {
  289. if (this.activePage == 'TextPage')
  290. this.$refs.page.startSearch(opts.needle);
  291. }
  292. stopTextSearch() {
  293. if (this.activePage == 'TextPage')
  294. this.$refs.page.stopSearch();
  295. }
  296. searchToggle() {
  297. this.searchActive = !this.searchActive;
  298. const page = this.$refs.page;
  299. if (this.searchActive && this.activePage == 'TextPage' && page.parsed) {
  300. this.closeAllTextPages();
  301. this.searchActive = true;
  302. this.$nextTick(() => {
  303. this.$refs.searchPage.init(page.parsed);
  304. });
  305. } else {
  306. this.stopTextSearch();
  307. this.searchActive = false;
  308. }
  309. }
  310. copyTextToggle() {
  311. this.copyTextActive = !this.copyTextActive;
  312. const page = this.$refs.page;
  313. if (this.copyTextActive && this.activePage == 'TextPage' && page.parsed) {
  314. this.closeAllTextPages();
  315. this.copyTextActive = true;
  316. this.$nextTick(() => {
  317. this.$refs.copyTextPage.init(this.mostRecentBook().bookPos, page.parsed, this.copyFullText);
  318. });
  319. } else {
  320. this.searchActive = false;
  321. }
  322. }
  323. historyToggle() {
  324. this.historyActive = !this.historyActive;
  325. if (this.historyActive) {
  326. this.closeAllTextPages();
  327. this.historyActive = true;
  328. } else {
  329. this.historyActive = false;
  330. }
  331. }
  332. settingsToggle() {
  333. this.settingsActive = !this.settingsActive;
  334. if (this.settingsActive) {
  335. this.closeAllTextPages();
  336. this.settingsActive = true;
  337. } else {
  338. this.settingsActive = false;
  339. }
  340. }
  341. buttonClick(button) {
  342. switch (button) {
  343. case 'loader':
  344. this.loaderToggle();
  345. break;
  346. case 'fullScreen':
  347. this.fullScreenToggle();
  348. break;
  349. case 'setPosition':
  350. this.setPositionToggle();
  351. break;
  352. case 'scrolling':
  353. this.scrollingToggle();
  354. break;
  355. case 'search':
  356. this.searchToggle();
  357. break;
  358. case 'copyText':
  359. this.copyTextToggle();
  360. break;
  361. case 'history':
  362. this.historyToggle();
  363. break;
  364. case 'refresh':
  365. if (this.mostRecentBook()) {
  366. this.loadBook({url: this.mostRecentBook().url, force: true});
  367. }
  368. break;
  369. case 'settings':
  370. this.settingsToggle();
  371. break;
  372. }
  373. this.$refs[button].$el.blur();
  374. }
  375. buttonActiveClass(button) {
  376. const classActive = { 'tool-button-active': true, 'tool-button-active:hover': true };
  377. const classDisabled = { 'tool-button-disabled': true, 'tool-button-disabled:hover': true };
  378. let classResult = {};
  379. switch (button) {
  380. case 'loader':
  381. case 'fullScreen':
  382. case 'setPosition':
  383. case 'scrolling':
  384. case 'search':
  385. case 'copyText':
  386. case 'history':
  387. case 'settings':
  388. if (this[`${button}Active`])
  389. classResult = classActive;
  390. break;
  391. }
  392. if (this.activePage == 'LoaderPage' || !this.mostRecentBook()) {
  393. switch (button) {
  394. case 'undoAction':
  395. case 'redoAction':
  396. case 'setPosition':
  397. case 'scrolling':
  398. case 'search':
  399. case 'copyText':
  400. classResult = classDisabled;
  401. break;
  402. case 'history':
  403. case 'refresh':
  404. if (!this.mostRecentBook())
  405. classResult = classDisabled;
  406. break;
  407. }
  408. }
  409. return classResult;
  410. }
  411. get activePage() {
  412. let result = '';
  413. if (this.progressActive)
  414. result = 'ProgressPage';
  415. else if (this.loaderActive)
  416. result = 'LoaderPage';
  417. else if (this.mostRecentBook())
  418. result = 'TextPage';
  419. if (!result) {
  420. this.loaderActive = true;
  421. result = 'LoaderPage';
  422. }
  423. if (result != 'TextPage') {
  424. this.$root.$emit('set-app-title');
  425. }
  426. if (this.lastActivePage != result && result == 'TextPage') {
  427. //акивируем страницу с текстом
  428. this.$nextTick(async() => {
  429. const last = this.mostRecentBook();
  430. const isParsed = await bookManager.hasBookParsed(last);
  431. if (!isParsed) {
  432. this.$root.$emit('set-app-title');
  433. return;
  434. }
  435. this.updateRoute();
  436. const textPage = this.$refs.page;
  437. if (textPage.showBook) {
  438. textPage.lastBook = last;
  439. textPage.bookPos = (last.bookPos !== undefined ? last.bookPos : 0);
  440. textPage.showBook();
  441. }
  442. });
  443. }
  444. this.lastActivePage = result;
  445. return result;
  446. }
  447. loadBook(opts) {
  448. this.closeAllTextPages();
  449. this.progressActive = true;
  450. this.$nextTick(async() => {
  451. const progress = this.$refs.page;
  452. try {
  453. progress.show();
  454. progress.setState({state: 'parse'});
  455. // есть ли среди недавних
  456. const key = bookManager.keyFromUrl(opts.url);
  457. let wasOpened = await bookManager.getRecentBook({key});
  458. wasOpened = (wasOpened ? wasOpened : {});
  459. const bookPos = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos);
  460. const bookPosSeen = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen);
  461. let book = null;
  462. if (!opts.force) {
  463. // пытаемся загрузить и распарсить книгу в менеджере из локального кеша
  464. const bookParsed = await bookManager.getBook({url: opts.url}, (prog) => {
  465. progress.setState({progress: prog});
  466. });
  467. // если есть в локальном кеше
  468. if (bookParsed) {
  469. await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
  470. this.loaderActive = false;
  471. progress.hide(); this.progressActive = false;
  472. this.blinkCachedLoadMessage();
  473. return;
  474. }
  475. // иначе идем на сервер
  476. // пытаемся загрузить готовый файл с сервера
  477. if (wasOpened.path) {
  478. try {
  479. const resp = await readerApi.loadCachedBook(wasOpened.path, (state) => {
  480. progress.setState(state);
  481. });
  482. book = Object.assign({}, wasOpened, {data: resp.data});
  483. } catch (e) {
  484. //молчим
  485. }
  486. }
  487. }
  488. progress.setState({totalSteps: 5});
  489. // не удалось, скачиваем книгу полностью с конвертацией
  490. let loadCached = true;
  491. if (!book) {
  492. book = await readerApi.loadBook(opts.url, (state) => {
  493. progress.setState(state);
  494. });
  495. loadCached = false;
  496. }
  497. // добавляем в bookManager
  498. progress.setState({state: 'parse', step: 5});
  499. const addedBook = await bookManager.addBook(book, (prog) => {
  500. progress.setState({progress: prog});
  501. });
  502. // добавляем в историю
  503. await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
  504. this.updateRoute(true);
  505. this.loaderActive = false;
  506. progress.hide(); this.progressActive = false;
  507. if (loadCached) {
  508. this.blinkCachedLoadMessage();
  509. } else
  510. this.stopBlink = true;
  511. } catch (e) {
  512. progress.hide(); this.progressActive = false;
  513. this.loaderActive = true;
  514. this.$alert(e.message, 'Ошибка', {type: 'error'});
  515. }
  516. });
  517. }
  518. blinkCachedLoadMessage() {
  519. this.blinkCount = 30;
  520. if (!this.inBlink) {
  521. this.inBlink = true;
  522. this.stopBlink = false;
  523. this.$nextTick(async() => {
  524. let page = this.$refs.page;
  525. while (this.blinkCount) {
  526. this.showRefreshIcon = !this.showRefreshIcon;
  527. if (page.blinkCachedLoadMessage)
  528. page.blinkCachedLoadMessage(this.showRefreshIcon);
  529. await sleep(500);
  530. if (this.stopBlink)
  531. break;
  532. this.blinkCount--;
  533. page = this.$refs.page;
  534. }
  535. this.showRefreshIcon = true;
  536. this.inBlink = false;
  537. if (page.blinkCachedLoadMessage)
  538. page.blinkCachedLoadMessage('finish');
  539. });
  540. }
  541. }
  542. keyHook(event) {
  543. if (this.$root.rootRoute == '/reader') {
  544. let handled = false;
  545. if (!handled && this.settingsActive)
  546. handled = this.$refs.settingsPage.keyHook(event);
  547. if (!handled && this.historyActive)
  548. handled = this.$refs.historyPage.keyHook(event);
  549. if (!handled && this.setPositionActive)
  550. handled = this.$refs.setPositionPage.keyHook(event);
  551. if (!handled && this.searchActive)
  552. handled = this.$refs.searchPage.keyHook(event);
  553. if (!handled && this.copyTextActive)
  554. handled = this.$refs.copyTextPage.keyHook(event);
  555. if (!handled && this.$refs.page && this.$refs.page.keyHook)
  556. handled = this.$refs.page.keyHook(event);
  557. if (!handled && event.type == 'keydown') {
  558. if (event.code == 'Escape')
  559. this.loaderToggle();
  560. if (this.activePage == 'TextPage') {
  561. switch (event.code) {
  562. case 'KeyP':
  563. this.setPositionToggle();
  564. break;
  565. case 'KeyF':
  566. if (event.ctrlKey) {
  567. this.searchToggle();
  568. event.preventDefault();
  569. event.stopPropagation();
  570. }
  571. break;
  572. case 'KeyC':
  573. if (event.ctrlKey) {
  574. this.copyTextToggle();
  575. event.preventDefault();
  576. event.stopPropagation();
  577. }
  578. break;
  579. case 'KeyZ':
  580. this.scrollingToggle();
  581. break;
  582. case 'KeyH':
  583. this.historyToggle();
  584. break;
  585. case 'KeyS':
  586. this.settingsToggle();
  587. break;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. //-----------------------------------------------------------------------------
  595. </script>
  596. <style scoped>
  597. .el-container {
  598. padding: 0;
  599. margin: 0;
  600. height: 100%;
  601. }
  602. .el-header {
  603. padding-left: 5px;
  604. padding-right: 5px;
  605. background-color: #1B695F;
  606. color: #000;
  607. overflow-x: auto;
  608. overflow-y: hidden;
  609. }
  610. .header {
  611. display: flex;
  612. justify-content: space-between;
  613. min-width: 550px;
  614. }
  615. .el-main {
  616. position: relative;
  617. display: flex;
  618. padding: 0;
  619. margin: 0;
  620. background-color: #EBE2C9;
  621. color: #000;
  622. }
  623. .tool-button {
  624. margin: 0 2px 0 2px;
  625. padding: 0;
  626. color: #3E843E;
  627. background-color: #E6EDF4;
  628. margin-top: 5px;
  629. height: 38px;
  630. width: 38px;
  631. border: 0;
  632. box-shadow: 3px 3px 5px black;
  633. }
  634. .tool-button:hover {
  635. background-color: white;
  636. }
  637. .tool-button-active {
  638. box-shadow: 0 0 0;
  639. color: white;
  640. background-color: #8AB45F;
  641. position: relative;
  642. top: 1px;
  643. left: 1px;
  644. }
  645. .tool-button-active:hover {
  646. color: white;
  647. background-color: #81C581;
  648. }
  649. .tool-button-disabled {
  650. color: lightgray;
  651. background-color: gray;
  652. }
  653. .tool-button-disabled:hover {
  654. color: lightgray;
  655. background-color: gray;
  656. }
  657. i {
  658. font-size: 200%;
  659. }
  660. .space {
  661. width: 10px;
  662. display: inline-block;
  663. }
  664. .clear {
  665. color: rgba(0,0,0,0);
  666. }
  667. </style>