mirror of
https://github.com/Ellpeck/ObsidianSimpleTimeTracker.git
synced 2024-11-21 17:23:28 +01:00
first setup
This commit is contained in:
parent
186b13142f
commit
4d49d195a9
28 changed files with 3306 additions and 219 deletions
|
@ -3,7 +3,6 @@ root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
npm node_modules
|
|
||||||
build
|
|
23
.eslintrc
23
.eslintrc
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"root": true,
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"env": { "node": true },
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
"no-prototype-builtins": "off",
|
|
||||||
"@typescript-eslint/no-empty-function": "off"
|
|
||||||
}
|
|
||||||
}
|
|
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
github: Ellpeck
|
||||||
|
ko_fi: Ellpeck
|
||||||
|
patreon: Ellpeck
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -10,13 +10,14 @@ node_modules
|
||||||
|
|
||||||
# Don't include the compiled main.js file in the repo.
|
# Don't include the compiled main.js file in the repo.
|
||||||
# They should be uploaded to GitHub releases instead.
|
# They should be uploaded to GitHub releases instead.
|
||||||
main.js
|
/main.js
|
||||||
|
|
||||||
# Exclude sourcemaps
|
# Exclude sourcemaps
|
||||||
*.map
|
*.map
|
||||||
|
|
||||||
# obsidian
|
# obsidian
|
||||||
data.json
|
workspace
|
||||||
|
workspace.json
|
||||||
|
|
||||||
# Exclude macOS Finder (System Explorer) View States
|
# Exclude macOS Finder (System Explorer) View States
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
1
.npmrc
1
.npmrc
|
@ -1 +0,0 @@
|
||||||
tag-version-prefix=""
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Ellpeck
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -1,13 +1,12 @@
|
||||||
import esbuild from "esbuild";
|
import esbuild from "esbuild";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import builtins from 'builtin-modules'
|
import builtins from 'builtin-modules';
|
||||||
|
import { copy } from 'esbuild-plugin-copy';
|
||||||
|
|
||||||
const banner =
|
const banner = `/*
|
||||||
`/*
|
|
||||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
if you want to view the source, please visit the github repository of this plugin
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
*/
|
*/`;
|
||||||
`;
|
|
||||||
|
|
||||||
const prod = (process.argv[2] === 'production');
|
const prod = (process.argv[2] === 'production');
|
||||||
|
|
||||||
|
@ -15,26 +14,45 @@ esbuild.build({
|
||||||
banner: {
|
banner: {
|
||||||
js: banner,
|
js: banner,
|
||||||
},
|
},
|
||||||
entryPoints: ['main.ts'],
|
entryPoints: ['src/main.ts'],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
external: [
|
external: [
|
||||||
'obsidian',
|
'obsidian',
|
||||||
'electron',
|
'electron',
|
||||||
'@codemirror/autocomplete',
|
'@codemirror/autocomplete',
|
||||||
|
'@codemirror/closebrackets',
|
||||||
'@codemirror/collab',
|
'@codemirror/collab',
|
||||||
'@codemirror/commands',
|
'@codemirror/commands',
|
||||||
|
'@codemirror/comment',
|
||||||
|
'@codemirror/fold',
|
||||||
|
'@codemirror/gutter',
|
||||||
|
'@codemirror/highlight',
|
||||||
|
'@codemirror/history',
|
||||||
'@codemirror/language',
|
'@codemirror/language',
|
||||||
'@codemirror/lint',
|
'@codemirror/lint',
|
||||||
|
'@codemirror/matchbrackets',
|
||||||
|
'@codemirror/panel',
|
||||||
|
'@codemirror/rangeset',
|
||||||
|
'@codemirror/rectangular-selection',
|
||||||
'@codemirror/search',
|
'@codemirror/search',
|
||||||
'@codemirror/state',
|
'@codemirror/state',
|
||||||
|
'@codemirror/stream-parser',
|
||||||
|
'@codemirror/text',
|
||||||
|
'@codemirror/tooltip',
|
||||||
'@codemirror/view',
|
'@codemirror/view',
|
||||||
'@lezer/common',
|
...builtins
|
||||||
'@lezer/highlight',
|
],
|
||||||
'@lezer/lr',
|
plugins: [
|
||||||
...builtins],
|
copy({
|
||||||
|
assets: [{
|
||||||
|
from: ["./manifest.json", "./main.js", "./styles.css"],
|
||||||
|
to: ["./test-vault/.obsidian/plugins/obsidian-simple-time-tracker/."]
|
||||||
|
}]
|
||||||
|
}),
|
||||||
|
],
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
watch: !prod,
|
watch: !prod,
|
||||||
target: 'es2018',
|
target: 'es2016',
|
||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
sourcemap: prod ? false : 'inline',
|
sourcemap: prod ? false : 'inline',
|
||||||
treeShaking: true,
|
treeShaking: true,
|
||||||
|
|
137
main.ts
137
main.ts
|
@ -1,137 +0,0 @@
|
||||||
import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian';
|
|
||||||
|
|
||||||
// Remember to rename these classes and interfaces!
|
|
||||||
|
|
||||||
interface MyPluginSettings {
|
|
||||||
mySetting: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DEFAULT_SETTINGS: MyPluginSettings = {
|
|
||||||
mySetting: 'default'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class MyPlugin extends Plugin {
|
|
||||||
settings: MyPluginSettings;
|
|
||||||
|
|
||||||
async onload() {
|
|
||||||
await this.loadSettings();
|
|
||||||
|
|
||||||
// This creates an icon in the left ribbon.
|
|
||||||
const ribbonIconEl = this.addRibbonIcon('dice', 'Sample Plugin', (evt: MouseEvent) => {
|
|
||||||
// Called when the user clicks the icon.
|
|
||||||
new Notice('This is a notice!');
|
|
||||||
});
|
|
||||||
// Perform additional things with the ribbon
|
|
||||||
ribbonIconEl.addClass('my-plugin-ribbon-class');
|
|
||||||
|
|
||||||
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
|
|
||||||
const statusBarItemEl = this.addStatusBarItem();
|
|
||||||
statusBarItemEl.setText('Status Bar Text');
|
|
||||||
|
|
||||||
// This adds a simple command that can be triggered anywhere
|
|
||||||
this.addCommand({
|
|
||||||
id: 'open-sample-modal-simple',
|
|
||||||
name: 'Open sample modal (simple)',
|
|
||||||
callback: () => {
|
|
||||||
new SampleModal(this.app).open();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// This adds an editor command that can perform some operation on the current editor instance
|
|
||||||
this.addCommand({
|
|
||||||
id: 'sample-editor-command',
|
|
||||||
name: 'Sample editor command',
|
|
||||||
editorCallback: (editor: Editor, view: MarkdownView) => {
|
|
||||||
console.log(editor.getSelection());
|
|
||||||
editor.replaceSelection('Sample Editor Command');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// This adds a complex command that can check whether the current state of the app allows execution of the command
|
|
||||||
this.addCommand({
|
|
||||||
id: 'open-sample-modal-complex',
|
|
||||||
name: 'Open sample modal (complex)',
|
|
||||||
checkCallback: (checking: boolean) => {
|
|
||||||
// Conditions to check
|
|
||||||
const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
|
|
||||||
if (markdownView) {
|
|
||||||
// If checking is true, we're simply "checking" if the command can be run.
|
|
||||||
// If checking is false, then we want to actually perform the operation.
|
|
||||||
if (!checking) {
|
|
||||||
new SampleModal(this.app).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This command will only show up in Command Palette when the check function returns true
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// This adds a settings tab so the user can configure various aspects of the plugin
|
|
||||||
this.addSettingTab(new SampleSettingTab(this.app, this));
|
|
||||||
|
|
||||||
// If the plugin hooks up any global DOM events (on parts of the app that doesn't belong to this plugin)
|
|
||||||
// Using this function will automatically remove the event listener when this plugin is disabled.
|
|
||||||
this.registerDomEvent(document, 'click', (evt: MouseEvent) => {
|
|
||||||
console.log('click', evt);
|
|
||||||
});
|
|
||||||
|
|
||||||
// When registering intervals, this function will automatically clear the interval when the plugin is disabled.
|
|
||||||
this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
onunload() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadSettings() {
|
|
||||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
|
||||||
}
|
|
||||||
|
|
||||||
async saveSettings() {
|
|
||||||
await this.saveData(this.settings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SampleModal extends Modal {
|
|
||||||
constructor(app: App) {
|
|
||||||
super(app);
|
|
||||||
}
|
|
||||||
|
|
||||||
onOpen() {
|
|
||||||
const {contentEl} = this;
|
|
||||||
contentEl.setText('Woah!');
|
|
||||||
}
|
|
||||||
|
|
||||||
onClose() {
|
|
||||||
const {contentEl} = this;
|
|
||||||
contentEl.empty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SampleSettingTab extends PluginSettingTab {
|
|
||||||
plugin: MyPlugin;
|
|
||||||
|
|
||||||
constructor(app: App, plugin: MyPlugin) {
|
|
||||||
super(app, plugin);
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
display(): void {
|
|
||||||
const {containerEl} = this;
|
|
||||||
|
|
||||||
containerEl.empty();
|
|
||||||
|
|
||||||
containerEl.createEl('h2', {text: 'Settings for my awesome plugin.'});
|
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName('Setting #1')
|
|
||||||
.setDesc('It\'s a secret')
|
|
||||||
.addText(text => text
|
|
||||||
.setPlaceholder('Enter your secret')
|
|
||||||
.setValue(this.plugin.settings.mySetting)
|
|
||||||
.onChange(async (value) => {
|
|
||||||
console.log('Secret: ' + value);
|
|
||||||
this.plugin.settings.mySetting = value;
|
|
||||||
await this.plugin.saveSettings();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"id": "obsidian-sample-plugin",
|
"id": "obsidian-simple-time-tracker",
|
||||||
"name": "Sample Plugin",
|
"name": "Simple Time Tracker",
|
||||||
"version": "1.0.0",
|
"version": "0.0.1",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "This is a sample plugin for Obsidian. This plugin demonstrates some of the capabilities of the Obsidian API.",
|
"description": "Simple time tracker plugin for Obsidian.",
|
||||||
"author": "Obsidian",
|
"author": "Ellpeck",
|
||||||
"authorUrl": "https://obsidian.md",
|
"authorUrl": "https://ellpeck.de",
|
||||||
"isDesktopOnly": false
|
"isDesktopOnly": false
|
||||||
}
|
}
|
||||||
|
|
3041
package-lock.json
generated
Normal file
3041
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
20
package.json
20
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "obsidian-sample-plugin",
|
"name": "obsidian-simple-time-tracker",
|
||||||
"version": "1.0.0",
|
"version": "0.0.1",
|
||||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
"description": "Simple time tracker plugin for Obsidian.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node esbuild.config.mjs",
|
"dev": "node esbuild.config.mjs",
|
||||||
|
@ -9,16 +9,16 @@
|
||||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "Ellpeck",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
"builtin-modules": "^3.2.0",
|
||||||
"@typescript-eslint/parser": "5.29.0",
|
"electron": "^13.6.2",
|
||||||
"builtin-modules": "3.3.0",
|
"esbuild": "0.14.0",
|
||||||
"esbuild": "0.14.47",
|
"esbuild-plugin-copy": "^1.3.0",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.3.1",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.4.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Plugin, Platform, WorkspaceLeaf } 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";
|
||||||
|
|
||||||
|
|
24
src/settings-tab.ts
Normal file
24
src/settings-tab.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { App, PluginSettingTab } from "obsidian";
|
||||||
|
import SimpleTimeTrackerPlugin from "./main";
|
||||||
|
|
||||||
|
export class SimpleTimeTrackerSettingsTab extends PluginSettingTab {
|
||||||
|
|
||||||
|
plugin: SimpleTimeTrackerPlugin;
|
||||||
|
|
||||||
|
constructor(app: App, plugin: SimpleTimeTrackerPlugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
display(): void {
|
||||||
|
this.containerEl.empty();
|
||||||
|
this.containerEl.createEl("h2", { text: "Simple Time Tracker Settings" });
|
||||||
|
|
||||||
|
// TODO settings go here
|
||||||
|
|
||||||
|
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("a", { href: "https://ellpeck.de/support" })
|
||||||
|
.createEl("img", { attr: { src: "https://ellpeck.de/res/generalsupport.png" }, cls: "simple-time-tracker-support" });
|
||||||
|
}
|
||||||
|
}
|
7
src/settings.ts
Normal file
7
src/settings.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export const defaultSettings: SimpleTimeTrackerSettings = {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface SimpleTimeTrackerSettings {
|
||||||
|
|
||||||
|
}
|
13
styles.css
13
styles.css
|
@ -1,8 +1,5 @@
|
||||||
/*
|
.simple-time-tracker-support {
|
||||||
|
max-width: 50%;
|
||||||
This CSS file will be included with your plugin, and
|
width: 400px;
|
||||||
available in the app when your plugin is enabled.
|
height: auto;
|
||||||
|
}
|
||||||
If your plugin does not need CSS, delete this file.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
1
test-vault/.obsidian/app.json
vendored
Normal file
1
test-vault/.obsidian/app.json
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
3
test-vault/.obsidian/appearance.json
vendored
Normal file
3
test-vault/.obsidian/appearance.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"accentColor": ""
|
||||||
|
}
|
3
test-vault/.obsidian/community-plugins.json
vendored
Normal file
3
test-vault/.obsidian/community-plugins.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[
|
||||||
|
"obsidian-simple-time-tracker"
|
||||||
|
]
|
19
test-vault/.obsidian/core-plugins.json
vendored
Normal file
19
test-vault/.obsidian/core-plugins.json
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[
|
||||||
|
"file-explorer",
|
||||||
|
"global-search",
|
||||||
|
"switcher",
|
||||||
|
"graph",
|
||||||
|
"backlink",
|
||||||
|
"outgoing-link",
|
||||||
|
"tag-pane",
|
||||||
|
"page-preview",
|
||||||
|
"daily-notes",
|
||||||
|
"templates",
|
||||||
|
"note-composer",
|
||||||
|
"command-palette",
|
||||||
|
"editor-status",
|
||||||
|
"starred",
|
||||||
|
"outline",
|
||||||
|
"word-count",
|
||||||
|
"file-recovery"
|
||||||
|
]
|
11
test-vault/.obsidian/hotkeys.json
vendored
Normal file
11
test-vault/.obsidian/hotkeys.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"app:reload": [
|
||||||
|
{
|
||||||
|
"modifiers": [
|
||||||
|
"Mod",
|
||||||
|
"Shift"
|
||||||
|
],
|
||||||
|
"key": "R"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
97
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/main.js
vendored
Normal file
97
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/main.js
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
||||||
|
var __export = (target, all) => {
|
||||||
|
__markAsModule(target);
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __reExport = (target, module2, desc) => {
|
||||||
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
||||||
|
for (let key of __getOwnPropNames(module2))
|
||||||
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
||||||
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
};
|
||||||
|
var __toModule = (module2) => {
|
||||||
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
||||||
|
};
|
||||||
|
var __async = (__this, __arguments, generator) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
var fulfilled = (value) => {
|
||||||
|
try {
|
||||||
|
step(generator.next(value));
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var rejected = (value) => {
|
||||||
|
try {
|
||||||
|
step(generator.throw(value));
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||||||
|
step((generator = generator.apply(__this, __arguments)).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
__export(exports, {
|
||||||
|
default: () => SimpleTimeTrackerPlugin
|
||||||
|
});
|
||||||
|
var import_obsidian2 = __toModule(require("obsidian"));
|
||||||
|
|
||||||
|
// src/settings.ts
|
||||||
|
var defaultSettings = {};
|
||||||
|
|
||||||
|
// src/settings-tab.ts
|
||||||
|
var import_obsidian = __toModule(require("obsidian"));
|
||||||
|
var SimpleTimeTrackerSettingsTab = class extends import_obsidian.PluginSettingTab {
|
||||||
|
constructor(app, plugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
display() {
|
||||||
|
this.containerEl.empty();
|
||||||
|
this.containerEl.createEl("h2", { text: "Simple Time Tracker Settings" });
|
||||||
|
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("a", { href: "https://ellpeck.de/support" }).createEl("img", { attr: { src: "https://ellpeck.de/res/generalsupport.png" }, cls: "simple-time-tracker-support" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
var SimpleTimeTrackerPlugin = class extends import_obsidian2.Plugin {
|
||||||
|
onload() {
|
||||||
|
return __async(this, null, function* () {
|
||||||
|
yield this.loadSettings();
|
||||||
|
this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));
|
||||||
|
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e) => {
|
||||||
|
e.empty();
|
||||||
|
e.addClass("simple-time-tracker");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
loadSettings() {
|
||||||
|
return __async(this, null, function* () {
|
||||||
|
this.settings = Object.assign({}, defaultSettings, yield this.loadData());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
saveSettings() {
|
||||||
|
return __async(this, null, function* () {
|
||||||
|
yield this.saveData(this.settings);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3JjL21haW4udHMiLCAic3JjL3NldHRpbmdzLnRzIiwgInNyYy9zZXR0aW5ncy10YWIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IFBsdWdpbiwgUGxhdGZvcm0sIFdvcmtzcGFjZUxlYWYgfSBmcm9tIFwib2JzaWRpYW5cIjtcclxuaW1wb3J0IHsgZGVmYXVsdFNldHRpbmdzLCBTaW1wbGVUaW1lVHJhY2tlclNldHRpbmdzIH0gZnJvbSBcIi4vc2V0dGluZ3NcIjtcclxuaW1wb3J0IHsgU2ltcGxlVGltZVRyYWNrZXJTZXR0aW5nc1RhYiB9IGZyb20gXCIuL3NldHRpbmdzLXRhYlwiO1xyXG5cclxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgU2ltcGxlVGltZVRyYWNrZXJQbHVnaW4gZXh0ZW5kcyBQbHVnaW4ge1xyXG5cclxuXHRzZXR0aW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0FBTyxJQUFJLGlCQUFpQixNQUFNLEtBQUs7QUFBQTtBQUFBO0FBQUEsRUFHekQsZUFBZTtBQUFBO0FBQ3BCLFlBQU0sS0FBSyxTQUFTLEtBQUs7QUFBQTtBQUFBO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
10
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/manifest.json
vendored
Normal file
10
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/manifest.json
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"id": "obsidian-simple-time-tracker",
|
||||||
|
"name": "Simple Time Tracker",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "0.15.0",
|
||||||
|
"description": "Simple time tracker plugin for Obsidian.",
|
||||||
|
"author": "Ellpeck",
|
||||||
|
"authorUrl": "https://ellpeck.de",
|
||||||
|
"isDesktopOnly": false
|
||||||
|
}
|
5
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/styles.css
vendored
Normal file
5
test-vault/.obsidian/plugins/obsidian-simple-time-tracker/styles.css
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.simple-time-tracker-support {
|
||||||
|
max-width: 50%;
|
||||||
|
width: 400px;
|
||||||
|
height: auto;
|
||||||
|
}
|
5
test-vault/track-note-test.md
Normal file
5
test-vault/track-note-test.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
This is a time tracker:
|
||||||
|
|
||||||
|
```simple-time-tracker
|
||||||
|
|
||||||
|
```
|
|
@ -10,7 +10,6 @@
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"strictNullChecks": true,
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"DOM",
|
"DOM",
|
||||||
"ES5",
|
"ES5",
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { readFileSync, writeFileSync } from "fs";
|
|
||||||
|
|
||||||
const targetVersion = process.env.npm_package_version;
|
|
||||||
|
|
||||||
// read minAppVersion from manifest.json and bump version to target version
|
|
||||||
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
|
|
||||||
const { minAppVersion } = manifest;
|
|
||||||
manifest.version = targetVersion;
|
|
||||||
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
|
|
||||||
|
|
||||||
// update versions.json with target version and minAppVersion from manifest.json
|
|
||||||
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
|
|
||||||
versions[targetVersion] = minAppVersion;
|
|
||||||
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"1.0.0": "0.15.0"
|
"0.0.1": "0.15.0"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue