Sha256: 7a8ab0f3e65d295a5f021346a9f16f0a4a3869374045c373bd39f289be7c7bab

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

(function($){
    var load_timer;
    var LOADING_TEXT = 'Loading…';
    function prevent(e) {
        e.preventDefault();
    }
    function freeze() {
        $(document.body).bind("touchmove", prevent);
    }
    function thaw() {
        $(document.body).unbind('touchmove', prevent);
    }
    function showLoaderNow() {
        $('#app_load_loader').remove();
        freeze();
        loading_text = LOADING_TEXT;
        if (Application.currentView && Application.currentView.params.loading_text) {
            loading_text = Application.currentView.params.loading_text;
        }
        $('#loading_text').html(loading_text);

        $('#loading').css({'height': document.documentElement.clientHeight + 'px'});
        $.alignLoader();

        $('#loading').show();
    }
    $.alignLoader = function() {
        $('#loading').css({'top': window.scrollY + 'px'});
    };
    $.showLoader = function(loader_text) {
        if (load_timer) {
            load_timer.stop();
            load_timer = undefined;
        }
        load_timer = new Timer(showLoaderNow, 222);
        load_timer.start();
    };
    $.hideLoader = function() {
        load_timer.stop();
        thaw();
        $('#loading').hide();
        $('#app_load_loader').remove();
        if (Application.currentView && Application.currentView.params.loading_text) {
            Application.currentView.params.loading_text = LOADING_TEXT;
        }
    };
})(Zepto);

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sports_db-0.2 app/assets/javascripts/plugins/loading.js
sports_db-0.0.13 app/assets/javascripts/plugins/loading.js
sports_db-0.1.3 app/assets/javascripts/plugins/loading.js
sports_db-0.1.2 app/assets/javascripts/plugins/loading.js
sports_db-0.1.1 app/assets/javascripts/plugins/loading.js
sports_db-0.1.0 app/assets/javascripts/plugins/loading.js
sports_db-0.0.9 app/assets/javascripts/plugins/loading.js
sports_db-0.0.8 app/assets/javascripts/plugins/loading.js
sports_db-0.0.7 app/assets/javascripts/plugins/loading.js
sports_db-0.0.6 app/assets/javascripts/plugins/loading.js
sports_db-0.0.5 app/assets/javascripts/plugins/loading.js
sports_db-0.0.4 app/assets/javascripts/plugins/loading.js