combo_auto_box 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ComboAutoBox
2
- VERSION = '0.0.19'
2
+ VERSION = '0.0.20'
3
3
  end
@@ -211,15 +211,27 @@ var ComboAutoBox = {
211
211
  }
212
212
 
213
213
  spanTag = $('#' + container + ' > div.container-combo-auto-box > span.simple');
214
- var paddingRight = 1;
215
- try {
216
- paddingRight = parseInt(textField.css('padding-right').replace(/px/, ''));
217
- } catch (error) {
218
- paddingRight = 1;
214
+
215
+ inputWidth = getTextFieldWidth(textField);
216
+ inputHeight = getTextFieldHeight(textField);
217
+
218
+ inputBorderTop = getTextFieldBorder(textField, 'top');
219
+ inputBorderBottom = getTextFieldBorder(textField, 'bottom');
220
+
221
+ if (inputHeight % 2 != 0) {
222
+ inputBorderTop = inputBorderTop + 2;
219
223
  }
220
- spanTag.css('margin', '3px 0px 0px ' + (getTextFieldWidth(textField) - 13).toString() + 'px');
221
224
 
222
- spanTag.children(':first').css('height', (getTextFieldHeight(textField) - 10).toString() + 'px');
225
+ iWidth = 20;
226
+ if (inputWidth < 20) {
227
+ iWidth = 10;
228
+ }
229
+
230
+ spanTag.css('margin-top', inputBorderTop.toString() + 'px');
231
+ spanTag.css('margin-left', (inputWidth - iWidth + 4).toString() + 'px');
232
+
233
+ spanTag.children(':first').css('width', iWidth.toString() + 'px');
234
+ spanTag.children(':first').css('height', inputHeight.toString() + 'px');
223
235
 
224
236
  return true;
225
237
  }
@@ -239,9 +251,21 @@ var ComboAutoBox = {
239
251
  return widthTotal;
240
252
  }
241
253
 
254
+ var getTextFieldBorder = function (textField, side) {
255
+ var heightTotal = 0;
256
+
257
+ var matched = textField.css('border-' + side).match(/(\d+)(px)/);
258
+ try {
259
+ heightTotal = heightTotal + parseInt(matched[1]);
260
+ } catch (error) {
261
+ }
262
+
263
+ return heightTotal;
264
+ }
265
+
242
266
  var getTextFieldHeight = function (textField) {
243
267
  var heightTotal = 0;
244
-
268
+
245
269
  if (textField.height() != null) {
246
270
  heightTotal = heightTotal + textField.height();
247
271
  }
@@ -1,7 +1,6 @@
1
1
  span.combo-auto-box-item-id { display:none; }
2
- div.container-combo-auto-box span.simple { position:absolute;cursor:pointer;display:block;margin:0px 0px 0px 0px; width:20px; }
3
- /* div.container-combo-auto-box span.simple i { background-image:url(/assets/combo_auto_box_expand.png);width:19px;height:19px;display:block;font-size:0; } */
4
- div.container-combo-auto-box span.simple i { background:url(/assets/dark-grey-disclosure-arrow-down.png) no-repeat center;width:4px;height:5px;display:block;padding: 3px 6px 7px 6px; background-color:#EFEFEF;}
2
+ div.container-combo-auto-box span.simple { position:absolute;cursor:pointer;display:block;margin:0px 0px 0px 0px; }
3
+ div.container-combo-auto-box span.simple i { background:url(/assets/dark-grey-disclosure-arrow-down.png) no-repeat center;display:block;background-color:#EFEFEF;}
5
4
  div.container-combo-auto-box span.simple i:hover { background:url(/assets/light-grey-disclosure-arrow-down.png) no-repeat center; background-color:#EFEFEF;}
6
5
 
7
6
  div.multiple { border: 1px solid #CDCDCD; display:table; width:100%; }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combo_auto_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-14 00:00:00.000000000 Z
12
+ date: 2013-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport