rsence-pre 3.0.0.8 → 3.0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/client/conf/client_pkg.yaml +6 -2
  4. data/client/js/comm/queue/queue.js +32 -44
  5. data/client/js/comm/transporter/transporter.js +24 -16
  6. data/client/js/comm/values/values.js +27 -15
  7. data/client/js/controls/button/button.coffee +14 -5
  8. data/client/js/controls/button/themes/default/button.css +4 -2
  9. data/client/js/controls/checkbox/checkbox.js +4 -4
  10. data/client/js/controls/dialogs/sheet/sheet.js +11 -11
  11. data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
  12. data/client/js/controls/imageview/imageview.js +15 -15
  13. data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
  14. data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
  15. data/client/js/controls/progress/progressbar/progressbar.js +6 -7
  16. data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
  17. data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
  18. data/client/js/controls/sliders/slider/slider.js +74 -79
  19. data/client/js/controls/stepper/stepper.js +31 -31
  20. data/client/js/controls/stringview/stringview.js +20 -8
  21. data/client/js/controls/tab/tab.js +57 -63
  22. data/client/js/controls/tab/themes/default/tab.html +4 -1
  23. data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
  24. data/client/js/controls/validatorview/validatorview.js +4 -4
  25. data/client/js/controls/window/window.js +43 -56
  26. data/client/js/core/class/class.js +25 -23
  27. data/client/js/core/elem/elem.coffee +8 -1
  28. data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
  29. data/client/js/core/util/util_methods/util_methods.coffee +57 -15
  30. data/client/js/datetime/calendar/calendar.coffee +196 -199
  31. data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
  32. data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
  33. data/client/js/datetime/datepicker/datepicker.coffee +18 -3
  34. data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
  35. data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
  36. data/client/js/datetime/momentjs/momentjs.js +310 -76
  37. data/client/js/datetime/timepicker/timepicker.coffee +6 -1
  38. data/client/js/datetime/timesheet/timesheet.js +59 -61
  39. data/client/js/foundation/control/control.js +45 -44
  40. data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
  41. data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
  42. data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
  43. data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
  44. data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
  45. data/client/js/foundation/geom/rect/rect.js +43 -32
  46. data/client/js/foundation/locale_settings/locale_settings.js +36 -25
  47. data/client/js/foundation/system/system.js +79 -67
  48. data/client/js/foundation/thememanager/thememanager.coffee +11 -1
  49. data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
  50. data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
  51. data/client/js/foundation/value/value.js +22 -15
  52. data/client/js/foundation/view/view.js +94 -55
  53. data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
  54. data/client/js/lists/listitems/listitems.js +26 -4
  55. data/client/js/menus/combobox/combobox.coffee +55 -0
  56. data/client/js/menus/minimenu/minimenu.js +61 -30
  57. data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
  58. data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
  59. data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
  60. data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
  61. data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
  62. data/client/js/tables/table/table.coffee +109 -64
  63. data/client/js/tables/table/themes/default/table.css +4 -0
  64. data/lib/rsence/msg.rb +64 -64
  65. data/lib/rsence/plugins/plugin.rb +68 -52
  66. data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
  67. data/lib/rsence/value.rb +79 -59
  68. data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
  69. data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
  70. data/plugins/main/js/main.js +46 -28
  71. metadata +6 -8
  72. data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  73. data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  74. data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  75. data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  76. data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
  77. data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
@@ -340,6 +340,9 @@ EventManagerApp = HApplication.extend
340
340
  return false
341
341
  return true
342
342
  #
343
+ # Queue of items to check for focus, because it's fairly slow directly:
344
+ _topmostQueue: []
345
+ #
343
346
  # Converts eventOptions into a list of enabled event names
344
347
  _setEventOptions: (_ctrl,_eventOptions,_warnMethodName)->
345
348
  _warnMethodName = '[unknown]' unless _warnMethodName
@@ -377,9 +380,7 @@ EventManagerApp = HApplication.extend
377
380
  @_listeners.enabled.unshift( _viewId ) unless ~@_listeners.enabled.indexOf(_viewId)
