nextcloud显示上传速度

nextcloud显示上传信息改一个js文件就可以了,改完记得刷新。

1. 进入js文件的目录

cd /var/www/html/nextcloud/apps/files/js/

2. 备份原文件

sudo cp file-upload.js file-upload.js-original

3. 编辑js文件

sudo vi file-upload.js

4. 输入:1153跳转到1153行(nextcloud 15),在1153行你会看到类似以下代码:

var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
if (!(smoothRemainingSeconds >= 0 && smoothRemainingSeconds < 14400)) {
    // show "Uploading ..." for durations longer than 4 hours
    h = t('files', 'Uploading ...');
}

5. 在上面代码的下一行添加:

a). 倒计时+速度

// add xfr speed to time remaining
h = h + t('files', ' @ {bitrate}' , {
          bitrate: humanFileSize(data.bitrate / 8) + '/s'
      });
// ========================================

b). 只有速度

// xfr speed replaces time remaining
h = t('files', '{bitrate}' , {
          loadedSize: humanFileSize(data.loaded),
          totalSize: humanFileSize(data.total),
          bitrate: humanFileSize(data.bitrate / 8) + '/s'
      });
// ========================================

c). 已载入/总大小

// uploaded of total size replaces time remaining
h = t('files', '{loadedSize} of {totalSize}' , {
          loadedSize: humanFileSize(data.loaded),
          totalSize: humanFileSize(data.total)
      });
// ========================================

d). 已载入/总大小+速度

// uploaded of total size and xfr speed replaces time remaining
h = t('files', '{loadedSize} of {totalSize} ({bitrate})' , {
          loadedSize: humanFileSize(data.loaded),
          totalSize: humanFileSize(data.total),
          bitrate: humanFileSize(data.bitrate / 8) + '/s'
      });
// ========================================

想恢复原状,直接删除注释部分代码即可。enjoy it :)

已有 5 条评论

  1. [...]文章转载自:原文地址[...]

  2. david david

    这个必须要顶,谢谢大神奉献脚本

  3. petal petal

    在15.0.7不起作用

    1. 我测试了,可以的,今天升级了16.0.0依然正常,注意2点,文件编码和浏览器缓存。

  4. petal petal

    确实是缓存的事, 全清了就出来了

添加新评论