HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/Velosophe/carparkcannonball.cc/wwwroot/source/scripts/modules/modules.defaults.js
/*------------------------------------------------------------------------*/
/*  Rodesk default JS functions
/*------------------------------------------------------------------------*/

var rodeskDefaults = (function () {

    /*------------------------------------------------------------------------*/
    /* Modernizr fallback for <img> tags using SVG (will replace SVG with PNG when not supported)
    /* http://bit.ly/XajRsC
    /*------------------------------------------------------------------------*/

    var _modernizrSvg = function() {
        if( !Modernizr.svg ) {
            jQuery( 'img[src*="svg"]' ).attr( 'src', function() {
                return jQuery( this ).attr( 'src' ).replace( '.svg', '.png' );
            } );
        }
    };

    /*------------------------------------------------------------------------*/
    /*  Open rel=external in new window
    /*------------------------------------------------------------------------*/

    var _relExternal = function() {
        window.open( $( this ).attr( 'href' ) );
        return false;
    };

    /*------------------------------------------------------------------------*/
    /*  Make link of whole element block
    /*------------------------------------------------------------------------*/

    var _jsBlock = function( event ) {

        var link        = $( this ).find( 'a' ).not( '.js-block-skip' ),
            closestHref = link.attr( 'href' ),
            rel         = link.attr( 'rel' );

        if( rel === 'external' ) {
            window.open( closestHref, '_blank' );
        } else {
            window.location = closestHref;
        }

        return false;
    };


    /*------------------------------------------------------------------------*/
   /*  Init Image Liquid JS plugin
   /*------------------------------------------------------------------------*/

   var _imgLiquidCustom = function( element ) {

       element.each( function( counter, image ) {

           // Decode the IMG url if all ready encoded
           // The imgLiquid plugin fucksup the encoded URL's
           // See https://github.com/karacas/imgLiquid/issues/25

           var imageElem   = $( image ).find( 'img' );

           if ( new RegExp( /%[0-9A-Z]{2}/g ).test( imageElem.attr( 'src' )) ) {
               imageElem.attr( 'src', decodeURIComponent( imageElem.attr( 'src' ) ) );
           }

           element.imgLiquid();

       });

   };

    /*------------------------------------------------------------------------*/
    /*  Init matchHeight plugin
    /*------------------------------------------------------------------------*/

    var _matchHeight = function( classArray ) {
        $.each( classArray, function( count, element ) {
            $( element ).matchHeight();
        });
    };

    /*------------------------------------------------------------------------*/
    /*  Setup event listeners
    /*------------------------------------------------------------------------*/

    var _setupListeners = function( classArray ) {

        // Init events for class=".js-block"
        $(document).on( "click" , ".js-block" , _jsBlock );

        // Init events for rel="external"
        $(document).on( "click" , "a[rel='external']" , _relExternal );

    };

    // Return an object exposed to the public
    return {

        matchHeight:_matchHeight,

        /**
         * Global functions init
         */
        init: function() {

            // Init several default functions
            _modernizrSvg(); // Run svgModernizr
            _imgLiquidCustom( $( '.js-image-liquid' ) ); // init imageLiquid plugin
            _setupListeners(); // Setup the event listeners

        }

    };

})(jQuery); // Fully reference jQuery after this point.