furatto 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +1 -0
  6. data/furatto.gemspec +21 -0
  7. data/lib/furatto.rb +16 -0
  8. data/lib/furatto/engine.rb +6 -0
  9. data/lib/furatto/version.rb +3 -0
  10. data/vendor/assets/fonts/fontawesome/FontAwesome.otf +0 -0
  11. data/vendor/assets/fonts/fontawesome/fontawesome-webfont.eot +0 -0
  12. data/vendor/assets/fonts/fontawesome/fontawesome-webfont.svg +399 -0
  13. data/vendor/assets/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
  14. data/vendor/assets/fonts/fontawesome/fontawesome-webfont.woff +0 -0
  15. data/vendor/assets/fonts/meteocons-webfont.eot +0 -0
  16. data/vendor/assets/fonts/meteocons-webfont.svg +81 -0
  17. data/vendor/assets/fonts/meteocons-webfont.ttf +0 -0
  18. data/vendor/assets/fonts/meteocons-webfont.woff +0 -0
  19. data/vendor/assets/images/icheck/aero.png +0 -0
  20. data/vendor/assets/images/icheck/aero@2x.png +0 -0
  21. data/vendor/assets/images/icheck/blue.png +0 -0
  22. data/vendor/assets/images/icheck/blue@2x.png +0 -0
  23. data/vendor/assets/images/icheck/flat.png +0 -0
  24. data/vendor/assets/images/icheck/flat@2x.png +0 -0
  25. data/vendor/assets/images/icheck/green.png +0 -0
  26. data/vendor/assets/images/icheck/green@2x.png +0 -0
  27. data/vendor/assets/images/icheck/grey.png +0 -0
  28. data/vendor/assets/images/icheck/grey@2x.png +0 -0
  29. data/vendor/assets/images/icheck/orange.png +0 -0
  30. data/vendor/assets/images/icheck/orange@2x.png +0 -0
  31. data/vendor/assets/images/icheck/pink.png +0 -0
  32. data/vendor/assets/images/icheck/pink@2x.png +0 -0
  33. data/vendor/assets/images/icheck/purple.png +0 -0
  34. data/vendor/assets/images/icheck/purple@2x.png +0 -0
  35. data/vendor/assets/images/icheck/red.png +0 -0
  36. data/vendor/assets/images/icheck/red@2x.png +0 -0
  37. data/vendor/assets/images/icheck/yellow.png +0 -0
  38. data/vendor/assets/images/icheck/yellow@2x.png +0 -0
  39. data/vendor/assets/images/icons/customize-icon150.png +0 -0
  40. data/vendor/assets/images/icons/flexible-icon.png +0 -0
  41. data/vendor/assets/images/icons/github-128-black.png +0 -0
  42. data/vendor/assets/images/icons/iphone-icon150.png +0 -0
  43. data/vendor/assets/images/icons/lock-icon128.png +0 -0
  44. data/vendor/assets/images/icons/rocket-icon128.png +0 -0
  45. data/vendor/assets/images/icons/rocket-icon150.png +0 -0
  46. data/vendor/assets/images/icons/screen-icon.png +0 -0
  47. data/vendor/assets/images/icons/screens-icon.png +0 -0
  48. data/vendor/assets/images/icons/screens2-icon.png +0 -0
  49. data/vendor/assets/images/next.png +0 -0
  50. data/vendor/assets/images/previous.png +0 -0
  51. data/vendor/assets/images/themes.gif +0 -0
  52. data/vendor/assets/images/toggle.png +0 -0
  53. data/vendor/assets/javascripts/dropdown.js +169 -0
  54. data/vendor/assets/javascripts/furatto.js +15 -0
  55. data/vendor/assets/javascripts/jpanel.js +547 -0
  56. data/vendor/assets/javascripts/jquery.avgrund.js +127 -0
  57. data/vendor/assets/javascripts/jquery.dropkick-1.0.0.js +400 -0
  58. data/vendor/assets/javascripts/jquery.icheck.js +462 -0
  59. data/vendor/assets/javascripts/jquery.tagsinput.js +354 -0
  60. data/vendor/assets/javascripts/jquery.toolbar.js +242 -0
  61. data/vendor/assets/javascripts/legacy.js +140 -0
  62. data/vendor/assets/javascripts/picker.date.js +957 -0
  63. data/vendor/assets/javascripts/picker.js +785 -0
  64. data/vendor/assets/javascripts/picker.time.js +651 -0
  65. data/vendor/assets/javascripts/rainbow-custom.min.js +13 -0
  66. data/vendor/assets/javascripts/responsive-tables.js +67 -0
  67. data/vendor/assets/javascripts/responsiveslides.js +391 -0
  68. data/vendor/assets/javascripts/tooltip.js +353 -0
  69. data/vendor/assets/stylesheets/furatto.scss +101 -0
  70. data/vendor/assets/stylesheets/furatto/_alerts.scss +81 -0
  71. data/vendor/assets/stylesheets/furatto/_base.scss +187 -0
  72. data/vendor/assets/stylesheets/furatto/_buttons.scss +100 -0
  73. data/vendor/assets/stylesheets/furatto/_code.scss +66 -0
  74. data/vendor/assets/stylesheets/furatto/_date_picker.date.scss +266 -0
  75. data/vendor/assets/stylesheets/furatto/_date_picker.scss +158 -0
  76. data/vendor/assets/stylesheets/furatto/_date_picker.time.scss +122 -0
  77. data/vendor/assets/stylesheets/furatto/_dropdown.scss +261 -0
  78. data/vendor/assets/stylesheets/furatto/_font-awesome-ie7.scss +1953 -0
  79. data/vendor/assets/stylesheets/furatto/_fonts.scss +614 -0
  80. data/vendor/assets/stylesheets/furatto/_footer.scss +44 -0
  81. data/vendor/assets/stylesheets/furatto/_forms.scss +290 -0
  82. data/vendor/assets/stylesheets/furatto/_grid.scss +56 -0
  83. data/vendor/assets/stylesheets/furatto/_images.scss +44 -0
  84. data/vendor/assets/stylesheets/furatto/_labels.scss +43 -0
  85. data/vendor/assets/stylesheets/furatto/_layout.scss +0 -0
  86. data/vendor/assets/stylesheets/furatto/_left_navbar.scss +100 -0
  87. data/vendor/assets/stylesheets/furatto/_mixins.scss +283 -0
  88. data/vendor/assets/stylesheets/furatto/_modal.scss +103 -0
  89. data/vendor/assets/stylesheets/furatto/_nav.scss +106 -0
  90. data/vendor/assets/stylesheets/furatto/_navbar.scss +187 -0
  91. data/vendor/assets/stylesheets/furatto/_pagination.scss +158 -0
  92. data/vendor/assets/stylesheets/furatto/_responsive-1200px-min.scss +21 -0
  93. data/vendor/assets/stylesheets/furatto/_responsive-767px-max.scss +82 -0
  94. data/vendor/assets/stylesheets/furatto/_responsive-768px-979px.scss +23 -0
  95. data/vendor/assets/stylesheets/furatto/_responsive_navbar.scss +184 -0
  96. data/vendor/assets/stylesheets/furatto/_responsive_tables.scss +28 -0
  97. data/vendor/assets/stylesheets/furatto/_responsiveslides.scss +202 -0
  98. data/vendor/assets/stylesheets/furatto/_select.scss +191 -0
  99. data/vendor/assets/stylesheets/furatto/_tables.scss +90 -0
  100. data/vendor/assets/stylesheets/furatto/_tags.scss +107 -0
  101. data/vendor/assets/stylesheets/furatto/_toolbars.scss +116 -0
  102. data/vendor/assets/stylesheets/furatto/_tooltips.scss +143 -0
  103. data/vendor/assets/stylesheets/furatto/_typography.scss +266 -0
  104. data/vendor/assets/stylesheets/furatto/_variables.scss +628 -0
  105. data/vendor/assets/stylesheets/furatto/_vrt_navbar.scss +61 -0
  106. data/vendor/assets/stylesheets/furatto/icheck/_aero.scss +64 -0
  107. data/vendor/assets/stylesheets/furatto/icheck/_all.scss +20 -0
  108. data/vendor/assets/stylesheets/furatto/icheck/_blue.scss +64 -0
  109. data/vendor/assets/stylesheets/furatto/icheck/_flat.scss +64 -0
  110. data/vendor/assets/stylesheets/furatto/icheck/_green.scss +64 -0
  111. data/vendor/assets/stylesheets/furatto/icheck/_grey.scss +64 -0
  112. data/vendor/assets/stylesheets/furatto/icheck/_orange.scss +64 -0
  113. data/vendor/assets/stylesheets/furatto/icheck/_pink.scss +64 -0
  114. data/vendor/assets/stylesheets/furatto/icheck/_purple.scss +64 -0
  115. data/vendor/assets/stylesheets/furatto/icheck/_red.scss +64 -0
  116. data/vendor/assets/stylesheets/furatto/icheck/_yellow.scss +64 -0
  117. data/vendor/assets/stylesheets/normalize.scss +403 -0
  118. metadata +162 -0
