2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

FHEMWEB: negative slider patch from Markus

git-svn-id: https://svn.fhem.de/fhem/trunk@3714 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-08-16 07:30:18 +00:00
parent 9ae0a74be4
commit 00180c5251
2 changed files with 4 additions and 5 deletions

View File

@ -2149,7 +2149,7 @@ FW_sliderFn($$$$$)
my $cv = ReadingsVal($d, $cmd, Value($d)); my $cv = ReadingsVal($d, $cmd, Value($d));
my $id = ($cmd eq "state") ? "" : "-$cmd"; my $id = ($cmd eq "state") ? "" : "-$cmd";
$cmd = "" if($cmd eq "state"); $cmd = "" if($cmd eq "state");
$cv =~ s/.*?(\d+).*/$1/; # get first number $cv =~ s/.*?([.\-\d]+).*/$1/; # get first number
$cv = 0 if($cv !~ m/\d/); $cv = 0 if($cv !~ m/\d/);
return "<td colspan='2'>". return "<td colspan='2'>".
"<div class='slider' id='slider.$d$id' min='$min' stp='$stp' ". "<div class='slider' id='slider.$d$id' min='$min' stp='$stp' ".

View File

@ -7,7 +7,6 @@ FW_sliderUpdateLine(d)
if(k == 1) if(k == 1)
name = name+"-"+d[1].replace(/[ \d].*$/,''); name = name+"-"+d[1].replace(/[ \d].*$/,'');
el = document.getElementById(name); el = document.getElementById(name);
if(el) { if(el) {
var doSet = 1; // Only set the "state" slider in the detail view var doSet = 1; // Only set the "state" slider in the detail view
if(el.parentNode.getAttribute("name") == "val.set"+d[0]) { if(el.parentNode.getAttribute("name") == "val.set"+d[0]) {
@ -18,8 +17,8 @@ FW_sliderUpdateLine(d)
} }
if(doSet) { if(doSet) {
var val = d[1].replace(/^.*?(\d+).*/g, "$1"); // get first number var val = d[1].replace(/^.*?([.\-\d]+).*/g, "$1"); // get first number
if(!val.match(/\d+/)) if(!val.match(/[.\-\d]+/))
val = 0; val = 0;
FW_sliderCreate(el, val); FW_sliderCreate(el, val);
} }
@ -133,7 +132,7 @@ FW_sliderSelChange(name, devName, vArr)
function function
FW_querySetSlider(el, val) FW_querySetSlider(el, val)
{ {
val = val.replace(/[^\d\.]/g, ""); // remove non numbers val = val.replace(/[^\d.\-]/g, ""); // remove non numbers
FW_sliderCreate(el, val); FW_sliderCreate(el, val);
} }