~ubuntu-branches/ubuntu/trusty/0ad/trusty-backports

« back to all changes in this revision

Viewing changes to source/tools/jsdebugger/js/lib/jquery.easyui/plugins/jquery.spinner.js

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-02-18 23:21:11 UTC
  • mfrom: (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20140218232111-9x3ag0s782wd9w62
* Repack tarball to remove minified javascript files without source in
  source/tools/jsdebugger/. (Closes: #735349)
  - debian/control: Hardcode versions of 0ad-data{,-common} to depend on to
    workaround the fact that 0.0.15+dfsg is strictly greater than 0.0.15.
* Update debian/copyright to include text of IBM Common Public License.
* Update email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * jQuery EasyUI 1.3.2
3
 
 * 
4
 
 * Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
5
 
 *
6
 
 * Licensed under the GPL or commercial licenses
7
 
 * To use it on other terms please contact us: jeasyui@gmail.com
8
 
 * http://www.gnu.org/licenses/gpl.txt
9
 
 * http://www.jeasyui.com/license_commercial.php
10
 
 *
11
 
 */
12
 
(function($){
13
 
function _1(_2){
14
 
var _3=$("<span class=\"spinner\">"+"<span class=\"spinner-arrow\">"+"<span class=\"spinner-arrow-up\"></span>"+"<span class=\"spinner-arrow-down\"></span>"+"</span>"+"</span>").insertAfter(_2);
15
 
$(_2).addClass("spinner-text spinner-f").prependTo(_3);
16
 
return _3;
17
 
};
18
 
function _4(_5,_6){
19
 
var _7=$.data(_5,"spinner").options;
20
 
var _8=$.data(_5,"spinner").spinner;
21
 
if(_6){
22
 
_7.width=_6;
23
 
}
24
 
var _9=$("<div style=\"display:none\"></div>").insertBefore(_8);
25
 
_8.appendTo("body");
26
 
if(isNaN(_7.width)){
27
 
_7.width=$(_5).outerWidth();
28
 
}
29
 
var _a=_8.find(".spinner-arrow");
30
 
_8._outerWidth(_7.width)._outerHeight(_7.height);
31
 
$(_5)._outerWidth(_8.width()-_a.outerWidth());
32
 
$(_5).css({height:_8.height()+"px",lineHeight:_8.height()+"px"});
33
 
_a._outerHeight(_8.height());
34
 
_a.find("span")._outerHeight(_a.height()/2);
35
 
_8.insertAfter(_9);
36
 
_9.remove();
37
 
};
38
 
function _b(_c){
39
 
var _d=$.data(_c,"spinner").options;
40
 
var _e=$.data(_c,"spinner").spinner;
41
 
_e.find(".spinner-arrow-up,.spinner-arrow-down").unbind(".spinner");
42
 
if(!_d.disabled){
43
 
_e.find(".spinner-arrow-up").bind("mouseenter.spinner",function(){
44
 
$(this).addClass("spinner-arrow-hover");
45
 
}).bind("mouseleave.spinner",function(){
46
 
$(this).removeClass("spinner-arrow-hover");
47
 
}).bind("click.spinner",function(){
48
 
_d.spin.call(_c,false);
49
 
_d.onSpinUp.call(_c);
50
 
$(_c).validatebox("validate");
51
 
});
52
 
_e.find(".spinner-arrow-down").bind("mouseenter.spinner",function(){
53
 
$(this).addClass("spinner-arrow-hover");
54
 
}).bind("mouseleave.spinner",function(){
55
 
$(this).removeClass("spinner-arrow-hover");
56
 
}).bind("click.spinner",function(){
57
 
_d.spin.call(_c,true);
58
 
_d.onSpinDown.call(_c);
59
 
$(_c).validatebox("validate");
60
 
});
61
 
}
62
 
};
63
 
function _f(_10,_11){
64
 
var _12=$.data(_10,"spinner").options;
65
 
if(_11){
66
 
_12.disabled=true;
67
 
$(_10).attr("disabled",true);
68
 
}else{
69
 
_12.disabled=false;
70
 
$(_10).removeAttr("disabled");
71
 
}
72
 
};
73
 
$.fn.spinner=function(_13,_14){
74
 
if(typeof _13=="string"){
75
 
var _15=$.fn.spinner.methods[_13];
76
 
if(_15){
77
 
return _15(this,_14);
78
 
}else{
79
 
return this.validatebox(_13,_14);
80
 
}
81
 
}
82
 
_13=_13||{};
83
 
return this.each(function(){
84
 
var _16=$.data(this,"spinner");
85
 
if(_16){
86
 
$.extend(_16.options,_13);
87
 
}else{
88
 
_16=$.data(this,"spinner",{options:$.extend({},$.fn.spinner.defaults,$.fn.spinner.parseOptions(this),_13),spinner:_1(this)});
89
 
$(this).removeAttr("disabled");
90
 
}
91
 
_16.options.originalValue=_16.options.value;
92
 
$(this).val(_16.options.value);
93
 
$(this).attr("readonly",!_16.options.editable);
94
 
_f(this,_16.options.disabled);
95
 
_4(this);
96
 
$(this).validatebox(_16.options);
97
 
_b(this);
98
 
});
99
 
};
100
 
$.fn.spinner.methods={options:function(jq){
101
 
var _17=$.data(jq[0],"spinner").options;
102
 
return $.extend(_17,{value:jq.val()});
103
 
},destroy:function(jq){
104
 
return jq.each(function(){
105
 
var _18=$.data(this,"spinner").spinner;
106
 
$(this).validatebox("destroy");
107
 
_18.remove();
108
 
});
109
 
},resize:function(jq,_19){
110
 
return jq.each(function(){
111
 
_4(this,_19);
112
 
});
113
 
},enable:function(jq){
114
 
return jq.each(function(){
115
 
_f(this,false);
116
 
_b(this);
117
 
});
118
 
},disable:function(jq){
119
 
return jq.each(function(){
120
 
_f(this,true);
121
 
_b(this);
122
 
});
123
 
},getValue:function(jq){
124
 
return jq.val();
125
 
},setValue:function(jq,_1a){
126
 
return jq.each(function(){
127
 
var _1b=$.data(this,"spinner").options;
128
 
_1b.value=_1a;
129
 
$(this).val(_1a);
130
 
});
131
 
},clear:function(jq){
132
 
return jq.each(function(){
133
 
var _1c=$.data(this,"spinner").options;
134
 
_1c.value="";
135
 
$(this).val("");
136
 
});
137
 
},reset:function(jq){
138
 
return jq.each(function(){
139
 
var _1d=$(this).spinner("options");
140
 
$(this).spinner("setValue",_1d.originalValue);
141
 
});
142
 
}};
143
 
$.fn.spinner.parseOptions=function(_1e){
144
 
var t=$(_1e);
145
 
return $.extend({},$.fn.validatebox.parseOptions(_1e),$.parser.parseOptions(_1e,["width","height","min","max",{increment:"number",editable:"boolean"}]),{value:(t.val()||undefined),disabled:(t.attr("disabled")?true:undefined)});
146
 
};
147
 
$.fn.spinner.defaults=$.extend({},$.fn.validatebox.defaults,{width:"auto",height:22,value:"",min:null,max:null,increment:1,editable:true,disabled:false,spin:function(_1f){
148
 
},onSpinUp:function(){
149
 
},onSpinDown:function(){
150
 
}});
151
 
})(jQuery);
152