Drupal.behaviors.roblib_search_islandscholar = { attach: function(context, settings) { url = settings.roblib_search_islandscholar.search_url; jQuery.getJSON(url, function(data) { var items = []; var numberOfDocs = 0; try { numberOfDocs = data.response.docs.length; } catch (err) { // do nothing leave docLength at 0 } if (numberOfDocs < 1) { jQuery('#' + 'roblib-search-content-islandscholar').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-islandscholar-roblib-islandscholar-results').hide(); } else { jQuery.each(data.response.docs, function(key, val) { items.push('
\n\
\n\ ' + val.Title_sorted + '
'); try { items.push('
'); jQuery.each(val.author, function(key2, val2){ items.push('' + val2 + '; ') }) items.push('
') } catch (e){ } try { items.push('
'); jQuery.each(val.genre, function(key2, val2){ items.push('' + val2 + ' ') }) try{ jQuery.each(val["mods.hostTitle"], function(key2, val2){ items.push('' + val2 + ' ') }) } catch (err){ } try{ jQuery.each(val.dateIssued, function(key2, val2){ items.push('' + val2 + ' ') }) } catch(err){ } try{ jQuery.each(val["mods.volume"], function(key2, val2){ items.push('Vol. ' + val2 + ' ') }) } catch (err){ } try{ jQuery.each(val["mods.issue"], function(key2, val2){ items.push('Issue ' + val2 + ', ') }) } catch (err){ } try{ jQuery.each(val["mods.pageStart"], function(key2, val2){ items.push('p' + val2 + '') }) } catch (err){ } try{ jQuery.each(val["mods.pageEnd"], function(key2, val2){ items.push('-' + val2 + ',') }) } catch (err){ } try{ if(jQuery.inArray('OBJ',val.hasDatastreams) > 0){ items.push('
full text
') ; } } catch (err){ } items.push('
') } catch (e){ } items.push('
'); }); jQuery('#roblib-search-content-islandscholar').empty().append(items.join('')); var number = data.response.numFound; var query = encodeURIComponent(data.responseHeader.params.q);//.'milk'; var scholarUrl = "http://www.islandscholar.ca/islandora/solr/search/" jQuery('#roblib-search-islandscholar-more').empty().append('see all ' + number + ' results'); //items = showMoreItems(items, number); } }); } }