jquery.progressbar.js
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* jQuery EasyUI 1.5
*
* Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved.
*
* Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php
* To use it on other terms please contact us: info@jeasyui.com
*
*/
(function($){
function _1(_2){
$(_2).addClass("progressbar");
$(_2).html("<div class=\"progressbar-text\"></div><div class=\"progressbar-value\"><div class=\"progressbar-text\"></div></div>");
$(_2).bind("_resize",function(e,_3){
if($(this).hasClass("easyui-fluid")||_3){
_4(_2);
}
return false;
});
return $(_2);
};
function _4(_5,_6){
var _7=$.data(_5,"progressbar").options;
var _8=$.data(_5,"progressbar").bar;
if(_6){
_7.width=_6;
}
_8._size(_7);
_8.find("div.progressbar-text").css("width",_8.width());
_8.find("div.progressbar-text,div.progressbar-value").css({height:_8.height()+"px",lineHeight:_8.height()+"px"});
};
$.fn.progressbar=function(_9,_a){
if(typeof _9=="string"){
var _b=$.fn.progressbar.methods[_9];
if(_b){
return _b(this,_a);
}
}
_9=_9||{};
return this.each(function(){
var _c=$.data(this,"progressbar");
if(_c){
$.extend(_c.options,_9);
}else{
_c=$.data(this,"progressbar",{options:$.extend({},$.fn.progressbar.defaults,$.fn.progressbar.parseOptions(this),_9),bar:_1(this)});
}
$(this).progressbar("setValue",_c.options.value);
_4(this);
});
};
$.fn.progressbar.methods={options:function(jq){
return $.data(jq[0],"progressbar").options;
},resize:function(jq,_d){
return jq.each(function(){
_4(this,_d);
});
},getValue:function(jq){
return $.data(jq[0],"progressbar").options.value;
},setValue:function(jq,_e){
if(_e<0){
_e=0;
}
if(_e>100){
_e=100;
}
return jq.each(function(){
var _f=$.data(this,"progressbar").options;
var _10=_f.text.replace(/{value}/,_e);
var _11=_f.value;
_f.value=_e;
$(this).find("div.progressbar-value").width(_e+"%");
$(this).find("div.progressbar-text").html(_10);
if(_11!=_e){
_f.onChange.call(this,_e,_11);
}
});
}};
$.fn.progressbar.parseOptions=function(_12){
return $.extend({},$.parser.parseOptions(_12,["width","height","text",{value:"number"}]));
};
$.fn.progressbar.defaults={width:"auto",height:22,value:0,text:"{value}%",onChange:function(_13,_14){
}};
})(jQuery);