add open web link to mobile ui (#5985)
Signed-off-by: si458 <simonsmith5521@gmail.com>
Simon Smith committed
Apr 2, 2024 at 23:36 UTC
5d1c8ca68b24b3d0986cd3c9d5279acf1030c0cc
1 file changed
+17
views/default-mobile.handlebars
+17
@@ -926,6 +926,7 @@
926
<div style=float:right;text-align:right>
927
<span id=DeskChatButton><img src='images/icon-chat.png' onclick=deviceChat(event) height=16 width=16 style=padding-top:5px;cursor:pointer /></span>
928
<span id=DeskToastButton><img src='images/icon-notify.png' onclick=deviceToastFunction() height=16 width=16 style=padding-top:5px;cursor:pointer /></span>
929
+ <span id=DeskOpenWebButton><img src='images/icon-url2.png' onclick=deviceUrlFunction() height=16 width=16 style=padding-top:5px;cursor:pointer /></span>
930
<!--<input id=DeskToolsButton type=button value=Tools onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()"> -->
931
</div>
932
<div>
@@ -3940,6 +3941,22 @@
3941
}, "Start chat session?");
3942
}
3943
3944
+ function deviceUrlFunction() {
3945
+ if (xxdialogMode) return;
3946
+ setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll onkeyup=deviceUrlFunctionValidate() onchange=deviceUrlFunctionValidate()></input>');
3947
+ Q('d2devurl').focus();
3948
+ deviceUrlFunctionValidate();
3949
+ }
3950
+
3951
+ function deviceUrlFunctionValidate() {
3952
+ var x = Q('d2devurl').value.toLowerCase();
3953
+ QE('idx_dlgOkButton', ((x.startsWith('http://') && (x.length > 7)) || (x.startsWith('https://') && (x.length > 8))));
3954
+ }
3955
+
3956
+ function deviceUrlFunctionEx() {
3957
+ meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: Q('d2devurl').value });
3958
+ }
3959
+
3960
// Look to see if we need to update the device timeline
3961
function updateDeviceTimeline() {
3962
if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null) || (currentNode.mtype == 3)) return;