Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChirayu Chiripal <chirayu.chiripal@gmail.com>2014-07-25 13:59:43 +0400
committerChirayu Chiripal <chirayu.chiripal@gmail.com>2014-07-25 14:16:06 +0400
commite7087eb698ad8b8a898b7634b80d6d02193328a5 (patch)
treef9bd10b9cdc322d952b7c7e2d681ad5f5942495b /js/common.js
parent6330df41758f6323b08d564720bd7d93c62ca370 (diff)
check dragged element is file or not
Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
Diffstat (limited to 'js/common.js')
-rw-r--r--js/common.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/js/common.js b/js/common.js
index 87387dc380..435cba40a1 100644
--- a/js/common.js
+++ b/js/common.js
@@ -448,14 +448,31 @@ PMA_DROP_IMPORT = {
* @return void
*/
_dragenter : function (event) {
+ event.stopPropagation();
+ event.preventDefault();
+ if (!PMA_DROP_IMPORT._hasFiles(event)) {
+ return;
+ }
if (PMA_commonParams.get('db') === '') {
$(".pma_drop_handler").html(PMA_messages.dropImportSelectDB);
} else {
$(".pma_drop_handler").html(PMA_messages.dropImportDropFiles);
}
$(".pma_drop_handler").fadeIn();
- event.stopPropagation();
- event.preventDefault();
+ },
+ /**
+ * Check if dragged element contains Files
+ *
+ * @param event the event object
+ *
+ * @return bool
+ */
+ _hasFiles: function (event) {
+ if (typeof event.originalEvent.dataTransfer.types === 'undefined'
+ || $.inArray('Files', event.originalEvent.dataTransfer.types) < 0) {
+ return false;
+ }
+ return true;
},
/**
* Triggered when dragged file is being dragged over PMA UI
@@ -465,9 +482,12 @@ PMA_DROP_IMPORT = {
* @return void
*/
_dragover: function (event) {
- $(".pma_drop_handler").fadeIn();
event.stopPropagation();
event.preventDefault();
+ if (!PMA_DROP_IMPORT._hasFiles(event)) {
+ return;
+ }
+ $(".pma_drop_handler").fadeIn();
},
/**
* Triggered when dragged objects are left