Skip to content

Commit

Permalink
调整真实url获取位置
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyuesaves committed Jun 12, 2024
1 parent 3f8e90a commit eda7b40
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/render_modules/qContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function addEventqContextMenu() {
/**
* 图片路径 - 搜索用
*/
let searchImagePath = "";
let searchImageData = null;
/**
* 图片,表情包路径
*/
Expand Down Expand Up @@ -194,10 +194,10 @@ function addEventqContextMenu() {
}
});

document.addEventListener(eventName, async (event) => {
document.addEventListener(eventName, (event) => {
if (event.button === 2) {
imagePath = "";
searchImagePath = "";
searchImageData = null;
msgSticker = null;
isRightClick = true;
const messageEl = getParentElement(event.target, "message");
Expand Down Expand Up @@ -239,10 +239,10 @@ function addEventqContextMenu() {
for (let i = 0; i < event.target.parentElement.__VUE__.length; i++) {
const el = event.target.parentElement.__VUE__[i];
if (el?.ctx?.picData) {
searchImagePath = encodeURIComponent(await getPicUrl(el.ctx.picData, msgRecord.chatType));
searchImageData = { picData: el.ctx.picData, chatType: msgRecord.chatType }; //getPicUrl();
}
}
log(decodeURIComponent(searchImagePath));
log(searchImageData);
}
// 发送表情包检测
if (elements.some((ele) => ele.marketFaceElement)) {
Expand All @@ -251,7 +251,7 @@ function addEventqContextMenu() {
}
} else {
imagePath = "";
searchImagePath = "";
searchImageData = null;
msgSticker = null;
}
});
Expand Down Expand Up @@ -292,10 +292,11 @@ function addEventqContextMenu() {
});
}
// 搜索图片
if (searchImagePath && options.imageSearch.enabled) {
const _searchImagePath = searchImagePath;
addQContextMenu(qContextMenu, searchIcon, "搜索图片", () => {
const openUrl = options.imageSearch.searchUrl.replace("%search%", _searchImagePath);
if (searchImageData && options.imageSearch.enabled) {
const _searchImageData = searchImageData;
addQContextMenu(qContextMenu, searchIcon, "搜索图片", async () => {
const searchImageUrl = encodeURIComponent(await getPicUrl(_searchImageData.picData, _searchImageData.chatType));
const openUrl = options.imageSearch.searchUrl.replace("%search%", searchImageUrl);
lite_tools.openWeb(openUrl);
});
}
Expand Down

0 comments on commit eda7b40

Please sign in to comment.