-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.js
More file actions
101 lines (100 loc) · 2.91 KB
/
main.js
File metadata and controls
101 lines (100 loc) · 2.91 KB
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
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var c = Object.defineProperty;
var p = Object.getOwnPropertyDescriptor;
var g = Object.getOwnPropertyNames;
var r = Object.prototype.hasOwnProperty;
var m = (s, t) => {
for (var n in t) c(s, n, { get: t[n], enumerable: !0 });
},
u = (s, t, n, i) => {
if ((t && typeof t == "object") || typeof t == "function")
for (let a of g(t))
!r.call(s, a) &&
a !== n &&
c(s, a, {
get: () => t[a],
enumerable: !(i = p(t, a)) || i.enumerable,
});
return s;
};
var h = (s) => u(c({}, "__esModule", { value: !0 }), s);
var y = {};
m(y, { default: () => o });
module.exports = h(y);
var e = require("obsidian"),
w = { mySetting: "default" },
o = class extends e.Plugin {
async onload() {
(await this.loadSettings(),
this.addRibbonIcon("dice", "Sample Plugin", (i) => {
new e.Notice("This is a notice!");
}).addClass("my-plugin-ribbon-class"),
this.addStatusBarItem().setText("Status Bar Text"),
this.addCommand({
id: "open-sample-modal-simple",
name: "Open sample modal (simple)",
callback: () => {
new l(this.app).open();
},
}),
this.addCommand({
id: "open-sample-modal-complex",
name: "Open sample modal (complex)",
checkCallback: (i) => {
if (this.app.workspace.getActiveViewOfType(e.MarkdownView))
return (i || new l(this.app).open(), !0);
},
}),
this.addSettingTab(new d(this.app, this)),
this.registerDomEvent(document, "click", (i) => {
console.log("click", i);
}),
this.registerInterval(
window.setInterval(() => console.log("setInterval"), 300 * 1e3),
));
}
onunload() {}
async loadSettings() {
this.settings = Object.assign({}, w, await this.loadData());
}
async saveSettings() {
await this.saveData(this.settings);
}
},
l = class extends e.Modal {
constructor(t) {
super(t);
}
onOpen() {
let { contentEl: t } = this;
t.setText("Woah!");
}
onClose() {
let { contentEl: t } = this;
t.empty();
}
},
d = class extends e.PluginSettingTab {
constructor(t, n) {
(super(t, n), (this.plugin = n));
}
display() {
let { containerEl: t } = this;
(t.empty(),
new e.Setting(t)
.setName("Setting #1")
.setDesc("It's a secret")
.addText((n) =>
n
.setPlaceholder("Enter your secret")
.setValue(this.plugin.settings.mySetting)
.onChange(async (i) => {
((this.plugin.settings.mySetting = i),
await this.plugin.saveSettings());
}),
));
}
};