|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 10/31/2009 at 04:21AM PDT, ID: 24860544 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: |
<html>
<head>
<script type="text/javascript">
var READYSTATE_COMPLETE = 4;
var READYSTATE_INTERACTIVE = 3;
var READYSTATE_LOADED = 2;
function myStart(){
var submitwindow = new scraper();
//submitwindow.timer = new Timer(submitwindow);
//submitwindow.tick();
}
function scraper(){
var x="yada";
this.oBrowser.navigate("http://www.espn.go.com");
this.timer = new Timer(this);
var hardpause = true;
this.tick(1, hardpause);
}
scraper.prototype.oBrowser = new ActiveXObject("InternetExplorer.Application");
scraper.prototype.oBrowser.Visible = true;
scraper.prototype.resumeAt=30;
scraper.prototype.count = 0;
// scraper.prototype.timer = new Timer(this);
scraper.prototype.oBrowser.Width = 320;
scraper.prototype.oBrowser.Height = 800;
scraper.prototype.oBrowser.Left = 650;
scraper.prototype.oBrowser.Top = 5;
scraper.prototype.oBrowser.menubar = true;
scraper.prototype.oBrowser.toolbar = true;
scraper.prototype.oBrowser.statusbar = true;
scraper.prototype.oBrowser.Visible = true;
scraper.prototype.oBrowser.Silent = true;
scraper.prototype.step = -1;
scraper.prototype.steps = -1;
//scraper.prototype.sixml = new ActiveXObject("MSXML2.DOMDocument.3.0");
scraper.prototype.lastKnownUrl = "nowhere yet";
scraper.prototype.async = false;
scraper.prototype.sep = "--";
scraper.prototype.exit = false;
scraper.prototype.scrapedata = "";
scraper.prototype.nestedLevel=0;
//2004-04-23 mcd added missing 'prototype' below
scraper.prototype.skip=false;
scraper.prototype.soapdocPreBound = "";
scraper.prototype.passedin = false;
scraper.prototype.actionStartTime = "";
scraper.prototype.tick = function(d){
var argv = this.tick.arguments;
var argc = argv.length;
var hardpause = false;
for (var arg = 0; arg < argc; arg++) {
//instructionProgress.value = instructionProgress.value + "<br>Argument " + arg + " = " + argv[arg];
switch(arg){
case 1:
hardpause = argv[arg];
break;
default:
break;
}
}
//instructionProgress.value = instructionProgress.value + "<br>hardpause = " + hardpause;
this.count+=d;
var debugmsg=""+this.count + " of " + this.resumeAt + ", readystate=" + this.oBrowser.readyState + ", busy=" + this.oBrowser.Busy + ", outernode no: " + this.step;
window.status = debugmsg;
if(this.oBrowser.readyState==READYSTATE_COMPLETE && !(this.oBrowser.Busy) && !(hardpause)) {
this.step = this.step+1;
alert('done');
}
else {
//alert(this.count < this.resumeAt);
if (this.count < this.resumeAt) {
//alert('dude');
//2009-10-22: the ie8 bug comes somewhere from below in this else clauses
this.timer.setTimeout("tick", 1000, d, hardpause);
}
else {
if(!(hardpause)){
var currentLocation = this.lastKnownUrl;
var currentTime = new Date();
var theTime = currentTime.getHours() + ':' + currentTime.getMinutes() + ':' + currentTime.getSeconds() + ' ';
var scrapeErrors = "current location: " + currentLocation + "\n current time:" + theTime + "\n Action didn't succeed in the time alotted.\n\n";
this.skip = true;
this.exit = true;
} else {
var instructionProgress= this.sep + "Completed hard pause.\n";
}
this.step = this.step+1;
}
}
}
function Timer(){
this.obj = (arguments.length)?arguments[0]:window;
return this;
}
// The set functions should be called with:
// - The name of the object method (as a string) (required)
// - The millisecond delay (required)
// - Any number of extra arguments, which will all be
// passed to the method when it is evaluated.
//
Timer.prototype.setInterval = function(func, msec){
var i = Timer.getNew();
var t = Timer.buildCall(this.obj, i, arguments);
Timer.set[i].timer = window.setInterval(t,msec);
return i;
}
Timer.prototype.setTimeout = function(func, msec){
var i = Timer.getNew();
Timer.buildCall(this.obj, i, arguments);
Timer.set[i].timer = window.setTimeout("Timer.callOnce("+i+");",msec);
return i;
}
// The clear functions should be called with
// the return value from the equivalent set function.
Timer.prototype.clearInterval = function(i){
if(!Timer.set[i]) return;
window.clearInterval(Timer.set[i].timer);
Timer.set[i] = null;
}
Timer.prototype.clearTimeout = function(i){
if(!Timer.set[i]) return;
window.clearTimeout(Timer.set[i].timer);
Timer.set[i] = null;
}
// Private data
Timer.set = new Array();
Timer.buildCall = function(obj, i, args){
var t = "";
Timer.set[i] = new Array();
if(obj != window){
Timer.set[i].obj = obj;
t = "Timer.set["+i+"].obj.";
}
t += args[0]+"(";
if(args.length > 2){
Timer.set[i][0] = args[2];
t += "Timer.set["+i+"][0]";
for(var j=1; (j+2)<args.length; j++){
Timer.set[i][j] = args[j+2];
t += ", Timer.set["+i+"]["+j+"]";
}
}
t += ");";
Timer.set[i].call = t;
return t;
}
Timer.callOnce = function(i){
if(!Timer.set[i]) return;
//alert(Timer.set[i].call);
eval(Timer.set[i].call);
Timer.set[i] = null;
}
Timer.getNew = function(){
var i = 0;
while(Timer.set[i]) i++;
return i;
}
</script>
</head>
<body onload="myStart();">
dude xx
</body>
</html>
|
Advertisement