diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..f5f110b6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Publish.js linguist-generated diff --git a/.gitignore b/.gitignore index fe2041ae..2afc0fb3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ node_modules # Don't include the compiled main.js file in the repo. # They should be uploaded to GitHub releases instead. main.js -PublishLoad.js # Exclude sourcemaps *.map diff --git a/PublishLoad.js b/PublishLoad.js new file mode 100644 index 00000000..e3c2c88d --- /dev/null +++ b/PublishLoad.js @@ -0,0 +1,30 @@ +// META-BIND OBSIDIAN PUBLISH SCRIPT +// add this script to the end of you publish.js +// this script loads and executes the latest version of the meta-bind plugin for obsidian publish + +// The plugin settings. Not all settings are used. +let mb_settingsString = `{ + "devMode": false, + "preferredDateFormat": "YYYY-MM-DD", + "useUsDateInputOrder": false, + "syncInterval": 50, + "minSyncInterval": 1000, + "maxSyncInterval": 50, + "inputTemplates": "", + "dateFormat": "eu" +}`; + +// if true, the script is pulled from the master branch instead of the release branch +const mb_dev_mode = false; + +const mb_settings = JSON.parse(mb_settingsString); + +async function mb_load() { + const response = mb_dev_mode + ? await fetch('https://raw.githubusercontent.com/mProjectsCode/obsidian-meta-bind-plugin/master/Publish.js') + : await fetch('https://raw.githubusercontent.com/mProjectsCode/obsidian-meta-bind-plugin/release/Publish.js'); + const script = await response.text(); + eval(script); +} + +await mb_load();