node-red-contrib-snap4city-user
Version:
Nodes for Snap4city project, targeted to standard user (no developer)
66 lines (60 loc) • 2.4 kB
HTML
<!--/* NODE-RED-CONTRIB-SNAP4CITY-DEVELOPER
Copyright (C) 2018 DISIT Lab http://www.disit.org - University of Florence
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */-->
<script type="text/x-red" data-template-name="show-micro-web-app">
<div class="form-row">
<label for="node-input-name">Name</label>
<input type="text" autocomplete="off" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="show-micro-web-app">
</script>
<script type="text/javascript">
var lnk = document.location.host + RED.settings.httpNodeRoot + "/s4cmicro";
var re = new RegExp('\/{1,}', 'g');
lnk = lnk.replace(re, '/');
if (!RED.hasOwnProperty("actions")) {
RED.keyboard.add("*", /* m */ 77, {
ctrl: true,
shift: true
}, function () {
window.open(document.location.protocol + "//" + lnk)
});
} else {
RED.keyboard.add("*", "ctrl-shift-m", "Show Map");
RED.actions.add("Show Map", function () {
window.open(document.location.protocol + "//" + lnk)
});
}
RED.nodes.registerType('show-micro-web-app', {
category: 'S4CView',
color: "#C0DEED",
defaults: {
name: {
value: ""
}
},
inputs: 1,
outputs: 0,
icon: "white-globe.png",
align: "right",
label: function () {
return this.name || "show micro web app";
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
info: function () {
return 'The map can be found [here](' + RED.settings.httpNodeRoot.slice(0, -1) + '/s4cmicro).';
}
});
</script>