mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Fix issue processwire/processwire-issues#274
This commit is contained in:
@@ -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) {
|
||||||
@@ -464,18 +467,20 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
resizeActive = false;
|
resizeActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).resize(function() {
|
if(allowAjax) {
|
||||||
if(resizeActive) return;
|
$(window).resize(function() {
|
||||||
resizeActive = true;
|
if(resizeActive) return;
|
||||||
setTimeout(windowResize, 1000);
|
resizeActive = true;
|
||||||
}).resize();
|
setTimeout(windowResize, 1000);
|
||||||
|
}).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
Reference in New Issue
Block a user