| 1 | { // this wrapper avoids name clashing of outer variables and functions |
| 2 | const config = HFS.getPluginConfig() |
| 3 | |
| 4 | const label = HFS.t(["download counter", "Download counter"]) |
| 5 | const inMenu = config.where === 'menu' |
| 6 | HFS.onEvent('additionalEntryDetails', ({ entry: { hits } }) => |
| 7 | hits && !inMenu && HFS.h('span', { className: "download-counter", title: label }, hits)) |
| 8 | |
| 9 | HFS.onEvent('fileMenu', ({ entry, props }) => { |
| 10 | if (!entry.isFolder) |
| 11 | props.push({ id: 'download-counter', label, value: entry.hits || 0 }) |
| 12 | }) |
| 13 | } |