V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hylau

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

  •  
  •   hylau · May 11, 2014 · 2506 views
    This topic created in 4372 days ago, the information mentioned may be changed or developed.
    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
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   972 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 19:50 · PVG 03:50 · LAX 12:50 · JFK 15:50
    ♥ Do have faith in what you're doing.