blob: 56af82c3f66af5abae2cfff128d56e2d94c98205 [file] [log] [blame]
Adrià Vilanova Martínez5af86512023-12-02 20:44:16 +01001/* (license-header)
2 * hores
3 * Copyright (c) 2023 Adrià Vilanova Martínez
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public
16 * License along with this program.
17 * If not, see http://www.gnu.org/licenses/.
18 */
Copybara botbe50d492023-11-30 00:16:42 +010019window.addEventListener("load", function() {
20
21 document.querySelectorAll(".custom-actions-btn").forEach(el => {
22 el.addEventListener("click", e => {
23 var forId = el.getAttribute("id");
24 var menu = document.querySelector("[for=\""+forId+"\"]").parentElement;
25 var overflow = menu.parentElement;
26
27 menu.style.left = el.offsetLeft - menu.offsetWidth + el.offsetWidth - overflow.scrollLeft + 'px';
28 menu.style.top = el.offsetTop + el.offsetHeight - overflow.scrollTop + 'px';
29 });
30 });
31});