4

For all the English Language sites, ELU, ELL, Linguistics, Language Learners (did I miss any), etymonline is a pretty heavily used resource. It provides very short definitions and longer etymologies, a very common discussion topic on all these sites.

For example, who knew that the preposition 'down' comes from the name for a geographical feature? Etymonline is like wikipedia for ELU chat.

A simple one-box would be an amazing feature to have and would benefit all sites.

1
  • 4
    IIRC the one-box is created server-side when you post the link. There has to be some API at etymonline that can offer the content for the one-box at a single call. At first glance it doesn't look like etymonline offers such an api. If the SE dev team has to do some html scraping I doubt they will add it.
    – rene Mod
    Commented Oct 15, 2016 at 17:53

1 Answer 1

5

It's unlikely SE will implement this specifically, because as @rene said, there's no official API for etymonline.

However, I have made a 'plugin' for use with my SE Chat Custom Oneboxes userscript. This is, by no means, an ideal solution, but it works, and could be helpful for sites such as this where SE can't implement themselves.

enter image description here

To use it:

  1. Install a userscript manager: Tampermonkey (for Chrome) or Greasemonkey (for Firefox)
  2. Install the userscript. Clicking this link will prompt your userscript manager to ask you to install it.
  3. Copy and paste the plugin (below) just above the -------------------------------- in the middle of the script.

That's it!

Plugin:

customSites['etymonline.com'] = function(link, $obj) {
    var term = link.split('?')[1].split('term=')[1];
    if(term) {
    $('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/shu8/SE-Chat-Custom-Oneboxes/master/etymonline.css">');
        $.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent('http://etymonline.com/index.php?term=' + term) + "%22&callback=", function(d) {
            var termToDisplay = $(d).find('#dictionary dt:eq(0)').text(),
                definition = $(d).find('#dictionary dd:eq(0)').text();

            var template = "<div class='etymonline-container'>\
                              <span class='term'>[etymonline]: <a href='"+link+"'>" + termToDisplay + "</a></span><br>\
                              <span>" + definition + "</span>\
                            </div>";

            $obj.html(template);
        });
    }
};

Once you've installed it, you can quickly check if it works by going to this chat link, which is a etymonline link, which will transform into a nicer-looking, more helpful onebox! :D


If you have any installation questions, or any design suggestions (I did this really quickly!) please do comment here.

0

You must log in to answer this question.

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