From b8bb659e5d03fafc63a80446ccffb1c614df0edb Mon Sep 17 00:00:00 2001 From: rnicholus Date: Fri, 20 Oct 2017 15:56:52 -0500 Subject: [PATCH] feat(features.js): auto-detect folder support closes #1703 --- client/js/features.js | 14 +++++++------- client/js/version.js | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/js/features.js b/client/js/features.js index 6cdb29bc2..cb9bc3c41 100644 --- a/client/js/features.js +++ b/client/js/features.js @@ -38,12 +38,6 @@ qq.supportedFeatures = (function() { return supported; } - //only way to test for Filesystem API support since webkit does not expose the DataTransfer interface - function isChrome21OrHigher() { - return (qq.chrome() || qq.opera()) && - navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/) !== undefined; - } - //only way to test for complete Clipboard API support at this time function isChrome14OrHigher() { return (qq.chrome() || qq.opera()) && @@ -109,7 +103,13 @@ qq.supportedFeatures = (function() { supportsFileDrop = supportsAjaxFileUploading && isDragAndDropSupported(); - supportsFolderDrop = supportsFileDrop && isChrome21OrHigher(); + // adapted from https://stackoverflow.com/a/23278460/486979 + supportsFolderDrop = supportsFileDrop && (function() { + var input = document.createElement("input"); + + input.type = "file"; + return !!("webkitdirectory" in (input || document.querySelectorAll("input[type=file]")[0])); + }()); supportsChunking = supportsAjaxFileUploading && qq.isFileChunkingSupported(); diff --git a/client/js/version.js b/client/js/version.js index beaffb809..d00dc3133 100644 --- a/client/js/version.js +++ b/client/js/version.js @@ -1,2 +1,2 @@ /*global qq */ -qq.version = "5.16.0-alpha.14"; +qq.version = "5.16.0-alpha.15"; diff --git a/package.json b/package.json index 710a232b9..d44823162 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "Fine Uploader", "main": "lib/traditional.js", "types" : "typescript/fine-uploader.d.ts", - "version": "5.16.0-alpha.14", + "version": "5.16.0-alpha.15", "description": "Multiple file upload plugin with progress-bar, drag-and-drop, direct-to-S3 & Azure uploading, client-side image scaling, preview generation, form support, chunking, auto-resume, and tons of other features.", "keywords": [ "amazon",