Reader.vue 26 KB

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