Permalink
Browse files

some fixes...

  • Loading branch information...
1 parent 4666d55 commit 9c31884c08c417c3c7ee4178980d2a1d0945e127 @pgte committed Dec 5, 2009
Showing with 32 additions and 12 deletions.
  1. +21 −0 README
  2. +9 −12 assets/javascripts/cymain.js
  3. +2 −0 assets/javascripts/final.js
View
21 README
@@ -0,0 +1,21 @@
+Install
+-------
+
+1. Install nginx with the http push module.
+You can find instructions here:
+
+2. Clone cyclops
+
+3. Link nginx.conf to cyclops/nginx/nginx.conf
+
+4. Gentlemen, start your nginx
+
+5. browse to http://localhost:8000/demo_final/start_master.html
+
+6. Generate URLs
+
+7. Distribute slave URL to person(s) operating the browser(s) that are to be controlled (by email or IM, for instance). This person will have to open this URL.
+
+8. Click on the master link
+
+9. Move your mouse and click on things
View
21 assets/javascripts/cymain.js
@@ -17,6 +17,8 @@ var Cyclops = function(type) {
cyclops_get_lastModified = null;
Cyclops.prototype.startListening = function() {
+ $('#mouse').show();
+
$.getJSON("/activity?id="+$.cookie('cyclops_queue_id'), function(ev) {
//console.info(ev.when+': Playing event '+ev.type);
slave['playEvent_'+ev.type](ev);
@@ -173,11 +175,9 @@ Cyclops.prototype.__find_object_in_location = function(x, y) {
Cyclops.prototype.__create_event = function(type, pageX, pageY) {
ev = jQuery.Event(type);
ev.pageX=parseInt(pageX);
- ev.clientX=ev.pageX - (document.body.scrollLeft
- + document.documentElement.scrollLeft) ;
+ ev.clientX=ev.pageX;
ev.pageY=parseInt(pageY);
- ev.clientY=ev.pageY - (document.body.scrollTop
- + document.documentElement.scrollTop);
+ ev.clientY=ev.pageY;
return ev;
}
@@ -186,9 +186,9 @@ Cyclops.prototype.playEvent_mousemove = function(e) {
// TODO: move to dispatch event
$("#mouse").css('top', e.data.y).css('left', e.data.x);
var el;
- if(el = slave.__find_object_in_location(e.data.x, e.data.y)) {
- //el.dispatchEvent(evt);
- var jsEvent = this.__create_event('mousemove', e.data.x, e.data.y);
+ if(el = slave.__find_object_in_location(e.data.x- (document.body.scrollLeft + document.documentElement.scrollLeft),
+ e.data.y - (document.body.scrollTop + document.documentElement.scrollTop))) {
+ var jsEvent = this.__create_event('mousemove', e.data.x- (document.body.scrollLeft + document.documentElement.scrollLeft), e.data.y- (document.body.scrollTop + document.documentElement.scrollTop));
$(el).trigger(jsEvent);
}
}
@@ -257,7 +257,8 @@ Cyclops.prototype.playEvent_click = function(e) {
// TODO: move to dispatch event
//console.info('CLICK!');
var el, href;
- if(el = slave.__find_object_in_location(e.data.x, e.data.y)) {
+ if(el = slave.__find_object_in_location(e.data.x- (document.body.scrollLeft + document.documentElement.scrollLeft),
+ e.data.y - (document.body.scrollTop + document.documentElement.scrollTop))) {
//console.info(el);
if(href = $(el).attr('href')) {
document.location = href+'?cyclops_slave=true';
@@ -279,7 +280,3 @@ Cyclops.prototype.playEvent_scroll = function(e) {
window.scrollTo(e.data.left, e.data.top);
}
-$(window).load(function() {
-
-});
-
View
2 assets/javascripts/final.js
@@ -109,5 +109,7 @@ $(window).load(function() {
console.info("click on document");
});*/
+ $('#mouse').hide();
+
});

0 comments on commit 9c31884

Please sign in to comment.