Difference between revisions of "Widget:DCTList"
From LINKS Community Center
Line 177: | Line 177: | ||
// TEST TEST TEST TEST TEST TEST TEST | // TEST TEST TEST TEST TEST TEST TEST | ||
const CKEY = 'children' | const CKEY = 'children' | ||
+ | const DKEY = 'desc' | ||
const fq = '[[Category:Function_category]]' + | const fq = '[[Category:Function_category]]' + | ||
− | '|?-Subproperty_of=' + CKEY; | + | '|?-Subproperty_of=' + CKEY + |
+ | '|?Has_description=' + DKEY; | ||
const qUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(fq); | const qUrl = '/api.php?action=ask&format=json&query=' + encodeURIComponent(fq); | ||
Line 184: | Line 186: | ||
const data = fRes.query.results; | const data = fRes.query.results; | ||
+ | console.log(data) | ||
const xxx = new Map(); | const xxx = new Map(); | ||
+ | |||
+ | const removePrefix = str => str.substring(str.indexOf(':') + 1); | ||
Object.keys(data).forEach(key => { | Object.keys(data).forEach(key => { | ||
− | + | xxx.set( | |
− | + | removePrefix(data[key].fulltext), | |
+ | data[key].printouts[CKEY].map(func => removePrefix(func.fulltext)) | ||
+ | ) | ||
}) | }) | ||
console.log('Func result', xxx); | console.log('Func result', xxx); |
Revision as of 13:47, 30 August 2022
Development verstion of the DCT List.
Not ready for production!