Add plugin_anilist_limit_characters and plugin_languages_threshold options (#89)
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
return null
|
||||
|
||||
//Load inputs
|
||||
let {ignored, skipped, colors, details} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
let {ignored, skipped, colors, details, threshold} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
threshold = (Number(threshold.replace(/%$/, ""))||0)/100
|
||||
|
||||
//Custom colors
|
||||
const colorsets = JSON.parse(`${await imports.fs.readFile(`${imports.__module(import.meta.url)}/colorsets.json`)}`)
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
//Compute languages stats
|
||||
console.debug(`metrics/compute/${login}/plugins > languages > computing stats`)
|
||||
languages.favorites = Object.entries(languages.stats).sort(([an, a], [bn, b]) => b - a).slice(0, 8).map(([name, value]) => ({name, value, size:value, color:languages.colors[name], x:0}))
|
||||
languages.favorites = Object.entries(languages.stats).sort(([an, a], [bn, b]) => b - a).slice(0, 8).map(([name, value]) => ({name, value, size:value, color:languages.colors[name], x:0})).filter(({value}) => value/languages.total > threshold)
|
||||
const visible = {total:Object.values(languages.favorites).map(({size}) => size).reduce((a, b) => a + b, 0)}
|
||||
for (let i = 0; i < languages.favorites.length; i++) {
|
||||
languages.favorites[i].value /= visible.total
|
||||
|
||||
Reference in New Issue
Block a user