mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 04:36:36 +00:00
fhemweb_colorpicker.js: use loadScript to load jscolor
Color.pm: don't use FHEM_colorpickerInit/$data{FWEXT}{colorpicker}{SCRIPT} git-svn-id: https://svn.fhem.de/fhem/trunk@7516 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fa12df2a36
commit
02273ef79f
@ -11,13 +11,13 @@ use vars qw($FW_ME);
|
||||
sub
|
||||
Color_Initialize()
|
||||
{
|
||||
FHEM_colorpickerInit();
|
||||
#FHEM_colorpickerInit();
|
||||
}
|
||||
|
||||
sub
|
||||
FHEM_colorpickerInit()
|
||||
{
|
||||
$data{FWEXT}{colorpicker}{SCRIPT} = "/jscolor/jscolor.js";
|
||||
#$data{FWEXT}{colorpicker}{SCRIPT} = "/jscolor/jscolor.js";
|
||||
}
|
||||
|
||||
my %dim_values = (
|
||||
|
@ -59,25 +59,26 @@ FW_colorpickerCreate(elName, devName, vArr, currVal, set, params, cmd)
|
||||
|
||||
var inp = $(newEl).find("[type=text]");
|
||||
|
||||
var myPicker = new jscolor.color(inp.get(0),
|
||||
loadScript("jscolor/jscolor.js",
|
||||
function() {
|
||||
var myPicker = new jscolor.color(inp.get(0),
|
||||
{pickerMode:'RGB',pickerFaceColor:'transparent',pickerFace:3,pickerBorder:0,pickerInsetColor:'red'});
|
||||
inp.get(0).color = myPicker;
|
||||
inp.get(0).color = myPicker;
|
||||
|
||||
if( currVal ) {
|
||||
if( currVal.length > 6 ) currVal = currVal.slice(0,6);
|
||||
myPicker.fromString(currVal);
|
||||
}
|
||||
if( elName )
|
||||
$(inp).attr("name", elName);
|
||||
|
||||
if( elName )
|
||||
$(inp).attr("name", elName);
|
||||
if( cmd )
|
||||
$(newEl).change(function(arg) { cmd( myPicker.toString() ) });
|
||||
else
|
||||
$(newEl).change(function(arg) { $(inp).attr("value", myPicker.toString() ) });
|
||||
|
||||
if( cmd )
|
||||
$(newEl).change(function(arg) { cmd( myPicker.toString() ) });
|
||||
else
|
||||
$(newEl).change(function(arg) { $(inp).attr("value", myPicker.toString() ) });
|
||||
newEl.setValueFn = function(arg){ if( arg.length > 6 ) arg = arg.slice(0,6);
|
||||
myPicker.fromString(arg); };
|
||||
|
||||
newEl.setValueFn = function(arg){ if( arg.length > 6 ) arg = arg.slice(0,6);
|
||||
myPicker.fromString(arg); };
|
||||
if( currVal )
|
||||
newEl.setValueFn(currVal);
|
||||
});
|
||||
|
||||
return newEl;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user