|
11 | 11 | var Esc = 'Esc'; |
12 | 12 | var Space = ' '; |
13 | 13 |
|
| 14 | + var noop = function () { |
| 15 | + }; |
| 16 | + |
14 | 17 | var hasClass, addClass, removeClass; |
15 | 18 | if (document.body.classList) { |
16 | 19 | hasClass = function (el, className) { |
|
706 | 709 | }, onLacksMkdir); |
707 | 710 | } |
708 | 711 |
|
709 | | - function switchToFileMode() { |
710 | | - if (optFile && optActive !== optFile) { |
711 | | - optFile.focus(); |
712 | | - optFile.click(); |
713 | | - } |
714 | | - } |
715 | | - |
716 | | - function switchToDirMode() { |
717 | | - if (optDirFile) { |
718 | | - if (optActive !== optDirFile) { |
719 | | - optDirFile.focus(); |
720 | | - optDirFile.click(); |
721 | | - } |
722 | | - } else if (optInnerDirFile) { |
723 | | - if (optActive !== optInnerDirFile) { |
724 | | - optInnerDirFile.focus(); |
725 | | - optInnerDirFile.click(); |
726 | | - } |
727 | | - } |
728 | | - } |
| 712 | + var switchToFileMode = noop; |
| 713 | + var switchToDirMode = noop; |
729 | 714 |
|
730 | 715 | function enableAddDirFile() { |
731 | 716 | var classHidden = 'hidden'; |
|
841 | 826 | onClickOptFile(); // prevent clear input files |
842 | 827 | } |
843 | 828 | }); |
| 829 | + |
| 830 | + switchToFileMode = function () { |
| 831 | + if (optFile && optActive !== optFile) { |
| 832 | + optFile.focus(); |
| 833 | + onClickOptFile(true); |
| 834 | + } |
| 835 | + } |
| 836 | + |
| 837 | + switchToDirMode = function () { |
| 838 | + if (optDirFile) { |
| 839 | + if (optActive !== optDirFile) { |
| 840 | + optDirFile.focus(); |
| 841 | + onClickOptDirFile(); |
| 842 | + } |
| 843 | + } else if (optInnerDirFile) { |
| 844 | + if (optActive !== optInnerDirFile) { |
| 845 | + optInnerDirFile.focus(); |
| 846 | + onClickOptInnerDirFile(); |
| 847 | + } |
| 848 | + } |
| 849 | + } |
844 | 850 | } |
845 | 851 |
|
846 | 852 | function enableUploadProgress() { // also fix Safari upload filename has no path info |
|
0 commit comments