mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-11-26 19:18:34 +01:00
Compare commits
2 commits
05a4710b8a
...
7aa91901c6
Author | SHA1 | Date | |
---|---|---|---|
7aa91901c6 | |||
70ade8ada0 |
11 changed files with 184 additions and 181 deletions
|
@ -4,6 +4,6 @@ root = true
|
|||
[*]
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Plugin } from "obsidian";
|
||||
import { defaultSettings, SimpleTimeTrackerSettings } from "./settings";
|
||||
import { SimpleTimeTrackerSettingsTab } from "./settings-tab";
|
||||
import { displayTracker, loadTracker } from "./tracker";
|
||||
import { displayTracker, loadTracker, Tracker } from "./tracker";
|
||||
|
||||
export default class SimpleTimeTrackerPlugin extends Plugin {
|
||||
|
||||
|
@ -13,7 +13,7 @@ export default class SimpleTimeTrackerPlugin extends Plugin {
|
|||
this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));
|
||||
|
||||
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e, i) => {
|
||||
let tracker = loadTracker(s);
|
||||
let tracker: Tracker = loadTracker(s);
|
||||
e.empty();
|
||||
displayTracker(tracker, e, () => i.getSectionInfo(e), this.settings);
|
||||
});
|
||||
|
@ -27,11 +27,11 @@ export default class SimpleTimeTrackerPlugin extends Plugin {
|
|||
});
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
async loadSettings(): Promise<void> {
|
||||
this.settings = Object.assign({}, defaultSettings, await this.loadData());
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
async saveSettings(): Promise<void> {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@ export class SimpleTimeTrackerSettingsTab extends PluginSettingTab {
|
|||
this.containerEl.createEl("hr");
|
||||
this.containerEl.createEl("p", {text: "If you like this plugin and want to support its development, you can do so through my website by clicking this fancy image!"});
|
||||
this.containerEl.createEl("a", {href: "https://ellpeck.de/support"})
|
||||
.createEl("img", { attr: { src: "https://ellpeck.de/res/generalsupport.png" }, cls: "simple-time-tracker-support" });
|
||||
.createEl("img", {
|
||||
attr: {src: "https://ellpeck.de/res/generalsupport.png"},
|
||||
cls: "simple-time-tracker-support"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ function startNewEntry(tracker: Tracker, name: string): void {
|
|||
name = `Segment ${tracker.entries.length + 1}`;
|
||||
let entry: Entry = {name: name, startTime: moment().unix(), endTime: null, subEntries: null};
|
||||
tracker.entries.push(entry);
|
||||
};
|
||||
}
|
||||
|
||||
function endRunningEntry(tracker: Tracker): void {
|
||||
let entry = getRunningEntry(tracker.entries);
|
||||
|
|
Loading…
Reference in a new issue