2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

use widget module to update colorpicker in longpoll

git-svn-id: https://svn.fhem.de/fhem/trunk@3432 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-07-15 21:39:00 +00:00
parent e1965eb586
commit f488484516
4 changed files with 30 additions and 14 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII # Add changes at the top of the list. Keep it in ASCII
- SVN - SVN
- feature: FHEMWEB use widget module to update colorpicker in longpoll
- feature: FHEMWEB widget (slider/etc) javascript handler modularized - feature: FHEMWEB widget (slider/etc) javascript handler modularized
- feature: FHEMWEB longpoll in multiple browserwindows - feature: FHEMWEB longpoll in multiple browserwindows
- feature: fhem.pl: version command added - feature: fhem.pl: version command added

View File

@ -135,7 +135,7 @@ HUEDevice_colorpickerFn($$$)
} else { } else {
my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\""; my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\"";
return '<td align="center">'. return '<td align="center">'.
"<input class='color {pickerMode:'$mode'}' value='#$cv' onchange='setColor(this,\"$mode\",$c)'\"/>". "<input class='color {pickerMode:'$mode'}' value='#$cv' onchange='colorpicker_setColor(this,\"$mode\",$c)'\"/>".
'</td>'; '</td>';
} }
} }

View File

@ -992,17 +992,4 @@ var jscolor = {
}; };
function
setColor(el,mode,cmd)
{
var v = el.color;
if(mode=="HSV") {
v = (0x100 | Math.round(42*el.color.hsv[0])).toString(16).substr(1) +
(0x100 | Math.round(255*el.color.hsv[1])).toString(16).substr(1) +
(0x100 | Math.round(255*el.color.hsv[2])).toString(16).substr(1);
}
if(cmd)
document.location = cmd.replace('%',v);
}
jscolor.install(); jscolor.install();

View File

@ -0,0 +1,28 @@
function
FW_colorpickerUpdateLine(d)
{
el = document.getElementById(name);
if(el) {
el.setAttribute('value', '#d');
}
}
function
colorpicker_setColor(el,mode,cmd)
{
var v = el.color;
if(mode=="HSV") {
v = (0x100 | Math.round(42*el.color.hsv[0])).toString(16).substr(1) +
(0x100 | Math.round(255*el.color.hsv[1])).toString(16).substr(1) +
(0x100 | Math.round(255*el.color.hsv[2])).toString(16).substr(1);
}
if(cmd)
document.location = cmd.replace('%',v);
}
FW_widgets['colorpicker'] = {
updateLine:FW_colorpickerUpdateLine
};