Drupal.behaviors.roblib_search_eds_articles = { attach: function(context, settings) { $url = settings.roblib_search_eds_articles.search_url; jQuery.getJSON($url, function(data) { var items = []; var numberOfDocs = 0; try { numberOfDocs = data.records.length; } catch (err) { // do nothing leave docLength at 0 } if(numberOfDocs < 1){ jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-eds-roblib-search-eds-articles').hide(); } else { var counter = 0; var divs = new Array(); var content = new Array(); jQuery.each(data.records, function(key, val) { id = 'roblib-search-eds-article-' + counter; edsPopulatePopupDivs(content, val, counter); divs[counter++] = id; if (typeof val.Items !== 'undefined') { items.push('
'); if (typeof val.Items.Ti !== 'undefined') { jQuery.each(val.Items.Ti, function(key2, val2){ items.push('
'); items.push(''+val2.Data+'
'); }) } items.push('
'); jQuery.each(val.RecordInfo.BibRelationships.HasContributorRelationships, function(key3, authors){ items.push(authors.NameFull+';'+' '); }) items.push('
'); if (typeof val.Items.Src !== 'undefined') { jQuery.each(val.Items.Src, function(key4, source){ items.push('
'+source.Label+': '+source.Data+'
'); }) } if (typeof val.PLink !== 'undefined'){ items.push(''); } //items.push('
'+val.DbLabel+'
'); items.push('
'); } }); jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join('')); qtipify(divs, content, 'Notes'); } var queries = []; jQuery.each(data.queries, function(key7, query){ queries.push(query.query); }) var query_str = data.queries[0].query; var href_str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=0&custid=uprince&profid=eds&groupid=main&mode=and&cli0=RV&clv0=N&lang=en' + '&authtype=ip,guest&cli2=FT&clv2=N&cli3=&clv3=(ST+Academic+Journal+or+ST+Conference+Materials+or+ST+News+or+ST+Magazines)&bquery='; jQuery('#roblib-search-eds-article-more').empty().append('See all results'); }); } } /*function edsArticlesPopulatePopupDivs(content, val, counter){ content[counter] = ''; jQuery.each(val.DetailedRecord, function(key, value){ if(value.Group == 'Note') { content[counter] += '
' + value.Label + '' ; content[counter] += ' ' + value.Data +'
'; } }) } */