diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 7cd07e18..895feb28 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -86,7 +86,7 @@ $(function() { //animate : true, # ToDo: Reenable function //extraScrollPx: 300 }); - $loadMore.on( 'append.infiniteScroll', function( event, response, path, data ) { + $loadMore.on( "append.infiniteScroll", function( event, response, path, data ) { $(".pagination").addClass("hidden"); $(".load-more .row").isotope( "appended", $(data), null ); }); @@ -117,7 +117,7 @@ $(function() { var buttonText = $this.html(); $this.html("..."); $("#update_error").addClass("hidden"); - if ($("#message").length){ + if ($("#message").length) { $("#message").alert("close"); } $.ajax({ @@ -179,6 +179,7 @@ $(function() { }); }); + // Init all data control handlers to default $("input[data-control]").trigger("change"); $("#bookDetailsModal") diff --git a/cps/static/js/table.js b/cps/static/js/table.js index fad703ef..1c828267 100644 --- a/cps/static/js/table.js +++ b/cps/static/js/table.js @@ -27,15 +27,15 @@ $(function() { async: true, timeout: 900, success:function(data){ - $('#domain-table').bootstrapTable("load", data); + $("#domain-table").bootstrapTable("load", data); } }); }); $("#domain-table").bootstrapTable({ formatNoMatches: function () { return ""; - }, - striped: false + }, + striped: false }); $("#btndeletedomain").click(function() { //get data-id attribute of the clicked element @@ -51,7 +51,7 @@ $(function() { url: window.location.pathname + "/../../ajax/domainlist", async: true, timeout: 900, - success:function(data){ + success:function(data) { $("#domain-table").bootstrapTable("load", data); } }); @@ -65,11 +65,11 @@ $(function() { }); }); -function TableActions (value, row, index) { +/*function TableActions (value, row, index) { return [ "", "", "" ].join(""); -} +}*/ diff --git a/cps/static/js/uploadprogress.js b/cps/static/js/uploadprogress.js index 7d640411..1711f182 100644 --- a/cps/static/js/uploadprogress.js +++ b/cps/static/js/uploadprogress.js @@ -6,6 +6,7 @@ * Version 1.0.0 * Licensed under the MIT license. */ + (function($) { "use strict"; @@ -57,13 +58,13 @@ // Translate texts this.$modalTitle.text(this.options.modalTitle) - this.$modalFooter.children("button").text(this.options.modalFooter) + this.$modalFooter.children("button").text(this.options.modalFooter); this.$modal.on("hidden.bs.modal", $.proxy(this.reset, this)); }, reset: function() { - this.$modalTitle.text(this.options.modalTitle) + this.$modalTitle.text(this.options.modalTitle); this.$modalFooter.hide(); this.$modalBar.addClass("progress-bar-success"); this.$modalBar.removeClass("progress-bar-danger"); @@ -132,25 +133,25 @@ // Replace the contents of the form, with the returned html if (xhr.status === 422) { var newHtml = $.parseHTML(xhr.responseText); - this.$modalBar.text(newHtml[0].data); - //this.$modal.modal("hide"); + this.replaceForm(newHtml); + this.$modal.modal("hide"); } // Write the error response to the document. else{ - var responseText = xhr.responseText; // Handle no response error if (contentType) { + var responseText = xhr.responseText; if (contentType.indexOf("text/plain") !== -1) { responseText = "
" + responseText + "
"; } - document.write(xhr.responseText); + document.write(responseText); } } }, - set_progress: function(percent){ + setProgress: function(percent) { var txt = percent + "%"; - if (percent == 100) { + if (percent === 100) { txt = this.options.uploadedMsg; } this.$modalBar.attr("aria-valuenow", percent); @@ -158,21 +159,20 @@ this.$modalBar.css("width", percent + "%"); }, - progress: function(/*ProgressEvent*/e){ + progress: function(/*ProgressEvent*/e) { var percent = Math.round((e.loaded / e.total) * 100); - this.set_progress(percent); + this.setProgress(percent); }, - // replace_form replaces the contents of the current form + // replaceForm replaces the contents of the current form // with the form in the html argument. // We use the id of the current form to find the new form in the html - replace_form: function(html) { + replaceForm: function(html) { var newForm; var formId = this.$form.attr("id"); - if(formId !== undefined){ + if ( typeof(formId) !== "undefined") { newForm = $(html).find("#" + formId); - } - else{ + } else { newForm = $(html).find("form"); } // add the filestyle again @@ -181,11 +181,11 @@ } }; - $.fn.uploadprogress = function(options, value){ + $.fn.uploadprogress = function(options) { return this.each(function() { var _options = $.extend({}, $.fn.uploadprogress.defaults, options); - var file_progress = new UploadProgress(this, _options); - file_progress.constructor(); + var fileProgress = new UploadProgress(this, _options); + fileProgress.constructor(); }); };