diff --git a/content/assets/images/cammie_down.svg b/content/assets/images/cammie_down.svg new file mode 100644 index 0000000..c8da617 --- /dev/null +++ b/content/assets/images/cammie_down.svg @@ -0,0 +1,258 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/assets/scripts/cammie.coffee b/content/assets/scripts/cammie.coffee deleted file mode 100644 index 9356a82..0000000 --- a/content/assets/scripts/cammie.coffee +++ /dev/null @@ -1,32 +0,0 @@ -# Reworked version of the underscorejs debounce -debounce = (func, wait, initial = () -> ) -> - timeout = false - () -> - context = this - args = arguments - later = () -> - timeout = null - func.apply context, args - callNow = !timeout - clearTimeout timeout - timeout = setTimeout later, wait - initial.apply context, args if callNow - -# Display controls when moving mouse -$ "#cammie-ctrls" - .mousemove debounce () -> - $ this - .removeClass 'display' - , 3000, () -> - $ this - .addClass 'display' - -# Cammie controls -$ '.ctrl' - .click -> - $context = $ this - $.ajax "https://kelder.zeus.ugent.be/webcam/cgi/ptdc.cgi", - data: - command: $context.data 'command' - posX: $context.data 'x' - posY: $context.data 'y' diff --git a/content/assets/scripts/cammie.js b/content/assets/scripts/cammie.js new file mode 100644 index 0000000..d8442fe --- /dev/null +++ b/content/assets/scripts/cammie.js @@ -0,0 +1,46 @@ +var debounce; + +debounce = function(func, wait, initial) { + var timeout; + if (initial == null) { + initial = function() {}; + } + timeout = false; + return function() { + var args, callNow, context, later; + context = this; + args = arguments; + later = function() { + timeout = null; + return func.apply(context, args); + }; + callNow = !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + return initial.apply(context, args); + } + }; +}; + +function cammie_error() { + $("#cammie-feed").attr("src","/assets/images/cammie_down.svg") +} + +$("#cammie-ctrls").mousemove(debounce(function() { + return $(this).removeClass('display'); +}, 3000, function() { + return $(this).addClass('display'); +})); + +$('.ctrl').click(function() { + var $context; + $context = $(this); + return $.ajax("https://kelder.zeus.ugent.be/webcam/cgi/ptdc.cgi", { + data: { + command: $context.data('command'), + posX: $context.data('x'), + posY: $context.data('y') + } + }); +}); diff --git a/content/cammie.erb b/content/cammie.erb index 285c790..cc781f9 100644 --- a/content/cammie.erb +++ b/content/cammie.erb @@ -11,7 +11,7 @@ title: Cammie
- cammie + cammie