forked from node-red/node-red-nodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
what3words.html
89 lines (86 loc) · 3.73 KB
/
what3words.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
<script type="text/x-red" data-template-name="what3words">
<div class="form-row">
<label for="node-input-property"><i class="fa fa-ellipsis-h"></i> <span data-i18n="node-red:common.label.property"></span></label>
<input type="text" id="node-input-property" style="width:70%;"/>
</div>
<div class="form-row">
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-input-apikey">
</div>
<div class="form-row">
<label for="node-input-lang"><i class="fa fa-language"></i> Language</label>
<select type="text" id="node-input-lang" style="width:73%;">
<option value="de">German</option>
<option value="no">Norwegian</option>
<option value="fi">Finnish</option>
<option value="ru">Russian</option>
<option value="pt">Portuguese</option>
<option value="fr">French</option>
<option value="id">Bahasa Indonesia</option>
<option value="mn">Mongolian</option>
<option value="sv">Swedish</option>
<option value="ko">Korean</option>
<option value="sw">Swahili</option>
<option value="af">Afrikaans</option>
<option value="el">Greek</option>
<option value="en">English</option>
<option value="it">Italian</option>
<option value="es">Spanish</option>
<option value="zh">Chinese</option>
<option value="cs">Czech</option>
<option value="xh">Xhosa</option>
<option value="ar">Arabic</option>
<option value="th">Thai</option>
<option value="ja">Japanese</option>
<option value="zu">Zulu</option>
<option value="pl">Polish</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option value="tr">Turkish</option>
</select>
</div>
<br/>
<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/x-red" data-help-name="what3words">
<p>Uses what3words to convert a location to a unique three.word.combination .</p>
<p>Expects either <ul>
<li><code>msg.location.lat</code> and <code>msg.location.lon</code>, or </li>
<li><code>msg.payload</code> to contain a <i>lat,lon</i> string,</li>
</ul> and produces a msg.payload of unique.three.words .</p>
<p>Also does the reverse by accepting a <b>dot (.)</b> separated three.word.string in <code>msg.payload</code>,
and adds the corresponding <code>msg.location</code> property.</p>
<p><b>Note:</b> This is an online service and requires a live internet connection.</p>
<p>The API-key is stored in a separate credentials file.</p>
<p>See <i><a href="http://www.what3words.com/" target="_new">what3words</a></i> for more details.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('what3words',{
category: 'location',
defaults: {
name: {value:""},
property: {value:"payload",required:true},
title: {value:""},
lang: {value:"en"}
},
credentials: {
apikey: {type: "password"}
},
color:"#DEBD5C",
inputs:1,
outputs:1,
icon: "what3words.png",
label: function() {
return this.name||"what3words";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
$("#node-input-property").typedInput({default:'msg',types:['msg']});
}
});
</script>