mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
fhemweb.js: add dialog in smallscreen mode for webCmd if hiddenroom=detail (Forum #49930)
git-svn-id: https://svn.fhem.de/fhem/trunk@10956 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
19fc038d05
commit
7eaa3bab8e
@ -196,9 +196,45 @@ FW_jqueryReadyFn()
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
FW_smallScreenCommands();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show the webCmd list in a dialog if: smallScreen & hiddenroom=detail & room
|
||||||
|
function
|
||||||
|
FW_smallScreenCommands()
|
||||||
|
{
|
||||||
|
if($("div#menu select").length == 0 || // not SmallScreen
|
||||||
|
$("div#content").attr("room") == undefined || // not room Overview
|
||||||
|
$("div#content div.col1 a").length > 0) // no hiddenroom=detail
|
||||||
|
return;
|
||||||
|
|
||||||
|
$("div#content div.col1").each(function(){
|
||||||
|
var tr = $(this).closest("tr");
|
||||||
|
if($(tr).find("> td").length <= 2)
|
||||||
|
return;
|
||||||
|
$(this).html("<a href='#'>"+$(this).html()+"</a>");
|
||||||
|
$(this).find("a").click(function(){
|
||||||
|
var t = $("<table></table>"), row=0;
|
||||||
|
$(tr).find("> td").each(function(){
|
||||||
|
$(t).append("<tr></tr>");
|
||||||
|
if(row++ == 0) {
|
||||||
|
$(t).find("tr:last").append($(this).find("a").html());
|
||||||
|
} else {
|
||||||
|
$(this).attr("data-orig", 1);
|
||||||
|
this.orig=$(this).parent();
|
||||||
|
$(t).find("tr:last").append($(this).detach());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
FW_okDialog(t, this, function(){
|
||||||
|
$("#FW_okDialog [data-orig]").each(function(){
|
||||||
|
$(this).detach().appendTo(this.orig);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(window.jQuery) {
|
if(window.jQuery) {
|
||||||
$(document).ready(FW_jqueryReadyFn);
|
$(document).ready(FW_jqueryReadyFn);
|
||||||
@ -282,16 +318,19 @@ FW_errmsg(txt, timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
FW_okDialog(txt, parent)
|
FW_okDialog(txt, parent, removeFn)
|
||||||
{
|
{
|
||||||
var div = $("<div id='FW_okDialog'>");
|
var div = $("<div id='FW_okDialog'>");
|
||||||
$(div).html(txt);
|
$(div).html(txt);
|
||||||
$("body").append(div);
|
$("body").append(div);
|
||||||
|
var oldPos = $("body").scrollTop();
|
||||||
$(div).dialog({
|
$(div).dialog({
|
||||||
dialogClass:"no-close", modal:true, width:"auto", closeOnEscape:true,
|
dialogClass:"no-close", modal:true, width:"auto", closeOnEscape:true,
|
||||||
maxWidth:$(window).width()*0.9, maxHeight:$(window).height()*0.9,
|
maxWidth:$(window).width()*0.9, maxHeight:$(window).height()*0.9,
|
||||||
buttons: [{text:"OK", click:function(){
|
buttons: [{text:"OK", click:function(){
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
|
if(removeFn)
|
||||||
|
removeFn();
|
||||||
$(div).remove();
|
$(div).remove();
|
||||||
}}]
|
}}]
|
||||||
});
|
});
|
||||||
@ -304,6 +343,7 @@ FW_okDialog(txt, parent)
|
|||||||
my: "left top", at: "right bottom",
|
my: "left top", at: "right bottom",
|
||||||
of: parent, collision: "flipfit"
|
of: parent, collision: "flipfit"
|
||||||
});
|
});
|
||||||
|
setTimeout(function(){$("body").scrollTop(oldPos);}, 1); // Not ideal.
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
|
@ -61,14 +61,14 @@ button.dist { margin:5px; }
|
|||||||
|
|
||||||
/* Landscape mode */
|
/* Landscape mode */
|
||||||
@media all and (orientation:landscape) {
|
@media all and (orientation:landscape) {
|
||||||
div.col1 { width: 282px; }
|
div.col1 { width:282px; }
|
||||||
div.col2 { width: 108px; }
|
div.col2 { width:108px; }
|
||||||
div.col3 { width: 108px; height: 30px; }
|
div.col3 { width:100%; min-width:108px; height:30px; }
|
||||||
|
|
||||||
table.block input { text-align: center; }
|
table.block input { text-align: center; }
|
||||||
table.block tr td:nth-child(3) { text-align: center; }
|
table.block tr td:nth-child(3) { text-align: center; }
|
||||||
|
|
||||||
table.block div.slider { width: 108px; text-align: center; }
|
table.block div.slider { min-width: 108px; text-align: center; }
|
||||||
table.block slider { float: none; }
|
table.block slider { float: none; }
|
||||||
table.block select { text-align: center; }
|
table.block select { text-align: center; }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user