29

In math.SE as well as in codegolf.SE we quite often use OEIS (Online Encyclopedia of Integer Sequences), which the standard reference for sequences in combinatorics and number theory.

I think - and apparently I am not the only one - this would be an excellent addition of sites that do get oneboxed.

All the sequences available in OEIS are enumerated and have a consistent formatting, which would make it easy from a technical standpoint. As an example: http://oeis.org/A000001 the "first" sequence, which is the the number of groups (a certain algebraic structure) of the given order.

I picture the onebox to contain the number and the description, as well as the first three lines (there are usually at most three lines displayed there, if more are know they can be found under the list link) including the links that follow, basically just the header as you can see it here (screenshot):

enter image description here

  • 8
    Yup. There's a reason why the chat message has 16 stars (and this post has 8 upvotes) and counting.. – ev3commander May 31 '16 at 19:43
4

I have previously made a userscript that lets you make custom oneboxes for specific sites at Stack Apps: Make your own custom oneboxes for Chat!.

I've made a 'plugin' for it to onebox OEIS entries.

enter image description here

To use it, simply install the userscript and then paste this 'plugin' (just above the //---------You don't need to modify the below!----------------//):

customSites['oeis.org'] = function(link, $obj) {
    var id = link.split('/')[3];
    if(id) {
    $('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/shu8/SE-Chat-Custom-Oneboxes/master/oeis.css">');
        $.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent('http://oeis.org/' + id) + "%22&callback=", function(d) {
            var $document = $(d);
            var $table = $document.find('form').parent().next();
            var number = $table.find('table:eq(1) td:eq(0)').text().trim();
            var desc = $table.find('table:eq(1) td:eq(2)').text().trim();
            var sequence = $table.find('table:eq(2)').text().trim().replace(/ *\([^)]*\)/, ''); //http://stackoverflow.com/a/4292483/3541881
            var template = "<div class='oeis-container'>\
                              <span class='id'>[OEIS]: <a href='"+link+"'>"+number+"</a></span>\
                              <span>"+desc+"</span>\
                              <span class='sequence'>"+sequence.replace(/ *\([^)]*\)/, '')+"</span>\
                            </div>";
            $obj.html(template);
        });
    }
};

More installation help can be found at the Stack Apps post :)


Unfortunately, this isn't the ideal solution, because anyone who wants to see the onebox must install the userscript. Being implemented by SE would be much, much better, but this userscript can help you if you regularly need to see OEIS entries from chat! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .