Commit 4e3eb54b authored by Kevin Gutierrez's avatar Kevin Gutierrez
Browse files

Unify function spaces

parent ebe2f86d
$(function () {
$(function() {
// Redirect users that don't support filereader
if (!$('html').hasClass('filereader')) {
document.location.href = window.fileupload_opts.simple_upload_url;
......@@ -6,7 +6,7 @@ $(function () {
}
// prevents browser default drag/drop
$(document).bind('drop dragover', function (e) {
$(document).bind('drop dragover', function(e) {
e.preventDefault();
});
......@@ -20,7 +20,7 @@ $(function () {
acceptFileTypes: window.fileupload_opts.errormessages.accepted_file_types,
maxFileSize: window.fileupload_opts.errormessages.max_file_size
},
add: function (e, data) {
add: function(e, data) {
$('.messages').empty();
var $this = $(this);
var that = $this.data('blueimp-fileupload') || $this.data('fileupload');
......@@ -30,21 +30,21 @@ $(function () {
$('#upload-list').append(li);
data.context = li;
data.process(function () {
data.process(function() {
return $this.fileupload('process', data);
}).always(function () {
}).always(function() {
data.context.removeClass('processing');
data.context.find('.left').each(function (index, elm) {
data.context.find('.left').each(function(index, elm) {
$(elm).append(escapeHtml(data.files[index].name));
});
}).done(function () {
}).done(function() {
data.context.find('.start').prop('disabled', false);
if (that._trigger('added', e, data) !== false && (options.autoUpload || data.autoUpload) && data.autoUpload !== false) {
data.submit();
}
}).fail(function () {
}).fail(function() {
if (data.files.error) {
data.context.each(function (index) {
data.context.each(function(index) {
var error = data.files[index].error;
if (error) {
$(this).find('.error_messages').text(error);
......@@ -54,18 +54,18 @@ $(function () {
});
},
processfail: function (e, data) {
processfail: function(e, data) {
var itemElement = $(data.context);
itemElement.removeClass('upload-uploading').addClass('upload-failure');
},
progress: function (e, data) {
progress: function(e, data) {
if (e.isDefaultPrevented()) {
return false;
}
var progress = Math.floor((data.loaded / data.total) * 100);
data.context.each(function () {
data.context.each(function() {
$(this)
.find('.progress')
.addClass('active')
......@@ -76,7 +76,7 @@ $(function () {
});
},
progressall: function (e, data) {
progressall: function(e, data) {
var progress = parseInt((data.loaded / data.total) * 100, 10);
$('#overall-progress')
.addClass('active')
......@@ -90,7 +90,7 @@ $(function () {
}
},
done: function (e, data) {
done: function(e, data) {
var itemElement = $(data.context);
var response = $.parseJSON(data.result);
......@@ -104,29 +104,29 @@ $(function () {
}
},
fail: function (e, data) {
fail: function(e, data) {
var itemElement = $(data.context);
itemElement.addClass('upload-failure');
},
always: function (e, data) {
always: function(e, data) {
var itemElement = $(data.context);
itemElement.removeClass('upload-uploading').addClass('upload-complete');
}
});
// ajax-enhance forms added on done()
$('#upload-list').on('submit', 'form', function (e) {
$('#upload-list').on('submit', 'form', function(e) {
var form = $(this);
var itemElement = form.closest('#upload-list > li');
e.preventDefault();
$.post(this.action, form.serialize(), function (data) {
$.post(this.action, form.serialize(), function(data) {
if (data.success) {
var statusText = $('.status-msg.update-success').text();
addMessage('success', statusText);
itemElement.slideUp(function () {
itemElement.slideUp(function() {
$(this).remove();
});
} else {
......@@ -138,7 +138,7 @@ $(function () {
});
});
$('#upload-list').on('click', '.delete', function (e) {
$('#upload-list').on('click', '.delete', function(e) {
var form = $(this).closest('form');
var itemElement = form.closest('#upload-list > li');
......@@ -146,9 +146,9 @@ $(function () {
var CSRFToken = $('input[name="csrfmiddlewaretoken"]', form).val();
$.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function (data) {
$.post(this.href, { csrfmiddlewaretoken: CSRFToken }, function(data) {
if (data.success) {
itemElement.slideUp(function () {
itemElement.slideUp(function() {
$(this).remove();
});
}
......
var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
'chooser': function (modal, jsonData) {
'chooser': function(modal, jsonData) {
var searchUrl = $('form.video-search', modal.body).attr('action');
/* currentTag stores the tag currently being filtered on, so that we can
......@@ -7,12 +7,12 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
var currentTag;
function ajaxifyLinks(context) {
$('.listing a', context).click(function () {
$('.listing a', context).click(function() {
modal.loadUrl(this.href);
return false;
});
$('.pagination a', context).click(function () {
$('.pagination a', context).click(function() {
var page = this.getAttribute('data-page');
setPage(page);
return false;
......@@ -23,7 +23,7 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
$.ajax({
url: searchUrl,
data: requestData,
success: function (data, status) {
success: function(data, status) {
$('#image-results').html(data);
ajaxifyLinks($('#image-results'));
}
......@@ -56,7 +56,7 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
ajaxifyLinks(modal.body);
$('form.video-upload', modal.body).submit(function () {
$('form.video-upload', modal.body).submit(function() {
var formdata = new FormData(this);
$.ajax({
url: this.action,
......@@ -65,10 +65,10 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
contentType: false,
type: 'POST',
dataType: 'text',
success: function (response) {
success: function(response) {
modal.loadResponseText(response);
},
error: function (response, textStatus, errorThrown) {
error: function(response, textStatus, errorThrown) {
var message = jsonData['error_message'] + '<br />' + errorThrown + ' - ' + response.status;
$('#upload').append(
'<div class="help-block help-critical">' + '<strong>' + jsonData['error_label'] + ': </strong>' + message + '</div>'
......@@ -81,13 +81,13 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
$('form.video-search', modal.body).submit(search);
$('#id_q').on('input', function () {
$('#id_q').on('input', function() {
clearTimeout($.data(this, 'timer'));
var wait = setTimeout(search, 200);
$(this).data('timer', wait);
});
$('#collection_chooser_collection_id').change(search);
$('a.suggested-tag').click(function () {
$('a.suggested-tag').click(function() {
currentTag = $(this).text();
$('#id_q').val('');
fetchResults({
......@@ -101,7 +101,7 @@ var VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS = {
// autocomplete: {source: "{{ autocomplete_url|addslashes }}"}
// });
},
'video_chosen': function (modal, jsonData) {
'video_chosen': function(modal, jsonData) {
modal.respond('videoChosen', jsonData['result']);
modal.close();
},
......
......@@ -4,12 +4,12 @@ function createVideoChooser(id) {
var input = $('#' + id);
var editLink = chooserElement.find('.edit-link');
$('.action-choose', chooserElement).click(function () {
$('.action-choose', chooserElement).click(function() {
ModalWorkflow({
url: window.chooserUrls.videoChooser,
onload: VIDEO_CHOOSER_MODAL_ONLOAD_HANDLERS,
responses: {
videoChosen: function (videoData) {
videoChosen: function(videoData) {
input.val(videoData.id);
previewVideo.attr({
src: videoData.preview.url,
......@@ -22,7 +22,7 @@ function createVideoChooser(id) {
});
});
$('.action-clear', chooserElement).click(function () {
$('.action-clear', chooserElement).click(function() {
input.val('');
chooserElement.addClass('blank');
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment