forked from juliang22/ObsidianTimestampNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.ts
103 lines (90 loc) · 2.98 KB
/
settings.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { App, PluginSettingTab, Setting } from 'obsidian';
import TimestampPlugin from './main';
export interface TimestampPluginSettings {
noteTitle: string;
urlStartTimeMap: Map<string, number>;
urlColor: string;
timestampColor: string;
urlTextColor: string;
timestampTextColor: string;
}
export const DEFAULT_SETTINGS: TimestampPluginSettings = {
noteTitle: "",
urlStartTimeMap: new Map<string, number>(),
urlColor: 'blue',
timestampColor: 'green',
urlTextColor: 'white',
timestampTextColor: 'white'
}
const COLORS = { 'blue': 'blue', 'red': 'red', 'green': 'green', 'yellow': 'yellow', 'orange': 'orange', 'purple': 'purple', 'pink': 'pink', 'grey': 'grey', 'black': 'black', 'white': 'white' };
export class TimestampPluginSettingTab extends PluginSettingTab {
plugin: TimestampPlugin;
constructor(app: App, plugin: TimestampPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', { text: 'Timestamp Notes Plugin' });
// Customize title
new Setting(containerEl)
.setName('Title')
.setDesc('This title will be printed after opening a video with the hotkey. Use <br> for new lines.')
.addText(text => text
.setPlaceholder('Enter title template.')
.setValue(this.plugin.settings.noteTitle)
.onChange(async (value) => {
this.plugin.settings.noteTitle = value;
await this.plugin.saveSettings();
}));
// Customize url button color
new Setting(containerEl)
.setName('URL Button Color')
.setDesc('Pick a color for the url button.')
.addDropdown(dropdown => dropdown
.addOptions(COLORS)
.setValue(this.plugin.settings.urlColor)
.onChange(async (value) => {
this.plugin.settings.urlColor = value;
await this.plugin.saveSettings();
}
));
// Customize url text color
new Setting(containerEl)
.setName('URL Text Color')
.setDesc('Pick a color for the URL text button.')
.addDropdown(dropdown => dropdown
.addOptions(COLORS)
.setValue(this.plugin.settings.urlTextColor)
.onChange(async (value) => {
this.plugin.settings.urlTextColor = value;
await this.plugin.saveSettings();
}
));
// Customize timestamp button color
new Setting(containerEl)
.setName('Timestamp Button Color')
.setDesc('Pick a color for the timestamp button.')
.addDropdown(dropdown => dropdown
.addOptions(COLORS)
.setValue(this.plugin.settings.timestampColor)
.onChange(async (value) => {
this.plugin.settings.timestampColor = value;
await this.plugin.saveSettings();
}
));
// Customize timestamp text color
new Setting(containerEl)
.setName('Timestamp Text Color')
.setDesc('Pick a color for the timestamp text.')
.addDropdown(dropdown => dropdown
.addOptions(COLORS)
.setValue(this.plugin.settings.timestampTextColor)
.onChange(async (value) => {
this.plugin.settings.timestampTextColor = value;
await this.plugin.saveSettings();
}
));
}
}