Skip to content

Commit

Permalink
Merge pull request #8 from kmcelwee/master
Browse files Browse the repository at this point in the history
Add toggle-completed-task-view command
  • Loading branch information
heliostatic committed Apr 13, 2023
2 parents d8520dd + 602a3d3 commit 5e52ae8
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
import { App, Plugin, addIcon} from 'obsidian';
import { App, Plugin, addIcon, PluginManifest } from 'obsidian';

export default class TaskHiderPlugin extends Plugin {
statusBar: HTMLElement;

constructor(app: App, manifest: PluginManifest) {
super(app, manifest);
this.statusBar = this.addStatusBarItem();
}

toggleCompletedTaskView() {
document.body.toggleClass('hide-completed-tasks', hiddenState);
hiddenState = !hiddenState;
this.statusBar.setText(hiddenState ? 'Showing Completed Tasks' : 'Hiding Completed Tasks');
}

async onload() {
console.log('loading completed-task-display plugin');

let statusBar = this.addStatusBarItem();
statusBar.setText('Showing Completed Tasks');
this.statusBar.setText('Showing Completed Tasks');

addIcon('tasks', taskShowIcon);
this.addRibbonIcon('tasks', 'Task Hider', () => {
document.body.toggleClass('hide-completed-tasks', hiddenState);
hiddenState = !hiddenState;
statusBar.setText(hiddenState ? 'Showing Completed Tasks' : 'Hiding Completed Tasks');
this.addRibbonIcon('tasks', 'Task Hider', this.toggleCompletedTaskView);
this.addCommand({
id: "toggle-completed-task-view",
name: "Toggle Completed Task View",
callback: this.toggleCompletedTaskView,
});
}

Expand Down

0 comments on commit 5e52ae8

Please sign in to comment.