0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-06-02 18:49:23 +02:00
gitea/web_src/js/features/comp/ColorPicker.js
silverwind fa100618c4
Forbid jQuery .css and refactor all usage (#29852)
Tested all functionality. There is a [pre-existing
bug](https://github.com/go-gitea/gitea/issues/29853) when moving a
project panels which is not caused by this refactoring.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-19 16:28:46 +00:00

17 lines
548 B
JavaScript

import $ from 'jquery';
import {createColorPicker} from '../colorpicker.js';
export function initCompColorPicker() {
(async () => {
await createColorPicker(document.querySelectorAll('.color-picker'));
for (const el of document.querySelectorAll('.precolors .color')) {
el.addEventListener('click', (e) => {
const color = e.target.getAttribute('data-color-hex');
const parent = e.target.closest('.color.picker');
$(parent.querySelector('.color-picker')).minicolors('value', color);
});
}
})();
}