Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

final application working standalone

  • Loading branch information...
commit c99c498655fe05ca61b3ac3bf984f9fba1583fd2 1 parent f74fb80
@pgte authored
View
42 assets/javascripts/final.js
@@ -0,0 +1,42 @@
+$(document).ready(function() {
+ $('#show_message').click(function() { $('#message').slideDown(); });
+ $('#hide_message').click(function() { $('#message').slideUp(); });
+
+ // Canvas paint
+
+ canvas = document.getElementById('painthere');
+ canvas_ctx = canvas.getContext('2d');
+ canvas_ctx.fillStyle = 'black';
+ canvas_ctx.beginPath();
+
+ var x;
+ var y;
+
+ canvas.onmousedown = function(e) {
+ x = e.clientX;
+ y = e.clientY;
+ canvas_ctx.moveTo(x, y);
+ }
+
+ canvas.onmouseup = function(e) {
+ x = null;
+ y = null;
+ }
+
+ canvas.onmousemove = function(e) {
+ if (x == null || y == null) {
+ return;
+ }
+ x = e.clientX;
+ y = e.clientY;
+ x += -canvas.offsetLeft + document.body.scrollLeft
+ + document.documentElement.scrollLeft;
+ y += -canvas.offsetTop + document.body.scrollTop
+ + document.documentElement.scrollTop;
+ canvas_ctx.lineTo(x, y);
+ canvas_ctx.stroke();
+ canvas_ctx.moveTo(x, y);
+ }
+
+
+});
View
4 assets/javascripts/jquery.jgrowl_flymake.js
@@ -0,0 +1,4 @@
+
+(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',$.extend(new $.fn.jGrowl(),{notifications:[],element:null,interval:null}));$(this).data('jGrowl.instance').startup(this);}
+if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications[this.notifications.length]={message:message,options:o};o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification'+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'"><div class="close">'+o.closeTemplate+'</div><div class="header">'+o.header+'</div><div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();(o.glue=='after')?$('div.jGrowl-notification:last',this.element).after(notification):$('div.jGrowl-notification:first',this.element).before(notification);$(notification).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind('jGrowl.beforeOpen',function(){o.beforeOpen.apply(self.element,[self.element,message,o]);}).bind('jGrowl.open',function(){o.open.apply(self.element,[self.element,message,o]);}).bind('jGrowl.beforeClose',function(){o.beforeClose.apply(self.element,[self.element,message,o]);}).bind('jGrowl.close',function(){$(this).data('jGrowl').pause=true;$(this).trigger('jGrowl.beforeClose').animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();o.close.apply(self.element,[self.element,message,o]);});}).trigger('jGrowl.beforeOpen').animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger('jGrowl.open');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',this.element).size()>1&&$('div.jGrowl-closer',this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer))self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).trigger('jGrowl.close');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool)){this.render(this.notifications.shift());}
+if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});};},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"])$(this.element).addClass('ie6');},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);
View
11 assets/stylesheets/master.css
@@ -0,0 +1,11 @@
+#message {
+ padding: 1em;
+ background-color: grey;
+ border: 1px solid black;
+}
+canvas#painthere {
+ width: 300px;
+ height: 300px;
+ padding: 0;
+ border: 1px solid black;
+}
View
32 demo_final/application.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Cyclops Demo Final</title>
+ <meta name="description" content="" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <link rel="stylesheet" href="../assets/stylesheets/master.css" type="text/css" media="screen" charset="utf-8">
+ <link rel="stylesheet" href="../assets/stylesheets/jquery.jgrowl.css" type="text/css" media="screen" charset="utf-8">
+</head>
+<body>
+ <h1>Cyclops Demo</h1>
+ <h2>Message:</h2>
+ <div id="message" style="display:none"><h3>Hello World!</h3></div>
+ <button id="show_message">Show message</button>
+ <button id="hide_message">Hide message</button>
+ <h2>Paint here:</h2>
+ <canvas width="300" height="300" id="painthere"></canvas>
+ <footer>
+ </footer>
+ <img src="../assets/images/cursor.png" id="mouse" style="position:absolute" />
+ <script src="../assets/javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/final.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/json2.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/pubsub.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/event.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/cymain.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/cynotify.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/jquery.hotkeys.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../assets/javascripts/jquery.jgrowl.js" type="text/javascript" charset="utf-8"></script>
+
+</body>
+</html>
View
77 demo_playback/playback.html
@@ -0,0 +1,77 @@
+<html>
+<style>
+#board {
+ width: 100%;
+ height: 100px;
+ background-color: green;
+}
+#board:hover {
+ background-color: yellow;
+}
+</style>
+<body>
+ <div id="board" style="" onmouseover="console.info();"></div>
+ <h1>Cyclops Playbacker</h1>
+ <h2>Enter events:</h2>
+ <form action="/activity?id=__ID__" method="POST">
+ <p>
+ <label for="events">Events JSON:</label><br />
+ <textarea id="events" name="events"></textarea>
+ </p>
+ <p>
+ <input type="submit" name="process" id="process" value="Trigger"/>
+ </p>
+ </form>
+ <script src="../assets/javascripts/jquery.js" type="text/javascript" charset="utf-8" ></script>
+ <script src="../assets/javascripts/json2.js" type="text/javascript" charset="utf-8" ></script>
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $('#board').mouseover(function(ev) {
+ console.info("clientX:"+ev.clientX);
+ console.info("clientY:"+ev.clientY);
+ });
+ $('form').submit(function() {
+ var jsonLines = $('#events').val();
+ var jsonLineArray = jsonLines.split("\r|\n|\r\n");
+ var jqDoc = $(document);
+ for(lineNumber in jsonLineArray) {
+ line = jsonLineArray[lineNumber];
+ console.info('parsing '+ line);
+ try {
+ var event_object = JSON.parse(line);
+ console.info('Object = '+event_object);
+ //jqDoc.trigger(event_object.type, event_object.data);
+ //console.info("X:"+event_object.data.x);
+ //console.info("Y:"+event_object.data.y);
+
+ var event = document.createEvent("MouseEvents");
+ event.initMouseEvent(
+ event_object.type,
+ true,
+ true,
+ window,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ false,
+ false,
+ false,
+ false,
+ 0,
+ null
+ );
+ canceled = !document.elementFromPoint(event_object.data.x, event_object.data.y).dispatchEvent(event);
+ if(canceled)
+ console.error('event canceled');
+ } catch(e) {
+ console.error(e);
+ }
+ }
+ return false;
+ });
+ });
+ </script>
+ </body>
+</html>
View
2  test/push/publisher.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script src="../../assets/javascripts/jquery-1.3.2.min.js" type="text/javascript" ></script>
+ <script src="../../assets/javascripts/jquery.js" type="text/javascript" ></script>
</head>
<body>
<h1>Cyclops Publisher</h1>
View
2  test/push/subscriber.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script src="../../assets/javascripts/jquery-1.3.2.min.js" type="text/javascript" ></script>
+ <script src="../../assets/javascripts/jquery.js" type="text/javascript" ></script>
</head>
<body>
<h1>Cyclops Subscriber</h1>
Please sign in to comment.
Something went wrong with that request. Please try again.