From d8ed1fa9130f4c9c27aad93384013c7555b348b9 Mon Sep 17 00:00:00 2001 From: retep998 Date: Tue, 23 Apr 2013 13:40:28 -0400 Subject: [PATCH] Simplified script generation. Signed-off-by: retep998 --- assemble.bat | 12 +- chrome/content/firerecord.js | 279 ++++++++--------------------------- locale.xpi | Bin 6786 -> 0 bytes 3 files changed, 68 insertions(+), 223 deletions(-) delete mode 100644 locale.xpi diff --git a/assemble.bat b/assemble.bat index 3297acf..08aeec1 100644 --- a/assemble.bat +++ b/assemble.bat @@ -1,9 +1,13 @@ if exist "C:\Program Files\7-Zip\7z.exe" ( - "C:\Program Files\7-Zip\7z.exe" a FireRecord.zip chrome defaults chrome.manifest install.rdf + "C:\Program Files\7-Zip\7z.exe" a FireRecord.zip chrome defaults locale skin chrome.manifest install.rdf .project ) else if exist "C:\Program Files (x86)\7-Zip\7z.exe" ( - "C:\Program Files (x86)\7-Zip\7z.exe" a FireRecord.zip chrome defaults chrome.manifest install.rdf + "C:\Program Files (x86)\7-Zip\7z.exe" a FireRecord.zip chrome defaults locale skin chrome.manifest install.rdf .project ) else ( - "C:\Program Files\WinRAR\rar.exe" a FireRecord.zip chrome defaults chrome.manifest install.rdf + "C:\Program Files\WinRAR\rar.exe" a FireRecord.zip chrome defaults locale skin chrome.manifest install.rdf .project ) move FireRecord.zip FireRecord.xpi -start "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" FireRecord.xpi +if exist "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" ( + start "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" FireRecord.xpi +) else ( + start FireRecord.xpi +) diff --git a/chrome/content/firerecord.js b/chrome/content/firerecord.js index 6115838..83d1f71 100644 --- a/chrome/content/firerecord.js +++ b/chrome/content/firerecord.js @@ -16,40 +16,40 @@ var firerecord = function () { appcontent.addEventListener("DOMContentLoaded", firerecord.run, true); } }, - running: function (){ - if(recordingx){ - recordingx = false; - alert("Stop Listen"); + running: function (){ + if(recordingx){ + recordingx = false; + alert("Stop Listen"); - //document.location.reload(); - //closes all tabs on firefox. - } - else{ - recordingx = true; - alert("Start Listen"); - //createFile("Initialize New Test File"); - firerecord.run(); - } + //document.location.reload(); + //closes all tabs on firefox. + } + else{ + recordingx = true; + alert("Start Listen"); + //createFile("Initialize New Test File"); + firerecord.run(); + } - }, - file: function(){ + }, + file: function(){ const nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] + var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); - fp.init(window, "Dialog Title", nsIFilePicker.modeOpen); - fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText); + 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. - path = fp.file.path; - // work with returned nsILocalFile... + 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. + path = fp.file.path; + // work with returned nsILocalFile... - } - }, + } + }, run : function () { var head = content.document.getElementsByTagName("head")[0], style = content.document.getElementById("link-target-finder-style"), @@ -71,81 +71,14 @@ var firerecord = function () { // Find all elements attributes and add a listener //----------------------------------------------------------- // Add author(s) to this section. Who did this? David and Peter? - for (var i = 0; i < all.length; ++i) { - //Define the classname variable - elm = all[i]; - //deleted local call to new array info - var validtags = ["A", "BUTTON", "FORM", "IMG", "INPUT", "LINK", "OPTION", "SELECT", "TABLE", "TEXTAREA"]; - //Add a click event listener to all the valid tags. - if (validtags.indexOf(all[i].tagName) < 0) continue; - - info[0] = all[i].tagName; - - //Feel free to change this to a for each... - if(recordingx){ - switch (info[0]) { - //All of these cases need null checks for each attribute. - case "INPUT": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleType, false); - break; - case "A": - - elm.addEventListener("click", handleEvent); - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "BUTTON": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "FORM": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "IMG": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "INPUT": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "LINK": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "OPTION": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - case "SELECT": - - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - 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; - case "TEXTAREA": - elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; - elm.addEventListener("click", handleEvent, false); - break; - + // Vastly simplified by Peter + if(recordingx){ + for (var i = 0; i < all.length; ++i) { + var elm = all[i]; + elm.addEventListener("click", handleEvent, false); + elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected"; } - } - - } + } //---------------------------------------------------------------- } @@ -154,7 +87,7 @@ var firerecord = function () { }; //Need to add author to this part... - //Need to add author to this part... + //Need to add author to this part... function handleEvent(e) { var targ; if (!e) { @@ -166,136 +99,44 @@ var firerecord = function () { else if (e.srcElement) { targ = e.srcElement; } - - //--------------------------------------------------------------------- - - - - - - //_____________________________________________________________________ - var tname; - var taginfo = new Array(); - tname = targ.tagName; - taginfo[0] = tname; - - //Feel free to change this to a for each... - switch (tname) { - //All of these cases need null checks for each attribute. - - case "A": - taginfo[1] = targ.href; - - break; - case "BUTTON": - taginfo[1] = targ.name; - taginfo[2] = targ.type; - taginfo[3] = targ.value; - taginfo[4] = targ.form; - - break; - case "FORM": - taginfo[1] = targ.name; - taginfo[2] = targ.length; - taginfo[3] = targ.target; - taginfo[4] = targ.action; - - break; - case "IMG": - taginfo[1] = targ.name; - taginfo[2] = targ.src; - - break; - case "INPUT": - taginfo[1] = targ.name; - taginfo[2] = targ.type; - taginfo[3] = targ.value; - - break; - case "LINK": - taginfo[1] = targ.href; - taginfo[2] = targ.type; - taginfo[3] = targ.charset; - - break; - case "OPTION": - taginfo[1] = targ.text; - taginfo[2] = targ.value; - taginfo[3] = targ.index; - - break; - case "SELECT": - taginfo[1] = targ.type; - taginfo[2] = targ.name; - taginfo[3] = targ.size; - - break; - case "TABLE": - taginfo[1] = targ.summmary; - taginfo[2] = targ.caption; - - break; - case "TEXTAREA": - taginfo[1] = targ.name; - taginfo[2] = targ.type; - taginfo[3] = targ.value; - - break; - - } - - alert(window.content.location.href); - if(!taginfo[1]){ - //taginfo[1]= "null"; - } - if(!taginfo[2]){ - //taginfo[2]= "null"; - } - if(!taginfo[3]){ - //taginfo[3]= "null"; - } - if(!taginfo[4]){ - //taginfo[4]= "null"; - } - var contents = "You clicked on a " + tname + " with info \n "+ taginfo.join(' :: ')+"\n"; - - appendFile(contents); + var contents = "script_click(script_find(" + targ.tagName + ", " + targ.getAttribute("id") + ", " + targ.getAttribute("name") + "));\n"; + alert(contents); + appendFile(contents); e.cancelBubble = true; - }; }(); function createFile(contents) { - alert("created File"); - var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); - file1.initWithPath("C:\\test\\" + "test.txt"); - //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. - foStream.init(file1, 0x02 | 0x08 | 0x20, 438, 0); - var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"]. + alert("created File"); + var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); + file1.initWithPath("C:\\test\\" + "test.txt"); + //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. + foStream.init(file1, 0x02 | 0x08 | 0x20, 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.toString()); - converter.close(); // this closes foStream + converter.init(foStream, "UTF-8", 0, 0); + converter.writeString(contents.toString()); + converter.close(); // this closes foStream } function appendFile(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"]. + 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.init(foStream, "UTF-8", 0, 0); - converter.writeString(contents); - converter.close(); + converter.writeString(contents); + converter.close(); } function handleType(e) { var targ; diff --git a/locale.xpi b/locale.xpi deleted file mode 100644 index 8983b22b57eab8f7c7567638685d307cecd95f15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6786 zcmZ`;1zeNs+aBFWBPj|Zwb3D=ba#k^2#nD%V56l5NQoc}1Qe7Kl`bg-3F(yXZjezT z{f*-};{P1K?RP)V`~G%c*Yn=*llL`kH7sl@z{N*QGfeici@ysJbnOTQTR1{^A`W#$c9c`T* zAQc`}EuczArG&Zb?YOrHqD^=vvfLPTLd58>l;#M_s2%f$ z&bN+FA9dkRDn!lF%Nwrn6wz$0THSw@5$?H`#!lJ5BHkJ;4F=nD=v$@OEGGM5DWn;; ze%AK+;9dE;BLJHORpRdcVI-%GRpaZzv?UoU|4Mq$qUTQJz3$L4r?G-U&6L`}0&VVc zrYo7{CpH)|oaRbRN~^4=HR~Vr>M4!gg=iL}$p@%j43%EJ6?}kk86+w&Om^g^K*A?< za4l$~{1qhJ0`3k2T3Wb)T%2vziBYiS#ke_3bMu+~Jr@GZul3TMjrF)}izW04fmC4E z*c!^lYM20T5Mv@->7f$t~Z3AQ{o zrbl&f=H+G|Ysy)ka_&3a*0@)B)nVe}0#W@`9OkB-KQw|B14*G1RN z7lx0EE+zO1GSC$UOjk)3P|(e|ioU_NkrkR<(ES5qWE1X8s@S?5G`86`>Btss**~)CK0%Ku~43u+6$3`nrXlbdNqegVF z*@RRkRDWz$Sn=K=mh&P$9GV$+i8@SP7BQ4Ro((>j)w|c>`novHQrGao^J0Q%x5A{9 zoKe$2a^v^sb+LNM7xPR`9vc zE7IpvS2fjL@yGeJ!mph|LO@LyY$EyO0oV1VhknkaQT_ex^t&*=`woR)ace#yB&MUY z`i!3$&DYsItnCX^B;(^&8`Km?bT&&#u76l@tC&wXRC`UPsLsMJ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