Skip to content

Commit

Permalink
Working prototype -- Firefox only
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Dec 31, 2008
1 parent 781ba94 commit cddd608
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
24 changes: 18 additions & 6 deletions src/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,35 @@
_started: null,
_stopped: null,
start: function() {
if (this._started) {
this.stop();
}
this._started = (new Date()).getTime();
this._stopped = null;
console.log('start');
},
stop: function() {
this._stopped = (new Date()).getTime();
console.log('stop');
console.log(this._getEvents());
this._started = null;
//console.log(this._getEvents());
},
play: function() {
var c = Dom.get('cursor');

c.style.display = 'block';
console.log('play');
var f = this._getEvents();
console.log(fires.length, ' :: ', f.length);
for (var i = 0; i < f.length; i++) {
if (fires[i][1] == 'mousemove') {
console.log(fires[i][2][0]);
c.style.top = fires[i][2][0].pageY + 'px';
c.style.left = fires[i][2][0].pageX + 'px';
}
}
},
_getEvents: function() {
var out = [];
for (var i = 0; i < fires.length; i++) {
if (fires[i][3]) {
if (fires[i][3] < this._started) {
if ((fires[i][3] > this._started) && (fires[i][3] < this._stopped)) {
//console.log(fires[i][3]);
out.push(fires[i]);
}
Expand Down
11 changes: 10 additions & 1 deletion tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>YUI Event Capture Test</title>
<style>
#cursor {
display: none;
height: 16px;
width: 16px;
background-image: url( ../src/cursor.png );
top: 0;
left: 0;
position: absolute;
}
</style>
</head>
<body>
<h2>YUI Event Capture Test</h2>

<button id="start">Start</button> - <button id="stop">Stop</button>

<div></div>
<div id="cursor"></div>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="../src/capture.js"></script>
<script>
Expand Down

0 comments on commit cddd608

Please sign in to comment.