Changes for page Material Collection
Last modified by Judith Steinfeld on 2025/06/03 11:13
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -1,11 +2,10 @@ 1 -const tabName = "materials"; 2 2 const tagCols = [ 3 - ["T ype", "lecture", "exercise", "hands-on", "solution", "tutorial"],2 + // ["Tag1", "CERN", "CHEP", "GPU", "VISPA"], 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,10 +53,6 @@ 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 - 60 60 const u = new URL(row.link_value); 61 61 let icon; 62 62 if (u.hostname.includes("github")) icon = "github"; ... ... @@ -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