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 { var counter = 0; var divs = new Array(); var content = new Array(); jQuery.each(data.response.docs, function (key, val) { id = 'roblib-search-islandscholar-' + counter; content[counter] = ''; if (typeof val['mods_abstract_s'] !== 'undefined') { content[counter] = val['mods_abstract_s'][0]; } else { content[counter] = 'No abstract available'; } divs[counter++] = id; items.push('
\n\
\n\ ' + val['dc.title'] + '
'); try { items.push('
'); jQuery.each(val["mods_author_lastname_first_ms"], function (key2, val2) { items.push('' + val2 + '; ') }) items.push('
') } catch (e) { } items.push('
'); if (typeof val.mods_relatedItem_host_titleInfo_title_s !== 'undefined') { items.push('' + val.mods_relatedItem_host_titleInfo_title_s + ' ') } if (typeof val.mods_canonical_date_issued_s !== 'undefined') { items.push('' + val.mods_canonical_date_issued_s + ' ') } if (typeof val.mods_part_detail_volume_number_s !== 'undefined') { items.push('Vol. ' + val.mods_part_detail_volume_number_s + ' ') } if (typeof val.mods_part_detail_issue_number_s !== 'undefined') { items.push('Issue ' + val.mods_part_detail_issue_number_s + ', ') } if (typeof val.mods_part_extent_start_s !== 'undefined') { items.push('p' + val.mods_part_extent_start_s + '') } if (typeof val.mods_part_extent_end_s !== 'undefined') { items.push('-' + val.mods_part_extent_end_s + ',') } if (typeof val.mods_genre_s !== 'undefined') { items.push('
' + val.mods_genre_s + '
'); } if (jQuery.inArray('PDF', val.fedora_datastreams_ms) > 0) { items.push('
full text
'); } items.push('
'); items.push('
'); }); jQuery('#roblib-search-content-islandscholar').empty().append(items.join('')); qtipify(divs, content, 'Abstract'); var number = data.response.numFound; var query = encodeURIComponent(data.responseHeader.params.q);//.'milk'; jQuery('#roblib-search-islandscholar-more').empty().append('see all results'); } }); } }