首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 互联网 >

修改了一上DownThemAll! 使之上载完成后自动写入descript.ion

2012-10-23 
修改了一下DownThemAll! 使之下载完成后自动写入descript.iondta/manager.js--- manager.js.orig2009-10-2

修改了一下DownThemAll! 使之下载完成后自动写入descript.ion

dta/manager.js

--- manager.js.orig2009-10-27 18:16:52.000000000 +0800+++ manager.js2009-11-19 15:47:08.000000000 +0800@@ -1408,6 +1408,13 @@ QueueItem.prototype = { } else { this.tmpFile.clone().moveTo(destination, this.destinationName);+        //{{{ write descript.ion+        try {+    writeDescription(this.destinationPath, this.destinationName, this.urlManager.usable);+} catch (x) {+}+         this.complete(); } }

dta/manager.xul

--- manager.xul.orig2009-10-27 18:16:52.000000000 +0800+++ manager.xul2009-11-17 18:24:28.000000000 +0800@@ -70,6 +70,7 @@ <popupset> <popup id="popup" onpopupshowing="Tree.refreshTools(); return true;"> <menuitem id="info" label="&infos.label;" oncommand="Tree.showInfo();" />+<menuitem id="writeInfo" label="write info to descript.ion" oncommand="Tree.writeInfo();" /> <menuseparator /> <menuitem id="launch" label="&launch.label;" oncommand="FileHandling.openFile();" /> <menuitem id="delete" label="&delete.label;" oncommand="FileHandling.deleteFile();" />?

?

dta/manager/tree.js

--- manager/tree.js.orig2009-10-27 18:16:52.000000000 +0800+++ manager/tree.js2009-11-19 15:45:24.000000000 +0800@@ -463,6 +463,17 @@ var Tree = { } this.endUpdate(); },+writeInfo: function () {+    this.beginUpdate();++    for (let d in Tree.selected) {+var dir=d.destinationPath;+var filename=d.destinationName;+var url = d.urlManager.usable;+        writeDescription(dir, filename, url);+    }+    this.endUpdate();+}, _hoverItem: null, _ww: Serv('@mozilla.org/embedcomp/window-watcher;1', 'nsIWindowWatcher'), hovering: function(event) {

common/internalFunctions.js

?

var writeDescription = function () {    var UNICODE =Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);     UNICODE.charset = 'UTF-8';    //check downloaded file existencevar downloadedFile = new FileFactory(dir);if (!downloadedFile.exists() )return;downloadedFile.append(filename);if (!downloadedFile.exists() )return;//open descript.ionvar descFile = new FileFactory(dir);descFile.append("descript.ion");if (!descFile.exists()) {descFile.create(descFile.NORMAL_FILE_TYPE, 0666);}//write infovar aContent = """ + filename + ""\t" + url + "\n";aContent  = UNICODE.ConvertFromUnicode(aContent);var ostream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);//init ( nsIFile file , PRInt32 ioFlags , PRInt32 perm , PRInt32 behaviorFlags )const PR_WRONLY = 2;const PR_APPEND = 16; ostream.init(descFile, 0x02|0x08|0x10, 0x200, false);//const NS_SEEK_END = 2;//ostream.seek(NS_SEEK_END, 0);ostream.write(aContent, aContent.length);aContent = UNICODE.Finish();if (aContent.length > 0) ostream.write(aContent, aContent.length);ostream.close();} //end of writeDescription_impl     return writeDescription_impl;}();

热点排行