diff --git a/modules/discojuice/www/discojuice/discojuice.control.js b/modules/discojuice/www/discojuice/discojuice.control.js index ec647355d2792afc99ba05dfe052a1ea99d56802..dd3873846307bc70c68ee05f248865e5fd6cf8a7 100644 --- a/modules/discojuice/www/discojuice/discojuice.control.js +++ b/modules/discojuice/www/discojuice/discojuice.control.js @@ -44,6 +44,24 @@ DiscoJuice.Control = { if (this.wncr[i] && typeof this.wncr[i] === 'function') this.wncr[i](); }, + + // "mergeData": function (data) { + // var i, item, relID; + // for (i = 0; i < data.length; i++) { + // item = data[i]; + // relID = item.entityID; + // if (item.subID) { + // relID += '#' + item.subID; + // } + // item['relID'] = relID; + // + // if (!this.alreadyLoaded[relID]) { + // this.data.push(item); + // this.alreadyLoaded[relID] = true; + // } + // } + // }, + /* * Fetching JSON Metadata using AJAX. * Callback postLoad is called when data is returned. @@ -99,6 +117,7 @@ DiscoJuice.Control = { data: parameters, success: function(data) { that.data = $.merge(that.data, data); + //that.mergeData(data); that.parent.Utils.log('Successfully loaded metadata (' + data.length + ') (' + j + ' of ' + metadataurls.length + ')'); notifyCompleted(); } diff --git a/modules/discojuice/www/discojuice/discojuice.ui.js b/modules/discojuice/www/discojuice/discojuice.ui.js index 5d98181594cee2981eaaf38aaaa65fb06c00fbdb..20beb28f235a8ab958a700f90daab8dc4ea72ad9 100644 --- a/modules/discojuice/www/discojuice/discojuice.ui.js +++ b/modules/discojuice/www/discojuice/discojuice.ui.js @@ -16,6 +16,7 @@ DiscoJuice.UI = { // Reference to the "popup": null, + "alreadyLoaded": {}, // Entities / items "resulthtml": 'Loading data…', @@ -39,6 +40,7 @@ DiscoJuice.UI = { "clearItems": function() { this.resulthtml = ''; + this.alreadyLoaded = {}; }, "addItem": function(item, countrydef, search, distance, quickentry, enabled) { @@ -52,6 +54,13 @@ DiscoJuice.UI = { var debugweight = this.parent.Utils.options.get('debug.weight', false); + var relID = item.entityID; + if (item.subID) { + relID += '#' + item.subID; + } + + if (this.alreadyLoaded[relID]) return; + this.alreadyLoaded[relID] = true; // Add icon element first if (item.icon && this.parent.Utils.options.get('showIcon', true)) { @@ -134,10 +143,7 @@ DiscoJuice.UI = { } - var relID = item.entityID; - if (item.subID) { - relID += '#' + item.subID; - } +