forked from sytone/foundry-vtt-journal-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
100 lines (91 loc) · 3.91 KB
/
main.js
File metadata and controls
100 lines (91 loc) · 3.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
// Import TypeScript modules
import * as Constants from './module/constants.js';
import * as Logger from './module/logger.js'
import { registerSettings } from './module/settings.js';
import * as JournalSync from './module/journal-sync.js'
import BMDSync from './module/better-md.js';
/* ------------------------------------ */
/* Initialize module */
/* ------------------------------------ */
Hooks.once('init', async function () {
//Logger.log(`Initializing ${Constants.MODULE_NAME}`);
//Logger.log(" ___ _ __, ");
//Logger.log(" ( / // ( ");
//Logger.log(" / __ , , _ _ _ __, // `. __ , _ _ _,");
//Logger.log(" _/_(_)(_/_/ (_/ / /_(_/(_(/_---(___)/ (_/_/ / /_(__");
//Logger.log(" // / ");
//Logger.log("(/ ' ");
Logger.log("____ ____ ____ ____ ____ ____ ");
Logger.log("||B |||E |||T |||T |||E |||R || ");
Logger.log("||__|||__|||__|||__|||__|||__|| ");
Logger.log("|_________|____|____|____|____|____ ____ ____ ____ ");
Logger.log("|| |||M |||A |||R |||K |||D |||O |||W |||N ||");
Logger.log("||_______|||__|||__|||__|||__|||__|||__|||__|||__||");
Logger.log("|_________|_________|____|____|____|____|/__\|/__\|");
Logger.log("|| ||| |||S |||Y |||N |||C || ");
Logger.log("||_______|||_______|||__|||__|||__|||__|| ");
Logger.log("|/_______\|/_______\|/__\|/__\|/__\|/__\| ");
Logger.log(" ");
// Assign custom classes and constants here
// Register custom module settings
await registerSettings();
// // Preload Handlebars templates
// await preloadTemplates();
await JournalSync.initModule();
// Register custom sheets (if any)
});
/* ------------------------------------ */
/* Setup module */
/* ------------------------------------ */
Hooks.once('setup', async function () {
// Do anything after initialization but before
// ready
});
/* ------------------------------------ */
/* When ready */
/* ------------------------------------ */
Hooks.once('ready', async function () {
// Do anything once the module is ready
await JournalSync.readyModule();
});
// Add any additional hooks if necessary
Hooks.on("renderSidebarTab", async (app, html) =>{
//Logger.log("sidebar was rendered");
if (app.options.id == "journal" && game.user.isGM) {
let button = $("<div class='header-actions action-buttons flexrow'><button><i class='fas fa-user-robot'></i> Better Markdown Sync</button></div>");
button.click(function() {
new BMDSync().render(true);
// const db = new DatabaseBakend();
// db.getDocuments('JounalEntry')
})
/*
button.click(async () => {
console.log("the button was clicked");
ui.notifications.info("Checking your DDB details - this might take a few seconds!");
const setupComplete = isSetupComplete();
if (setupComplete) {
const cobaltStatus = await checkCobalt();
if (cobaltStatus.success) {
let validKey = await isValidKey();
if (validKey) {
new DDBMuncher().render(true);
}
} else {
new DDBCookie().render(true);
}
} else {
game.settings.set("ddb-importer", "settings-call-muncher", true);
new DDBSetup().render(true);
}
});
*/
$(html).find(".directory-header").append(button);
//would potentially require reload from setting, not worrying about this now
/*const top = game.settings.get(Constants.MODULE_NAME, "ShowButtonTop");
if (top) {
$(html).find(".directory-header").append(button);
} else {
$(html).find(".directory-footer").append(button);
}*/
}
});