"Move to bin" 代码如下所示-6ren">
gpt4 book ai didi

javascript - 用于删除 Google 表格的书签

转载 作者:行者123 更新时间:2023-11-29 23:16:30 26 4
gpt4 key购买 nike

我正在寻找一个小书签,它将删除当前的 Google 表格(而不是 "Move to bin" 菜单选项)。我可以从 JavaScript 中看到 "File">"Move to bin" 代码如下所示:

Ih = Ak(uk("docs-trash").label("Move to bin").Ea(765), "trash").dc("bin | delete | remove ||").build();

我认为解决方案可能是: javascript: document.getElementById("docs-trash").click();

我这样做是不是走错了路?

最佳答案

希望这样的内容对您有所帮助:

javascript:(function() {
var eltMove = document.querySelector('#\\:b2>div>span');
fireMouseEvent(document.querySelector('#docs-file-menu'), 'mousedown');
fireMouseEvent(eltMove, 'mousedown');
fireMouseEvent(eltMove, 'mouseup');
fireMouseEvent(eltMove, 'mouseup');

function fireMouseEvent(eltTarget, myEvent) {
var screenX, screenY, clientX, clientY;
var event = document.createEvent('MouseEvents');
event.initMouseEvent(myEvent, true, true, window, 1, screenX, screenY, clientX, clientY, false, false, false, false, 0, null);
eltTarget.dispatchEvent(event);
}
})();

关于javascript - 用于删除 Google 表格的书签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52595862/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com