点击元素和移动到元素的默认名称更改为点击/移动到的元素的文本值

This commit is contained in:
naibo 2023-09-05 21:20:13 +08:00
parent 5921d84140
commit fd9d2b5b24
5 changed files with 32 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -454,6 +454,31 @@ function toolBoxKernel(e, para = null) {
let l = nodeList.length;
let nt = null;
let nt2 = null;
if (option == 2 || option == 7) { //点击元素或移动到元素操作的名称更改
let l = 6;
if(option == 2){
title = LANG("点击", "Click ");
} else {
title = LANG("移动到", "Move to ");
l = 5;
}
content = para["content"];
let str = content.trim();
if (str == "") {
title += LANG("元素", "Element");
} else {
if(window.location.href.indexOf("_CN") != -1){ //中文
if (str.length > l) {
str = str.substring(0, l) + "...";
}
} else { //英文
if (str.length > l + 7) {
str = str.substring(0, l + 7) + "...";
}
}
title += str;
}
}
let t = {
id: 0,
index: l,
@ -704,7 +729,7 @@ document.oncontextmenu = function() {
contextMenu.style.position = "absolute";
contextMenu.style.left = event.clientX + "px";
contextMenu.style.top = event.clientY + "px";
contextMenu.style.width = LANG("180px", "220px");
contextMenu.style.width = LANG("180px", "250px");
// 添加删除元素的功能
contextMenu.addEventListener("dblclick", function() {

View File

@ -1 +1 @@
{"language":"zh"}
{"language":"en"}

View File

@ -69,6 +69,7 @@ export function sendSingleClick() {
"tabIndex": -1,
"useLoop": false, //是否使用循环内元素
"iframe": global.iframe,
"content": global.nodeList[0]["node"].innerText,
"xpath": readXPath(global.nodeList[0]["node"], 0),
"allXPaths": getElementXPaths(global.nodeList[0]["node"]),
};
@ -107,6 +108,7 @@ export function sendMouseMove(){
"tabIndex": -1,
"useLoop": false, //是否使用循环内元素
"iframe": global.iframe,
"content": global.nodeList[0]["node"].innerText,
"xpath": readXPath(global.nodeList[0]["node"], 0),
"allXPaths": getElementXPaths(global.nodeList[0]["node"]),
};
@ -125,6 +127,7 @@ export function sendLoopMouseMove(){
"tabIndex": -1,
"xpath": "", //默认值设置为空
"allXPaths": "",
"content": "",
"useLoop": true, //是否使用循环内元素
"iframe": global.iframe,
"loopType": 1, //循环类型1为不固定元素列表
@ -231,6 +234,7 @@ export function sendLoopClickSingle(name) {
"tabIndex": -1,
"useLoop": true, //是否使用循环内元素
"iframe": global.iframe,
"content": global.nodeList[0]["node"].innerText,
"xpath": readXPath(global.nodeList[0]["node"], 0),
"allXPaths": getElementXPaths(global.nodeList[0]["node"]),
"loopType": 0, //循环类型0为单个元素
@ -256,6 +260,7 @@ export function sendLoopClickEvery() {
"tabIndex": -1,
"xpath": "", //默认值设置为空
"allXPaths": "",
"content": "",
"useLoop": true, //是否使用循环内元素
"iframe": global.iframe,
"loopType": 1, //循环类型1为不固定元素列表