Drupal.behaviors.roblib_search_eds_articles = { attach: function (context, settings) { $url = settings.roblib_search_eds_articles.search_url; articles_profile = settings.roblib_search_eds_articles.eds_profile; proxy_url = "http://proxy.library.upei.ca/login?url="; jQuery.getJSON($url, function (data) { var items = []; var numberOfDocs = 0; try { numberOfDocs = data.numFound; } 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(); var queries = []; jQuery.each(data.queries, function (key7, query) { queries.push(query.query); }) var query_str = encodeURI(data.queries[0].query); var href_str = 'https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&scope=site&type=1&custid=uprince&groupid=main&profile=eds&mode=bool&lang=en&bquery='; jQuery.each(data.documents, function (key, val) { id = 'roblib-search-eds-article-' + counter; divs[counter++] = id; if (typeof val.Items !== 'undefined') { items.push('
'); if (typeof val.Items.Title !== 'undefined') { items.push('
'); items.push('' + val.Items.Title.Data + '
'); } pubType = val.PubType; pubYear = val.RecordInfo.BibRelationships.IsPartOfRelationships["date"]; !pubYear ? pubYear = " " : pubYear = pubYear[0]["Y"]; items.push('
' + pubYear + ' - ' + pubType + '
'); var roblib_authors = []; jQuery.each(val.RecordInfo.BibRelationships.HasContributorRelationships, function (key3, author) { roblib_authors.push(author.NameFull); }) items.push('
'); roblib_authors = roblib_shorten(roblib_authors.join('; '), 50, " "); items.push(roblib_authors); items.push('
'); if (typeof val.Items.TitleSource !== 'undefined') { items.push('
In: ' + val.Items.TitleSource.Data + '
'); } if (typeof val.PLink !== 'undefined' && typeof val.PDF !== 'undefined' && val.PDF == 'pdflink') { items.push(''); } if (typeof val.PLink !== 'undefined' && typeof val.HTML !== 'undefined' && val.HTML == '1') { items.push(''); } items.push('
'); } else { items.push('
You must login to view this result, click here to login
' );} }); jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join('')); } var non_upei_link = ''; var upei_link = 'SEE ALL (' + data.recordCount + ') '; if(!data.is_local_ip) { non_upei_link = '[Non-UPEI]'; upei_link = upei_link + non_upei_link; } jQuery('#roblib-search-eds-article-more').empty().append(upei_link); jQuery('#roblib-eds-articles-more-results').empty().append(upei_link); jQuery('#roblib-eds-articles-toc').empty().append('Articles (' + data.recordCount + ')'); }); } }