From 3ddb132fa6396c175240fe3d10969e07962044e7 Mon Sep 17 00:00:00 2001 From: d0whc3r Date: Wed, 31 Aug 2016 00:14:17 +0200 Subject: [PATCH 1/4] add editorconfig, jshint, sass-lint and src beautified --- .editorconfig | 21 + .jscsrc | 6 + .jshintrc | 16 + .sass-lint.yml | 92 ++++ src/lf-ng-md-file-input.js | 852 +++++++++++++++++++------------------ 5 files changed, 565 insertions(+), 422 deletions(-) create mode 100644 .editorconfig create mode 100644 .jscsrc create mode 100644 .jshintrc create mode 100644 .sass-lint.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c2cdfb8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] + +# Change these settings to your own preference +indent_style = space +indent_size = 2 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..f8bf9ba --- /dev/null +++ b/.jscsrc @@ -0,0 +1,6 @@ +{ + "requireCamelCaseOrUpperCaseIdentifiers": true, + "requireCapitalizedConstructors": true, + "requireParenthesesAroundIIFE": true, + "validateQuoteMarks": "'" +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..4572e5d --- /dev/null +++ b/.jshintrc @@ -0,0 +1,16 @@ +{ + "bitwise": true, + "browser": true, + "curly": true, + "eqeqeq": true, + "esnext": true, + "latedef": true, + "noarg": true, + "node": true, + "strict": true, + "undef": true, + "unused": true, + "globals": { + "angular": false + } +} diff --git a/.sass-lint.yml b/.sass-lint.yml new file mode 100644 index 0000000..5c0588c --- /dev/null +++ b/.sass-lint.yml @@ -0,0 +1,92 @@ +options: + formatter: stylish +files: + include: + - 'app/styles/*.s+(a|c)ss' + - 'app/scripts/**/*.s+(a|c)ss' +rules: + # Extends + extends-before-mixins: 1 + extends-before-declarations: 1 + placeholder-in-extend: 1 + + # Mixins + mixins-before-declarations: 1 + + # Line Spacing + one-declaration-per-line: 1 + empty-line-between-blocks: 1 + single-line-per-selector: 1 + + # Disallows + no-attribute-selectors: 0 + no-color-keywords: 1 + no-color-literals: 1 + no-combinators: 0 + no-css-comments: 1 + no-debug: 1 + no-disallowed-properties: 0 + no-duplicate-properties: 1 + no-empty-rulesets: 1 + no-extends: 0 + no-ids: 1 + no-important: 1 + no-invalid-hex: 1 + no-mergeable-selectors: 1 + no-misspelled-properties: 1 + no-qualifying-elements: 1 + no-trailing-whitespace: 1 + no-trailing-zero: 1 + no-transition-all: 1 + no-universal-selectors: 0 + no-url-protocols: 1 + no-vendor-prefixes: 1 + no-warn: 1 + property-units: 0 + + # Nesting + force-attribute-nesting: 1 + force-element-nesting: 1 + force-pseudo-nesting: 1 + + # Name Formats + class-name-format: 1 + function-name-format: 1 + id-name-format: 0 + mixin-name-format: 1 + placeholder-name-format: 1 + variable-name-format: 1 + + # Style Guide + attribute-quotes: 1 + bem-depth: 0 + border-zero: 1 + brace-style: 1 + clean-import-paths: 1 + empty-args: 1 + hex-length: 1 + hex-notation: 1 + indentation: 1 + leading-zero: 1 + nesting-depth: 1 + property-sort-order: 1 + pseudo-element: 1 + quotes: 1 + shorthand-values: 1 + url-quotes: 1 + variable-for-property: 1 + zero-unit: 1 + + # Inner Spacing + space-after-comma: 1 + space-before-colon: 1 + space-after-colon: 1 + space-before-brace: 1 + space-before-bang: 1 + space-after-bang: 1 + space-between-parens: 1 + space-around-operator: 1 + + # Final Items + trailing-semicolon: 1 + final-newline: 1 diff --git a/src/lf-ng-md-file-input.js b/src/lf-ng-md-file-input.js index 1cb2e0d..f3012ad 100644 --- a/src/lf-ng-md-file-input.js +++ b/src/lf-ng-md-file-input.js @@ -1,12 +1,13 @@ -(function(window,angular,undefined) { +(function(window, angular, undefined) { 'use strict'; - var genLfObjId = function(){ - return 'lfobjxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); - return v.toString(16); - }); + var genLfObjId = function() { + return 'lfobjxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0, + v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); }; var lfNgMdFileinput = angular.module('lfNgMdFileInput', ['ngMaterial']); @@ -20,64 +21,64 @@ } }); - lfNgMdFileinput.run(function($templateCache){ + lfNgMdFileinput.run(function($templateCache) { $templateCache.put('lfNgMdFileinput.html', [ - '
', - '
', - '×', - '
', - '
', - '
{{strCaptionDragAndDrop}}
', - '
', - '
', - '
', - '
×
', - '', - '', - '', - '', - '
', - '', - '
', - '
', - '', - '
', - '
', - '
', - '
', - '
', - '
', - '
', - '', - '
', - '{{strCaptionPlaceholder}}', - '
', - '
', - '{{strCaption}}', - '
', - '', - '
', - '', - ' ', - '{{strCaptionRemove}}', - '', - '', - ' ', - '{{strCaptionBrowse}}', - '',//,onchange="angular.element(this).scope().onFileChanged(this)"/>', - '', - '
', - '
' - ].join('')); + '
', + '
', + '×', + '
', + '
', + '
{{strCaptionDragAndDrop}}
', + '
', + '
', + '
', + '
×
', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '{{strCaptionPlaceholder}}', + '
', + '
', + '{{strCaption}}', + '
', + '', + '
', + '', + ' ', + '{{strCaptionRemove}}', + '', + '', + ' ', + '{{strCaptionBrowse}}', + '', //,onchange="angular.element(this).scope().onFileChanged(this)"/>', + '', + '
', + '
' + ].join('')); }); - lfNgMdFileinput.filter('lfTrusted', ['$sce', function ($sce) { + lfNgMdFileinput.filter('lfTrusted', ['$sce', function($sce) { return function(url) { return $sce.trustAsResourceUrl(url); }; @@ -86,17 +87,17 @@ lfNgMdFileinput.directive('lfRequired', function() { return { restrict: "A", - require:"ngModel", + require: "ngModel", link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - ctrl.$validators.required = function(modelValue,viewValue) { - if(!modelValue){ - return false; - } - return modelValue.length>0; - }; + if (!ctrl) { + return; + } + ctrl.$validators.required = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + return modelValue.length > 0; + }; } } }); @@ -104,21 +105,21 @@ lfNgMdFileinput.directive('lfMaxcount', function() { return { restrict: "A", - require:"ngModel", - link: function(scope, element, attrs ,ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfMaxcount', function(value) { - var intVal = parseInt(value,10); - intMax = isNaN(intVal) ? -1 : intVal; - ctrl.$validate(); - }); - ctrl.$validators.maxcount = function(modelValue,viewValue) { - if(!modelValue){ - return false; - } + require: "ngModel", + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfMaxcount', function(value) { + var intVal = parseInt(value, 10); + intMax = isNaN(intVal) ? -1 : intVal; + ctrl.$validate(); + }); + ctrl.$validators.maxcount = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } return modelValue.length <= intMax; }; } @@ -128,87 +129,87 @@ lfNgMdFileinput.directive('lfFilesize', function() { return { restrict: "A", - require:"ngModel", - link: function(scope, element, attrs ,ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfFilesize', function(value) { - var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; - if(!reg.test(value)){ - intMax = -1; - }else{ - var sizes = ['Byte', 'KB', 'MB']; - var unit = value.match(reg)[1]; - var number = value.substring(0,value.indexOf(unit)); - sizes.every(function(obj,idx){ - if(unit === obj){ - intMax = parseInt(number)*Math.pow(1024,idx); - return false; - }else{ - return true; - } - }); - } - ctrl.$validate(); - }); - ctrl.$validators.filesize = function(modelValue,viewValue) { - if(!modelValue){ - return false; - } - var boolValid = true; - modelValue.every(function(obj,idx){ - if(obj.lfFile.size > intMax){ - boolValid = false; - return false; - }else{ - return true; - } - }); - return boolValid; + require: "ngModel", + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfFilesize', function(value) { + var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; + if (!reg.test(value)) { + intMax = -1; + } else { + var sizes = ['Byte', 'KB', 'MB']; + var unit = value.match(reg)[1]; + var number = value.substring(0, value.indexOf(unit)); + sizes.every(function(obj, idx) { + if (unit === obj) { + intMax = parseInt(number) * Math.pow(1024, idx); + return false; + } else { + return true; + } + }); + } + ctrl.$validate(); + }); + ctrl.$validators.filesize = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + var boolValid = true; + modelValue.every(function(obj, idx) { + if (obj.lfFile.size > intMax) { + boolValid = false; + return false; + } else { + return true; + } + }); + return boolValid; }; } } }); - lfNgMdFileinput.directive('lfTotalsize', function() { + lfNgMdFileinput.directive('lfTotalsize', function() { return { restrict: "A", - require:"ngModel", - link: function(scope, element, attrs ,ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfTotalsize', function(value) { - var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; - if(!reg.test(value)){ - intMax = -1; - }else{ - var sizes = ['Byte', 'KB', 'MB']; - var unit = value.match(reg)[1]; - var number = value.substring(0,value.indexOf(unit)); - sizes.every(function(obj,idx){ - if(unit === obj){ - intMax = parseInt(number)*Math.pow(1024,idx); - return false; - }else{ - return true; - } - }); - } - ctrl.$validate(); - }); - ctrl.$validators.totalsize = function(modelValue,viewValue) { - if(!modelValue){ - return false; - } - var intTotal = 0; - angular.forEach(modelValue,function(obj,idx){ - intTotal = intTotal + obj.lfFile.size; - }); - return intTotal < intMax; + require: "ngModel", + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfTotalsize', function(value) { + var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; + if (!reg.test(value)) { + intMax = -1; + } else { + var sizes = ['Byte', 'KB', 'MB']; + var unit = value.match(reg)[1]; + var number = value.substring(0, value.indexOf(unit)); + sizes.every(function(obj, idx) { + if (unit === obj) { + intMax = parseInt(number) * Math.pow(1024, idx); + return false; + } else { + return true; + } + }); + } + ctrl.$validate(); + }); + ctrl.$validators.totalsize = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + var intTotal = 0; + angular.forEach(modelValue, function(obj, idx) { + intTotal = intTotal + obj.lfFile.size; + }); + return intTotal < intMax; }; } } @@ -217,8 +218,8 @@ lfNgMdFileinput.directive('lfMimetype', function() { return { restrict: "A", - require:"ngModel", - link: function(scope, element, attrs ,ctrl) { + require: "ngModel", + link: function(scope, element, attrs, ctrl) { if (!ctrl) { return; } @@ -227,15 +228,15 @@ reg = new RegExp(value, "i"); ctrl.$validate(); }); - ctrl.$validators.mimetype = function(modelValue,viewValue) { - if(!modelValue){ + ctrl.$validators.mimetype = function(modelValue, viewValue) { + if (!modelValue) { return false; } var boolValid = true; - modelValue.every(function(obj,idx){ - if(obj.lfFile.type.match(reg)){ + modelValue.every(function(obj, idx) { + if (obj.lfFile.type.match(reg)) { return true; - }else{ + } else { boolValid = false; return false; } @@ -246,29 +247,29 @@ } }); - lfNgMdFileinput.directive('lfNgMdFileInput',['$q','$compile','$timeout', function($q,$compile,$timeout){ + lfNgMdFileinput.directive('lfNgMdFileInput', ['$q', '$compile', '$timeout', function($q, $compile, $timeout) { return { restrict: 'E', templateUrl: 'lfNgMdFileinput.html', replace: true, - require:"ngModel", - scope:{ - lfFiles:'=?', - lfApi:'=?', - lfOption:'=?', - lfCaption:'@?', - lfPlaceholder:'@?', - lfDragAndDropLabel:'@?', - lfBrowseLabel: '@?', - lfRemoveLabel: '@?', + require: "ngModel", + scope: { + lfFiles: '=?', + lfApi: '=?', + lfOption: '=?', + lfCaption: '@?', + lfPlaceholder: '@?', + lfDragAndDropLabel: '@?', + lfBrowseLabel: '@?', + lfRemoveLabel: '@?', lfOnFileClick: '=?', - accept:'@?', - ngDisabled:'=?' + accept: '@?', + ngDisabled: '=?' }, - link: function(scope,element,attrs,ctrl){ + link: function(scope, element, attrs, ctrl) { var elFileinput = angular.element(element[0].querySelector('.lf-ng-md-file-input-tag')); - var elDragview = angular.element(element[0].querySelector('.lf-ng-md-file-input-drag')); + var elDragview = angular.element(element[0].querySelector('.lf-ng-md-file-input-drag')); var elThumbnails = angular.element(element[0].querySelector('.lf-ng-md-file-input-thumbnails')); var isCustomCaption = false; @@ -282,28 +283,28 @@ scope.isMutiple = false; scope.isProgress = false; - if(angular.isDefined(attrs.preview)){ + if (angular.isDefined(attrs.preview)) { scope.isPreview = true; } - if(angular.isDefined(attrs.drag)){ + if (angular.isDefined(attrs.drag)) { scope.isDrag = true; }; - if(angular.isDefined(attrs.multiple)){ - elFileinput.attr('multiple','multiple'); + if (angular.isDefined(attrs.multiple)) { + elFileinput.attr('multiple', 'multiple'); scope.isMutiple = true; - }else{ + } else { elFileinput.removeAttr('multiple'); } - if(angular.isDefined(attrs.progress)){ + if (angular.isDefined(attrs.progress)) { scope.isProgress = true; } scope.isDisabled = false; - if (angular.isDefined(attrs.ngDisabled) ) { + if (angular.isDefined(attrs.ngDisabled)) { scope.$watch('ngDisabled', function(isDisabled) { scope.isDisabled = isDisabled; }); @@ -314,18 +315,18 @@ scope.strCaptionIconCls = "lf-caption"; scope.strUnknowIconCls = "lf-unknow"; - if(angular.isDefined(attrs.lfOption)){ - if(angular.isObject(scope.lfOption)){ - if(scope.lfOption.hasOwnProperty('browseIconCls')){ + if (angular.isDefined(attrs.lfOption)) { + if (angular.isObject(scope.lfOption)) { + if (scope.lfOption.hasOwnProperty('browseIconCls')) { scope.strBrowseIconCls = scope.lfOption.browseIconCls; } - if(scope.lfOption.hasOwnProperty('removeIconCls')){ + if (scope.lfOption.hasOwnProperty('removeIconCls')) { scope.strRemoveIconCls = scope.lfOption.removeIconCls; } - if(scope.lfOption.hasOwnProperty('captionIconCls')){ + if (scope.lfOption.hasOwnProperty('captionIconCls')) { scope.strCaptionIconCls = scope.lfOption.captionIconCls; } - if(scope.lfOption.hasOwnProperty('unknowIconCls')){ + if (scope.lfOption.hasOwnProperty('unknowIconCls')) { scope.strUnknowIconCls = scope.lfOption.unknowIconCls; } } @@ -337,17 +338,17 @@ scope[attrs.ngModel] = scope.lfFiles; - scope.$watch('lfFiles.length',function(newVal,oldVal){ - ctrl.$validate(); - }); + scope.$watch('lfFiles.length', function(newVal, oldVal) { + ctrl.$validate(); + }); - scope.lfApi = new function(){ + scope.lfApi = new function() { var self = this; - self.removeAll = function(){ + self.removeAll = function() { scope.removeAllFiles(); }; - self.removeByName = function(name){ + self.removeByName = function(name) { scope.removeFileByName(name); }; }; @@ -358,11 +359,11 @@ scope.strCaptionPlaceholder = 'Select file'; - scope.strCaptionDragAndDrop = 'Drag & drop files here...'; + scope.strCaptionDragAndDrop = 'Drag & drop files here...'; - scope.strCaptionBrowse = 'Browse'; + scope.strCaptionBrowse = 'Browse'; - scope.strCaptionRemove = 'Remove'; + scope.strCaptionRemove = 'Remove'; scope.strAriaLabel = ""; @@ -370,93 +371,95 @@ scope.strAriaLabel = attrs.ariaLabel; } - if(angular.isDefined(attrs.lfPlaceholder)){ + if (angular.isDefined(attrs.lfPlaceholder)) { scope.$watch('lfPlaceholder', function(newVal) { scope.strCaptionPlaceholder = newVal; }); } - if (angular.isDefined(attrs.lfCaption) ) { + if (angular.isDefined(attrs.lfCaption)) { isCustomCaption = true; scope.$watch('lfCaption', function(newVal) { scope.strCaption = newVal; }); } - if(scope.lfDragAndDropLabel){ - scope.strCaptionDragAndDrop = scope.lfDragAndDropLabel; - } + if (scope.lfDragAndDropLabel) { + scope.strCaptionDragAndDrop = scope.lfDragAndDropLabel; + } - if(scope.lfBrowseLabel){ - scope.strCaptionBrowse = scope.lfBrowseLabel; - } + if (scope.lfBrowseLabel) { + scope.strCaptionBrowse = scope.lfBrowseLabel; + } - if(scope.lfRemoveLabel){ - scope.strCaptionRemove = scope.lfRemoveLabel; - } + if (scope.lfRemoveLabel) { + scope.strCaptionRemove = scope.lfRemoveLabel; + } - elDragview.bind("dragover", function(e){ + elDragview.bind("dragover", function(e) { e.stopPropagation(); e.preventDefault(); - if(scope.isDisabled || !scope.isDrag){ + if (scope.isDisabled || !scope.isDrag) { return; } elDragview.addClass("lf-ng-md-file-input-drag-hover"); }); - elDragview.bind("dragleave", function(e){ - e.stopPropagation(); - e.preventDefault(); - if(scope.isDisabled || !scope.isDrag){ - return; - } - elDragview.removeClass("lf-ng-md-file-input-drag-hover"); - }); + elDragview.bind("dragleave", function(e) { + e.stopPropagation(); + e.preventDefault(); + if (scope.isDisabled || !scope.isDrag) { + return; + } + elDragview.removeClass("lf-ng-md-file-input-drag-hover"); + }); - elDragview.bind("drop", function(e){ + elDragview.bind("drop", function(e) { - e.stopPropagation(); - e.preventDefault(); + e.stopPropagation(); + e.preventDefault(); - if(scope.isDisabled || !scope.isDrag){ - return; - } + if (scope.isDisabled || !scope.isDrag) { + return; + } - elDragview.removeClass("lf-ng-md-file-input-drag-hover"); + elDragview.removeClass("lf-ng-md-file-input-drag-hover"); - if (angular.isObject(e.originalEvent)){ + if (angular.isObject(e.originalEvent)) { e = e.originalEvent; } - var files = e.target.files || e.dataTransfer.files; - var i = 0; + var files = e.target.files || e.dataTransfer.files; + var i = 0; - if(files.length <= 0){ - return; - } + if (files.length <= 0) { + return; + } - var names = scope.lfFiles.map(function(obj){return obj.lfFileName;}); + var names = scope.lfFiles.map(function(obj) { + return obj.lfFileName; + }); - var regexp = new RegExp(scope.accept, "i"); + var regexp = new RegExp(scope.accept, "i"); scope.floatProgress = 0; - if(scope.isMutiple){ + if (scope.isMutiple) { intFilesCount = files.length; - for(var i=0;i'); + var elFrame = angular.element('
'); - var elFrameX = angular.element('
×
'); + var elFrameX = angular.element('
×
'); - var tplPreview = ''; + var tplPreview = ''; - if(lfTagType == 'image'){ + if (lfTagType == 'image') { - tplPreview = ''; + tplPreview = ''; - }else if(lfTagType == 'video'){ + } else if (lfTagType == 'video') { - tplPreview = [''].join(''); + tplPreview = ['' + ].join(''); - }else if(lfTagType == 'audio'){ + } else if (lfTagType == 'audio') { - tplPreview = [''].join(''); + tplPreview = ['' + ].join(''); - }else{ + } else { - tplPreview = [ '', - '
', - '', - '
', - '
'].join(''); + tplPreview = ['', + '
', + '', + '
', + '
' + ].join(''); - } + } - var elPreview = angular.element(tplPreview); + var elPreview = angular.element(tplPreview); - var elFooter = angular.element(''); + var elFooter = angular.element(''); - elFrame.append(elFrameX); + elFrame.append(elFrameX); - elFrame.append(elPreview); + elFrame.append(elPreview); - elFrame.append(elFooter); + elFrame.append(elFooter); - $compile(elFrame)(scope); + $compile(elFrame)(scope); - elThumbnails.append(elFrame); + elThumbnails.append(elFrame); lfFileObj.element = elFrame; - updateTextCaption(); + updateTextCaption(); - },function(error){ + }, function(error) { - },function(notify){ + }, function(notify) { - }); + }); - }; + }; - var updateTextCaption = function(){ - if(scope.lfFiles.length == 1){ - if(!isCustomCaption){ + var updateTextCaption = function() { + if (scope.lfFiles.length == 1) { + if (!isCustomCaption) { scope.strCaption = '' + scope.lfFiles[0].lfFileName; } - scope.isFilesNull = false; - }else if(scope.lfFiles.length > 1){ - if(!isCustomCaption){ - scope.strCaption = '' + scope.lfFiles.length + ' files selected'; + scope.isFilesNull = false; + } else if (scope.lfFiles.length > 1) { + if (!isCustomCaption) { + scope.strCaption = '' + scope.lfFiles.length + ' files selected'; } - scope.isFilesNull = false; - }else{ - if(!isCustomCaption){ - scope.strCaption = ''; + scope.isFilesNull = false; + } else { + if (!isCustomCaption) { + scope.strCaption = ''; } - scope.isFilesNull = true; - } - }; - - var parseFileType = function (file){ - var type = file.type; - var name = file.name; - if(isImageType(type,name)){ - return "image"; - }else if(isVideoType(type,name)){ - return "video"; - }else if(isAudioType(type,name)){ - return "audio"; - } - return "object"; - }; - - var isImageType = function(type,name){ - return (type.match('image.*') || name.match(/\.(gif|png|jpe?g)$/i)) ? true : false; - }; - - var isVideoType = function(type,name){ - return (type.match('video.*') || name.match(/\.(og?|mp4|webm|3gp)$/i)) ? true : false; - }; - - var isAudioType = function(type,name){ - return (type.match('audio.*') || name.match(/\.(ogg|mp3|wav)$/i)) ? true : false; - }; - - var readAsDataURL = function (file,index) { - - var deferred = $q.defer(); - - var reader = new FileReader(); - - reader.onloadstart = function(){ - deferred.notify(0); - }; - - reader.onload = function(event){ - - }; - - reader.onloadend = function(event){ - deferred.resolve({ - 'index':index, - 'result':reader.result - }); + scope.isFilesNull = true; + } + }; + + var parseFileType = function(file) { + var type = file.type; + var name = file.name; + if (isImageType(type, name)) { + return "image"; + } else if (isVideoType(type, name)) { + return "video"; + } else if (isAudioType(type, name)) { + return "audio"; + } + return "object"; + }; + + var isImageType = function(type, name) { + return (type.match('image.*') || name.match(/\.(gif|png|jpe?g)$/i)) ? true : false; + }; + + var isVideoType = function(type, name) { + return (type.match('video.*') || name.match(/\.(og?|mp4|webm|3gp)$/i)) ? true : false; + }; + + var isAudioType = function(type, name) { + return (type.match('audio.*') || name.match(/\.(ogg|mp3|wav)$/i)) ? true : false; + }; + + var readAsDataURL = function(file, index) { + + var deferred = $q.defer(); + + var reader = new FileReader(); + + reader.onloadstart = function() { + deferred.notify(0); + }; + + reader.onload = function(event) { + + }; + + reader.onloadend = function(event) { + deferred.resolve({ + 'index': index, + 'result': reader.result + }); scope.intLoading--; - scope.floatProgress = (intFilesCount-scope.intLoading)/intFilesCount*100; - }; + scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; + }; - reader.onerror = function(event){ - deferred.reject(reader.result); + reader.onerror = function(event) { + deferred.reject(reader.result); scope.intLoading--; - scope.floatProgress = (intFilesCount-scope.intLoading)/intFilesCount*100; - }; + scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; + }; - reader.onprogress = function(event){ - deferred.notify(event.loaded/event.total); - }; + reader.onprogress = function(event) { + deferred.notify(event.loaded / event.total); + }; - reader.readAsArrayBuffer(file); + reader.readAsArrayBuffer(file); - return deferred.promise; - }; + return deferred.promise; + }; - } + } - }; + }; }]); -})(window,window.angular); +})(window, window.angular); From bd5ef1590fe9210d2abd18f00a7a7e7de0a5d76c Mon Sep 17 00:00:00 2001 From: d0whc3r Date: Wed, 31 Aug 2016 00:19:53 +0200 Subject: [PATCH 2/4] src rebeautified --- src/lf-ng-md-file-input.js | 1268 ++++++++++++++++++------------------ 1 file changed, 634 insertions(+), 634 deletions(-) diff --git a/src/lf-ng-md-file-input.js b/src/lf-ng-md-file-input.js index f3012ad..ed566eb 100644 --- a/src/lf-ng-md-file-input.js +++ b/src/lf-ng-md-file-input.js @@ -1,741 +1,741 @@ (function(window, angular, undefined) { - 'use strict'; + 'use strict'; - var genLfObjId = function() { - return 'lfobjxxxxxxxx'.replace(/[xy]/g, function(c) { - var r = Math.random() * 16 | 0, - v = c == 'x' ? r : (r & 0x3 | 0x8); - return v.toString(16); - }); + var genLfObjId = function() { + return 'lfobjxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random() * 16 | 0, + v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + }; + + var lfNgMdFileinput = angular.module('lfNgMdFileInput', ['ngMaterial']); + + lfNgMdFileinput.directive('html5vfix', function() { + return { + restrict: 'A', + link: function(scope, element, attr) { + attr.$set('src', attr.vsrc); + } + } + }); + + lfNgMdFileinput.run(function($templateCache) { + $templateCache.put('lfNgMdFileinput.html', [ + '
', + '
', + '×', + '
', + '
', + '
{{strCaptionDragAndDrop}}
', + '
', + '
', + '
', + '
×
', + '', + '', + '', + '', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '', + '
', + '{{strCaptionPlaceholder}}', + '
', + '
', + '{{strCaption}}', + '
', + '', + '
', + '', + ' ', + '{{strCaptionRemove}}', + '', + '', + ' ', + '{{strCaptionBrowse}}', + '', //,onchange="angular.element(this).scope().onFileChanged(this)"/>', + '', + '
', + '
' + ].join('')); + }); + + lfNgMdFileinput.filter('lfTrusted', ['$sce', function($sce) { + return function(url) { + return $sce.trustAsResourceUrl(url); }; + }]); + + lfNgMdFileinput.directive('lfRequired', function() { + return { + restrict: 'A', + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + ctrl.$validators.required = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + return modelValue.length > 0; + }; + } + } + }); + + lfNgMdFileinput.directive('lfMaxcount', function() { + return { + restrict: 'A', + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfMaxcount', function(value) { + var intVal = parseInt(value, 10); + intMax = isNaN(intVal) ? -1 : intVal; + ctrl.$validate(); + }); + ctrl.$validators.maxcount = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + return modelValue.length <= intMax; + }; + } + } + }); + + lfNgMdFileinput.directive('lfFilesize', function() { + return { + restrict: 'A', + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfFilesize', function(value) { + var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; + if (!reg.test(value)) { + intMax = -1; + } else { + var sizes = ['Byte', 'KB', 'MB']; + var unit = value.match(reg)[1]; + var number = value.substring(0, value.indexOf(unit)); + sizes.every(function(obj, idx) { + if (unit === obj) { + intMax = parseInt(number) * Math.pow(1024, idx); + return false; + } else { + return true; + } + }); + } + ctrl.$validate(); + }); + ctrl.$validators.filesize = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + var boolValid = true; + modelValue.every(function(obj, idx) { + if (obj.lfFile.size > intMax) { + boolValid = false; + return false; + } else { + return true; + } + }); + return boolValid; + }; + } + } + }); + + lfNgMdFileinput.directive('lfTotalsize', function() { + return { + restrict: 'A', + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var intMax = -1; + attrs.$observe('lfTotalsize', function(value) { + var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; + if (!reg.test(value)) { + intMax = -1; + } else { + var sizes = ['Byte', 'KB', 'MB']; + var unit = value.match(reg)[1]; + var number = value.substring(0, value.indexOf(unit)); + sizes.every(function(obj, idx) { + if (unit === obj) { + intMax = parseInt(number) * Math.pow(1024, idx); + return false; + } else { + return true; + } + }); + } + ctrl.$validate(); + }); + ctrl.$validators.totalsize = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + var intTotal = 0; + angular.forEach(modelValue, function(obj, idx) { + intTotal = intTotal + obj.lfFile.size; + }); + return intTotal < intMax; + }; + } + } + }); + + lfNgMdFileinput.directive('lfMimetype', function() { + return { + restrict: 'A', + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + if (!ctrl) { + return; + } + var reg; + attrs.$observe('lfMimetype', function(value) { + reg = new RegExp(value, 'i'); + ctrl.$validate(); + }); + ctrl.$validators.mimetype = function(modelValue, viewValue) { + if (!modelValue) { + return false; + } + var boolValid = true; + modelValue.every(function(obj, idx) { + if (obj.lfFile.type.match(reg)) { + return true; + } else { + boolValid = false; + return false; + } + }); + return boolValid; + }; + } + } + }); + + lfNgMdFileinput.directive('lfNgMdFileInput', ['$q', '$compile', '$timeout', function($q, $compile, $timeout) { + return { + restrict: 'E', + templateUrl: 'lfNgMdFileinput.html', + replace: true, + require: 'ngModel', + scope: { + lfFiles: '=?', + lfApi: '=?', + lfOption: '=?', + lfCaption: '@?', + lfPlaceholder: '@?', + lfDragAndDropLabel: '@?', + lfBrowseLabel: '@?', + lfRemoveLabel: '@?', + lfOnFileClick: '=?', + accept: '@?', + ngDisabled: '=?' + }, + link: function(scope, element, attrs, ctrl) { + + var elFileinput = angular.element(element[0].querySelector('.lf-ng-md-file-input-tag')); + var elDragview = angular.element(element[0].querySelector('.lf-ng-md-file-input-drag')); + var elThumbnails = angular.element(element[0].querySelector('.lf-ng-md-file-input-thumbnails')); + + var isCustomCaption = false; + var intFilesCount = 0; + + scope.intLoading = 0; + scope.floatProgress = 0; + + scope.isPreview = false; + scope.isDrag = false; + scope.isMutiple = false; + scope.isProgress = false; + + if (angular.isDefined(attrs.preview)) { + scope.isPreview = true; + } - var lfNgMdFileinput = angular.module('lfNgMdFileInput', ['ngMaterial']); + if (angular.isDefined(attrs.drag)) { + scope.isDrag = true; + }; - lfNgMdFileinput.directive('html5vfix', function() { - return { - restrict: 'A', - link: function(scope, element, attr) { - attr.$set('src', attr.vsrc); + if (angular.isDefined(attrs.multiple)) { + elFileinput.attr('multiple', 'multiple'); + scope.isMutiple = true; + } else { + elFileinput.removeAttr('multiple'); + } + + if (angular.isDefined(attrs.progress)) { + scope.isProgress = true; + } + + scope.isDisabled = false; + + if (angular.isDefined(attrs.ngDisabled)) { + scope.$watch('ngDisabled', function(isDisabled) { + scope.isDisabled = isDisabled; + }); + } + + scope.strBrowseIconCls = 'lf-browse'; + scope.strRemoveIconCls = 'lf-remove'; + scope.strCaptionIconCls = 'lf-caption'; + scope.strUnknowIconCls = 'lf-unknow'; + + if (angular.isDefined(attrs.lfOption)) { + if (angular.isObject(scope.lfOption)) { + if (scope.lfOption.hasOwnProperty('browseIconCls')) { + scope.strBrowseIconCls = scope.lfOption.browseIconCls; + } + if (scope.lfOption.hasOwnProperty('removeIconCls')) { + scope.strRemoveIconCls = scope.lfOption.removeIconCls; + } + if (scope.lfOption.hasOwnProperty('captionIconCls')) { + scope.strCaptionIconCls = scope.lfOption.captionIconCls; } + if (scope.lfOption.hasOwnProperty('unknowIconCls')) { + scope.strUnknowIconCls = scope.lfOption.unknowIconCls; + } + } } - }); - lfNgMdFileinput.run(function($templateCache) { - $templateCache.put('lfNgMdFileinput.html', [ - '
', - '
', - '×', - '
', - '
', - '
{{strCaptionDragAndDrop}}
', - '
', - '
', - '
', - '
×
', - '', - '', - '', - '', - '
', - '', - '
', - '
', - '', - '
', - '
', - '
', - '
', - '
', - '
', - '
', - '', - '
', - '{{strCaptionPlaceholder}}', - '
', - '
', - '{{strCaption}}', - '
', - '', - '
', - '', - ' ', - '{{strCaptionRemove}}', - '', - '', - ' ', - '{{strCaptionBrowse}}', - '', //,onchange="angular.element(this).scope().onFileChanged(this)"/>', - '', - '
', - '
' - ].join('')); - }); + scope.accept = scope.accept || ''; - lfNgMdFileinput.filter('lfTrusted', ['$sce', function($sce) { - return function(url) { - return $sce.trustAsResourceUrl(url); + scope.lfFiles = []; + + scope[attrs.ngModel] = scope.lfFiles; + + scope.$watch('lfFiles.length', function(newVal, oldVal) { + ctrl.$validate(); + }); + + scope.lfApi = new function() { + var self = this; + self.removeAll = function() { + scope.removeAllFiles(); + }; + + self.removeByName = function(name) { + scope.removeFileByName(name); + }; }; - }]); - - lfNgMdFileinput.directive('lfRequired', function() { - return { - restrict: "A", - require: "ngModel", - link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - ctrl.$validators.required = function(modelValue, viewValue) { - if (!modelValue) { - return false; - } - return modelValue.length > 0; - }; - } + + scope.isFilesNull = true; + + scope.strCaption = ''; + + scope.strCaptionPlaceholder = 'Select file'; + + scope.strCaptionDragAndDrop = 'Drag & drop files here...'; + + scope.strCaptionBrowse = 'Browse'; + + scope.strCaptionRemove = 'Remove'; + + scope.strAriaLabel = ''; + + if (angular.isDefined(attrs.ariaLabel)) { + scope.strAriaLabel = attrs.ariaLabel; } - }); - lfNgMdFileinput.directive('lfMaxcount', function() { - return { - restrict: "A", - require: "ngModel", - link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfMaxcount', function(value) { - var intVal = parseInt(value, 10); - intMax = isNaN(intVal) ? -1 : intVal; - ctrl.$validate(); - }); - ctrl.$validators.maxcount = function(modelValue, viewValue) { - if (!modelValue) { - return false; - } - return modelValue.length <= intMax; - }; - } + if (angular.isDefined(attrs.lfPlaceholder)) { + scope.$watch('lfPlaceholder', function(newVal) { + scope.strCaptionPlaceholder = newVal; + }); } - }); - lfNgMdFileinput.directive('lfFilesize', function() { - return { - restrict: "A", - require: "ngModel", - link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfFilesize', function(value) { - var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; - if (!reg.test(value)) { - intMax = -1; - } else { - var sizes = ['Byte', 'KB', 'MB']; - var unit = value.match(reg)[1]; - var number = value.substring(0, value.indexOf(unit)); - sizes.every(function(obj, idx) { - if (unit === obj) { - intMax = parseInt(number) * Math.pow(1024, idx); - return false; - } else { - return true; - } - }); - } - ctrl.$validate(); - }); - ctrl.$validators.filesize = function(modelValue, viewValue) { - if (!modelValue) { - return false; - } - var boolValid = true; - modelValue.every(function(obj, idx) { - if (obj.lfFile.size > intMax) { - boolValid = false; - return false; - } else { - return true; - } - }); - return boolValid; - }; - } + if (angular.isDefined(attrs.lfCaption)) { + isCustomCaption = true; + scope.$watch('lfCaption', function(newVal) { + scope.strCaption = newVal; + }); } - }); - lfNgMdFileinput.directive('lfTotalsize', function() { - return { - restrict: "A", - require: "ngModel", - link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - var intMax = -1; - attrs.$observe('lfTotalsize', function(value) { - var reg = /^[1-9][0-9]*(Byte|KB|MB)$/; - if (!reg.test(value)) { - intMax = -1; - } else { - var sizes = ['Byte', 'KB', 'MB']; - var unit = value.match(reg)[1]; - var number = value.substring(0, value.indexOf(unit)); - sizes.every(function(obj, idx) { - if (unit === obj) { - intMax = parseInt(number) * Math.pow(1024, idx); - return false; - } else { - return true; - } - }); - } - ctrl.$validate(); - }); - ctrl.$validators.totalsize = function(modelValue, viewValue) { - if (!modelValue) { - return false; - } - var intTotal = 0; - angular.forEach(modelValue, function(obj, idx) { - intTotal = intTotal + obj.lfFile.size; - }); - return intTotal < intMax; - }; - } + if (scope.lfDragAndDropLabel) { + scope.strCaptionDragAndDrop = scope.lfDragAndDropLabel; } - }); - lfNgMdFileinput.directive('lfMimetype', function() { - return { - restrict: "A", - require: "ngModel", - link: function(scope, element, attrs, ctrl) { - if (!ctrl) { - return; - } - var reg; - attrs.$observe('lfMimetype', function(value) { - reg = new RegExp(value, "i"); - ctrl.$validate(); - }); - ctrl.$validators.mimetype = function(modelValue, viewValue) { - if (!modelValue) { - return false; - } - var boolValid = true; - modelValue.every(function(obj, idx) { - if (obj.lfFile.type.match(reg)) { - return true; - } else { - boolValid = false; - return false; - } - }); - return boolValid; - }; - } + if (scope.lfBrowseLabel) { + scope.strCaptionBrowse = scope.lfBrowseLabel; } - }); - lfNgMdFileinput.directive('lfNgMdFileInput', ['$q', '$compile', '$timeout', function($q, $compile, $timeout) { - return { - restrict: 'E', - templateUrl: 'lfNgMdFileinput.html', - replace: true, - require: "ngModel", - scope: { - lfFiles: '=?', - lfApi: '=?', - lfOption: '=?', - lfCaption: '@?', - lfPlaceholder: '@?', - lfDragAndDropLabel: '@?', - lfBrowseLabel: '@?', - lfRemoveLabel: '@?', - lfOnFileClick: '=?', - accept: '@?', - ngDisabled: '=?' - }, - link: function(scope, element, attrs, ctrl) { - - var elFileinput = angular.element(element[0].querySelector('.lf-ng-md-file-input-tag')); - var elDragview = angular.element(element[0].querySelector('.lf-ng-md-file-input-drag')); - var elThumbnails = angular.element(element[0].querySelector('.lf-ng-md-file-input-thumbnails')); - - var isCustomCaption = false; - var intFilesCount = 0; - - scope.intLoading = 0; - scope.floatProgress = 0; - - scope.isPreview = false; - scope.isDrag = false; - scope.isMutiple = false; - scope.isProgress = false; - - if (angular.isDefined(attrs.preview)) { - scope.isPreview = true; - } + if (scope.lfRemoveLabel) { + scope.strCaptionRemove = scope.lfRemoveLabel; + } - if (angular.isDefined(attrs.drag)) { - scope.isDrag = true; - }; + elDragview.bind('dragover', function(e) { + e.stopPropagation(); + e.preventDefault(); + if (scope.isDisabled || !scope.isDrag) { + return; + } + elDragview.addClass('lf-ng-md-file-input-drag-hover'); + }); - if (angular.isDefined(attrs.multiple)) { - elFileinput.attr('multiple', 'multiple'); - scope.isMutiple = true; - } else { - elFileinput.removeAttr('multiple'); - } + elDragview.bind('dragleave', function(e) { + e.stopPropagation(); + e.preventDefault(); + if (scope.isDisabled || !scope.isDrag) { + return; + } + elDragview.removeClass('lf-ng-md-file-input-drag-hover'); + }); - if (angular.isDefined(attrs.progress)) { - scope.isProgress = true; - } + elDragview.bind('drop', function(e) { - scope.isDisabled = false; + e.stopPropagation(); + e.preventDefault(); - if (angular.isDefined(attrs.ngDisabled)) { - scope.$watch('ngDisabled', function(isDisabled) { - scope.isDisabled = isDisabled; - }); - } + if (scope.isDisabled || !scope.isDrag) { + return; + } - scope.strBrowseIconCls = "lf-browse"; - scope.strRemoveIconCls = "lf-remove"; - scope.strCaptionIconCls = "lf-caption"; - scope.strUnknowIconCls = "lf-unknow"; - - if (angular.isDefined(attrs.lfOption)) { - if (angular.isObject(scope.lfOption)) { - if (scope.lfOption.hasOwnProperty('browseIconCls')) { - scope.strBrowseIconCls = scope.lfOption.browseIconCls; - } - if (scope.lfOption.hasOwnProperty('removeIconCls')) { - scope.strRemoveIconCls = scope.lfOption.removeIconCls; - } - if (scope.lfOption.hasOwnProperty('captionIconCls')) { - scope.strCaptionIconCls = scope.lfOption.captionIconCls; - } - if (scope.lfOption.hasOwnProperty('unknowIconCls')) { - scope.strUnknowIconCls = scope.lfOption.unknowIconCls; - } - } - } + elDragview.removeClass('lf-ng-md-file-input-drag-hover'); - scope.accept = scope.accept || ''; + if (angular.isObject(e.originalEvent)) { + e = e.originalEvent; + } - scope.lfFiles = []; + var files = e.target.files || e.dataTransfer.files; + var i = 0; - scope[attrs.ngModel] = scope.lfFiles; + if (files.length <= 0) { + return; + } - scope.$watch('lfFiles.length', function(newVal, oldVal) { - ctrl.$validate(); - }); + var names = scope.lfFiles.map(function(obj) { + return obj.lfFileName; + }); - scope.lfApi = new function() { - var self = this; - self.removeAll = function() { - scope.removeAllFiles(); - }; + var regexp = new RegExp(scope.accept, 'i'); - self.removeByName = function(name) { - scope.removeFileByName(name); - }; - }; + scope.floatProgress = 0; - scope.isFilesNull = true; + if (scope.isMutiple) { + intFilesCount = files.length; + for (var i = 0; i < files.length; i++) { + var file = files[i]; + if (file.type.match(regexp)) { + if (names.indexOf(file.name) != -1) { + scope.removeFileByName(file.name); + } + setTimeout(readFile(file), i * 100); + } + } + } else { + intFilesCount = 1; + for (var i = 0; i < files.length; i++) { + var file = files[i]; + if (file.type.match(regexp)) { + scope.removeAllFiles(); + setTimeout(readFile(file), 100); + break; + } + } + } - scope.strCaption = ''; + }); - scope.strCaptionPlaceholder = 'Select file'; + scope.openDialog = function(event, el) { + if (event) { + $timeout(function() { + event.preventDefault(); + event.stopPropagation(); + var elFileinput = event.target.children[2]; + if (elFileinput !== undefined) { + elFileinput.click(); + } + }, 0); + } + }; - scope.strCaptionDragAndDrop = 'Drag & drop files here...'; + scope.removeAllFiles = function(event) { - scope.strCaptionBrowse = 'Browse'; + if (scope.isDisabled) { + return; + } - scope.strCaptionRemove = 'Remove'; + scope.lfFiles.length = 0; - scope.strAriaLabel = ""; + elThumbnails.empty(); - if (angular.isDefined(attrs.ariaLabel)) { - scope.strAriaLabel = attrs.ariaLabel; - } + updateTextCaption(); - if (angular.isDefined(attrs.lfPlaceholder)) { - scope.$watch('lfPlaceholder', function(newVal) { - scope.strCaptionPlaceholder = newVal; - }); - } + }; - if (angular.isDefined(attrs.lfCaption)) { - isCustomCaption = true; - scope.$watch('lfCaption', function(newVal) { - scope.strCaption = newVal; - }); - } + scope.removeFileByName = function(name, event) { - if (scope.lfDragAndDropLabel) { - scope.strCaptionDragAndDrop = scope.lfDragAndDropLabel; - } + if (scope.isDisabled) { + return; + } - if (scope.lfBrowseLabel) { - scope.strCaptionBrowse = scope.lfBrowseLabel; - } + scope.lfFiles.every(function(obj, idx) { + if (obj.lfFileName == name) { + obj.element.remove(); + scope.lfFiles.splice(idx, 1); + return false; + } + return true; + }); - if (scope.lfRemoveLabel) { - scope.strCaptionRemove = scope.lfRemoveLabel; - } + updateTextCaption(); - elDragview.bind("dragover", function(e) { - e.stopPropagation(); - e.preventDefault(); - if (scope.isDisabled || !scope.isDrag) { - return; - } - elDragview.addClass("lf-ng-md-file-input-drag-hover"); - }); - - elDragview.bind("dragleave", function(e) { - e.stopPropagation(); - e.preventDefault(); - if (scope.isDisabled || !scope.isDrag) { - return; - } - elDragview.removeClass("lf-ng-md-file-input-drag-hover"); - }); - - elDragview.bind("drop", function(e) { - - e.stopPropagation(); - e.preventDefault(); - - if (scope.isDisabled || !scope.isDrag) { - return; - } - - elDragview.removeClass("lf-ng-md-file-input-drag-hover"); - - if (angular.isObject(e.originalEvent)) { - e = e.originalEvent; - } - - var files = e.target.files || e.dataTransfer.files; - var i = 0; - - if (files.length <= 0) { - return; - } - - var names = scope.lfFiles.map(function(obj) { - return obj.lfFileName; - }); - - var regexp = new RegExp(scope.accept, "i"); - - scope.floatProgress = 0; - - if (scope.isMutiple) { - intFilesCount = files.length; - for (var i = 0; i < files.length; i++) { - var file = files[i]; - if (file.type.match(regexp)) { - if (names.indexOf(file.name) != -1) { - scope.removeFileByName(file.name); - } - setTimeout(readFile(file), i * 100); - } - } - } else { - intFilesCount = 1; - for (var i = 0; i < files.length; i++) { - var file = files[i]; - if (file.type.match(regexp)) { - scope.removeAllFiles(); - setTimeout(readFile(file), 100); - break; - } - } - } - - }); - - scope.openDialog = function(event, el) { - if (event) { - $timeout(function() { - event.preventDefault(); - event.stopPropagation(); - var elFileinput = event.target.children[2]; - if (elFileinput !== undefined) { - elFileinput.click(); - } - }, 0); - } - }; - - scope.removeAllFiles = function(event) { - - if (scope.isDisabled) { - return; - } - - scope.lfFiles.length = 0; - - elThumbnails.empty(); - - updateTextCaption(); - - }; - - scope.removeFileByName = function(name, event) { - - if (scope.isDisabled) { - return; - } - - scope.lfFiles.every(function(obj, idx) { - if (obj.lfFileName == name) { - obj.element.remove(); - scope.lfFiles.splice(idx, 1); - return false; - } - return true; - }); - - updateTextCaption(); + }; - }; + scope.onFileChanged = function(e) { - scope.onFileChanged = function(e) { - - var files = e.files || e.target.files; - - var names = scope.lfFiles.map(function(obj) { - return obj.lfFileName; - }); - - if (files.length <= 0) { - return; - } - - scope.floatProgress = 0; + var files = e.files || e.target.files; - if (scope.isMutiple) { - intFilesCount = files.length; - for (var i = 0; i < files.length; i++) { - var file = files[i]; - if (names.indexOf(file.name) != -1) { - scope.removeFileByName(file.name); - } - setTimeout(readFile(file), i * 100); - } - } else { - intFilesCount = 1; - for (var i = 0; i < files.length; i++) { - var file = files[i]; - scope.removeAllFiles(); - setTimeout(readFile(file), 100); - break; - } - } + var names = scope.lfFiles.map(function(obj) { + return obj.lfFileName; + }); - elFileinput.val(''); + if (files.length <= 0) { + return; + } - }; + scope.floatProgress = 0; - elFileinput.bind("change", scope.onFileChanged); + if (scope.isMutiple) { + intFilesCount = files.length; + for (var i = 0; i < files.length; i++) { + var file = files[i]; + if (names.indexOf(file.name) != -1) { + scope.removeFileByName(file.name); + } + setTimeout(readFile(file), i * 100); + } + } else { + intFilesCount = 1; + for (var i = 0; i < files.length; i++) { + var file = files[i]; + scope.removeAllFiles(); + setTimeout(readFile(file), 100); + break; + } + } - scope.onFileClick = function(key) { - if (angular.isFunction(scope.lfOnFileClick)) { - scope.lfFiles.every(function(obj, idx) { - if (obj.key == key) { - scope.lfOnFileClick(obj, idx); - return false; - } else { - return true; - } - }); - } - }; + elFileinput.val(''); - var readFile = function(file) { + }; - scope.intLoading++; + elFileinput.bind('change', scope.onFileChanged); + + scope.onFileClick = function(key) { + if (angular.isFunction(scope.lfOnFileClick)) { + scope.lfFiles.every(function(obj, idx) { + if (obj.key == key) { + scope.lfOnFileClick(obj, idx); + return false; + } else { + return true; + } + }); + } + }; - readAsDataURL(file).then(function(result) { + var readFile = function(file) { - var lfFile = file; - var lfFileName = file.name; - var lfFileType = file.type; - var lfTagType = parseFileType(file); - var lfDataUrl = window.URL.createObjectURL(file); + scope.intLoading++; - var lfFileObj = { - "key": genLfObjId(), - "lfFile": lfFile, - "lfFileName": lfFileName, - "lfDataUrl": lfDataUrl, - "lfTagType": lfTagType - }; + readAsDataURL(file).then(function(result) { - scope.lfFiles.push(lfFileObj); + var lfFile = file; + var lfFileName = file.name; + var lfFileType = file.type; + var lfTagType = parseFileType(file); + var lfDataUrl = window.URL.createObjectURL(file); - var elFrame = angular.element('
'); + var lfFileObj = { + 'key': genLfObjId(), + 'lfFile': lfFile, + 'lfFileName': lfFileName, + 'lfDataUrl': lfDataUrl, + 'lfTagType': lfTagType + }; - var elFrameX = angular.element('
×
'); + scope.lfFiles.push(lfFileObj); - var tplPreview = ''; + var elFrame = angular.element('
'); - if (lfTagType == 'image') { + var elFrameX = angular.element('
×
'); - tplPreview = ''; + var tplPreview = ''; - } else if (lfTagType == 'video') { + if (lfTagType == 'image') { - tplPreview = ['' - ].join(''); + tplPreview = ''; - } else if (lfTagType == 'audio') { + } else if (lfTagType == 'video') { - tplPreview = ['' - ].join(''); + tplPreview = ['' + ].join(''); - } else { + } else if (lfTagType == 'audio') { - tplPreview = ['', - '
', - '', - '
', - '
' - ].join(''); + tplPreview = ['' + ].join(''); - } + } else { - var elPreview = angular.element(tplPreview); + tplPreview = ['', + '
', + '', + '
', + '
' + ].join(''); - var elFooter = angular.element(''); + } - elFrame.append(elFrameX); + var elPreview = angular.element(tplPreview); - elFrame.append(elPreview); + var elFooter = angular.element(''); - elFrame.append(elFooter); + elFrame.append(elFrameX); - $compile(elFrame)(scope); + elFrame.append(elPreview); - elThumbnails.append(elFrame); + elFrame.append(elFooter); - lfFileObj.element = elFrame; + $compile(elFrame)(scope); - updateTextCaption(); + elThumbnails.append(elFrame); - }, function(error) { + lfFileObj.element = elFrame; - }, function(notify) { + updateTextCaption(); - }); + }, function(error) { - }; + }, function(notify) { - var updateTextCaption = function() { - if (scope.lfFiles.length == 1) { - if (!isCustomCaption) { - scope.strCaption = '' + scope.lfFiles[0].lfFileName; - } - scope.isFilesNull = false; - } else if (scope.lfFiles.length > 1) { - if (!isCustomCaption) { - scope.strCaption = '' + scope.lfFiles.length + ' files selected'; - } - scope.isFilesNull = false; - } else { - if (!isCustomCaption) { - scope.strCaption = ''; - } - scope.isFilesNull = true; - } - }; + }); - var parseFileType = function(file) { - var type = file.type; - var name = file.name; - if (isImageType(type, name)) { - return "image"; - } else if (isVideoType(type, name)) { - return "video"; - } else if (isAudioType(type, name)) { - return "audio"; - } - return "object"; - }; + }; - var isImageType = function(type, name) { - return (type.match('image.*') || name.match(/\.(gif|png|jpe?g)$/i)) ? true : false; - }; + var updateTextCaption = function() { + if (scope.lfFiles.length == 1) { + if (!isCustomCaption) { + scope.strCaption = '' + scope.lfFiles[0].lfFileName; + } + scope.isFilesNull = false; + } else if (scope.lfFiles.length > 1) { + if (!isCustomCaption) { + scope.strCaption = '' + scope.lfFiles.length + ' files selected'; + } + scope.isFilesNull = false; + } else { + if (!isCustomCaption) { + scope.strCaption = ''; + } + scope.isFilesNull = true; + } + }; - var isVideoType = function(type, name) { - return (type.match('video.*') || name.match(/\.(og?|mp4|webm|3gp)$/i)) ? true : false; - }; + var parseFileType = function(file) { + var type = file.type; + var name = file.name; + if (isImageType(type, name)) { + return 'image'; + } else if (isVideoType(type, name)) { + return 'video'; + } else if (isAudioType(type, name)) { + return 'audio'; + } + return 'object'; + }; - var isAudioType = function(type, name) { - return (type.match('audio.*') || name.match(/\.(ogg|mp3|wav)$/i)) ? true : false; - }; + var isImageType = function(type, name) { + return (type.match('image.*') || name.match(/\.(gif|png|jpe?g)$/i)) ? true : false; + }; - var readAsDataURL = function(file, index) { + var isVideoType = function(type, name) { + return (type.match('video.*') || name.match(/\.(og?|mp4|webm|3gp)$/i)) ? true : false; + }; - var deferred = $q.defer(); + var isAudioType = function(type, name) { + return (type.match('audio.*') || name.match(/\.(ogg|mp3|wav)$/i)) ? true : false; + }; - var reader = new FileReader(); + var readAsDataURL = function(file, index) { - reader.onloadstart = function() { - deferred.notify(0); - }; + var deferred = $q.defer(); - reader.onload = function(event) { + var reader = new FileReader(); - }; + reader.onloadstart = function() { + deferred.notify(0); + }; - reader.onloadend = function(event) { - deferred.resolve({ - 'index': index, - 'result': reader.result - }); - scope.intLoading--; - scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; - }; + reader.onload = function(event) { - reader.onerror = function(event) { - deferred.reject(reader.result); - scope.intLoading--; - scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; - }; + }; - reader.onprogress = function(event) { - deferred.notify(event.loaded / event.total); - }; + reader.onloadend = function(event) { + deferred.resolve({ + 'index': index, + 'result': reader.result + }); + scope.intLoading--; + scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; + }; - reader.readAsArrayBuffer(file); + reader.onerror = function(event) { + deferred.reject(reader.result); + scope.intLoading--; + scope.floatProgress = (intFilesCount - scope.intLoading) / intFilesCount * 100; + }; - return deferred.promise; - }; + reader.onprogress = function(event) { + deferred.notify(event.loaded / event.total); + }; - } + reader.readAsArrayBuffer(file); + return deferred.promise; }; - }]); + } + + }; + + }]); })(window, window.angular); From 6a156fffbf87ed38591cbddb8febdc635e479a1e Mon Sep 17 00:00:00 2001 From: d0whc3r Date: Wed, 31 Aug 2016 00:26:37 +0200 Subject: [PATCH 3/4] add filepath attribute --- src/lf-ng-md-file-input.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lf-ng-md-file-input.js b/src/lf-ng-md-file-input.js index ed566eb..44396c3 100644 --- a/src/lf-ng-md-file-input.js +++ b/src/lf-ng-md-file-input.js @@ -576,6 +576,7 @@ var lfFile = file; var lfFileName = file.name; var lfFileType = file.type; + var lfFilePath = file.path; var lfTagType = parseFileType(file); var lfDataUrl = window.URL.createObjectURL(file); @@ -583,6 +584,7 @@ 'key': genLfObjId(), 'lfFile': lfFile, 'lfFileName': lfFileName, + 'lfFilePath': lfFilePath, 'lfDataUrl': lfDataUrl, 'lfTagType': lfTagType }; From 777a606e577d7e83b9156cfc8bbf773ccea587e7 Mon Sep 17 00:00:00 2001 From: d0whc3r Date: Wed, 31 Aug 2016 20:03:50 +0200 Subject: [PATCH 4/4] Fixed misspelled widht --- dist/lf-ng-md-file-input.css | 6 +++--- dist/lf-ng-md-file-input.min.css | 2 +- src/lf-ng-md-file-input.scss | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/lf-ng-md-file-input.css b/dist/lf-ng-md-file-input.css index 78c246c..a4010af 100644 --- a/dist/lf-ng-md-file-input.css +++ b/dist/lf-ng-md-file-input.css @@ -66,17 +66,17 @@ } .lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame > video { height: 160px; - widht: auto; + width: auto; max-width: 100%; } .lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame > audio { height: 160px; - widht: auto; + width: auto; max-width: 100%; } .lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame > object { height: 160px; - widht: auto; + width: auto; max-width: 100%; } .lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame > object .lf-ng-md-file-input-preview-default { diff --git a/dist/lf-ng-md-file-input.min.css b/dist/lf-ng-md-file-input.min.css index da728a1..2f01da0 100644 --- a/dist/lf-ng-md-file-input.min.css +++ b/dist/lf-ng-md-file-input.min.css @@ -1 +1 @@ -.lf-ng-md-file-input{margin-top:5px;margin-bottom:5px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);border:1px solid #ddd;padding:5px;margin-bottom:10px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container.disabled{background-color:rgba(0,0,0,.03)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-x{float:none;text-align:right;margin-bottom:5px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-x:focus{outline:0;border:0}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag{-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;border:2px dashed #DDD}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-hover{border:2px dashed #fff;background-color:rgba(0,0,0,.1)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-text-container{height:200px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-text-container .lf-ng-md-file-input-drag-text{font-size:40px;font-weight:700;color:rgba(0,0,0,.26)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame{-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);display:table;margin:8px;height:160px;border:1px solid #ddd;padding:6px;float:left;text-align:center;vertical-align:middle}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame:focus{outline:0}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>img{height:160px;width:auto;max-width:100%}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>audio,.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object,.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>video{height:160px;widht:auto;max-width:100%}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object .lf-ng-md-file-input-preview-default{height:160px;width:160px;text-align:left}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object .lf-ng-md-file-input-preview-default .lf-ng-md-file-input-preview-icon{width:80%;height:80%;margin-top:10%;margin-left:10%;background-size:cover}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame .lf-ng-md-file-input-frame-caption{margin:0 auto;width:160px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-top:4px;font-size:11px;color:#777}.lf-ng-md-file-input .lf-ng-md-file-input-container{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26)}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption{-moz-border-radius:5px 0 0 5px;-webkit-border-radius:5px;border-radius:5px 0 0 5px;position:relative;overflow:hidden;z-index:2;padding:0 8px}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption.disabled{background-color:rgba(0,0,0,.03)}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption .lf-ng-md-file-input-caption-text{margin-left:8px;font-weight:700}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption .lf-ng-md-file-input-caption-text-default{margin-left:8px;color:rgba(0,0,0,.26);font-weight:700}.lf-ng-md-file-input .lf-ng-md-file-input-container md-progress-linear{position:absolute;bottom:0;left:0}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-icon{background-size:cover}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button{display:inline-block;vertical-align:middle;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;-moz-border-radius:none;-webkit-border-radius:none;border-radius:none;margin:0;padding:0 8px;min-height:initial;min-width:100px}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button.lf-ng-md-file-input-button-brower{-moz-border-radius:0 5px 5px 0;-webkit-border-radius:0;border-radius:0 5px 5px 0}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button.lf-ng-md-file-input-button-remove{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;z-index:2}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised .lf-ng-md-file-input-tag,.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button .lf-ng-md-file-input-tag{filter:alpha(Opacity=0);opacity:0;display:block;position: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Ii8+PC9zdmc+)} \ No newline at end of file +.lf-ng-md-file-input{margin-top:5px;margin-bottom:5px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);border:1px solid #ddd;padding:5px;margin-bottom:10px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container.disabled{background-color:rgba(0,0,0,.03)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-x{float:none;text-align:right;margin-bottom:5px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-x:focus{outline:0;border:0}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag{-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;border:2px dashed #DDD}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-hover{border:2px dashed #fff;background-color:rgba(0,0,0,.1)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-text-container{height:200px}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-drag-text-container .lf-ng-md-file-input-drag-text{font-size:40px;font-weight:700;color:rgba(0,0,0,.26)}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame{-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);display:table;margin:8px;height:160px;border:1px solid #ddd;padding:6px;float:left;text-align:center;vertical-align:middle}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame:focus{outline:0}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>audio,.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>img,.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object,.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>video{height:160px;width:auto;max-width:100%}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object .lf-ng-md-file-input-preview-default{height:160px;width:160px;text-align:left}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame>object .lf-ng-md-file-input-preview-default .lf-ng-md-file-input-preview-icon{width:80%;height:80%;margin-top:10%;margin-left:10%;background-size:cover}.lf-ng-md-file-input .lf-ng-md-file-input-preview-container .lf-ng-md-file-input-frame .lf-ng-md-file-input-frame-caption{margin:0 auto;width:160px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-top:4px;font-size:11px;color:#777}.lf-ng-md-file-input .lf-ng-md-file-input-container{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26)}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption{-moz-border-radius:5px 0 0 5px;-webkit-border-radius:5px;border-radius:5px 0 0 5px;position:relative;overflow:hidden;z-index:2;padding:0 8px}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption.disabled{background-color:rgba(0,0,0,.03)}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption .lf-ng-md-file-input-caption-text{margin-left:8px;font-weight:700}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-ng-md-file-input-caption .lf-ng-md-file-input-caption-text-default{margin-left:8px;color:rgba(0,0,0,.26);font-weight:700}.lf-ng-md-file-input .lf-ng-md-file-input-container md-progress-linear{position:absolute;bottom:0;left:0}.lf-ng-md-file-input .lf-ng-md-file-input-container .lf-icon{background-size:cover}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button{display:inline-block;vertical-align:middle;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;-moz-border-radius:none;-webkit-border-radius:none;border-radius:none;margin:0;padding:0 8px;min-height:initial;min-width:100px}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button.lf-ng-md-file-input-button-brower{-moz-border-radius:0 5px 5px 0;-webkit-border-radius:0;border-radius:0 5px 5px 0}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button.lf-ng-md-file-input-button-remove{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;z-index:2}.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised .lf-ng-md-file-input-tag,.lf-ng-md-file-input .lf-ng-md-file-input-container .md-raised.lf-ng-md-file-input-button .lf-ng-md-file-input-tag{filter:alpha(Opacity=0);opacity:0;display:block;position:absolute;top:0;left:0;min-width:100%;min-height:100%;background:none;cursor:inherit}.lf-ng-md-file-input .lf-caption{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSI1Ni4yNSIgaWQ9InN2ZzIiIHZlcnNpb249IjEuMSIgd2lkdGg9IjU2LjI1IiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi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veGxpbmsiPjxwYXRoIGQ9Ik0yMi41LDZjLTItMi01LjItMi03LjIsMGwtOC43LDguNmMtMS4yLDEuMi0xLjIsMy4xLDAsNC4zYzEuMiwxLjIsMy4xLDEuMiw0LjMsMGw3LjItNy4yYzAuNC0wLjQsMC40LTEsMC0xLjQgIGMtMC40LTAuNC0xLTAuNC0xLjQsMGwtNy4yLDcuMmMtMC40LDAuNC0xLDAuNC0xLjQsMGMtMC40LTAuNC0wLjQtMSwwLTEuNGw4LjctOC43YzEuMi0xLjIsMy4xLTEuMiw0LjMsMGMxLjIsMS4yLDEuMiwzLjEsMCw0LjMgIGwtOC43LDguNmMtMiwyLTUuMiwyLTcuMiwwYy0yLTItMi01LjIsMC03LjJMMTYuNywxLjdjMC40LTAuNCwwLjQtMSwwLTEuNHMtMS0wLjQtMS40LDBMMy43LDExLjhjLTIuOCwyLjgtMi44LDcuMywwLDEwLjEgIGMyLjgsMi44LDcuMywyLjgsMTAuMSwwbDguNy04LjZDMjQuNCwxMS4zLDI0LjQsOCwyMi41LDZ6Ii8+PC9zdmc+)} \ No newline at end of file diff --git a/src/lf-ng-md-file-input.scss b/src/lf-ng-md-file-input.scss index 35ea750..7c27b26 100644 --- a/src/lf-ng-md-file-input.scss +++ b/src/lf-ng-md-file-input.scss @@ -58,17 +58,17 @@ } >video{ height: 160px; - widht:auto; + width:auto; max-width: 100%; } >audio{ height: 160px; - widht:auto; + width:auto; max-width: 100%; } >object{ height: 160px; - widht:auto; + width:auto; max-width: 100%; .lf-ng-md-file-input-preview-default{ height:160px;