Sha256: 2b29487825b8e8b4a6c1e128dabe932fac29fe87da706a2af8b994b51947e4e1

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

/*global Application */
;(function($){
    var load_timer;
    var LOADING_TEXT = 'Loading…';
    var $loading = $('#loading');
    var v = parseFloat($.os.version);
    var deviceHasNativeSupport = ($.os.ios && v >= 5) || ($.os.android && v >= 2.2);

    function alignLoader() {
        if (!deviceHasNativeSupport && $loading.css('display') === 'block') {
            $loading
                .css('position', 'absolute')
                .find('.loading_text')
                .css('margin-top', (window.pageYOffset + 80) + 'px');
        }
    }
    $.showLoader = function() {
        if (load_timer) {
            window.clearTimeout(load_timer);
        }
        load_timer = setTimeout(function() {
            var txt = LOADING_TEXT;
            if (Application.currentView && Application.currentView.params.loading_text) {
                txt = Application.currentView.params.loading_text;
            }
            $('#loading_text').html(txt);
            $loading
                .freeze()
                .show();
            alignLoader();
        }, 333);
    };
    $.hideLoader = function() {
        if (load_timer) {
            window.clearTimeout(load_timer);
        }

        $loading
          .freeze({'unfreeze':true})
          .hide();

        $('#app_load_loader').remove();

        Application.currentView.params.loading_text = LOADING_TEXT;
    };

    $(window).on('scroll', alignLoader);

})(Zepto);

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sports_db-0.2.19 app/assets/javascripts/plugins/loading.js
sports_db-0.2.18 app/assets/javascripts/plugins/loading.js
sports_db-0.2.17 app/assets/javascripts/plugins/loading.js
sports_db-0.2.16 app/assets/javascripts/plugins/loading.js
sports_db-0.2.15 app/assets/javascripts/plugins/loading.js
sports_db-0.2.14 app/assets/javascripts/plugins/loading.js
sports_db-0.2.13 app/assets/javascripts/plugins/loading.js
sports_db-0.2.12 app/assets/javascripts/plugins/loading.js
sports_db-0.2.11 app/assets/javascripts/plugins/loading.js
sports_db-0.2.10 app/assets/javascripts/plugins/loading.js
sports_db-0.2.9 app/assets/javascripts/plugins/loading.js
sports_db-0.2.8 app/assets/javascripts/plugins/loading.js
sports_db-0.2.7 app/assets/javascripts/plugins/loading.js
sports_db-0.2.6 app/assets/javascripts/plugins/loading.js
sports_db-0.2.5 app/assets/javascripts/plugins/loading.js
sports_db-0.2.4 app/assets/javascripts/plugins/loading.js