zeus.ugent.be/content/assets/scripts/cammie.js

47 lines
1 KiB
JavaScript
Raw Normal View History

2018-12-14 00:48:29 +00:00
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);
}
};
};
2018-12-14 01:28:35 +00:00
function cammie_error() {
$("#cammie-feed").attr("src","/assets/images/cammie_down.svg")
2018-12-14 01:28:35 +00:00
}
2018-12-14 00:48:29 +00:00
$("#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')
}
});
});