1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix select box handling in Safari

Fixes #928
This commit is contained in:
Nick O'Leary 2016-07-04 11:21:58 +01:00
parent b8f578862e
commit dc00870461
9 changed files with 42 additions and 43 deletions

View File

@ -251,7 +251,7 @@
$("#inject-time-type-select").change(function() {
$("#node-input-crontab").val('');
var id = $("#inject-time-type-select option:selected").val();
var id = $("#inject-time-type-select").val();
$(".inject-time-row").hide();
$("#inject-time-row-"+id).show();
if ((id == "none") || (id == "interval")) {
@ -271,8 +271,8 @@
});
$("<option></option>").val(24).text("00:00").appendTo("#inject-time-interval-time-end");
$("#inject-time-interval-time-start").change(function() {
var start = Number($("#inject-time-interval-time-start option:selected").val());
var end = Number($("#inject-time-interval-time-end option:selected").val());
var start = Number($("#inject-time-interval-time-start").val());
var end = Number($("#inject-time-interval-time-end").val());
$("#inject-time-interval-time-end option").remove();
for (var i=start+1;i<25;i++) {
var l = (i<10?"0":"")+i+":00";
@ -291,10 +291,6 @@
min:1
});
$("#inject-time-interval-units").change(function() {
var units = $("#inject-time-interval-units option:selected").val();
});
$.widget( "ui.injecttimespinner", $.ui.spinner, {
options: {
// seconds
@ -342,7 +338,7 @@
// Fixed time
var time = cronparts[1]+":"+cronparts[0];
$("#inject-time-time").val(time);
$("#inject-time-type-select option").filter(function() {return $(this).val() == "s";}).attr('selected',true);
$("#inject-time-type-select").val("s");
if (days == "*") {
$("#inject-time-time-days input[type=checkbox]").prop("checked",true);
} else {
@ -397,16 +393,16 @@
end = Number(endparts[1])+1;
}
}
$("#inject-time-interval-time-end option").filter(function() {return $(this).val() == end;}).attr('selected',true);
$("#inject-time-interval-time-start option").filter(function() {return $(this).val() == start;}).attr('selected',true);
$("#inject-time-interval-time-end").val(end);
$("#inject-time-interval-time-start").val(start);
}
} else {
$("#inject-time-type-select option").filter(function() {return $(this).val() == "none";}).attr('selected',true);
$("#inject-time-type-select").val("none");
}
$(".inject-time-row").hide();
$("#inject-time-type-select option").filter(function() {return $(this).val() == repeattype;}).attr('selected',true);
$("#inject-time-type-select").val(repeattype);
$("#inject-time-row-"+repeattype).show();
$("#node-input-payload").typedInput('type',this.payloadType);
@ -418,12 +414,12 @@
oneditsave: function() {
var repeat = "";
var crontab = "";
var type = $("#inject-time-type-select option:selected").val();
var type = $("#inject-time-type-select").val();
if (type == "none") {
// nothing
} else if (type == "interval") {
var count = $("#inject-time-interval-count").val();
var units = $("#inject-time-interval-units option:selected").val();
var units = $("#inject-time-interval-units").val();
if (units == "s") {
repeat = count;
} else {
@ -438,8 +434,8 @@
} else if (type == "interval-time") {
repeat = "";
var count = $("#inject-time-interval-time-units").val();
var startTime = Number($("#inject-time-interval-time-start option:selected").val());
var endTime = Number($("#inject-time-interval-time-end option:selected").val());
var startTime = Number($("#inject-time-interval-time-start").val());
var endTime = Number($("#inject-time-interval-time-end").val());
var days = $('#inject-time-interval-time-days input[type=checkbox]:checked').map(function(_, el) {
return $(el).val()
}).get();

View File

@ -242,7 +242,7 @@
$("#node-input-scope-select").change(function(e) {
var scope = $(this).children("option:selected").val();
var scope = $(this).val();
if (scope === "target") {
createNodeList();
$(".node-input-target-row").show();
@ -259,7 +259,7 @@
$("#node-input-scope-select").change();
},
oneditsave: function() {
var scope = $("#node-input-scope-select").children("option:selected").val();
var scope = $("#node-input-scope-select").val();
if (scope === 'all') {
this.scope = null;
} else {

View File

@ -231,7 +231,7 @@
})
$("#node-input-scope-select").change(function(e) {
var scope = $(this).children("option:selected").val();
var scope = $(this).val();
if (scope === "target") {
createNodeList();
$(".node-input-target-row").show();
@ -248,7 +248,7 @@
$("#node-input-scope-select").change();
},
oneditsave: function() {
var scope = $("#node-input-scope-select").children("option:selected").val();
var scope = $("#node-input-scope-select").val();
if (scope === 'all') {
this.scope = null;
} else {

View File

@ -140,7 +140,7 @@
});
$("#node-input-intype").change(function() {
var newtype = $("#node-input-intype option:selected").val();
var newtype = $("#node-input-intype").val();
if ((pinsInUse.hasOwnProperty(pinnow)) && (pinsInUse[pinnow] !== newtype)) {
RED.notify(pinname+" "+pinnow+" "+alreadyset+" "+pinsInUse[pinnow],"error");
}
@ -286,7 +286,7 @@
});
$("#node-input-out").change(function() {
var newtype = $("#node-input-out option:selected").val();
var newtype = $("#node-input-out").val();
if ((pinsInUse.hasOwnProperty(pinnow)) && (pinsInUse[pinnow] !== newtype)) {
RED.notify(pinname+" "+pinnow+" "+alreadyset+" "+pinsInUse[pinnow],"error");
}

View File

@ -86,14 +86,14 @@
},
oneditprepare: function() {
var updateOptions = function() {
var sockettype = $("#node-input-server option:selected").val();
var sockettype = $("#node-input-server").val();
if (sockettype == "client") {
$("#node-input-host-row").show();
} else {
$("#node-input-host-row").hide();
}
var datamode = $("#node-input-datamode option:selected").val();
var datatype = $("#node-input-datatype option:selected").val();
var datamode = $("#node-input-datamode").val();
var datatype = $("#node-input-datatype").val();
if (datamode == "stream") {
if (datatype == "utf8") {
$("#node-row-newline").show();
@ -181,7 +181,7 @@
},
oneditprepare: function() {
var updateOptions = function() {
var sockettype = $("#node-input-beserver option:selected").val();
var sockettype = $("#node-input-beserver").val();
if (sockettype == "reply") {
$("#node-input-port-row").hide();
$("#node-input-host-row").hide();

View File

@ -90,7 +90,7 @@
},
oneditprepare: function() {
$("#node-input-multicast").change(function() {
var id = $("#node-input-multicast option:selected").val();
var id = $("#node-input-multicast").val();
if (id == "false") {
$(".node-input-group").hide();
$(".node-input-iface").hide();
@ -202,12 +202,10 @@
var bindtarget = this._("udp.bind.target");
var type = this.outport==""?"random":"fixed";
$("#node-input-outport-type option").filter(function() {
return $(this).val() == type;
}).attr('selected',true);
$("#node-input-outport-type").val(type);
$("#node-input-outport-type").change(function() {
var type = $(this).children("option:selected").val();
var type = $(this).val();
if (type == "random") {
$("#node-input-outport").val("").hide();
} else {
@ -217,7 +215,7 @@
$("#node-input-outport-type").change();
$("#node-input-multicast").change(function() {
var id = $("#node-input-multicast option:selected").val();
var id = $("#node-input-multicast").val();
if (id === "multi") {
$(".node-input-iface").show();
$("#node-input-addr-label").html('<i class="fa fa-list"></i> ' + grouplabel);
@ -233,7 +231,7 @@
$("#node-input-addr-label").html('<i class="fa fa-list"></i> ' + addresslabel);
$("#node-input-addr")[0].placeholder = addressph;
}
var type = $(this).children("option:selected").val();
var type = $(this).val();
if (type == "false") {
$("#node-input-outport-type-random").html(bindrandom);
} else {

View File

@ -88,7 +88,7 @@
function resizeRule(rule) {
var newWidth = rule.width();
var selectField = rule.find("select");
var type = selectField.children("option:selected").val()||"";
var type = selectField.val()||"";
var valueField = rule.find(".node-input-rule-value");
var btwnField1 = rule.find(".node-input-rule-btwn-value");
var btwnField2 = rule.find(".node-input-rule-btwn-value2");
@ -115,7 +115,10 @@
$("#node-input-rule-container").css('min-height','250px').css('min-width','450px').editableList({
addItem: function(container,i,opt) {
var rule = opt||{t:"",v:"",v2:""};
var rule = opt;
if (!rule.hasOwnProperty('t')) {
rule.t = 'eq';
}
var row = $('<div/>').appendTo(container);
var row2 = $('<div/>',{style:"padding-top: 5px; padding-left: 175px;"}).appendTo(container);
var row3 = $('<div/>',{style:"padding-top: 5px; padding-left: 102px;"}).appendTo(container);
@ -133,8 +136,7 @@
$('<label/>',{for:"node-input-rule-case-"+i,style:"margin-left: 3px;"}).text(caseLabel).appendTo(row2);
selectField.change(function() {
resizeRule(container);
var type = selectField.children("option:selected").val();
var type = selectField.val();
if (type === "btwn") {
valueField.typedInput('hide');
btwnValueField.typedInput('show');
@ -157,7 +159,7 @@
row3.hide();
}
});
selectField.find("option").filter(function() {return $(this).val() == rule.t;}).attr('selected',true);
selectField.val(rule.t);
if (rule.t == "btwn") {
btwnValueField.typedInput('value',rule.v);
btwnValueField.typedInput('type',rule.vt||'num');
@ -199,7 +201,7 @@
node.rules= [];
rules.each(function(i) {
var rule = $(this);
var type = rule.find("select option:selected").val();
var type = rule.find("select").val();
var r = {t:type};
if (!(type === "true" || type === "false" || type === "null" || type === "nnull" || type === "else")) {
if (type === "btwn") {

View File

@ -108,7 +108,10 @@
}
$('#node-input-rule-container').css('min-height','300px').css('min-width','450px').editableList({
addItem: function(container,i,opt) {
var rule = opt||{t:"replace",p:"payload"};
var rule = opt;
if (!rule.hasOwnProperty('t')) {
rule = {t:"set",p:"payload",to:"",tot:"str"};
}
if (rule.t === "change" && rule.re) {
rule.fromt = 're';
delete rule.re;
@ -193,7 +196,7 @@
resizeRule(container);
});
selectField.find("option").filter(function() {return $(this).val() == rule.t;}).attr('selected',true);
selectField.val(rule.t);
propertyName.typedInput('value',rule.p);
propertyName.typedInput('type',rule.pt);
propertyValue.typedInput('value',rule.to);
@ -250,7 +253,7 @@
node.rules= [];
rules.each(function(i) {
var rule = $(this);
var type = rule.find(".node-input-rule-type option:selected").val();
var type = rule.find(".node-input-rule-type").val();
var r = {
t:type,
p:rule.find(".node-input-rule-property-name").typedInput('value'),

View File

@ -113,7 +113,7 @@
$("#node-input-sep").show();
}
$("#node-input-select-sep").change(function() {
var v = $("#node-input-select-sep option:selected").val();
var v = $("#node-input-select-sep").val();
$("#node-input-sep").val(v);
if (v == "") {
$("#node-input-sep").val("");