mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-21 22:50:55 +00:00
Also support disabling the Pads
This commit is contained in:
parent
d8b9c35655
commit
9a4cb277e9
@ -587,12 +587,11 @@ hr {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.control a.confirm:active {
|
||||
background-color: #777;
|
||||
.control:not(.disabled) a.confirm:active {
|
||||
background-color:#777
|
||||
}
|
||||
|
||||
.control li:active {
|
||||
background-color: #777;
|
||||
.control:not(.disabled) li:active {
|
||||
background-color:#777
|
||||
}
|
||||
|
||||
/* Switch
|
||||
|
2
data/css/style.min.css
vendored
2
data/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
15
data/js/controls.js
vendored
15
data/js/controls.js
vendored
@ -647,6 +647,7 @@ function buttonclick(number, isdown) {
|
||||
}
|
||||
|
||||
function padclick(type, number, isdown) {
|
||||
if(!$("#id" + number + " nav").hasClass("disabled")) {
|
||||
switch (type) {
|
||||
case CENTER:
|
||||
if (isdown) websock.send("pcdown:" + number);
|
||||
@ -669,6 +670,7 @@ function padclick(type, number, isdown) {
|
||||
else websock.send("prup:" + number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function switcher(number, state) {
|
||||
@ -831,7 +833,7 @@ var elementHTML = function(data) {
|
||||
var processEnabled = function(data) {
|
||||
//Handle the enabling and disabling of controls
|
||||
//Most controls can be disabled through the use of $("#<item>").prop("disabled", true) and CSS will style it accordingly
|
||||
//The switcher also requires the addition of the "disabled" class
|
||||
//The switcher and pads also require the addition of the "disabled" class
|
||||
switch(data.type) {
|
||||
case UI_SWITCHER:
|
||||
case UPDATE_SWITCHER:
|
||||
@ -868,5 +870,16 @@ var processEnabled = function(data) {
|
||||
case UPDATE_BUTTON:
|
||||
$("#btn" + data.id).prop("disabled", !data.enabled);
|
||||
break;
|
||||
|
||||
case UI_PAD:
|
||||
case UI_CPAD:
|
||||
case UPDATE_PAD:
|
||||
case UPDATE_CPAD:
|
||||
if(data.enabled) {
|
||||
$("#id" + data.id + " nav").removeClass('disabled');
|
||||
} else {
|
||||
$("#id" + data.id + " nav").addClass('disabled');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
5
data/js/controls.min.js
vendored
5
data/js/controls.min.js
vendored
@ -54,7 +54,7 @@ function textchange(number){var val=$("#text"+number).val();websock.send("tvalue
|
||||
function tabclick(number){var val=$("#tab"+number).val();websock.send("tabvalue:"+val+":"+number);}
|
||||
function selectchange(number){var val=$("#select"+number).val();websock.send("svalue:"+val+":"+number);}
|
||||
function buttonclick(number,isdown){if(isdown)websock.send("bdown:"+number);else websock.send("bup:"+number);}
|
||||
function padclick(type,number,isdown){switch(type){case CENTER:if(isdown)websock.send("pcdown:"+number);else websock.send("pcup:"+number);break;case UP:if(isdown)websock.send("pfdown:"+number);else websock.send("pfup:"+number);break;case DOWN:if(isdown)websock.send("pbdown:"+number);else websock.send("pbup:"+number);break;case LEFT:if(isdown)websock.send("pldown:"+number);else websock.send("plup:"+number);break;case RIGHT:if(isdown)websock.send("prdown:"+number);else websock.send("prup:"+number);break;}}
|
||||
function padclick(type,number,isdown){if(!$("#id"+number+" nav").hasClass("disabled")){switch(type){case CENTER:if(isdown)websock.send("pcdown:"+number);else websock.send("pcup:"+number);break;case UP:if(isdown)websock.send("pfdown:"+number);else websock.send("pfup:"+number);break;case DOWN:if(isdown)websock.send("pbdown:"+number);else websock.send("pbup:"+number);break;case LEFT:if(isdown)websock.send("pldown:"+number);else websock.send("plup:"+number);break;case RIGHT:if(isdown)websock.send("prdown:"+number);else websock.send("prup:"+number);break;}}}
|
||||
function switcher(number,state){if(state==null){if(!$("#sl"+number).hasClass("checked")){websock.send("sactive:"+number);$("#sl"+number).addClass("checked");}else{websock.send("sinactive:"+number);$("#sl"+number).removeClass("checked");}}else if(state==1){$("#sl"+number).addClass("checked");$("#sl"+number).prop("checked",true);}else if(state==0){$("#sl"+number).removeClass("checked");$("#sl"+number).prop("checked",false);}}
|
||||
var rangeSlider=function(isDiscrete){var range=$(".range-slider__range");var slidercb=function(){sliderchange($(this).attr("id").replace(/^\D+/g,""));};range.on({input:function(){$(this).next().html(this.value)}});range.each(function(){$(this).next().html(this.value);if($(this).attr("callbackSet")!="true"){if(!isDiscrete){$(this).on({input:slidercb});}else{$(this).on({change:slidercb});}
|
||||
$(this).attr("callbackSet","true");}});};var addToHTML=function(data){panelStyle=data.hasOwnProperty('panelStyle')?" style='"+data.panelStyle+"' ":"";panelwide=data.hasOwnProperty('wide')?"wide":"";if(!data.hasOwnProperty('parentControl')||$("#tab"+data.parentControl).length>0){var parent=data.hasOwnProperty('parentControl')?$("#tab"+data.parentControl):$("#row");var html="";switch(data.type){case UI_LABEL:case UI_BUTTON:case UI_SWITCHER:case UI_CPAD:case UI_PAD:case UI_SLIDER:case UI_NUMBER:case UI_TEXT_INPUT:case UI_SELECT:case UI_GRAPH:case UI_GAUGE:case UI_ACCEL:html="<div id='id"+data.id+"' "+panelStyle+" class='two columns "+panelwide+" card tcenter "+
|
||||
@ -98,4 +98,5 @@ data.value+"</span></div>";case UI_NUMBER:return"<input style='color:black;' "+e
|
||||
"' type='number' value='"+data.value+"' onchange='numberchange("+id+")' />";case UI_ACCEL:return"ACCEL // Not implemented fully!<div class='accelerometer' id='accel"+id+
|
||||
"' ><div class='ball"+id+"'></div><pre class='accelerometeroutput"+id+"'></pre>";default:return"";}}
|
||||
var processEnabled=function(data){switch(data.type){case UI_SWITCHER:case UPDATE_SWITCHER:if(data.enabled){$("#sl"+data.id).removeClass('disabled');$("#s"+data.id).prop("disabled",false);}else{$("#sl"+data.id).addClass('disabled');$("#s"+data.id).prop("disabled",true);}
|
||||
break;case UI_SLIDER:case UPDATE_SLIDER:$("#sl"+data.id).prop("disabled",!data.enabled);break;case UI_NUMBER:case UPDATE_NUMBER:$("#num"+data.id).prop("disabled",!data.enabled);break;case UI_TEXT_INPUT:case UPDATE_TEXT_INPUT:$("#text"+data.id).prop("disabled",!data.enabled);break;case UI_SELECT:case UPDATE_SELECT:$("#select"+data.id).prop("disabled",!data.enabled);break;case UI_BUTTON:case UPDATE_BUTTON:$("#btn"+data.id).prop("disabled",!data.enabled);break;}}
|
||||
break;case UI_SLIDER:case UPDATE_SLIDER:$("#sl"+data.id).prop("disabled",!data.enabled);break;case UI_NUMBER:case UPDATE_NUMBER:$("#num"+data.id).prop("disabled",!data.enabled);break;case UI_TEXT_INPUT:case UPDATE_TEXT_INPUT:$("#text"+data.id).prop("disabled",!data.enabled);break;case UI_SELECT:case UPDATE_SELECT:$("#select"+data.id).prop("disabled",!data.enabled);break;case UI_BUTTON:case UPDATE_BUTTON:$("#btn"+data.id).prop("disabled",!data.enabled);break;case UI_PAD:case UI_CPAD:case UPDATE_PAD:case UPDATE_CPAD:if(data.enabled){$("#id"+data.id+" nav").removeClass('disabled');}else{$("#id"+data.id+" nav").addClass('disabled');}
|
||||
break;}}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user