Simplified script generation.
Signed-off-by: retep998 <retep998@verizon.net>
This commit is contained in:
parent
729b7b552b
commit
d8ed1fa913
12
assemble.bat
12
assemble.bat
@ -1,9 +1,13 @@
|
|||||||
if exist "C:\Program Files\7-Zip\7z.exe" (
|
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" (
|
) 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 (
|
) 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
|
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
|
||||||
|
)
|
||||||
|
@ -16,40 +16,40 @@ var firerecord = function () {
|
|||||||
appcontent.addEventListener("DOMContentLoaded", firerecord.run, true);
|
appcontent.addEventListener("DOMContentLoaded", firerecord.run, true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
running: function (){
|
running: function (){
|
||||||
if(recordingx){
|
if(recordingx){
|
||||||
recordingx = false;
|
recordingx = false;
|
||||||
alert("Stop Listen");
|
alert("Stop Listen");
|
||||||
|
|
||||||
//document.location.reload();
|
//document.location.reload();
|
||||||
//closes all tabs on firefox.
|
//closes all tabs on firefox.
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
recordingx = true;
|
recordingx = true;
|
||||||
alert("Start Listen");
|
alert("Start Listen");
|
||||||
//createFile("Initialize New Test File");
|
//createFile("Initialize New Test File");
|
||||||
firerecord.run();
|
firerecord.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
file: function(){
|
file: function(){
|
||||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||||
|
|
||||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||||
.createInstance(nsIFilePicker);
|
.createInstance(nsIFilePicker);
|
||||||
fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
|
fp.init(window, "Dialog Title", nsIFilePicker.modeOpen);
|
||||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
|
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
|
||||||
|
|
||||||
var rv = fp.show();
|
var rv = fp.show();
|
||||||
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
|
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
|
||||||
var file = fp.file;
|
var file = fp.file;
|
||||||
// Get the path as string. Note that you usually won't
|
// Get the path as string. Note that you usually won't
|
||||||
// need to work with the string paths.
|
// need to work with the string paths.
|
||||||
path = fp.file.path;
|
path = fp.file.path;
|
||||||
// work with returned nsILocalFile...
|
// work with returned nsILocalFile...
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
run : function () {
|
run : function () {
|
||||||
var head = content.document.getElementsByTagName("head")[0],
|
var head = content.document.getElementsByTagName("head")[0],
|
||||||
style = content.document.getElementById("link-target-finder-style"),
|
style = content.document.getElementById("link-target-finder-style"),
|
||||||
@ -71,81 +71,14 @@ var firerecord = function () {
|
|||||||
// Find all elements attributes and add a listener
|
// Find all elements attributes and add a listener
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// Add author(s) to this section. Who did this? David and Peter?
|
// Add author(s) to this section. Who did this? David and Peter?
|
||||||
for (var i = 0; i < all.length; ++i) {
|
// Vastly simplified by Peter
|
||||||
//Define the classname variable
|
if(recordingx){
|
||||||
elm = all[i];
|
for (var i = 0; i < all.length; ++i) {
|
||||||
//deleted local call to new array info
|
var elm = all[i];
|
||||||
var validtags = ["A", "BUTTON", "FORM", "IMG", "INPUT", "LINK", "OPTION", "SELECT", "TABLE", "TEXTAREA"];
|
elm.addEventListener("click", handleEvent, false);
|
||||||
//Add a click event listener to all the valid tags.
|
elm.className += ((elm.className.length > 0) ? " " : "") + "link-target-finder-selected";
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -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...
|
//Need to add author to this part...
|
||||||
function handleEvent(e) {
|
function handleEvent(e) {
|
||||||
var targ;
|
var targ;
|
||||||
if (!e) {
|
if (!e) {
|
||||||
@ -166,136 +99,44 @@ var firerecord = function () {
|
|||||||
else if (e.srcElement) {
|
else if (e.srcElement) {
|
||||||
targ = e.srcElement;
|
targ = e.srcElement;
|
||||||
}
|
}
|
||||||
|
var contents = "script_click(script_find(" + targ.tagName + ", " + targ.getAttribute("id") + ", " + targ.getAttribute("name") + "));\n";
|
||||||
//---------------------------------------------------------------------
|
alert(contents);
|
||||||
|
appendFile(contents);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//_____________________________________________________________________
|
|
||||||
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);
|
|
||||||
e.cancelBubble = true;
|
e.cancelBubble = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}();
|
}();
|
||||||
function createFile(contents) {
|
function createFile(contents) {
|
||||||
|
|
||||||
alert("created File");
|
alert("created File");
|
||||||
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
file1.initWithPath("C:\\test\\" + "test.txt");
|
file1.initWithPath("C:\\test\\" + "test.txt");
|
||||||
//alert("create file nullcheck" +file1.toString());
|
//alert("create file nullcheck" +file1.toString());
|
||||||
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||||
// use 0x02 | 0x10 to open file for appending.
|
// use 0x02 | 0x10 to open file for appending.
|
||||||
foStream.init(file1, 0x02 | 0x08 | 0x20, 438, 0);
|
foStream.init(file1, 0x02 | 0x08 | 0x20, 438, 0);
|
||||||
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
||||||
createInstance(Components.interfaces.nsIConverterOutputStream);
|
createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||||
converter.init(foStream, "UTF-8", 0, 0);
|
converter.init(foStream, "UTF-8", 0, 0);
|
||||||
converter.writeString(contents.toString());
|
converter.writeString(contents.toString());
|
||||||
converter.close(); // this closes foStream
|
converter.close(); // this closes foStream
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendFile(contents) {
|
function appendFile(contents) {
|
||||||
|
|
||||||
alert("appended File");
|
alert("appended File");
|
||||||
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var file1 = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
file1.initWithPath(path);
|
file1.initWithPath(path);
|
||||||
//alert("append file nullcheck: "+file1.toString());
|
//alert("append file nullcheck: "+file1.toString());
|
||||||
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||||
// use 0x02 | 0x10 to open file for appending.
|
// use 0x02 | 0x10 to open file for appending.
|
||||||
foStream.init(file1, 0x02 | 0x10, 438, 0);
|
foStream.init(file1, 0x02 | 0x10, 438, 0);
|
||||||
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
|
||||||
createInstance(Components.interfaces.nsIConverterOutputStream);
|
createInstance(Components.interfaces.nsIConverterOutputStream);
|
||||||
converter.init(foStream, "UTF-8", 0, 0);
|
converter.init(foStream, "UTF-8", 0, 0);
|
||||||
|
|
||||||
converter.writeString(contents);
|
converter.writeString(contents);
|
||||||
converter.close();
|
converter.close();
|
||||||
}
|
}
|
||||||
function handleType(e) {
|
function handleType(e) {
|
||||||
var targ;
|
var targ;
|
||||||
|
BIN
locale.xpi
BIN
locale.xpi
Binary file not shown.
Reference in New Issue
Block a user