2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

98_DOIFtools.pm: fixed browser issues for Chrome(event monitor dialog) and IE(lookup window and event selection in event monitor)

git-svn-id: https://svn.fhem.de/fhem/trunk@13921 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Ellert 2017-04-07 17:41:40 +00:00
parent 1d11d6a6df
commit 709cb8adfd
2 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- bugfix: 98_DOIFtools: fixed browser issues for Chrome and IE
- feature: 98_monitoring: whitelist attribute added - feature: 98_monitoring: whitelist attribute added
- feature: 93_DbRep: support of primary key (set in table history/current) - feature: 93_DbRep: support of primary key (set in table history/current)
- update: 88_HMCCU: Optimized reading update performance - update: 88_HMCCU: Optimized reading update performance

View File

@ -57,11 +57,13 @@ function doiftoolsCopyToClipboard() {
var txtarea = document.getElementById("console"); var txtarea = document.getElementById("console");
var start = txtarea.selectionStart; var start = txtarea.selectionStart;
var finish = txtarea.selectionEnd; var finish = txtarea.selectionEnd;
var txt = txtarea.value.substring(start, finish); var txt = $("textarea#console").text().substring(start, finish);
var hlp = lang ? "Bitte, genau eine komplette Event-Zeile markieren." : "Please highlight exactly one complete event line"; var hlp = lang ? "Bitte, genau eine komplette Event-Zeile markieren." : "Please highlight exactly one complete event line";
$('#console').attr('disabled', 'disabled');
$('#console').removeAttr('disabled');
if(!txt) if(!txt)
return FW_okDialog(hlp); return FW_okDialog(hlp);
var redi=/^....-..-..\s..:..:..(\....)?\s([^\s]+)\s([^\s]+)\s([^\s]+:\s)?(.*)([\r\n]*)?$/; var redi=/^....-..-..\s..:..:..(\....)?\s([^\s]+)\s([^\s]+)\s([^\s]+:\s)?(.*)([\n]*)?$/;
var retdi = txt.match(redi); var retdi = txt.match(redi);
if(!retdi) if(!retdi)
return FW_okDialog(hlp); return FW_okDialog(hlp);
@ -220,6 +222,9 @@ function doiftoolsOptChanged() {
inpt.setSelectionRange(7,17+N); inpt.setSelectionRange(7,17+N);
} }
} }
function doiftoolsReplaceBR() {
$("textarea#console").html($("textarea#console").html().replace(/<br>/g,""));
}
function delbutton() { function delbutton() {
if ($('#doiftoolstype').attr('embefore') == 1) { if ($('#doiftoolstype').attr('embefore') == 1) {
@ -238,6 +243,8 @@ function delbutton() {
//execute //execute
$( window ).on( "load", delbutton ); $( window ).on( "load", delbutton );
$('#console').on('select', doiftoolsCopyToClipboard); $('#console').on('select', doiftoolsCopyToClipboard);
$('#console').on('mouseover',doiftoolsReplaceBR);
$('#console').on('mousedown',doiftoolsReplaceBR);
</script> </script>
EOF EOF
my $DOIFtoolsJSfuncStart = <<'EOF'; my $DOIFtoolsJSfuncStart = <<'EOF';
@ -254,20 +261,20 @@ function doiftoolsAddLookUp () {
var devList = JSON.parse(data); var devList = JSON.parse(data);
var dev = devList.Results[0]; var dev = devList.Results[0];
var row = 0; var row = 0;
for (item in dev.Internals) { for (var item in dev.Internals) {
if (item == "DEF") {dev.Internals[item] = "<pre>"+dev.Internals[item]+"</pre>"} if (item == "DEF") {dev.Internals[item] = "<pre>"+dev.Internals[item]+"</pre>"}
var cla = ((row++&1)?"odd":"even"); var cla = ((row++&1)?"odd":"even");
txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Internals[item].replace(/\n/g,"<br>")+"</td></tr>\n"; txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Internals[item].replace(/\n/g,"<br>")+"</td></tr>\n";
} }
txt += "</table>Readings<table class='block wide readings' style='font-size:12px'><br>"; txt += "</table>Readings<table class='block wide readings' style='font-size:12px'><br>";
row = 0; row = 0;
for (item in dev.Readings) { for (var item in dev.Readings) {
var cla = ((row++&1)?"odd":"even"); var cla = ((row++&1)?"odd":"even");
txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Readings[item].Value+"</td><td>"+dev.Readings[item].Time+"</td></tr>\n"; txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Readings[item].Value+"</td><td>"+dev.Readings[item].Time+"</td></tr>\n";
} }
txt += "</table>Attributes<table class='block wide attributes' style='font-size:12px'><br>"; txt += "</table>Attributes<table class='block wide attributes' style='font-size:12px'><br>";
row = 0; row = 0;
for (item in dev.Attributes) { for (var item in dev.Attributes) {
if (item.match(/(userReadings|wait|setList)/) ) {dev.Attributes[item] = "<pre>"+dev.Attributes[item]+"</pre>"} if (item.match(/(userReadings|wait|setList)/) ) {dev.Attributes[item] = "<pre>"+dev.Attributes[item]+"</pre>"}
var cla = ((row++&1)?"odd":"even"); var cla = ((row++&1)?"odd":"even");
txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Attributes[item]+"</td></tr>\n"; txt += "<tr class='"+cla+"'><td>"+item+"</td><td>"+dev.Attributes[item]+"</td></tr>\n";