dist/crocodoc.viewer.js
function createLink(link) {
        var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK),
            left = link.bbox[0],
            top = link.bbox[1],
            attr = {};

        if (browser.ie) {
            // @NOTE: IE doesn't allow override of ctrl+click on anchor tags,
            // but there is a workaround to add a child element (which triggers
            // the onclick event first)
            $('<span>')
                .appendTo($link)
                .on('click', handleClick);
        }

        $link.css({
            left: left + 'pt',
            top: top + 'pt',
            width: link.bbox[2] - left + 'pt',
            height: link.bbox[3] - top + 'pt'
        });

        if (link.uri) {
            if (/^http|^mailto/.test(link.uri)) {
                attr.href = encodeURI(link.uri);
                attr.target = '_blank';
                attr.rel = 'noreferrer'; // strip referrer for privacy
            } else {
                // don't embed this link... we don't trust the protocol
                return;
            }
        } else if (link.destination) {
            attr.href = '#page-' + link.destination.pagenum;
        }

        $link.attr(attr);
        $link.data('link', link);
        $link.appendTo($el);
    }
function createLink(link) {
        var $link = $('<a>').addClass(CSS_CLASS_PAGE_LINK),
            left = link.bbox[0],
            top = link.bbox[1],
            attr = {};

        if (browser.ie) {
            // @NOTE: IE doesn't allow override of ctrl+click on anchor tags,
            // but there is a workaround to add a child element (which triggers
            // the onclick event first)
            $('<span>')
                .appendTo($link)
                .on('click', handleClick);
        }

        $link.css({
            left: left + 'pt',
            top: top + 'pt',
            width: link.bbox[2] - left + 'pt',
            height: link.bbox[3] - top + 'pt'
        });

        if (link.uri) {
            if (/^http|^mailto/.test(link.uri)) {
                attr.href = encodeURI(link.uri);
                attr.target = '_blank';
                attr.rel = 'noreferrer'; // strip referrer for privacy
            } else {
                // don't embed this link... we don't trust the protocol
                return;
            }
        } else if (link.destination) {
            attr.href = '#page-' + link.destination.pagenum;
        }

        $link.attr(attr);
        $link.data('link', link);
        $link.appendTo($el);
    }
function createLink ( link ) { var $link = $ ( '<a>' ) . addClass ( CSS_CLASS_PAGE_LINK ) , left = link . bbox [ 0 ] , top = link . bbox [ 1 ] , attr = { } ; if ( browser . ie ) { // @NOTE: IE doesn't allow override of ctrl+click on anchor tags, // but there is a workaround to add a child element (which triggers // the onclick event first) $ ( '<span>' ) . appendTo ( $link ) . on ( 'click' , handleClick ) ; } $link . css ( { left : left + 'pt' , top : top + 'pt' , width : link . bbox [ 2 ] - left + 'pt' , height : link . bbox [ 3 ] - top + 'pt' } ) ; if ( link . uri ) { if ( / ^http|^mailto / . test ( link . uri ) ) { attr . href = encodeURI ( link . uri ) ; attr . target = '_blank' ; attr . rel = 'noreferrer' ; // strip referrer for privacy } else { // don't embed this link... we don't trust the protocol return ; } } else if ( link . destination ) { attr . href = '#page-' + link . destination . pagenum ; } $link . attr ( attr ) ; $link . data ( 'link' , link ) ; $link . appendTo ( $el ) ; }
Create a link element given link data
@param   {Object} link The link data
@returns {void}
@private
Create a link element given link data