diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-11-10 01:40:22 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-11-10 01:40:22 +0100 |
commit | 410404cfdd54c083b6609fd52334e02d320145d7 (patch) | |
tree | ac934bde696f099590496d23bdd636f691f4c637 /static/popup.ts | |
parent | Basic event modification works again. (diff) | |
download | calp-410404cfdd54c083b6609fd52334e02d320145d7.tar.gz calp-410404cfdd54c083b6609fd52334e02d320145d7.tar.xz |
Re-modularize javascript.
This moves almost everything out of globals.ts, into sepparate files.
Things are still slightly to tightly coupled. But that is worked on.
Diffstat (limited to 'static/popup.ts')
-rw-r--r-- | static/popup.ts | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/static/popup.ts b/static/popup.ts index 00638089..ce643854 100644 --- a/static/popup.ts +++ b/static/popup.ts @@ -1,7 +1,11 @@ -import { find_block, find_popup, PopupElement } from './globals' +import { VIEW, find_block } from './globals' +import { PopupElement } from './components/popup-element' +import { uid } from './types' + export { event_from_popup, popup_from_event, close_popup, - close_all_popups, /* VIEW, */open_popup, toggle_popup, activePopup + close_all_popups, open_popup, toggle_popup, activePopup, + find_popup } /* TODO rewrite most of this */ @@ -39,7 +43,16 @@ function close_all_popups() { } } -declare let VIEW: 'month' | 'week' + +function find_popup(uid: uid): HTMLElement | null { + // for (let el of vcal_objects[uid].registered) { + // if (el.tagName === 'popup-element') { + // return el; + // } + // } + // throw 'Popup not fonud'; + return document.querySelector(`popup-element[data-uid="${uid}"]`) +} /* open given popup */ function open_popup(popup: HTMLElement) { |