dist/js/glightbox.js
function getSourceType(url) {
        var origin = url;
        url = url.toLowerCase();

        if (url.match(/\.(jpeg|jpg|gif|png|apn|webp|svg)$/) !== null) {
            return 'image';
        }
        if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)) {
            return 'video';
        }
        if (url.match(/vimeo\.com\/([0-9]*)/)) {
            return 'video';
        }
        if (url.match(/\.(mp4|ogg|webm)$/) !== null) {
            return 'video';
        }

        // Check if inline content
        if (url.indexOf("#") > -1) {
            var hash = origin.split('#').pop();
            if (hash.trim() !== '') {
                return 'inline';
            }
        }
        // Ajax
        if (url.includes("gajax=true")) {
            return 'ajax';
        }

        return 'external';
    }
function getSourceType(url) {
        var origin = url;
        url = url.toLowerCase();

        if (url.match(/\.(jpeg|jpg|gif|png|apn|webp|svg)$/) !== null) {
            return 'image';
        }
        if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)) {
            return 'video';
        }
        if (url.match(/vimeo\.com\/([0-9]*)/)) {
            return 'video';
        }
        if (url.match(/\.(mp4|ogg|webm)$/) !== null) {
            return 'video';
        }

        // Check if inline content
        if (url.indexOf("#") > -1) {
            var hash = origin.split('#').pop();
            if (hash.trim() !== '') {
                return 'inline';
            }
        }
        // Ajax
        if (url.includes("gajax=true")) {
            return 'ajax';
        }

        return 'external';
    }
function getSourceType ( url ) { var origin = url ; url = url . toLowerCase ( ) ; if ( url . match ( / \.(jpeg|jpg|gif|png|apn|webp|svg)$ / ) !== null ) { return 'image' ; } if ( url . match ( / (youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+) / ) || url . match ( / youtu\.be\/([a-zA-Z0-9\-_]+) / ) ) { return 'video' ; } if ( url . match ( / vimeo\.com\/([0-9]*) / ) ) { return 'video' ; } if ( url . match ( / \.(mp4|ogg|webm)$ / ) !== null ) { return 'video' ; } // Check if inline content if ( url . indexOf ( "#" ) > - 1 ) { var hash = origin . split ( '#' ) . pop ( ) ; if ( hash . trim ( ) !== '' ) { return 'inline' ; } } // Ajax if ( url . includes ( "gajax=true" ) ) { return 'ajax' ; } return 'external' ; }
Get source type
gte the source type of a url

@param {string} url
Get source type gte the source type of a url