378
381
  _elem = ELEM.get( _ctrl.elemId )
379
382
  [ x, y ] = @status.crsr
380
- _matchIds = @_findTopmostEnabled( HPoint.new( x, y ), 'contains', null )
381
- if ~_matchIds.indexOf( _viewId )
382
- @changeActiveControl( _ctrl )
383
+ @_topmostQueue.push( [ HPoint.new( x, y ), _ctrl ] )
383
384
  #
384
385
  # Releases bindings done by #_setEventOptions
385
386
  _unsetEventOptions: (_ctrl,_warnMethodName)->
@@ -396,7 +397,6 @@ EventManagerApp = HApplication.extend
396
397
  _intersectHoverIdx = @_listeners._rectHoverIntersectMode.indexOf( _viewId )
397
398
  if ~_intersectHoverIdx
398
399
  @_listeners._rectHoverIntersectMode.splice( _intersectHoverIdx, 1 )
399
- _wasFocused = false
400
400
  _elem = ELEM.get( _ctrl.elemId )
401
401
  for _statusItem in [ 'dragged', 'selected', 'hovered', 'active', 'focused', 'enabled' ]
402
402
  _viewIdx = @_listeners[_statusItem].indexOf(_viewId)
@@ -411,7 +411,6 @@ EventManagerApp = HApplication.extend
411
411
  _ctrl._lostActiveStatus( null )
412
412
  else if _statusItem == 'focused'
413
413
  @blur( _ctrl )
414
- _wasFocused = true
415
414
  else if _statusItem == 'enabled'
416
415
  _ctrl.setEnabled( false ) if _ctrl.enabled
417
416
  _viewIdx = @_listeners[_statusItem].indexOf(_viewId)
@@ -736,8 +735,17 @@ EventManagerApp = HApplication.extend
736
735
  if _active.length != 1
737
736
  @warn "Danger, too many active items: #{JSON.stringify(_active)}"
738
737
  for _viewId in _active.slice()
738
+ if _viewId == null
739
+ console.warn('encountered null viewId in active listeners!')
740
+ _idx = _active.indexOf( _viewId )
741
+ while ~_idx
742
+ _idx = _active.indexOf( _viewId )
743
+ _active.splice( _idx, 1 )
744
+ continue
739
745
  continue if _newActive != null and _viewId == _newActive.viewId
740
746
  _ctrl = @_views[_viewId]
747
+ if _ctrl.isDead and !@isProduction
748
+ console.warn('trying to deactivate dead control!')
741
749
  _ctrl.active = false
742
750
  _idx = _active.indexOf( _viewId )
743
751
  _dragIdx = _dragged.indexOf(_viewId)
@@ -1116,25 +1124,21 @@ EventManagerApp = HApplication.extend
1116
1124
  # a special default rule of auto-selecting the active control and
1117
1125
  # checking all of its siblings before traversing.
1118
1126
  defaultKey: (_methodName,_ctrl)->
1119
- if _ctrl?
1120
- return true if _ctrl[_methodName]? and _ctrl[_methodName]()
1121
- else # first special rules, check same
1122
- return null unless @_listeners.active
1123
- _ctrl = @_views[@_listeners.active[0]]
1124
- return true if _ctrl[_methodName]? and _ctrl[_methodName]()
1125
- _stop = null
1126
- for _viewId in _ctrl.parent.views
1127
- continue if _ctrl.viewId == _viewId
1128
- _ctrl = @_views[_viewId]
1129
- if _ctrl[_methodName]?
1130
- _stopStatus = _ctrl[_methodName]()
1131
- if _stopStatus == false or _stopStatus == true
1132
- _stop = _stopStatus unless _stop
1133
- if _stop != null
1134
- return _stop
1135
- if _ctrl.parent?
1136
- return true if @defaultKey(_methodName,_ctrl.parent)
1137
- return null
1127
+ return true if _ctrl? and _ctrl[_methodName]? and _ctrl[_methodName]() == true
1128
+ return null unless @_listeners.active
1129
+ _ctrl = @_views[@_listeners.active[0]]
1130
+ return true if _ctrl[_methodName]? and _ctrl[_methodName]() == true
1131
+ _stop = null
1132
+ for _viewId in _ctrl.parent.views
1133
+ continue if _ctrl.viewId == _viewId
1134
+ _ctrl = @_views[_viewId]
1135
+ if _ctrl[_methodName]?
1136
+ _stopStatus = _ctrl[_methodName]()
1137
+ if _stopStatus == false or _stopStatus == true
1138
+ _stop = _stopStatus unless _stop
1139
+ return _stop if _stop != null
1140
+ return true if _ctrl.parent? and @defaultKey(_methodName,_ctrl.parent) == true
1141
+ null
1138
1142
  #
