Reader.vue 25 KB

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