- $('#btn-compress').toggleClass('disabled', selected == 0);
- $('#btn-extract').toggleClass('disabled', selected != 1);
+ $('#btn-compress').toggleClass('disabled', filex.host != 'moss.man.poznan.pl' || selected == 0);
+
+ if (filex.host == 'moss.man.poznan.pl' && selected == 1) {
+ var filename = filex.selectedFiles()[0].get('name'),
+ is_archive = _.some(['.zip', '.tar.gz', '.tgz', '.tar.bz2', 'tbz'], function(ext) {
+ return filename.endsWith(ext);
+ });
+
+ $('#btn-extract').toggleClass('disabled', !is_archive);
+ }
+ else {
+ $('#btn-extract').addClass('disabled');
+ }
+ });
+
+ $('form').on('show.bs.modal', function() {
+ $(this).find('.alert').remove();
+ this.reset();
+ }).on('shown.bs.modal', function() {
+ $(this).find('input[type="text"]')[0].focus();