diff options
| author | julian laplace <julescarbon@gmail.com> | 2022-10-26 16:01:28 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2022-10-26 16:01:28 +0200 |
| commit | 3de2a5872fd0481568e918a1ea798b3f75ace610 (patch) | |
| tree | 91d2e08c3f07bc0f866cfb22deecbc07afc78057 /public/assets/js | |
| parent | 8fe5a1cf652fd4bd0b737bd18605a8d4c4028407 (diff) | |
update keyword hover colors
Diffstat (limited to 'public/assets/js')
| -rw-r--r-- | public/assets/js/lib/views/stream/hootstream.js | 2 | ||||
| -rw-r--r-- | public/assets/js/util/format.js | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/public/assets/js/lib/views/stream/hootstream.js b/public/assets/js/lib/views/stream/hootstream.js index f4e48c4..016c987 100644 --- a/public/assets/js/lib/views/stream/hootstream.js +++ b/public/assets/js/lib/views/stream/hootstream.js @@ -109,7 +109,7 @@ var HootStream = View.extend({ file_count: `${files.length || 0} f.`, file_opacity: age_opacity * get_size_opacity(files.length), comment_count: `${comments.length || 0} c.`, - comment_opacity: age_opacity * get_size_opacity(files.length), + comment_opacity: age_opacity * get_size_opacity(comments.length), }), this.renderFiles(postedToday ? files : files.slice(0, 10)), ...this.renderHoots({ hoots: comments.slice(0, 1), tag: "first_post" }), diff --git a/public/assets/js/util/format.js b/public/assets/js/util/format.js index 7058cea..aac8311 100644 --- a/public/assets/js/util/format.js +++ b/public/assets/js/util/format.js @@ -282,9 +282,18 @@ const size_scale = [ function get_size_opacity(n) { return get_scale_opacity(n, size_scale); } +/** + * find a value on one axis of an array of points, and return the proportional point + * @param {Array} value a value, to be matched on the first column of scale + * @param {Array} scale an array of points: (value, target) + * @return {Number} a proportional point within the closest target values + */ function get_scale_opacity(value, scale) { for (let i = 1; i < scale.length; i++) { const [max_value, max_lerp] = scale[i]; + if (value === max_value) { + return max_lerp; + } if (value < max_value) { const [min_value, min_lerp] = scale[i - 1]; return lerp(norm(value, min_value, max_value), min_lerp, max_lerp); |
