aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-06 00:48:10 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-06 00:48:10 +0200
commit4c06ace245bffa98a2b994ce81f4d1a1ea7fa750 (patch)
tree183b1fa701bad12169bf67705ad3e2a6fea52d79
parentClean up caltable code. (diff)
downloadcalp-4c06ace245bffa98a2b994ce81f4d1a1ea7fa750.tar.gz
calp-4c06ace245bffa98a2b994ce81f4d1a1ea7fa750.tar.xz
Start moving popup's away from parents.
-rw-r--r--module/output/html.scm15
-rw-r--r--static/script.js19
2 files changed, 30 insertions, 4 deletions
diff --git a/module/output/html.scm b/module/output/html.scm
index 725cd39a..b70b5f56 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -213,7 +213,10 @@
,(when (and (prop ev 'PARTSTAT)
(eq? 'TENTATIVE (prop ev 'PARTSTAT)))
" tentative"))
- (onclick "toggle_child_popup(this)"))))
+ ; (onclick "toggle_child_popup(this)")
+ (onclick ,(format #f "toggle_popup(document.getElementById('~a'))"
+ (string-append "popup" (html-id ev))))
+ )))
;; Inner div to prevent overflow. Previously "overflow: none"
;; was set on the surounding div, but the popup /needs/ to
;; overflow.
@@ -226,7 +229,9 @@
`(span (@ (class "location"))
,(string-map (lambda (c) (if (char=? c #\,) #\newline c))
(prop ev 'LOCATION)))))
- ,(popup ev popup-id)))))
+ #;
+ ,(popup ev (string-append "popup" (html-id ev)) #; popup-id
+ )))))
;; Format single event for graphical display
(define (create-block date ev)
@@ -725,7 +730,11 @@
post-end: post-end
next-start: next-start
prev-start: prev-start
- ))
+ )
+ ,@(for event in (stream->list
+ (events-between pre-start post-end events))
+ (popup event (string-append "popup" (html-id event)) #; popup-id
+ )))
;; Page footer
(footer
diff --git a/static/script.js b/static/script.js
index d3526849..f7f46c99 100644
--- a/static/script.js
+++ b/static/script.js
@@ -569,10 +569,27 @@ function close_popup(popup) {
function open_popup(popup) {
popup.classList.add("visible");
+ let element = document.getElementById(popup.id.substr(5))
+ let root = document.body;
+ let offsetX = 0, offsetY = 0;
+ while (element !== root) {
+ console.log(element);
+ offsetX += element.offsetLeft;
+ offsetY += element.offsetTop;
+ element = element.offsetParent;
+ }
+ console.table({offsetX, offsetY})
+ popup.style.left = offsetX + "px";
+ popup.style.top = offsetY + "px";
}
function toggle_popup(popup) {
- popup.classList.toggle("visible");
+ // popup.classList.toggle("visible");
+ if (popup.classList.contains("visible")) {
+ close_popup(popup);
+ } else {
+ open_popup(popup);
+ }
}
function toggle_child_popup(el) {