Sha256: 1d23e1bcf7bfd2ab1d851de7e1e8375e707469ed5eb5933522785bd559cfcddf

Contents?: true

Size: 846 Bytes

Versions: 6

Compression:

Stored size: 846 Bytes

Contents

if (typeof(Alchemy) === 'undefined') {
	var Alchemy = {};
}

(function($) {

	$.extend(Alchemy, {

		ButtonObserver: function (selector) {
			$(selector).click(function(event) {
				Alchemy.disableButton(this);
			});
		},

		disableButton: function (button) {
			var $button = $(button), $clone = $button.clone(), width = $button.outerWidth(), text = $button.text();
			$button.hide();
			$button.parent().append($clone);
			$clone.attr({disabled: true, href: 'javascript:void(0)'})
			.addClass('disabled cloned-button')
			.css({width: width})
			.html('<img src="/assets/alchemy/ajax_loader.gif" style="width: 16px; height: 16px">')
			.show();
			return true;
		},

		enableButton: function (button) {
			var $button = $(button);
			$button.show();
			$button.parent().find('.cloned-button').remove();
			return true;
		}

	});

})(jQuery);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alchemy_cms-2.1.5 app/assets/javascripts/alchemy/alchemy.buttons.js
alchemy_cms-2.1.4 app/assets/javascripts/alchemy/alchemy.buttons.js
alchemy_cms-2.1.3 app/assets/javascripts/alchemy/alchemy.buttons.js
alchemy_cms-2.1.2 app/assets/javascripts/alchemy/alchemy.buttons.js
alchemy_cms-2.1.1 app/assets/javascripts/alchemy/alchemy.buttons.js
alchemy_cms-2.1 app/assets/javascripts/alchemy/alchemy.buttons.js