|
2 | 2 | // ==UserScript== |
3 | 3 | // @name 115小助手 |
4 | 4 | // @namespace https://github.com/maomao1996/tampermonkey-scripts |
5 | | -// @version 1.8.3 |
| 5 | +// @version 1.8.4 |
6 | 6 | // @description 网盘顶部菜单栏添加链接任务和云下载、SHA1 快速查重(新页面打开)、SHA1 自动查重、删除空文件夹、一键搜(快捷搜索)、SHA1 查重列表支持选中第一个元素和悬浮菜单展示、搜索列表支持悬浮菜单展示、列表显示文件 SHA1 信息、关闭网盘侧边栏、悬浮菜单移除图标、悬浮菜单支持新标签页打开文件夹、加速转码 |
7 | 7 | // @icon https://115.com/favicon.ico |
8 | 8 | // @author maomao1996 |
|
318 | 318 | return new Promise((resolve) => setTimeout(resolve, timeout)) |
319 | 319 | } |
320 | 320 |
|
| 321 | + /** |
| 322 | + * 工具方法 - 生成随机 rgba 颜色 |
| 323 | + * 生成类似 rgba(199, 237, 204, 0.7) 的随机颜色 |
| 324 | + * 保持绿色为主色调,其他颜色适当随机 |
| 325 | + */ |
| 326 | + const getRandomRgba = (): string => { |
| 327 | + // 保持绿色为主色调 |
| 328 | + const g = random(220, 255) |
| 329 | + // 红色和蓝色适当随机 |
| 330 | + const r = random(120, 240) |
| 331 | + const b = random(120, 240) |
| 332 | + |
| 333 | + return `rgba(${r}, ${g}, ${b}, 0.39)` |
| 334 | + } |
| 335 | + |
321 | 336 | /** |
322 | 337 | * 工具方法 - 获取样式 |
323 | 338 | */ |
|
356 | 371 | * 小助手相关样式 |
357 | 372 | */ |
358 | 373 | /*css*/ `.mm-quick-operation{margin-left: 12px;padding: 0 4px;white-space: nowrap;}`, |
359 | | - /*css*/ `.list-contents .active::before, .list-thumb .active{background: rgba(199, 237, 204, 0.7)!important;}`, |
| 374 | + /*css*/ `.list-contents .active::before, .list-thumb .active{background: var(--repeat-color, rgba(199, 237, 204, 0.7))!important;}`, |
360 | 375 | // 链接任务 |
361 | 376 | /*css*/ `.left-tvf .btn-upload{z-index: 1;}`, |
362 | 377 | // 列表显示文件SHA1信息 |
|
764 | 779 | $li.each(function () { |
765 | 780 | const sha1 = $(this).attr('sha1') |
766 | 781 | if (!SHA1_MAP[sha1]) { |
767 | | - SHA1_MAP[sha1] = 1 |
| 782 | + SHA1_MAP[sha1] = getRandomRgba() |
768 | 783 | } else { |
769 | 784 | repeatCount++ |
770 | | - $(this).addClass('active') |
| 785 | + $(this).addClass('active')[0].style.setProperty('--repeat-color', SHA1_MAP[sha1]) |
771 | 786 | if (isSelected) { |
772 | 787 | $(this).find('.checkbox').trigger('click') |
773 | 788 | } |
|
0 commit comments