mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
fhemweb.js: fixing inline attribtue changes (Forum #52379)
git-svn-id: https://svn.fhem.de/fhem/trunk@11328 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
431413e11f
commit
f2ffa13962
@ -2512,7 +2512,7 @@ FW_Notify($$)
|
|||||||
|
|
||||||
if($dev->{CHANGED}) {
|
if($dev->{CHANGED}) {
|
||||||
$dn = $1 if($dev->{CHANGED}->[0] =~ m/^MODIFIED (.*)$/);
|
$dn = $1 if($dev->{CHANGED}->[0] =~ m/^MODIFIED (.*)$/);
|
||||||
if($dev->{CHANGED}->[0] =~ m/^ATTR ([^ ]+) ([^ ]+) (.*)$/) {
|
if($dev->{CHANGED}->[0] =~ m/^ATTR ([^ ]+) ([^ ]+) (.*)$/s) {
|
||||||
$dn = $1;
|
$dn = $1;
|
||||||
my @a = ("$2: $3");
|
my @a = ("$2: $3");
|
||||||
$events = \@a;
|
$events = \@a;
|
||||||
|
@ -500,10 +500,10 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
|
|||||||
var newDef = typeof cm !== 'undefined' ?
|
var newDef = typeof cm !== 'undefined' ?
|
||||||
cm.getValue() : $(this).closest("form").find("textarea").val();
|
cm.getValue() : $(this).closest("form").find("textarea").val();
|
||||||
var cmd = $(this).attr("name")+"="+$(this).attr("value")+" "+newDef;
|
var cmd = $(this).attr("name")+"="+$(this).attr("value")+" "+newDef;
|
||||||
var noDef;
|
var isDef = true;
|
||||||
|
|
||||||
if( newDef == undefined ) {
|
if( newDef == undefined ) {
|
||||||
noDef = true;
|
isDef = false;
|
||||||
var div = $(this).closest("div.makeSelect");
|
var div = $(this).closest("div.makeSelect");
|
||||||
var devName = $(div).attr("dev"),
|
var devName = $(div).attr("dev"),
|
||||||
cmd = $(div).attr("cmd");
|
cmd = $(div).attr("cmd");
|
||||||
@ -527,9 +527,9 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
|
|||||||
newDef = newDef.replace(/&/g, '&') // Same as in 01_FHEMWEB
|
newDef = newDef.replace(/&/g, '&') // Same as in 01_FHEMWEB
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>');
|
.replace(/>/g, '>');
|
||||||
if(newDef.indexOf("\n") >= 0)
|
if(isDef) {
|
||||||
newDef = '<pre>'+newDef+'</pre>';
|
if(newDef.indexOf("\n") >= 0)
|
||||||
if(!noDef) {
|
newDef = '<pre>'+newDef+'</pre>';
|
||||||
$("div#disp").html(newDef).css("display", "");
|
$("div#disp").html(newDef).css("display", "");
|
||||||
$("div#edit").css("display", "none");
|
$("div#edit").css("display", "none");
|
||||||
}
|
}
|
||||||
@ -580,9 +580,11 @@ FW_doUpdate()
|
|||||||
} else {
|
} else {
|
||||||
$("[informId='"+d[0]+"']").each(function(){
|
$("[informId='"+d[0]+"']").each(function(){
|
||||||
if(this.setValueFn) { // change the select/etc value
|
if(this.setValueFn) { // change the select/etc value
|
||||||
this.setValueFn(d[1]);
|
this.setValueFn(d[1].replace(/\n/g, '\u2424'));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if(d[2].match(/\n/))
|
||||||
|
d[2] = '<pre>'+d[2]+'</pre>';
|
||||||
$(this).html(d[2]); // Readings-Value
|
$(this).html(d[2]); // Readings-Value
|
||||||
if(d[0].match(/-ts$/)) // timestamps
|
if(d[0].match(/-ts$/)) // timestamps
|
||||||
$(this).addClass('changed');
|
$(this).addClass('changed');
|
||||||
@ -823,7 +825,7 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
|
|||||||
$("#td_longText").val(txt);
|
$("#td_longText").val(txt);
|
||||||
|
|
||||||
var cm;
|
var cm;
|
||||||
if( typeof AddCodeMirror == 'function' && !$("#td_longText").get(0).editor) {
|
if(typeof AddCodeMirror == 'function' && !$("#td_longText").get(0).editor) {
|
||||||
$("#td_longText").get(0).editor = true;
|
$("#td_longText").get(0).editor = true;
|
||||||
AddCodeMirror($("#td_longText").get(0), function(pcm) {cm = pcm;});
|
AddCodeMirror($("#td_longText").get(0), function(pcm) {cm = pcm;});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user