material_raingular 0.0.2.4.6.alpha → 0.0.2.4.7.alpha

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
2
  SHA1:
3
- metadata.gz: aff815f9f96a33c806020497c5774e53cad733c0
4
- data.tar.gz: 17b0d03ae905a729d444d14d28f676b2df144509
3
+ metadata.gz: df4d672f568ee580bebdb816f8b00f01067937bd
4
+ data.tar.gz: 36299cbc73efd8e05f34f2017ad495dadb1b1637
5
5
  SHA512:
6
- metadata.gz: 5c46dea975dd77718cfc052d9d6e683a10ec12a43a92ef8fbf641475dc84e7ae2ec010499396a2d114e60a83444a133fdcb6f1b3fb3920d0f5261d8b8c719704
7
- data.tar.gz: 66ee2254112a02c90dd6ce1f886bd0564b8f19c06ea50a34cd213807d65cb3714a1ed7a1882c5fe79ea53d24ba3603574066b4920772194ff76816d5e1a8984c
6
+ metadata.gz: f34a2aac81912db2aeeec3287e2c79e3c142efc1aa3eeb9bf06f3a6937b99406a2a7e761f0527bfd014f0fbfdd275120b5248cae18eb2b88b0ecca545147226a
7
+ data.tar.gz: ee235aec1e42082784d83e62da149966ecc3aca2ec4763bee4ae196f0cf0a38dc18664ddb4057665b60db2d98c953dc0d76d33d8d0efbe3c238b279b0bb30c18
@@ -102,34 +102,33 @@ angular.module('AutoComplete', [ 'FactoryName'])
102
102
  link: (scope, element, attributes, ngModel) ->
103
103
  if element[0].tagName == 'INPUT'
104
104
  element.bind 'focus', ->
105
- pos = element.position()
105
+ pos = element.position() if element.position
106
106
  element.next()[0].style.left = '0px'
107
107
  element.bind 'blur', ->
108
- element.parent().find('.active').removeClass('active')
108
+ active = angular.element(element.next()[0].getElementsByClassName('active')[0])
109
+ active.removeClass('active')
109
110
  ngModel.$setViewValue(element.val())
110
111
  ngModel.$render()
111
112
  element.bind 'keydown', (input)->
112
- if input.keyCode == 40
113
- selected = element.next().find('a.active')
113
+ keypress = (direction) ->
114
+ index = if direction == 'next' then 0 else element.next().find('a').length - 1
115
+ selected = angular.element(element.next()[0].getElementsByClassName('active')[0])
114
116
  if selected.hasClass('active')
115
117
  selected.removeClass('active')
116
- selected = selected.next('a')
117
- else
118
- selected = element.next().find('a').first()
119
- if !selected.html() then selected = element.next().find('a').first()
120
- scroll = selected[0].scrollHeight * element.next().find('a').index(selected)
118
+ until complete
119
+ selected = angular.element(selected[0][direction + 'Sibling']) if selected[0]
120
+ complete = !!selected[0]
121
+ complete = selected[0].tagName == 'A' if complete
122
+ complete = true if !selected[0]
123
+ selected = angular.element(element.next().find('a')[index]) unless selected[0]
124
+ ind = 0
125
+ for el,i in element.next()[0].getElementsByTagName('a')
126
+ ind = i if el == selected[0]
127
+ scroll = selected[0].scrollHeight * ind
121
128
  selected[0].parentElement.scrollTop = scroll
122
129
  selected.addClass('active')
123
130
  element.val(selected.text())
131
+ if input.keyCode == 40
132
+ keypress('next')
124
133
  if input.keyCode == 38
125
- selected = element.next().find('a.active')
126
- if selected.hasClass('active')
127
- selected.removeClass('active')
128
- selected = selected.prev('a')
129
- else
130
- selected = element.next().find('a').last()
131
- if !selected.html() then selected = element.next().find('a').last()
132
- scroll = selected[0].scrollHeight * element.next().find('a').index(selected)
133
- selected[0].parentElement.scrollTop = scroll
134
- selected.addClass('active')
135
- element.val(selected.text())
134
+ keypress('previous')
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.0.2.4.6.alpha"
2
+ VERSION = "0.0.2.4.7.alpha"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.4.6.alpha
4
+ version: 0.0.2.4.7.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler