From ba972d8547089d8f2c8e19749ee0a0ab93d36233 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 14 Feb 2019 21:42:59 -0500 Subject: Add popup display mode Allows the popup to be stretched to the full width of the screen, anchored to the top or bottom of the window. --- ext/fg/js/popup.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ext/fg/js') diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index a17b184a..14276efe 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -62,6 +62,7 @@ class Popup { } } + let above = false; let y = 0; let height = Math.max(containerHeight, options.general.popupHeight); const yBelow = elementRect.bottom + options.general.popupOffset; @@ -75,11 +76,14 @@ class Popup { } else { height = Math.max(height - overflowAbove, 0); y = Math.max(yAbove - height, 0); + above = true; } } else { y = yBelow; } + this.container.classList.toggle('yomichan-float-full-width', options.general.popupDisplayMode === 'full-width'); + this.container.classList.toggle('yomichan-float-above', above); this.container.style.left = `${x}px`; this.container.style.top = `${y}px`; this.container.style.width = `${width}px`; -- cgit v1.2.3