2015-05-29 18:49:19 +02:00
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="what3words">
|
2018-01-31 12:18:30 +01:00
|
|
|
<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>
|
2015-05-29 18:49:19 +02:00
|
|
|
<div class="form-row">
|
2017-03-10 00:17:40 +01:00
|
|
|
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
|
|
|
|
<input type="password" id="node-input-apikey">
|
2015-05-29 18:49:19 +02:00
|
|
|
</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="en">English</option>
|
|
|
|
<option value="de">German</option>
|
|
|
|
<option value="es">Spanish</option>
|
|
|
|
<option value="fr">French</option>
|
|
|
|
<option value="pt">Portuguese</option>
|
|
|
|
<option value="ru">Russian</option>
|
|
|
|
<option value="sv">Swedish</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>
|
2016-03-02 14:27:48 +01:00
|
|
|
<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>
|
2015-05-29 18:49:19 +02:00
|
|
|
</ul> and produces a msg.payload of unique.three.words .</p>
|
2016-11-06 21:26:19 +01:00
|
|
|
<p>Also does the reverse by accepting a <b>dot (.)</b> separated three.word.string in <code>msg.payload</code>,
|
2016-03-02 14:27:48 +01:00
|
|
|
and adds the corresponding <code>msg.location</code> property.</p>
|
2015-05-29 18:49:19 +02:00
|
|
|
<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: {
|
2018-01-31 12:18:30 +01:00
|
|
|
name: {value:""},
|
|
|
|
property: {value:"payload",required:true},
|
2015-05-29 18:49:19 +02:00
|
|
|
title: {value:""},
|
2018-01-31 12:18:30 +01:00
|
|
|
lang: {value:"en"}
|
2015-05-29 18:49:19 +02:00
|
|
|
},
|
2017-03-10 00:17:40 +01:00
|
|
|
credentials: {
|
|
|
|
apikey: {type: "password"}
|
|
|
|
},
|
2015-05-29 18:49:19 +02:00
|
|
|
color:"#DEBD5C",
|
|
|
|
inputs:1,
|
|
|
|
outputs:1,
|
|
|
|
icon: "arrow-in.png",
|
|
|
|
label: function() {
|
|
|
|
return this.name||"what3words";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2018-02-03 00:38:26 +01:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
|
|
|
$("#node-input-property").typedInput({default:'msg',types:['msg']});
|
2015-05-29 18:49:19 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|