return;
}
this.label.html(text);
},
//format the text
_getFormatString: function (format, val) {
var self = this;
var processValue = parseInt(self.element.attr(“aria-valuenow”));
var remainingProcess = self.max – processValue
var percentProgress = val;
var percentageRemaining = 100 – val;
var r = /{0}/g;
format = format.replace(r, processValue.toString());
r = /{ProgressValue}/g;
format = format.replace(r, processValue.toString());
r = /{1}/g;
format = format.replace(r, percentProgress.toString());
r = /{PercentProgress}/g;
format = format.replace(r, percentProgress.toString());
r = /{2}/g;
format = format.replace(r, remainingProcess.toString());
r = /{RemainingProgress}/g;
format = format.replace(r, remainingProcess.toString());
r = /{3}/g;
format = format.replace(r, percentageRemaining.toString());
r = /{PercentageRemaining}/g;
format = format.replace(r, percentageRemaining.toString());
r = /{4}/g;
format = format.replace(r, self.min);
r = /{Min}/g;
format = format.replace(r, self.min);
r = /{5}/g;
format = format.replace(r, self.max);
r = /{Max}/g;
format = format.replace(r, self.max);
return format;
},
///destroy the widget.
destroy: function () {
this.element.empty();
this.element.removeClass(“ui-wijprogressbar ui-widget ui-widget-content ui-corner-all ui-wijprogressbar-h”).removeAttr(“title”);
$.Widget.prototype.destroy.apply(this, arguments);
}
});
///progress bar animation. If user want to write custom animation,can override the animations option.And set the animated to the options key.
$.extend($.ui.wijprogressbar, {
animations: {
progress: function (options, additions) {
options = $.extend({
easing: “swing”,
duration: 1000
}, options, additions);
options.content.stop(true, true).animate({
widthvalue: options.processValue
}, options);
}
}
});
})(jQuery);
widget主要是处理ui层面的,实用与否只有用了才知道,widget可以利用jQuery已经存在的css framework。利用themeRoller,可以很轻松的换肤。至于说功能,可以在用户反馈后再慢慢完善。
这个progressbar本身是继承自jQuery ui progressbar的。因为开源,如果自己有好的想法,自己也可以去增加自己需要的功能。










