Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 60 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x 2x 2x 2x 1x | export class UsedMethodsRenderer { constructor(usedMethodsData, language) { this.usedMethodsData = usedMethodsData; this.language = language; } render() { const container = document.createElement('div'); container.style.marginBottom = '20px'; container.innerHTML = `<h3>Used Methods</h3>`; let methods = this.usedMethodsData['dcc:usedMethod']; Iif (!methods) { container.textContent = 'No used methods data available.'; return container; } Iif (!Array.isArray(methods)) { methods = [methods]; } methods.forEach(method => { const details = document.createElement('details'); details.style.border = '1px solid #ccc'; details.style.padding = '8px'; details.style.marginBottom = '10px'; // Summary: show method name (language-specific), norm and reference const summary = document.createElement('summary'); let methodName = ''; Eif (method['dcc:name'] && method['dcc:name']['dcc:content']) { const content = method['dcc:name']['dcc:content']; methodName = Array.isArray(content) ? (content.find(item => item.$ && item.$.lang === this.language) || content[0])._ || '' : content._ || ''; } const norm = method['dcc:norm'] || ''; const reference = method['dcc:reference'] || ''; summary.innerHTML = `<strong>${methodName}</strong> (${norm})`; Eif (reference) { summary.innerHTML += ` - <a href="${reference}" target="_blank">${reference}</a>`; } details.appendChild(summary); // Expanded content: language-specific description const contentDiv = document.createElement('div'); contentDiv.style.marginTop = '8px'; contentDiv.style.fontFamily = 'sans-serif'; let description = ''; Eif (method['dcc:description'] && method['dcc:description']['dcc:content']) { const desc = method['dcc:description']['dcc:content']; description = Array.isArray(desc) ? (desc.find(c => c.$ && c.$.lang === this.language) || desc[0])._ || '' : desc._ || ''; } contentDiv.innerHTML = description; details.appendChild(contentDiv); container.appendChild(details); }); return container; } } |