Backdoor
火狐狸
火狐狸
  • UID25518
  • 注册日期2008-07-20
  • 最后登录2017-12-20
  • 发帖数186
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
阅读:1170回复:0

【求助】网页截图的firegestrues脚本,在6.0a1失效!

楼主#
更多 发布于:2011-04-25 09:19
以下为脚本,请好心高手帮助修改,谢谢了!

var win = window.content;
    var w = win.document.width;
    var h = win.document.height;

    var pos = document.getElementById('status-bar');
    var scrollbox = document.createElement('scrollbox');
    scrollbox.width = '1';
    scrollbox.height = '1';
    pos.appendChild(scrollbox);

    var canvas = win.document.createElement('canvas');
    canvas.style.display = 'inline';
    canvas.width = w;
    canvas.height = h;
    scrollbox.appendChild(canvas);

    var ctx = canvas.getContext("2d");
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.save();
    ctx.scale(1.0, 1.0);
    ctx.drawWindow(win, 0, 0, w, h, "rgb(255,255,255)");
    ctx.restore();

    var url = canvas.toDataURL("image/png");
    const IO_SERVICE = Components.classes['@mozilla.org/network/io-service;1']
       .getService(Components.interfaces.nsIIOService);
    url = IO_SERVICE.newURI(url, null, null);

    var fp = Components.classes['@mozilla.org/filepicker;1']
       .createInstance(Components.interfaces.nsIFilePicker);
    fp.init(window, "Save Screenshot As", fp.modeSave);
    fp.appendFilters(fp.filterImages);
    fp.defaultExtension = "png";
    fp.defaultString = win.document.title + ".png";
    if ( fp.show() == fp.returnCancel || !fp.file ) return;

    var wbp = Components.classes['@mozilla.org/embedding/browser/nsWebBrowserPersist;1']
       .createInstance(Components.interfaces.nsIWebBrowserPersist);
    wbp.saveURI(url, null, null, null, null, fp.file);

    pos.removeChild(scrollbox);
游客

返回顶部