2019-12-16 03:04:31 +08:00
|
|
|
const settings = {};
|
2019-07-18 00:02:07 +08:00
|
|
|
|
2019-12-16 03:04:31 +08:00
|
|
|
class Setting {
|
|
|
|
constructor(id, data) {
|
|
|
|
this.id = id;
|
|
|
|
settings[id] = this;
|
|
|
|
this.type = 'toggle';
|
|
|
|
if (data.type) this.type = data.type;
|
|
|
|
if (Settings.stored[id]) {
|
|
|
|
this.value = Settings.stored[id].value;
|
|
|
|
|
|
|
|
} else if (data.value != undefined) {
|
|
|
|
this.value = data.value
|
|
|
|
|
|
|
|
} else {
|
|
|
|
switch (this.type) {
|
|
|
|
case 'toggle': this.value = true; break;
|
|
|
|
case 'number': this.value = 0; break;
|
|
|
|
case 'text': this.value = ''; break;
|
2020-04-26 02:25:07 +08:00
|
|
|
case 'password': this.value = ''; break;
|
2019-12-16 03:04:31 +08:00
|
|
|
case 'select': this.value; break;
|
|
|
|
case 'click': this.value = false; break;
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
this.condition = data.condition;
|
|
|
|
this.category = data.category || 'general';
|
|
|
|
this.name = data.name || tl(`settings.${id}`);
|
|
|
|
this.description = data.description || tl(`settings.${id}.desc`);
|
2020-12-06 05:31:45 +08:00
|
|
|
this.launch_setting = data.launch_setting || false;
|
2019-07-18 00:02:07 +08:00
|
|
|
|
2019-12-16 03:04:31 +08:00
|
|
|
if (this.type == 'number') {
|
|
|
|
this.min = data.min;
|
|
|
|
this.max = data.max;
|
|
|
|
this.step = data.step;
|
|
|
|
}
|
|
|
|
if (this.type == 'click') {
|
|
|
|
this.icon = data.icon;
|
|
|
|
this.click = data.click;
|
|
|
|
}
|
|
|
|
if (this.type == 'select') {
|
|
|
|
this.options = data.options;
|
|
|
|
}
|
2020-04-26 02:25:07 +08:00
|
|
|
if (this.type == 'password') {
|
|
|
|
this.hidden = true;
|
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
if (typeof data.onChange == 'function') {
|
|
|
|
this.onChange = data.onChange
|
|
|
|
}
|
|
|
|
|
|
|
|
//add to structure
|
|
|
|
var category = Settings.structure[this.category];
|
|
|
|
if (category) {
|
|
|
|
category.items[id] = this;
|
|
|
|
let before = category.open;
|
|
|
|
category.open = false;
|
|
|
|
Vue.nextTick(() => {
|
|
|
|
category.open = before;
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
2019-12-18 00:44:27 +08:00
|
|
|
}
|
|
|
|
delete() {
|
|
|
|
if (settings[this.id]) {
|
|
|
|
delete settings[this.id];
|
|
|
|
}
|
|
|
|
if (Settings.structure[this.category] && Settings.structure[this.category].items[this.id]) {
|
|
|
|
delete Settings.structure[this.category].items[this.id];
|
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const Settings = {
|
|
|
|
structure: {},
|
|
|
|
stored: {},
|
|
|
|
setup() {
|
2019-07-18 00:02:07 +08:00
|
|
|
if (localStorage.getItem('settings') != null) {
|
2019-12-16 03:04:31 +08:00
|
|
|
Settings.stored = JSON.parse(localStorage.getItem('settings'));
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
|
|
|
|
//General
|
|
|
|
new Setting('language', {value: 'en', type: 'select', options: Language.options});
|
|
|
|
new Setting('username', {value: '', type: 'text'});
|
2020-07-16 15:32:59 +08:00
|
|
|
new Setting('streamer_mode', {value: false, onChange() {
|
|
|
|
StartScreen.vue._data.redact_names = settings.streamer_mode.value;
|
|
|
|
updateStreamerModeNotification();
|
|
|
|
}});
|
2020-03-05 03:56:17 +08:00
|
|
|
|
|
|
|
//Interface
|
2021-01-09 21:56:57 +08:00
|
|
|
new Setting('interface_scale', {category: 'interface', value: 100, min: 40, max: 200, type: 'number', condition: isApp, onChange() {
|
|
|
|
var factor = Math.clamp(settings.interface_scale.value, 40, 200) / 100;
|
|
|
|
currentwindow.webContents.setZoomFactor(factor)
|
|
|
|
resizeWindow()
|
|
|
|
}});
|
2020-03-05 03:56:17 +08:00
|
|
|
new Setting('origin_size', {category: 'interface', value: 10, type: 'number'});
|
|
|
|
new Setting('control_size', {category: 'interface', value: 10, type: 'number'});
|
2020-10-10 21:17:43 +08:00
|
|
|
new Setting('motion_trails', {category: 'interface', value: true, onChange() {
|
|
|
|
if (Animator.open) {
|
|
|
|
scene[this.value ? 'add' : 'remove'](Animator.motion_trail);
|
|
|
|
}
|
|
|
|
}});
|
2020-03-05 03:56:17 +08:00
|
|
|
new Setting('seethrough_outline', {category: 'interface', value: false});
|
|
|
|
new Setting('outliner_colors', {category: 'interface', value: false});
|
2021-02-05 00:20:01 +08:00
|
|
|
new Setting('preview_checkerboard', {category: 'interface', value: true, onChange() {
|
2020-03-05 03:56:17 +08:00
|
|
|
$('#center').toggleClass('checkerboard', settings.preview_checkerboard.value);
|
|
|
|
}});
|
2021-02-05 00:20:01 +08:00
|
|
|
new Setting('uv_checkerboard', {category: 'interface', value: true, onChange() {
|
2020-04-26 02:25:07 +08:00
|
|
|
$('.UVEditor').toggleClass('checkerboard_trigger', settings.uv_checkerboard.value);
|
2020-03-05 03:56:17 +08:00
|
|
|
}});
|
2019-12-16 03:04:31 +08:00
|
|
|
|
|
|
|
//Preview
|
|
|
|
new Setting('brightness', {category: 'preview', value: 50, type: 'number'});
|
2020-03-05 03:56:17 +08:00
|
|
|
new Setting('shading', {category: 'preview', value: true, onChange() {
|
2020-07-16 15:32:59 +08:00
|
|
|
updateShading()
|
2020-03-05 03:56:17 +08:00
|
|
|
}});
|
2020-10-07 03:57:57 +08:00
|
|
|
new Setting('antialiasing', {category: 'preview', value: true});
|
2020-08-17 22:48:14 +08:00
|
|
|
new Setting('fov', {category: 'preview', value: 45, type: 'number', onChange(val) {
|
|
|
|
Preview.all.forEach(preview => preview.setFOV(val));
|
|
|
|
}});
|
2021-03-04 21:22:12 +08:00
|
|
|
new Setting('camera_near_plane',{category: 'preview', value: 1, type: 'number', onChange(val) {
|
|
|
|
Preview.all.forEach(preview => {
|
|
|
|
preview.camPers.near = val;
|
|
|
|
preview.camPers.updateProjectionMatrix();
|
|
|
|
});
|
|
|
|
}});
|
2020-05-31 21:54:04 +08:00
|
|
|
new Setting('render_sides', {category: 'preview', value: 'auto', type: 'select', options: {
|
|
|
|
'auto': tl('settings.render_sides.auto'),
|
|
|
|
'front': tl('settings.render_sides.front'),
|
|
|
|
'double': tl('settings.render_sides.double'),
|
|
|
|
}, onChange() {
|
|
|
|
Canvas.updateRenderSides();
|
|
|
|
}});
|
2021-01-28 02:44:30 +08:00
|
|
|
new Setting('background_rendering', {category: 'preview', value: true});
|
2020-05-31 21:54:04 +08:00
|
|
|
/*
|
|
|
|
new Setting('transparency', {category: 'preview', value: true, onChange() {
|
|
|
|
for (var uuid in Canvas.materials) {
|
|
|
|
let material = Canvas.materials[uuid]
|
|
|
|
if (material instanceof THREE.Material) {
|
|
|
|
material.transparent = settings.transparency.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}});
|
|
|
|
*/
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('texture_fps', {category: 'preview', value: 2, type: 'number', onChange() {
|
|
|
|
TextureAnimator.updateSpeed()
|
|
|
|
}});
|
2020-10-20 04:11:04 +08:00
|
|
|
new Setting('particle_tick_rate',{category: 'preview', value: 30, type: 'number', onChange() {
|
|
|
|
Wintersky.global_options.tick_rate = this.value;
|
|
|
|
}});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('volume', {category: 'preview', value: 80, type: 'number'});
|
|
|
|
new Setting('display_skin', {category: 'preview', value: false, type: 'click', condition: isApp, icon: 'icon-player', click: function() { changeDisplaySkin() }});
|
|
|
|
|
|
|
|
//Edit
|
2020-10-05 05:44:06 +08:00
|
|
|
new Setting('undo_limit', {category: 'edit', value: 256, type: 'number'});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('canvas_unselect', {category: 'edit', value: false});
|
2019-12-18 00:44:27 +08:00
|
|
|
new Setting('highlight_cubes', {category: 'edit', value: true, onChange() {
|
|
|
|
updateCubeHighlights();
|
|
|
|
}});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('deactivate_size_limit',{category: 'edit', value: false});
|
|
|
|
|
|
|
|
//Grid
|
2020-04-26 02:25:07 +08:00
|
|
|
new Setting('base_grid', {category: 'grid', value: true,});
|
|
|
|
new Setting('large_grid', {category: 'grid', value: false});
|
|
|
|
new Setting('full_grid', {category: 'grid', value: false});
|
|
|
|
new Setting('large_box', {category: 'grid', value: false});
|
|
|
|
new Setting('large_grid_size', {category: 'grid', value: 3, type: 'number'});
|
|
|
|
new Setting('display_grid', {category: 'grid', value: false});
|
|
|
|
new Setting('painting_grid', {category: 'grid', value: true, onChange() {
|
2020-07-16 15:32:59 +08:00
|
|
|
Canvas.updatePaintingGrid();
|
2020-03-05 03:56:17 +08:00
|
|
|
}});
|
2019-12-16 03:04:31 +08:00
|
|
|
|
|
|
|
//Snapping
|
|
|
|
new Setting('edit_size', {category: 'snapping', value: 16, type: 'number'});
|
|
|
|
new Setting('shift_size', {category: 'snapping', value: 64, type: 'number'});
|
|
|
|
new Setting('ctrl_size', {category: 'snapping', value: 160, type: 'number'});
|
2021-01-10 22:44:13 +08:00
|
|
|
new Setting('ctrl_shift_size', {category: 'snapping', value: 640, type: 'number'});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('negative_size',{category: 'snapping', value: false});
|
2020-12-30 01:13:02 +08:00
|
|
|
new Setting('animation_snap',{category: 'snapping', value: 24, type: 'number'});
|
2019-12-16 03:04:31 +08:00
|
|
|
|
|
|
|
//Paint
|
2020-09-01 03:40:37 +08:00
|
|
|
new Setting('sync_color', {category: 'paint', value: false});
|
2020-04-26 02:25:07 +08:00
|
|
|
new Setting('paint_side_restrict', {category: 'paint', value: true});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('brush_opacity_modifier', {category: 'paint', value: 'pressure', type: 'select', options: {
|
|
|
|
'pressure': tl('settings.brush_modifier.pressure'),
|
|
|
|
'tilt': tl('settings.brush_modifier.tilt'),
|
2019-12-18 00:44:27 +08:00
|
|
|
'none': tl('settings.brush_modifier.none'),
|
2019-12-16 03:04:31 +08:00
|
|
|
}});
|
|
|
|
new Setting('brush_size_modifier', {category: 'paint', value: 'tilt', type: 'select', options: {
|
|
|
|
'pressure': tl('settings.brush_modifier.pressure'),
|
|
|
|
'tilt': tl('settings.brush_modifier.tilt'),
|
2019-12-18 00:44:27 +08:00
|
|
|
'none': tl('settings.brush_modifier.none'),
|
2019-12-16 03:04:31 +08:00
|
|
|
}});
|
|
|
|
new Setting('image_editor', {category: 'paint', value: false, type: 'click', condition: isApp, icon: 'fas.fa-pen-square', click: function() {changeImageEditor(null, true) }});
|
|
|
|
|
|
|
|
//Defaults
|
|
|
|
new Setting('autouv', {category: 'defaults', value: true});
|
|
|
|
new Setting('create_rename', {category: 'defaults', value: false});
|
|
|
|
new Setting('default_path', {category: 'defaults', value: false, type: 'click', condition: isApp, icon: 'burst_mode', click: function() { openDefaultTexturePath() }});
|
|
|
|
|
|
|
|
//Dialogs
|
|
|
|
new Setting('dialog_larger_cubes', {category: 'dialogs', value: true});
|
|
|
|
new Setting('dialog_rotation_limit', {category: 'dialogs', value: true});
|
|
|
|
|
2020-07-16 15:32:59 +08:00
|
|
|
//Application
|
|
|
|
new Setting('recent_projects', {category: 'application', value: 12, max: 128, min: 0, type: 'number', condition: isApp});
|
|
|
|
new Setting('backup_interval', {category: 'application', value: 10, type: 'number', condition: isApp});
|
|
|
|
new Setting('backup_retain', {category: 'application', value: 30, type: 'number', condition: isApp});
|
|
|
|
new Setting('automatic_updates', {category: 'application', value: true, condition: isApp});
|
2020-12-06 05:31:45 +08:00
|
|
|
new Setting('hardware_acceleration', {category: 'application', value: true, condition: isApp, launch_setting: true});
|
2020-07-16 15:32:59 +08:00
|
|
|
|
2019-12-16 03:04:31 +08:00
|
|
|
//Export
|
|
|
|
new Setting('minifiedout', {category: 'export', value: false});
|
2020-09-26 19:21:20 +08:00
|
|
|
new Setting('minify_bbmodel', {category: 'export', value: true});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('export_groups', {category: 'export', value: true});
|
2020-04-26 02:25:07 +08:00
|
|
|
new Setting('sketchfab_token', {category: 'export', value: '', type: 'password'});
|
2019-12-16 03:04:31 +08:00
|
|
|
new Setting('credit', {category: 'export', value: 'Made with Blockbench', type: 'text'});
|
2020-07-16 15:32:59 +08:00
|
|
|
|
2021-03-05 19:54:15 +08:00
|
|
|
Blockbench.onUpdateTo('3.8', () => {
|
|
|
|
settings.preview_checkerboard.value = true;
|
|
|
|
settings.uv_checkerboard.value = true;
|
|
|
|
})
|
2019-12-18 00:44:27 +08:00
|
|
|
},
|
|
|
|
addCategory(id, data) {
|
|
|
|
if (!data) data = 0;
|
|
|
|
Settings.structure[id] = {
|
|
|
|
name: data.name || tl('settings.category.'+id),
|
|
|
|
open: data.open != undefined ? !!data.open : id === 'general',
|
|
|
|
items: {}
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
},
|
2020-07-16 15:32:59 +08:00
|
|
|
open(options = 0) {
|
2019-07-18 00:02:07 +08:00
|
|
|
for (var sett in settings) {
|
|
|
|
if (settings.hasOwnProperty(sett)) {
|
|
|
|
Settings.old[sett] = settings[sett].value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
showDialog('settings')
|
2020-07-16 15:32:59 +08:00
|
|
|
|
|
|
|
setSettingsTab(options.tab || 'setting');
|
|
|
|
|
|
|
|
if (options.search) {
|
|
|
|
$('dialog#settings div.search_bar input').val(options.search);
|
|
|
|
if (options.tab == 'keybindings') {
|
|
|
|
Keybinds.updateSearch()
|
|
|
|
} else {
|
|
|
|
Settings.updateSearch()
|
|
|
|
}
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
},
|
|
|
|
saveLocalStorages() {
|
|
|
|
var settings_copy = {}
|
|
|
|
for (var key in settings) {
|
2019-12-16 03:04:31 +08:00
|
|
|
settings_copy[key] = {value: settings[key].value}
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
localStorage.setItem('settings', JSON.stringify(settings_copy) )
|
2020-04-26 02:25:07 +08:00
|
|
|
|
2020-12-06 05:31:45 +08:00
|
|
|
if (window.canvas_scenes) {
|
|
|
|
localStorage.setItem('canvas_scenes', JSON.stringify(canvas_scenes))
|
|
|
|
}
|
|
|
|
if (window.ColorPanel) {
|
|
|
|
localStorage.setItem('colors', JSON.stringify({
|
|
|
|
palette: ColorPanel.vue._data.palette,
|
|
|
|
history: ColorPanel.vue._data.history,
|
|
|
|
}))
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
},
|
|
|
|
save() {
|
2020-04-26 02:25:07 +08:00
|
|
|
Settings.saveLocalStorages()
|
2019-07-18 00:02:07 +08:00
|
|
|
function hasSettingChanged(id) {
|
|
|
|
return (settings[id].value !== Settings.old[id])
|
|
|
|
}
|
|
|
|
hideDialog()
|
|
|
|
updateSelection()
|
|
|
|
|
|
|
|
for (var key in BarItems) {
|
|
|
|
var action = BarItems[key]
|
|
|
|
if (action.linked_setting) {
|
2021-02-26 05:18:34 +08:00
|
|
|
if (settings[action.linked_setting] && action.value != settings[action.linked_setting].value) {
|
|
|
|
action.value = settings[action.linked_setting].value;
|
|
|
|
action.updateEnabledState();
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
}
|
2020-04-26 02:25:07 +08:00
|
|
|
if (hasSettingChanged('base_grid') || hasSettingChanged('large_grid') || hasSettingChanged('full_grid') || hasSettingChanged('large_grid_size')
|
2019-07-18 00:02:07 +08:00
|
|
|
||hasSettingChanged('large_box') || hasSettingChanged('display_grid') || hasSettingChanged('edit_size')) {
|
|
|
|
buildGrid()
|
|
|
|
}
|
|
|
|
Canvas.outlineMaterial.depthTest = !settings.seethrough_outline.value
|
2020-03-05 03:56:17 +08:00
|
|
|
if (hasSettingChanged('brightness')) {
|
2020-07-16 15:32:59 +08:00
|
|
|
updateShading()
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
for (var id in settings) {
|
|
|
|
var setting = settings[id];
|
2021-03-09 00:35:03 +08:00
|
|
|
if (!Condition(setting.condition)) return;
|
2019-12-16 03:04:31 +08:00
|
|
|
if (setting.onChange && hasSettingChanged(id)) {
|
|
|
|
setting.onChange(setting.value);
|
|
|
|
}
|
2020-12-06 05:31:45 +08:00
|
|
|
if (isApp && setting.launch_setting && hasSettingChanged(id)) {
|
|
|
|
ipcRenderer.send('edit-launch-setting', {key: id, value: setting.value})
|
|
|
|
}
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
Blockbench.dispatchEvent('update_settings');
|
|
|
|
},
|
|
|
|
updateSearch() {
|
|
|
|
var term = Settings.vue._data.search_term = $('input#settings_search_bar').val().toLowerCase();
|
2019-12-16 03:04:31 +08:00
|
|
|
var structure = Settings.structure;
|
2019-07-18 00:02:07 +08:00
|
|
|
if (term) {
|
|
|
|
var keywords = term.replace(/_/g, ' ').split(' ');
|
|
|
|
var items = {};
|
|
|
|
for (var key in settings) {
|
|
|
|
var setting = settings[key];
|
2021-03-09 00:35:03 +08:00
|
|
|
if (Condition(setting.condition)) {
|
2019-07-18 00:02:07 +08:00
|
|
|
var name = tl('settings.'+key).toLowerCase();
|
|
|
|
var desc = tl('settings.'+key+'.desc').toLowerCase();
|
|
|
|
var missmatch = false;
|
|
|
|
for (var word of keywords) {
|
|
|
|
if (
|
|
|
|
!key.includes(word) &&
|
|
|
|
!name.includes(word) &&
|
|
|
|
!desc.includes(word)
|
|
|
|
) {
|
|
|
|
missmatch = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!missmatch) {
|
|
|
|
items[key] = setting;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
structure.search_results.items = items
|
|
|
|
structure.search_results.hidden = false;
|
|
|
|
for (var key in structure) {
|
|
|
|
structure[key].open = false
|
|
|
|
}
|
|
|
|
structure.search_results.open = true;
|
|
|
|
} else {
|
|
|
|
structure.search_results.hidden = true;
|
|
|
|
}
|
|
|
|
},
|
2019-12-18 00:44:27 +08:00
|
|
|
get(id) {
|
|
|
|
if (id && settings[id]) {
|
|
|
|
return settings[id].value;
|
|
|
|
}
|
|
|
|
},
|
2019-07-18 00:02:07 +08:00
|
|
|
old: {}
|
|
|
|
}
|
|
|
|
Settings.setup()
|
|
|
|
|
2020-07-16 15:32:59 +08:00
|
|
|
function updateStreamerModeNotification() {
|
|
|
|
$('#start_screen section#streamer_mode').detach()
|
|
|
|
|
|
|
|
if (settings.streamer_mode.value) {
|
|
|
|
addStartScreenSection('streamer_mode', {
|
|
|
|
graphic: {type: 'icon', icon: 'live_tv'},
|
|
|
|
color: 'var(--color-stream)',
|
|
|
|
text_color: 'var(--color-light)',
|
|
|
|
text: [
|
|
|
|
{type: 'h1', text: tl('interface.streamer_mode_on'), click() {
|
|
|
|
Settings.open({search: 'streamer_mode'})
|
|
|
|
}}
|
|
|
|
]
|
|
|
|
})
|
2020-04-26 02:25:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-18 00:02:07 +08:00
|
|
|
onVueSetup(function() {
|
2019-12-18 00:44:27 +08:00
|
|
|
Settings.structure.search_results = {
|
|
|
|
name: tl('dialog.settings.search_results'),
|
|
|
|
hidden: true,
|
|
|
|
open: true,
|
|
|
|
items: {}
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
for (var key in settings) {
|
|
|
|
var category = settings[key].category
|
|
|
|
if (!category) category = 'general'
|
|
|
|
|
2019-12-16 03:04:31 +08:00
|
|
|
if (!Settings.structure[category]) {
|
|
|
|
Settings.structure[category] = {
|
2019-07-18 00:02:07 +08:00
|
|
|
name: tl('settings.category.'+category),
|
|
|
|
open: category === 'general',
|
|
|
|
items: {}
|
|
|
|
}
|
|
|
|
}
|
2019-12-16 03:04:31 +08:00
|
|
|
Settings.structure[category].items[key] = settings[key]
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
Settings.vue = new Vue({
|
|
|
|
el: 'ul#settingslist',
|
|
|
|
data: {
|
2019-12-16 03:04:31 +08:00
|
|
|
structure: Settings.structure,
|
2019-07-18 00:02:07 +08:00
|
|
|
search_term: ''
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
saveSettings() {
|
2021-02-26 05:18:34 +08:00
|
|
|
Settings.saveLocalStorages();
|
2019-07-18 00:02:07 +08:00
|
|
|
},
|
|
|
|
toggleCategory(category) {
|
|
|
|
if (!category.open) {
|
2019-12-16 03:04:31 +08:00
|
|
|
for (var ct in Settings.structure) {
|
|
|
|
Settings.structure[ct].open = false
|
2019-07-18 00:02:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
category.open = !category.open
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|