1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/social/irc/91-irc.html

170 lines
7.3 KiB
HTML
Raw Normal View History

<script type="text/html" data-template-name="irc in">
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-ircserver"><i class="fa fa-globe"></i> <span data-i18n="irc.label.ircserver"></span></label>
<input type="text" id="node-input-ircserver">
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-channel"><i class="fa fa-random"></i> <span data-i18n="irc.label.channel"></span></label>
<input type="text" id="node-input-channel" placeholder="#nodered">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
2015-06-16 11:36:19 +02:00
<div class="form-tips"><span data-i18n="[html]irc.tip.in"></span></div>
</script>
<script type="text/javascript">
RED.nodes.registerType('irc in',{
category: 'social-input',
defaults: {
name: {value:""},
ircserver: {type:"irc-server", required:true},
channel: {value:"",required:true,validate:RED.validators.regex(/^#/)}
},
credentials: {
username: {type:"text"},
password: {type:"password"}
},
color:"Silver",
inputs:0,
outputs:2,
icon: "hash.png",
label: function() {
var ircNode = RED.nodes.node(this.ircserver);
return this.name || (ircNode ? ircNode.label() : "irc");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
if ((this.ircserver !== undefined) && (this.ircserver !== "")) {
this.channel = this.channel || RED.nodes.node(this.ircserver).channel;
$("#node-input-channel").val(this.channel);
}
else { this.channel = this.channel; }
$("#node-input-channel").val(this.channel);
}
});
</script>
<script type="text/html" data-template-name="irc out">
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-ircserver"><i class="fa fa-globe"></i> <span data-i18n="irc.label.ircserver"></span></label>
<input type="text" id="node-input-ircserver">
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-channel"><i class="fa fa-random"></i> <span data-i18n="irc.label.channel"></span></label>
<input type="text" id="node-input-channel" placeholder="#nodered">
</div>
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-input-sendObject"><i class="fa fa-arrows"></i> <span data-i18n="irc.label.action"></span></label>
<select type="text" id="node-input-sendObject" style="display: inline-block; vertical-align: middle; width:70%;">
2015-06-16 11:36:19 +02:00
<option value="pay" data-i18n="irc.payload"></option>
<option value="true" data-i18n="irc.topic"></option>
<option value="false" data-i18n="irc.msg"></option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
2015-06-16 11:36:19 +02:00
<div class="form-tips"><span data-i18n="[html]irc.tip.out"></span></div>
</script>
<script type="text/javascript">
RED.nodes.registerType('irc out',{
category: 'social-output',
defaults: {
name: {value:""},
sendObject: {value:"pay", required:true},
ircserver: {type:"irc-server", required:true},
channel: {value:"",required:true,validate:RED.validators.regex(/^#/)}
},
color:"Silver",
inputs:1,
outputs:0,
icon: "hash.png",
align: "right",
label: function() {
return this.name || (this.ircserver ? RED.nodes.node(this.ircserver).label() : "irc");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
if ((this.ircserver !== undefined) && (this.ircserver !== "")) {
this.channel = this.channel || RED.nodes.node(this.ircserver).channel;
$("#node-input-channel").val(this.channel);
}
else { this.channel = this.channel; }
}
});
</script>
<script type="text/html" data-template-name="irc-server">
<div class="form-row">
2015-06-16 11:36:19 +02:00
<label for="node-config-input-server"><i class="fa fa-globe"></i> <span data-i18n="irc.label.ircserver"></span></label>
<input type="text" id="node-config-input-server" placeholder="irc.freenode.net" style="width: 45%;" >
2015-06-16 11:36:19 +02:00
<label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> <span data-i18n="irc.label.port"></span></label>
<input type="text" id="node-config-input-port" style="width:45px">
</div>
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-config-input-ssl" style="display: inline-block; width: auto; vertical-align: top;">
2015-06-16 11:36:19 +02:00
<label for="node-config-input-ssl" style="width: 70%;"><span data-i18n="irc.label.ssl"></span></label>
</div>
<div class="form-row" id="certrow">
<label>&nbsp;</label>
<input type="checkbox" id="node-config-input-cert" style="display: inline-block; width: auto; vertical-align: top;">
2015-06-16 11:36:19 +02:00
<label for="node-config-input-cert" style="width: 70%;"><span data-i18n="irc.label.self"></span></label>
</div>
<div class="form-row">
<label for="node-config-input-nickname"><i class="fa fa-heart"></i> <span data-i18n="irc.label.nickname"></span></label>
2015-06-16 11:36:19 +02:00
<input type="text" id="node-config-input-nickname">
</div>
<div class="form-row">
<label for="node-config-input-username"><i class="fa fa-user"></i> <span data-i18n="irc.label.username"></span></label>
<input type="text" id="node-config-input-username" data-i18n="[placeholder]irc.placeholder.ifreq">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="irc.label.password"></span></label>
<input type="text" id="node-config-input-password" data-i18n="[placeholder]irc.placeholder.ifreq">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('irc-server',{
category: 'config',
defaults: {
server: {value:"",required:true},
port: {value:"6667"},
ssl: {value:false},
cert: {value:false},
nickname: {value:"",required:true}
},
credentials: {
username: {type:"text"},
password: {type:"password"}
},
label: function() {
return this.server;
},
oneditprepare: function() {
$("#node-config-input-ssl").change(function() {
if ($("#node-config-input-ssl").is(":checked")) {
$("#certrow").show();
}
else {
$("#certrow").hide();
}
});
},
oneditsave: function() {
this.ssl = $("#node-config-input-ssl").is(":checked");
this.cert = $("#node-config-input-cert").is(":checked");
}
});
</script>