Commit 1a11c378 by Sheng

Support Safari 11.x

parent 234653f3
...@@ -432,12 +432,38 @@ jQuery(function($){ ...@@ -432,12 +432,38 @@ jQuery(function($){
} }
function disable_file_inputs(inputs) {
var i, input;
for (i = 0; i < inputs.length; i++) {
input = inputs[i];
if (input.files.length === 0) {
input.setAttribute('disabled', '');
}
}
}
function enable_file_inputs(inputs) {
var i;
for (i = 0; i < inputs.length; i++) {
inputs[i].removeAttribute('disabled');
}
}
function connect_without_options() { function connect_without_options() {
// use data from the form // use data from the form
var form = document.querySelector(form_id), var form = document.querySelector(form_id),
inputs = form.querySelectorAll('input[type="file"]'),
url = form.action, url = form.action,
data = new FormData(form), data, pk;
disable_file_inputs(inputs);
data = new FormData(form);
pk = data.get('privatekey'); pk = data.get('privatekey');
enable_file_inputs(inputs);
function ajax_post() { function ajax_post() {
store_items(fields, data); store_items(fields, data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment