romo 0.19.8 → 0.19.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA512:
3
- data.tar.gz: 5eea8c90486df3910adfb7ec8c509ad7b905b00b75cd254dbe0b2ef5717e9af0f4d75274cd674af2c4788c335eec7c1bda863e62ec9f5fb07bd2c79ed98613b7
4
- metadata.gz: 7677d14e707541385b4bae0f61963fafd0d05ac14ac49cdcf3b0796cac5d473e68a7ea1e71a62238399587d6b43bc1a3676aa3d2babf3fbdbcd5f5ef4506b8d4
5
2
  SHA1:
6
- data.tar.gz: 796333f88f138aaba75067ce59915e6aa5f5bf4c
7
- metadata.gz: 9a0f573b36b64a154382beb9a02ee6d51351a0db
3
+ data.tar.gz: 109dec7707c080e71bfd48ae975ebc9b4e5d533c
4
+ metadata.gz: 15228cba845f2429670da60e0e88029620049bd5
5
+ SHA512:
6
+ data.tar.gz: 1e4763f9735a9cec9d98180fe77f5bb630c0ead348b7fc83a5ee166dc9d679f56bc9f133f0b61777d15781a4385c74b5e627987b5f29ec325601703b1c8522a6
7
+ metadata.gz: 8aec6f050a6897c483d725f4f783c0b87b09372030aa283c53b44171a9ecb3e9c0b3e6e7e54c1963fe5e5faaba52c67d5677ffa137578c3e680103b7952cb6d0
@@ -105,6 +105,14 @@ Romo.prototype.setAttr = function(elem, attrName, attrValue) {
105
105
  return attrValue;
106
106
  }
107
107
 
108
+ Romo.prototype.data = function(elem, dataName) {
109
+ return this._deserializeValue(this.attr(elem, "data-"+dataName));
110
+ }
111
+
112
+ Romo.prototype.setData = function(elem, dataName, dataValue) {
113
+ return this.setAttr(elem, "data-"+dataName, String(dataValue));
114
+ }
115
+
108
116
  Romo.prototype.style = function(elem, styleName) {
109
117
  return elem.style[styleName];
110
118
  }
@@ -433,8 +441,19 @@ Romo.prototype.decodeParamMap = [
433
441
  // AJAX
434
442
 
435
443
  Romo.prototype.ajax = function(settings) {
444
+ var httpMethod = (settings.type || 'GET').toUpperCase();
445
+ var xhrUrl = settings.url || window.location.toString();
446
+ var xhrData = settings.data ? settings.data : null
447
+ if (xhrData && httpMethod === 'GET') {
448
+ var xhrQuery = Romo.param(xhrData);
449
+ if (xhrQuery !== '') {
450
+ xhrUrl = (xhrUrl + '&' + xhrQuery).replace(/[&?]{1,2}/, '?');
451
+ }
452
+ xhrData = null;
453
+ }
454
+
436
455
  var xhr = new XMLHttpRequest();
437
- xhr.open(settings.type || 'GET', settings.url, true, settings.username, settings.password);
456
+ xhr.open(httpMethod, xhrUrl, true, settings.username, settings.password);
438
457
  if (settings.responseType === 'arraybuffer' || settings.responseType === 'blob') {
439
458
  xhr.responseType = settings.responseType;
440
459
  }
@@ -458,7 +477,7 @@ Romo.prototype.ajax = function(settings) {
458
477
  }
459
478
  }
460
479
  };
461
- xhr.send(settings.data ? settings.data : null);
480
+ xhr.send(xhrData);
462
481
  },
463
482
 
464
483
  // events
@@ -601,6 +620,20 @@ Romo.prototype._handlerKey = function(elem, eventName, fn) {
601
620
  return 'eid--'+this._el(elem)._romoeid+'--'+eventName+'--fid--'+this._fn(fn)._romofid;
602
621
  }
603
622
 
623
+ Romo.prototype._deserializeValue = function(value) {
624
+ try {
625
+ if (value === "true") { return true; } // "true" => true
626
+ if (value === "false") { return false; } // "false" => false
627
+ if (value === "undefined") { return undefined; } // "undefined" => undefined
628
+ if (value === "null") { return null; } // "null" => null
629
+ if (+value+"" === value) { return +value; } // "42.5" => 42.5
630
+ if (/^[\[\{]/.test(value)) { JSON.parse(value); } // JSON => parse if valid
631
+ return value; // String => self
632
+ } catch(e) {
633
+ return value
634
+ }
635
+ }
636
+
604
637
  // TODO: rework w/o jQuery
605
638
  Romo.prototype._addEventCallback = function(name, callback) {
606
639
  this._eventCallbacks.push({ eventName: name, callback: callback });
@@ -90,7 +90,7 @@ RomoSelectedOptionsList.prototype.doRefreshUI = function() {
90
90
  var maxRows = this.focusElem.data('romo-selected-options-list-max-rows') || 0;
91
91
  var maxHeight = listTopPad+(itemHeight*maxRows)+(itemMarginBottom*(maxRows-1))+(2*itemBorderWidth*maxRows)+listBottomPad+(itemHeight/2);
92
92
  }
93
- if (maxRows !== undefined && (uiListElemHeight > maxHeight)) {
93
+ if (maxRows !== 0 && (uiListElemHeight > maxHeight)) {
94
94
  this.elem.css({
95
95
  'height': String(maxHeight)+'px',
96
96
  'overflow-y': 'auto'
data/lib/romo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Romo
2
- VERSION = "0.19.8"
2
+ VERSION = "0.19.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: romo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.8
4
+ version: 0.19.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2017-09-26 00:00:00 Z
13
+ date: 2017-09-28 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert