diff --git a/chrome/content/browserx.xul b/chrome/content/browserx.xul index 9e18a1f..3303b10 100644 --- a/chrome/content/browserx.xul +++ b/chrome/content/browserx.xul @@ -2,7 +2,8 @@ - + @@ -11,8 +12,10 @@ - + + @@ -27,17 +30,16 @@ - - - - - - - - - - - + + + + + + + diff --git a/chrome/content/fireio.js b/chrome/content/fireio.js new file mode 100644 index 0000000..624a2f8 --- /dev/null +++ b/chrome/content/fireio.js @@ -0,0 +1,59 @@ + +var io = { +openPath : function(){ + alert("test2"); + + const nsIFilePicker = Components.interfaces.nsIFilePicker; + + var fp = Components.classes["@mozilla.org/filepicker;1"] + .createInstance(nsIFilePicker); + fp.init(window, "Dialog Title", nsIFilePicker.modeOpen); + fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText); + + var rv = fp.show(); + if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { + var file = fp.file; + // Get the path as string. Note that you usually won't + // need to work with the string paths. + var path = fp.file.path; + // work with returned nsILocalFile... + + } + return path; + }, +appendPath: function (path, contents) +{ + alert("appended File"); +var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); +file1.initWithPath(path); +//alert("append file nullcheck: "+file1.toString()); +var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); +// use 0x02 | 0x10 to open file for appending. +foStream.init(file1, 0x02 | 0x10, 438, 0); +var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"]. + createInstance(Components.interfaces.nsIConverterOutputStream); +converter.init(foStream, "UTF-8", 0, 0); +converter.writeString(contents); +converter.close(); +}, + +newPath: function() { + const nsIFilePicker = Components.interfaces.nsIFilePicker; + +var fp = Components.classes["@mozilla.org/filepicker;1"] + .createInstance(nsIFilePicker); +fp.init(window, "Dialog Title", nsIFilePicker.modeSave); +fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText); + +var rv = fp.show(); +if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { + var file = fp.file; + // Get the path as string. Note that you usually won't + // need to work with the string paths. + var path = fp.file.path; + // work with returned nsILocalFile... + +} +return path; +}, +} diff --git a/chrome/content/firerecord.js b/chrome/content/firerecord.js index bd9c658..567647c 100644 --- a/chrome/content/firerecord.js +++ b/chrome/content/firerecord.js @@ -19,6 +19,8 @@ var firerecord = function () { appcontent.addEventListener("DOMContentLoaded", firerecord.run, true); } }, + + //Rylan running: function (){ if(recordingx){ recordingx = false; @@ -35,7 +37,17 @@ var firerecord = function () { } }, - file: function(){ + openfile: function(){ + + path = io.openPath(); + + }, + newfile: function(){ + path = io.newPath(); + createFile(); + }, + //rylan + /*file: function(){ const nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] @@ -52,7 +64,9 @@ var firerecord = function () { // work with returned nsILocalFile... } - }, + },*/ + + //rylan checkpage: function(readloc){ page = window.content.location.href; if (page != readloc){ @@ -61,6 +75,7 @@ var firerecord = function () { } }, + //rylan readr: function(){ var a= "http://rt.com/news/"; var b= "A"; @@ -73,6 +88,7 @@ var firerecord = function () { //setTimeout(function(){firerecord.fireExp();},8000); }, + //rylan nullCheck: function(elem){ if(!elem.href){ elem.href = "null"; @@ -121,7 +137,11 @@ var firerecord = function () { } return elem; - },/* + }, + + /* + + //rylan fireExp: function(){ var all = content.document.getElementsByTagName("A"); for (var i = 0; i < all.length; ++i) { @@ -133,6 +153,8 @@ var firerecord = function () { } } },*/ + + //rylan fire: function(b,c,d,e,f){ @@ -233,6 +255,8 @@ var firerecord = function () { } }, + + run : function () { var head = content.document.getElementsByTagName("head")[0], @@ -272,7 +296,7 @@ var firerecord = function () { case "INPUT": elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleType, false); + elm.addEventListener("keyup", handleType, false); break; case "A": @@ -316,8 +340,7 @@ var firerecord = function () { elm.addEventListener("click", handleEvent, false); break; case "TABLE": - info[1] = all[i].getAttribute("summmary"); - info[2] = all[i].getAttribute("caption"); + elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; elm.addEventListener("click", handleEvent, false); break; @@ -339,8 +362,7 @@ var firerecord = function () { }; - //Need to add author to this part... - //Need to add author to this part... + //rylan function handleEvent(e) { var targ; if (!e) { @@ -392,12 +414,12 @@ var firerecord = function () { taginfo[2] = targ.src; break; - case "INPUT": + /*case "INPUT": taginfo[1] = targ.name; taginfo[2] = targ.type; taginfo[3] = targ.value; - break; + break;*/ case "LINK": taginfo[1] = targ.href; taginfo[2] = targ.type; @@ -459,18 +481,18 @@ var firerecord = function () { var contents = taginfo.join(' :: ')+"\n"; - appendFile(window.content.location.href+"\n"); - appendFile(contents); + io.appendPath(path, window.content.location.href+"\n"); + io.appendPath(path, contents); e.cancelBubble = true; }; }(); -function createFile(contents) { +function createFile() { alert("created File"); var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); - file1.initWithPath("C:\\test\\" + "test.txt"); + file1.initWithPath(path); //alert("create file nullcheck" +file1.toString()); var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); // use 0x02 | 0x10 to open file for appending. @@ -478,7 +500,7 @@ function createFile(contents) { var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"]. createInstance(Components.interfaces.nsIConverterOutputStream); converter.init(foStream, "UTF-8", 0, 0); - converter.writeString(contents.toString()); + converter.close(); // this closes foStream } diff --git a/skin/play.png b/skin/play.png new file mode 100644 index 0000000..a0a95eb Binary files /dev/null and b/skin/play.png differ diff --git a/skin/record.png b/skin/record.png new file mode 100644 index 0000000..28d306f Binary files /dev/null and b/skin/record.png differ