逗妇乳
小狐狸
小狐狸
  • UID50148
  • 注册日期2015-06-01
  • 最后登录2022-11-21
  • 发帖数83
  • 经验89枚
  • 威望0点
  • 贡献值32点
  • 好评度6点
阅读:363回复:0

【求助】addMenuPlus.uc.js 新增全页面截图菜单无法在 GitHub 截图

楼主#
更多 发布于:2022-08-17 20:38
配置如下,这个怎么解决?
而且FF内置的截图工具也无法在 github 使用

page([
    {
        label: "全页面截图",
        image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABISURBVDhPY6AOWPnmPwpGBuhy6PJggE8Buhy6PBjglEADA2/AMAAUhwHtDUDGyACbPAjDAV5JIMAmD8IkA7I1wgDFBmAABgYA9oelARp3ZZ4AAAAASUVORK5CYII=",
        oncommand: function () {
            function receiveMessage(message) {
                switch (message.name) {
                    case 'addMenu_full_scrrenshot':
                        if (message.data.image == "data:,") {
                            addMenu.alert("截图失败");
                        } else {
                            saveURL(message.data.image, null, addMenu.convertText("%TITLES%") + ".png", null, false,
                                true,
                                null,
                                null,
                                null,
                                PrivateBrowsingUtils.isWindowPrivate(window),
                                Services.scriptSecurityManager.createNullPrincipal({}));
                            window.messageManager.removeMessageListener("addMenu_full_scrrenshot", receiveMessage);
                        }
                        break;
                }
            }
            window.messageManager.addMessageListener("addMenu_full_scrrenshot", receiveMessage);
            let frameScript = function () {
                var document = content.document;
                var canvas = document.createElement("canvas");
                canvas.width = document.documentElement.scrollWidth;
                canvas.height = document.documentElement.scrollHeight;
                var ctx = canvas.getContext("2d");
                ctx.drawWindow(content, 0, 0, canvas.width, canvas.height, "rgb(255,255,255)");
                var data = { image: canvas.toDataURL("image/png") };
                sendSyncMessage("addMenu_full_scrrenshot", data);
            }
            let frameScriptURI = 'data:application/javascript,'
                + encodeURIComponent('(' + frameScript.toString() + ')()');
            gBrowser.selectedTab.linkedBrowser.messageManager.loadFrameScript(frameScriptURI, true);
        }
    }
])
游客

返回顶部