Cleanup of old code, moved Node class, many improvements on file handling
This commit is contained in:
parent
65f8cd14a7
commit
16992db6b1
19 changed files with 485 additions and 3281 deletions
|
|
@ -9,10 +9,8 @@
|
|||
{
|
||||
"imports": {
|
||||
"api": "/js/{{ .VERSION }}/api.mjs",
|
||||
"sync": "/js/{{ .VERSION }}/sync.mjs",
|
||||
"key": "/js/{{ .VERSION }}/key.mjs",
|
||||
"sync": "/js/{{ .VERSION }}/sync.mjs",
|
||||
"checklist": "/js/{{ .VERSION }}/checklist.mjs",
|
||||
"crypto": "/js/{{ .VERSION }}/crypto.mjs",
|
||||
"node_store": "/js/{{ .VERSION }}/node_store.mjs",
|
||||
"node": "/js/{{ .VERSION }}/page_node.mjs",
|
||||
"sidebar": "/js/{{ .VERSION }}/sidebar.mjs"
|
||||
|
|
@ -20,14 +18,14 @@
|
|||
}
|
||||
</script>
|
||||
<script>
|
||||
window._VERSION = "{{ .VERSION }}"
|
||||
globalThis._VERSION = "{{ .VERSION }}"
|
||||
|
||||
if (navigator.serviceWorker)
|
||||
navigator.serviceWorker.register('/service_worker.js')
|
||||
navigator.serviceWorker.register('/service_worker.js', { type: 'module' })
|
||||
</script>
|
||||
<script type="module" defer>
|
||||
import { MessageBus } from '/js/{{ .VERSION }}/mbus.mjs'
|
||||
window._mbus = new MessageBus()
|
||||
globalThis._mbus = new MessageBus()
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<img id="logo" src="/images/v1/logo.svg">
|
||||
<input type="text" id="username" placeholder="Username">
|
||||
<input type="password" id="password" placeholder="Password">
|
||||
<button onclick=window._login.authenticate()>Log in</button>
|
||||
<button onclick="globalThis._login.authenticate()">Log in</button>
|
||||
<div id="error"></div>
|
||||
</div>
|
||||
|
||||
|
|
@ -42,6 +42,6 @@ class Login {
|
|||
}
|
||||
}
|
||||
|
||||
window._login = new Login()
|
||||
globalThis._login = new Login()
|
||||
</script>
|
||||
{{ end }}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- page-node -->
|
||||
<div id="notes2" class="page-node">
|
||||
<div id="tree-expander" onclick="window._mbus.dispatch('TREE_EXPANSION', { expand: true })">></div>
|
||||
<div id="tree-expander" onclick="globalThis._mbus.dispatch('TREE_EXPANSION', { expand: true })">></div>
|
||||
<div id="tree" tabindex=0></div>
|
||||
|
||||
<div id="main-page">
|
||||
|
|
@ -47,20 +47,21 @@
|
|||
import {App} from "/js/{{ .VERSION }}/app.mjs"
|
||||
import {API} from 'api'
|
||||
import {Sync} from 'sync'
|
||||
import { } from '/js/{{ .VERSION }}/page_node.mjs'
|
||||
import { } from '/js/{{ .VERSION }}/page_preferences.mjs'
|
||||
import { } from '/js/{{ .VERSION }}/page_storage.mjs'
|
||||
import { } from '/js/{{ .VERSION }}/page_history.mjs'
|
||||
import { } from '/js/{{ .VERSION }}/file.mjs'
|
||||
|
||||
window.Sync = Sync
|
||||
globalThis.Sync = Sync
|
||||
|
||||
if (!API.hasAuthenticationToken()) {
|
||||
location.href = '/login'
|
||||
} else {
|
||||
try {
|
||||
window.nodeStore = new NodeStore()
|
||||
window.nodeStore.initializeDB().then(() => {
|
||||
window._app = new App()
|
||||
globalThis.nodeStore = new NodeStore()
|
||||
globalThis.nodeStore.initializeDB().then(() => {
|
||||
globalThis._app = new App()
|
||||
})
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
<script type="module">
|
||||
import { NodeStore } from 'node_store'
|
||||
import { Sync } from 'sync'
|
||||
window.Sync = Sync
|
||||
window.nodeStore = new NodeStore()
|
||||
window.nodeStore.initializeDB().then(()=>{
|
||||
globalThis.Sync = Sync
|
||||
globalThis.nodeStore = new NodeStore()
|
||||
globalThis.nodeStore.initializeDB().then(()=>{
|
||||
Sync.tree()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue