diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-08-31 11:56:12 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-08-31 11:57:09 -0400 |
commit | 85472d9407861f688e55b06b1767882f71229fc2 (patch) | |
tree | f31a137ca7277741109ce36cee5f6b544da71876 /ext | |
parent | 68af0d86c3a941e185b34926fdbc57c457466e28 (diff) |
Add option for position of popup for horizontal text
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/options.js | 1 | ||||
-rw-r--r-- | ext/bg/js/settings.js | 2 | ||||
-rw-r--r-- | ext/bg/settings.html | 8 | ||||
-rw-r--r-- | ext/fg/js/popup.js | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index c4a7e681..c76525b9 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -201,6 +201,7 @@ function optionsSetDefaults(options) { popupVerticalOffset: 10, popupHorizontalOffset2: 10, popupVerticalOffset2: 0, + popupHorizontalTextPosition: 'below', popupVerticalTextPosition: 'before', showGuide: true, compactTags: false, diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 83a1c2f6..c4eb4842 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -32,6 +32,7 @@ async function formRead() { optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked'); optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10); optionsNew.general.popupDisplayMode = $('#popup-display-mode').val(); + optionsNew.general.popupHorizontalTextPosition = $('#popup-horizontal-text-position').val(); optionsNew.general.popupVerticalTextPosition = $('#popup-vertical-text-position').val(); optionsNew.general.popupWidth = parseInt($('#popup-width').val(), 10); optionsNew.general.popupHeight = parseInt($('#popup-height').val(), 10); @@ -171,6 +172,7 @@ async function onReady() { $('#show-advanced-options').prop('checked', options.general.showAdvanced); $('#max-displayed-results').val(options.general.maxResults); $('#popup-display-mode').val(options.general.popupDisplayMode); + $('#popup-horizontal-text-position').val(options.general.popupHorizontalTextPosition); $('#popup-vertical-text-position').val(options.general.popupVerticalTextPosition); $('#popup-width').val(options.general.popupWidth); $('#popup-height').val(options.general.popupHeight); diff --git a/ext/bg/settings.html b/ext/bg/settings.html index c6090c91..4f244602 100644 --- a/ext/bg/settings.html +++ b/ext/bg/settings.html @@ -108,6 +108,14 @@ </div> <div class="form-group"> + <label for="popup-display-mode">Popup position for horizontal text</label> + <select class="form-control" id="popup-horizontal-text-position"> + <option value="below">Below text</option> + <option value="above">Above text</option> + </select> + </div> + + <div class="form-group"> <label for="popup-display-mode">Popup position for vertical text</label> <select class="form-control" id="popup-vertical-text-position"> <option value="default">Same as for horizontal text</option> diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 138dec41..86ce575d 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -91,13 +91,15 @@ class Popup { } } + const preferBelow = (optionsGeneral.popupHorizontalTextPosition === 'below'); + const verticalOffset = optionsGeneral.popupVerticalOffset; const [y, h, below] = Popup.limitGeometry( elementRect.top - verticalOffset, elementRect.bottom + verticalOffset, height, maxHeight, - true + preferBelow ); return [x, y, width, h, below]; |