mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
fhemweb.js: show Apply changes only if needed.
git-svn-id: https://svn.fhem.de/fhem/trunk@12418 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3fc4df2ae3
commit
e7ced7abbc
@ -602,20 +602,33 @@ FW_rawDef()
|
||||
'<textarea id="td_longText" rows="25" cols="60" style="width:99%"/>'+
|
||||
'<button>Apply changes</button>'+
|
||||
'</div></br>');
|
||||
|
||||
FW_cmd(FW_root+"?cmd=list -r "+dev+"&XHR=1", function(data) {
|
||||
data = data.replace("define", "defmod");
|
||||
$("#rawDef textarea").val(data);
|
||||
var off = $("#rawDef").position().top-20;
|
||||
$('body, html').animate({scrollTop:off}, 500);
|
||||
$("#rawDef button").hide();
|
||||
|
||||
$('#rawDef textarea').bind('input propertychange', function() {
|
||||
var nData = $("#rawDef textarea").val();
|
||||
if(nData != data)
|
||||
$("#rawDef button").show();
|
||||
else
|
||||
$("#rawDef button").hide();
|
||||
});
|
||||
});
|
||||
|
||||
$("#rawDef button").click(function(){
|
||||
var data = $("#rawDef textarea").val();
|
||||
var arr = data.split("\n"), str="", i1=-1;
|
||||
function
|
||||
doNext()
|
||||
{
|
||||
if(++i1 >= arr.length)
|
||||
if(++i1 >= arr.length) {
|
||||
return FW_okDialog("Applied changes, no errors found.");
|
||||
return;
|
||||
}
|
||||
str += arr[i1];
|
||||
if(arr[i1].charAt(arr[i1].length-1) === "\\") {
|
||||
str += "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user