Sha256: 6bf95a2d7a3ad9678b6c81b20b834309a3be32dc776e8f3f9eeba4b7abe26f74

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

I"t(function() {
  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  this.Sidebar = (function() {
    var INSTANCE;

    INSTANCE = null;

    Sidebar.instance = function() {
      return INSTANCE || (INSTANCE = new this($(window), $('.sidebar-plugins')));
    };

    Sidebar.newWidgetContainer = function() {
      return Sidebar.instance().newWidgetContainer();
    };

    function Sidebar($window, $container) {
      this.$window = $window;
      this.$container = $container;
      this.updatePosition = bind(this.updatePosition, this);
      this.saveMinTop();
      this.$window.scroll(this.updatePosition);
      this.$window.resize(this.updatePosition);
      this.$outerContainer = this.$container.parent();
    }

    Sidebar.prototype.updatePosition = function() {
      this.$outerContainer.toggleClass('fixed', this.$window.scrollTop() > this.minTop);
      return this.$container.height($(window).height() - this.$container[0].getBoundingClientRect().top);
    };

    Sidebar.prototype.newWidgetContainer = function() {
      return $(document.createElement('div')).addClass('sidebar-plugin').prependTo(this.$container);
    };

    Sidebar.prototype.saveMinTop = function() {
      var ref;
      return this.minTop = ((ref = this.$container.position()) != null ? ref.top : void 0) || 0;
    };

    return Sidebar;

  })();

}).call(this);
:ET

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shipit-engine-0.0.1.pre test/dummy/tmp/cache/assets/test/sprockets/v3.0/5-U7omAI0wWlpYtm4-S-0h2s2orLnhYlJctYVZn8H3M.cache