You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/web_src/js/features
MisterCavespider c403e2f1cf
Fixed colour transparency regex matching in project board sorting (#22091) (#22092)
As described in the linked issue (#22091), semi-transparent UI elements
would result in JS errors due to the fact that the CSS `backgroundColor`
element was being matched by the pattern
`^rgb\((\d+),\s*(\d+),\s*(\d+)\)$`, which does not take the alpha
channel into account.

I changed the pattern to `^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$`.
This new pattern accepts both `rgb` and `rgba` tuples, and ignores the
alpha channel (that little `.*` at the end) from the sorting criteria.
The reason why I chose to ignore alpha is because when it comes to
kanban colour sorting, only the hue is important; the order of the
panels should stay the same, even if some of them are transparent.

Alternative solutions were discussed in the bug report and are included
here for completeness:
1. Change the regex from ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ to
^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d+(\.\d+)?))?\)$ (alpha channel is
a float or NaN on 5th group) and include the alpha channel in the
sorting criteria.
2. Rethink on why you're reading colours out of the CSS in the first
place, then reformat this sorting procedure.

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago
..
admin Add system setting table with cache and also add cache supports for user setting (#18058) 2 years ago
comp Add team member invite by email (#20307) 2 years ago
aria.js Remove customized (unmaintained) dropdown, improve aria a11y for dropdown (#19861) 2 years ago
aria.md Remove customized (unmaintained) dropdown, improve aria a11y for dropdown (#19861) 2 years ago
citation.js fix webpackChunkName for citation-js-csl (#21806) 2 years ago
clipboard.js Update JS dependencies (#21881) 2 years ago
codeeditor.js Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) 2 years ago
colorpicker.js Move jquery-minicolors to npm/webpack (#12305) 4 years ago
common-global.js Prevent NPE if trying to restore an already restored deleted branch (#21940) 2 years ago
common-issue.js Add a checkbox to select all issues/PRs (#20177) 2 years ago
common-organization.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
contextpopup.js Refactor from Vue2 to Vue3 (#20044) 2 years ago
copycontent.js Improvements for Content Copy (#21842) 2 years ago
dropzone.js Update JS dependencies (#17611) 3 years ago
emoji.js Frontend refactor, PascalCase to camelCase, remove unused code (#17365) 3 years ago
eventsource.sharedworker.js Fix the JS error "EventSource is not defined" caused by some non-standard browsers (#20584) 2 years ago
file-fold.js Allow to mark files in a PR as viewed (#19007) 2 years ago
formatting.js Localize all timestamps (#21440) 2 years ago
heatmap.js Localize time units on activity heatmap (#21570) 2 years ago
imagediff.js Fix viewed images not loading in a PR (#19919) 2 years ago
install.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
mcaptcha.js Add support mCaptcha as captcha provider (#20458) 2 years ago
notification.js Enable contenthash in filename for dynamic assets (#20813) 2 years ago
org-team.js Never use /api/v1 from Gitea UI Pages (#19318) 2 years ago
pull-view-file.js Replace unstyled meter with progress (#19968) 2 years ago
repo-branch.js Add apply-patch, basic revert and cherry-pick functionality (#17902) 2 years ago
repo-code.js Improvements for Content Copy (#21842) 2 years ago
repo-code.test.js Ignore line anchor links with leading zeroes (#21728) 2 years ago
repo-commit.js Improve commit status icons (#21124) 2 years ago
repo-common.js Rework repo buttons (#20602) 2 years ago
repo-diff-filetree.js Refactor from Vue2 to Vue3 (#20044) 2 years ago
repo-diff.js Add filetree on left of diff view (#21012) 2 years ago
repo-editor.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
repo-findfile.js Use weighted algorithm for string matching when finding files in repo (#21370) 2 years ago
repo-findfile.test.js Remove vitest globals (#21505) 2 years ago
repo-graph.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
repo-home.js A minimal change to replace data calls with attr as per guidelines (#19900) 2 years ago
repo-issue-content.js Multiple improvements for comment edit diff (#21990) 2 years ago
repo-issue-pr-form.js Refactor from Vue2 to Vue3 (#20044) 2 years ago
repo-issue.js Change ID pattern of raw content container for issue (#21966) 2 years ago
repo-legacy.js Change ID pattern of raw content container for issue (#21966) 2 years ago
repo-migrate.js Update JS dependencies (#21881) 2 years ago
repo-migration.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
repo-projects.js Fixed colour transparency regex matching in project board sorting (#22091) (#22092) 2 years ago
repo-release.js Enable spellcheck for EasyMDE, use contenteditable mode (#19776) 2 years ago
repo-settings.js Remove customized (unmaintained) dropdown, improve aria a11y for dropdown (#19861) 2 years ago
repo-template.js Never use /api/v1 from Gitea UI Pages (#19318) 2 years ago
repo-unicode-escape.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
repo-wiki.js Enable spellcheck for EasyMDE, use contenteditable mode (#19776) 2 years ago
serviceworker.js Remove useless `appVer` from JS `window.config` (#21445) 2 years ago
sshkey-helper.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
stopwatch.js Update JS dependencies and eslint config (#21388) 2 years ago
tablesort.js Added missing `data-` prefix. (#17884) 3 years ago
tribute.js Update JS dependencies (#21881) 2 years ago
user-auth-webauthn.js Prevent security failure due to bad APP_ID (#18678) 2 years ago
user-auth.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago
user-settings.js Use explicit jQuery import, remove unused eslint globals (#18435) 2 years ago