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;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control a.confirm:active {
|
.control:not(.disabled) a.confirm:active {
|
||||||
background-color: #777;
|
background-color:#777
|
||||||
}
|
}
|
||||||
|
.control:not(.disabled) li:active {
|
||||||
.control li:active {
|
background-color:#777
|
||||||
background-color: #777;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch
|
/* 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
57
data/js/controls.js
vendored
57
data/js/controls.js
vendored
@ -647,27 +647,29 @@ function buttonclick(number, isdown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function padclick(type, number, isdown) {
|
function padclick(type, number, isdown) {
|
||||||
switch (type) {
|
if(!$("#id" + number + " nav").hasClass("disabled")) {
|
||||||
case CENTER:
|
switch (type) {
|
||||||
if (isdown) websock.send("pcdown:" + number);
|
case CENTER:
|
||||||
else websock.send("pcup:" + number);
|
if (isdown) websock.send("pcdown:" + number);
|
||||||
break;
|
else websock.send("pcup:" + number);
|
||||||
case UP:
|
break;
|
||||||
if (isdown) websock.send("pfdown:" + number);
|
case UP:
|
||||||
else websock.send("pfup:" + number);
|
if (isdown) websock.send("pfdown:" + number);
|
||||||
break;
|
else websock.send("pfup:" + number);
|
||||||
case DOWN:
|
break;
|
||||||
if (isdown) websock.send("pbdown:" + number);
|
case DOWN:
|
||||||
else websock.send("pbup:" + number);
|
if (isdown) websock.send("pbdown:" + number);
|
||||||
break;
|
else websock.send("pbup:" + number);
|
||||||
case LEFT:
|
break;
|
||||||
if (isdown) websock.send("pldown:" + number);
|
case LEFT:
|
||||||
else websock.send("plup:" + number);
|
if (isdown) websock.send("pldown:" + number);
|
||||||
break;
|
else websock.send("plup:" + number);
|
||||||
case RIGHT:
|
break;
|
||||||
if (isdown) websock.send("prdown:" + number);
|
case RIGHT:
|
||||||
else websock.send("prup:" + number);
|
if (isdown) websock.send("prdown:" + number);
|
||||||
break;
|
else websock.send("prup:" + number);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,7 +833,7 @@ var elementHTML = function(data) {
|
|||||||
var processEnabled = function(data) {
|
var processEnabled = function(data) {
|
||||||
//Handle the enabling and disabling of controls
|
//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
|
//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) {
|
switch(data.type) {
|
||||||
case UI_SWITCHER:
|
case UI_SWITCHER:
|
||||||
case UPDATE_SWITCHER:
|
case UPDATE_SWITCHER:
|
||||||
@ -868,5 +870,16 @@ var processEnabled = function(data) {
|
|||||||
case UPDATE_BUTTON:
|
case UPDATE_BUTTON:
|
||||||
$("#btn" + data.id).prop("disabled", !data.enabled);
|
$("#btn" + data.id).prop("disabled", !data.enabled);
|
||||||
break;
|
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 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 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 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);}}
|
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});}
|
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 "+
|
$(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+
|
"' 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"";}}
|
"' ><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);}
|
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