Sha256: b71787001b357f8f348b7ad012dd3e45b2fb5cb0d8deb84cbeae87bc9f2d853a

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

;(function($){
    var MIN = 13;
    var MAX = 17;
    var DEFAULT = 15;
    var p = Application.params.font_size;
    var pi = parseInt(p);
    var size = ((!isNaN(p) && pi <= MAX && pi >= MIN)) ? pi : DEFAULT;

    $.fn.resizeable = function() {
        function set(size, notify) {
            // set size
            $('.resizeable_text').css('font-size', get_px(size) + "px");

            // reset disabled state
            $('.resizeable').removeClass('disabled');
            // set disabled state
            if (size === MIN) $('.resizeable.down').addClass('disabled');
            if (size === MAX) $('.resizeable.up').addClass('disabled');

            // notify the client of the size
            if (notify) Client.notify({ 'font_size': size });
            return size;
        }
        function handlers(el) {
            el
                .unbind("click")
                .bind("click", function() {
                    var new_size = size + parseInt($(this).data('dir'), 10);
                    if (new_size <= MAX && new_size >= MIN) {
                        size = set(new_size, true);
                    }
                });
        }

        set(size, false);
        handlers(this);

        return this;
    };
})(Zepto);

Version data entries

11 entries across 11 versions & 1 rubygems

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