Changes for page Material Collection

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

From version 55.15
edited by Benjamin Fischer
on 2024/10/28 13:32
Change comment: There is no comment for this version
To version 55.25
edited by Benjamin Fischer
on 2024/10/28 14:24
Change comment: There is no comment for this version

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -1,6 +1,6 @@
1 1  const tabName = "materials";
2 2  const tagCols = [
3 - ["Type", "lecture", "exercise", "hands-on", "solution", "tutorial", "talk", "course", "video"],
3 + ["Type", "lecture", "exercise", "hands-on", "solution", "tutorial", "talk", "course", "video", "paper"],
4 4   ["Tags", true],
5 5  ]
6 6  
... ... @@ -56,16 +56,21 @@
56 56   const b = a.ownerDocument.createElement("b");
57 57   a.replaceWith(b);
58 58   b.appendChild(a);
59 + a.textContent = row.doc_title;
59 59  
60 60   const u = new URL(row.link_value);
61 61   let icon;
62 62   if (u.hostname.includes("github")) icon = "github";
64 + if (u.hostname.includes("github.io")) icon = "book";
63 63   if (u.hostname.includes("gitlab")) icon = "gitlab";
64 64   if (u.hostname.includes("google")) icon = "google";
67 + if (u.hostname.includes("colab")) icon = "code";
68 + if (u.hostname.includes("youtube")) icon = "youtube-play";
65 65   if (u.pathname.endsWith(".pdf")) icon = "file-pdf-o";
70 + if (u.pathname.endsWith(".pptx")) icon = "file-powerpoint-o";
66 66   if (icon) {
67 67   const s = a.ownerDocument.createElement("span");
68 - s.textContent = " ";
73 + s.appendChild(a.ownerDocument.createElement("wbr"));
69 69   s.setAttribute("class", `fa fa-${icon}`);
70 70   s.setAttribute("style", "padding-right: .3em;");
71 71   a.insertBefore(s, a.firstChild);
... ... @@ -72,8 +72,6 @@
72 72   }
73 73   a.setAttribute("class", "wikiexternallink");
74 74   a.setAttribute("href", u.href);
75 -
76 - a.parentNode
77 77  
78 78   row.doc_location = ol.outerHTML;
79 79