如图,表格的附件,
有多个附件时需要区分。
能否添加鼠标悬停时显示文件名?
已记录,后续将增加。
1 Like
可以临时用油猴脚本代替
// ==UserScript==
// @name NOCOBASE 提示文件名
// @namespace http://tampermonkey.net/
// @version 2024-10-30
// @description try to take over the world!
// @author You
// @match
// @icon https://www.google.com/s2/favicons?sz=64&domain=undefined.localhost
// @grant none
// @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// ==/UserScript==
(function() {
‘use strict’;
// Your code here…
// 创建一个新的按钮元素
var button = document.createElement(‘button’);
// 设置按钮的文本内容
button.textContent = '图片添加提示';
// 设置按钮的样式
var style = button.style;
style.position = 'fixed'; // 固定定位
style.bottom = '10px'; // 距离页面底部10px
style.right = '10px'; // 距离页面左侧10px
style.zIndex = 99999; // 确保按钮位于其他元素之上(可选)
style.padding = '10px 20px'; // 按钮的内边距
style.backgroundColor = '#007BFF'; // 按钮的背景颜色
style.color = '#FFFFFF'; // 按钮的文本颜色
style.border = 'none'; // 去除按钮的边框
style.borderRadius = '5px'; // 按钮的圆角
style.cursor = 'pointer'; // 鼠标悬停时显示为手型
// 为按钮添加点击事件监听器
button.addEventListener('click', function() {
// 获取页面上所有的img元素
var images = document.querySelectorAll('td img');
// 遍历所有的img元素
for (var i = 0; i < images.length; i++) {
// 获取当前img元素的alt属性值
var altText = images[i].getAttribute('alt');
// 为当前img元素设置title属性,值设为alt属性的值
images[i].setAttribute('title', altText);
}
});
// 将按钮添加到页面的body元素中
document.body.appendChild(button);
})();
1 Like