-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
97 lines (93 loc) · 3.91 KB
/
test.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<script type="text/javascript">
RED.nodes.registerType('googlehome-config-node-offline', {
category: 'config',
defaults: {
ipaddress: {
value: "",
required: true
},
name: {
value: ""
},
language: {
value: "en"
},
notificationLevel: {
value: 50
}
},
label: function () {
return this.name || this.ipaddress;
},
oneditprepare: function () {
var node = this;
var options = $("#node-input-language");
//Calling the API built by NodeJS code
$.getJSON('/languages', function (languages) {
$.each(languages, function (l, language) {
options.append($("<option />").val(language.key).text(language.value));
options.val(node.language);
});
});
try {
$("#node-config-input-ipaddress").autocomplete("destroy");
} catch (err) { }
$("#node-config-lookup-ipaddress").click(function () {
$("#node-config-lookup-ipaddress-icon").removeClass('fa-search');
$("#node-config-lookup-ipaddress-icon").addClass('spinner');
$("#node-config-lookup-ipaddress").addClass('disabled');
$.getJSON('ipaddresses', function (data) {
$("#node-config-lookup-ipaddress-icon").addClass('fa-search');
$("#node-config-lookup-ipaddress-icon").removeClass('spinner');
$("#node-config-lookup-ipaddress").removeClass('disabled');
var ipaddresses = [];
$.each(data, function (i, ip) {
ipaddresses.push(ip);
});
$("#node-config-input-ipaddress").autocomplete({
source: ipaddresses,
minLength: 0,
close: function (event, ui) {
$("#node-config-input-ipaddress").autocomplete("destroy");
}
}).autocomplete("search", "");
});
});
},
oneditsave: function () {
var node = this;
node.language = $("#node-input-language").val();
}
});
</script>
<script type="text/x-red" data-template-name="googlehome-config-node-offline">
<div class="form-row">
<label for="node-config-input-ipaddress"><i class="icon-bookmark"></i> IP Adress</label>
<input type="text" id="node-config-input-ipaddress" style="width:60%;" placeholder="192.168.xxx.xxx"/>
<a id="node-config-lookup-ipaddress" class="btn"><i id="node-config-lookup-ipaddress-icon" class="fa fa-search"></i></a>
</div>
<div class="form-row">
<label for="node-config-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-config-input-name" style="width:60%;" placeholder="Google Home Mini"/>
</div>
<div class="form-row">
<label for="node-input-language"><i class="fa fa-globe"></i> Language</label>
<select id="node-input-language" style="width:60%;">
<option value="en"> English</option>
</select>
</div>
<div class="form-row">
<label for="node-input-language" style="width:40%;"><i class="fa fa-volume-up" ></i> Default notification level (%)</label>
<input type="text" id="node-config-input-notificationLevel" style="width:10%;" placeholder="50"/>
<label for="node-config-input-name" ><i class="icon-tag"></i> Overridable</label>
<input type="checkbox" checked data-toggle="toggle" class="red-ui-tab-link-button">
</div>
<div class="form-row">
<label for="node-input-language"><i class="fa fa-volume-up"></i> <span data-i18n="node-red:tcpin.label.type">Default notification level (%)</span></label>
<select id="node-input-language" style="width:120px; margin-right:5px;">
<option value="server" data-i18n="node-red:tcpin.type.listen">Listen on</option>
<option value="client" data-i18n="node-red:tcpin.type.connect">Connect to</option>
</select>
<span data-i18n="node-red:tcpin.label.port">port</span> <input type="text" id="node-input-port" style="width:65px" autocomplete="disable" dir="" class="input-error">
</div>
</script>