From 528b32ccf7cc7d3f0de66b50dca2cb2540b2bc35 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 12 Oct 2022 20:24:08 +0700 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3=20SettingsPage=20(=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/Reader.vue | 4 +- .../Reader/SettingsPage/SettingsPage.vue | 150 ++---------- .../Reader/SettingsPage/ViewTab/Mode.inc | 124 ---------- .../Reader/SettingsPage/ViewTab/Mode/Mode.vue | 214 ++++++++++++++++++ .../Reader/SettingsPage/ViewTab/ViewTab.vue | 79 +++++++ .../SettingsPage/{ => ViewTab}/defPalette.js | 30 ++- .../Reader/SettingsPage/ViewTab/helper.js | 9 + client/store/modules/reader.js | 4 - package-lock.json | 14 +- package.json | 2 +- 10 files changed, 353 insertions(+), 277 deletions(-) delete mode 100644 client/components/Reader/SettingsPage/ViewTab/Mode.inc create mode 100644 client/components/Reader/SettingsPage/ViewTab/Mode/Mode.vue create mode 100644 client/components/Reader/SettingsPage/ViewTab/ViewTab.vue rename client/components/Reader/SettingsPage/{ => ViewTab}/defPalette.js (77%) create mode 100644 client/components/Reader/SettingsPage/ViewTab/helper.js diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index c8fd99c0..b0002f9a 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -543,9 +543,7 @@ class Reader { //обновим settings, если загружали обои из /upload/ if (updated) { - const newSettings = _.cloneDeep(this.settings); - newSettings.needUpdateSettingsView = (newSettings.needUpdateSettingsView < 10 ? newSettings.needUpdateSettingsView + 1 : 0); - this.commit('reader/setSettings', newSettings); + this.commit('reader/setSettings', {}); } dynamicCss.replace('wallpapers', newCss); diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue index 19b2ec2d..6391d3a8 100644 --- a/client/components/Reader/SettingsPage/SettingsPage.vue +++ b/client/components/Reader/SettingsPage/SettingsPage.vue @@ -23,7 +23,6 @@ stretch inline-label > -
@@ -33,7 +32,6 @@ -
@@ -41,47 +39,7 @@ - + @@ -115,10 +73,10 @@ import wallpaperStorage from '../share/wallpaperStorage'; import readerApi from '../../../api/reader'; import rstore from '../../../store/modules/reader'; -import defPalette from './defPalette'; //pages import ProfilesTab from './ProfilesTab/ProfilesTab.vue'; +import ViewTab from './ViewTab/ViewTab.vue'; import ToolBarTab from './ToolBarTab/ToolBarTab.vue'; import KeysTab from './KeysTab/KeysTab.vue'; import PageMoveTab from './PageMoveTab/PageMoveTab.vue'; @@ -134,6 +92,7 @@ const componentOptions = { Window, //pages ProfilesTab, + ViewTab, ToolBarTab, KeysTab, PageMoveTab, @@ -200,13 +159,6 @@ const componentOptions = { if (hex.test(newValue)) this.backgroundColor = newValue; }, - dualDivColor(newValue) { - this.dualDivColorFiltered = newValue; - }, - dualDivColorFiltered(newValue) { - if (hex.test(newValue)) - this.dualDivColor = newValue; - }, statusBarColor(newValue) { this.statusBarColorFiltered = newValue; }, @@ -222,39 +174,29 @@ class SettingsPage { form = {}; selectedTab = 'profiles'; - selectedViewTab = 'mode'; - fontBold = false; - fontItalic = false; - vertShift = 0; - tabsScrollable = false; - textColorFiltered = ''; - bgColorFiltered = ''; - dualDivColorFiltered = ''; - statusBarColorFiltered = ''; - - webFonts = []; - fonts = []; setsChanged = false; + fontBold = false; + fontItalic = false; + vertShift = 0; + textColorFiltered = ''; + bgColorFiltered = ''; + statusBarColorFiltered = ''; + webFonts = []; + fonts = []; + created() { this.commit = this.$store.commit; - this.reader = this.$store.state.reader; this.debouncedCommitSettings = _.debounce(() => { this.commit('reader/setSettings', _.cloneDeep(this.form)); - }, 100); + }, 50); this.settingsChanged();//no await } mounted() { - this.$watch( - '$refs.tabs.scrollable', - (newValue) => { - this.tabsScrollable = newValue && !this.$root.isMobileDevice; - } - ); } init() { @@ -263,9 +205,6 @@ class SettingsPage { } async settingsChanged() { - if (_.isEqual(this.form, this.settings)) - return; - this.setsChanged = true; try { this.form = _.cloneDeep(this.settings); @@ -326,55 +265,6 @@ class SettingsPage { return result; } - get predefineTextColors() { - return defPalette.concat([ - '#ffffff', - '#000000', - '#202020', - '#323232', - '#aaaaaa', - '#00c0c0', - '#ebe2c9', - '#cfdc99', - '#478355', - '#909080', - ]); - } - - get predefineBackgroundColors() { - return defPalette.concat([ - '#ffffff', - '#000000', - '#202020', - '#ebe2c9', - '#cfdc99', - '#478355', - '#a6caf0', - '#909080', - '#808080', - '#c8c8c8', - ]); - } - - colorPanStyle(type) { - let result = 'width: 30px; height: 30px; border: 1px solid black; border-radius: 4px;'; - switch (type) { - case 'text': - result += `background-color: ${this.textColor};` - break; - case 'bg': - result += `background-color: ${this.backgroundColor};` - break; - case 'div': - result += `background-color: ${this.dualDivColor};` - break; - case 'statusbar': - result += `background-color: ${this.statusBarColor};` - break; - } - return result; - } - needReload() { this.$root.notify.warning('Необходимо обновить страницу (F5), чтобы изменения возымели эффект'); } @@ -517,20 +407,6 @@ export default vueComponent(SettingsPage); .tab { justify-content: initial; } - -.label-2 { - width: 110px; -} - -.input { - max-width: 150px; -} - -.no-mp { - margin: 0; - padding: 0; -} - diff --git a/client/components/Reader/SettingsPage/ViewTab/ViewTab.vue b/client/components/Reader/SettingsPage/ViewTab/ViewTab.vue new file mode 100644 index 00000000..fb204c05 --- /dev/null +++ b/client/components/Reader/SettingsPage/ViewTab/ViewTab.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/client/components/Reader/SettingsPage/defPalette.js b/client/components/Reader/SettingsPage/ViewTab/defPalette.js similarity index 77% rename from client/components/Reader/SettingsPage/defPalette.js rename to client/components/Reader/SettingsPage/ViewTab/defPalette.js index b29214b8..f0b9acfe 100644 --- a/client/components/Reader/SettingsPage/defPalette.js +++ b/client/components/Reader/SettingsPage/ViewTab/defPalette.js @@ -14,4 +14,32 @@ const defPalette = [ 'rgb(255,255,255)', 'rgb(205,205,205)', 'rgb(178,178,178)', 'rgb(153,153,153)', 'rgb(127,127,127)', 'rgb(102,102,102)', 'rgb(76,76,76)', 'rgb(51,51,51)', 'rgb(25,25,25)', 'rgb(0,0,0)' ]; -export default defPalette; \ No newline at end of file +export default { + predefinePalette: defPalette, + + predefineTextColors: defPalette.concat([ + '#ffffff', + '#000000', + '#202020', + '#323232', + '#aaaaaa', + '#00c0c0', + '#ebe2c9', + '#cfdc99', + '#478355', + '#909080', + ]), + + predefineBackgroundColors: defPalette.concat([ + '#ffffff', + '#000000', + '#202020', + '#ebe2c9', + '#cfdc99', + '#478355', + '#a6caf0', + '#909080', + '#808080', + '#c8c8c8', + ]), +}; \ No newline at end of file diff --git a/client/components/Reader/SettingsPage/ViewTab/helper.js b/client/components/Reader/SettingsPage/ViewTab/helper.js new file mode 100644 index 00000000..35743a17 --- /dev/null +++ b/client/components/Reader/SettingsPage/ViewTab/helper.js @@ -0,0 +1,9 @@ +const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/; + +export function colorPanStyle(bgColor) { + return `width: 30px; height: 30px; border: 1px solid black; border-radius: 4px; background-color: ${bgColor}`; +} + +export function isHexColor(value) { + return hex.test(value); +} diff --git a/client/store/modules/reader.js b/client/store/modules/reader.js index 81216c48..5a1381b7 100644 --- a/client/store/modules/reader.js +++ b/client/store/modules/reader.js @@ -198,10 +198,6 @@ const settingDefaults = { bucSetOnNew: true, // автоматически включать проверку обновлений для вновь загружаемых файлов bucCancelEnabled: true, // вкл/выкл отмену проверки книг через bucCancelDays bucCancelDays: 90, // количество дней, через которое отменяется проверка книги, при условии отсутствия обновлений за это время - - //для SettingsPage - needUpdateSettingsView: 0, - }; for (const font of fonts) diff --git a/package-lock.json b/package-lock.json index 8d89a0f3..b43dae4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "pako": "^2.0.4", "path-browserify": "^1.0.1", "pidusage": "^3.0.0", - "quasar": "^2.7.7", + "quasar": "^2.9.2", "safe-buffer": "^5.2.1", "sanitize-html": "^2.7.1", "sjcl": "^1.0.8", @@ -8009,9 +8009,9 @@ } }, "node_modules/quasar": { - "version": "2.7.7", - "resolved": "https://registry.npmjs.org/quasar/-/quasar-2.7.7.tgz", - "integrity": "sha512-tegG6EmEmv5i24MoNopRkhZOdT5kdLSAxQMA0V/fG04oco52hk2xwvB0EVS8WzT0bZZbc/9iXlAm1c29rZ3yVA==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/quasar/-/quasar-2.9.2.tgz", + "integrity": "sha512-Z4QWJDC4vFILKRJJdE0j/jnRTo94A2k403G6LtTiSIRSmV8dUl4YWqqNRH6lQQ01Vwjj06kKtN81fi3ontBt0w==", "engines": { "node": ">= 10.18.1", "npm": ">= 6.13.4", @@ -16394,9 +16394,9 @@ } }, "quasar": { - "version": "2.7.7", - "resolved": "https://registry.npmjs.org/quasar/-/quasar-2.7.7.tgz", - "integrity": "sha512-tegG6EmEmv5i24MoNopRkhZOdT5kdLSAxQMA0V/fG04oco52hk2xwvB0EVS8WzT0bZZbc/9iXlAm1c29rZ3yVA==" + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/quasar/-/quasar-2.9.2.tgz", + "integrity": "sha512-Z4QWJDC4vFILKRJJdE0j/jnRTo94A2k403G6LtTiSIRSmV8dUl4YWqqNRH6lQQ01Vwjj06kKtN81fi3ontBt0w==" }, "querystringify": { "version": "2.2.0", diff --git a/package.json b/package.json index cd2cce35..5f11e3c1 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "pako": "^2.0.4", "path-browserify": "^1.0.1", "pidusage": "^3.0.0", - "quasar": "^2.7.7", + "quasar": "^2.9.2", "safe-buffer": "^5.2.1", "sanitize-html": "^2.7.1", "sjcl": "^1.0.8",