From 233477e937325cb281c4e1c7bccdd95308b47a30 Mon Sep 17 00:00:00 2001 From: fklinck Date: Fri, 14 Dec 2018 01:48:29 +0100 Subject: [PATCH 1/4] Converted cammie.coffee to cammie.js --- content/assets/scripts/cammie.coffee | 32 --------------------- content/assets/scripts/cammie.js | 42 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 32 deletions(-) delete mode 100644 content/assets/scripts/cammie.coffee create mode 100644 content/assets/scripts/cammie.js 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..bc44f49 --- /dev/null +++ b/content/assets/scripts/cammie.js @@ -0,0 +1,42 @@ +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); + } + }; +}; + +$("#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') + } + }); +}); From 875dc90a6ea5d9a9215a1e375b3327f0b5058932 Mon Sep 17 00:00:00 2001 From: fklinck Date: Fri, 14 Dec 2018 02:28:35 +0100 Subject: [PATCH 2/4] show a message when cammie is down --- content/assets/images/cammie_down.svg | 143 ++++++++++++++++++++++++++ content/assets/scripts/cammie.js | 4 + content/cammie.erb | 2 +- 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 content/assets/images/cammie_down.svg diff --git a/content/assets/images/cammie_down.svg b/content/assets/images/cammie_down.svg new file mode 100644 index 0000000..89756ed --- /dev/null +++ b/content/assets/images/cammie_down.svg @@ -0,0 +1,143 @@ + + + + + + + + + + image/svg+xml + + + + + + + Cammie is on a break,Please come back later + + + + + + + diff --git a/content/assets/scripts/cammie.js b/content/assets/scripts/cammie.js index bc44f49..1313ffb 100644 --- a/content/assets/scripts/cammie.js +++ b/content/assets/scripts/cammie.js @@ -23,6 +23,10 @@ debounce = function(func, wait, initial) { }; }; +function cammie_error() { + $("#cammie-feed").attr("src","/images/cammie_down.svg") +} + $("#cammie-ctrls").mousemove(debounce(function() { return $(this).removeClass('display'); }, 3000, function() { 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
From c6fd939391859433aa3486198662068494215093 Mon Sep 17 00:00:00 2001 From: fklinck Date: Fri, 14 Dec 2018 02:41:19 +0100 Subject: [PATCH 3/4] fixed cammis_down.svg location in cammie.js --- content/assets/scripts/cammie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/assets/scripts/cammie.js b/content/assets/scripts/cammie.js index 1313ffb..d8442fe 100644 --- a/content/assets/scripts/cammie.js +++ b/content/assets/scripts/cammie.js @@ -24,7 +24,7 @@ debounce = function(func, wait, initial) { }; function cammie_error() { - $("#cammie-feed").attr("src","/images/cammie_down.svg") + $("#cammie-feed").attr("src","/assets/images/cammie_down.svg") } $("#cammie-ctrls").mousemove(debounce(function() { From b2b1d9594b9b5866ee516ca521aa1a1d95e36aa9 Mon Sep 17 00:00:00 2001 From: fklinck Date: Fri, 14 Dec 2018 02:50:25 +0100 Subject: [PATCH 4/4] updated cammie_down.svg image, now has text --- content/assets/images/cammie_down.svg | 145 +++++++++++++++++++++++--- 1 file changed, 130 insertions(+), 15 deletions(-) diff --git a/content/assets/images/cammie_down.svg b/content/assets/images/cammie_down.svg index 89756ed..c8da617 100644 --- a/content/assets/images/cammie_down.svg +++ b/content/assets/images/cammie_down.svg @@ -56,21 +56,6 @@ transform="translate(0,-11.249983)"> Cammie is on a break,Please come back later + + + + + + + + + + + + + + + + + + + + + + + + + +