diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-10 01:49:11 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-10 01:49:11 +0100 |
commit | 1ef01481fa9e70ef688b24ffd7957b97f020bb2e (patch) | |
tree | f5762e0914bae4696b89529f6d802d49baf6c40d /static/components | |
parent | Major cleanup in calp html. (diff) | |
download | calp-1ef01481fa9e70ef688b24ffd7957b97f020bb2e.tar.gz calp-1ef01481fa9e70ef688b24ffd7957b97f020bb2e.tar.xz |
Major move from week to calendar meta-view. Also repairs month view.
Diffstat (limited to 'static/components')
-rw-r--r-- | static/components/vevent-block.ts | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/static/components/vevent-block.ts b/static/components/vevent-block.ts index 6b3e7dec..95c72592 100644 --- a/static/components/vevent-block.ts +++ b/static/components/vevent-block.ts @@ -48,34 +48,36 @@ class ComponentBlock extends ComponentVEvent { /* -------------------------------------------------- */ - let p; - if ((p = data.getProperty('dtstart'))) { - let c = this.closest('.event-container') as HTMLElement - let start = parseDate(c.dataset.start!).getTime() - let end = parseDate(c.dataset.end!).getTime(); - // console.log(p); - let pp = to_local(p).getTime() - let result = 100 * (Math.min(end, Math.max(start, pp)) - start) / (end - start) + "%" - if (c.classList.contains('longevents')) { - this.style.left = result - } else { - this.style.top = result + if (window.VIEW === 'week') { + let p; + if ((p = data.getProperty('dtstart'))) { + let c = this.closest('.event-container') as HTMLElement + let start = parseDate(c.dataset.start!).getTime() + let end = parseDate(c.dataset.end!).getTime(); + // console.log(p); + let pp = to_local(p).getTime() + let result = 100 * (Math.min(end, Math.max(start, pp)) - start) / (end - start) + "%" + if (c.classList.contains('longevents')) { + this.style.left = result + } else { + this.style.top = result + } + // console.log('dtstart', p); } - // console.log('dtstart', p); - } - if ((p = data.getProperty('dtend'))) { - // console.log('dtend', p); - let c = this.closest('.event-container') as HTMLElement - let start = parseDate(c.dataset.start!).getTime() - let end = parseDate(c.dataset.end!).getTime(); - let pp = to_local(p).getTime() - let result = 100 - (100 * (Math.min(end, Math.max(start, pp)) - start) / (end - start)) + "%" - if (c.classList.contains('longevents')) { - this.style.width = 'unset'; - this.style.right = result; - } else { - this.style.height = 'unset'; - this.style.bottom = result; + if ((p = data.getProperty('dtend'))) { + // console.log('dtend', p); + let c = this.closest('.event-container') as HTMLElement + let start = parseDate(c.dataset.start!).getTime() + let end = parseDate(c.dataset.end!).getTime(); + let pp = to_local(p).getTime() + let result = 100 - (100 * (Math.min(end, Math.max(start, pp)) - start) / (end - start)) + "%" + if (c.classList.contains('longevents')) { + this.style.width = 'unset'; + this.style.right = result; + } else { + this.style.height = 'unset'; + this.style.bottom = result; + } } } @@ -84,7 +86,10 @@ class ComponentBlock extends ComponentVEvent { } if (data.getProperty('rrule') !== undefined) { - (this.getElementsByClassName('repeating')![0] as HTMLElement).innerText = '↺' + let rep = this.getElementsByClassName('repeating') + if (rep && rep.length !== 0) { + (rep[0] as HTMLElement).innerText = '↺' + } } } } |