function updateLists () {
    const atb = settings.getSetting('atb')
    const setAtb = settings.getSetting('set_atb')
    const versionParam = getVersionParam()

    for (let listType in lists) {
        for (let name in lists[listType]) {
            const list = lists[listType][name]
            const constantsName = list.constantsName

            let url = constants[constantsName]
            if (!url) return

            let etag = settings.getSetting(constantsName + '-etag') || ''

            // only add url params to contentblocking.js duckduckgo urls
            if (url.match(/^https?:\/\/(.+)?duckduckgo.com\/contentblocking\.js/)) {
                if (atb) url += '&atb=' + atb
                if (setAtb) url += '&set_atb=' + setAtb
                if (versionParam) url += versionParam
            }

            console.log('Checking for list update: ', name)

            // if we don't have parsed list data skip the etag to make sure we
            // get a fresh copy of the list to process
            if (Object.keys(list.parsed).length === 0) etag = ''

            load.loadExtensionFile({url: url, source: 'external', etag: etag}, (listData, response) => {
                const newEtag = response.getResponseHeader('etag') || ''
                console.log('Updating list: ', name)

                // sync new etag to storage
                settings.updateSetting(constantsName + '-etag', newEtag)

                list.parser.parse(listData, list.parsed)

                list.isLoaded = true
            })
        }
    }

    let trackersWhitelistTemporaryEtag = settings.getSetting('trackersWhitelistTemporary-etag') || ''
    // reset etag to get a new list copy if we don't have brokenSiteList data
    if (!trackersWhitelistTemporary || !trackersWhitelistTemporaryEtag) trackersWhitelistTemporaryEtag = ''

    // load broken site list
    // source: https://github.com/duckduckgo/content-blocking-whitelist/blob/master/trackers-whitelist-temporary.txt
    load.loadExtensionFile({url: constants.trackersWhitelistTemporary, etag: trackersWhitelistTemporaryEtag, source: 'external'}, (listData, response) => {
        const newTrackersWhitelistTemporaryEtag = response.getResponseHeader('etag') || ''
        settings.updateSetting('trackersWhitelistTemporary-etag', newTrackersWhitelistTemporaryEtag)

        trackersWhitelistTemporary = listData.trim().split('\n')
    })
}
/*
 * Get the list data and use abp to parse.
 * The parsed list data will be added to
 * the easyLists object.
 */
Get the list data and use abp to parse.
The parsed list data will be added to
the easyLists object.
Get the list data and use abp to parse . The parsed list data will be added to the easyLists object .
function updateLists () {
    const atb = settings.getSetting('atb')
    const setAtb = settings.getSetting('set_atb')
    const versionParam = getVersionParam()
    for (let listType in lists) {
        for (let name in lists[listType]) {
            const list = lists[listType][name]
            const constantsName = list.constantsName
            let url = constants[constantsName]
            if (!url) return
            let etag = settings.getSetting(constantsName + '-etag') || ''
            if (url.match(/^https?:\/\/(.+)?duckduckgo.com\/contentblocking\.js/)) {
                if (atb) url += '&atb=' + atb
                if (setAtb) url += '&set_atb=' + setAtb
                if (versionParam) url += versionParam
            }
            console.log('Checking for list update: ', name)
            if (Object.keys(list.parsed).length === 0) etag = ''
            load.loadExtensionFile({url: url, source: 'external', etag: etag}, (listData, response) => {
                const newEtag = response.getResponseHeader('etag') || ''
                console.log('Updating list: ', name)
                settings.updateSetting(constantsName + '-etag', newEtag)
                list.parser.parse(listData, list.parsed)
                list.isLoaded = true
            })
        }
    }
    let trackersWhitelistTemporaryEtag = settings.getSetting('trackersWhitelistTemporary-etag') || ''
    if (!trackersWhitelistTemporary || !trackersWhitelistTemporaryEtag) trackersWhitelistTemporaryEtag = ''
    load.loadExtensionFile({url: constants.trackersWhitelistTemporary, etag: trackersWhitelistTemporaryEtag, source: 'external'}, (listData, response) => {
        const newTrackersWhitelistTemporaryEtag = response.getResponseHeader('etag') || ''
        settings.updateSetting('trackersWhitelistTemporary-etag', newTrackersWhitelistTemporaryEtag)
        trackersWhitelistTemporary = listData.trim().split('\n')
    })
}
function updateLists ( ) { const atb = settings . getSetting ( 'atb' ) const setAtb = settings . getSetting ( 'set_atb' ) const versionParam = getVersionParam ( ) for ( let listType in lists ) { for ( let name in lists [ listType ] ) { const list = lists [ listType ] [ name ] const constantsName = list . constantsName let url = constants [ constantsName ] if ( ! url ) return let etag = settings . getSetting ( constantsName + '-etag' ) || '' if ( url . match ( / ^https?:\/\/(.+)?duckduckgo.com\/contentblocking\.js / ) ) { if ( atb ) url += '&atb=' + atb if ( setAtb ) url += '&set_atb=' + setAtb if ( versionParam ) url += versionParam } console . log ( 'Checking for list update: ' , name ) if ( Object . keys ( list . parsed ) . length === 0 ) etag = '' load . loadExtensionFile ( { url : url , source : 'external' , etag : etag } , ( listData , response ) => { const newEtag = response . getResponseHeader ( 'etag' ) || '' console . log ( 'Updating list: ' , name ) settings . updateSetting ( constantsName + '-etag' , newEtag ) list . parser . parse ( listData , list . parsed ) list . isLoaded = true } ) } } let trackersWhitelistTemporaryEtag = settings . getSetting ( 'trackersWhitelistTemporary-etag' ) || '' if ( ! trackersWhitelistTemporary || ! trackersWhitelistTemporaryEtag ) trackersWhitelistTemporaryEtag = '' load . loadExtensionFile ( { url : constants . trackersWhitelistTemporary , etag : trackersWhitelistTemporaryEtag , source : 'external' } , ( listData , response ) => { const newTrackersWhitelistTemporaryEtag = response . getResponseHeader ( 'etag' ) || '' settings . updateSetting ( 'trackersWhitelistTemporary-etag' , newTrackersWhitelistTemporaryEtag ) trackersWhitelistTemporary = listData . trim ( ) . split ( '\n' ) } ) }
Get the list data and use abp to parse.
Get the list data and use abp to parse .
// only add url params to contentblocking.js duckduckgo urls // if we don't have parsed list data skip the etag to make sure we // get a fresh copy of the list to process // sync new etag to storage // reset etag to get a new list copy if we don't have brokenSiteList data // load broken site list // source: https://github.com/duckduckgo/content-blocking-whitelist/blob/master/trackers-whitelist-temporary.txt