##Oneboxing arXiv links
Oneboxing arXiv links
customSites['arxiv.org'] = function(link, $obj) {
$('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/shu8/SE-Chat-Custom-Oneboxes/master/arxiv.css">');
var id = link.split('/')[4];
if (id.indexOf('pdf') > -1) {
id = id.replace('.pdf', '');
}
$.get("http://export.arxiv.org/api/query?search_query="+id, function(d) {
var $xml = $(d);
console.log($xml);
var title = $xml.find('entry title').text();
var author = $xml.find('entry author').text();
var summary = $xml.find('entry summary').text();
var url = $xml.find('entry link[type="text/html"]').attr('href');
var template = "<div class='arxiv-container'> \
<img src='https://i.sstatic.net/0h65A.jpg' /> \
<div class='title'><a href='"+url+"'>"+title+"</a></div> \
<div class='author'>"+author+"</div> \
<div class='desc'>"+summary+"</div> \
</div>";
$obj.html(template);
});
};