From 0855512f52dedb8e10602f4e925933d26aec15fa Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 8 Jul 2015 17:15:33 -0400 Subject: [PATCH] Additional cleanup work. --- js/imageUpload/imageUpload.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/js/imageUpload/imageUpload.js b/js/imageUpload/imageUpload.js index 7a887972..ed7a728b 100644 --- a/js/imageUpload/imageUpload.js +++ b/js/imageUpload/imageUpload.js @@ -282,12 +282,14 @@ jQuery(document).ready(function($) { */ function sendFileToServer(fd, status) { - + // Send one (or more) images to the server. Normally only one image here for now. var jqXHR=$.ajax({ xhr: function() { var xhrobj = $.ajaxSettings.xhr(); if (xhrobj.upload) { xhrobj.upload.addEventListener('progress', function(event) { + + // calculate progress periodically and set the progress bar var percent = 0; var position = event.loaded || event.position; var total = event.total; @@ -350,9 +352,14 @@ jQuery(document).ready(function($) { }); return jqXHR; -// status.setAbort(jqXHR); + } + /* + * This function is used to start handling of various things and + * to restart handling when an image has been added. I neede to + * do this because .on() didn't cover this situation. + */ function setupExpandedImageEvents() { // Handle expanded images on hover for image gallery @@ -379,6 +386,8 @@ jQuery(document).ready(function($) { id = $(this).attr("data-id"); $('#glm-galleryImageLarger_' + id).dialog("close"); }); + + // Make images sortable and store the list of IDs in a hidden input field when order has changed. $('.glm-galleryImages').sortable({ update: function(event, ui) { var sortedIDs = $(this).sortable('toArray'); -- 2.17.1