Widget: DataExporter: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 25: | Line 25: | ||
for (const field of doc.querySelectorAll('Field')) { | for (const field of doc.querySelectorAll('Field')) { | ||
const prop = field.querySelector('semanticmediawiki_Property')?.getAttribute('name') || field.getAttribute('name'); | const prop = field.querySelector('semanticmediawiki_Property')?.getAttribute('name') | ||
|| field.getAttribute('name'); | |||
const label = field.querySelector('Label')?.textContent; | const label = field.querySelector('Label')?.textContent; | ||
output.innerHTML += prop + ' | ' + label + '<br>'; | output.innerHTML += prop + ' | ' + label + '<br>'; | ||
Line 31: | Line 32: | ||
} | } | ||
</script> | </script> | ||
<style> | |||
#form { | |||
display: flex; | |||
flex-flow: row wrap; | |||
justify-content: space-between; | |||
align-items: flex-start; | |||
} | |||
</style> | |||
</head> | </head> | ||
<body> | <body> | ||
<button type="button" onclick="exportData()">Export Data</button> | <button type="button" onclick="exportData()">Export Data</button> | ||
<form> | |||
<div id="form"> | |||
<fieldset> | |||
<legend>Library</legend> | |||
<input type="radio" id="TL" name="library" value="TL" checked> | |||
<label for="TL">Technologies</label><br> | |||
<input type="radio" id="UCL" name="library" value="UCL"> | |||
<label for="UCL">Use Cases</label><br> | |||
<input type="radio" id="GL" name="library" value="GL"> | |||
<label for="GL">Guidelines</label> | |||
</fieldset> | |||
<fieldset> | |||
<legend>Format</legend> | |||
<input type="radio" id="TL" name="format" value="TL" checked> | |||
<label for="TL">Excel (.xslx)</label><br> | |||
<input type="radio" id="UCL" name="format" value="UCL"> | |||
<label for="UCL">OpenOffice (.ods)</label><br> | |||
<input type="radio" id="GL" name="format" value="GL"> | |||
<label for="GL">CSV (.csv)</label> | |||
</fieldset> | |||
</div> | |||
</form> | |||
<div id="output"></div> | <div id="output"></div> | ||
</body> | </body> |