Sha256: 067764019a6ec0cf530910b0c490325affca63241fcb26749d119e28d926bbab

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

/*global Application */
;(function() {

    // Delay loading of images to make sure they load last.
    // Also, enable retina images.
    var delayed_load = function() {

        $('.delayed_load').not('.processed').each(function() {

            var src = $(this).data('src');

            if (window.devicePixelRatio > 1)  {
                src = src.replace(/\.png/g, '@2x.png');
            }

            if (src) {
                $(this)
                    .attr('src', src)
                    .addClass('processed');
            } else {
                $(this).remove();
                console.log("Removing image: " + this);
            }

        });

    };

    $(document.body)
        .on('Application:viewAppended', delayed_load)
        .on('tabUpdated', delayed_load);

    $(document.body).on('Logo:Error', function(e) {
        if ($(e.target).data('fxdlogo')) return;

        // NBA3 should use `Application.params.MISSING_LOGO`
        $(e.target)
            .attr('src', Application.params.imageHost + 'logos/DivisionIAA_25x25@2x.png')
            .data('fxdlogo', true);

    });

})();

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sports_db-0.2.19 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.18 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.17 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.16 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.15 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.14 app/assets/javascripts/plugins/delayed_load.js
sports_db-0.2.13 app/assets/javascripts/plugins/delayed_load.js