1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00
This commit is contained in:
Ryan Cramer
2017-06-23 07:32:03 -04:00
parent 0cccb763a5
commit 651e0e8763
2 changed files with 14 additions and 9 deletions

View File

@@ -440,12 +440,14 @@ $(document).ready(function() {
/**
* Progressive enchanchment for browsers that support html5 File API
*
* #PageIDIndictator.size indicates PageEdit, which we're limiting AjaxUpload to since only ProcessPageEdit has the ajax handler
* #PageIDIndictator.length indicates PageEdit, which we're limiting AjaxUpload to since only ProcessPageEdit has the ajax handler
*
*/
var allowAjax = false;
if (window.File && window.FileList && window.FileReader
&& ($("#PageIDIndicator").length > 0 || $('.InputfieldAllowAjaxUpload').length > 0)) {
InitHTML5('');
allowAjax = true;
} else {
InitOldSchool();
}
@@ -454,6 +456,7 @@ $(document).ready(function() {
var resizeActive = false;
var windowResize = function() {
if(!allowAjax) return;
$(".AjaxUploadDropHere").each(function() {
var $t = $(this);
if($t.parent().width() <= minContainerWidth) {
@@ -465,17 +468,19 @@ $(document).ready(function() {
resizeActive = false;
}
if(allowAjax) {
$(window).resize(function() {
if(resizeActive) return;
resizeActive = true;
setTimeout(windowResize, 1000);
}).resize();
}
//$(document).on('reloaded', '.InputfieldFileMultiple, .InputfieldFileSingle', function(event) {
$(document).on('reloaded', '.InputfieldHasFileList', function(event) {
initSortable($(this).find(".InputfieldFileList"));
InitHTML5($(this));
windowResize();
if(allowAjax) windowResize();
});
});

File diff suppressed because one or more lines are too long