blob: b8c2ae5e256612071e213a055900aea198b93404 [file] [log] [blame]
Davit Tabidze207ce082024-04-09 19:15:25 +04001document.addEventListener("DOMContentLoaded", function () {
2 function showTooltip(obj) {
3 // obj.style.display = 'flex';
4 obj.style.visibility = 'visible';
5 obj.style.opacity = '1';
6 }
7 function hideTooltip(obj) {
8 obj.style.visibility = 'hidden';
9 obj.style.opacity = '0';
10 // obj.style.display = '';
11 }
12 const circle = document.querySelector(".user-circle");
13 const tooltipUser = document.querySelector("#tooltip-user");
14 [
15 ['mouseenter', () => showTooltip(tooltipUser)],
16 ['mouseleave', () => hideTooltip(tooltipUser)],
17 ].forEach(([event, listener]) => {
18 circle.addEventListener(event, listener);
19 });
20 const icons = document.querySelectorAll(".app-icon-tooltip");
21 icons.forEach(function (icon) {
22 icon.addEventListener("click", function (event) {
23 event.stopPropagation();
24 const appUrl = this.getAttribute("data-app-url");
25 document.getElementById('appFrame').src = 'about:blank';
26 document.getElementById('appFrame').src = appUrl;
27 document.querySelectorAll(".app-icon-tooltip .background-glow").forEach((e) => e.remove());
28 const glow = document.createElement('div');
29 glow.classList.add("background-glow");
30 glow.setAttribute("style", "transform: none; transform-origin: 50% 50% 0px;")
31 this.appendChild(glow);
32 });
33 const tooltip = icon.querySelector('.tooltip');
34 tooltip.addEventListener("click", function (event) {
35 event.stopPropagation();
36 });
37 [
38 ['mouseenter', () => showTooltip(tooltip)],
39 ['mouseleave', () => hideTooltip(tooltip)],
40 ['focus', () => showTooltip(tooltip)],
41 ['blur', () => hideTooltip(tooltip)],
42 ].forEach(([event, listener]) => {
43 icon.addEventListener(event, listener);
44 });
45 });
46 const helpButtons = document.querySelectorAll('.help-button');
47 helpButtons.forEach(function (button) {
48 button.addEventListener('click', function (event) {
49 event.stopPropagation();
50 const buttonId = button.getAttribute('id');
51 const modalId = 'modal-' + buttonId.substring("help-button-".length);
52 const closeHelpId = "close-help-" + buttonId.substring("help-button-".length);
53 const modal = document.getElementById(modalId);
54 modal.removeAttribute("close");
55 modal.setAttribute("open", true);
56 const closeHelpButton = document.getElementById(closeHelpId);
57 closeHelpButton.addEventListener('click', function (event) {
58 event.stopPropagation();
59 modal.removeAttribute("open");
60 modal.setAttribute("close", true);
61 });
62 });
63 });
64 const modalHelpButtons = document.querySelectorAll('.title-menu');
65 modalHelpButtons.forEach(function (button) {
66 button.addEventListener('click', function (event) {
67 event.stopPropagation();
68 const helpTitle = button.getAttribute('id');
69 const helpTitleId = helpTitle.substring('title-'.length);
70 const helpContentId = 'help-content-' + helpTitleId;
71 const allContentElements = document.querySelectorAll('.help-content');
72 allContentElements.forEach(function (contentElement) {
73 contentElement.style.display = 'none';
74 });
75 document.getElementById(helpContentId).style.display = 'block';
76 });
77 });
78});