Original formatting restored

This commit is contained in:
David D'Hauwe 2022-06-09 16:04:14 +02:00
parent 05bcb5a249
commit d7ac93c94e

View File

@ -61,45 +61,45 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
(function () { (function() {
RED.nodes.registerType('e-mail', { RED.nodes.registerType('e-mail',{
category: 'social-output', category: 'social-output',
color: "#c7e9c0", color:"#c7e9c0",
defaults: { defaults: {
server: { value: "smtp.gmail.com", required: true }, server: {value:"smtp.gmail.com",required:true},
port: { value: "465", required: true }, port: {value:"465",required:true},
secure: { value: true }, secure: {value: true},
tls: { value: true }, tls: {value: true},
name: { value: "" }, name: {value:""},
dname: { value: "" } dname: {value:""}
}, },
credentials: { credentials: {
userid: { type: "text" }, userid: {type:"text"},
password: { type: "password" }, password: {type: "password"},
global: { type: "boolean" } global: { type:"boolean"}
}, },
inputs: 1, inputs:1,
outputs: 0, outputs:0,
icon: "envelope.png", icon: "envelope.png",
align: "right", align: "right",
paletteLabel: function () { paletteLabel: function() {
return this._("email.email"); return this._("email.email");
}, },
label: function () { label: function() {
return this.dname || this.name || this._("email.email"); return this.dname||this.name||this._("email.email");
}, },
labelStyle: function () { labelStyle: function() {
return (this.dname) ? "node_label_italic" : ""; return (this.dname)?"node_label_italic":"";
}, },
oneditprepare: function () { oneditprepare: function() {
if (this.credentials.global) { if (this.credentials.global) {
$('#node-tip').show(); $('#node-tip').show();
} else { } else {
$('#node-tip').hide(); $('#node-tip').hide();
}
} }
}); }
})(); });
})();
</script> </script>
@ -190,24 +190,24 @@
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div> </div>
<script> <script>
var checkPorts = function () { var checkPorts = function() {
var currentPort = $("#node-input-port").val(); var currentPort = $("#node-input-port").val();
if (currentPort === "143" || currentPort === "993" || currentPort === "110" || currentPort == "995") { if (currentPort === "143" || currentPort === "993" || currentPort === "110" || currentPort == "995") {
if ($("#node-input-useSSL").prop("checked") === true) { if ($("#node-input-useSSL").prop("checked") === true) {
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP" ? "993" : "995"); $("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"993":"995");
} else { } else {
$("#node-input-port").val($("#node-input-protocol").val() === "IMAP" ? "143" : "110"); $("#node-input-port").val($("#node-input-protocol").val() === "IMAP"?"143":"110");
} }
} }
}; };
$("#node-input-useSSL").change(function (x, y) { $("#node-input-useSSL").change(function(x, y) {
// console.log("useSSL: x="+ JSON.stringify(x) + ", y=" + y); // console.log("useSSL: x="+ JSON.stringify(x) + ", y=" + y);
// console.log("Value: " + $("#node-input-useSSL").prop("checked")); // console.log("Value: " + $("#node-input-useSSL").prop("checked"));
checkPorts(); checkPorts();
}); });
$("#node-input-protocol").change(function () { $("#node-input-protocol").change(function() {
var protocol = $("#node-input-protocol").val(); var protocol = $("#node-input-protocol").val();
if (protocol === "IMAP") { if (protocol === "IMAP") {
$(".node-input-autotls").show(); $(".node-input-autotls").show();
@ -226,80 +226,80 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
(function () { (function() {
RED.nodes.registerType('e-mail in', { RED.nodes.registerType('e-mail in',{
category: 'social-input', category: 'social-input',
color: "#c7e9c0", color:"#c7e9c0",
defaults: { defaults: {
name: { value: "" }, name: {value:""},
protocol: { value: "IMAP", required: true }, // Which protocol to use to connect to the mail server ("IMAP" or "POP3") protocol: {value: "IMAP", required:true}, // Which protocol to use to connect to the mail server ("IMAP" or "POP3")
server: { value: "imap.gmail.com", required: true }, server: {value:"imap.gmail.com",required:true},
useSSL: { value: true }, useSSL: {value: true},
autotls: { value: "never" }, autotls: {value: "never"},
port: { value: "993", required: true }, port: {value:"993",required:true},
box: { value: "INBOX" }, // For IMAP, The mailbox to process box: {value:"INBOX"}, // For IMAP, The mailbox to process
disposition: { value: "Read" }, // For IMAP, the disposition of the read email disposition: { value: "Read" }, // For IMAP, the disposition of the read email
criteria: { value: "UNSEEN" }, criteria: {value: "UNSEEN"},
repeat: { value: "300", required: true }, repeat: {value:"300",required:true},
fetch: { value: "auto" }, fetch: {value:"auto"},
inputs: { value: 0 } inputs: {value:0}
}, },
credentials: { credentials: {
userid: { type: "text" }, userid: {type:"text"},
password: { type: "password" }, password: {type: "password"},
global: { type: "boolean" } global: { type:"boolean"}
}, },
inputs: 0, inputs: 0,
outputs: 1, outputs: 1,
icon: "envelope.png", icon: "envelope.png",
paletteLabel: function () { paletteLabel: function() {
return this._("email.email"); return this._("email.email");
}, },
label: function () { label: function() {
return this.name || this._("email.email"); return this.name||this._("email.email");
}, },
labelStyle: function () { labelStyle: function() {
return (this.name) ? "node_label_italic" : ""; return (this.name)?"node_label_italic":"";
}, },
oneditprepare: function () { oneditprepare: function() {
var that = this; var that = this;
if (this.credentials.global) { if (this.credentials.global) {
$('#node-tip').show(); $('#node-tip').show();
} else { } else {
$('#node-tip').hide(); $('#node-tip').hide();
}
if (typeof this.box === 'undefined') {
$("#node-input-box").val("INBOX");
this.box = "INBOX";
}
if (typeof this.criteria === 'undefined') {
$("#node-input-criteria").val("UNSEEN");
this.criteria = "UNSEEN";
}
if (typeof this.autotls === 'undefined') {
$("#node-input-autotls").val("never");
this.autotls = "never";
}
if ($("#node-input-fetch").val() === null) { $("#node-input-fetch").val("auto"); }
$("#node-input-fetch").change(function () {
if ($("#node-input-fetch").val() === "trigger") {
$('#node-repeatTime').hide();
that.inputs = 1;
}
else {
$('#node-repeatTime').show();
that.inputs = 0;
}
});
$("#node-input-criteria").change(function () {
if ($("#node-input-criteria").val() === "_msg_") {
$("#node-input-fetch").val("trigger");
$("#node-input-fetch").change();
}
});
} }
}); if (typeof this.box === 'undefined') {
})(); $("#node-input-box").val("INBOX");
this.box = "INBOX";
}
if (typeof this.criteria === 'undefined') {
$("#node-input-criteria").val("UNSEEN");
this.criteria = "UNSEEN";
}
if (typeof this.autotls === 'undefined') {
$("#node-input-autotls").val("never");
this.autotls = "never";
}
if ($("#node-input-fetch").val() === null) { $("#node-input-fetch").val("auto"); }
$("#node-input-fetch").change(function() {
if ($("#node-input-fetch").val() === "trigger") {
$('#node-repeatTime').hide();
that.inputs = 1;
}
else {
$('#node-repeatTime').show();
that.inputs = 0;
}
});
$("#node-input-criteria").change(function() {
if ($("#node-input-criteria").val() === "_msg_") {
$("#node-input-fetch").val("trigger");
$("#node-input-fetch").change();
}
});
}
});
})();
</script> </script>