SettingsPage.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. <template>
  2. <Window ref="window" width="600px" @close="close">
  3. <template #header>
  4. Настройки
  5. </template>
  6. <div class="col row">
  7. <div class="full-height">
  8. <q-tabs
  9. ref="tabs"
  10. v-model="selectedTab"
  11. class="bg-grey-3 text-black"
  12. left-icon="la la-caret-up"
  13. right-icon="la la-caret-down"
  14. active-color="white"
  15. active-bg-color="primary"
  16. indicator-color="black"
  17. vertical
  18. no-caps
  19. stretch
  20. inline-label
  21. >
  22. <div v-show="tabsScrollable" class="q-pt-lg" />
  23. <q-tab class="tab" name="profiles" icon="la la-users" label="Профили" />
  24. <q-tab class="tab" name="view" icon="la la-eye" label="Вид" />
  25. <q-tab class="tab" name="toolbar" icon="la la-grip-horizontal" label="Панель" />
  26. <q-tab class="tab" name="keys" icon="la la-gamepad" label="Управление" />
  27. <q-tab class="tab" name="pagemove" icon="la la-school" label="Листание" />
  28. <q-tab class="tab" name="convert" icon="la la-magic" label="Конвертир." />
  29. <q-tab class="tab" name="others" icon="la la-list-ul" label="Прочее" />
  30. <q-tab class="tab" name="reset" icon="la la-broom" label="Сброс" />
  31. <div v-show="tabsScrollable" class="q-pt-lg" />
  32. </q-tabs>
  33. </div>
  34. <div class="col fit">
  35. <!-- Профили --------------------------------------------------------------------->
  36. <div v-if="selectedTab == 'profiles'" class="fit tab-panel">
  37. @@include('./ProfilesTab.inc');
  38. </div>
  39. <!-- Вид ------------------------------------------------------------------------->
  40. <div v-if="selectedTab == 'view'" class="fit column">
  41. <q-tabs
  42. v-model="selectedViewTab"
  43. active-color="black"
  44. active-bg-color="white"
  45. indicator-color="white"
  46. dense
  47. no-caps
  48. class="no-mp bg-grey-4 text-grey-7"
  49. >
  50. <q-tab name="mode" label="Режим" />
  51. <q-tab name="color" label="Цвет" />
  52. <q-tab name="font" label="Шрифт" />
  53. <q-tab name="text" label="Текст" />
  54. <q-tab name="status" label="Строка статуса" />
  55. </q-tabs>
  56. <div class="q-mb-sm" />
  57. <div class="col tab-panel">
  58. <div v-if="selectedViewTab == 'mode'">
  59. @@include('./ViewTab/Mode.inc');
  60. </div>
  61. <div v-if="selectedViewTab == 'color'">
  62. @@include('./ViewTab/Color.inc');
  63. </div>
  64. <div v-if="selectedViewTab == 'font'">
  65. @@include('./ViewTab/Font.inc');
  66. </div>
  67. <div v-if="selectedViewTab == 'text'">
  68. @@include('./ViewTab/Text.inc');
  69. </div>
  70. <div v-if="selectedViewTab == 'status'">
  71. @@include('./ViewTab/Status.inc');
  72. </div>
  73. </div>
  74. </div>
  75. <!-- Кнопки ---------------------------------------------------------------------->
  76. <div v-if="selectedTab == 'toolbar'" class="fit tab-panel">
  77. @@include('./ToolBarTab.inc');
  78. </div>
  79. <!-- Управление ------------------------------------------------------------------>
  80. <div v-if="selectedTab == 'keys'" class="fit column">
  81. @@include('./KeysTab.inc');
  82. </div>
  83. <!-- Листание -------------------------------------------------------------------->
  84. <div v-if="selectedTab == 'pagemove'" class="fit tab-panel">
  85. @@include('./PageMoveTab.inc');
  86. </div>
  87. <!-- Конвертирование ------------------------------------------------------------->
  88. <div v-if="selectedTab == 'convert'" class="fit tab-panel">
  89. @@include('./ConvertTab.inc');
  90. </div>
  91. <!-- Прочее ---------------------------------------------------------------------->
  92. <div v-if="selectedTab == 'others'" class="fit tab-panel">
  93. @@include('./OthersTab.inc');
  94. </div>
  95. <!-- Сброс ----------------------------------------------------------------------->
  96. <div v-if="selectedTab == 'reset'" class="fit tab-panel">
  97. @@include('./ResetTab.inc');
  98. </div>
  99. </div>
  100. </div>
  101. </Window>
  102. </template>
  103. <script>
  104. //-----------------------------------------------------------------------------
  105. import { ref, watch } from 'vue';
  106. import vueComponent from '../../vueComponent.js';
  107. import _ from 'lodash';
  108. import * as utils from '../../../share/utils';
  109. import * as cryptoUtils from '../../../share/cryptoUtils';
  110. import Window from '../../share/Window.vue';
  111. import NumInput from '../../share/NumInput.vue';
  112. import UserHotKeys from './UserHotKeys/UserHotKeys.vue';
  113. import wallpaperStorage from '../share/wallpaperStorage';
  114. import readerApi from '../../../api/reader';
  115. import rstore from '../../../store/modules/reader';
  116. import defPalette from './defPalette';
  117. const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
  118. const componentOptions = {
  119. components: {
  120. Window,
  121. NumInput,
  122. UserHotKeys,
  123. },
  124. data: function() {
  125. return Object.assign({}, rstore.settingDefaults);
  126. },
  127. watch: {
  128. settings: function() {
  129. this.settingsChanged();
  130. },
  131. form: function(newValue) {
  132. if (this.inited) {
  133. this.commit('reader/setSettings', _.cloneDeep(newValue));
  134. }
  135. },
  136. fontBold: function(newValue) {
  137. this.fontWeight = (newValue ? 'bold' : '');
  138. },
  139. fontItalic: function(newValue) {
  140. this.fontStyle = (newValue ? 'italic' : '');
  141. },
  142. vertShift: function(newValue) {
  143. const font = (this.webFontName ? this.webFontName : this.fontName);
  144. if (this.fontShifts[font] != newValue || this.fontVertShift != newValue) {
  145. this.fontShifts = Object.assign({}, this.fontShifts, {[font]: newValue});
  146. this.fontVertShift = newValue;
  147. }
  148. },
  149. fontName: function(newValue) {
  150. const font = (this.webFontName ? this.webFontName : newValue);
  151. this.vertShift = this.fontShifts[font] || 0;
  152. },
  153. webFontName: function(newValue) {
  154. const font = (newValue ? newValue : this.fontName);
  155. this.vertShift = this.fontShifts[font] || 0;
  156. },
  157. wallpaper: function(newValue) {
  158. if (newValue != '' && this.pageChangeAnimation == 'flip')
  159. this.pageChangeAnimation = '';
  160. },
  161. dualPageMode(newValue) {
  162. if (newValue && this.pageChangeAnimation == 'flip' || this.pageChangeAnimation == 'rightShift')
  163. this.pageChangeAnimation = '';
  164. },
  165. textColor: function(newValue) {
  166. this.textColorFiltered = newValue;
  167. },
  168. textColorFiltered: function(newValue) {
  169. if (hex.test(newValue))
  170. this.textColor = newValue;
  171. },
  172. backgroundColor: function(newValue) {
  173. this.bgColorFiltered = newValue;
  174. },
  175. bgColorFiltered: function(newValue) {
  176. if (hex.test(newValue))
  177. this.backgroundColor = newValue;
  178. },
  179. dualDivColor(newValue) {
  180. this.dualDivColorFiltered = newValue;
  181. },
  182. dualDivColorFiltered(newValue) {
  183. if (hex.test(newValue))
  184. this.dualDivColor = newValue;
  185. },
  186. statusBarColor(newValue) {
  187. this.statusBarColorFiltered = newValue;
  188. },
  189. statusBarColorFiltered(newValue) {
  190. if (hex.test(newValue))
  191. this.statusBarColor = newValue;
  192. },
  193. },
  194. };
  195. class SettingsPage {
  196. _options = componentOptions;
  197. selectedTab = 'profiles';
  198. selectedViewTab = 'mode';
  199. selectedKeysTab = 'mouse';
  200. fontBold = false;
  201. fontItalic = false;
  202. vertShift = 0;
  203. tabsScrollable = false;
  204. textColorFiltered = '';
  205. bgColorFiltered = '';
  206. dualDivColorFiltered = '';
  207. webFonts = [];
  208. fonts = [];
  209. serverStorageKeyVisible = false;
  210. toolButtons = [];
  211. rstore = {};
  212. setup() {
  213. const settingsProps = { form: ref({}) };
  214. for (let prop in rstore.settingDefaults) {
  215. settingsProps[prop] = ref(_.cloneDeep(rstore.settingDefaults[prop]));
  216. watch(settingsProps[prop], (newValue) => {
  217. settingsProps.form.value = Object.assign({}, settingsProps.form.value, {[prop]: newValue});
  218. }, {deep: true});
  219. }
  220. return settingsProps;
  221. }
  222. created() {
  223. this.commit = this.$store.commit;
  224. this.reader = this.$store.state.reader;
  225. this.form = {};
  226. this.rstore = rstore;
  227. this.toolButtons = rstore.toolButtons;
  228. this.settingsChanged();
  229. }
  230. mounted() {
  231. this.$watch(
  232. '$refs.tabs.scrollable',
  233. (newValue) => {
  234. this.tabsScrollable = newValue && !this.$root.isMobileDevice;
  235. }
  236. );
  237. }
  238. init() {
  239. this.$refs.window.init();
  240. this.inited = true;
  241. }
  242. settingsChanged() {
  243. if (_.isEqual(this.form, this.settings))
  244. return;
  245. this.form = Object.assign({}, this.settings);
  246. for (const prop in rstore.settingDefaults) {
  247. this[prop] = _.cloneDeep(this.form[prop]);
  248. }
  249. this.fontBold = (this.fontWeight == 'bold');
  250. this.fontItalic = (this.fontStyle == 'italic');
  251. this.fonts = rstore.fonts;
  252. this.webFonts = rstore.webFonts;
  253. const font = (this.webFontName ? this.webFontName : this.fontName);
  254. this.vertShift = this.fontShifts[font] || 0;
  255. this.textColorFiltered = this.textColor;
  256. this.bgColorFiltered = this.backgroundColor;
  257. this.dualDivColorFiltered = this.dualDivColor;
  258. this.statusBarColorFiltered = this.statusBarColor;
  259. }
  260. get mode() {
  261. return this.$store.state.config.mode;
  262. }
  263. get isExternalConverter() {
  264. return this.$store.state.config.useExternalBookConverter;
  265. }
  266. get settings() {
  267. return this.$store.state.reader.settings;
  268. }
  269. get serverSyncEnabled() {
  270. return this.$store.state.reader.serverSyncEnabled;
  271. }
  272. set serverSyncEnabled(newValue) {
  273. this.commit('reader/setServerSyncEnabled', newValue);
  274. }
  275. get profiles() {
  276. return this.$store.state.reader.profiles;
  277. }
  278. get currentProfileOptions() {
  279. const profNames = Object.keys(this.profiles)
  280. profNames.sort();
  281. let result = [{label: 'Нет', value: ''}];
  282. profNames.forEach(name => {
  283. result.push({label: name, value: name});
  284. });
  285. return result;
  286. }
  287. get wallpaperOptions() {
  288. let result = [{label: 'Нет', value: ''}];
  289. const userWallpapers = _.cloneDeep(this.userWallpapers);
  290. userWallpapers.sort((a, b) => a.label.localeCompare(b.label));
  291. for (const wp of userWallpapers) {
  292. if (wallpaperStorage.keyExists(wp.cssClass))
  293. result.push({label: wp.label, value: wp.cssClass});
  294. }
  295. for (let i = 1; i <= 17; i++) {
  296. result.push({label: i, value: `paper${i}`});
  297. }
  298. return result;
  299. }
  300. get fontsOptions() {
  301. let result = [];
  302. this.fonts.forEach(font => {
  303. result.push({label: (font.label ? font.label : font.name), value: font.name});
  304. });
  305. return result;
  306. }
  307. get webFontsOptions() {
  308. let result = [{label: 'Нет', value: ''}];
  309. this.webFonts.forEach(font => {
  310. result.push({label: font.name, value: font.name});
  311. });
  312. return result;
  313. }
  314. get pageChangeAnimationOptions() {
  315. let result = [
  316. {label: 'Нет', value: ''},
  317. {label: 'Вверх-вниз', value: 'downShift'},
  318. (!this.dualPageMode ? {label: 'Вправо-влево', value: 'rightShift'} : null),
  319. {label: 'Протаивание', value: 'thaw'},
  320. {label: 'Мерцание', value: 'blink'},
  321. {label: 'Вращение', value: 'rotate'},
  322. (this.wallpaper == '' && !this.dualPageMode ? {label: 'Листание', value: 'flip'} : null),
  323. ];
  324. result = result.filter(v => v);
  325. return result;
  326. }
  327. get currentProfile() {
  328. return this.$store.state.reader.currentProfile;
  329. }
  330. set currentProfile(newValue) {
  331. this.commit('reader/setCurrentProfile', newValue);
  332. }
  333. get partialStorageKey() {
  334. return this.serverStorageKey.substr(0, 7) + '***';
  335. }
  336. get serverStorageKey() {
  337. return this.$store.state.reader.serverStorageKey;
  338. }
  339. get setStorageKeyLink() {
  340. return `https://${window.location.host}/#/reader?setStorageAccessKey=${utils.toBase58(this.serverStorageKey)}`;
  341. }
  342. get predefineTextColors() {
  343. return defPalette.concat([
  344. '#ffffff',
  345. '#000000',
  346. '#202020',
  347. '#323232',
  348. '#aaaaaa',
  349. '#00c0c0',
  350. '#ebe2c9',
  351. '#cfdc99',
  352. '#478355',
  353. '#909080',
  354. ]);
  355. }
  356. get predefineBackgroundColors() {
  357. return defPalette.concat([
  358. '#ffffff',
  359. '#000000',
  360. '#202020',
  361. '#ebe2c9',
  362. '#cfdc99',
  363. '#478355',
  364. '#a6caf0',
  365. '#909080',
  366. '#808080',
  367. '#c8c8c8',
  368. ]);
  369. }
  370. colorPanStyle(type) {
  371. let result = 'width: 30px; height: 30px; border: 1px solid black; border-radius: 4px;';
  372. switch (type) {
  373. case 'text':
  374. result += `background-color: ${this.textColor};`
  375. break;
  376. case 'bg':
  377. result += `background-color: ${this.backgroundColor};`
  378. break;
  379. case 'div':
  380. result += `background-color: ${this.dualDivColor};`
  381. break;
  382. case 'statusbar':
  383. result += `background-color: ${this.statusBarColor};`
  384. break;
  385. }
  386. return result;
  387. }
  388. needReload() {
  389. this.$root.notify.warning('Необходимо обновить страницу (F5), чтобы изменения возымели эффект');
  390. }
  391. needTextReload() {
  392. this.$root.notify.warning('Необходимо обновить книгу в обход кэша, чтобы изменения возымели эффект');
  393. }
  394. close() {
  395. this.$emit('do-action', {action: 'settings'});
  396. }
  397. async setDefaults() {
  398. try {
  399. if (await this.$root.stdDialog.confirm('Подтвердите установку настроек по умолчанию:', ' ')) {
  400. this.form = Object.assign({}, rstore.settingDefaults);
  401. for (let prop in rstore.settingDefaults) {
  402. this[prop] = this.form[prop];
  403. }
  404. }
  405. } catch (e) {
  406. //
  407. }
  408. }
  409. async addProfile() {
  410. try {
  411. if (Object.keys(this.profiles).length >= 100) {
  412. this.$root.stdDialog.alert('Достигнут предел количества профилей', 'Ошибка');
  413. return;
  414. }
  415. const result = await this.$root.stdDialog.prompt('Введите произвольное название для профиля устройства:', ' ', {
  416. inputValidator: (str) => { if (!str) return 'Название не должно быть пустым'; else if (str.length > 50) return 'Слишком длинное название'; else return true; },
  417. });
  418. if (result && result.value) {
  419. if (this.profiles[result.value]) {
  420. this.$root.stdDialog.alert('Такой профиль уже существует', 'Ошибка');
  421. } else {
  422. const newProfiles = Object.assign({}, this.profiles, {[result.value]: 1});
  423. this.commit('reader/setAllowProfilesSave', true);
  424. await this.$nextTick();//ждем обработчики watch
  425. this.commit('reader/setProfiles', newProfiles);
  426. await this.$nextTick();//ждем обработчики watch
  427. this.commit('reader/setAllowProfilesSave', false);
  428. this.currentProfile = result.value;
  429. }
  430. }
  431. } catch (e) {
  432. //
  433. }
  434. }
  435. async delProfile() {
  436. if (!this.currentProfile)
  437. return;
  438. try {
  439. const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Удаление профиля '${this.$root.sanitize(this.currentProfile)}' необратимо.` +
  440. `<br>Все настройки профиля будут потеряны, однако список читаемых книг сохранится.` +
  441. `<br><br>Введите 'да' для подтверждения удаления:`, ' ', {
  442. inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Удаление не подтверждено'; },
  443. });
  444. if (result && result.value && result.value.toLowerCase() == 'да') {
  445. if (this.profiles[this.currentProfile]) {
  446. const newProfiles = Object.assign({}, this.profiles);
  447. delete newProfiles[this.currentProfile];
  448. this.commit('reader/setAllowProfilesSave', true);
  449. await this.$nextTick();//ждем обработчики watch
  450. this.commit('reader/setProfiles', newProfiles);
  451. await this.$nextTick();//ждем обработчики watch
  452. this.commit('reader/setAllowProfilesSave', false);
  453. this.currentProfile = '';
  454. }
  455. }
  456. } catch (e) {
  457. //
  458. }
  459. }
  460. async delAllProfiles() {
  461. if (!Object.keys(this.profiles).length)
  462. return;
  463. try {
  464. const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Удаление ВСЕХ профилей с настройками необратимо.` +
  465. `<br><br>Введите 'да' для подтверждения удаления:`, ' ', {
  466. inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Удаление не подтверждено'; },
  467. });
  468. if (result && result.value && result.value.toLowerCase() == 'да') {
  469. this.commit('reader/setAllowProfilesSave', true);
  470. await this.$nextTick();//ждем обработчики watch
  471. this.commit('reader/setProfiles', {});
  472. await this.$nextTick();//ждем обработчики watch
  473. this.commit('reader/setAllowProfilesSave', false);
  474. this.currentProfile = '';
  475. }
  476. } catch (e) {
  477. //
  478. }
  479. }
  480. async copyToClip(text, prefix) {
  481. const result = await utils.copyTextToClipboard(text);
  482. const suf = (prefix.substr(-1) == 'а' ? 'а' : '');
  483. const msg = (result ? `${prefix} успешно скопирован${suf} в буфер обмена` : 'Копирование не удалось');
  484. if (result)
  485. this.$root.notify.success(msg);
  486. else
  487. this.$root.notify.error(msg);
  488. }
  489. async showServerStorageKey() {
  490. this.serverStorageKeyVisible = !this.serverStorageKeyVisible;
  491. }
  492. async enterServerStorageKey(key) {
  493. try {
  494. const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Изменение ключа доступа приведет к замене всех профилей и читаемых книг в читалке.` +
  495. `<br><br>Введите новый ключ доступа:`, ' ', {
  496. inputValidator: (str) => {
  497. try {
  498. if (str && utils.fromBase58(str).length == 32) {
  499. return true;
  500. }
  501. } catch (e) {
  502. //
  503. }
  504. return 'Неверный формат ключа';
  505. },
  506. inputValue: (key && _.isString(key) ? key : null),
  507. });
  508. if (result && result.value && utils.fromBase58(result.value).length == 32) {
  509. this.commit('reader/setServerStorageKey', result.value);
  510. }
  511. } catch (e) {
  512. //
  513. }
  514. }
  515. async generateServerStorageKey() {
  516. try {
  517. const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Генерация нового ключа доступа приведет к удалению всех профилей и читаемых книг в читалке.` +
  518. `<br><br>Введите 'да' для подтверждения генерации нового ключа:`, ' ', {
  519. inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Генерация не подтверждена'; },
  520. });
  521. if (result && result.value && result.value.toLowerCase() == 'да') {
  522. if (this.$root.generateNewServerStorageKey)
  523. this.$root.generateNewServerStorageKey();
  524. }
  525. } catch (e) {
  526. //
  527. }
  528. }
  529. loadWallpaperFileClick() {
  530. this.$refs.file.click();
  531. }
  532. loadWallpaperFile() {
  533. const file = this.$refs.file.files[0];
  534. if (file.size > 10*1024*1024) {
  535. this.$root.stdDialog.alert('Файл обоев не должен превышать в размере 10Mb', 'Ошибка');
  536. return;
  537. }
  538. if (file.type != 'image/png' && file.type != 'image/jpeg') {
  539. this.$root.stdDialog.alert('Файл обоев должен иметь тип PNG или JPEG', 'Ошибка');
  540. return;
  541. }
  542. if (this.userWallpapers.length >= 100) {
  543. this.$root.stdDialog.alert('Превышено максимальное количество пользовательских обоев.', 'Ошибка');
  544. return;
  545. }
  546. this.$refs.file.value = '';
  547. if (file) {
  548. const reader = new FileReader();
  549. reader.onload = (e) => {
  550. (async() => {
  551. const data = e.target.result;
  552. const key = utils.toHex(cryptoUtils.sha256(data));
  553. const label = `#${key.substring(0, 4)}`;
  554. const cssClass = `user-paper${key}`;
  555. const newUserWallpapers = _.cloneDeep(this.userWallpapers);
  556. const index = _.findIndex(newUserWallpapers, (item) => (item.cssClass == cssClass));
  557. if (index < 0)
  558. newUserWallpapers.push({label, cssClass});
  559. if (!wallpaperStorage.keyExists(cssClass)) {
  560. await wallpaperStorage.setData(cssClass, data);
  561. //отправим data на сервер в файл `/upload/${key}`
  562. try {
  563. //const res =
  564. await readerApi.uploadFileBuf(data);
  565. //console.log(res);
  566. } catch (e) {
  567. console.error(e);
  568. }
  569. }
  570. this.userWallpapers = newUserWallpapers;
  571. this.wallpaper = cssClass;
  572. })();
  573. }
  574. reader.readAsDataURL(file);
  575. }
  576. }
  577. async delWallpaper() {
  578. if (this.wallpaper.indexOf('user-paper') == 0) {
  579. const newUserWallpapers = [];
  580. for (const wp of this.userWallpapers) {
  581. if (wp.cssClass != this.wallpaper) {
  582. newUserWallpapers.push(wp);
  583. }
  584. }
  585. await wallpaperStorage.removeData(this.wallpaper);
  586. this.userWallpapers = newUserWallpapers;
  587. this.wallpaper = '';
  588. }
  589. }
  590. keyHook(event) {
  591. if (!this.$root.stdDialog.active && event.type == 'keydown' && event.key == 'Escape') {
  592. this.close();
  593. }
  594. return true;
  595. }
  596. }
  597. export default vueComponent(SettingsPage);
  598. //-----------------------------------------------------------------------------
  599. </script>
  600. <style scoped>
  601. .tab {
  602. justify-content: initial;
  603. }
  604. .tab-panel {
  605. overflow-x: hidden;
  606. overflow-y: auto;
  607. font-size: 90%;
  608. padding: 0 10px 15px 10px;
  609. }
  610. .part-header {
  611. border-top: 2px solid #bbbbbb;
  612. font-weight: bold;
  613. font-size: 110%;
  614. margin-top: 15px;
  615. margin-bottom: 5px;
  616. }
  617. .item {
  618. width: 100%;
  619. margin-top: 5px;
  620. margin-bottom: 5px;
  621. }
  622. .label-1, .label-3, .label-7 {
  623. width: 75px;
  624. }
  625. .label-2, .label-4, .label-5 {
  626. width: 110px;
  627. }
  628. .label-6 {
  629. width: 100px;
  630. }
  631. .label-1, .label-2, .label-3, .label-4, .label-5, .label-6, .label-7 {
  632. display: flex;
  633. flex-direction: column;
  634. justify-content: center;
  635. text-align: right;
  636. margin-right: 10px;
  637. overflow: hidden;
  638. }
  639. .text {
  640. font-size: 90%;
  641. line-height: 130%;
  642. }
  643. .button {
  644. margin: 3px 15px 3px 0;
  645. padding: 0 5px 0 5px;
  646. }
  647. .copy-icon {
  648. margin-left: 5px;
  649. cursor: pointer;
  650. font-size: 120%;
  651. color: blue;
  652. }
  653. .input {
  654. max-width: 150px;
  655. }
  656. .no-mp {
  657. margin: 0;
  658. padding: 0;
  659. }
  660. .col-left {
  661. width: 150px;
  662. }
  663. </style>