From cf6a9a10dd3f348a101ee8714209c0f4fcf082d9 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Sun, 26 Mar 2017 18:06:58 +0800 Subject: [PATCH] Style fix --- .../views/install/tmpl/default.php | 90 ++++++++++--------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/administrator/components/com_installer/views/install/tmpl/default.php b/administrator/components/com_installer/views/install/tmpl/default.php index 54649feb9f19f..7968f28dacdd0 100644 --- a/administrator/components/com_installer/views/install/tmpl/default.php +++ b/administrator/components/com_installer/views/install/tmpl/default.php @@ -78,6 +78,7 @@ var cover = $('#dragarea'); body.on('dragenter', function(e) { + e.preventDefault(); e.stopPropagation(); cover.fadeIn(); @@ -87,6 +88,7 @@ // Notify user when file is over the drop area body.on('dragover', function(e) { e.preventDefault(); + e.stopPropagation(); cover.fadeIn(); return false; @@ -94,52 +96,54 @@ cover.on('dragleave', function(e) { e.preventDefault(); + e.stopPropagation(); cover.fadeOut(); return false; }); - body.on('drop', function(event) { - event.preventDefault(); + body.on('drop', function(e) { + e.preventDefault(); + e.stopPropagation(); cover.fadeOut(); - - var files = event.originalEvent.target.files || event.originalEvent.dataTransfer.files; - + + var files = e.originalEvent.target.files || e.originalEvent.dataTransfer.files; + if (!files.length) { return; } - + var file = files[0]; - + var data = new FormData(); data.append('install_package', file); data.append('installtype', 'upload'); data.append('{$token}', 1); - + jQuery("#loading").css("display", "block"); - - $.ajax({ - url: 'index.php?option=com_installer&task=install.ajax_upload', - data: data, - type: 'post', - processData: false, - cache: false, + + $.ajax({ + url: 'index.php?option=com_installer&task=install.ajax_upload', + data: data, + type: 'post', + processData: false, + cache: false, contentType: false - }).done(function (res) { - if (res.success) { - if (res.data.redirect) { - location.href = res.data.redirect; - } else { - location.href = 'index.php?option=com_installer&view=install'; - } - } else { - jQuery("#loading").css("display", "none"); - alert(res.message); - } - }).error (function (error) { - jQuery("#loading").css("display", "none"); - alert(error.statusText); - }); + }).done(function (res) { + if (res.success) { + if (res.data.redirect) { + location.href = res.data.redirect; + } else { + location.href = 'index.php?option=com_installer&view=install'; + } + } else { + jQuery("#loading").css("display", "none"); + alert(res.message); + } + }).error (function (error) { + jQuery("#loading").css("display", "none"); + alert(error.statusText); + }); }); }); JS @@ -147,19 +151,19 @@ JFactory::getDocument()->addStyleDeclaration( <<