', {
"class": 'mercury-toolbar-container',
style: 'width:10000px'
});
this.element.css({
width: '100%'
});
this.element.appendTo((_ref = jQuery(this.options.appendTo).get(0)) != null ? _ref : 'body');
_ref1 = Mercury.config.toolbars;
for (toolbarName in _ref1) {
if (!__hasProp.call(_ref1, toolbarName)) continue;
buttons = _ref1[toolbarName];
if (buttons._custom) {
continue;
}
toolbar = jQuery('
', {
"class": "mercury-toolbar mercury-" + toolbarName + "-toolbar"
}).appendTo(this.element);
if (buttons._regions) {
toolbar.attr('data-regions', buttons._regions);
}
container = jQuery('
', {
"class": 'mercury-toolbar-button-container'
}).appendTo(toolbar);
for (buttonName in buttons) {
if (!__hasProp.call(buttons, buttonName)) continue;
options = buttons[buttonName];
if (buttonName === '_regions') {
continue;
}
button = this.buildButton(buttonName, options);
if (button) {
button.appendTo(container);
}
}
if (container.css('white-space') === 'nowrap') {
expander = new Mercury.Toolbar.Expander(toolbarName, {
appendTo: toolbar,
"for": container
});
expander.appendTo(this.element);
}
if (Mercury.config.toolbars['primary'] && toolbarName !== 'primary') {
toolbar.addClass('disabled');
}
}
if (!this.visible) {
return this.element.css({
display: 'none'
});
}
};
Toolbar.prototype.buildButton = function(name, options) {
var action, button, group, handled, opts, summary, title;
if (name[0] === '_') {
return false;
}
switch (jQuery.type(options)) {
case 'array':
title = options[0], summary = options[1], handled = options[2];
return new Mercury.Toolbar.Button(name, title, summary, handled, {
appendDialogsTo: this.element
});
case 'object':
group = new Mercury.Toolbar.ButtonGroup(name, options);
for (action in options) {
if (!__hasProp.call(options, action)) continue;
opts = options[action];
button = this.buildButton(action, opts);
if (button) {
button.appendTo(group);
}
}
return group;
case 'string':
return jQuery('
', {
"class": "mercury-" + (options === '-' ? 'line-separator' : 'separator')
});
default:
throw Mercury.I18n('Unknown button structure -- please provide an array, object, or string for "%s".', name);
}
};
Toolbar.prototype.bindEvents = function() {
var _this = this;
Mercury.on('region:focused', function(event, options) {
var regions, toolbar, _i, _len, _ref, _results;
_ref = _this.element.find(".mercury-toolbar");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
toolbar = _ref[_i];
toolbar = jQuery(toolbar);
if (regions = toolbar.data('regions')) {
if (regions.split(',').indexOf(options.region.type()) > -1) {
_results.push(toolbar.removeClass('disabled'));
} else {
_results.push(void 0);
}
} else {
_results.push(void 0);
}
}
return _results;
});
Mercury.on('region:blurred', function(event, options) {
var regions, toolbar, _i, _len, _ref, _results;
_ref = _this.element.find(".mercury-toolbar");
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
toolbar = _ref[_i];
toolbar = jQuery(toolbar);
if (regions = toolbar.data('regions')) {
if (regions.split(',').indexOf(options.region.type()) > -1) {
_results.push(toolbar.addClass('disabled'));
} else {
_results.push(void 0);
}
} else {
_results.push(void 0);
}
}
return _results;
});
this.element.on('click', function() {
return Mercury.trigger('hide:dialogs');
});
return this.element.on('mousedown', function(event) {
return event.preventDefault();
});
};
Toolbar.prototype.height = function(force) {
if (force == null) {
force = false;
}
if (this.visible || force) {
return this.element.outerHeight();
} else {
return 0;
}
};
Toolbar.prototype.top = function() {
if (this.visible) {
return this.element.offset().top;
} else {
return 0;
}
};
Toolbar.prototype.show = function() {
this.visible = true;
this.element.css({
top: -this.element.outerHeight(),
display: 'block'
});
return this.element.animate({
top: 0
}, 200, 'easeInOutSine');
};
Toolbar.prototype.hide = function() {
this.visible = false;
return this.element.hide();
};
return Toolbar;
})();
}).call(this);
; TI"required_assets_digest; TI"%4f47d1c1ef6bc6ce31fdc00603783e23; FI"
_version; TI"%2cf3622cbba861b85d33ffabfa420c13; F