-
Notifications
You must be signed in to change notification settings - Fork 0
/
25-ismobile.html
50 lines (43 loc) · 1.45 KB
/
25-ismobile.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script type="text/javascript">
RED.nodes.registerType('IsMobile',{
color: '#e5e4ef',
icon: "font-awesome/fa-mobile",
category: 'introspection',
defaults: {
name: {
value:"",
},
},
inputs:0,
outputs:0,
label: function() {
return (this.name || this._def.paletteLabel);
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
onpaletteadd: () => {
setTimeout( function() {
RED.sidebar.info.show()
}, 1000);
if ( (RED.utils.getBrowserInfo().mobile > 0) || window.matchMedia('only screen and (max-width: 890px)').matches ) {
setTimeout( function() {
// taken from https://discourse.nodered.org/t/togglepalette-v-togglesidebar/78169/3
RED.actions.invoke("core:toggle-palette", false)
RED.actions.invoke("core:toggle-sidebar", false)
}, 1400);
}
},
onpaletteremove: () => {
},
});
</script>
<script type="text/html" data-template-name="IsMobile">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="IsMobile">
<p>A palette-only node, this does not get included in any flow. This node hides the palette bar and the sidebar on mobile devices. If not required, disable the node in the palette manager.</p>
</script>