2009-04-01 16:37:10 +08:00
|
|
|
var controlParms = "view=request&request=control";
|
2019-01-19 23:32:40 +08:00
|
|
|
var controlReq = new Request.JSON( {url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: getControlResponse} );
|
2009-04-01 16:37:10 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function getControlResponse( respObj, respText ) {
|
2019-01-19 23:32:40 +08:00
|
|
|
if ( !respObj ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
return;
|
2019-01-19 23:32:40 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
//console.log( respText );
|
|
|
|
if ( respObj.result != 'Ok' ) {
|
|
|
|
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
|
|
|
|
}
|
2009-04-01 16:37:10 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function controlCmd( control, event, xtell, ytell ) {
|
|
|
|
var locParms = "&id="+$('mid').get('value');
|
|
|
|
if ( event && (xtell || ytell) ) {
|
2018-01-12 02:14:11 +08:00
|
|
|
var target = event.target;
|
2017-05-19 01:50:56 +08:00
|
|
|
var coords = $(target).getCoordinates();
|
2009-04-01 16:37:10 +08:00
|
|
|
|
2018-01-12 02:14:11 +08:00
|
|
|
var x = event.pageX - coords.left;
|
|
|
|
var y = event.pageY - coords.top;
|
2009-04-01 16:37:10 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
if ( xtell ) {
|
|
|
|
var xge = parseInt( (x*100)/coords.width );
|
2019-01-19 23:32:40 +08:00
|
|
|
if ( xtell == -1 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
xge = 100 - xge;
|
2019-01-19 23:32:40 +08:00
|
|
|
} else if ( xtell == 2 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
xge = 2*(50 - xge);
|
2019-01-19 23:32:40 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
locParms += "&xge="+xge;
|
|
|
|
}
|
|
|
|
if ( ytell ) {
|
|
|
|
var yge = parseInt( (y*100)/coords.height );
|
2019-01-19 23:32:40 +08:00
|
|
|
if ( ytell == -1 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
yge = 100 - yge;
|
2019-01-19 23:32:40 +08:00
|
|
|
} else if ( ytell == 2 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
yge = 2*(50 - yge);
|
2019-01-19 23:32:40 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
locParms += "&yge="+yge;
|
2009-04-01 16:37:10 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
|
|
|
controlReq.send( controlParms+"&control="+control+locParms );
|
2009-04-01 16:37:10 +08:00
|
|
|
}
|