Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (57 loc) · 2.39 KB
/
Copy pathscript.js
File metadata and controls
59 lines (57 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
jQuery(window)
.once("map")
.on("load", function () {
const view = jQuery(".ev-table");
if (view.length > 0) {
const cells = jQuery(".x-axis > .views-row > .views-field > .field-content");
const overlay = jQuery('<div id="popup-overlay" class="hidden"></div>');
const popup = jQuery('<div id="popup"></div>');
overlay.append(popup);
const closeBtn = jQuery('<div class="close material-symbols-outlined">Close</div>');
jQuery("body").append(overlay);
const closePopup = (e) => {
if (
e.target == overlay[0] ||
e.target == closeBtn[0] ||
e.target.className == "close material-symbols-outlined"
) {
overlay.addClass("hidden");
jQuery(".views-row", popup).detach();
}
};
overlay.click(closePopup);
closeBtn.click(closePopup);
const titles = [];
cells?.each(function (_, cell) {
const rows = jQuery(".views-row", cell);
if(!rows) return;
const newCellContentArr = [];
rows?.each(function (_, row) {
const resources = jQuery(".link ol li", row);
const size = 10 * Math.log(resources.length) + 20;
const cellContent = jQuery(row).clone(true, true);
const colorCode = row.querySelector("#cell-data", cellContent).dataset.color;
const briefName = row.querySelector("#cell-data", cellContent).dataset.brief;
const categoryName = row.querySelector("#cell-data", cellContent).dataset.category;
const cellColorJS = colorCode != "" ? colorCode : "#005cb9";
const newCellContent = jQuery(
`<button class="title-group" aria-label="${briefName} brief, ${categoryName} category, ${
resources.length
} ${resources.length == 1 ? "resource" : "resources"}" data-size="${
resources.length
}" style="width:${size}px;height:${size}px;background-color:${cellColorJS};display:flex;"></button>`
);
newCellContent.click(() => {
popup.append(closeBtn);
popup.append(cellContent);
overlay.removeClass("hidden");
popup.scrollTop(0);
});
newCellContentArr.push(newCellContent);
});
jQuery(this).once().html('');
newCellContentArr.forEach(content => jQuery(this).append(content));
});
view.addClass("ready");
}
});