mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 添加移除遮罩子菜单
This commit is contained in:
@@ -9,7 +9,8 @@ use url::Url;
|
||||
fn create_utils_menu() -> Menu {
|
||||
let retry_bridge = CustomMenuItem::new("retry".to_string(), "重试桥接");
|
||||
let mock_touch = CustomMenuItem::new("mock_touch".to_string(), "模拟触摸");
|
||||
return Menu::new().add_item(retry_bridge).add_item(mock_touch);
|
||||
let remove_overlay = CustomMenuItem::new("remove_overlay".to_string(), "移除遮罩");
|
||||
return Menu::new().add_item(retry_bridge).add_item(mock_touch).add_item(remove_overlay);
|
||||
}
|
||||
|
||||
// 创建米游社客户端菜单
|
||||
@@ -133,6 +134,16 @@ pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) {
|
||||
})()"#;
|
||||
window.eval(&execute_js).ok().unwrap();
|
||||
}
|
||||
"remove_overlay" => {
|
||||
let window = handle.get_window("mhy_client").unwrap();
|
||||
let execute_js = r#"javascript:(async function(){
|
||||
const arg = {
|
||||
method: 'teyvat_remove',
|
||||
}
|
||||
await window.__TAURI__.event.emit('post_mhy_client',JSON.stringify(arg));
|
||||
})()"#;
|
||||
window.eval(&execute_js).ok().unwrap();
|
||||
}
|
||||
_ => {}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -279,6 +279,9 @@ class TGClient {
|
||||
case "teyvat_open":
|
||||
createPost(<string>arg.payload);
|
||||
break;
|
||||
case "teyvat_remove":
|
||||
await this.hideOverlay();
|
||||
break;
|
||||
case "teyvat_retry": {
|
||||
const executeJS = `javascript:(function(){
|
||||
window.location.reload();
|
||||
|
||||
Reference in New Issue
Block a user