@@ -0,0 +1,651 @@
1
+
2
+ /*!
3
+ * Time picker for pickadate.js v3.1.1
4
+ * http://amsul.github.io/pickadate.js/time.htm
5
+ */
6
+
7
+ /*jshint
8
+ debug: true,
9
+ devel: true,
10
+ browser: true,
11
+ asi: true,
12
+ unused: true,
13
+ boss: true
14
+ */
15
+
16
+
17
+ // Create a new scope.
18
+ (function() {
19
+
20
+
21
+ /**
22
+ * Globals and constants
23
+ */
24
+ var HOURS_IN_DAY = 24,
25
+ MINUTES_IN_HOUR = 60,
26
+ HOURS_TO_NOON = 12,
27
+ MINUTES_IN_DAY = HOURS_IN_DAY * MINUTES_IN_HOUR
28
+
29
+
30
+
31
+ /**
32
+ * The time picker constructor
33
+ */
34
+ function TimePicker( picker, settings ) {
35
+
36
+ var clock = this,
37
+ elementDataValue = picker.$node.data( 'value' )
38
+
39
+ clock.settings = settings
40
+
41
+ // The queue of methods that will be used to build item objects.
42
+ clock.queue = {
43
+ interval: 'i',
44
+ min: 'measure create',
45
+ max: 'measure create',
46
+ now: 'now create',
47
+ select: 'parse create validate',
48
+ highlight: 'create validate',
49
+ view: 'create validate',
50
+ disable: 'flipItem',
51
+ enable: 'flipItem'
52
+ }
53
+
54
+ // The component's item object.
55
+ clock.item = {}
56
+
57
+ clock.item.interval = settings.interval || 30
58
+ clock.item.disable = ( settings.disable || [] ).slice( 0 )
59
+ clock.item.enable = -(function( collectionDisabled ) {
60
+ return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
61
+ })( clock.item.disable )
62
+
63
+ clock.
64
+ set( 'min', settings.min ).
65
+ set( 'max', settings.max ).
66
+ set( 'now' ).
67
+
68
+ // Setting the `select` also sets the `highlight` and `view`.
69
+ set( 'select',
70
+
71
+ // If there's a `value` or `data-value`, use that with formatting.
72
+ // Otherwise default to the minimum selectable time.
73
+ elementDataValue || picker.$node[ 0 ].value || clock.item.min,
74
+
75
+ // Use the relevant format.
76
+ { format: elementDataValue ? settings.formatSubmit : settings.format }
77
+ )
78
+
79
+ // The keycode to movement mapping.
80
+ clock.key = {
81
+ 40: 1, // Down
82
+ 38: -1, // Up
83
+ 39: 1, // Right
84
+ 37: -1, // Left
85
+ go: function( timeChange ) {
86
+ clock.set( 'highlight', clock.item.highlight.pick + timeChange * clock.item.interval, { interval: timeChange * clock.item.interval } )
87
+ this.render()
88
+ }
89
+ }
90
+
91
+
92
+ // Bind some picker events.
93
+ picker.
94
+ on( 'render', function() {
95
+ var $pickerHolder = picker.$root.children(),
96
+ $viewset = $pickerHolder.find( '.' + settings.klass.viewset )
97
+ if ( $viewset.length ) {
98
+ $pickerHolder[ 0 ].scrollTop = ~~( $viewset.position().top - ( $viewset[ 0 ].clientHeight * 2 ) )
99
+ }
100
+ else {
101
+ console.warn( 'Nothing to viewset with', clock.item.view )
102
+ }
103
+ }).
104
+ on( 'open', function() {
105
+ picker.$root.find( 'button' ).attr( 'disable', false )
106
+ }).
107
+ on( 'close', function() {
108
+ picker.$root.find( 'button' ).attr( 'disable', true )
109
+ })
110
+
111
+ } //TimePicker
112
+
113
+
114
+ /**
115
+ * Set a timepicker item object.
116
+ */
117
+ TimePicker.prototype.set = function( type, value, options ) {
118
+
119
+ var clock = this
120
+
121
+ // Go through the queue of methods, and invoke the function. Update this
122
+ // as the time unit, and set the final resultant as this item type.
123
+ // * In the case of `enable`, keep the queue but set `disable` instead.
124
+ // And in the case of `flip`, keep the queue but set `enable` instead.
125
+ clock.item[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = clock.queue[ type ].split( ' ' ).map( function( method ) {
126
+ return value = clock[ method ]( type, value, options )
127
+ }).pop()
128
+
129
+ // Check if we need to cascade through more updates.
130
+ if ( type == 'select' ) {
131
+ clock.set( 'highlight', clock.item.select, options )
132
+ }
133
+ else if ( type == 'highlight' ) {
134
+ clock.set( 'view', clock.item.highlight, options )
135
+ }
136
+ else if ( type == 'interval' ) {
137
+ clock.
138
+ set( 'min', clock.item.min, options ).
139
+ set( 'max', clock.item.max, options )
140
+ }
141
+ else if ( ( type == 'flip' || type == 'min' || type == 'max' || type == 'disable' || type == 'enable' ) && clock.item.select && clock.item.highlight ) {
142
+ if ( type == 'min' ) {
143
+ clock.set( 'max', clock.item.max, options )
144
+ }
145
+ clock.
146
+ set( 'select', clock.item.select, options ).
147
+ set( 'highlight', clock.item.highlight, options )
148
+ }
149
+
150
+ return clock
151
+ } //TimePicker.prototype.set
152
+
153
+
154
+ /**
155
+ * Get a timepicker item object.
156
+ */
157
+ TimePicker.prototype.get = function( type ) {
158
+ return this.item[ type ]
159
+ } //TimePicker.prototype.get
160
+
161
+
162
+ /**
163
+ * Create a picker time object.
164
+ */
165
+ TimePicker.prototype.create = function( type, value, options ) {
166
+
167
+ var clock = this
168
+
169
+ // If there's no value, use the type as the value.
170
+ value = value === undefined ? type : value
171
+
172
+ // If it's an object, use the "pick" value.
173
+ if ( Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
174
+ value = value.pick
175
+ }
176
+
177
+ // If it's an array, convert it into minutes.
178
+ else if ( Array.isArray( value ) ) {
179
+ value = +value[ 0 ] * MINUTES_IN_HOUR + (+value[ 1 ])
180
+ }
181
+
182
+ // If no valid value is passed, set it to "now".
183
+ else if ( !Picker._.isInteger( value ) ) {
184
+ value = clock.now( type, value, options )
185
+ }
186
+
187
+ // If we're setting the max, make sure it's greater than the min.
188
+ if ( type == 'max' && value < clock.item.min.pick ) {
189
+ value += MINUTES_IN_DAY
190
+ }
191
+
192
+ // Normalize it into a "reachable" interval.
193
+ value = clock.normalize( value, options )
194
+
195
+ // Return the compiled object.
196
+ return {
197
+
198
+ // Divide to get hours from minutes.
199
+ hour: ~~( HOURS_IN_DAY + value / MINUTES_IN_HOUR ) % HOURS_IN_DAY,
200
+
201
+ // The remainder is the minutes.
202
+ mins: ( MINUTES_IN_HOUR + value % MINUTES_IN_HOUR ) % MINUTES_IN_HOUR,
203
+
204
+ // The time in total minutes.
205
+ time: ( MINUTES_IN_DAY + value ) % MINUTES_IN_DAY,
206
+
207
+ // Reference to the "relative" value to pick.
208
+ pick: value
209
+ }
210
+ } //TimePicker.prototype.create
211
+
212
+
213
+ /**
214
+ * Get the time relative to now.
215
+ */
216
+ TimePicker.prototype.now = function( type, value/*, options*/ ) {
217
+
218
+ var date = new Date(),
219
+ dateMinutes = date.getHours() * MINUTES_IN_HOUR + date.getMinutes()
220
+
221
+ // If the value is a number, adjust by that many intervals because
222
+ // the time has passed. In the case of “midnight” and a negative `min`,
223
+ // increase the value by 2. Otherwise increase it by 1.
224
+ if ( Picker._.isInteger( value ) ) {
225
+ value += type == 'min' && value < 0 && dateMinutes === 0 ? 2 : 1
226
+ }
227
+
228
+ // If the value isn’t a number, default to 1 passed interval.
229
+ else {
230
+ value = 1
231
+ }
232
+
233
+ // Calculate the final relative time.
234
+ return value * this.item.interval + dateMinutes
235
+ } //TimePicker.prototype.now
236
+
237
+
238
+ /**
239
+ * Normalize minutes or an object to be "reachable" based on the interval.
240
+ */
241
+ TimePicker.prototype.normalize = function( value/*, options*/ ) {
242
+ // If it's a negative value, add one interval to keep it as "passed".
243
+ return value - ( ( value < 0 ? this.item.interval : 0 ) + value % this.item.interval )
244
+ } //TimePicker.prototype.normalize
245
+
246
+
247
+ /**
248
+ * Measure the range of minutes.
249
+ */
250
+ TimePicker.prototype.measure = function( type, value, options ) {
251
+
252
+ var clock = this
253
+
254
+ // If it's anything false-y, set it to the default.
255
+ if ( !value ) {
256
+ value = type == 'min' ? [ 0, 0 ] : [ HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1 ]
257
+ }
258
+
259
+ // If it's a literal true, or an integer, make it relative to now.
260
+ else if ( value === true || Picker._.isInteger( value ) ) {
261
+ value = clock.now( type, value, options )
262
+ }
263
+
264
+ // If it's an object already, just normalize it.
265
+ else if ( Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
266
+ value = clock.normalize( value.pick, options )
267
+ }
268
+
269
+ return value
270
+ } ///TimePicker.prototype.measure
271
+
272
+
273
+ /**
274
+ * Validate an object as enabled.
275
+ */
276
+ TimePicker.prototype.validate = function( type, timeObject, options ) {
277
+
278
+ var clock = this,
279
+ interval = options && options.interval ? options.interval : clock.item.interval
280
+
281
+ // Check if the object is disabled.
282
+ if ( clock.disabled( timeObject ) ) {
283
+
284
+ // Shift with the interval until we reach an enabled time.
285
+ timeObject = clock.shift( timeObject, interval )
286
+ }
287
+
288
+ // Scope the object into range.
289
+ timeObject = clock.scope( timeObject )
290
+
291
+ // Do a second check to see if we landed on a disabled min/max.
292
+ // In that case, shift using the opposite interval as before.
293
+ if ( clock.disabled( timeObject ) ) {
294
+ timeObject = clock.shift( timeObject, interval * -1 )
295
+ }
296
+
297
+ // Return the final object.
298
+ return timeObject
299
+ } //TimePicker.prototype.validate
300
+
301
+
302
+ /**
303
+ * Check if an object is disabled.
304
+ */
305
+ TimePicker.prototype.disabled = function( timeObject ) {
306
+
307
+ var
308
+ clock = this,
309
+
310
+ // Filter through the disabled times to check if this is one.
311
+ isDisabledTime = clock.item.disable.filter( function( timeToDisable ) {
312
+
313
+ // If the time is a number, match the hours.
314
+ if ( Picker._.isInteger( timeToDisable ) ) {
315
+ return timeObject.hour == timeToDisable
316
+ }
317
+
318
+ // If it's an array, create the object and match the times.
319
+ if ( Array.isArray( timeToDisable ) ) {
320
+ return timeObject.pick == clock.create( timeToDisable ).pick
321
+ }
322
+ }).length
323
+
324
+ // If the clock is "enabled" flag is flipped, flip the condition.
325
+ return clock.item.enable === -1 ? !isDisabledTime : isDisabledTime
326
+ } //TimePicker.prototype.disabled
327
+
328
+
329
+ /**
330
+ * Shift an object by an interval until we reach an enabled object.
331
+ */
332
+ TimePicker.prototype.shift = function( timeObject, interval ) {
333
+
334
+ var
335
+ clock = this
336
+
337
+ // Keep looping as long as the time is disabled.
338
+ while ( clock.disabled( timeObject ) ) {
339
+
340
+ // Increase/decrease the time by the interval and keep looping.
341
+ timeObject = clock.create( timeObject.pick += interval || clock.item.interval )
342
+
343
+ // If we've looped beyond the limits, break out of the loop.
344
+ if ( timeObject.pick <= clock.item.min.pick || timeObject.pick >= clock.item.max.pick ) {
345
+ break
346
+ }
347
+ }
348
+
349
+ // Return the final object.
350
+ return timeObject
351
+ } //TimePicker.prototype.shift
352
+
353
+
354
+ /**
355
+ * Scope an object to be within range of min and max.
356
+ */
357
+ TimePicker.prototype.scope = function( timeObject ) {
358
+ var minLimit = this.item.min.pick,
359
+ maxLimit = this.item.max.pick
360
+ return this.create( timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject )
361
+ } //TimePicker.prototype.scope
362
+
363
+
364
+ /**
365
+ * Parse a string into a usable type.
366
+ */
367
+ TimePicker.prototype.parse = function( type, value, options ) {
368
+
369
+ var
370
+ clock = this,
371
+ parsingObject = {}
372
+
373
+ if ( !value || Picker._.isInteger( value ) || Array.isArray( value ) || Picker._.isDate( value ) || Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
374
+ return value
375
+ }
376
+
377
+ // We need a `.format` to parse the value.
378
+ if ( !( options && options.format ) ) {
379
+ throw "Need a formatting option to parse this.."
380
+ }
381
+
382
+ // Convert the format into an array and then map through it.
383
+ clock.formats.toArray( options.format ).map( function( label ) {
384
+
385
+ var
386
+ // Grab the formatting label.
387
+ formattingLabel = clock.formats[ label ],
388
+
389
+ // The format length is from the formatting label function or the
390
+ // label length without the escaping exclamation (!) mark.
391
+ formatLength = formattingLabel ? Picker._.trigger( formattingLabel, clock, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length
392
+
393
+ // If there's a format label, split the value up to the format length.
394
+ // Then add it to the parsing object with appropriate label.
395
+ if ( formattingLabel ) {
396
+ parsingObject[ label ] = value.substr( 0, formatLength )
397
+ }
398
+
399
+ // Update the time value as the substring from format length to end.
400
+ value = value.substr( formatLength )
401
+ })
402
+
403
+ return +parsingObject.i + MINUTES_IN_HOUR * (
404
+
405
+ +( parsingObject.H || parsingObject.HH ) ||
406
+
407
+ ( +( parsingObject.h || parsingObject.hh ) % 12 + ( /^p/i.test( parsingObject.A || parsingObject.a ) ? 12 : 0 ) )
408
+ )
409
+ } //TimePicker.prototype.parse
410
+
411
+
412
+ /**
413
+ * Various formats to display the object in.
414
+ */
415
+ TimePicker.prototype.formats = {
416
+
417
+ h: function( string, timeObject ) {
418
+
419
+ // If there's string, then get the digits length.
420
+ // Otherwise return the selected hour in "standard" format.
421
+ return string ? Picker._.digits( string ) : timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON
422
+ },
423
+ hh: function( string, timeObject ) {
424
+
425
+ // If there's a string, then the length is always 2.
426
+ // Otherwise return the selected hour in "standard" format with a leading zero.
427
+ return string ? 2 : Picker._.lead( timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON )
428
+ },
429
+ H: function( string, timeObject ) {
430
+
431
+ // If there's string, then get the digits length.
432
+ // Otherwise return the selected hour in "military" format as a string.
433
+ return string ? Picker._.digits( string ) : '' + timeObject.hour
434
+ },
435
+ HH: function( string, timeObject ) {
436
+
437
+ // If there's string, then get the digits length.
438
+ // Otherwise return the selected hour in "military" format with a leading zero.
439
+ return string ? Picker._.digits( string ) : Picker._.lead( timeObject.hour )
440
+ },
441
+ i: function( string, timeObject ) {
442
+
443
+ // If there's a string, then the length is always 2.
444
+ // Otherwise return the selected minutes.
445
+ return string ? 2 : Picker._.lead( timeObject.mins )
446
+ },
447
+ a: function( string, timeObject ) {
448
+
449
+ // If there's a string, then the length is always 4.
450
+ // Otherwise check if it's more than "noon" and return either am/pm.
451
+ return string ? 4 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'a.m.' : 'p.m.'
452
+ },
453
+ A: function( string, timeObject ) {
454
+
455
+ // If there's a string, then the length is always 2.
456
+ // Otherwise check if it's more than "noon" and return either am/pm.
457
+ return string ? 2 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'AM' : 'PM'
458
+ },
459
+
460
+ // Create an array by splitting the formatting string passed.
461
+ toArray: function( formatString ) { return formatString.split( /(h{1,2}|H{1,2}|i|a|A|!.)/g ) },
462
+
463
+ // Format an object into a string using the formatting options.
464
+ toString: function ( formatString, itemObject ) {
465
+ var clock = this
466
+ return clock.formats.toArray( formatString ).map( function( label ) {
467
+ return Picker._.trigger( clock.formats[ label ], clock, [ 0, itemObject ] ) || label.replace( /^!/, '' )
468
+ }).join( '' )
469
+ }
470
+ } //TimePicker.prototype.formats
471
+
472
+
473
+ /**
474
+ * Flip an item as enabled or disabled.
475
+ */
476
+ TimePicker.prototype.flipItem = function( type, value/*, options*/ ) {
477
+
478
+ var clock = this,
479
+ collection = clock.item.disable,
480
+ isFlipped = clock.item.enable === -1
481
+
482
+ // Flip the enabled and disabled times.
483
+ if ( value == 'flip' ) {
484
+ clock.item.enable = isFlipped ? 1 : -1
485
+ }
486
+
487
+ // Check if we have to add/remove from collection.
488
+ else if ( !isFlipped && type == 'enable' || isFlipped && type == 'disable' ) {
489
+ collection = clock.removeDisabled( collection, value )
490
+ }
491
+ else if ( !isFlipped && type == 'disable' || isFlipped && type == 'enable' ) {
492
+ collection = clock.addDisabled( collection, value )
493
+ }
494
+
495
+ return collection
496
+ } //TimePicker.prototype.flipItem
497
+
498
+
499
+ /**
500
+ * Add an item to the disabled collection.
501
+ */
502
+ TimePicker.prototype.addDisabled = function( collection, item ) {
503
+ var clock = this
504
+ item.map( function( timeUnit ) {
505
+ if ( !clock.filterDisabled( collection, timeUnit ).length ) {
506
+ collection.push( timeUnit )
507
+ }
508
+ })
509
+ return collection
510
+ } //TimePicker.prototype.addDisabled
511
+
512
+
513
+ /**
514
+ * Remove an item from the disabled collection.
515
+ */
516
+ TimePicker.prototype.removeDisabled = function( collection, item ) {
517
+ var clock = this
518
+ item.map( function( timeUnit ) {
519
+ collection = clock.filterDisabled( collection, timeUnit, 1 )
520
+ })
521
+ return collection
522
+ } //TimePicker.prototype.removeDisabled
523
+
524
+
525
+ /**
526
+ * Filter through the disabled collection to find a time unit.
527
+ */
528
+ TimePicker.prototype.filterDisabled = function( collection, timeUnit, isRemoving ) {
529
+ var timeIsArray = Array.isArray( timeUnit )
530
+ return collection.filter( function( disabledTimeUnit ) {
531
+ var isMatch = !timeIsArray && timeUnit === disabledTimeUnit ||
532
+ timeIsArray && Array.isArray( disabledTimeUnit ) && timeUnit.toString() === disabledTimeUnit.toString()
533
+ return isRemoving ? !isMatch : isMatch
534
+ })
535
+ } //TimePicker.prototype.filterDisabled
536
+
537
+
538
+ /**
539
+ * The division to use for the range intervals.
540
+ */
541
+ TimePicker.prototype.i = function( type, value/*, options*/ ) {
542
+ return Picker._.isInteger( value ) && value > 0 ? value : this.item.interval
543
+ }
544
+
545
+
546
+ /**
547
+ * Create a string for the nodes in the picker.
548
+ */
549
+ TimePicker.prototype.nodes = function( isOpen ) {
550
+
551
+ var
552
+ clock = this,
553
+ settings = clock.settings,
554
+ selectedObject = clock.item.select,
555
+ highlightedObject = clock.item.highlight,
556
+ viewsetObject = clock.item.view,
557
+ disabledCollection = clock.item.disable
558
+
559
+ return Picker._.node( 'ul', Picker._.group({
560
+ min: clock.item.min.pick,
561
+ max: clock.item.max.pick,
562
+ i: clock.item.interval,
563
+ node: 'li',
564
+ item: function( loopedTime ) {
565
+ loopedTime = clock.create( loopedTime )
566
+ return [
567
+ Picker._.trigger( clock.formats.toString, clock, [ Picker._.trigger( settings.formatLabel, clock, [ loopedTime ] ) || settings.format, loopedTime ] ),
568
+ (function( klasses, timeMinutes ) {
569
+
570
+ if ( selectedObject && selectedObject.pick == timeMinutes ) {
571
+ klasses.push( settings.klass.selected )
572
+ }
573
+
574
+ if ( highlightedObject && highlightedObject.pick == timeMinutes ) {
575
+ klasses.push( settings.klass.highlighted )
576
+ }
577
+
578
+ if ( viewsetObject && viewsetObject.pick == timeMinutes ) {
579
+ klasses.push( settings.klass.viewset )
580
+ }
581
+
582
+ if ( disabledCollection && clock.disabled( loopedTime ) ) {
583
+ klasses.push( settings.klass.disabled )
584
+ }
585
+
586
+ return klasses.join( ' ' )
587
+ })( [ settings.klass.listItem ], loopedTime.pick ),
588
+ 'data-pick=' + loopedTime.pick
589
+ ]
590
+ }
591
+ }) + Picker._.node( 'li', Picker._.node( 'button', settings.clear, settings.klass.buttonClear, 'data-clear=1' + ( isOpen ? '' : ' disable' ) ) ), settings.klass.list )
592
+ } //TimePicker.prototype.nodes
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+ /* ==========================================================================
601
+ Extend the picker to add the component with the defaults.
602
+ ========================================================================== */
603
+
604
+ TimePicker.defaults = (function( prefix ) {
605
+
606
+ return {
607
+
608
+ // Clear
609
+ clear: 'Clear',
610
+
611
+ // The format to show on the `input` element
612
+ format: 'h:i A',
613
+
614
+ // The interval between each time
615
+ interval: 30,
616
+
617
+ // Classes
618
+ klass: {
619
+
620
+ picker: prefix + ' ' + prefix + '--time',
621
+ holder: prefix + '__holder',
622
+
623
+ list: prefix + '__list',
624
+ listItem: prefix + '__list-item',
625
+
626
+ disabled: prefix + '__list-item--disabled',
627
+ selected: prefix + '__list-item--selected',
628
+ highlighted: prefix + '__list-item--highlighted',
629
+ viewset: prefix + '__list-item--viewset',
630
+ now: prefix + '__list-item--now',
631
+
632
+ buttonClear: prefix + '__button--clear'
633
+ }
634
+ }
635
+ })( Picker.klasses().picker )
636
+
637
+
638
+
639
+
640
+
641
+ /**
642
+ * Extend the picker to add the date picker.
643
+ */
644
+ Picker.extend( 'pickatime', TimePicker )
645
+
646
+
647
+ // Close the scope.
648
+ })();
649
+
650
+
651
+