mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +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:
parent
e1965eb586
commit
f488484516
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII
|
||||
- SVN
|
||||
- feature: FHEMWEB use widget module to update colorpicker in longpoll
|
||||
- feature: FHEMWEB widget (slider/etc) javascript handler modularized
|
||||
- feature: FHEMWEB longpoll in multiple browserwindows
|
||||
- feature: fhem.pl: version command added
|
||||
|
@ -135,7 +135,7 @@ HUEDevice_colorpickerFn($$$)
|
||||
} else {
|
||||
my $c = "\"$FW_ME?cmd=set $d $cmd %$srf\"";
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
28
fhem/www/pgm2/fhemweb_colorpicker.js
Normal file
28
fhem/www/pgm2/fhemweb_colorpicker.js
Normal 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
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user