mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-11-27 03:28:35 +01:00
Compare commits
No commits in common. "7aa91901c6831d15ad1782a333b8ad36a0115fa6" and "05a4710b8a9de1a3675443872418a791c1844421" have entirely different histories.
7aa91901c6
...
05a4710b8a
11 changed files with 181 additions and 184 deletions
|
@ -4,6 +4,6 @@ root = true
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = space
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
tab_width = 4
|
tab_width = 4
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Plugin } from "obsidian";
|
import { Plugin } from "obsidian";
|
||||||
import { defaultSettings, SimpleTimeTrackerSettings } from "./settings";
|
import { defaultSettings, SimpleTimeTrackerSettings } from "./settings";
|
||||||
import { SimpleTimeTrackerSettingsTab } from "./settings-tab";
|
import { SimpleTimeTrackerSettingsTab } from "./settings-tab";
|
||||||
import { displayTracker, loadTracker, Tracker } from "./tracker";
|
import { displayTracker, loadTracker } from "./tracker";
|
||||||
|
|
||||||
export default class SimpleTimeTrackerPlugin extends Plugin {
|
export default class SimpleTimeTrackerPlugin extends Plugin {
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export default class SimpleTimeTrackerPlugin extends Plugin {
|
||||||
this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));
|
this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));
|
||||||
|
|
||||||
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e, i) => {
|
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e, i) => {
|
||||||
let tracker: Tracker = loadTracker(s);
|
let tracker = loadTracker(s);
|
||||||
e.empty();
|
e.empty();
|
||||||
displayTracker(tracker, e, () => i.getSectionInfo(e), this.settings);
|
displayTracker(tracker, e, () => i.getSectionInfo(e), this.settings);
|
||||||
});
|
});
|
||||||
|
@ -27,11 +27,11 @@ export default class SimpleTimeTrackerPlugin extends Plugin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadSettings(): Promise<void> {
|
async loadSettings() {
|
||||||
this.settings = Object.assign({}, defaultSettings, await this.loadData());
|
this.settings = Object.assign({}, defaultSettings, await this.loadData());
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveSettings(): Promise<void> {
|
async saveSettings() {
|
||||||
await this.saveData(this.settings);
|
await this.saveData(this.settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,6 @@ export class SimpleTimeTrackerSettingsTab extends PluginSettingTab {
|
||||||
this.containerEl.createEl("hr");
|
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("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" })
|
this.containerEl.createEl("a", { href: "https://ellpeck.de/support" })
|
||||||
.createEl("img", {
|
.createEl("img", { attr: { src: "https://ellpeck.de/res/generalsupport.png" }, cls: "simple-time-tracker-support" });
|
||||||
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}`;
|
name = `Segment ${tracker.entries.length + 1}`;
|
||||||
let entry: Entry = { name: name, startTime: moment().unix(), endTime: null, subEntries: null };
|
let entry: Entry = { name: name, startTime: moment().unix(), endTime: null, subEntries: null };
|
||||||
tracker.entries.push(entry);
|
tracker.entries.push(entry);
|
||||||
}
|
};
|
||||||
|
|
||||||
function endRunningEntry(tracker: Tracker): void {
|
function endRunningEntry(tracker: Tracker): void {
|
||||||
let entry = getRunningEntry(tracker.entries);
|
let entry = getRunningEntry(tracker.entries);
|
||||||
|
|
Loading…
Reference in a new issue