1139
1143
  # Handles the keyDown event
1140
1144
  keyDown: (e)->
@@ -1219,13 +1223,27 @@ EventManagerApp = HApplication.extend
1219
1223
  @warn('EventManager#isCmdKeyDown is deprecated, use #status.cmdKeyDown instead')
1220
1224
  @status.altKeyDown
1221
1225
  #
1222
- # Debug output
1223
- # idle: ->
1224
- # console.log( 'focused: ',
1225
- # JSON.stringify(@_listeners.focused),'active:',
1226
- # JSON.stringify(@_listeners.active),'dragged:',
1227
- # JSON.stringify(@_listeners.dragged),'hovered:',
1228
- # JSON.stringify(@_listeners.hovered) )
1226
+ idle: ->
1227
+ if @_topmostQueue.length
1228
+ _items = []
1229
+ _lastPoint = false
1230
+ for i in [0..(@_topmostQueue.length-1)]
1231
+ [ _point, _ctrl ] = @_topmostQueue.shift()
1232
+ _lastPoint = _point
1233
+ continue if _ctrl.isDead
1234
+ continue unless _ctrl.enabled
1235
+ _items.push( _ctrl )
1236
+ _matchIds = @_findTopmostEnabled( _lastPoint, 'contains', null )
1237
+ for _ctrl in _items
1238
+ _viewId = _ctrl.viewId
1239
+ if ~_matchIds.indexOf( _viewId )
1240
+ @changeActiveControl( _ctrl )
1241
+ # Debug output
1242
+ # console.log( 'focused: ',
1243
+ # JSON.stringify(@_listeners.focused),'active:',
1244
+ # JSON.stringify(@_listeners.active),'dragged:',
1245
+ # JSON.stringify(@_listeners.dragged),'hovered:',
1246
+ # JSON.stringify(@_listeners.hovered) )
1229
1247
  #
1230
1248
  # Cleans up structures
1231
1249
  die: ->
@@ -1233,7 +1251,7 @@ EventManagerApp = HApplication.extend
1233
1251
  @base()
1234
1252
 
