diff options
author | Emmanuel ROHEE <erohee@amdocs.com> | 2014-09-19 16:36:19 +0200 |
---|---|---|
committer | Emmanuel ROHEE <erohee@amdocs.com> | 2014-09-19 17:20:33 +0200 |
commit | e9670fd144e635f4ed34d9601b010c4f148a70a3 (patch) | |
tree | 1cb53a91a23a0fb25d61c1047a6a2bef7c3c201b | |
parent | SYWEB-13: Do not start the app if the browser does not support WEBStorage. (diff) | |
download | synapse-e9670fd144e635f4ed34d9601b010c4f148a70a3.tar.xz |
SYWEB-13: disabled "Send image" button if the browser does not support HTML5 file API
-rw-r--r-- | webclient/components/fileInput/file-input-directive.js | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/webclient/components/fileInput/file-input-directive.js b/webclient/components/fileInput/file-input-directive.js index 14e2f772f7..9c849a140f 100644 --- a/webclient/components/fileInput/file-input-directive.js +++ b/webclient/components/fileInput/file-input-directive.js @@ -31,13 +31,23 @@ angular.module('mFileInput', []) }, link: function(scope, element, attrs, ctrl) { - element.bind("click", function() { - element.find("input")[0].click(); - element.find("input").bind("change", function(e) { - scope.selectedFile = this.files[0]; - scope.$apply(); + + // Check if HTML5 file selection is supported + if (window.FileList) { + element.bind("click", function() { + element.find("input")[0].click(); + element.find("input").bind("change", function(e) { + scope.selectedFile = this.files[0]; + 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 element.css("cursor", "pointer"); |