diff --git a/app/view/domain/record.html b/app/view/domain/record.html
index 72a1ddf..763de3e 100644
--- a/app/view/domain/record.html
+++ b/app/view/domain/record.html
@@ -290,12 +290,16 @@ $(document).ready(function(){
field: 'Value',
title: '记录值',
formatter: function(value, row, index) {
- var display = value;
- if(row.Type == 'MX') display = value + ' | ' + row.MX;
var copyId = 'copy-value-' + row.RecordId;
- // 只允许安全字符,避免引号问题
- var safeValue = (value+'').replace(/'/g, "'").replace(/\\/g, "\\\\");
- return ''+display+'';
+ if(row.Type == 'MX') {
+ // 只复制 mx.yandex.net,按钮在其右侧,优先级单独显示
+ return ''+value+''
+ + ''
+ + ' | '+row.MX+'';
+ } else {
+ return ''+value+''
+ + '';
+ }
}
},
{
@@ -728,23 +732,38 @@ function advanceSearch(){
}
}
function copyToClipboard(text, selector) {
- var tempInput = document.createElement('input');
- tempInput.style.position = 'absolute';
- tempInput.style.left = '-9999px';
- tempInput.value = text;
- document.body.appendChild(tempInput);
- tempInput.select();
- document.execCommand('copy');
- document.body.removeChild(tempInput);
- if(selector){
- var icon = document.querySelector(selector + ' + a i');
- if(icon){
- var oldClass = icon.className;
- icon.className = 'fa fa-check';
- setTimeout(function(){ icon.className = oldClass; }, 1000);
- }
- }
- layer.msg('已复制到剪贴板', {icon: 1, time: 600});
+ if (!text && selector) {
+ var el = document.querySelector(selector);
+ if (el) {
+ text = el.getAttribute('data-value');
+ }
+ }
+ var tempInput = document.createElement('input');
+ tempInput.style.position = 'absolute';
+ tempInput.style.left = '-9999px';
+ tempInput.value = text;
+ document.body.appendChild(tempInput);
+ tempInput.select();
+ document.execCommand('copy');
+ document.body.removeChild(tempInput);
+ if(selector){
+ var icon = document.querySelector(selector + ' + a i');
+ if(icon){
+ var oldClass = icon.className;
+ icon.className = 'fa fa-check';
+ setTimeout(function(){ icon.className = oldClass; }, 1000);
+ }
+ }
+ layer.msg('已复制到剪贴板', {icon: 1, time: 600});
+}
+// 工具函数:HTML转义,防止XSS
+function htmlEscape(str) {
+ return String(str)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
}
{/block}
\ No newline at end of file