dist/hashedit.js
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;
    }
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;
    }
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 ; }
Retrieve a link from the selection
Retrieve a link from the selection