authy-form-helpers-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dariusz Gertych
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # authy-form-helpers-rails
2
+
3
+ [authy-form-helpers](https://github.com/authy/authy-form-helpers) packaged for Rails assets pipeline.
4
+
5
+ ## Usage
6
+
7
+ Add the following to your gemfile:
8
+
9
+ ```ruby
10
+ gem "authy-form-helpers-rails"
11
+ ```
12
+
13
+ Add the following directive to your Javascript manifest file (application.js):
14
+
15
+ ```js
16
+ //= require authy-form-helpers
17
+ ```
18
+
19
+ Add the following directive to your Css manifest file (application.css):
20
+
21
+ ```css
22
+ /*= require authy-form-helpers*/
23
+ ```
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
@@ -0,0 +1,21 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc "Fetch new version from https://github.com/authy/authy-form-helpers"
4
+ task :fetch do
5
+ source = "https://raw.github.com/authy/authy-form-helpers/master/src/form.authy.coffee"
6
+ target = "vendor/assets/javascripts/form.authy.coffee"
7
+ sh "curl #{source} > #{target}"
8
+
9
+ ['flags.authy.css', 'form.authy.css'].each do |file|
10
+ source = "https://raw.github.com/authy/authy-form-helpers/master/src/#{file}"
11
+ target = "vendor/assets/stylesheets/#{file}"
12
+ sh "curl #{source} > #{target}"
13
+ end
14
+
15
+
16
+ ['close.gif', 'flags.png', 'icon.png'].each do |file|
17
+ source = "https://raw.github.com/authy/authy-form-helpers/master/src/images/#{file}"
18
+ target = "vendor/assets/images/#{file}"
19
+ sh "curl #{source} > #{target}"
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'authy-form-helpers-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "authy-form-helpers-rails"
8
+ spec.version = AuthyFormHelpers::Rails::VERSION
9
+ spec.authors = ["Dariusz Gertych"]
10
+ spec.email = ["chytreg@gmail.com"]
11
+ spec.description = %q{authy-form-helpers packaged for Rails assets pipeline}
12
+ spec.summary = %q{authy-form-helpers packaged for Rails assets pipeline}
13
+ spec.homepage = "http://github.com/rails-assets/authy-form-helpers-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,9 @@
1
+ require "authy-form-helpers-rails/version"
2
+
3
+ module AuthyFormHelpers
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ # Rails -> use vendor directory.
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module AuthyFormHelpers
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ //= require form.authy
@@ -0,0 +1,505 @@
1
+ window.Authy = {}
2
+
3
+ # Fix Internet Explorer by defining getElementsByClassName
4
+ unless document.getElementsByClassName?
5
+ document.getElementsByClassName = (className, parentElement) ->
6
+ children = (parentElement || document.body).getElementsByTagName("*")
7
+ elements = []
8
+ child = undefined
9
+ i = 0
10
+ length = children.length
11
+
12
+ while i < length
13
+ child = children[i]
14
+ elements.push child unless (" " + child.className + " ").indexOf(" " + className + " ") is -1
15
+ i++
16
+ return elements
17
+
18
+ HTMLDivElement::getElementsByClassName = (className) ->
19
+ return document.getElementsByClassName className, this
20
+
21
+ window.Authy.UI = ->
22
+
23
+ # Attributes
24
+ self = this
25
+ tooltipTitle = "Authy Help Tooltip"
26
+ tooltipMessage = "This is a help tooltip for your users. You can set the message by doing: authyUI.setTooltip(\"title\", \"message\");"
27
+
28
+ countriesList = [
29
+ {"country":"United States of America (+1)","code":"1"},{"country":"Canada (+1)","code":"1"},{"country":"Russia (+7)","code":"7"},
30
+ {"country":"Kazakhstan (+7)","code":"7"},{"country":"Egypt (+20)","code":"20"},{"country":"South Africa (+27)","code":"27"},
31
+ {"country":"Greece (+30)","code":"30"},{"country":"Netherlands (+31)","code":"31"},{"country":"Belgium (+32)","code":"32"},
32
+ {"country":"France (+33)","code":"33"},{"country":"Spain (+34)","code":"34"},{"country":"Hungary (+36)","code":"36"},
33
+ {"country":"Italy (+39)","code":"39"},{"country":"Romania (+40)","code":"40"},{"country":"Switzerland (+41)","code":"41"},
34
+ {"country":"Austria (+43)","code":"43"},{"country":"United Kingdom (+44)","code":"44"},{"country":"Guernsey (+44)","code":"44"},
35
+ {"country":"Isle of Man (+44)","code":"44"},{"country":"Jersey (+44)","code":"44"},{"country":"Denmark (+45)","code":"45"},
36
+ {"country":"Sweden (+46)","code":"46"},{"country":"Norway (+47)","code":"47"},{"country":"Poland (+48)","code":"48"},
37
+ {"country":"Germany (+49)","code":"49"},{"country":"Peru (+51)","code":"51"},{"country":"Mexico (+52)","code":"52"},
38
+ {"country":"Cuba (+53)","code":"53"},{"country":"Argentina (+54)","code":"54"},{"country":"Brazil (+55)","code":"55"},
39
+ {"country":"Chile (+56)","code":"56"},{"country":"Colombia (+57)","code":"57"},{"country":"Venezuela (+58)","code":"58"},
40
+ {"country":"Malaysia (+60)","code":"60"},{"country":"Australia (+61)","code":"61"},{"country":"Indonesia (+62)","code":"62"},
41
+ {"country":"Philippines (+63)","code":"63"},{"country":"New Zealand (+64)","code":"64"},{"country":"Singapore (+65)","code":"65"},
42
+ {"country":"Thailand (+66)","code":"66"},{"country":"Japan (+81)","code":"81"},{"country":"Korea (+South) (+82)","code":"82"},
43
+ {"country":"Vietnam (+84)","code":"84"},{"country":"China (+86)","code":"86"},{"country":"Turkey (+90)","code":"90"},
44
+ {"country":"India (+91)","code":"91"},{"country":"Pakistan (+92)","code":"92"},{"country":"Afghanistan (+93)","code":"93"},
45
+ {"country":"Sri Lanka (+94)","code":"94"},{"country":"Myanmar (+95)","code":"95"},{"country":"Iran (+98)","code":"98"},
46
+ {"country":"Morocco (+212)","code":"212"},{"country":"Algeria (+213)","code":"213"},{"country":"Tunisia (+216)","code":"216"},
47
+ {"country":"Libya (+218)","code":"218"},{"country":"Gambia (+220)","code":"220"},{"country":"Senegal (+221)","code":"221"},
48
+ {"country":"Mauritania (+222)","code":"222"},{"country":"Mali Republic (+223)","code":"223"},{"country":"Guinea (+224)","code":"224"},
49
+ {"country":"Ivory Coast (+225)","code":"225"},{"country":"Burkina Faso (+226)","code":"226"},{"country":"Niger (+227)","code":"227"},
50
+ {"country":"Togo (+228)","code":"228"},{"country":"Benin (+229)","code":"229"},{"country":"Mauritius (+230)","code":"230"},
51
+ {"country":"Liberia (+231)","code":"231"},{"country":"Sierra Leone (+232)","code":"232"},{"country":"Ghana (+233)","code":"233"},
52
+ {"country":"Nigeria (+234)","code":"234"},{"country":"Chad (+235)","code":"235"},{"country":"Central African Republic (+236)","code":"236"},
53
+ {"country":"Cameroon (+237)","code":"237"},{"country":"Cape Verde Islands (+238)","code":"238"},{"country":"Sao Tome and Principe (+239)","code":"239"},
54
+ {"country":"Gabon (+241)","code":"241"},{"country":"Congo, Democratic Republ (+243)","code":"243"},{"country":"Angola (+244)","code":"244"},
55
+ {"country":"Guinea-Bissau (+245)","code":"245"},{"country":"Seychelles (+248)","code":"248"},{"country":"Sudan (+249)","code":"249"},
56
+ {"country":"Rwanda (+250)","code":"250"},{"country":"Ethiopia (+251)","code":"251"},{"country":"Somalia (+252)","code":"252"},
57
+ {"country":"Djibouti (+253)","code":"253"},{"country":"Kenya (+254)","code":"254"},{"country":"Tanzania (+255)","code":"255"},
58
+ {"country":"Uganda (+256)","code":"256"},{"country":"Burundi (+257)","code":"257"},{"country":"Mozambique (+258)","code":"258"},
59
+ {"country":"Zambia (+260)","code":"260"},{"country":"Madagascar (+261)","code":"261"},{"country":"Reunion (+262)","code":"262"},
60
+ {"country":"Zimbabwe (+263)","code":"263"},{"country":"Namibia (+264)","code":"264"},{"country":"Malawi (+265)","code":"265"},
61
+ {"country":"Lesotho (+266)","code":"266"},{"country":"Botswana (+267)","code":"267"},{"country":"Swaziland (+268)","code":"268"},
62
+ {"country":"Mayotte Island (+269)","code":"269"},{"country":"Aruba (+297)","code":"297"},{"country":"Faroe Islands (+298)","code":"298"},
63
+ {"country":"Greenland (+299)","code":"299"},{"country":"Gibraltar (+350)","code":"350"},{"country":"Portugal (+351)","code":"351"},
64
+ {"country":"Luxembourg (+352)","code":"352"},{"country":"Ireland (+353)","code":"353"},{"country":"Iceland (+354)","code":"354"},
65
+ {"country":"Albania (+355)","code":"355"},{"country":"Malta (+356)","code":"356"},{"country":"Cyprus (+357)","code":"357"},
66
+ {"country":"Finland (+358)","code":"358"},{"country":"Bulgaria (+359)","code":"359"},{"country":"Lithuania (+370)","code":"370"},
67
+ {"country":"Latvia (+371)","code":"371"},{"country":"Estonia (+372)","code":"372"},{"country":"Moldova (+373)","code":"373"},
68
+ {"country":"Armenia (+374)","code":"374"},{"country":"Belarus (+375)","code":"375"},{"country":"Andorra (+376)","code":"376"},
69
+ {"country":"Monaco (+377)","code":"377"},{"country":"San Marino (+378)","code":"378"},{"country":"Ukraine (+380)","code":"380"},
70
+ {"country":"Serbia (+381)","code":"381"},{"country":"Montenegro (+382)","code":"382"},{"country":"Croatia (+385)","code":"385"},
71
+ {"country":"Slovenia (+386)","code":"386"},{"country":"Bosnia-Herzegovina (+387)","code":"387"},{"country":"Macedonia (+389)","code":"389"},
72
+ {"country":"Czech Republic (+420)","code":"420"},{"country":"Slovakia (+421)","code":"421"},{"country":"Liechtenstein (+423)","code":"423"},
73
+ {"country":"Falkland Islands (+500)","code":"500"},{"country":"Belize (+501)","code":"501"},{"country":"Guatemala (+502)","code":"502"},
74
+ {"country":"El Salvador (+503)","code":"503"},{"country":"Honduras (+504)","code":"504"},{"country":"Nicaragua (+505)","code":"505"},
75
+ {"country":"Costa Rica (+506)","code":"506"},{"country":"Panama (+507)","code":"507"},{"country":"Haiti (+509)","code":"509"},
76
+ {"country":"Guadeloupe (+590)","code":"590"},{"country":"Bolivia (+591)","code":"591"},{"country":"Guyana (+592)","code":"592"},
77
+ {"country":"Ecuador (+593)","code":"593"},{"country":"French Guiana (+594)","code":"594"},{"country":"Paraguay (+595)","code":"595"},
78
+ {"country":"Martinique (+596)","code":"596"},{"country":"Suriname (+597)","code":"597"},{"country":"Uruguay (+598)","code":"598"},
79
+ {"country":"Netherlands Antilles (+599)","code":"599"},{"country":"Timor-Leste (+670)","code":"670"},{"country":"Guam (+671)","code":"671"},
80
+ {"country":"Brunei (+673)","code":"673"},{"country":"Nauru (+674)","code":"674"},{"country":"Papua New Guinea (+675)","code":"675"},
81
+ {"country":"Tonga (+676)","code":"676"},{"country":"Solomon Islands (+677)","code":"677"},{"country":"Vanuatu (+678)","code":"678"},
82
+ {"country":"Fiji Islands (+679)","code":"679"},{"country":"Cook Islands (+682)","code":"682"},{"country":"Samoa (+685)","code":"685"},
83
+ {"country":"New Caledonia (+687)","code":"687"},{"country":"French Polynesia (+689)","code":"689"},{"country":"Korea (+North) (+850)","code":"850"},
84
+ {"country":"HongKong (+852)","code":"852"},{"country":"Macau (+853)","code":"853"},{"country":"Cambodia (+855)","code":"855"},
85
+ {"country":"Laos (+856)","code":"856"},{"country":"Bangladesh (+880)","code":"880"},{"country":"International (+882)","code":"882"},
86
+ {"country":"Taiwan (+886)","code":"886"},{"country":"Maldives (+960)","code":"960"},{"country":"Lebanon (+961)","code":"961"},
87
+ {"country":"Jordan (+962)","code":"962"},{"country":"Syria (+963)","code":"963"},{"country":"Iraq (+964)","code":"964"},
88
+ {"country":"Kuwait (+965)","code":"965"},{"country":"Saudi Arabia (+966)","code":"966"},{"country":"Yemen (+967)","code":"967"},
89
+ {"country":"Oman (+968)","code":"968"},{"country":"Palestine (+970)","code":"970"},{"country":"United Arab Emirates (+971)","code":"971"},
90
+ {"country":"Israel (+972)","code":"972"},{"country":"Bahrain (+973)","code":"973"},{"country":"Qatar (+974)","code":"974"},
91
+ {"country":"Bhutan (+975)","code":"975"},{"country":"Mongolia (+976)","code":"976"},{"country":"Nepal (+977)","code":"977"},
92
+ {"country":"Tajikistan (+992)","code":"992"},{"country":"Turkmenistan (+993)","code":"993"},{"country":"Azerbaijan (+994)","code":"994"},
93
+ {"country":"Georgia (+995)","code":"995"},{"country":"Kyrgyzstan (+996)","code":"996"},{"country":"Uzbekistan (+998)","code":"998"},
94
+ {"country":"Bahamas (+1242)","code":"1242"},{"country":"Barbados (+1246)","code":"1246"},{"country":"Anguilla (+1264)","code":"1264"},
95
+ {"country":"Antigua and Barbuda (+1268)","code":"1268"},{"country":"Virgin Islands, British (+1284)","code":"1284"},{"country":"Cayman Islands (+1345)","code":"1345"},
96
+ {"country":"Bermuda (+1441)","code":"1441"},{"country":"Grenada (+1473)","code":"1473"},{"country":"Turks and Caicos Islands (+1649)","code":"1649"},
97
+ {"country":"Montserrat (+1664)","code":"1664"},{"country":"Saint Lucia (+1758)","code":"1758"},{"country":"Dominica (+1767)","code":"1767"},
98
+ {"country":"St. Vincent and The Gren (+1784)","code":"1784"},{"country":"Puerto Rico (+1787)","code":"1787"},{"country":"Dominican Republic (+1809)","code":"1809"},
99
+ {"country":"Dominican Republic2 (+1829)","code":"1829"},{"country":"Dominican Republic3 (+1849)","code":"1849"},{"country":"Trinidad and Tobago (+1868)","code":"1868"},
100
+ {"country":"Saint Kitts and Nevis (+1869)","code":"1869"},{"country":"Jamaica (+1876)","code":"1876"},{"country":"Congo (+2420)","code":"2420"}
101
+ ]
102
+
103
+
104
+
105
+ # Private Members
106
+
107
+ #validates the cellphone is not null and partially correct
108
+ setupCellphoneValidation = ->
109
+ cellPhone = document.getElementById("authy-cellphone")
110
+ return unless cellPhone
111
+ cellPhone.onblur = ->
112
+ if cellPhone.value != "" and cellPhone.value.match(/^([0-9][0-9][0-9])\W*([0-9][0-9]{2})\W*([0-9]{0,5})$/)
113
+ cellPhone.style.backgroundColor = "white"
114
+ else
115
+ cellPhone.style.backgroundColor = "#F2DEDE"
116
+ return
117
+
118
+
119
+ #Validates Authy token is not null
120
+ setupAuthyTokenValidation = ->
121
+ token = document.getElementById("authy-token")
122
+ return unless token
123
+ token.onblur = ->
124
+ if token.value != "" and token.value.match(/^\d+$/)
125
+ token.style.backgroundColor = "white"
126
+ else
127
+ token.style.backgroundColor = "#F2DEDE"
128
+
129
+ return
130
+
131
+ #Sets the help toolTip
132
+ setupTooltip = ->
133
+ authy_help = document.getElementById("authy-help")
134
+ return unless authy_help
135
+ tooltip = document.createElement("div")
136
+ tooltip.setAttribute "id", "authy-tooltip"
137
+ tooltip.innerHTML = "<a id=\"authy-tooltip-close\"></a><h3 class=\"tooltip-title\">" + tooltipTitle + "</h3><p class=\"tooltip-content\">" + tooltipMessage + "</p>"
138
+ document.body.appendChild tooltip
139
+
140
+ document.getElementById("authy-help").onclick = ->
141
+ #reposition the tooltip
142
+ tooltip = document.getElementById("authy-tooltip")
143
+ setupTooltipPosition(this, tooltip)
144
+ tooltip.style.display = "block"
145
+
146
+ document.getElementById("authy-tooltip-close").onclick = ->
147
+ document.getElementById("authy-tooltip").style.display = "none"
148
+
149
+ setupTooltipPosition(authy_help, tooltip)
150
+
151
+ return
152
+
153
+ #
154
+ # Set the tooltip position
155
+ #
156
+ setupTooltipPosition = (helpLink, tooltip) ->
157
+ pos = absolutePosFor(helpLink)
158
+ tooltipTop = pos[0]
159
+ tooltipLeft = pos[1] + helpLink.offsetWidth + 5
160
+ tooltip.setAttribute "style", "top:" + tooltipTop + "px;left:" + tooltipLeft + "px;"
161
+
162
+
163
+ # Process the down-arrow key
164
+ processKey40 = (listId) ->
165
+ caId = "countries-autocomplete-" + listId
166
+ countriesDropdown = document.getElementById(caId)
167
+ countriesArr = countriesDropdown.getElementsByTagName("li")
168
+
169
+ i = 0
170
+ for li in countriesArr #search all the array which is active and set the next one as active
171
+ if li.className == "active" && countriesArr.length > (i + 1)
172
+ activeElement = countriesArr[i + 1]
173
+ li.className = ""
174
+ # countriesDropdown.scrollTo(0, selectedLi.offsetTop)
175
+ setActive(activeElement)
176
+ self.autocomplete(activeElement, false)
177
+ break
178
+ i++
179
+ return false
180
+
181
+
182
+ #process the up arrow key
183
+ processKey38 = (listId) ->
184
+ caId = "countries-autocomplete-" + listId
185
+ countriesArr = document.getElementById(caId).getElementsByTagName("li")
186
+ i = countriesArr.length - 1
187
+
188
+ while i >= 0
189
+ if document.getElementById(caId).getElementsByTagName("li")[i].className == "active"
190
+ document.getElementById(caId).getElementsByTagName("li")[i].className = ""
191
+ activeElement = null
192
+ if i == 0
193
+ activeElement = document.getElementById(caId).getElementsByTagName("li")[countriesArr.length - 1]
194
+ else
195
+ activeElement = document.getElementById(caId).getElementsByTagName("li")[i - 1]
196
+
197
+ setActive(activeElement)
198
+ self.autocomplete(activeElement, false)
199
+ return false
200
+ i--
201
+ document.getElementById(caId).getElementsByTagName("li")[0].setAttribute("class", "active")
202
+
203
+ return
204
+
205
+
206
+ #
207
+ # Process the enter key
208
+ #
209
+ processKey13 = (listId) ->
210
+ obj = document.getElementById("countries-autocomplete-" + listId).getElementsByClassName("active")[0]
211
+ self.autocomplete(obj, true)
212
+ return false
213
+
214
+ setActive = (liElement) ->
215
+ listId = liElement.getAttribute("data-list-id")
216
+ liElements = document.getElementById("countries-autocomplete-" + listId).getElementsByTagName("li")
217
+ for li in liElements
218
+ li.className = ""
219
+
220
+ liElement.className = "active"
221
+
222
+ #
223
+ # Setup to handle the keyboard input events
224
+ #
225
+ setupEvents = (countriesInput, listId) ->
226
+ return unless countriesInput
227
+
228
+ countriesInput.onblur = (event) ->
229
+ processKey13(listId)
230
+
231
+ countriesInput.onfocus = ->
232
+ countriesDropdown = document.getElementById("countries-autocomplete-" + listId)
233
+ setupCountriesDropdownPosition(countriesInput, countriesDropdown )
234
+ countriesDropdown.style.display = "block"
235
+ return
236
+
237
+ countriesInput.onkeyup = (event) ->
238
+ document.getElementById("countries-autocomplete-" + listId).style.display = "block"
239
+ keyID = getKeyCode(event)
240
+ switch keyID
241
+ when 13 # enter key
242
+ processKey13(listId)
243
+ return false
244
+ when 40 # down key
245
+ return false if processKey40(listId) == false
246
+ when 38 # up key
247
+ return false if processKey38(listId) == false
248
+ self.searchItem listId
249
+
250
+ countriesInput.onkeypress = (event) ->
251
+ if getKeyCode(event) == 13
252
+ processKey13(listId) # Enter key
253
+ return false
254
+
255
+ document.getElementById("countries-autocomplete-" + listId).onclick = (e) ->
256
+ if e && e.stopPropagation
257
+ hideAutocompleteList(listId)
258
+ e.stopPropagation()
259
+ else
260
+ e = window.event
261
+ e.cancelBubble = true
262
+
263
+ document.getElementById("countries-input-" + listId).onclick = (e) ->
264
+ if e && e.stopPropagation
265
+ e.stopPropagation()
266
+ countriesInput.focus()
267
+ countriesInput.select()
268
+ else
269
+ e = window.event
270
+ e.cancelBubble = true
271
+
272
+ document.onclick = ->
273
+ hideAutocompleteList(listId)
274
+ return
275
+
276
+ hideAutocompleteList = (listId) ->
277
+ document.getElementById("countries-autocomplete-" + listId).style.display = "none"
278
+
279
+ #
280
+ # Returns each country code <li> item
281
+ #
282
+ buildItem = (classActive, country, listId) ->
283
+ cc = country.country.substring(0, 2).toLowerCase() + country.code
284
+ li = document.createElement("li")
285
+ li.setAttribute("class", classActive)
286
+ li.setAttribute("data-list-id", listId)
287
+ li.setAttribute("rel", country.code)
288
+ li.setAttribute("data-name", country.country)
289
+
290
+ li.onmouseover = (event) ->
291
+ setActive(li)
292
+
293
+ flag = document.createElement("span")
294
+ flag.setAttribute("class", "aflag flag-#{cc}")
295
+ li.appendChild(flag)
296
+
297
+ name = document.createElement("span")
298
+ name.innerHTML = country.country
299
+ li.appendChild(name)
300
+
301
+ return li
302
+
303
+ #
304
+ # Given an element returns it absolute position
305
+ #
306
+ absolutePosFor = (element) ->
307
+ absTop = 0
308
+ absLeft = 0
309
+ while element
310
+ absTop += element.offsetTop
311
+ absLeft += element.offsetLeft
312
+ element = element.offsetParent
313
+ return [absTop, absLeft]
314
+
315
+
316
+ #
317
+ # Sets up the countriesDropDown
318
+ #
319
+ setupCountriesDropdown = (countriesSelect, listId) ->
320
+ return unless countriesSelect
321
+ countries = []
322
+ i = 0
323
+
324
+ while i < countriesSelect.getElementsByTagName("option").length
325
+ buf = []
326
+ buf[0] = countriesSelect.getElementsByTagName("option")[i].value
327
+ buf[1] = countriesSelect.getElementsByTagName("option")[i].innerHTML
328
+ countries.push buf
329
+ i++
330
+
331
+ countriesSelect.setAttribute "style", "display:none"
332
+ name = countriesSelect.getAttribute("name")
333
+ countriesSelect.removeAttribute "name"
334
+
335
+ countriesDropdown = document.createElement("div")
336
+ countryCodeValue = document.createElement("input")
337
+ countryCodeValue.setAttribute "type", "hidden"
338
+ countryCodeValue.setAttribute "id", "country-code-" + listId
339
+ countryCodeValue.setAttribute "name", name
340
+
341
+ classActive = ""
342
+ countriesAutocompleteList = document.createElement("ul")
343
+ i = 0
344
+
345
+ while i < countriesList.length
346
+ classActive = (if (i is 0) then "active" else "")
347
+ countriesAutocompleteList.appendChild(buildItem(classActive, countriesList[i], listId))
348
+ i++
349
+
350
+ countriesDropdown.innerHTML = ""
351
+ countriesDropdown.appendChild(countriesAutocompleteList)
352
+ document.body.appendChild countriesDropdown
353
+
354
+ countriesInput = document.createElement("input")
355
+ countriesInput.setAttribute "id", "countries-input-" + listId
356
+ countriesInput.setAttribute "class", "countries-input"
357
+ countriesInput.setAttribute "type", "text"
358
+ countriesInput.setAttribute "autocomplete", "off"
359
+
360
+ placeholder = countriesSelect.getAttribute("placeholder")
361
+ if placeholder?
362
+ countriesSelect.removeAttribute "placeholder"
363
+ countriesInput.setAttribute "placeholder", placeholder
364
+
365
+ countriesSelect.parentNode.insertBefore countriesInput, countriesSelect
366
+ countriesSelect.parentNode.appendChild countryCodeValue
367
+
368
+ countriesDropdown.setAttribute "id", "countries-autocomplete-" + listId
369
+ countriesDropdown.setAttribute "class", "countries-autocomplete"
370
+
371
+ setupCountriesDropdownPosition(countriesInput, countriesDropdown)
372
+
373
+ setupEvents countriesInput, listId
374
+ return
375
+
376
+ #
377
+ # Calculates the country dropdown position based on the countriesInput
378
+ #
379
+ setupCountriesDropdownPosition = (countriesInput, countriesDropdown) ->
380
+ pos = absolutePosFor(countriesInput)
381
+
382
+ width = countriesInput.offsetWidth
383
+ if width < 220
384
+ width = 220
385
+ countriesDropdown.setAttribute "style", "width: " + (width - 5) + "px; top: " + (pos[0] + 2 + countriesInput.offsetHeight) + "px; left: " + (pos[1] - 2) + "px;"
386
+
387
+
388
+
389
+
390
+ #
391
+ # If there are multiple countries dropdows, finds each one and sets a countries Dropdown
392
+ #
393
+ findAndSetupCountries = ->
394
+ setupCountriesDropdown document.getElementById("authy-countries"), 0
395
+ countries = document.getElementsByClassName("authy-countries")
396
+ i = 0
397
+
398
+ while i < countries.length
399
+ setupCountriesDropdown countries[i], i + 1
400
+ i++
401
+ return
402
+
403
+ #
404
+ # Display the country code that was selected before submitting the form
405
+ #
406
+ setCountryField = ->
407
+ defaultListId = 0
408
+ field = document.getElementById("authy-countries")
409
+ countryCode = field.value
410
+
411
+ if countryCode isnt ''
412
+ for country in countriesList
413
+ if country.code is countryCode
414
+ self.autocomplete(buildItem('active', country, defaultListId), true)
415
+ break
416
+
417
+ getKeyCode = (event) ->
418
+ if event && event.which #others
419
+ keyCode = event.which
420
+ else if window.event
421
+ keyCode = window.event.keyCode
422
+
423
+ return keyCode
424
+
425
+
426
+
427
+
428
+ ###########
429
+ # Public Members
430
+ ###########
431
+
432
+ @init = ->
433
+ setupAuthyTokenValidation()
434
+ setupTooltip()
435
+ findAndSetupCountries()
436
+ setCountryField()
437
+ setupCellphoneValidation()
438
+
439
+
440
+ @searchItem = (listId) ->
441
+ classActive = "active"
442
+ countriesInput = document.getElementById("countries-input-" + listId)
443
+ str = countriesInput.value
444
+ countriesAutocompleteList = document.createElement("ul")
445
+ firstCountryCodeFound = null
446
+ matches = false
447
+ str = str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") # Escape regular expression special characters
448
+ reg = new RegExp("^" + str, "i")
449
+ i = 0
450
+
451
+ while i < countriesList.length
452
+ countryItem = countriesList[i]
453
+ countryWords = countryItem.country.toLowerCase().split(/\s+/)
454
+
455
+ # Capture words starting with the entered pattern
456
+ cw = 0
457
+
458
+ while cw < countryWords.length
459
+ if (countryWords[cw].length > 2 && countryWords[cw].match(reg)) || "#{countryItem.code}".match(reg)
460
+ countriesAutocompleteList.appendChild(buildItem(classActive, countryItem, listId))
461
+ classActive = ""
462
+ matches = true
463
+ firstCountryCodeFound = countryItem.code unless firstCountryCodeFound?
464
+ break
465
+ cw++
466
+ i++
467
+
468
+ if matches
469
+ dropdownMenu = document.getElementById("countries-autocomplete-" + listId)
470
+ dropdownMenu.innerHTML = ""
471
+ dropdownMenu.appendChild(countriesAutocompleteList)
472
+ self.setCountryCode(listId, firstCountryCodeFound)
473
+
474
+ @autocomplete = (obj, hideList) ->
475
+ listId = obj.getAttribute("data-list-id")
476
+ document.getElementById("countries-input-" + listId).value = obj.getAttribute("data-name")
477
+ self.setCountryCode(listId, obj.getAttribute("rel"))
478
+ if hideList
479
+ hideAutocompleteList(listId)
480
+ return
481
+
482
+ @setCountryCode = (listId, countryCode) ->
483
+ document.getElementById("country-code-" + listId).value = countryCode
484
+
485
+ @setTooltip = (title, msg) ->
486
+ tooltip = document.getElementById("authy-tooltip")
487
+ return unless tooltip
488
+ tooltip.getElementsByClassName("tooltip-title")[0].innerHTML = title
489
+ tooltip.getElementsByClassName("tooltip-content")[0].innerHTML = msg
490
+ return
491
+
492
+ return #class return
493
+ Authy.UI.instance = ->
494
+ unless @ui
495
+ @ui = new Authy.UI()
496
+ @ui.init()
497
+ @ui
498
+
499
+ window.onload = ->
500
+ Authy.UI.instance()
501
+
502
+
503
+
504
+
505
+
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require form.authy
3
+ *= require flags.authy
4
+ */
@@ -0,0 +1,264 @@
1
+ [class^="flag-"],
2
+ [class*="flag-"] {
3
+ background: url('/assets/flags.png') no-repeat;
4
+ }
5
+
6
+ .aflag {
7
+ width: 16px;
8
+ height: 11px;
9
+ display: inline-block;
10
+ }
11
+
12
+ .flag-af93 {background-position: -48px 0}
13
+ .flag-al213 {background-position: -160px -33px}
14
+ .flag-al355 {background-position: -96px 0}
15
+ .flag-an1264 {background-position: -80px 0}
16
+ .flag-an1268 {background-position: -64px 0}
17
+ .flag-an244 {background-position: -144px 0}
18
+ .flag-an376 {background-position: -16px 0}
19
+ .flag-ar297 {background-position: -224px 0}
20
+ .flag-ar374 {background-position: -112px 0}
21
+ .flag-ar54 {background-position: -160px 0}
22
+ .flag-au43 {background-position: -192px 0}
23
+ .flag-au61 {background-position: -208px 0}
24
+ .flag-az994 {background-position: -240px 0}
25
+ .flag-ba1242 {background-position: -208px -11px}
26
+ .flag-ba1246 {background-position: -16px -11px}
27
+ .flag-ba880 {background-position: -32px -11px}
28
+ .flag-ba973 {background-position: -96px -11px}
29
+ .flag-be1441 {background-position: -144px -11px}
30
+ .flag-be229 {background-position: -128px -11px}
31
+ .flag-be32 {background-position: -48px -11px}
32
+ .flag-be375 {background-position: -16px -22px}
33
+ .flag-be501 {background-position: -32px -22px}
34
+ .flag-bh975 {background-position: -224px -11px}
35
+ .flag-bo267 {background-position: 0 -22px}
36
+ .flag-bo387 {background-position: 0 -11px}
37
+ .flag-bo591 {background-position: -176px -11px}
38
+ .flag-br55 {background-position: -192px -11px}
39
+ .flag-br673 {background-position: -160px -11px}
40
+ .flag-bu226 {background-position: -64px -11px}
41
+ .flag-bu257 {background-position: -112px -11px}
42
+ .flag-bu359 {background-position: -80px -11px}
43
+ .flag-bv {background-position: -240px -11px}
44
+ .flag-ca1 {background-position: -48px -22px}
45
+ .flag-ca1345 {background-position: -192px -77px}
46
+ .flag-ca237 {background-position: -192px -22px}
47
+ .flag-ca238 {background-position: -16px -33px}
48
+ .flag-ca855 {background-position: -64px -77px}
49
+ .flag-catalonia {background-position: -64px -22px}
50
+ .flag-ce236 {background-position: -96px -22px}
51
+ .flag-ch235 {background-position: -112px -143px}
52
+ .flag-ch56 {background-position: -176px -22px}
53
+ .flag-ch86 {background-position: -208px -22px}
54
+ .flag-co2420 {background-position: -80px -22px}
55
+ .flag-co243 {background-position: -112px -22px}
56
+ .flag-co506 {background-position: -240px -22px}
57
+ .flag-co57 {background-position: -224px -22px}
58
+ .flag-co682 {background-position: -160px -22px}
59
+ .flag-cr385 {background-position: 0 -66px}
60
+ .flag-cu53 {background-position: 0 -33px}
61
+ .flag-cw {background-position: -32px -33px}
62
+ .flag-cy357 {background-position: -48px -33px}
63
+ .flag-cz420 {background-position: -64px -33px}
64
+ .flag-de45 {background-position: -112px -33px}
65
+ .flag-dj253 {background-position: -96px -33px}
66
+ .flag-do1767 {background-position: -128px -33px}
67
+ .flag-do1809 {background-position: -144px -33px}
68
+ .flag-do1829 {background-position: -144px -33px}
69
+ .flag-do1849 {background-position: -144px -33px}
70
+ .flag-ec593 {background-position: -176px -33px}
71
+ .flag-eg20 {background-position: -208px -33px}
72
+ .flag-eh {background-position: -224px -33px}
73
+ .flag-el503 {background-position: -32px -143px}
74
+ .flag-england {background-position: -240px -33px}
75
+ .flag-er {background-position: 0 -44px}
76
+ .flag-es372 {background-position: -192px -33px}
77
+ .flag-et251 {background-position: -32px -44px}
78
+ .flag-eu {background-position: -48px -44px}
79
+ .flag-fa298 {background-position: -128px -44px}
80
+ .flag-fa500 {background-position: -96px -44px}
81
+ .flag-fi358 {background-position: -64px -44px}
82
+ .flag-fi679 {background-position: -80px -44px}
83
+ .flag-fm {background-position: -112px -44px}
84
+ .flag-fr33 {background-position: -144px -44px}
85
+ .flag-fr594 {background-position: -224px -44px}
86
+ .flag-fr689 {background-position: -224px -110px}
87
+ .flag-ga220 {background-position: -48px -55px}
88
+ .flag-ga241 {background-position: -160px -44px}
89
+ .flag-ge49 {background-position: -80px -33px}
90
+ .flag-ge995 {background-position: -208px -44px}
91
+ .flag-gh233 {background-position: 0 -55px}
92
+ .flag-gi350 {background-position: -16px -55px}
93
+ .flag-gq {background-position: -96px -55px}
94
+ .flag-gr1473 {background-position: -192px -44px}
95
+ .flag-gr299 {background-position: -32px -55px}
96
+ .flag-gr30 {background-position: -112px -55px}
97
+ .flag-gs {background-position: -128px -55px}
98
+ .flag-gu224 {background-position: -64px -55px}
99
+ .flag-gu245 {background-position: -176px -55px}
100
+ .flag-gu44 {background-position: -240px -44px}
101
+ .flag-gu502 {background-position: -144px -55px}
102
+ .flag-gu590 {background-position: -80px -55px}
103
+ .flag-gu592 {background-position: -192px -55px}
104
+ .flag-gu671 {background-position: -160px -55px}
105
+ .flag-ha509 {background-position: -16px -66px}
106
+ .flag-hm {background-position: -224px -55px}
107
+ .flag-ho504 {background-position: -240px -55px}
108
+ .flag-ho852 {background-position: -208px -55px}
109
+ .flag-hu36 {background-position: -32px -66px}
110
+ .flag-ic {background-position: -48px -66px}
111
+ .flag-ic354 {background-position: -192px -66px}
112
+ .flag-in62 {background-position: -64px -66px}
113
+ .flag-in91 {background-position: -128px -66px}
114
+ .flag-io {background-position: -144px -66px}
115
+ .flag-ir353 {background-position: -80px -66px}
116
+ .flag-ir964 {background-position: -160px -66px}
117
+ .flag-ir98 {background-position: -176px -66px}
118
+ .flag-is44 {background-position: -112px -66px}
119
+ .flag-is972 {background-position: -96px -66px}
120
+ .flag-it39 {background-position: -208px -66px}
121
+ .flag-iv225 {background-position: -144px -22px}
122
+ .flag-ja1876 {background-position: -240px -66px}
123
+ .flag-ja81 {background-position: -16px -77px}
124
+ .flag-je44 {background-position: -224px -66px}
125
+ .flag-jo962 {background-position: 0 -77px}
126
+ .flag-ka7 {background-position: -208px -77px}
127
+ .flag-ke254 {background-position: -32px -77px}
128
+ .flag-ki {background-position: -80px -77px}
129
+ .flag-km {background-position: -96px -77px}
130
+ .flag-ko82 {background-position: -144px -77px}
131
+ .flag-ko850 {background-position: -128px -77px}
132
+ .flag-ku965 {background-position: -176px -77px}
133
+ .flag-kurdistan {background-position: -160px -77px}
134
+ .flag-ky996 {background-position: -48px -77px}
135
+ .flag-la371 {background-position: -112px -88px}
136
+ .flag-la856 {background-position: -224px -77px}
137
+ .flag-le266 {background-position: -64px -88px}
138
+ .flag-le961 {background-position: -240px -77px}
139
+ .flag-li218 {background-position: -128px -88px}
140
+ .flag-li231 {background-position: -48px -88px}
141
+ .flag-li370 {background-position: -80px -88px}
142
+ .flag-li423 {background-position: -16px -88px}
143
+ .flag-lu352 {background-position: -96px -88px}
144
+ .flag-ma222 {background-position: -96px -99px}
145
+ .flag-ma223 {background-position: 0 -99px}
146
+ .flag-ma230 {background-position: -144px -99px}
147
+ .flag-ma261 {background-position: -208px -88px}
148
+ .flag-ma265 {background-position: -176px -99px}
149
+ .flag-ma269 {background-position: -112px -165px}
150
+ .flag-ma356 {background-position: -128px -99px}
151
+ .flag-ma389 {background-position: -240px -88px}
152
+ .flag-ma596 {background-position: -80px -99px}
153
+ .flag-ma60 {background-position: -208px -99px}
154
+ .flag-ma853 {background-position: -48px -99px}
155
+ .flag-ma960 {background-position: -160px -99px}
156
+ .flag-me52 {background-position: -192px -99px}
157
+ .flag-mh {background-position: -224px -88px}
158
+ .flag-mo1664 {background-position: -112px -99px}
159
+ .flag-mo212 {background-position: -144px -88px}
160
+ .flag-mo258 {background-position: -224px -99px}
161
+ .flag-mo373 {background-position: -176px -88px}
162
+ .flag-mo377 {background-position: -160px -88px}
163
+ .flag-mo382 {background-position: -192px -88px}
164
+ .flag-mo976 {background-position: -32px -99px}
165
+ .flag-mp {background-position: -64px -99px}
166
+ .flag-my95 {background-position: -16px -99px}
167
+ .flag-na264 {background-position: -240px -99px}
168
+ .flag-na674 {background-position: -128px -110px}
169
+ .flag-ne31 {background-position: -80px -110px}
170
+ .flag-ne599 {background-position: -128px 0}
171
+ .flag-ne64 {background-position: -160px -110px}
172
+ .flag-ne687 {background-position: 0 -110px}
173
+ .flag-ne977 {background-position: -112px -110px}
174
+ .flag-nf {background-position: -32px -110px}
175
+ .flag-ni227 {background-position: -16px -110px}
176
+ .flag-ni234 {background-position: -48px -110px}
177
+ .flag-ni505 {background-position: -64px -110px}
178
+ .flag-no47 {background-position: -96px -110px}
179
+ .flag-nu {background-position: -144px -110px}
180
+ .flag-om968 {background-position: -176px -110px}
181
+ .flag-pa507 {background-position: -192px -110px}
182
+ .flag-pa595 {background-position: -144px -121px}
183
+ .flag-pa675 {background-position: -240px -110px}
184
+ .flag-pa92 {background-position: -16px -121px}
185
+ .flag-pa970 {background-position: -96px -121px}
186
+ .flag-pe51 {background-position: -208px -110px}
187
+ .flag-ph63 {background-position: 0 -121px}
188
+ .flag-pm {background-position: -48px -121px}
189
+ .flag-pn {background-position: -64px -121px}
190
+ .flag-po351 {background-position: -112px -121px}
191
+ .flag-po48 {background-position: -32px -121px}
192
+ .flag-pu1787 {background-position: -80px -121px}
193
+ .flag-pw {background-position: -128px -121px}
194
+ .flag-qa974 {background-position: -160px -121px}
195
+ .flag-re262 {background-position: -176px -121px}
196
+ .flag-ro40 {background-position: -192px -121px}
197
+ .flag-ru7 {background-position: -224px -121px}
198
+ .flag-rw250 {background-position: -240px -121px}
199
+ .flag-sa1758 {background-position: 0 -88px}
200
+ .flag-sa1869 {background-position: -112px -77px}
201
+ .flag-sa239 {background-position: -16px -143px}
202
+ .flag-sa378 {background-position: -176px -132px}
203
+ .flag-sa685 {background-position: -176px 0}
204
+ .flag-sa685 {background-position: -80px -165px}
205
+ .flag-sa966 {background-position: 0 -132px}
206
+ .flag-scotland {background-position: -48px -132px}
207
+ .flag-se221 {background-position: -192px -132px}
208
+ .flag-se248 {background-position: -32px -132px}
209
+ .flag-se381 {background-position: -208px -121px}
210
+ .flag-sh {background-position: -112px -132px}
211
+ .flag-si232 {background-position: -160px -132px}
212
+ .flag-si65 {background-position: -96px -132px}
213
+ .flag-sl386 {background-position: -128px -132px}
214
+ .flag-sl421 {background-position: -144px -132px}
215
+ .flag-so252 {background-position: -208px -132px}
216
+ .flag-so27 {background-position: -128px -165px}
217
+ .flag-so677 {background-position: -16px -132px}
218
+ .flag-somaliland {background-position: -224px -132px}
219
+ .flag-sp34 {background-position: -16px -44px}
220
+ .flag-sr94 {background-position: -32px -88px}
221
+ .flag-ss {background-position: 0 -143px}
222
+ .flag-st1784 {background-position: -208px -154px}
223
+ .flag-su249 {background-position: -64px -132px}
224
+ .flag-su597 {background-position: -240px -132px}
225
+ .flag-sw268 {background-position: -80px -143px}
226
+ .flag-sw41 {background-position: -128px -22px}
227
+ .flag-sw46 {background-position: -80px -132px}
228
+ .flag-sx {background-position: -48px -143px}
229
+ .flag-sy963 {background-position: -64px -143px}
230
+ .flag-ta255 {background-position: -80px -154px}
231
+ .flag-ta886 {background-position: -64px -154px}
232
+ .flag-ta992 {background-position: -176px -143px}
233
+ .flag-tf {background-position: -128px -143px}
234
+ .flag-th66 {background-position: -160px -143px}
235
+ .flag-ti670 {background-position: -208px -143px}
236
+ .flag-tk {background-position: -192px -143px}
237
+ .flag-to228 {background-position: -144px -143px}
238
+ .flag-to676 {background-position: 0 -154px}
239
+ .flag-tr1868 {background-position: -32px -154px}
240
+ .flag-tu1649 {background-position: -96px -143px}
241
+ .flag-tu216 {background-position: -240px -143px}
242
+ .flag-tu90 {background-position: -16px -154px}
243
+ .flag-tu993 {background-position: -224px -143px}
244
+ .flag-tv {background-position: -48px -154px}
245
+ .flag-ug256 {background-position: -112px -154px}
246
+ .flag-uk380 {background-position: -96px -154px}
247
+ .flag-um {background-position: -128px -154px}
248
+ .flag-un1 {background-position: -144px -154px}
249
+ .flag-un44 {background-position: -176px -44px}
250
+ .flag-un971 {background-position: -32px 0}
251
+ .flag-ur598 {background-position: -160px -154px}
252
+ .flag-uz998 {background-position: -176px -154px}
253
+ .flag-va {background-position: -192px -154px}
254
+ .flag-va678 {background-position: -32px -165px}
255
+ .flag-ve58 {background-position: -224px -154px}
256
+ .flag-vi {background-position: 0 -165px}
257
+ .flag-vi1284 {background-position: -240px -154px}
258
+ .flag-vi84 {background-position: -16px -165px}
259
+ .flag-wales {background-position: -48px -165px}
260
+ .flag-wf {background-position: -64px -165px}
261
+ .flag-ye967 {background-position: -96px -165px}
262
+ .flag-za260 {background-position: -160px -165px}
263
+ .flag-zanzibar {background-position: -144px -165px}
264
+ .flag-zi263 {background-position: -176px -165px}
@@ -0,0 +1,78 @@
1
+
2
+ .countries-autocomplete {
3
+ background-color: #fff;
4
+ border: 1px solid #ccc;
5
+ }
6
+
7
+ .countries-autocomplete ul {
8
+ margin: 0px;
9
+ padding: 0px;
10
+ }
11
+
12
+ .countries-autocomplete li {
13
+ list-style-type:none;
14
+ padding: 5px 3px;
15
+ font-size: 12px;
16
+ font-family: arial;
17
+ }
18
+
19
+ .countries-autocomplete li span {
20
+ margin: 0 2px;
21
+ }
22
+
23
+ .countries-autocomplete li:hover,
24
+ .countries-autocomplete li.active {
25
+ cursor: pointer;
26
+ background-color: #eee;
27
+ }
28
+
29
+ #authy-tooltip-close {
30
+ position: absolute;
31
+ top: 5px;
32
+ left: 7px;
33
+ cursor: pointer;
34
+ width: 11px;
35
+ height: 11px;
36
+ background: url('/assets/close.gif') no-repeat 0 0;
37
+ }
38
+
39
+ #authy-token {
40
+ padding: 3px 0 3px 25px;
41
+ background: url('/assets/icon.png') no-repeat 2px center;
42
+ background-size: 18px 18px;
43
+
44
+ }
45
+
46
+ #authy-tooltip {
47
+ position: absolute;
48
+ z-index: 999999;
49
+ border: 1px solid #ccc;
50
+ -moz-border-radius: 6px;
51
+ -webkit-border-radius: 6px;
52
+ border-radius: 6px;
53
+ padding: 15px 10px 10px 10px;
54
+ background-color: #fff;
55
+ display: none;
56
+ width: 330px;
57
+ }
58
+
59
+ #authy-tooltip p {
60
+ color: #444;
61
+ }
62
+
63
+ .countries-autocomplete {
64
+ position: absolute;
65
+ width: 200px;
66
+ display: none;
67
+ max-height: 200px;
68
+ overflow: auto;
69
+ z-index: 99999999;
70
+ }
71
+
72
+ #authy-help {
73
+ color: #35C2F1;
74
+ }
75
+
76
+ #authy-help:hover {
77
+ text-decoration: none;
78
+ }
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authy-form-helpers-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dariusz Gertych
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: authy-form-helpers packaged for Rails assets pipeline
47
+ email:
48
+ - chytreg@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - authy-form-helpers-rails.gemspec
59
+ - lib/authy-form-helpers-rails.rb
60
+ - lib/authy-form-helpers-rails/version.rb
61
+ - vendor/assets/images/close.gif
62
+ - vendor/assets/images/flags.png
63
+ - vendor/assets/images/icon.png
64
+ - vendor/assets/javascripts/authy-form-helpers.js
65
+ - vendor/assets/javascripts/form.authy.coffee
66
+ - vendor/assets/stylesheets/authy-form-helpers.css
67
+ - vendor/assets/stylesheets/flags.authy.css
68
+ - vendor/assets/stylesheets/form.authy.css
69
+ homepage: http://github.com/rails-assets/authy-form-helpers-rails
70
+ licenses:
71
+ - MIT
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 1.8.23
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: authy-form-helpers packaged for Rails assets pipeline
94
+ test_files: []
95
+ has_rdoc: