Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
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 => {
             let obj = data[key]
             xxx.set(
            xxx.set(obj.fulltext.split(':')[1], obj.printouts[CKEY].map(func => func.fulltext.split(':')[1]))
                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 12:47, 30 August 2022

Development verstion of the DCT List.
Not ready for production!