From d7fa28142f9b0fc1453d4954152a652c00968a9d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 16 Apr 2021 10:15:07 -0400 Subject: [PATCH 1/3] Use on-mousedown and on-mouseup if doing continuous --- web/skins/classic/includes/control_functions.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/skins/classic/includes/control_functions.php b/web/skins/classic/includes/control_functions.php index 61138612f..877563664 100644 --- a/web/skins/classic/includes/control_functions.php +++ b/web/skins/classic/includes/control_functions.php @@ -122,7 +122,16 @@ function controlPanTilt($monitor, $cmds) { $hasTilt = $control->CanTilt(); $hasDiag = $hasPan && $hasTilt && $control->CanMoveDiag(); ?> - + From e0c0598e13957465086bdb3076d33752d9ee9979 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 16 Apr 2021 10:15:57 -0400 Subject: [PATCH 2/3] Add on-mouseup and on-mousedown processing --- web/skins/classic/js/skin.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index 067c39391..76b8e9ac9 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -186,6 +186,28 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() { window[fnName](ev); }; }); + document.querySelectorAll("button[data-on-mousedown]").forEach(function(el) { + var fnName = el.getAttribute("data-on-mousedown"); + if ( !window[fnName] ) { + console.error("Nothing found to bind to " + fnName + " on element " + el.name); + return; + } + + el.onmousedown = function(ev) { + window[fnName](ev); + }; + }); + document.querySelectorAll("button[data-on-mouseup]").forEach(function(el) { + var fnName = el.getAttribute("data-on-mouseup"); + if ( !window[fnName] ) { + console.error("Nothing found to bind to " + fnName + " on element " + el.name); + return; + } + + el.onmouseup = function(ev) { + window[fnName](ev); + }; + }); // 'data-on-click-true' calls the global function in the attribute value with no arguments when a click happens. document.querySelectorAll("a[data-on-click-true], button[data-on-click-true], input[data-on-click-true]").forEach(function attachOnClick(el) { From c880618d5f60674b5306cd5e8c299969cfe4a4b6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 16 Apr 2021 10:24:48 -0400 Subject: [PATCH 3/3] If no button is associated with the event, assume it is a mouseup --- web/skins/classic/views/js/watch.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 6dec23151..ed897ed00 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -672,7 +672,8 @@ if ( monitorType != 'WebSite' ) { } var controlReq = new Request.JSON( { url: monitorUrl, - method: 'post', + method: 'get', + //method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse @@ -691,12 +692,17 @@ function getControlResponse(respObj, respText) { function controlCmd(event) { button = event.target; - control = button.getAttribute('value'); + if (event.buttons) { + control = button.getAttribute('value'); + } else { + console.log('stop'); + control = 'moveStop'; + } xtell = button.getAttribute('data-xtell'); ytell = button.getAttribute('data-ytell'); var locParms = ''; - if ( event && (xtell || ytell) ) { + if (xtell || ytell) { var target = event.target; var coords = $(target).getCoordinates();