From 53ae62440fe4c4f3ec5da0ba60371dcaec9b2952 Mon Sep 17 00:00:00 2001 From: Lorin Werthen Date: Tue, 19 Jul 2016 11:31:12 +0200 Subject: [PATCH] fix cammie controls and integrity of html --- .travis.yml | 3 +- content/assets/scripts/cammie.coffee | 73 ++++++++++++++++++++++++---- content/cammie.erb | 8 +-- layouts/default.erb | 1 - 4 files changed, 69 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index e6f376c..1b4101c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,10 @@ install: script: - bundle exec nanoc - bundle exec nanoc check elinks +- bundle exec nanoc check html - bundle exec nanoc check ilinks -- bundle exec nanoc check stale - bundle exec nanoc check mixed_content +- bundle exec nanoc check stale after_success: - mv deploy_key ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa diff --git a/content/assets/scripts/cammie.coffee b/content/assets/scripts/cammie.coffee index da88a1e..e067792 100644 --- a/content/assets/scripts/cammie.coffee +++ b/content/assets/scripts/cammie.coffee @@ -1,15 +1,68 @@ -$('.ctrl').click -> - $.ajax "//kelder.zeus.ugent.be/webcam/cgi/ptdc.cgi", - data: - command: $(this).attr("command") - posX: $(this).attr("posX") - posY: $(this).attr("posY") +# All the cammie controls +commands = + up: + command: 'set_relative_pos' + posX: 0 + posY: 10 + down: + command: 'set_relative_pos' + posX: 0 + posY: -10 + left: + command: 'set_relative_pos' + posX: -10 + posY: 0 + right: + command: 'set_relative_pos' + posX: 10 + posY: 0 +# Initially hide all the controls $('.ctrl').hide() -timeout = null +$('.ctrl').click -> + $.ajax "//kelder.zeus.ugent.be/webcam/cgi/ptdc.cgi", + data: commands[$(this).attr('id')] -$('.fullpage').mousemove (event) -> - clearTimeout(timeout) if timeout +timer = undefined +fade_buffer = false +blocking = false + +clear_timer = () -> + clearTimeout timer + timer = 0 + +set_timer = () -> + timer = setTimeout((-> + ctrl_hide() + fade_buffer = true + ), 3000) + +ctrl_show = () -> $('.ctrl').fadeIn() - timeout = setTimeout (-> $('.ctrl').fadeOut()), 3000 + +ctrl_hide = () -> + $('.ctrl').fadeOut() + +block_hide = () -> + clear_timer() + blocking = true + +unblock_hide = () -> + set_timer() + blocking = false + +$(document).mousemove -> + if !blocking + if !fade_buffer + clear_timer() if timer + else + fade_buffer = false + + ctrl_show() + set_timer() + +$('.ctrl').mouseover(block_hide) + +# Timeout when we leave the window +$(document).mouseleave(unblock_hide) diff --git a/content/cammie.erb b/content/cammie.erb index 5b6aa1d..2a297a3 100644 --- a/content/cammie.erb +++ b/content/cammie.erb @@ -4,16 +4,16 @@ src="https://kelder.zeus.ugent.be/webcam/video/mjpg.cgi?profileid=2" alt="" /> -
+
-