We will also need to modify the fetchCallback
function from http://cdn.sstatic.net/js/third-party/citation-helper.js?v=2.
This is the current content of that function, which we can "edit in place" to update.
// Callback to run when search completes.
function fetchCallback(response) {
// Here's an example of what the 'response' argument might contain.
// response = {
// "results": [
// {
// "pagination": "2586-2620",
// "links": [
// "http://dx.doi.org/10.1016/j.jfa.2014.12.018",
// "http://www.arxiv.org/abs/1406.4766"
// ],
// "title": "Free transport for finite depth subfactor planar algebras",
// "year": "2015",
// "source": "",
// "score": 2.15747,
// "zbl_id": "06435710",
// "authors": "Nelson, Brent"
// },
// {
// "pagination": "183-214",
// "links": [
// "http://dx.doi.org/10.1023/A:1021296230310"
// ],
// "title": "Exchange relation planar algebras",
// "year": "2002",
// "source": "Geom. Dedicata 95, 183-214 (2002).",
// "score": 2.15747,
// "zbl_id": "1022.46039",
// "authors": "Landau, Zeph A."
// }
// ]
// }
var html = $('<div class="list">');
for (var i = 0; i < response.results.length; i++) {
var result = response.results[i];
var zbl = 'https://zbmath.org/?q=an:' + result.zbl_id;
var link = result.links.length > 0 ? result.links[0] : '';
var arxiv = '';
for (var j = 0; j < result.links.length; j++) {
arxiv = result.links[j].includes("arxiv") ? result.links[j] : arxiv;
}
var authors = sanitizeForDisplay(result.authors);
var title = sanitizeForDisplay(result.title);
var citationHtml = sanitizeForDisplay(result.source);
var result = $('<div class="item" style="float:none;padding:5px">')
.html($('<div class = "summary post-link" style="float:none;width:auto;font-weight:bold;">')
.text(title))
.append('<br/>')
.append($('<span class="body-summary" style="float:none"></span>')
.append(authors + '<br/>' + citationHtml + '<br/> Preview (opens in new tab): ')
.append(renderOptionalLink(link, 'article'))
.append(renderOptionalLink(zbl, 'zbmath'))
.append(renderOptionalLink(arxiv, 'arxiv'))
)
.click(loadResultCallback(link, result))
.hover(function () { $(this).css('background-color', '#e6e6e6') }, function () { $(this).css('background-color', '#fff') });
html.append(result);
result.find('a').on('click', function(e) { e.stopPropagation(); });
}
$('#results').html('').append(html);
MathJax.Hub.Queue(['Typeset', MathJax.Hub, 'results']);
$('#popup-cite .search-spinner').removeSpinner();
}
getCitationHtml
to match the JSON data from ZBL? $\endgroup$