From 6cdc9859c38e55748bc20ac9fab7f4d2a3c14d9c Mon Sep 17 00:00:00 2001 From: Arvind Date: Wed, 3 Sep 2014 18:11:37 +0530 Subject: [PATCH] Fixing duplicate 'loading animation' getting added on linked-data page. --- swtr/static/js/main.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/swtr/static/js/main.js b/swtr/static/js/main.js index 419b592..58cdef8 100644 --- a/swtr/static/js/main.js +++ b/swtr/static/js/main.js @@ -678,19 +678,24 @@ id: 'linked-data-container', initialize: function() { var self = this; - this.loader_template = _.template($("#loader-template").html()); - $("#linked-data-page").prepend(this.loader_template()); - swtr.LDs = new LDSwts(); - swtr.LDs.getAll({ - what: 'img-anno', - success: function(data) { - swtr.LDs.add(data); - if(!swtr.tagCloudView) { - $("#spinner").remove(); - swtr.tagCloudView = new TagCloudView({collection: swtr.LDs}); + if(!swtr.LDs) { + swtr.LDs = new LDSwts(); + } + if(!swtr.LDs.length) { + console.log(swtr.LDs); + this.loader_template = _.template($("#loader-template").html()); + $("#linked-data-page").prepend(this.loader_template()); + swtr.LDs.getAll({ + what: 'img-anno', + success: function(data) { + swtr.LDs.add(data); + if(!swtr.tagCloudView) { + $("#spinner").remove(); + swtr.tagCloudView = new TagCloudView({collection: swtr.LDs}); + } } - } - }); + }); + } }, destroy: function() { this.cleanUp(); -- 1.7.10.4