V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hylau
V2EX  ›  分享发现

有感觉前几天 livid 的提问,分享个 firefox/FireGestures 插件的截屏脚本

  •  
  •   hylau · 2014-05-11 01:22:59 +08:00 · 2197 次点击
    这是一个创建于 3640 天前的主题,其中的信息可能已经有所发展或是发生改变。
    var path = "F:\\Desktop";
    var canvas = content.document.createElement("canvas");
    canvas.width = content.document.body.clientWidth;
    canvas.height = content.document.body.clientHeight;
    var ctx = canvas.getContext("2d");
    ctx.drawWindow(content, 0, 0, canvas.width, canvas.height, "rgb(255,255,255)");
    var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath(path + "\\" + new Date().getTime() + ".png");
    Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Components.interfaces.nsIWebBrowserPersist).saveURI(Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(canvas.toDataURL(), null, null), null, null, null, null, file, null);
    -----
    F:\\Desktop是所存位置,我设定的是按住鼠标向下,向右向下的手势


    原帖: http://tieba.baidu.com/p/1994076176?pid=26391826918&cid=26392798567#26392798567
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3429 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:00 · PVG 19:00 · LAX 04:00 · JFK 07:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.