1235
1253
  LOAD( ->
1236
- window.EventManager = EventManagerApp.new( 500, 'EventManager' )
1254
+ window.EventManager = EventManagerApp.new( 40, 'EventManager' )
1237
1255
  # Alias:
1238
1256
  window.EVENT = EventManager
1239
1257
  EventManager.start()
@@ -53,7 +53,7 @@ HRect = HClass.extend({
53
53
  constructor: function() {
54
54
  this.viewIds = [];
55
55
  var _args=arguments;
56
-
56
+
57
57
  if (_args.length === 0) {
58
58
  this._constructorDefault();
59
59
  } else if (_args.length === 4) {
@@ -126,7 +126,7 @@ HRect = HClass.extend({
126
126
  return [ _this.left, _this.top, _this.width, _this.height ];
127
127
  }
128
128
  },
129
-
129
+
130
130
  _updateFlexibleDimensions: function(){
131
131
  var
132
132
  _this = this,
@@ -146,6 +146,15 @@ HRect = HClass.extend({
146
146
  _view = HSystem.views[_viewId];
147
147
  if(_view.flexRight || _view.flexBottom){
148
148
  ELEM.flush();
149
+ //// This will increase performance somewhat, but needs to be broader than it is:
150
+ // var i=0,_parentElemIds=[_view.elemId],_parentView;
151
+ // for(;i<_view.parents.length;i++){
152
+ // _parentView = _view.parents[i];
153
+ // if(_parentView && _parentView.elemId !== null && _parentView.elemId !== undefined){
154
+ // _parentElemIds.push(_parentView.elemId);
155
+ // }
156
+ // }
157
+ // ELEM.flushElem(_parentElemIds);
149
158
  _parentSize = _view.parentSize();
150
159
  if( _view.flexRight && _view.flexLeft ){ // calculate width and right
151
160
  _virtualWidth = _parentSize[0] - _this.left - _view.flexRightOffset;
@@ -198,9 +207,9 @@ HRect = HClass.extend({
198
207
  *
199
208
  **/
200
209
  updateSecondaryValues: function(_noSize) {
201
-
210
+
202
211
  // this._updateFlexibleDimensions();
203
-
212
+
204
213
  /**
205
214
  * isValid is true if the Rect's right side is greater than or equal to its left
206
215
  * and its bottom is greater than or equal to its top, and false otherwise.
@@ -208,7 +217,7 @@ HRect = HClass.extend({
208
217
  * the frame of a view or window).
209
218
  **/
210
219
  this.isValid = ( this.right >= this.left && this.bottom >= this.top );
211
-
220
+
212
221
  /**
213
222
  *
214
223
  * The Point-returning functions return the coordinates of one of the
@@ -218,7 +227,7 @@ HRect = HClass.extend({
218
227
  this.leftBottom = new HPoint(this.left, this.bottom);
219
228
  this.rightTop = new HPoint(this.right, this.top);
220
229
  this.rightBottom = new HPoint(this.right, this.bottom);
221
-
230
+
222
231
  /**
223
232
  * The width and height of a Rect's rectangle, as returned through these
224
233
  * properties.
@@ -227,9 +236,11 @@ HRect = HClass.extend({
227
236
  this.width = (this.right - this.left);
228
237
  this.height = (this.bottom - this.top);
229
238
  }
239
+ this.position = [ this.left, this.top ];
240
+ this.size = [ this.width, this.height ];
230
241
  return this;
231
242
  },
232
-
243
+
233
244
  /** = Description
234
245
  * Sets the object's rectangle by defining the coordinates of all four
235
246
  * sides.
@@ -248,7 +259,7 @@ HRect = HClass.extend({
248
259
  **/
249
260
  set: function() {
250
261
  var _args=arguments;
251
-
262
+
252
263
  if (_args.length === 0) {
253
264
  this._constructorDefault();
254
265
  } else if (_args.length === 4) {
@@ -266,7 +277,7 @@ HRect = HClass.extend({
266
277
  this.updateSecondaryValues();
267
278
  return this;
268
279
  },
269
-
280
+
270
281
  /** = Description
271
282
  * Moves the rect's left side to a new coordinate.
272
283
  *
@@ -279,7 +290,7 @@ HRect = HClass.extend({
279
290
  this.updateSecondaryValues();
280
291
  return this;
281
292
  },
282
-
293
+
283
294
  /** = Description
284
295
  * Moves the rect's right side to a new coordinate.
285
296
  *
@@ -292,7 +303,7 @@ HRect = HClass.extend({
292
303
  this.updateSecondaryValues();
293
304
  return this;
294
305
  },
295
-
306
+
296
307
  /** = Description
297
308
  * Moves the rect's top side to a new coordinate.
298
309
  *
@@ -305,7 +316,7 @@ HRect = HClass.extend({
305
316
  this.updateSecondaryValues();
306
317
  return this;
307
318
  },
308
-
319
+
309
320
  /** = Description
310
321
  * Moves the rect's bottom side to a new coordinate.
311
322
  *
@@ -318,7 +329,7 @@ HRect = HClass.extend({
318
329
  this.updateSecondaryValues();
319
330
  return this;
320
331
  },
321
-
332
+
322
333
  /** = Description
323
334
  * Moves the rects left and top sides to a new point. Affects the position,
324
335
  * width and height.
@@ -333,7 +344,7 @@ HRect = HClass.extend({
333
344
  this.updateSecondaryValues();
334
345
  return this;
335
346
  },
336
-
347
+
337
348
  /** = Description
338
349
  * Moves the rects left and bottom sides to a new point. Affects the left
339
350
  * position, width and height.
@@ -348,7 +359,7 @@ HRect = HClass.extend({
348
359
  this.updateSecondaryValues();
349
360
  return this;
350
361
  },
351
-
362
+
352
363
  /** = Description
353
364
  * Moves the rects right and top sides to a new point. Affects the top
354
365
  * position, width and height.
@@ -363,7 +374,7 @@ HRect = HClass.extend({
363
374
  this.updateSecondaryValues();
364
375
  return this;
365
376
  },
366
-
377
+
367
378
  /** = Description
368
379
  * Moves the rects right and bottom sides to a new point. Affects the width
369
380
  * and height. Does not affect the position.
@@ -378,7 +389,7 @@ HRect = HClass.extend({
378
389
  this.updateSecondaryValues();
379
390
  return this;
380
391
  },
381
-
392
+
382
393
  /** = Description
383
394
  * Moves the rects right side to a new coordinate. Does not affect the position.
384
395
  *
@@ -435,7 +446,7 @@ HRect = HClass.extend({
435
446
  this.updateSecondaryValues();
436
447
  return this;
437
448
  },
438
-
449
+
439
450
  /** = Description
440
451
  * Returns true if the Rect has any area even a corner or part
441
452
  * of a side in common with rect, and false if it doesn't.
@@ -464,12 +475,12 @@ HRect = HClass.extend({
464
475
  overlaps: function( _rect, _insetbyX, _insetByY ){
465
476
  return this.intersects( _rect, _insetbyX, _insetByY );
466
477
  },
467
-
478
+
468
479
  /** = Description
469
480
  * Returns true if point or rect lies entirely within the Rect's
470
481
  * rectangle (and false if not). A rectangle contains the points that lie
471
482
  * along its edges; for example, two identical rectangles contain each other.
472
- *
483
+ *
473
484
  * Also works with HPoint instances.
474
485
  *
475
486
  * = Parameters
@@ -498,7 +509,7 @@ HRect = HClass.extend({
498
509
  return ( _rect.left >= this.left && _rect.right <= this.right &&
499
510
  _rect.top >= this.top && _rect.bottom <= this.bottom );
500
511
  },
501
-
512
+
502
513
  /** = Description
503
514
  * Insets the sides of the Rect's rectangle by x units (left and
504
515
  * right sides) and y units (top and bottom). Positive inset values shrink
@@ -537,7 +548,7 @@ HRect = HClass.extend({
537
548
  this.right -= x;
538
549
  this.bottom -= y;
539
550
  },
540
-
551
+
541
552
  /** = Description
542
553
  * Moves the Rect horizontally by x units and vertically by y
543
554
  * units. The rectangle's size doesn't change.
@@ -572,7 +583,7 @@ HRect = HClass.extend({
572
583
  this.right += x;
573
584
  this.bottom += y;
574
585
  },
575
-
586
+
576
587
  /** = Description
577
588
  * Moves the Rect to the location (x,y).
578
589
  *
@@ -606,7 +617,7 @@ HRect = HClass.extend({
606
617
  this.bottom += y-this.top;
607
618
  this.top = y;
608
619
  },
609
-
620
+
610
621
  /** = Description
611
622
  * Returns true if the two objects' rectangles exactly coincide.
612
623
  *
@@ -621,7 +632,7 @@ HRect = HClass.extend({
621
632
  return (this.left === _rect.left && this.top === _rect.top &&
622
633
  this.right === _rect.right && this.bottom === _rect.bottom);
623
634
  },
624
-
635
+
625
636
  /** = Description
626
637
  * Creates and returns a new Rect that's the intersection of this Rect and
627
638
  * the specified Rect. The new Rect encloses the area that the two Rects have
@@ -640,7 +651,7 @@ HRect = HClass.extend({
640
651
  Math.min(this.right, _rect.right), Math.min(this.bottom, _rect.bottom)
641
652
  );
642
653
  },
643
-
654
+
644
655
  /** = Description
645
656
  * Creates and returns a new Rect that minimally but completely encloses the
646
657
  * area defined by this Rect and the specified Rect.
@@ -658,10 +669,10 @@ HRect = HClass.extend({
658
669
  Math.max(this.right, _rect.right), Math.max(this.bottom, _rect.bottom)
659
670
  );
660
671
  },
661
-
672
+
662
673
  // HValue and HView support
663
674
  valueObj: null,
664
-
675
+
665
676
  /** = Description
666
677
  * Bind function
667
678
  *
@@ -676,7 +687,7 @@ HRect = HClass.extend({
676
687
  this._updateFlexibleDimensions();
677
688
  return this;
678
689
  },
679
-
690
+
680
691
  /** = Description
681
692
  * Release function
682
693
  **/
@@ -687,7 +698,7 @@ HRect = HClass.extend({
687
698
  }
688
699
  return this;
689
700
  },
690
-
701
+
691
702
  /** = Description
692
703
  * Sets valueObj for this component given as parameter.
693
704
  *
@@ -699,7 +710,7 @@ HRect = HClass.extend({
699
710
  this.valueObj = _valueObj;
700
711
  return this;
701
712
  },
702
-
713
+
703
714
  /** = Description
704
715
  * setValue function
705
716
  *
@@ -724,5 +735,5 @@ HRect = HClass.extend({
724
735
  toString: function(){
725
736
  return ('[object Rect left='+this.left+' top='+this.top+' width='+this.width+' height='+this.height+' right='+this.right+' bottom='+this.bottom+']');
726
737
  }
727
-
738
+
728
739
  });
@@ -1,8 +1,15 @@
1
1
 
2
2
  var
3
- HLocale = {
3
+ HLocale = (UtilMethods.extend({
4
+ setData: function(_locale){
5
+ this.updateObject(_locale,this);
6
+ },
4
7
  components: {
5
-
8
+
9
+ },
10
+ general: {
11
+ decimalSeparator: '.',
12
+ thousandsSeparator: ''
6
13
  },
7
14
  compUnits: {
8
15
  strings: {
@@ -87,13 +94,18 @@ HLocale = {
87
94
  dateDelimitter: '.',
88
95
  timeDelimitter: ':',
89
96
  timeMsDelimitter: '.',
90
- rangeDelimitter: ' ... '
97
+ rangeDelimitter: ' ... ',
98
+ dateFormat: 'YYYY-MM-DD',
99
+ timeFormat: 'HH:mm:ss',
100
+ dateTimeFormat: 'YYYY-MM-DD HH:mm:ss'
91
101
  },
92
102
  settings: {
93
103
  zeroPadTime: true,
94
104
  AMPM: false
95
105
  },
96
106
  defaultOptions: {
107
+ useUTC: true,
108
+ tzMinutes: 0,
97
109
  longWeekDay: false,
98
110
  shortWeekDay: false,
99
111
  shortYear: false,
@@ -110,11 +122,10 @@ HLocale = {
110
122
  for( _key in _default ){
111
123
  _options[_key] = _default[_key];
112
124
  }
113
- if( !_custom ){
114
- _custom = {};
115
- }
116
- for( _key in _custom ){
117
- _options[_key] = _custom[_key];
125
+ if( _custom ){
126
+ for( _key in _custom ){
127
+ _options[_key] = _custom[_key];
128
+ }
118
129
  }
119
130
  return _options;
120
131
  },
@@ -129,7 +140,7 @@ HLocale = {
129
140
  _this = HLocale.dateTime,
130
141
  _date = new Date( _dateTimeEpoch * 1000 ),
131
142
  _strings = _this.strings,
132
- _wday = _date.getUTCDay();
143
+ _wday = _this.options().useUTC?_date.getUTCDay():_date.getDay();
133
144
  return _strings.weekDaysShort[ _wday ];
134
145
  },
135
146
  formatLongWeekDay: function( _dateTimeEpoch ){
@@ -137,26 +148,26 @@ HLocale = {
137
148
  _this = HLocale.dateTime,
138
149
  _date = new Date( _dateTimeEpoch * 1000 ),
139
150
  _strings = _this.strings,
140
- _wday = _date.getUTCDay();
151
+ _wday = _this.options().useUTC?_date.getUTCDay():_date.getDay();
141
152
  return _strings.weekDaysLong[ _wday ];
142
153
  },
143
154
  formatDate: function( _dateTimeEpoch, _options ){
155
+ _options = this.options( _options );
144
156
  var
145
157
  _this = HLocale.dateTime,
146
158
  _date = new Date( _dateTimeEpoch * 1000 ),
147
159
  _strings = _this.strings,
148
- _wday = _date.getUTCDay(),
149
- _dateString = _date.getUTCDate() + _strings.dateDelimitter + (_date.getUTCMonth() + 1) + _strings.dateDelimitter;
150
-
151
- _options = _this.options( _options );
152
-
160
+ _wday = _options.useUTC?_date.getUTCDay():_date.getDay(),
161
+ _dateString = _options.useUTC?(_date.getUTCDate() + _strings.dateDelimitter + (_date.getUTCMonth() + 1) + _strings.dateDelimitter):
162
+ (_date.getDate() + _strings.dateDelimitter + (_date.getMonth() + 1) + _strings.dateDelimitter);
163
+
153
164
  if( _options.fullYear ){
154
- _dateString += _date.getUTCFullYear();
165
+ _dateString += _options.useUTC?_date.getUTCFullYear():_date.getFullYear();
155
166
  }
156
167
  else if( _options.shortYear ){
157
- _dateString += date.getUTCYear();
168
+ _dateString += _options.useUTC?_date.getUTCYear():_date.getYear();
158
169
  }
159
-
170
+
160
171
  if( _options.longWeekDay ){
161
172
  return _strings.weekDaysLong[_wday] + ' ' + _dateString;
162
173
  }
@@ -166,18 +177,18 @@ HLocale = {
166
177
  return _dateString;
167
178
  },
168
179
  formatTime: function( _dateTimeEpoch, _options ){
180
+ _options = this.options( _options );
169
181
  var
170
182
  _this = HLocale.dateTime,
171
183
  _date = new Date( _dateTimeEpoch * 1000 ),
172
184
  _strings = _this.strings,
173
- _timeString = _this.zeroPadTime( _date.getUTCHours() ) + _strings.timeDelimitter + _this.zeroPadTime( _date.getUTCMinutes() );
174
-
175
- _options = _this.options( _options );
176
-
185
+ _timeString = _options.useUTC?(_this.zeroPadTime( _date.getUTCHours() ) + _strings.timeDelimitter + _this.zeroPadTime( _date.getUTCMinutes() )):
186
+ (_this.zeroPadTime( _date.getHours() ) + _strings.timeDelimitter + _this.zeroPadTime( _date.getMinutes() ));
187
+
177
188
  if( _options.seconds ){
178
- _timeString += _strings.timeDelimitter + _this.zeroPadTime( _date.getUTCSeconds() );
189
+ _timeString += _strings.timeDelimitter + _this.zeroPadTime( _options.useUTC?_date.getUTCSeconds():_date.getSeconds() );
179
190
  if( _options.milliSeconds ){
180
- _timeString += _strings.timeMsDelimitter + _date.getUTCMilliseconds();
191
+ _timeString += _strings.timeMsDelimitter + _options.useUTC?_date.getUTCMilliseconds():_date.getMilliseconds;
181
192
  }
182
193
  }
183
194
  return _timeString;
@@ -187,4 +198,4 @@ HLocale = {
187
198
  return _this.formatDate( _dateTimeEpoch, _options ) + ' ' + _this.formatTime( _dateTimeEpoch, _options );
188
199
  }
189
200
  }
190
- };
201
+ })).nu();