code: function() {
  
        var parent, selection, range, div, links;
  
        parent = null;
  
        if (document.selection) {
          parent = document.selection.createRange().parentElement();
        } else {
          selection = window.getSelection();
          if (selection.rangeCount > 0) {
            parent = selection.getRangeAt(0).startContainer.parentNode;
          }
        }
  
        if (parent !== null) {
          if (parent.tagName == 'A') {
            return parent;
          }
        }
  
        if (window.getSelection) {
          selection = window.getSelection();
  
          if (selection.rangeCount > 0) {
            range = selection.getRangeAt(0);
            div = document.createElement('DIV');
            div.appendChild(range.cloneContents());
            links = div.getElementsByTagName("A");
  
            if (links.length > 0) {
              return links[0];
            } else {
              return null;
            }
  
          }
        }
  
        return null;
      }
docs: Retrieve a link from the selection