1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +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 * 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 if (window.File && window.FileList && window.FileReader
&& ($("#PageIDIndicator").length > 0 || $('.InputfieldAllowAjaxUpload').length > 0)) { && ($("#PageIDIndicator").length > 0 || $('.InputfieldAllowAjaxUpload').length > 0)) {
InitHTML5(''); InitHTML5('');
allowAjax = true;
} else { } else {
InitOldSchool(); InitOldSchool();
} }
@@ -454,6 +456,7 @@ $(document).ready(function() {
var resizeActive = false; var resizeActive = false;
var windowResize = function() { var windowResize = function() {
if(!allowAjax) return;
$(".AjaxUploadDropHere").each(function() { $(".AjaxUploadDropHere").each(function() {
var $t = $(this); var $t = $(this);
if($t.parent().width() <= minContainerWidth) { if($t.parent().width() <= minContainerWidth) {
@@ -465,17 +468,19 @@ $(document).ready(function() {
resizeActive = false; resizeActive = false;
} }
if(allowAjax) {
$(window).resize(function() { $(window).resize(function() {
if(resizeActive) return; if(resizeActive) return;
resizeActive = true; resizeActive = true;
setTimeout(windowResize, 1000); setTimeout(windowResize, 1000);
}).resize(); }).resize();
}
//$(document).on('reloaded', '.InputfieldFileMultiple, .InputfieldFileSingle', function(event) { //$(document).on('reloaded', '.InputfieldFileMultiple, .InputfieldFileSingle', function(event) {
$(document).on('reloaded', '.InputfieldHasFileList', function(event) { $(document).on('reloaded', '.InputfieldHasFileList', function(event) {
initSortable($(this).find(".InputfieldFileList")); initSortable($(this).find(".InputfieldFileList"));
InitHTML5($(this)); InitHTML5($(this));
windowResize(); if(allowAjax) windowResize();
}); });
}); });

File diff suppressed because one or more lines are too long