Changes for page Material Collection

Last modified by Judith Steinfeld on 2025/06/03 11:13

From version 56.1
edited by Judith Steinfeld
on 2024/11/06 09:43
Change comment: There is no comment for this version
To version 55.8
edited by admin
on 2024/10/23 14:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.JudithSteinfeld
1 +XWiki.admin
Content
... ... @@ -5,7 +5,7 @@
5 5  
6 6  With our material collection we want to provide an overview of existing materials and contacts by outlining where to find what.
7 7  
8 -The collection of existing materials thrives on being filled and is complemented by our own materials which include for example videos and slides from various workshops and schools organized by the ErUM-Data-Hub in collaboration with DIG-UM with which we reached over 800 participants so far.
8 +The collection of existing materials is complemented by our own materials which include for example videos and slides from various workshops and schools organized by the ErUM-Data-Hub in collaboration with DIG-UM with which we reached over 800 participants so far.
9 9  
10 10  
11 11  If you want to be subscribed or unsubscribed from this list please contact [[judith.steinfeld@erumdatahub.de>>mailto:judith.steinfeld@erumdatahub.de]]
XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,11 +2,10 @@
1 -const tabName = "materials";
2 2  const tagCols = [
3 - ["Type", "lecture", "exercise", "hands-on", "solution", "tutorial", "talk", "course", "video", "paper"],
2 + ["Type", "lecture", "exercise", "hands-on", "solution", "tutorial"],
4 4   ["Tags", true],
5 5  ]
6 6  
7 7  document.observe('xwiki:livetable:loading', () => {
8 - const mats = document.getElementById(tabName);
7 + const mats = document.getElementById("materials");
9 9  
10 10   // coulmn data sources
11 11   const conf = JSON.parse(mats.dataset.settings);
... ... @@ -27,7 +27,7 @@
27 27   );
28 28  
29 29   // handle clicks for tags
30 - document.getElementById(`${tabName}-display`).addEventListener("click", ev => {
29 + document.getElementById("materials-display").addEventListener("click", ev => {
31 31   if (ev.button) return; // only left click
32 32   if (ev.target.nodeName !== "SPAN") return;
33 33   if (!ev.target.classList.contains("ltTag")) return;
... ... @@ -43,7 +43,7 @@
43 43   })
44 44  });
45 45  
46 -document.observe(`xwiki:livetable:${tabName}:receivedEntries`, ({memo: {data}}) => {
45 +document.observe("xwiki:livetable:materials:receivedEntries", ({memo: {data}}) => {
47 47   for (const row of data.rows) {
48 48   const ol = new DOMParser().parseFromString(row.doc_location, "text/xml").documentElement;
49 49   const li = ol.children;
... ... @@ -53,24 +53,15 @@
53 53   li[i].textContent = li[i].textContent; // remove link
54 54  
55 55   const a = li[li.length - 1].children[0];
56 - const b = a.ownerDocument.createElement("b");
57 - a.replaceWith(b);
58 - b.appendChild(a);
59 - a.textContent = row.doc_title;
60 -
61 61   const u = new URL(row.link_value);
62 62   let icon;
63 63   if (u.hostname.includes("github")) icon = "github";
64 - if (u.hostname.includes("github.io")) icon = "book";
65 65   if (u.hostname.includes("gitlab")) icon = "gitlab";
66 66   if (u.hostname.includes("google")) icon = "google";
67 - if (u.hostname.includes("colab")) icon = "code";
68 - if (u.hostname.includes("youtube")) icon = "youtube-play";
69 69   if (u.pathname.endsWith(".pdf")) icon = "file-pdf-o";
70 - if (u.pathname.endsWith(".pptx")) icon = "file-powerpoint-o";
71 71   if (icon) {
72 72   const s = a.ownerDocument.createElement("span");
73 - s.appendChild(a.ownerDocument.createElement("wbr"));
63 + s.textContent = " ";
74 74   s.setAttribute("class", `fa fa-${icon}`);
75 75   s.setAttribute("style", "padding-right: .3em;");
76 76   a.insertBefore(s, a.firstChild);
... ... @@ -87,7 +87,7 @@
87 87   want[0] === true
88 88   ? Array.from(tags)
89 89   : want.filter(tag => tags.delete(tag))
90 - ).sort().map(tag => `<span class="ltTag" style="cursor:pointer;white-space:nowrap;">${tag}</span>`).join(", ")
80 + ).sort().map(tag => `<span class="ltTag" style="cursor:pointer;">${tag}</span>`).join(", ")
91 91   );
92 92   }
93 93  });