Browse Source

added hover popup to evergreen target

2.x-ebsco
Paul Pound 11 years ago
parent
commit
260fdd92e8
  1. 46
      targets/evergreen/js/evergreen_results.js
  2. 6
      targets/evergreen/roblib_search_evergreen.module

46
targets/evergreen/js/evergreen_results.js

@ -13,9 +13,14 @@ Drupal.behaviors.roblib_search_evergreen = {
jQuery('#' + 'roblib-search-content-evergreen').empty().append('No Results');
jQuery('.pane-roblib-search-evergreen-roblib-search-evergreen-results').hide();
} else {
var counter = 0;
var divs = new Array();
var content = new Array();
jQuery.each(data, function(key, val) {
items.push('<div class ="roblib-search-row">');
id = 'roblib_search_evergreen_' + counter;
populatePopupDivs(content, val, counter);
divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="' + id + '">');
items.push('<div class="roblib-title evergreen">');
if (typeof val.title !== 'undefined') {
items.push('<a href = "'+val.url+'">'+val.title);
@ -45,15 +50,48 @@ Drupal.behaviors.roblib_search_evergreen = {
items.push('</div>')
}
items.push('</div>');
});
});
jQuery('#roblib-search-content-evergreen').empty().append(items.join(''));
qtipify(divs, content, 'More Info');
}
jQuery('#roblib-search-content-evergreen').empty().append(items.join(''));
jQuery('#roblib-search-evergreen-more').empty().append('<a href = "' + data.catalogBaseSearchUrl + '">See all ' + data.numberOfRecords + ' results</a>');
});
}
}
function populatePopupDivs(content, val, counter){
content[counter] = '';
if(typeof val.publisher !== 'undefined'){
content[counter] += '<div class="evergreen-publisher">Publisher: ' + val.publisher +'</div>';
}
if(typeof val.pop !== 'undefined'){
content[counter] += '<div class="evergreen-pop">Place of Publication: ' + val.pop +'</div>';
}
if(typeof val.numofpages !== 'undefined'){
content[counter] += '<div class="evergreen-nop">Number of Pages: ' + val.numofpages +'</div>';
}
if(typeof val.date !== 'undefined'){
content[counter] += '<div class="evergreen-popup-date">Publication Year: ' + val.date +'</div>';
}
var subjects = '';
if(typeof val.subjectsa !== 'undefined'){
subjects += val.subjectsa;
}
if(typeof val.subjectsb !== 'undefined'){
subjects += ' ' + val.subjectsb;
}
if(typeof val.subjectsc !== 'undefined'){
subjects += ' ' + val.subjectsc;
}
if(subjects){
content[counter] += '<div class="evergreen-subjects">Subjects: ' + subjects + '</div>';
}
}
function roblibEvergreenAddHoldings(holdings, items){
items.push('<div class="evergreen-holdings-item">' + holdings.call_number + ' - ' + holdings.location +' (' + holdings.availability + ')</div>');
}

6
targets/evergreen/roblib_search_evergreen.module

@ -217,6 +217,12 @@ function roblib_search_evergreen_parse_results($results, $query) {
roblib_search_evergreen_update_array($output, $index, 'sor', $record->xpath('marcxml:datafield[@tag="245"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_update_array($output, $index, 'date', $record->xpath('marcxml:datafield[@tag="260"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_update_array($output, $index, 'id', $record->xpath('marcxml:datafield[@tag="901"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_update_array($output, $index, 'publisher', $record->xpath('marcxml:datafield[@tag="260"]/marcxml:subfield[@code="a"]'));
roblib_search_evergreen_update_array($output, $index, 'pop', $record->xpath('marcxml:datafield[@tag="260"]/marcxml:subfield[@code="b"]'));
roblib_search_evergreen_update_array($output, $index, 'numofpages', $record->xpath('marcxml:datafield[@tag="300"]/marcxml:subfield[@code="a"]'));
roblib_search_evergreen_update_array($output, $index, 'subjectsa', $record->xpath('marcxml:datafield[@tag="650"]/marcxml:subfield[@code="a"]'));
roblib_search_evergreen_update_array($output, $index, 'subjectsb', $record->xpath('marcxml:datafield[@tag="650"]/marcxml:subfield[@code="b"]'));
roblib_search_evergreen_update_array($output, $index, 'subjectsc', $record->xpath('marcxml:datafield[@tag="650"]/marcxml:subfield[@code="c"]'));
roblib_search_evergreen_holdings($output, $index, $record->xpath('marcxml:datafield[@tag="852"]'));
roblib_search_evergreen_electronic_holdings($output, $index, $record->xpath('marcxml:datafield[@tag="856"]'));
$id = $output[$index]['id'];

Loading…
Cancel
Save