add settings and consistency
This commit is contained in:
parent
30b4a8a55d
commit
9c14b44d22
|
@ -0,0 +1,55 @@
|
|||
[
|
||||
{
|
||||
"id": "core",
|
||||
"text": "Core",
|
||||
"settings": [
|
||||
{
|
||||
"id": "test-setting",
|
||||
"text": "Test Setting",
|
||||
"hint": "Test Setting",
|
||||
"enabled": false,
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"id": "test-setting2",
|
||||
"text": "Test Setting 2",
|
||||
"hint": "Test Setting 2",
|
||||
"enabled": true,
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"id": "voice-disconnect",
|
||||
"text": "Voice Disconnect",
|
||||
"hint": "Disconnect from voice server when Discord closes",
|
||||
"enabled": false,
|
||||
"disabled": true
|
||||
},
|
||||
{
|
||||
"id": "developer-mode",
|
||||
"text": "Developer Mode",
|
||||
"hint": "BetterDiscord developer mode",
|
||||
"enabled": false,
|
||||
"disabled": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ui",
|
||||
"text": "UI",
|
||||
"settings": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "emotes",
|
||||
"text": "Emotes",
|
||||
"settings": []
|
||||
},
|
||||
{
|
||||
"id": "security",
|
||||
"text": "Security",
|
||||
"settings": [
|
||||
|
||||
]
|
||||
}
|
||||
]
|
|
@ -1 +1,2 @@
|
|||
export { default as Events } from './events';
|
||||
export { default as Settings } from './settings';
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* BetterDiscord Settings Module
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import defaultSettings from '../data/user.settings.default';
|
||||
|
||||
export default class {
|
||||
static get getSettings() {
|
||||
return defaultSettings;
|
||||
}
|
||||
}
|
|
@ -43,7 +43,9 @@
|
|||
</template>
|
||||
<script>
|
||||
// Imports
|
||||
import { Settings } from '../../modules';
|
||||
import { SidebarView, Sidebar, SidebarItem, ContentColumn } from './sidebar';
|
||||
import { CoreSettings } from './bd';
|
||||
import { SvgX } from './common';
|
||||
|
||||
// Constants
|
||||
|
@ -65,22 +67,48 @@
|
|||
activeIndex: -1,
|
||||
lastActiveIndex: -1,
|
||||
animating: false,
|
||||
first: true
|
||||
first: true,
|
||||
settings: Settings.getSettings
|
||||
}
|
||||
},
|
||||
props: ['active', 'close'],
|
||||
computed: {
|
||||
coreSettings() {
|
||||
return this.settings.find(settingset => settingset.id === 'core').settings;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SidebarView, Sidebar, SidebarItem, ContentColumn, SvgX
|
||||
SidebarView, Sidebar, SidebarItem, ContentColumn,
|
||||
CoreSettings,
|
||||
SvgX
|
||||
},
|
||||
methods: {
|
||||
itemOnClick() {
|
||||
itemOnClick(id) {
|
||||
if (this.animating || id === this.activeIndex) return;
|
||||
if (this.activeIndex >= 0) this.sidebarItems.find(item => item.id === this.activeIndex).active = false;
|
||||
this.sidebarItems.find(item => item.id === id).active = true;
|
||||
this.animating = true;
|
||||
this.lastActiveIndex = this.activeIndex;
|
||||
this.activeIndex = id;
|
||||
|
||||
if (this.first) {
|
||||
this.first = false;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.animating = false;
|
||||
this.lastActiveIndex = -1;
|
||||
}, 400);
|
||||
},
|
||||
activeContent() {
|
||||
return false;
|
||||
activeContent(s) {
|
||||
const item = this.sidebarItems.find(item => item.contentid === s);
|
||||
if (!item) return false;
|
||||
return item.id === this.activeIndex;
|
||||
},
|
||||
animatingContent() {
|
||||
return false;
|
||||
animatingContent(s) {
|
||||
const item = this.sidebarItems.find(item => item.contentid === s);
|
||||
if (!item) return false;
|
||||
return item.id === this.lastActiveIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* BetterDiscord Core Settings Component
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
<template>
|
||||
<SettingsWrapper headertext="Core Settings">
|
||||
<div class="bd-form-item" v-for="setting in settings" :key="setting.id">
|
||||
<SettingSwitch key="setting.id" :setting="setting" :onClick="settingOnClick" :disabled="setting.disabled" />
|
||||
<div class="bd-form-divider" />
|
||||
</div>
|
||||
</SettingsWrapper>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Imports
|
||||
import { SettingsWrapper } from './';
|
||||
import { SettingSwitch } from '../common';
|
||||
|
||||
/*Methods*/
|
||||
function settingOnClick(setting) {
|
||||
if (setting.enabled) return this.disableSetting('core', setting.id);
|
||||
this.enableSetting('core', setting.id);
|
||||
}
|
||||
|
||||
const methods = { settingOnClick };
|
||||
|
||||
export default {
|
||||
props: ['settings', 'enableSetting', 'disableSetting'],
|
||||
components: {
|
||||
SettingsWrapper, SettingSwitch
|
||||
},
|
||||
methods: {
|
||||
settingOnClick(setting) {
|
||||
if (setting.enabled) return this.disableSetting('core', setting.id);
|
||||
this.enableSetting('core', setting.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* BetterDiscord Css Editor Component
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
<template src="./templates/CssEditor.html">
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const { CssEditor } = require('../../../');
|
||||
|
||||
/*Imports*/
|
||||
import { SettingsWrapper } from './';
|
||||
import { SettingSwitch, FormButton } from '../generic';
|
||||
const components = { SettingsWrapper, SettingSwitch, FormButton };
|
||||
|
||||
function openInternalEditor() {
|
||||
CssEditor.show();
|
||||
}
|
||||
|
||||
function settingClicked() {
|
||||
this.dummySetting.checked = !this.dummySetting.checked;
|
||||
}
|
||||
|
||||
export default {
|
||||
components,
|
||||
methods: { openInternalEditor, settingClicked },
|
||||
data() {
|
||||
return {
|
||||
dummySetting: {
|
||||
title: "Live Update",
|
||||
hint: "Automatically update client css when saved.",
|
||||
checked: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* BetterDiscord Settings Wrapper Component
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
<template>
|
||||
<div class="bd-settingsWrap">
|
||||
<div class="bd-settingsWrap-header">{{headertext}}</div>
|
||||
<ScrollerWrap>
|
||||
<slot />
|
||||
</ScrollerWrap>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// Imports
|
||||
import { ScrollerWrap } from '../common';
|
||||
|
||||
export default {
|
||||
props: ['headertext'],
|
||||
components: {
|
||||
ScrollerWrap
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
export { default as SettingsWrapper } from './SettingsWrapper.vue';
|
||||
export { default as CoreSettings } from './CoreSettings.vue';
|
|
@ -10,8 +10,10 @@
|
|||
|
||||
<template>
|
||||
<div class="bd-scroller-wrap" :class="{'bd-dark': dark}">
|
||||
<div class="bd-scroller">
|
||||
<slot/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
|
|
Loading…
Reference in New Issue