Update firerecord.js

Working prototype with playback function
This commit is contained in:
David Westgate 2013-04-28 21:10:04 -03:00
parent 016ee0c922
commit f864d6f2b6

View File

@ -38,12 +38,9 @@ var firerecord = function() {
// createFile("Initialize New Test File"); // createFile("Initialize New Test File");
firerecord.run(); firerecord.run();
} }
}, },
openfile : function() { openfile : function() {
path = io.openPath(); path = io.openPath();
}, },
newfile : function() { newfile : function() {
path = io.newPath(); path = io.newPath();
@ -75,29 +72,26 @@ var firerecord = function() {
} }
}, },
// rylan // rylan and David
readr : function() {
var a = "http://rt.com/news/";
var b = "A";
var c = "http://rt.com/news/ukraine-tymoshenko-pardon-request-508/";
var d = "null";
var e = "null";
var f = "null";
setTimeout(function() {
firerecord.checkpage(a);
}, 5000);
setTimeout(function() {
firerecord.fire(b, c, d, e, f);
}, 8000);
// setTimeout(function(){firerecord.fireExp();},8000);
},
// David
playback : function() { playback : function() {
var playThis = io.getLine(path); var playThis = io.getLine(path);
for(var i = 0; i < playThis.length; i++) var line1 = new Array();
var line2 = new Array();
for(var i = 0; i < playThis.length; i+=2)
{ {
alert(playThis[i]); line1 = playThis[i];
line2 = playThis[i+1].split(' :: ');
} }
//alert(line1.toString());
//alert(line2.toString());
setTimeout(function() {
firerecord.checkpage(line1);
}, 5000);
setTimeout(function() {
firerecord.fire(line2[0], line2[1], line2[2], line2[3], line2[4]);
}, 8000);
// setTimeout(function(){firerecord.fireExp();},8000);
}, },
// rylan // rylan
@ -272,8 +266,7 @@ var firerecord = function() {
} }
// Find all elements attributes and add a listener // Find all elements attributes and add a listener
// ----------------------------------------------------------- //David, Peter
// Add author(s) to this section. Who did this? David and Peter?
for ( var i = 0; i < all.length; ++i) { for ( var i = 0; i < all.length; ++i) {
// Define the classname variable // Define the classname variable
elm = all[i]; elm = all[i];
@ -340,7 +333,6 @@ var firerecord = function() {
elm.addEventListener("click", handleEvent, false); elm.addEventListener("click", handleEvent, false);
break; break;
case "SELECT": case "SELECT":
elm.className += ((elm.className.length > 0) ? " " : "") elm.className += ((elm.className.length > 0) ? " " : "")
+ "link-target-finder-selected"; + "link-target-finder-selected";
elm.addEventListener("click", handleEvent, false); elm.addEventListener("click", handleEvent, false);
@ -378,11 +370,6 @@ var firerecord = function() {
} else if (e.srcElement) { } else if (e.srcElement) {
targ = e.srcElement; targ = e.srcElement;
} }
// ---------------------------------------------------------------------
// _____________________________________________________________________
var taginfo = new Array(); var taginfo = new Array();
taginfo[0] = targ.tagName; taginfo[0] = targ.tagName;
@ -390,7 +377,6 @@ var firerecord = function() {
// Feel free to change this to a for each... // Feel free to change this to a for each...
switch (taginfo[0]) { switch (taginfo[0]) {
// All of these cases need null checks for each attribute. // All of these cases need null checks for each attribute.
case "A": case "A":
taginfo[1] = targ.href; taginfo[1] = targ.href;
@ -449,9 +435,7 @@ var firerecord = function() {
taginfo[3] = targ.value; taginfo[3] = targ.value;
break; break;
} }
if (!taginfo[1]) { if (!taginfo[1]) {
taginfo[1] = "null"; taginfo[1] = "null";
} }
@ -464,19 +448,15 @@ var firerecord = function() {
if (!taginfo[4]) { if (!taginfo[4]) {
taginfo[4] = "null"; taginfo[4] = "null";
} }
/* /*
* var positionFind = content.document.getElementsByTagName(taginfo[0]); * var positionFind = content.document.getElementsByTagName(taginfo[0]);
* for (var i = 0; i < positionFind.length; ++i) { if (targ = * for (var i = 0; i < positionFind.length; ++i) { if (targ =
* positionFind[i]){ taginfo[5] = i; * positionFind[i]){ taginfo[5] = i;
* } } alert(taginfo[5]); * } } alert(taginfo[5]);
*/ */
var contents = taginfo.join(' :: ') + "\n"; var contents = taginfo.join(' :: ') + "\n";
io.appendPath(path, window.content.location.href + "\n"); io.appendPath(path, window.content.location.href + "\n");
io.appendPath(path, contents); io.appendPath(path, contents);
e.cancelBubble = true; e.cancelBubble = true;
} }
; ;