From 8592cfb89db05f0e52d8c1b8c7046e6f49e3522d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 1 Feb 2012 00:09:27 -0800 Subject: Adding a montage framework copy for the user document Adding a new montage copy containing the latest version of montage to use the new native widgets Signed-off-by: Valerio Virgillito --- node_modules/montage-user/core/bitfield.js | 199 + .../montage-user/core/converter/bytes-converter.js | 123 + .../montage-user/core/converter/converter.js | 144 + .../core/converter/currency-converter.js | 77 + .../montage-user/core/converter/date-converter.js | 2630 +++++++++++++ .../core/converter/lower-case-converter.js | 46 + .../core/converter/new-line-to-br-converter.js | 60 + .../core/converter/number-converter.js | 390 ++ .../montage-user/core/converter/trim-converter.js | 73 + .../core/converter/upper-case-converter.js | 51 + node_modules/montage-user/core/core.js | 1130 ++++++ node_modules/montage-user/core/deserializer.js | 859 +++++ node_modules/montage-user/core/enum.js | 86 + .../core/event/action-event-listener.js | 76 + node_modules/montage-user/core/event/binding.js | 1420 +++++++ .../montage-user/core/event/event-manager.js | 2080 +++++++++++ .../montage-user/core/event/mutable-event.js | 239 ++ node_modules/montage-user/core/exception.js | 95 + node_modules/montage-user/core/gate.js | 195 + .../montage-user/core/geometry/cubic-bezier.js | 158 + node_modules/montage-user/core/geometry/point.js | 66 + node_modules/montage-user/core/jshint.js | 3945 ++++++++++++++++++++ node_modules/montage-user/core/logger.js | 497 +++ node_modules/montage-user/core/next-tick.js | 91 + node_modules/montage-user/core/promise.js | 663 ++++ node_modules/montage-user/core/serializer.js | 465 +++ node_modules/montage-user/core/shim.js | 12 + node_modules/montage-user/core/shim/array.js | 78 + node_modules/montage-user/core/shim/immediate.js | 57 + node_modules/montage-user/core/shim/string.js | 66 + node_modules/montage-user/core/shim/structures.js | 552 +++ node_modules/montage-user/core/shim/weak-map.js | 454 +++ node_modules/montage-user/core/state-chart.js | 595 +++ node_modules/montage-user/core/undo-manager.js | 240 ++ node_modules/montage-user/core/url.js | 317 ++ node_modules/montage-user/core/uuid.js | 74 + node_modules/montage-user/data/blueprint.js | 1062 ++++++ node_modules/montage-user/data/context.js | 374 ++ node_modules/montage-user/data/controllistener.js | 47 + .../montage-user/data/ldapaccess/ldapblueprint.js | 135 + .../montage-user/data/ldapaccess/ldapobjectid.js | 20 + .../data/ldapaccess/ldapselectorevaluator.js | 24 + .../montage-user/data/ldapaccess/ldapstore.js | 38 + .../data/nosqlaccess/nosqlblueprint.js | 135 + .../montage-user/data/nosqlaccess/nosqlobjectid.js | 22 + .../data/nosqlaccess/nosqlselectorevaluator.js | 24 + .../montage-user/data/nosqlaccess/nosqlstore.js | 68 + node_modules/montage-user/data/objectid.js | 77 + node_modules/montage-user/data/objectproperty.js | 298 ++ node_modules/montage-user/data/pledge.js | 270 ++ node_modules/montage-user/data/query.js | 114 + .../montage-user/data/restaccess/restblueprint.js | 138 + .../montage-user/data/restaccess/restobjectid.js | 21 + .../data/restaccess/restselectorevaluator.js | 24 + .../montage-user/data/restaccess/reststore.js | 186 + node_modules/montage-user/data/restriction.js | 66 + node_modules/montage-user/data/selector.js | 2220 +++++++++++ .../montage-user/data/sqlaccess/sqlblueprint.js | 135 + .../montage-user/data/sqlaccess/sqlobjectid.js | 22 + .../data/sqlaccess/sqlselectorevaluator.js | 24 + .../montage-user/data/sqlaccess/sqlstore.js | 69 + node_modules/montage-user/data/store.js | 1211 ++++++ node_modules/montage-user/data/transactionid.js | 230 ++ node_modules/montage-user/montage.js | 401 ++ node_modules/montage-user/node.js | 79 + node_modules/montage-user/package.json | 25 + node_modules/montage-user/require/browser.js | 112 + node_modules/montage-user/require/node.js | 101 + node_modules/montage-user/require/require.js | 698 ++++ node_modules/montage-user/service/service.js | 10 + node_modules/montage-user/ui/anchor.reel/anchor.js | 26 + node_modules/montage-user/ui/application.js | 216 ++ .../ui/bluemoon/button-group.reel/button-group.css | 111 + .../bluemoon/button-group.reel/button-group.html | 26 + .../ui/bluemoon/button-group.reel/button-group.js | 77 + .../ui/bluemoon/button.reel/button.css | 386 ++ .../ui/bluemoon/button.reel/button.html | 26 + .../montage-user/ui/bluemoon/button.reel/button.js | 743 ++++ .../ui/bluemoon/checkbox.reel/checkbox.css | 116 + .../ui/bluemoon/checkbox.reel/checkbox.html | 14 + .../ui/bluemoon/checkbox.reel/checkbox.js | 452 +++ .../checkbox.reel/checkmark-dark-disabled.svg | 5 + .../ui/bluemoon/checkbox.reel/checkmark-dark.svg | 7 + .../checkbox.reel/checkmark-light-disabled.svg | 5 + .../ui/bluemoon/checkbox.reel/checkmark.svg | 7 + .../ui/bluemoon/progress.reel/progress.css | 51 + .../ui/bluemoon/progress.reel/progress.html | 32 + .../ui/bluemoon/progress.reel/progress.js | 139 + .../ui/bluemoon/progress.reel/rule.png | Bin 0 -> 956 bytes .../ui/bluemoon/progress.reel/scroll.png | Bin 0 -> 272 bytes .../ui/bluemoon/slider.reel/slider.css | 255 ++ .../ui/bluemoon/slider.reel/slider.html | 82 + .../montage-user/ui/bluemoon/slider.reel/slider.js | 583 +++ .../ui/bluemoon/textarea.reel/textarea.css | 36 + .../ui/bluemoon/textarea.reel/textarea.html | 15 + .../ui/bluemoon/textarea.reel/textarea.js | 29 + .../ui/bluemoon/textfield.reel/textfield.css | 35 + .../ui/bluemoon/textfield.reel/textfield.html | 16 + .../ui/bluemoon/textfield.reel/textfield.js | 56 + .../ui/bluemoon/toggle.reel/toggle.css | 162 + .../ui/bluemoon/toggle.reel/toggle.html | 16 + .../montage-user/ui/bluemoon/toggle.reel/toggle.js | 423 +++ node_modules/montage-user/ui/button.reel/button.js | 416 +++ node_modules/montage-user/ui/check-input.js | 46 + .../montage-user/ui/checkbox.reel/checkbox.js | 26 + .../ui/component-group.reel/component-group.js | 33 + .../component-placeholder.js | 146 + node_modules/montage-user/ui/component.js | 1791 +++++++++ node_modules/montage-user/ui/composer/composer.js | 142 + .../ui/composer/long-press-composer.js | 232 ++ .../montage-user/ui/composer/swipe-composer.js | 303 ++ .../montage-user/ui/composer/translate-composer.js | 775 ++++ .../montage-user/ui/condition.reel/condition.js | 149 + .../montage-user/ui/controller/array-controller.js | 865 +++++ .../montage-user/ui/controller/media-controller.js | 698 ++++ .../ui/controller/object-controller.js | 62 + .../ui/controller/paged-array-controller.js | 260 ++ .../montage-user/ui/date-input.reel/date-input.js | 31 + node_modules/montage-user/ui/dom.js | 278 ++ .../ui/dynamic-text.reel/dynamic-text.js | 95 + node_modules/montage-user/ui/editable-text.js | 324 ++ node_modules/montage-user/ui/flow-path-cubic.js | 109 + node_modules/montage-user/ui/flow-path-lerp.js | 106 + node_modules/montage-user/ui/flow-path-linear.js | 77 + node_modules/montage-user/ui/flow-path-sigmoid.js | 142 + node_modules/montage-user/ui/flow-path.js | 209 ++ node_modules/montage-user/ui/flow.reel/flow.html | 60 + node_modules/montage-user/ui/flow.reel/flow.js | 762 ++++ node_modules/montage-user/ui/image.reel/image.js | 22 + node_modules/montage-user/ui/list.reel/list.html | 82 + node_modules/montage-user/ui/list.reel/list.js | 98 + node_modules/montage-user/ui/loader.reel/loader.js | 479 +++ .../ui/loading-panel.reel/loading-panel.css | 37 + .../ui/loading-panel.reel/loading-panel.html | 89 + .../ui/loading-panel.reel/loading-panel.js | 38 + .../montage-user/ui/loading.reel/loading-0.svg | 3 + .../montage-user/ui/loading.reel/loading-1.svg | 3 + .../montage-user/ui/loading.reel/loading-2.svg | 3 + .../montage-user/ui/loading.reel/loading-3.svg | 3 + .../montage-user/ui/loading.reel/loading-4.svg | 3 + .../montage-user/ui/loading.reel/loading-5.svg | 3 + .../montage-user/ui/loading.reel/loading-bg.svg | 31 + .../montage-user/ui/loading.reel/loading.css | 78 + .../montage-user/ui/loading.reel/loading.html | 36 + .../montage-user/ui/loading.reel/loading.js | 61 + node_modules/montage-user/ui/native-control.js | 240 ++ .../ui/nearest-neighbor-component-search.js | 226 ++ .../ui/number-input.reel/number-input.js | 17 + .../montage-user/ui/popup/alert.reel/alert.css | 67 + .../montage-user/ui/popup/alert.reel/alert.html | 120 + .../montage-user/ui/popup/alert.reel/alert.js | 134 + .../montage-user/ui/popup/confirm.reel/confirm.css | 17 + .../ui/popup/confirm.reel/confirm.html | 120 + .../montage-user/ui/popup/confirm.reel/confirm.js | 186 + .../ui/popup/notifier.reel/notifier.css | 15 + .../ui/popup/notifier.reel/notifier.html | 35 + .../ui/popup/notifier.reel/notifier.js | 121 + .../montage-user/ui/popup/popup.reel/popup.css | 70 + .../montage-user/ui/popup/popup.reel/popup.html | 54 + .../montage-user/ui/popup/popup.reel/popup.js | 519 +++ .../montage-user/ui/progress.reel/progress.css | 51 + .../montage-user/ui/progress.reel/progress.html | 32 + .../montage-user/ui/progress.reel/progress.js | 139 + .../montage-user/ui/progress.reel/rule.png | Bin 0 -> 956 bytes .../montage-user/ui/progress.reel/scroll.png | Bin 0 -> 272 bytes .../ui/radio-button.reel/radio-button.js | 97 + .../ui/range-input.reel/range-input.js | 24 + .../montage-user/ui/repetition.reel/repetition.js | 1156 ++++++ .../ui/scroll-bars.reel/scroll-bars.html | 117 + .../ui/scroll-bars.reel/scroll-bars.js | 241 ++ node_modules/montage-user/ui/scroll.js | 814 ++++ .../montage-user/ui/scroller.reel/scroller.html | 112 + .../montage-user/ui/scroller.reel/scroller.js | 253 ++ .../montage-user/ui/scrollview.reel/scrollview.js | 1230 ++++++ .../ui/select-input.reel/select-input.js | 320 ++ node_modules/montage-user/ui/slot.reel/slot.js | 302 ++ .../ui/substitution.reel/substitution.js | 91 + node_modules/montage-user/ui/tabs.reel/tabs.css | 126 + node_modules/montage-user/ui/tabs.reel/tabs.html | 80 + node_modules/montage-user/ui/tabs.reel/tabs.js | 177 + node_modules/montage-user/ui/template.js | 799 ++++ node_modules/montage-user/ui/text-input.js | 304 ++ .../montage-user/ui/textarea.reel/textarea.js | 37 + .../montage-user/ui/textfield.reel/textfield.js | 17 + .../ui/toggle-button.reel/toggle-button.js | 171 + .../ui/toggle-switch.reel/toggle-switch.css | 162 + .../ui/toggle-switch.reel/toggle-switch.html | 16 + .../ui/toggle-switch.reel/toggle-switch.js | 424 +++ .../video-player.reel/images/fullscreen-enter.png | Bin 0 -> 1178 bytes .../video-player.reel/images/fullscreen-exit.png | Bin 0 -> 1214 bytes .../ui/video-player.reel/images/pause.png | Bin 0 -> 1040 bytes .../ui/video-player.reel/images/play.png | Bin 0 -> 1375 bytes .../ui/video-player.reel/images/volume-down.png | Bin 0 -> 991 bytes .../ui/video-player.reel/images/volume-up.png | Bin 0 -> 1094 bytes .../ui/video-player.reel/video-player.css | 313 ++ .../ui/video-player.reel/video-player.html | 371 ++ .../ui/video-player.reel/video-player.js | 368 ++ 197 files changed, 50421 insertions(+) create mode 100755 node_modules/montage-user/core/bitfield.js create mode 100755 node_modules/montage-user/core/converter/bytes-converter.js create mode 100755 node_modules/montage-user/core/converter/converter.js create mode 100755 node_modules/montage-user/core/converter/currency-converter.js create mode 100755 node_modules/montage-user/core/converter/date-converter.js create mode 100755 node_modules/montage-user/core/converter/lower-case-converter.js create mode 100755 node_modules/montage-user/core/converter/new-line-to-br-converter.js create mode 100755 node_modules/montage-user/core/converter/number-converter.js create mode 100755 node_modules/montage-user/core/converter/trim-converter.js create mode 100755 node_modules/montage-user/core/converter/upper-case-converter.js create mode 100755 node_modules/montage-user/core/core.js create mode 100755 node_modules/montage-user/core/deserializer.js create mode 100755 node_modules/montage-user/core/enum.js create mode 100755 node_modules/montage-user/core/event/action-event-listener.js create mode 100755 node_modules/montage-user/core/event/binding.js create mode 100755 node_modules/montage-user/core/event/event-manager.js create mode 100755 node_modules/montage-user/core/event/mutable-event.js create mode 100755 node_modules/montage-user/core/exception.js create mode 100755 node_modules/montage-user/core/gate.js create mode 100755 node_modules/montage-user/core/geometry/cubic-bezier.js create mode 100755 node_modules/montage-user/core/geometry/point.js create mode 100755 node_modules/montage-user/core/jshint.js create mode 100755 node_modules/montage-user/core/logger.js create mode 100644 node_modules/montage-user/core/next-tick.js create mode 100755 node_modules/montage-user/core/promise.js create mode 100755 node_modules/montage-user/core/serializer.js create mode 100755 node_modules/montage-user/core/shim.js create mode 100755 node_modules/montage-user/core/shim/array.js create mode 100644 node_modules/montage-user/core/shim/immediate.js create mode 100755 node_modules/montage-user/core/shim/string.js create mode 100755 node_modules/montage-user/core/shim/structures.js create mode 100755 node_modules/montage-user/core/shim/weak-map.js create mode 100755 node_modules/montage-user/core/state-chart.js create mode 100644 node_modules/montage-user/core/undo-manager.js create mode 100644 node_modules/montage-user/core/url.js create mode 100755 node_modules/montage-user/core/uuid.js create mode 100755 node_modules/montage-user/data/blueprint.js create mode 100755 node_modules/montage-user/data/context.js create mode 100755 node_modules/montage-user/data/controllistener.js create mode 100755 node_modules/montage-user/data/ldapaccess/ldapblueprint.js create mode 100755 node_modules/montage-user/data/ldapaccess/ldapobjectid.js create mode 100755 node_modules/montage-user/data/ldapaccess/ldapselectorevaluator.js create mode 100755 node_modules/montage-user/data/ldapaccess/ldapstore.js create mode 100755 node_modules/montage-user/data/nosqlaccess/nosqlblueprint.js create mode 100755 node_modules/montage-user/data/nosqlaccess/nosqlobjectid.js create mode 100755 node_modules/montage-user/data/nosqlaccess/nosqlselectorevaluator.js create mode 100755 node_modules/montage-user/data/nosqlaccess/nosqlstore.js create mode 100755 node_modules/montage-user/data/objectid.js create mode 100755 node_modules/montage-user/data/objectproperty.js create mode 100755 node_modules/montage-user/data/pledge.js create mode 100755 node_modules/montage-user/data/query.js create mode 100755 node_modules/montage-user/data/restaccess/restblueprint.js create mode 100755 node_modules/montage-user/data/restaccess/restobjectid.js create mode 100755 node_modules/montage-user/data/restaccess/restselectorevaluator.js create mode 100755 node_modules/montage-user/data/restaccess/reststore.js create mode 100755 node_modules/montage-user/data/restriction.js create mode 100755 node_modules/montage-user/data/selector.js create mode 100755 node_modules/montage-user/data/sqlaccess/sqlblueprint.js create mode 100755 node_modules/montage-user/data/sqlaccess/sqlobjectid.js create mode 100755 node_modules/montage-user/data/sqlaccess/sqlselectorevaluator.js create mode 100755 node_modules/montage-user/data/sqlaccess/sqlstore.js create mode 100755 node_modules/montage-user/data/store.js create mode 100755 node_modules/montage-user/data/transactionid.js create mode 100755 node_modules/montage-user/montage.js create mode 100644 node_modules/montage-user/node.js create mode 100755 node_modules/montage-user/package.json create mode 100755 node_modules/montage-user/require/browser.js create mode 100644 node_modules/montage-user/require/node.js create mode 100755 node_modules/montage-user/require/require.js create mode 100755 node_modules/montage-user/service/service.js create mode 100644 node_modules/montage-user/ui/anchor.reel/anchor.js create mode 100755 node_modules/montage-user/ui/application.js create mode 100644 node_modules/montage-user/ui/bluemoon/button-group.reel/button-group.css create mode 100644 node_modules/montage-user/ui/bluemoon/button-group.reel/button-group.html create mode 100644 node_modules/montage-user/ui/bluemoon/button-group.reel/button-group.js create mode 100644 node_modules/montage-user/ui/bluemoon/button.reel/button.css create mode 100644 node_modules/montage-user/ui/bluemoon/button.reel/button.html create mode 100644 node_modules/montage-user/ui/bluemoon/button.reel/button.js create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkbox.css create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkbox.html create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkbox.js create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkmark-dark-disabled.svg create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkmark-dark.svg create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkmark-light-disabled.svg create mode 100644 node_modules/montage-user/ui/bluemoon/checkbox.reel/checkmark.svg create mode 100644 node_modules/montage-user/ui/bluemoon/progress.reel/progress.css create mode 100644 node_modules/montage-user/ui/bluemoon/progress.reel/progress.html create mode 100644 node_modules/montage-user/ui/bluemoon/progress.reel/progress.js create mode 100644 node_modules/montage-user/ui/bluemoon/progress.reel/rule.png create mode 100644 node_modules/montage-user/ui/bluemoon/progress.reel/scroll.png create mode 100644 node_modules/montage-user/ui/bluemoon/slider.reel/slider.css create mode 100644 node_modules/montage-user/ui/bluemoon/slider.reel/slider.html create mode 100644 node_modules/montage-user/ui/bluemoon/slider.reel/slider.js create mode 100644 node_modules/montage-user/ui/bluemoon/textarea.reel/textarea.css create mode 100644 node_modules/montage-user/ui/bluemoon/textarea.reel/textarea.html create mode 100644 node_modules/montage-user/ui/bluemoon/textarea.reel/textarea.js create mode 100644 node_modules/montage-user/ui/bluemoon/textfield.reel/textfield.css create mode 100644 node_modules/montage-user/ui/bluemoon/textfield.reel/textfield.html create mode 100644 node_modules/montage-user/ui/bluemoon/textfield.reel/textfield.js create mode 100644 node_modules/montage-user/ui/bluemoon/toggle.reel/toggle.css create mode 100644 node_modules/montage-user/ui/bluemoon/toggle.reel/toggle.html create mode 100644 node_modules/montage-user/ui/bluemoon/toggle.reel/toggle.js create mode 100644 node_modules/montage-user/ui/button.reel/button.js create mode 100644 node_modules/montage-user/ui/check-input.js create mode 100644 node_modules/montage-user/ui/checkbox.reel/checkbox.js create mode 100755 node_modules/montage-user/ui/component-group.reel/component-group.js create mode 100755 node_modules/montage-user/ui/component-placeholder.reel/component-placeholder.js create mode 100755 node_modules/montage-user/ui/component.js create mode 100644 node_modules/montage-user/ui/composer/composer.js create mode 100644 node_modules/montage-user/ui/composer/long-press-composer.js create mode 100644 node_modules/montage-user/ui/composer/swipe-composer.js create mode 100644 node_modules/montage-user/ui/composer/translate-composer.js create mode 100755 node_modules/montage-user/ui/condition.reel/condition.js create mode 100755 node_modules/montage-user/ui/controller/array-controller.js create mode 100755 node_modules/montage-user/ui/controller/media-controller.js create mode 100755 node_modules/montage-user/ui/controller/object-controller.js create mode 100755 node_modules/montage-user/ui/controller/paged-array-controller.js create mode 100644 node_modules/montage-user/ui/date-input.reel/date-input.js create mode 100755 node_modules/montage-user/ui/dom.js create mode 100755 node_modules/montage-user/ui/dynamic-text.reel/dynamic-text.js create mode 100755 node_modules/montage-user/ui/editable-text.js create mode 100644 node_modules/montage-user/ui/flow-path-cubic.js create mode 100644 node_modules/montage-user/ui/flow-path-lerp.js create mode 100644 node_modules/montage-user/ui/flow-path-linear.js create mode 100644 node_modules/montage-user/ui/flow-path-sigmoid.js create mode 100644 node_modules/montage-user/ui/flow-path.js create mode 100644 node_modules/montage-user/ui/flow.reel/flow.html create mode 100644 node_modules/montage-user/ui/flow.reel/flow.js create mode 100755 node_modules/montage-user/ui/image.reel/image.js create mode 100755 node_modules/montage-user/ui/list.reel/list.html create mode 100755 node_modules/montage-user/ui/list.reel/list.js create mode 100755 node_modules/montage-user/ui/loader.reel/loader.js create mode 100755 node_modules/montage-user/ui/loading-panel.reel/loading-panel.css create mode 100755 node_modules/montage-user/ui/loading-panel.reel/loading-panel.html create mode 100755 node_modules/montage-user/ui/loading-panel.reel/loading-panel.js create mode 100755 node_modules/montage-user/ui/loading.reel/loading-0.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-1.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-2.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-3.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-4.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-5.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading-bg.svg create mode 100755 node_modules/montage-user/ui/loading.reel/loading.css create mode 100755 node_modules/montage-user/ui/loading.reel/loading.html create mode 100755 node_modules/montage-user/ui/loading.reel/loading.js create mode 100644 node_modules/montage-user/ui/native-control.js create mode 100644 node_modules/montage-user/ui/nearest-neighbor-component-search.js create mode 100644 node_modules/montage-user/ui/number-input.reel/number-input.js create mode 100755 node_modules/montage-user/ui/popup/alert.reel/alert.css create mode 100755 node_modules/montage-user/ui/popup/alert.reel/alert.html create mode 100755 node_modules/montage-user/ui/popup/alert.reel/alert.js create mode 100755 node_modules/montage-user/ui/popup/confirm.reel/confirm.css create mode 100755 node_modules/montage-user/ui/popup/confirm.reel/confirm.html create mode 100755 node_modules/montage-user/ui/popup/confirm.reel/confirm.js create mode 100755 node_modules/montage-user/ui/popup/notifier.reel/notifier.css create mode 100755 node_modules/montage-user/ui/popup/notifier.reel/notifier.html create mode 100755 node_modules/montage-user/ui/popup/notifier.reel/notifier.js create mode 100755 node_modules/montage-user/ui/popup/popup.reel/popup.css create mode 100755 node_modules/montage-user/ui/popup/popup.reel/popup.html create mode 100755 node_modules/montage-user/ui/popup/popup.reel/popup.js create mode 100755 node_modules/montage-user/ui/progress.reel/progress.css create mode 100755 node_modules/montage-user/ui/progress.reel/progress.html create mode 100755 node_modules/montage-user/ui/progress.reel/progress.js create mode 100755 node_modules/montage-user/ui/progress.reel/rule.png create mode 100755 node_modules/montage-user/ui/progress.reel/scroll.png create mode 100755 node_modules/montage-user/ui/radio-button.reel/radio-button.js create mode 100644 node_modules/montage-user/ui/range-input.reel/range-input.js create mode 100755 node_modules/montage-user/ui/repetition.reel/repetition.js create mode 100644 node_modules/montage-user/ui/scroll-bars.reel/scroll-bars.html create mode 100644 node_modules/montage-user/ui/scroll-bars.reel/scroll-bars.js create mode 100755 node_modules/montage-user/ui/scroll.js create mode 100644 node_modules/montage-user/ui/scroller.reel/scroller.html create mode 100644 node_modules/montage-user/ui/scroller.reel/scroller.js create mode 100755 node_modules/montage-user/ui/scrollview.reel/scrollview.js create mode 100644 node_modules/montage-user/ui/select-input.reel/select-input.js create mode 100755 node_modules/montage-user/ui/slot.reel/slot.js create mode 100755 node_modules/montage-user/ui/substitution.reel/substitution.js create mode 100755 node_modules/montage-user/ui/tabs.reel/tabs.css create mode 100755 node_modules/montage-user/ui/tabs.reel/tabs.html create mode 100755 node_modules/montage-user/ui/tabs.reel/tabs.js create mode 100755 node_modules/montage-user/ui/template.js create mode 100644 node_modules/montage-user/ui/text-input.js create mode 100644 node_modules/montage-user/ui/textarea.reel/textarea.js create mode 100644 node_modules/montage-user/ui/textfield.reel/textfield.js create mode 100644 node_modules/montage-user/ui/toggle-button.reel/toggle-button.js create mode 100755 node_modules/montage-user/ui/toggle-switch.reel/toggle-switch.css create mode 100755 node_modules/montage-user/ui/toggle-switch.reel/toggle-switch.html create mode 100644 node_modules/montage-user/ui/toggle-switch.reel/toggle-switch.js create mode 100755 node_modules/montage-user/ui/video-player.reel/images/fullscreen-enter.png create mode 100755 node_modules/montage-user/ui/video-player.reel/images/fullscreen-exit.png create mode 100755 node_modules/montage-user/ui/video-player.reel/images/pause.png create mode 100755 node_modules/montage-user/ui/video-player.reel/images/play.png create mode 100755 node_modules/montage-user/ui/video-player.reel/images/volume-down.png create mode 100755 node_modules/montage-user/ui/video-player.reel/images/volume-up.png create mode 100755 node_modules/montage-user/ui/video-player.reel/video-player.css create mode 100755 node_modules/montage-user/ui/video-player.reel/video-player.html create mode 100755 node_modules/montage-user/ui/video-player.reel/video-player.js diff --git a/node_modules/montage-user/core/bitfield.js b/node_modules/montage-user/core/bitfield.js new file mode 100755 index 00000000..2c274d3c --- /dev/null +++ b/node_modules/montage-user/core/bitfield.js @@ -0,0 +1,199 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + Defines the BitField class, that compactly stores multiple values as a short series of bits. + @module montage/core/bitfield + @requires montage/core/core + */ + +var Montage = require("montage").Montage; + + +/** + The BitField object compactly stores multiple values as a short series of bits. This implementation is limited to 32 fields. + @class module:montage/core/bitfield.BitField + @classdesc Compactly stores multiple values as a short series of bits. + @extends module:montage/core/core.Montage + */ +var BitField = exports.BitField = Montage.create(Montage, /** @lends module:montage/core/bitfield.BitField# */ { + + /** + Creates a new BitField object containing the fields provided in the propertyDescriptor parameter. + @function + @param {Object} propertyDescriptor An object containing one or more property name/value pairs. Each pair is added to the new BitField. + @returns {Object} A new BitField object that contains fields described by the property descriptor. + @example var bitField = BitField.create(); + bitField = BitField.create().initWithDescriptor({ + likes_golf: { + value: false + }, + likes_basketball: { + value: true + }, + likes_baseball: { + value: false + }, + }); + */ + initWithDescriptor: { + enumerable: false, + value: function(propertyDescriptor) { + var fieldName; + this.reset(); + for (fieldName in propertyDescriptor) { + this.addField(fieldName, propertyDescriptor[fieldName].value); + } + return this; + } + }, + + /** + Adds a new field to a BitField instance. + @function + @param {String} aFieldName The name of the field to add. + @param {Mixed} defaultValue The new field's default value. + */ + addField: { + enumerable: false, + value: function(aFieldName, defaultValue) { + if (aFieldName in this) { + return; + } + if (this._fieldCount >= 32) { + throw "BitField 32 fields limit reached."; + } + //We try to recycle slots as limited to 32bits + this._trueValue += (this._fields[aFieldName] = this._constantsToReuse.length ? this._constantsToReuse.shift() : (1 << this._fieldCount)); + Montage.defineProperty(this, aFieldName, { + enumerable: true, + get: function() { + return (this._value === this._trueValue); + }, + set: function(value) { + value ? (this._value |= this._fields[aFieldName]) : (this._value &= ~ (this._fields[aFieldName])); + if (this.value) { + this.callDelegateMethod(); + } + } + }); + this._fieldCount++; + if (!! defaultValue) { + this[aFieldName] = true; + } + } + }, + + /** + @private + */ + _constantsToReuse: { + enumerable: false, + value: [] + }, + + /** + Removes a field from the bitfield. + @function + @param {String} aFieldName The name of the field to remove. + */ + removeField: { + enumerable: false, + value: function(aFieldName) { + delete this[aFieldName]; + this._constantsToReuse.push(this._fields[aFieldName]); + this._trueValue -= this._fields[aFieldName]; + delete this._fields[aFieldName]; + } + }, + + /** + The BitField object's delegate. + @type {Property} + @default null + */ + delegate: { + enumerable: false, + value: null + }, + + /** + @function + @returns Nothing + */ + callDelegateMethod: { + value: function() { + var delegateMethod; + if (this.delegate && typeof (delegateMethod = this.delegate.bitFieldDidBecomeTrue) === "function") { + delegateMethod.call(this.delegate, this); + } + }, + enumerable: false + }, +/** + @type {Function} + @default {Number} 0 + */ + value: { + enumerable: false, + get: function() { + return (this._value === this._trueValue); + } + }, + + /** + @private + */ + _fieldCount: { + enumerable: false, + value: 0 + }, +/** + @private +*/ + _value: { + enumerable: false, + value: 0 + }, +/** + @private +*/ + _trueValue: { + enumerable: false, + value: 0 + }, +/** + @function + */ + reset: { + enumerable: false, + value: function() { + this._value = 0x0; + } + }, +/** + @private +*/ + _fields: { + enumerable: false, + value: {} + }, +/** + @function + @returns result + */ + toString: { + value: function() { + var fieldNames = this._fields, + i, + iField, + result = ""; + for (i = 0; (iField = fieldNames[i]); i++) { + result += iField + "[" + (this._value & fieldNames[iField]) + "], "; + } + return result; + } + } +}); diff --git a/node_modules/montage-user/core/converter/bytes-converter.js b/node_modules/montage-user/core/converter/bytes-converter.js new file mode 100755 index 00000000..1626f352 --- /dev/null +++ b/node_modules/montage-user/core/converter/bytes-converter.js @@ -0,0 +1,123 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module montage/core/converter/bytes-converter + @requires montage/core/core + @requires montage/core/converter/converter + @requires montage/core/converter/number-converter +*/ +var Montage = require("montage").Montage; +var Converter = require('core/converter/converter').Converter; +var _numericValueToString = require("core/converter/number-converter")._numericValueToString; +var _stringToNumericValue = require("core/converter/number-converter")._stringToNumericValue; +var NUMERIC_SCALES_BINARY_ = require("core/converter/number-converter").NUMERIC_SCALES_BINARY_; +var isDef = require('core/converter/converter').isDef; + +/** + @private +*/ +var NUMERIC_SCALE_PREFIXES_BYTES = [ + 'P', 'T', 'G', 'M', 'K', '', 'm', 'u', 'n' +]; + +/** + Converts a string to number of bytes, taking into account the units. + Binary conversion. + @function + @param {string} stringValue String to be converted to numeric value. + @return {number} Numeric value for string. + @private + */ +var stringToNumBytes = function(stringValue) { + return _stringToNumericValue(stringValue, NUMERIC_SCALES_BINARY_); +}; + +/** + Converts number of bytes to string representation. Binary conversion. + Default is to return the additional 'B' suffix, e.g. '10.5KB' to minimize confusion with counts that are scaled by powers of 1000. + @function + @param {Number} val Value to be converted. + @param {Number} opt_decimals The number of decimals to use. Defaults to 2. + @param {Boolean} opt_suffix If true, include trailing 'B' in returned string. Default is true. + @return {String} String representation of number of bytes. + @private + */ +var numBytesToString = function(val, opt_decimals, opt_suffix) { + var suffix = ''; + if (!isDef(opt_suffix) || opt_suffix) { + suffix = 'B'; + } + return _numericValueToString(val, NUMERIC_SCALES_BINARY_, opt_decimals, suffix, NUMERIC_SCALE_PREFIXES_BYTES); +}; + +/** + Formats a number of bytes in human readable form: 54, 450K, 1.3M, 5G etc. + @function + @param {Number} bytes The number of bytes to show. + @param {Number} opt_decimals The number of decimals to use. Defaults to 2. + @return {String} The human readable form of the byte size. + @private + */ +var fileSize = function(bytes, opt_decimals) { + return numBytesToString(bytes, opt_decimals, false); +}; + +/** + @class module:montage/core/converter/bytes-converter.BytesConverter + @classdesc Converts a numeric value to byte format (for example, 2048 is converted to 2MB). + @extends module:montage/core/converter.Converter + */ +exports.BytesConverter = Montage.create(Converter, /** @lends module:montage/core/converter/bytes-converter.BytesConverter# */ { + + /** + The number of decimals to include in the formatted value. Default is 2. + @type {Property} + @default {Number} 2 + */ + decimals: { + value: 2 + }, + /** + Converts the specified value to byte format. + @function + @param {Property} v The value to format. + @returns {String} The value converted to byte format. + @example + var Converter= require("core/converter/converter").Converter; + var BytesConverter = require("core/converter/converter").BytesConverter; + var bytes = "12341234"; + var byteconverter = BytesConverter.create(); + console.log("Converted: " + byteconverter.convert(bytes)); + console.log("Reverted: " + byteconverter.revert(bytes)); + // Converted: 11.77MB + // Reverted: 12341234 + */ + convert: { + value: function(v) { + return fileSize(v, this.decimals); + } + }, + /** + Reverts a formatted byte string to a standard number. + @function + @param {String} v The value to revert. + @returns {String} v + @see module:montage/converter.BytesConverter#convert + @example + var Converter= require("core/converter/converter").Converter; + var BytesConverter = require("core/converter/converter").BytesConverter; + var bytes = "11.77MB"; + var byteconverter = BytesConverter.create(); + console.log("Reverted: " + byteconverter.revert(bytes)); + // Reverted: 12341234 + */ + revert: { + value: function(v) { + return v; + } + } +}); + diff --git a/node_modules/montage-user/core/converter/converter.js b/node_modules/montage-user/core/converter/converter.js new file mode 100755 index 00000000..abce44e2 --- /dev/null +++ b/node_modules/montage-user/core/converter/converter.js @@ -0,0 +1,144 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + Provides common conversion, validation, and formatting functions for different types of values. + @module montage/core/converter/converter + @requires montage/core/core + */ +var Montage = require("montage").Montage; + + +var FUNCTION_CLASS = '[object Function]', + BOOLEAN_CLASS = '[object Boolean]', + NUMBER_CLASS = '[object Number]', + STRING_CLASS = '[object String]', + ARRAY_CLASS = '[object Array]', + DATE_CLASS = '[object Date]'; + +var _toString = Object.prototype.toString; + +// TODO should maybe move these into String.isString and Number.isNumber to parallel Array.isArray + +/** + @exports module:montage/core/converter#isString + @function +*/ +var isString = function(object) { + return _toString.call(object) === STRING_CLASS; +}; +exports.isString = isString; + +/** + @exports module:montage/core/converter#isNumber + @function +*/ +var isNumber = function(object) { + return _toString.call(object) === NUMBER_CLASS; +}; +exports.isNumber = isNumber; + + +/** + @exports module:montage/core/converter#isDef + @function +*/ +var isDef = function(obj) { + return (obj && typeof obj !== 'undefined'); +}; +exports.isDef = isDef; + + +var startsWith = exports.startsWith = function(str) { + return str.lastIndexOf(prefix, 0) === 0; +}; +var endsWith = exports.endsWith = function(str) { + var l = str.length - suffix.length; + return l >= 0 && str.indexOf(suffix, l) == l; +}; + +/** + Truncates a string to a certain length and adds '...' if necessary.
+ The length also accounts for the ellipsis, so a maximum length of 10 and a string
+ 'Hello World!' produces 'Hello W...'. + @function + @param {String} str The string to truncate. + @param {Number} chars Max number of characters. + @param {Boolean} opt_protectEscapedCharacters Whether to protect escaped characters from being cut off in the middle. + @return {String} The truncated {@code str} string. + */ +var truncate = exports.truncate = function(str, chars, opt_protectEscapedCharacters) { + if (opt_protectEscapedCharacters) { + goog.string.unescapeEntities(this); + } + + if (str.length > chars) { + return str.substring(0, chars - 3) + '…'; + } + + if (opt_protectEscapedCharacters) { + str.htmlEscape(this); + } + + return this; +}; + + +// Validators +/** + Base validator object. + @class module:montage/core/converter.Validator + @extends module:montage/core/core.Montage + */ +var Validator = exports.Validator = Montage.create(Montage, /** @lends module:montage/core/converter.Validator# */{ +/** + @type {Object} + @default null + */ + validate: { + value: null + } +}); + + +// Converters + +/** + @class module:montage/core/converter.Converter + @classdesc The base Converter class that is extended by specific converter classes. A Converter has two primary methods: + + */ +var Converter = exports.Converter = Montage.create(Montage, /** @lends module:montage/core/converter.Converter# */ { + + /** + Specifies whether the converter allows partial conversion. + @type {Property} + @default {Boolean} true + */ + allowPartialConversion: { + value: true + }, + + /** + @type {Property} + @default null + */ + convert: { + enumerable: false, + value: null + }, +/** + @type {Property} + @default null + */ + revert: { + enumerable: false, + value: null + } +}); + diff --git a/node_modules/montage-user/core/converter/currency-converter.js b/node_modules/montage-user/core/converter/currency-converter.js new file mode 100755 index 00000000..bba81dc1 --- /dev/null +++ b/node_modules/montage-user/core/converter/currency-converter.js @@ -0,0 +1,77 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + @module montage/core/converter/currency-converter + @requires montage/core/core + @requires montage/core/converter/converter + @requires montage/core/converter/number-converter +*/ +var Montage = require("montage").Montage; +var Converter = require('core/converter/converter'); +var numericValueToString = require("core/converter/number-converter").numericValueToString; +var NumberConverter = require("core/converter/number-converter").NumberConverter; +/** + Formats a number as a human-readable currency value. + @function module:montage/core/converter/currency-converter.#formatCurrency + @param {Property} value + @param {String} currency + @param {Number} decimals + @param {String} useParensForNegative + @returns stringValue +*/ +var formatCurrency = function(value, currency, decimals, useParensForNegative) { + var stringValue = numericValueToString(value, decimals); + currency = currency || '$'; + if ((value < 0) && useParensForNegative) { + stringValue = '(' + stringValue.substring(1, stringValue.length) + ')'; + } + + stringValue = stringValue + ' ' + currency; + return stringValue; +}; +/** + @class module:montage/core/converter/currency-converter.CurrencyConverter + @classdesc Formats a value as a currency. + @extends module:montage/core/converter/number-converter.NumberConverter + */ +exports.CurrencyConverter = Montage.create(NumberConverter, /** @lends module:montage/core/converter.CurrencyConverter# */ { + + /** + @type {Property} + @default {String} '$' + */ + currency: { + value: '$' + }, + + /** + @type {Property} + @default {Number} 2 + */ + decimals: { + value: 2 + }, + + /** + @type {Property} + @default {Boolean} false + */ + useParensForNegative: { + value: false + }, + + /** + @function + @param {String} v + @returns {string} The formatted currency value. + */ + convert: { + value: function(v) { + return formatCurrency(v, this.currency, this.decimals, this.useParensForNegative); + } + } + +}); diff --git a/node_modules/montage-user/core/converter/date-converter.js b/node_modules/montage-user/core/converter/date-converter.js new file mode 100755 index 00000000..f0d3e540 --- /dev/null +++ b/node_modules/montage-user/core/converter/date-converter.js @@ -0,0 +1,2630 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + /** + @version: 1.0 Alpha-1 + @author: Coolite Inc. http://www.coolite.com/ + @date: 2008-04-13 + @copyright: Copyright (c) 2006-2008, Coolite Inc. (http://www.coolite.com/). All rights reserved. + @license: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. + @website: http://www.datejs.com/ + */ +/** + @module montage/core/converter/date-converter + @requires montage/core/core + @requires montage/core/converter/converter +*/ +var Montage = require("montage").Montage, + Converter = require("core/converter/converter").Converter, + Validator = require("core/converter/converter").Validator; + +(function () { + var $D = Date, + $P = $D.prototype, + $C = $D.CultureInfo, + p = function (s, l) { + if (!l) { + l = 2; + } + return ("000" + s).slice(l * -1); + }; + + /** + Resets the time of this Date object to 12:00 AM (00:00), which is the start of the day. + @function + @param {Boolean} .clone() this date instance before clearing Time + @return {Date} itself + */ + $P.clearTime = function () { + this.setHours(0); + this.setMinutes(0); + this.setSeconds(0); + this.setMilliseconds(0); + return this; + }; + + /** + * Resets the time of this Date object to the current time ('now'). + @function + @return {Date} itself + */ + $P.setTimeToNow = function () { + var n = new Date(); + this.setHours(n.getHours()); + this.setMinutes(n.getMinutes()); + this.setSeconds(n.getSeconds()); + this.setMilliseconds(n.getMilliseconds()); + return this; + }; + + /** + Gets a date that is set to the current date. The time is set to the start of the day (00:00 or 12:00 AM). + @function + @return {Date} The current date. + */ + $D.today = function () { + return new Date().clearTime(); + }; + + /** + Compares the first date to the second date and returns an number indication of their relative values. + @function + @param {Date} First Date object to compare [Required]. + @param {Date} Second Date object to compare to [Required]. + @return {Number} -1 = date1 is lessthan date2. 0 = values are equal. 1 = date1 is greaterthan date2. + */ + $D.compare = function (date1, date2) { + if (isNaN(date1) || isNaN(date2)) { + throw new Error(date1 + " - " + date2); + } else if (date1 instanceof Date && date2 instanceof Date) { + return (date1 < date2) ? -1 : (date1 > date2) ? 1 : 0; + } else { + throw new TypeError(date1 + " - " + date2); + } + }; + + /** + Compares the first Date object to the second Date object and returns true if they are equal. + @function + @param {Date} First Date object to compare [Required] + @param {Date} Second Date object to compare to [Required] + @return {Boolean} true if dates are equal. false if they are not equal. + */ + $D.equals = function (date1, date2) { + return (date1.compareTo(date2) === 0); + }; + + /** + Gets the day number (0-6) if given a CultureInfo specific string which is a valid dayName, abbreviatedDayName or shortestDayName (two char). + @function + @param {String} The name of the day (eg. "Monday, "Mon", "tuesday", "tue", "We", "we"). + @return {Number} The day number + */ + $D.getDayNumberFromName = function (name) { + var n = $C.dayNames, m = $C.abbreviatedDayNames, o = $C.shortestDayNames, s = name.toLowerCase(); + for (var i = 0; i < n.length; i++) { + if (n[i].toLowerCase() == s || m[i].toLowerCase() == s || o[i].toLowerCase() == s) { + return i; + } + } + return -1; + }; + + /** + Gets the month number (0-11) if given a Culture Info specific string which is a valid monthName or abbreviatedMonthName. + @function + @param {String} The name of the month (eg. "February, "Feb", "october", "oct"). + @return {Number} The day number + */ + $D.getMonthNumberFromName = function (name) { + var n = $C.monthNames, m = $C.abbreviatedMonthNames, s = name.toLowerCase(); + for (var i = 0; i < n.length; i++) { + if (n[i].toLowerCase() == s || m[i].toLowerCase() == s) { + return i; + } + } + return -1; + }; + + /** + Determines if the current date instance is within a LeapYear. + @function + @param {Number} The year. + @return {Boolean} true if date is within a LeapYear, otherwise false. + */ + $D.isLeapYear = function (year) { + return ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); + }; + + /** + Gets the number of days in the month, given a year and month value. Automatically corrects for LeapYear. + @function + @param {Number} The year. + @param {Number} The month (0-11). + @return {Number} The number of days in the month. + */ + $D.getDaysInMonth = function (year, month) { + return [31, ($D.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; + }; + + /** + @function + @param {Number} offset + @returns null + */ + $D.getTimezoneAbbreviation = function (offset) { + var z = $C.timezones, p; + for (var i = 0; i < z.length; i++) { + if (z[i].offset === offset) { + return z[i].name; + } + } + return null; + }; + /** + @function + @param {String} name + @returns null + */ + $D.getTimezoneOffset = function (name) { + var z = $C.timezones, p; + for (var i = 0; i < z.length; i++) { + if (z[i].name === name.toUpperCase()) { + return z[i].offset; + } + } + return null; + }; + + /** + Returns a new Date object that is an exact date and time copy of the original instance. + @function + @return {Date} A new Date instance + */ + $P.clone = function () { + return new Date(this.getTime()); + }; + + /** + Compares this instance to a Date object and returns an number indication of their relative values. + @function + @param {Date} Date Object to compare [Required]. + @return {Number} -1 = This is less-than date. 0 = values are equal. 1 = this is greater-than date. + */ + $P.compareTo = function (date) { + return Date.compare(this, date); + }; + + /** + Compares this instance to another Date object and returns true if they are equal. + @function + @param {Date} Date Object to compare. If no date to compare, new Date() [now] is used. + @return {Boolean} true If dates are equal. False if they are not equal. + */ + $P.equals = function (date) { + return Date.equals(this, date || new Date()); + }; + + /** + Determines if this instance is between a range of two dates or equal to either the start or end dates. + @function + @param {Date} start Of range [Required] + @param {Date} end Of range [Required] + @return {Boolean} true This is between or equal to the start and end dates, else false. + */ + $P.between = function (start, end) { + return this.getTime() >= start.getTime() && this.getTime() <= end.getTime(); + }; + + /** + Determines if this date occurs after the date to compare to. + @function + @param {Date} Date object to compare. If no date to compare, new Date() ("now") is used. + @return {Boolean} true if this date instance is greater than the date to compare to (or "now"), otherwise false. + */ + $P.isAfter = function (date) { + return this.compareTo(date || new Date()) === 1; + }; + + /** + Determines if this date occurs before the date to compare to. + @function + @param {Date} date object to compare. If no date to compare, new Date() ("now") is used. + @return {Boolean} true if this date instance is less than the date to compare to (or "now"). + */ + $P.isBefore = function (date) { + return (this.compareTo(date || new Date()) === -1); + }; + + /* + Determines if the current Date instance occurs today. + @function + @return {Boolean} true if this date instance is 'today', otherwise false. + */ + + /** + Determines if the current Date instance occurs on the same Date as the supplied 'date'. + If no 'date' to compare to is provided, the current Date instance is compared to 'today'. + @function + @param {Date} date object to compare. If no date to compare, the current Date ("now") is used. + @return {Boolean} true if this Date instance occurs on the same Day as the supplied 'date'. + */ + $P.isToday = $P.isSameDay = function (date) { + return this.clone().clearTime().equals((date || new Date()).clone().clearTime()); + }; + + /** + Adds the specified number of milliseconds to this instance. + @function + @param {Number} value The number of milliseconds to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addMilliseconds = function (value) { + this.setMilliseconds(this.getMilliseconds() + value * 1); + return this; + }; + + /** + Adds the specified number of seconds to this instance. + @function + @param {Number} value The number of seconds to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addSeconds = function (value) { + return this.addMilliseconds(value * 1000); + }; + + /** + Adds the specified number of seconds to this instance. + @function + @param {Number} value The number of seconds to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addMinutes = function (value) { + return this.addMilliseconds(value * 60000); + /* 60*1000 */ + }; + + /** + Adds the specified number of hours to this instance. + @function + @param {Number} value The number of hours to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addHours = function (value) { + return this.addMilliseconds(value * 3600000); + /* 60*60*1000 */ + }; + + /** + Adds the specified number of days to this instance. + @function + @param {Number} value The number of days to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addDays = function (value) { + this.setDate(this.getDate() + value * 1); + return this; + }; + + /** + Adds the specified number of weeks to this instance. + @function + @param {Number} value The number of weeks to add. The number can be positive or negative [Required] + @return {Date} this.addDays(value * 7) + */ + $P.addWeeks = function (value) { + return this.addDays(value * 7); + }; + + /** + Adds the specified number of months to this instance. + @function + @param {Number} value The number of months to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addMonths = function (value) { + var n = this.getDate(); + this.setDate(1); + this.setMonth(this.getMonth() + value * 1); + this.setDate(Math.min(n, $D.getDaysInMonth(this.getFullYear(), this.getMonth()))); + return this; + }; + + /** + Adds the specified number of years to this instance. + @param {Number} value The number of years to add. The number can be positive or negative [Required] + @return {Date} this + */ + $P.addYears = function (value) { + return this.addMonths(value * 12); + }; + + /** + Adds (or subtracts) to the value of the years, months, weeks, days, hours, minutes, seconds, milliseconds of the date instance using given configuration object. Positive and Negative values allowed. + @function + @param {Object} config Configuration object containing attributes (months, days, etc.) + @return {Date} this + @example +

+         Date.today().add( { days: 1, months: 1 } )
+
+         new Date().add( { years: -1 } )
+        
+ */ + $P.add = function (config) { + if (typeof config == "number") { + this._orient = config; + return this; + } + + var x = config; + + if (x.milliseconds) { + this.addMilliseconds(x.milliseconds); + } + if (x.seconds) { + this.addSeconds(x.seconds); + } + if (x.minutes) { + this.addMinutes(x.minutes); + } + if (x.hours) { + this.addHours(x.hours); + } + if (x.weeks) { + this.addWeeks(x.weeks); + } + if (x.months) { + this.addMonths(x.months); + } + if (x.years) { + this.addYears(x.years); + } + if (x.days) { + this.addDays(x.days); + } + return this; + }; + + var $y, $m, $d; + + /** + Get the week number. Week one (1) is the week which contains the first Thursday of the year. Monday is considered the first day of the week. + This algorithm is a JavaScript port of the work presented by Claus Tøndering at http://www.tondering.dk/claus/cal/node8.html#SECTION00880000000000000000 + .getWeek() Algorithm Copyright (c) 2008 Claus Tondering. + The .getWeek() function does NOT convert the date to UTC. The local datetime is used. Please use .getISOWeek() to get the week of the UTC converted date. + @function + @return {Number} 1 to 53 + */ + $P.getWeek = function () { + var a, b, c, d, e, f, g, n, s, w; + + $y = (!$y) ? this.getFullYear() : $y; + $m = (!$m) ? this.getMonth() + 1 : $m; + $d = (!$d) ? this.getDate() : $d; + + if ($m <= 2) { + a = $y - 1; + b = (a / 4 | 0) - (a / 100 | 0) + (a / 400 | 0); + c = ((a - 1) / 4 | 0) - ((a - 1) / 100 | 0) + ((a - 1) / 400 | 0); + s = b - c; + e = 0; + f = $d - 1 + (31 * ($m - 1)); + } else { + a = $y; + b = (a / 4 | 0) - (a / 100 | 0) + (a / 400 | 0); + c = ((a - 1) / 4 | 0) - ((a - 1) / 100 | 0) + ((a - 1) / 400 | 0); + s = b - c; + e = s + 1; + f = $d + ((153 * ($m - 3) + 2) / 5) + 58 + s; + } + + g = (a + b) % 7; + d = (f + g - e) % 7; + n = (f + 3 - d) | 0; + + if (n < 0) { + w = 53 - ((g - s) / 5 | 0); + } else if (n > 364 + s) { + w = 1; + } else { + w = (n / 7 | 0) + 1; + } + + $y = $m = $d = null; + + return w; + }; + + /** + Get the ISO 8601 week number. Week one ("01") is the week which contains the first Thursday of the year. Monday is considered the first day of the week. + The .getISOWeek() function does convert the date to it's UTC value. Please use .getWeek() to get the week of the local date. + @function + @return {String} "01" to "53" + */ + $P.getISOWeek = function () { + $y = this.getUTCFullYear(); + $m = this.getUTCMonth() + 1; + $d = this.getUTCDate(); + return p(this.getWeek()); + }; + + /** + Moves the date to Monday of the week set. Week one (1) is the week which contains the first Thursday of the year. + @function + @param {Number} n A Number (1 to 53) that represents the week of the year. + @return {Date} this + */ + $P.setWeek = function (n) { + return this.moveToDayOfWeek(1).addWeeks(n - this.getWeek()); + }; + + // private +/** + @private +*/ + var validate = function (n, min, max, name) { + if (typeof n == "undefined") { + return false; + } else if (typeof n != "number") { + throw new TypeError(n + " is not a Number."); + } else if (n < min || n > max) { + throw new RangeError(n + " is not a valid value for " + name + "."); + } + return true; + }; + + /** + Validates the number is within an acceptable range for milliseconds [0-999]. + @function + @param {Number} value The number to check if within range. + @return {Boolean} true if within range, otherwise false. + */ + $D.validateMillisecond = function (value) { + return validate(value, 0, 999, "millisecond"); + }; + + /** + Validates the number is within an acceptable range for seconds [0-59]. + @function + @param {Number} value The number to check if within range. + @return {Boolean} true if within range, otherwise false. + */ + $D.validateSecond = function (value) { + return validate(value, 0, 59, "second"); + }; + + /** + Validates the number is within an acceptable range for minutes [0-59]. + @function + @param {Number} value The number to check if within range. + @return {Boolean} true if within range, otherwise false. + */ + $D.validateMinute = function (value) { + return validate(value, 0, 59, "minute"); + }; + + /** + Validates the number is within an acceptable range for hours [0-23]. + @function + @param {Number} value The number to check if within range. + @return {Boolean} true If within range, otherwise false. + */ + $D.validateHour = function (value) { + return validate(value, 0, 23, "hour"); + }; + + /** + Validates the number is within an acceptable range for the days in a month [0-MaxDaysInMonth]. + @function + @param {Number} value The number to check if within range. + @param {Number} year The number to check if within range. + @param {Number} month The number to check if within range. + @return {Boolean} true if within range, otherwise false. + */ + $D.validateDay = function (value, year, month) { + return validate(value, 1, $D.getDaysInMonth(year, month), "day"); + }; + + /** + Validates the number is within an acceptable range for months [0-11]. + @function + @param {Number} value The number to check if within range. + @return {Boolean} true if within range, otherwise false. + */ + $D.validateMonth = function (value) { + return validate(value, 0, 11, "month"); + }; + + /** + Validates the number is within an acceptable range for years. + @function + @param {Number} value The number to check if within range