(function($){
$.fn.extend({
loading_icon:function(enabled)
{
return this.each(function() {
if (enabled == true)
{
if (this.loading == true) return;
this.loading = true;
this.save_background = $(this).css('background-image');
$(this).css('background-image','url()');
$(this).html('');
}
else
{
if (this.loading == undefined || this.loading == false) return;
this.loading = false;
$(this).html('');
$(this).css('background-image',this.save_background);
}
});
},
//pass the options variable to the function
loading_button: function(enabled,options) {
//Set the default values, use comma to separate the settings, example:
var defaults = {
image : '',
word: 'Loading'
}
var options = $.extend(defaults, options);
return this.each(function() {
if (enabled == true)
{
var inside_content = $(this).html();
//var action = $(this).attr('onclick');
//$(this).html(''+options.image + ' ' + options.word+'');
$(this).html(''+options.image + ' ' + options.word+'');
$(this).append(''+inside_content+'');
//$(this).append(''+action+'');
}
else
{
var hidden_div = $('.loading_button_hidden_div',this);
//var hidden_div_action = $('.loading_button_hidden_div_action',this);
if (hidden_div.length == 0) return;
$(this).html($(hidden_div).html());
//alert($(hidden_div_action).html())
//$(this).attr('onclick',$(hidden_div_action).html());
}
});
}
});
})(jQuery);