Sha256: 916dfe558b3c72a3b13bd3597c9e8f91b86146d9c29acebccdbb7d81dd7002ac
Contents?: true
Size: 1.46 KB
Versions: 23
Compression:
Stored size: 1.46 KB
Contents
class @Mercury.Statusbar constructor: (@options = {}) -> @visible = @options.visible @build() @bindEvents() build: -> @element = jQuery('<div>', {class: 'mercury-statusbar'}) @aboutElement = jQuery('<a>', {class: "mercury-statusbar-about"}).appendTo(@element).html("DSC Kit Editor") @pathElement = jQuery('<div>', {class: 'mercury-statusbar-path'}).appendTo(@element) @element.css({visibility: 'hidden'}) unless @visible @element.appendTo(jQuery(@options.appendTo).get(0) ? 'body') bindEvents: -> Mercury.on 'region:update', (event, options) => @setPath(options.region.path()) if options.region && jQuery.type(options.region.path) == 'function' @aboutElement.on 'click', => document.location = 'http://www.dsc.net' height: -> @element.outerHeight() top: -> top = @element.offset().top currentTop = if parseInt(@element.css('bottom')) < 0 then top - @element.outerHeight() else top if @visible then currentTop else top + @element.outerHeight() setPath: (elements) -> path = [] path.push("<a>#{element.tagName.toLowerCase()}</a>") for element in elements @pathElement.html("<span><strong>#{Mercury.I18n('Path:')} </strong>#{path.reverse().join(' » ')}</span>") show: -> @visible = true @element.css({opacity: 0, visibility: 'visible'}) @element.animate({opacity: 1}, 200, 'easeInOutSine') hide: -> @visible = false @element.css({visibility: 'hidden'})
Version data entries
23 entries across 23 versions & 1 rubygems