SYWEB-13: disabled "Send image" button if the browser does not support HTML5 file API

This commit is contained in:
Emmanuel ROHEE 2014-09-19 16:36:19 +02:00
parent f9688d7519
commit e9670fd144
1 changed files with 16 additions and 6 deletions

View File

@ -31,6 +31,9 @@ angular.module('mFileInput', [])
}, },
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
// Check if HTML5 file selection is supported
if (window.FileList) {
element.bind("click", function() { element.bind("click", function() {
element.find("input")[0].click(); element.find("input")[0].click();
element.find("input").bind("change", function(e) { element.find("input").bind("change", function(e) {
@ -38,6 +41,13 @@ angular.module('mFileInput', [])
scope.$apply(); scope.$apply();
}); });
}); });
}
else {
setTimeout(function() {
element.attr("disabled", true);
element.attr("title", "The app uses the HTML5 File API to send files. Your browser does not support it.");
}, 1);
}
// Change the mouse icon on mouseover on this element // Change the mouse icon on mouseover on this element
element.css("cursor", "pointer"); element.css("cursor", "pointer");