diff --git a/src/summary.js b/src/summary.js index be4377a..35db95d 100644 --- a/src/summary.js +++ b/src/summary.js @@ -5,10 +5,10 @@ const { escape } = require('html-escaper') module.exports = { make_table, summary, make_html, make_tg_table } function make_html ({ file_count, folder_count, total_size, details }) { - const head = ['类型', '数量', '大小'] + const head = ['類型', '數量', '大小'] const th = '' + head.map(k => `${k}`).join('') + '' const td = details.map(v => '' + [escape(v.ext), v.count, v.size].map(k => `${k}`).join('') + '').join('') - let tail = ['合计', file_count + folder_count, total_size] + let tail = ['合計', file_count + folder_count, total_size] tail = '' + tail.map(k => `${k}`).join('') + '' const table = ` ${th} @@ -26,7 +26,7 @@ function make_table ({ file_count, folder_count, total_size, details }) { return arr.map(content => ({ content, hAlign })) }) const total_count = file_count + folder_count - const tails = ['总计', total_count, total_size].map(v => ({ content: colors.bold(v), hAlign })) + const tails = ['總計', total_count, total_size].map(v => ({ content: colors.bold(v), hAlign })) tb.push(headers, ...records) tb.push(tails) return tb.toString() + '\n' @@ -56,8 +56,8 @@ function make_tg_table ({ file_count, folder_count, total_size, details }) { const hAlign = 'center' const headers = ['Type', 'Count', 'Size'].map(v => ({ content: v, hAlign })) details.forEach(v => { - if (v.ext === '文件夹') v.ext = '[Folder]' - if (v.ext === '无扩展名') v.ext = '[NoExt]' + if (v.ext === '資料夾') v.ext = '[Folder]' + if (v.ext === '無副檔名') v.ext = '[NoExt]' }) const records = details.map(v => [v.ext, v.count, v.size]).map(arr => arr.map(content => ({ content, hAlign }))) const total_count = file_count + folder_count @@ -107,8 +107,8 @@ function summary (info, sort_by) { } else { details.sort((a, b) => b.count - a.count) } - if (no_ext) details.push({ ext: '无扩展名', count: no_ext, size: format_size(no_ext_size), raw_size: no_ext_size }) - if (folder_count) details.push({ ext: '文件夹', count: folder_count, size: 0, raw_size: 0 }) + if (no_ext) details.push({ ext: '無副檔名', count: no_ext, size: format_size(no_ext_size), raw_size: no_ext_size }) + if (folder_count) details.push({ ext: '資料夾', count: folder_count, size: 0, raw_size: 0 }) return { file_count, folder_count, total_size, details } } @@ -123,4 +123,4 @@ function format_size (n) { flag++ } return n.toFixed(2) + ' ' + units[flag] -} +} \ No newline at end of file diff --git a/src/tg.js b/src/tg.js index 8e4041d..f882ba7 100644 --- a/src/tg.js +++ b/src/tg.js @@ -139,12 +139,11 @@ function send_choice ({ fid, chat_id }) { ], [ { text: '開始複製', callback_data: `copy ${fid}` } - ], - [ - { text: '強制更新', callback_data: `update ${fid}` }, - { text: '清除', callback_data: `clear_button` } ] - ].concat(gen_bookmark_choices(fid)) + ].concat(gen_bookmark_choices(fid)).concat([[ + { text: '強制更新', callback_data: `update ${fid}` }, + { text: '清除按鈕', callback_data: `clear_button` } + ]]) } }) }else{ @@ -156,12 +155,11 @@ function send_choice ({ fid, chat_id }) { [ { text: '文件統計', callback_data: `count ${fid}` }, { text: '開始複製', callback_data: `copy ${fid}` } - ], - [ - { text: '強制更新', callback_data: `update ${fid}` }, - { text: '清除', callback_data: `clear_button` } ] - ].concat(gen_bookmark_choices(fid)) + ].concat(gen_bookmark_choices(fid)).concat([[ + { text: '強制更新', callback_data: `update ${fid}` }, + { text: '清除按鈕', callback_data: `clear_button` } + ]]) } }) }