?

Log in

No account? Create an account
[光]
届かぬ手、届かぬ心
[转]Firefox技巧:在Easy dragtogo中添加把选中的网页文字直接存成TXT的选项 
29th-Mar-2010 11:04 am
这个功能实在是太爽了……不能不推。

原文地址:http://my219.cn/archives/41614.html

先安装Easy dragtogo 扩展

在about:config中新建一个字符串

名称:extensions.easydragtogo.custom.SaveTextAs

值为下面的内容:

if(target == "text" && url){var fp = Components.classes ["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker); fp.init (window, null, fp.modeSave); fp.defaultExtension = "txt"; fp.defaultString = url.substr(0, 20).replace(/[\\\/\*\|\?\n:"<>]/g, "-") + ".txt"; fp.appendFilters(fp.filterText); fp.appendFilters(fp.filterAll); if(fp.show() != fp.returnCancel){var conv = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].createInstance (Components.interfaces.nsIScriptableUnicodeConverter); conv.charset = 'GBK'; var text = conv.ConvertFromUnicode(url).replace(/\n/g, "\r\n"); var stream = Components.classes ["@mozilla.org/network/file-output-stream;1"].createInstance (Components.interfaces.nsIFileOutputStream); stream.init(fp.file, 0x02|0x20|0x08, 0666, 0); stream.write(text, text.length); var fin = conv.Finish(); if(fin.length > 0) stream.write (fin, fin.length); stream.close();}}

这样子打开easy dragtogo选项卡,在各种鼠标手势中就会多出现一个选项:custom.SaveTextAs

baozi
This page was loaded Nov 20th 2019, 7:00 am GMT.