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 73: Line 73:


     let table;
     let table;
   
 
     const FN_SEARCH = 'Search & Monitor';
     const FN_SEARCH = 'Search & Monitor';
     const FN_POST = 'Post & Schedule';
     const FN_POST = 'Post & Schedule';


    /** @param {string} title */
     const getUrl = title =>  title ? '/index.php/Special:FilePath/' + title : title;
     function getUrl(title) {
        return title ? '/index.php/Special:FilePath/' + title : title;
    }


     /** @param {string} text */
     const escapeAttr = text => text ? text.replace(/\s/g, '-') : text;
    function escapeAttr(text) {
        return text ? text.replace(/\s/g, '-') : text;
    }


     const hasFunction = (dctResult, subfunctions) => subfunctions.some(func => {
     const hasFunction = (dctResult, subfunctions) => subfunctions.some(
        const printoutValue = dctResult.printouts[func][0];
        func => dctResult.printouts[func][0] && dctResult.printouts[func][0].fulltext.toLowerCase() === 'yes'
        return printoutValue && printoutValue.fulltext.toLowerCase() === 'yes';
     );
     });


     async function getSources() {
     async function getSources() {
Line 136: Line 129:
         const results = dctResponse.query.results;
         const results = dctResponse.query.results;
         const dctList = Object.getOwnPropertyNames(results).map(dctKey => {
         const dctList = Object.getOwnPropertyNames(results).map(dctKey => {
            const dctResult = results[dctKey];
             /** @type {DCT} */
             /** @type {DCT} */
             const dct = {};
             const dct = {};
            const dctResult = results[dctKey];
             dct.name = dctKey;
             dct.name = dctKey;
             dct.url = dctResult.fullurl;
             dct.url = dctResult.fullurl;

Revision as of 15:52, 9 June 2022

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