blob: efca0dd903e06becfafc42d6f7ceb310ca937816 [file] [log] [blame]
Tyler Scott3c17d5f2015-06-23 17:49:29 -06001var catalog = "/catalog/myUniqueName";
Tyler Scotta1ac69d2015-07-02 17:42:03 -06002var config = {
Tyler Scott087aef72015-07-14 14:11:59 -06003 host: "atmos-csu.research-lan.colostate.edu",
Tyler Scott3c17d5f2015-06-23 17:49:29 -06004 port: 9696
Tyler Scotta1ac69d2015-07-02 17:42:03 -06005};
Tyler Scott3c17d5f2015-06-23 17:49:29 -06006
Tyler Scotta1ac69d2015-07-02 17:42:03 -06007//Run when the document loads.
8$(function () {
Tyler Scottbb013562015-07-16 15:52:40 -06009 new Atmos(catalog, config);
Tyler Scott3c17d5f2015-06-23 17:49:29 -060010});
11
Tyler Scotte815d3e2015-07-09 16:56:17 -060012/**
13 * Atmos
14 * @version 2.0
15 *
16 * Configures an Atmos object. This manages the atmos interface.
17 *
18 * @constructor
19 * @param {string} catalog - NDN path
20 * @param {Object} config - Object of configuration options for a Face.
21 */
Tyler Scott7d076e22015-07-06 19:21:50 -060022function Atmos(catalog, config){
23 "use strict";
24 //Internal variables.
25 this.results = []
26 this.resultCount = 0;
27 this.page = 1;
28 this.totalPages = 1;
29 this.selectedSearch = {};
30 this.dropdown = [];
31 this.state = {};
32 this.currentViewIndex = 0;
33
Tyler Scotte815d3e2015-07-09 16:56:17 -060034 this.catalog = catalog;
35
Tyler Scott7d076e22015-07-06 19:21:50 -060036 this.face = new Face(config);
37 this.categories = $('#side-menu');
38 this.resultTable = $('#resultTable');
Tyler Scotte815d3e2015-07-09 16:56:17 -060039 this.filters = $('#filters');
Tyler Scott7d076e22015-07-06 19:21:50 -060040
41 var scope = this;
42
43 this.resultTable.on('click', '.interest-button', function(){
44 var button = $(this);
45
Tyler Scott087aef72015-07-14 14:11:59 -060046 if (button.is(':disabled')){
47 console.warn("Attempt to request again!");
48 }
49
Tyler Scott7d076e22015-07-06 19:21:50 -060050 var name = button.parent().prev().text();
51 var interest = new Interest(new Name('/retrieve' + name));
Tyler Scott087aef72015-07-14 14:11:59 -060052 scope.face.expressInterest(interest, function(){}, function(){});
53
54 button.text("Requested!")
55 .removeClass('btn-primary')
56 .addClass('btn-default')
57 .addClass('disabled')
58 .prop('disabled', true);
Tyler Scott7d076e22015-07-06 19:21:50 -060059
60 });
61
62 $.getJSON("search_catagories.json").done(function (data) {
63 $.each(data, function (pageSection, contents) {
64 if (pageSection == "SearchCatagories") {
65 $.each(contents, function (search, searchOptions) {
66 var e = $('<li><a href="#">' + search.replace(/\_/g, " ") + '</a><ul class="subnav nav nav-pills nav-stacked"></ul></li>');
67
68 var sub = e.find('ul.subnav');
69 $.each(searchOptions, function(index, name){
70 var item = $('<li><a href="#">' + name + '</a></li>');
71 sub.append(item);
72 item.click(function(){
Tyler Scott575c61b2015-07-13 13:42:16 -060073 scope.addFilter(name, search);
Tyler Scott7d076e22015-07-06 19:21:50 -060074 });
75 });
76
Tyler Scott424ee102015-07-14 16:50:41 -060077 //Toggle the menus. (Only respond when the immediate tab is clicked.)
78 e.find('> a').click(function(){
Tyler Scott7d076e22015-07-06 19:21:50 -060079 scope.categories.find('.subnav').slideUp();
Tyler Scott424ee102015-07-14 16:50:41 -060080 var t = $(this).siblings('.subnav');
Tyler Scott7d076e22015-07-06 19:21:50 -060081 if ( !t.is(':visible')){
82 t.slideDown().triggerHandler('focus'); //Cancel other animations and slide down.
83 }
84 });
85
86 scope.categories.append(e);
87 });
88 }
89 });
90 });
91
92 $('#searchBar').submit(function(e){
93 e.preventDefault();
Tyler Scotte815d3e2015-07-09 16:56:17 -060094 console.log("Search started!", $('#search'));
Tyler Scott7d076e22015-07-06 19:21:50 -060095 })
96
97}
98
99Atmos.prototype.onData = function(data) {
100 var payloadStr = data.content.toString().split("\n")[0];
101
Tyler Scott424ee102015-07-14 16:50:41 -0600102 if (!payloadStr || payloadStr.length === 0){
Tyler Scottbb013562015-07-16 15:52:40 -0600103 this.populateResults();
Tyler Scott424ee102015-07-14 16:50:41 -0600104 return; //No results were returned.
105 }
106
Tyler Scott7d076e22015-07-06 19:21:50 -0600107 var queryResults = JSON.parse(payloadStr);
108
109 var scope = this;
110
Tyler Scottbb013562015-07-16 15:52:40 -0600111 $.each(queryResults, function (queryResult, field) {
Tyler Scott087aef72015-07-14 14:11:59 -0600112
Tyler Scottbb013562015-07-16 15:52:40 -0600113 if (queryResult == "next") {
114 scope.populateAutocomplete(field);
115 }
Tyler Scott7d076e22015-07-06 19:21:50 -0600116
Tyler Scottbb013562015-07-16 15:52:40 -0600117 if (queryResult == "results" && field == null){
118 return; //Sometimes the results are null. (We should skip this.)
119 }
Tyler Scott7d076e22015-07-06 19:21:50 -0600120
Tyler Scottbb013562015-07-16 15:52:40 -0600121 $.each(field, function (entryCount, name) {
122 scope.results.push(name);
Tyler Scott7d076e22015-07-06 19:21:50 -0600123 });
Tyler Scottbb013562015-07-16 15:52:40 -0600124 });
Tyler Scott7d076e22015-07-06 19:21:50 -0600125
Tyler Scottbb013562015-07-16 15:52:40 -0600126 // Calculating the current page and the view
127 this.populateResults();
Tyler Scott424ee102015-07-14 16:50:41 -0600128
Tyler Scott7d076e22015-07-06 19:21:50 -0600129}
130
131Atmos.prototype.query = function(prefix, parameters, callback, pipeline) {
132 this.results = [];
133 this.dropdown = [];
134 this.resultTable.empty();
Tyler Scott7d076e22015-07-06 19:21:50 -0600135
136 var queryPrefix = new Name(prefix);
137 queryPrefix.append("query");
138
139 var jsonString = JSON.stringify(parameters);
140 queryPrefix.append(jsonString);
141
142 this.state = {
143 prefix: new Name(prefix),
144 userOnData: callback,
145 outstanding: {},
146 nextSegment: 0,
Tyler Scott575c61b2015-07-13 13:42:16 -0600147 parameters: jsonString
Tyler Scott7d076e22015-07-06 19:21:50 -0600148 };
149
150 /*if (state.hasOwnProperty("version")) {
151 console.log("state already has version");
152 }*/
153
154 var queryInterest = new Interest(queryPrefix);
155 queryInterest.setInterestLifetimeMilliseconds(10000);
156
157 var scope = this;
158
159 this.face.expressInterest(queryInterest,
Tyler Scotte815d3e2015-07-09 16:56:17 -0600160 function(interest, data){
161 scope.onQueryData(interest, data);
162 }, function(interest){
163 scope.onQueryTimeout(interest);
Tyler Scott7d076e22015-07-06 19:21:50 -0600164 }
165 );
166
167 this.state["outstanding"][queryInterest.getName().toUri()] = 0;
168}
169
Tyler Scotte815d3e2015-07-09 16:56:17 -0600170/**
171 * @deprecated
172 * Use applyFilters/addFilters as appropriate.
173 */
Tyler Scott7d076e22015-07-06 19:21:50 -0600174Atmos.prototype.submitCatalogSearch = function(field) {
Tyler Scotte815d3e2015-07-09 16:56:17 -0600175 console.warn("Use of deprecated function submitCatalogSearch! (Use applyFilters/addFilters as appropriate)");
Tyler Scott7d076e22015-07-06 19:21:50 -0600176}
177
178Atmos.prototype.expressNextInterest = function() {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600179 // @todo pipelines
Tyler Scotte815d3e2015-07-09 16:56:17 -0600180 var nextName = new Name(this.state["results"]);
181 nextName.appendSegment(this.state["nextSegment"]);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600182
183 var nextInterest = new Interest(nextName);
184 nextInterest.setInterestLifetimeMilliseconds(10000);
185
Tyler Scott7d076e22015-07-06 19:21:50 -0600186 var scope = this;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600187
Tyler Scott7d076e22015-07-06 19:21:50 -0600188 this.face.expressInterest(nextInterest,
Tyler Scotte815d3e2015-07-09 16:56:17 -0600189 function(interest, data){
190 scope.onQueryResultsData(interest, data);
Tyler Scott7d076e22015-07-06 19:21:50 -0600191 },
Tyler Scotte815d3e2015-07-09 16:56:17 -0600192 function(interest){
193 scope.onQueryResultsTimeout(interest);
Tyler Scott7d076e22015-07-06 19:21:50 -0600194 });
195
196 this.state["nextSegment"] ++;
197 this.state["outstanding"][nextName.toUri()] = 0;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600198}
199
Tyler Scott7d076e22015-07-06 19:21:50 -0600200Atmos.prototype.onQueryData = function(interest, data) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600201 var name = data.getName();
202
Tyler Scott7d076e22015-07-06 19:21:50 -0600203 delete this.state["outstanding"][interest.getName().toUri()];
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600204
Tyler Scott7d076e22015-07-06 19:21:50 -0600205 this.state["version"] = name.get(this.state["prefix"].size() + 2).toVersion();
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600206
Tyler Scott575c61b2015-07-13 13:42:16 -0600207 this.state["results"] = new Name(this.state["prefix"]).append("query-results").append(this.state['parameters']).appendVersion(this.state["version"]);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600208
Tyler Scott7d076e22015-07-06 19:21:50 -0600209 this.expressNextInterest();
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600210}
211
Tyler Scott7d076e22015-07-06 19:21:50 -0600212Atmos.prototype.onQueryResultsData = function(interest, data) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600213 var name = data.getName();
Tyler Scott7d076e22015-07-06 19:21:50 -0600214 delete this.state["outstanding"][interest.getName().toUri()];
Tyler Scottf08ab962015-06-30 16:31:29 -0600215 if (!name.get(-1).equals(data.getMetaInfo().getFinalBlockId())) {
Tyler Scott7d076e22015-07-06 19:21:50 -0600216 this.expressNextInterest();
Tyler Scottf08ab962015-06-30 16:31:29 -0600217 } //else {
218 //alert("found final block");
219 //}
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600220
Tyler Scott7d076e22015-07-06 19:21:50 -0600221 this.state["userOnData"](data);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600222}
223
Tyler Scott7d076e22015-07-06 19:21:50 -0600224Atmos.prototype.onQueryTimeout = function(interest) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600225 var uri = interest.getName().toUri();
Tyler Scott7d076e22015-07-06 19:21:50 -0600226 if (this.state["outstanding"][uri] < 1) {
227 this.state["outstanding"][uri] ++;
228 var scope = this;
229 this.face.expressInterest(interest,
Tyler Scott575c61b2015-07-13 13:42:16 -0600230 function(interest, data){
231 scope.onQueryData(interest, data);
Tyler Scott7d076e22015-07-06 19:21:50 -0600232 },
Tyler Scott575c61b2015-07-13 13:42:16 -0600233 function(interest){
234 scope.onQueryTimeout(interest);
Tyler Scott7d076e22015-07-06 19:21:50 -0600235 });
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600236 } else {
Tyler Scott7d076e22015-07-06 19:21:50 -0600237 delete this.state["outstanding"][uri];
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600238
239 // We modify the autocomplete box here because we need to know
240 // we have all of the entries first. Fairly hacky.
Tyler Scott7d076e22015-07-06 19:21:50 -0600241 /* TODO FIXME
242 var autocompleteFullName = this.autocompleteText.value;
243 for (var i = 0; i < dropdown.length; ++i) {
244 if (this.dropdown[i].substr(0, dropdown[i].length - 1).toUpperCase === this.autocompleteText.value.toUpperCase || dropdown.length == 1) {
245 autocompleteText.value = dropdown[i];
246 }
247 }
248 */
249 }
250}
251
252Atmos.prototype.onQueryResultsTimeout = function(interest) {
253 var uri = interest.getName().toUri();
254 if (this.state["outstanding"][uri] < 1) {
255 this.state["outstanding"][uri] ++;
256 var scope = this;
257 this.face.expressInterest(interest,
258 function(){
259 scope.onQueryResultsData.apply(scope, arguments);
260 },
261 function(){
262 scope.onQueryResultsTimeout.apply(scope, arguments);
263 });
264 } else {
265 delete this.state["outstanding"][uri];
266 // We modify the autocomplete box here because we need to know
267 // we have all of the entries first. Fairly hacky.
268 /* TODO FIXME
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600269 var autocompleteFullName = autocompleteText.value;
270 for (var i = 0; i < dropdown.length; ++i) {
271 if (dropdown[i].substr(0, dropdown[i].length - 1).toUpperCase === autocompleteText.value.toUpperCase || dropdown.length == 1) {
272 autocompleteText.value = dropdown[i];
273 }
274 }
Tyler Scott7d076e22015-07-06 19:21:50 -0600275 */
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600276 }
277}
278
Tyler Scottbb013562015-07-16 15:52:40 -0600279Atmos.prototype.populateResults = function() {
280
281 //TODO Check only for page changes and result length
282
Tyler Scott7d076e22015-07-06 19:21:50 -0600283 this.resultTable.empty();
Tyler Scott7d076e22015-07-06 19:21:50 -0600284
285 for (var i = startIndex; i < startIndex + 20 && i < this.results.length; ++i) {
Tyler Scott087aef72015-07-14 14:11:59 -0600286 this.resultTable.append('<tr><td>' + this.results[i]
287 + '</td><td><button class="interest-button btn btn-primary btn-xs">Retrieve</button></td></tr>');
Tyler Scott7d076e22015-07-06 19:21:50 -0600288 }
289
290 if (this.results.length <= 20) {
291 this.page = 1;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600292 } else {
Tyler Scott7d076e22015-07-06 19:21:50 -0600293 this.page = startIndex / 20 + 1;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600294 }
295
Tyler Scott7d076e22015-07-06 19:21:50 -0600296 this.totalPages = Math.ceil(this.results.length / 20);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600297
Tyler Scott7d076e22015-07-06 19:21:50 -0600298 //TODO Fix the page to fit the theme.
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600299 var currentPage = $(".page");
300 currentPage.empty();
Tyler Scott7d076e22015-07-06 19:21:50 -0600301 if (this.page != 1) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600302 currentPage.append('<a href="#" onclick="getPage(this.id);" id="<"><</a>');
303 }
304 // This section of code creates the paging for the results.
305 // To prevent it from having a 1000+ pages, it will only show the 5 pages before/after
306 // the current page and the total pages (expect users not to really jump around a lot).
Tyler Scott7d076e22015-07-06 19:21:50 -0600307 for (var i = 1; i <= this.totalPages; ++i) {
308 if (i == 1 || i == this.totalPages // Min or max
309 || (i <= this.page && i + 5 >= this.page) // in our current page range
310 || (i >= this.page && i - 5 <= this.page)) { // in our current page range
311 if (i != this.page) {
Tyler Scottf08ab962015-06-30 16:31:29 -0600312 currentPage.append(' <a href="#" onclick="getPage(' + i + ');">' + i + '</a>')
Tyler Scott7d076e22015-07-06 19:21:50 -0600313 if (i == 1 && this.page > i + 5) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600314 currentPage.append(' ... ');
315 }
316 } else {
317 currentPage.append(' ' + i);
318 }
319 } else { // Need to skip ahead
Tyler Scott087aef72015-07-14 14:11:59 -0600320 if (i == this.page + 6) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600321 currentPage.append(' ... ');
322
Tyler Scottf08ab962015-06-30 16:31:29 -0600323 currentPage.append(' <a href="#" onclick="getPage(this.id);" id=">">></a>')
Tyler Scott7d076e22015-07-06 19:21:50 -0600324 i = this.totalPages - 1;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600325 }
326 }
327 }
Tyler Scott7d076e22015-07-06 19:21:50 -0600328 currentPage.append(' ' + this.results.length + ' results');
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600329}
330
Tyler Scott7d076e22015-07-06 19:21:50 -0600331Atmos.prototype.getPage = function(clickedPage) {
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600332 console.log(clickedPage);
333
334 var nextPage = clickedPage;
335 if (clickedPage === "<") {
Tyler Scott7d076e22015-07-06 19:21:50 -0600336 nextPage = this.page - 5;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600337 } else if (clickedPage === ">") {
338 console.log("> enabled");
339
Tyler Scott7d076e22015-07-06 19:21:50 -0600340 nextPage = this.page + 5;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600341 }
342
343 nextPage--; // Need to adjust for starting at 0
344
345 if (nextPage < 0 ) {
346 nextPage = 0;
347 console.log("0 enabled");
Tyler Scott7d076e22015-07-06 19:21:50 -0600348 } else if (nextPage > this.totalPages - 1) {
349 nextPage = this.totalPages - 1;
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600350 console.log("total enabled");
351 }
352
Tyler Scott7d076e22015-07-06 19:21:50 -0600353 this.populateResults(nextPage * 20);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600354 return false;
355}
356
Tyler Scott7d076e22015-07-06 19:21:50 -0600357
358Atmos.prototype.submitAutoComplete = function() {
359 /* FIXME TODO
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600360 if (autocompleteText.value.length > 0) {
361 var selection = autocompleteText.value;
362 $.each(dropdown, function (i, dropdownEntry) {
363 if (dropdownEntry.substr(0, dropdownEntry.length - 1) == selection) {
364 selection = dropdownEntry;
365 }
366 });
367
368 selectedSearch["?"] = selection;
369 query(catalog, selectedSearch, onData, 1);
370 delete selectedSearch["?"];
371 }
Tyler Scott7d076e22015-07-06 19:21:50 -0600372 */
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600373}
374
Tyler Scott7d076e22015-07-06 19:21:50 -0600375Atmos.prototype.populateAutocomplete = function(fields) {
376 /* FIXME TODO
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600377 var isAutocompleteFullName = (autocompleteText.value.charAt(autocompleteText.value.length - 1) === "/");
378 var autocompleteFullName = autocompleteText.value;
379 for (var i = 0; i < fields.length; ++i) {
380 var fieldFullName = fields[i];
381 var entry = autocompleteFullName;
382 var skipahead = "";
383
384 if (isAutocompleteFullName) {
385 skipahead = fieldFullName.substr(autocompleteText.value.length, fieldFullName.length);
386 } else {
387 if (fieldFullName.charAt(autocompleteText.value.length) === "/") {
388 entry += "/";
389 skipahead = fieldFullName.substr(autocompleteText.value.length + 1, fieldFullName.length);
390 } else {
391 skipahead = fieldFullName.substr(autocompleteText.value.length, fieldFullName.length);
392 }
393 }
394 if (skipahead.indexOf("/") != -1) {
395 entry += skipahead.substr(0, skipahead.indexOf("/") + 1);
396 } else {
397 entry += skipahead;
398 }
399
400 var added = false;
401 for (var j = 0; j < dropdown.length && !added; ++j) {
402 if (dropdown[j] === entry) {
403 added = true;
404 } else if (dropdown[j] > entry) {
405 dropdown.splice(j, 0, entry);
406 added = true;
407 }
408 }
409 if (!added) {
410 dropdown.push(entry);
411 }
412
413 }
414 $("#autocompleteText").autocomplete({
415 source: dropdown
416 });
Tyler Scott7d076e22015-07-06 19:21:50 -0600417 */
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600418}
419
Tyler Scotte815d3e2015-07-09 16:56:17 -0600420/**
421 * Adds a filter to the list of filters.
Tyler Scott087aef72015-07-14 14:11:59 -0600422 * If a filter is already added, it will be removed instead.
Tyler Scotte815d3e2015-07-09 16:56:17 -0600423 *
424 * @param {string} filter
425 */
Tyler Scott575c61b2015-07-13 13:42:16 -0600426Atmos.prototype.addFilter = function(name, category){
Tyler Scotte815d3e2015-07-09 16:56:17 -0600427 var existing = this.filters.find('span:contains(' + name + ')');
428 if (existing.length){
429 //If the category is clicked twice, then we delete it.
430 existing.remove();
431 this.applyFilters();
432
433 } else {
434
435 var filter = $('<span class="label label-default"></span>');
Tyler Scott575c61b2015-07-13 13:42:16 -0600436 filter.text(category + ':' + name);
Tyler Scotte815d3e2015-07-09 16:56:17 -0600437
438 this.filters.append(filter);
439
440 this.applyFilters();
441
442 var scope = this;
443 filter.click(function(){
444 $(this).remove();
445 scope.applyFilters();
446 });
447
448 }
449
450}
451
452Atmos.prototype.applyFilters = function(){
Tyler Scott575c61b2015-07-13 13:42:16 -0600453 var filters = this.filters.children().toArray().reduce(function(prev, current){
454 var data = $(current).text().split(/:/);
455 prev[data[0]] = data[1];
456 return prev;
457 }, {});
Tyler Scotte815d3e2015-07-09 16:56:17 -0600458 console.log('Collected filters:', filters);
Tyler Scott087aef72015-07-14 14:11:59 -0600459 var scope = this;
Tyler Scotte815d3e2015-07-09 16:56:17 -0600460 this.query(this.catalog, filters, function(data){
461 scope.onData(data);
462 }, 1);
463}
464
465/**
466 * @deprecated
467 * Use addFilter instead.
468 */
469Atmos.prototype.populateCurrentSelections = function() {
470 console.warn("Use of deprecated function populateCurrentSelections! (Use addFilter instead)");
471 /*
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600472 var currentSelection = $(".currentSelections");
473 currentSelection.empty();
474
475 currentSelection.append("<p>Filtering on:");
476
Tyler Scott7d076e22015-07-06 19:21:50 -0600477 var scope = this;
478
479 $.each(this.selectedSearch, function (searchMenuCatagory, selection) {
480 var e = $('<a href="#">[X] ' + searchMenuCatagory + ":" + selection + '</a>');
481 e.onclick(function(){
482 var searchFilter = $(this).text();
483
484 var search = "";
485 for (var j = 0; j < searchFilter.length; ++j) {
486 search += searchFilter[j] + " ";
487 }
488 console.log("Split values: '" + search + "'");
489
490 delete this.selectedSearch[searchFilter[0]];
491 this.query(catalog, selectedSearch, onData, 1);
492 populateCurrentSelections();
493 });
494 currentSelection.append(e);
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600495 });
496
497 currentSelection.append("</p>");
Tyler Scotte815d3e2015-07-09 16:56:17 -0600498 */
Tyler Scott3c17d5f2015-06-23 17:49:29 -0600499}