summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2017-04-05 16:31:40 -0400
committerGitHub <noreply@github.com>2017-04-05 16:31:40 -0400
commit874775b15f894dc3be2bc7149a37a8099209c98a (patch)
tree13d26d7c418f627b2e6418458a25cf773cd5306b
parent8202c556cc8160f8d1dea952e673474e33c1ccce (diff)
parent321ad525d1c47e6719e84d76a06a966855fce453 (diff)
downloadsdl_core-feature/sdl_rc_functionality.tar.gz
Merge pull request #1445 from jacobkeeler/fix/revert_HMI_removalfeature/sdl_rc_functionality
Revert HMI removal on RC branch
-rw-r--r--src/appMain/CMakeLists.txt6
-rw-r--r--src/components/HMI/IVSU/PROPRIETARY_REQUEST1
-rw-r--r--src/components/HMI/app/AppViews.js113
-rw-r--r--src/components/HMI/app/Flags.js62
-rw-r--r--src/components/HMI/app/SDLApp.js80
-rw-r--r--src/components/HMI/app/StateManager.js284
-rw-r--r--src/components/HMI/app/controller/AppController.js36
-rw-r--r--src/components/HMI/app/controller/InfoController.js80
-rw-r--r--src/components/HMI/app/controller/MediaController.js83
-rw-r--r--src/components/HMI/app/controller/PhoneController.js82
-rw-r--r--src/components/HMI/app/controller/SettingsController.js338
-rw-r--r--src/components/HMI/app/controller/sdl/AppController.js215
-rw-r--r--src/components/HMI/app/controller/sdl/Controller.js942
-rw-r--r--src/components/HMI/app/controller/sdl/MediaController.js142
-rw-r--r--src/components/HMI/app/controller/sdl/NonMediaController.js114
-rw-r--r--src/components/HMI/app/controller/sdl/RPCController.js3069
-rwxr-xr-xsrc/components/HMI/app/controlls/AZERTYLayout.js264
-rw-r--r--src/components/HMI/app/controlls/Button.js169
-rw-r--r--src/components/HMI/app/controlls/Indicator.js134
-rw-r--r--src/components/HMI/app/controlls/Label.js55
-rw-r--r--src/components/HMI/app/controlls/List.js186
-rw-r--r--src/components/HMI/app/controlls/MenuList.js204
-rwxr-xr-xsrc/components/HMI/app/controlls/QWERTYLayout.js264
-rwxr-xr-xsrc/components/HMI/app/controlls/QWERTZLayout.js264
-rw-r--r--src/components/HMI/app/controlls/ScrollBar.js167
-rw-r--r--src/components/HMI/app/controlls/ScrollableText.js209
-rw-r--r--src/components/HMI/app/mixins/PresetEventCustom.js57
-rw-r--r--src/components/HMI/app/mixins/PresetEvents.js44
-rw-r--r--src/components/HMI/app/model/PhoneModel.js88
-rw-r--r--src/components/HMI/app/model/abstract/RangedValue.js137
-rw-r--r--src/components/HMI/app/model/media/CDModel.js43
-rw-r--r--src/components/HMI/app/model/sdl/AppModel.js452
-rw-r--r--src/components/HMI/app/model/sdl/MediaModel.js361
-rw-r--r--src/components/HMI/app/model/sdl/Model.js1564
-rw-r--r--src/components/HMI/app/model/sdl/NonMediaModel.js228
-rw-r--r--src/components/HMI/app/model/sdl/VehicleInfoModel.js501
-rw-r--r--src/components/HMI/app/util/Audio.js43
-rw-r--r--src/components/HMI/app/util/StreamAudio.js49
-rw-r--r--src/components/HMI/app/view/WarningView.js335
-rw-r--r--src/components/HMI/app/view/climateView.js56
-rw-r--r--src/components/HMI/app/view/home/bottomControls.js90
-rw-r--r--src/components/HMI/app/view/home/controlButtons.js579
-rw-r--r--src/components/HMI/app/view/home/statusClimateView.js66
-rw-r--r--src/components/HMI/app/view/home/statusInfoView.js60
-rw-r--r--src/components/HMI/app/view/home/statusMediaView.js99
-rw-r--r--src/components/HMI/app/view/home/statusNavigationView.js59
-rw-r--r--src/components/HMI/app/view/home/statusPhoneView.js68
-rw-r--r--src/components/HMI/app/view/home/topControls.js59
-rw-r--r--src/components/HMI/app/view/homeView.js40
-rw-r--r--src/components/HMI/app/view/info/alertsView.js118
-rw-r--r--src/components/HMI/app/view/info/appsView.js155
-rw-r--r--src/components/HMI/app/view/info/calendarView.js104
-rw-r--r--src/components/HMI/app/view/info/devicelistView.js142
-rw-r--r--src/components/HMI/app/view/info/nonMediaView.js264
-rw-r--r--src/components/HMI/app/view/info/servicesView.js54
-rw-r--r--src/components/HMI/app/view/info/travelLinkView.js164
-rw-r--r--src/components/HMI/app/view/infoView.js190
-rw-r--r--src/components/HMI/app/view/media/common/LeftMenuView.js82
-rw-r--r--src/components/HMI/app/view/media/playerView.js43
-rw-r--r--src/components/HMI/app/view/media/sdl/controllsView.js238
-rw-r--r--src/components/HMI/app/view/media/sdlmediaView.js110
-rw-r--r--src/components/HMI/app/view/mediaView.js49
-rw-r--r--src/components/HMI/app/view/navigationApp/baseNavigationView.js169
-rw-r--r--src/components/HMI/app/view/navigationAppView.js76
-rw-r--r--src/components/HMI/app/view/navigationView.js53
-rw-r--r--src/components/HMI/app/view/phone/dialpadView.js261
-rw-r--r--src/components/HMI/app/view/phoneView.js97
-rw-r--r--src/components/HMI/app/view/sdl/AlertManeuverPopUp.js184
-rw-r--r--src/components/HMI/app/view/sdl/AlertPopUp.js251
-rw-r--r--src/components/HMI/app/view/sdl/AudioPassThruPopUp.js184
-rw-r--r--src/components/HMI/app/view/sdl/ExitAppView.js133
-rw-r--r--src/components/HMI/app/view/sdl/PopUp.js160
-rw-r--r--src/components/HMI/app/view/sdl/SystemRequestView.js113
-rw-r--r--src/components/HMI/app/view/sdl/TTSPopUp.js168
-rw-r--r--src/components/HMI/app/view/sdl/VRHelpListView.js106
-rw-r--r--src/components/HMI/app/view/sdl/VRPopUp.js236
-rw-r--r--src/components/HMI/app/view/sdl/VehicleInfoView.js219
-rw-r--r--src/components/HMI/app/view/sdl/driverDistraction.js84
-rw-r--r--src/components/HMI/app/view/sdl/shared/AbstractView.js95
-rw-r--r--src/components/HMI/app/view/sdl/shared/interactionChoicesView.js395
-rw-r--r--src/components/HMI/app/view/sdl/shared/keyboard.js297
-rw-r--r--src/components/HMI/app/view/sdl/shared/optionsView.js132
-rw-r--r--src/components/HMI/app/view/sdl/shared/scrollableMessage.js148
-rw-r--r--src/components/HMI/app/view/sdl/shared/sliderView.js211
-rw-r--r--src/components/HMI/app/view/sdl/shared/tbtTurnList.js125
-rw-r--r--src/components/HMI/app/view/sdl/shared/turnByTurnView.js236
-rw-r--r--src/components/HMI/app/view/sdl/tbtClientStateView.js113
-rw-r--r--src/components/HMI/app/view/settings/policies/appPermissionsListView.js126
-rw-r--r--src/components/HMI/app/view/settings/policies/appPermissionsView.js136
-rw-r--r--src/components/HMI/app/view/settings/policies/deviceConfigView.js135
-rw-r--r--src/components/HMI/app/view/settings/policies/deviceStateChangeView.js113
-rw-r--r--src/components/HMI/app/view/settings/policies/statisticsInfoView.js88
-rw-r--r--src/components/HMI/app/view/settings/policies/systemErrorView.js88
-rw-r--r--src/components/HMI/app/view/settings/policiesView.js152
-rw-r--r--src/components/HMI/app/view/settingsView.js100
-rw-r--r--src/components/HMI/audio/alert.wavbin0 -> 37428 bytes
-rw-r--r--src/components/HMI/audio/initial.wavbin0 -> 46834 bytes
-rw-r--r--src/components/HMI/audio/listen.wavbin0 -> 11070 bytes
-rw-r--r--src/components/HMI/audio/positive.wavbin0 -> 20302 bytes
-rw-r--r--src/components/HMI/audio/say.wavbin0 -> 47292 bytes
-rw-r--r--src/components/HMI/css/buttonControls.css546
-rw-r--r--src/components/HMI/css/general.css1560
-rw-r--r--src/components/HMI/css/info.css671
-rw-r--r--src/components/HMI/css/mcs.css3703
-rw-r--r--src/components/HMI/css/media.css528
-rw-r--r--src/components/HMI/css/navigation.css102
-rw-r--r--src/components/HMI/css/phone.css300
-rw-r--r--src/components/HMI/css/sdl.css1254
-rw-r--r--src/components/HMI/css/settings.css129
-rw-r--r--src/components/HMI/ffw/BasicCommunicationRPC.js1339
-rw-r--r--src/components/HMI/ffw/ButtonsRPC.js347
-rw-r--r--src/components/HMI/ffw/Framework.js40
-rw-r--r--src/components/HMI/ffw/NavigationRPC.js382
-rw-r--r--src/components/HMI/ffw/RPCClient.js302
-rw-r--r--src/components/HMI/ffw/RPCObserver.js349
-rw-r--r--src/components/HMI/ffw/TTSRPC.js476
-rw-r--r--src/components/HMI/ffw/UIRPC.js1857
-rw-r--r--src/components/HMI/ffw/VRRPC.js520
-rw-r--r--src/components/HMI/ffw/VehicleInfoRPC.js481
-rw-r--r--src/components/HMI/ffw/WebSocket.js77
-rw-r--r--src/components/HMI/images/common/arr-r-disable.pngbin0 -> 1268 bytes
-rw-r--r--src/components/HMI/images/common/arr-r.pngbin0 -> 1467 bytes
-rw-r--r--src/components/HMI/images/common/arrow_ico.pngbin0 -> 1194 bytes
-rw-r--r--src/components/HMI/images/common/bt_bg.pngbin0 -> 1204 bytes
-rw-r--r--src/components/HMI/images/common/bt_bg_pressed.pngbin0 -> 1211 bytes
-rw-r--r--src/components/HMI/images/common/btn-28h-gray-active.pngbin0 -> 957 bytes
-rw-r--r--src/components/HMI/images/common/btn-28h.pngbin0 -> 1080 bytes
-rw-r--r--src/components/HMI/images/common/btn-48h-active-gray.pngbin0 -> 952 bytes
-rw-r--r--src/components/HMI/images/common/btn-48h-active.pngbin0 -> 972 bytes
-rw-r--r--src/components/HMI/images/common/btn-48h-pressed.pngbin0 -> 3011 bytes
-rw-r--r--src/components/HMI/images/common/btn-48h.pngbin0 -> 1141 bytes
-rw-r--r--src/components/HMI/images/common/btn-98h.pngbin0 -> 1266 bytes
-rw-r--r--src/components/HMI/images/common/button.pngbin0 -> 655 bytes
-rw-r--r--src/components/HMI/images/common/button_active_blue.pngbin0 -> 170 bytes
-rw-r--r--src/components/HMI/images/common/button_large.pngbin0 -> 1192 bytes
-rw-r--r--src/components/HMI/images/common/button_small.pngbin0 -> 487 bytes
-rw-r--r--src/components/HMI/images/common/center-button-150.pngbin0 -> 1390 bytes
-rw-r--r--src/components/HMI/images/common/center-button.pngbin0 -> 1300 bytes
-rw-r--r--src/components/HMI/images/common/climate-status-bg.pngbin0 -> 2315 bytes
-rw-r--r--src/components/HMI/images/common/defaultButtonImage.pngbin0 -> 3874 bytes
-rw-r--r--src/components/HMI/images/common/delim.pngbin0 -> 1120 bytes
-rw-r--r--src/components/HMI/images/common/divider.pngbin0 -> 1157 bytes
-rw-r--r--src/components/HMI/images/common/header_bg.pngbin0 -> 6743 bytes
-rw-r--r--src/components/HMI/images/common/ico_back.pngbin0 -> 1123 bytes
-rw-r--r--src/components/HMI/images/common/ind_vert_active.pngbin0 -> 2346 bytes
-rw-r--r--src/components/HMI/images/common/ind_vert_def.pngbin0 -> 1066 bytes
-rw-r--r--src/components/HMI/images/common/ls_border.pngbin0 -> 3403 bytes
-rw-r--r--src/components/HMI/images/common/media-status-bg.pngbin0 -> 2048 bytes
-rw-r--r--src/components/HMI/images/common/minus-ico.pngbin0 -> 934 bytes
-rw-r--r--src/components/HMI/images/common/nav-status-bg.pngbin0 -> 2971 bytes
-rw-r--r--src/components/HMI/images/common/okbut.pngbin0 -> 3102 bytes
-rw-r--r--src/components/HMI/images/common/okbut_pressed.pngbin0 -> 3155 bytes
-rw-r--r--src/components/HMI/images/common/page-back-button.pngbin0 -> 1112 bytes
-rw-r--r--src/components/HMI/images/common/phone-statusbar-bg.pngbin0 -> 2910 bytes
-rw-r--r--src/components/HMI/images/common/plus-ico.pngbin0 -> 958 bytes
-rw-r--r--src/components/HMI/images/common/scroll_down.pngbin0 -> 1072 bytes
-rw-r--r--src/components/HMI/images/common/scroll_down_active.pngbin0 -> 1070 bytes
-rw-r--r--src/components/HMI/images/common/scroll_down_inactive.pngbin0 -> 1033 bytes
-rw-r--r--src/components/HMI/images/common/scroll_up.pngbin0 -> 1186 bytes
-rw-r--r--src/components/HMI/images/common/scroll_up_inactive.pngbin0 -> 1108 bytes
-rw-r--r--src/components/HMI/images/common/seat-act-led.pngbin0 -> 1383 bytes
-rw-r--r--src/components/HMI/images/common/seat-inact-led.pngbin0 -> 967 bytes
-rw-r--r--src/components/HMI/images/common/skipbuttonbg.pngbin0 -> 1562 bytes
-rw-r--r--src/components/HMI/images/common/skippbuttonbg_pressed.pngbin0 -> 1544 bytes
-rw-r--r--src/components/HMI/images/common/system_settings_btn_bg.pngbin0 -> 962 bytes
-rw-r--r--src/components/HMI/images/common/system_settings_btn_bg_active.pngbin0 -> 970 bytes
-rw-r--r--src/components/HMI/images/common/system_settings_btn_h54.pngbin0 -> 966 bytes
-rw-r--r--src/components/HMI/images/common/toggle.pngbin0 -> 3596 bytes
-rw-r--r--src/components/HMI/images/home/bottom_controlls_full.pngbin0 -> 28638 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/DownButton.pngbin0 -> 6391 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/DownButton_pressed.pngbin0 -> 6278 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/LeftButton.pngbin0 -> 6547 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/LeftButton_pressed.pngbin0 -> 6630 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/OkButton.pngbin0 -> 4939 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/OkButton_pressed.pngbin0 -> 4809 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/RightButton.pngbin0 -> 6550 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/RightButton_pressed.pngbin0 -> 6549 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/UpButton.pngbin0 -> 6397 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/UpButton_pressed.pngbin0 -> 6536 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/backGroundControllButtons.pngbin0 -> 3157 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/vr.pngbin0 -> 5429 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/vrImage.pngbin0 -> 2461 bytes
-rw-r--r--src/components/HMI/images/home/controlButtons/vr_pressed.pngbin0 -> 6165 bytes
-rw-r--r--src/components/HMI/images/home/home_main_image.pngbin0 -> 39085 bytes
-rw-r--r--src/components/HMI/images/home/home_phone.pngbin0 -> 2774 bytes
-rw-r--r--src/components/HMI/images/info/callendar-btn.pngbin0 -> 1366 bytes
-rw-r--r--src/components/HMI/images/info/ico_assist.pngbin0 -> 1553 bytes
-rw-r--r--src/components/HMI/images/info/ico_info_install.pngbin0 -> 2022 bytes
-rw-r--r--src/components/HMI/images/info/ico_vehicle.pngbin0 -> 1614 bytes
-rw-r--r--src/components/HMI/images/info/info_leftMenu_apps_ico.pngbin0 -> 1632 bytes
-rw-r--r--src/components/HMI/images/info/info_leftMenu_calendar_ico.pngbin0 -> 1868 bytes
-rw-r--r--src/components/HMI/images/info/info_leftMenu_services_ico.pngbin0 -> 2493 bytes
-rw-r--r--src/components/HMI/images/info/info_leftMenu_travelLink_ico.pngbin0 -> 3646 bytes
-rw-r--r--src/components/HMI/images/info/info_services_bg.pngbin0 -> 11109 bytes
-rw-r--r--src/components/HMI/images/info/info_travelLink_sirius_logo.pngbin0 -> 3627 bytes
-rw-r--r--src/components/HMI/images/info/menu_active.pngbin0 -> 973 bytes
-rw-r--r--src/components/HMI/images/info/view_info_calendar.pngbin0 -> 5924 bytes
-rw-r--r--src/components/HMI/images/list/list_item_bg.pngbin0 -> 1099 bytes
-rw-r--r--src/components/HMI/images/list/list_item_pressed.pngbin0 -> 1091 bytes
-rw-r--r--src/components/HMI/images/list/scrollbar/button-down-active.pngbin0 -> 1407 bytes
-rw-r--r--src/components/HMI/images/list/scrollbar/button-up-active.pngbin0 -> 1406 bytes
-rw-r--r--src/components/HMI/images/media/bcs-item_bgL.pngbin0 -> 1472 bytes
-rw-r--r--src/components/HMI/images/media/bcs-item_bgL_pressed.png0
-rw-r--r--src/components/HMI/images/media/bcs-item_bgR.pngbin0 -> 1423 bytes
-rw-r--r--src/components/HMI/images/media/bcs-item_bgR_pressed.pngbin0 -> 1407 bytes
-rw-r--r--src/components/HMI/images/media/bcs-item_bgS.pngbin0 -> 1542 bytes
-rw-r--r--src/components/HMI/images/media/bcs-item_bgS_pressed.pngbin0 -> 1541 bytes
-rw-r--r--src/components/HMI/images/media/bg.pngbin0 -> 4614 bytes
-rw-r--r--src/components/HMI/images/media/btn_bg.pngbin0 -> 1286 bytes
-rw-r--r--src/components/HMI/images/media/cd-next-btn.pngbin0 -> 1744 bytes
-rw-r--r--src/components/HMI/images/media/cd-next-btn_pressed.pngbin0 -> 1752 bytes
-rw-r--r--src/components/HMI/images/media/cd-prev-btn.pngbin0 -> 1845 bytes
-rw-r--r--src/components/HMI/images/media/cd-prev-btn_pressed.pngbin0 -> 1872 bytes
-rw-r--r--src/components/HMI/images/media/cd_play_btn.pngbin0 -> 1999 bytes
-rw-r--r--src/components/HMI/images/media/divider_o.pngbin0 -> 1136 bytes
-rw-r--r--src/components/HMI/images/media/ico-play.pngbin0 -> 1162 bytes
-rw-r--r--src/components/HMI/images/media/ico_arrow_down.pngbin0 -> 1723 bytes
-rw-r--r--src/components/HMI/images/media/ico_arrow_up.pngbin0 -> 1726 bytes
-rw-r--r--src/components/HMI/images/media/ico_back.pngbin0 -> 1123 bytes
-rw-r--r--src/components/HMI/images/media/ico_cd.pngbin0 -> 2479 bytes
-rw-r--r--src/components/HMI/images/media/ico_next.pngbin0 -> 1423 bytes
-rw-r--r--src/components/HMI/images/media/ico_pause.pngbin0 -> 1134 bytes
-rw-r--r--src/components/HMI/images/media/ico_prew.pngbin0 -> 1435 bytes
-rw-r--r--src/components/HMI/images/media/ls-item_bg.pngbin0 -> 1481 bytes
-rw-r--r--src/components/HMI/images/media/ls-item_bg_act.pngbin0 -> 1219 bytes
-rw-r--r--src/components/HMI/images/media/player_view.pngbin0 -> 62443 bytes
-rw-r--r--src/components/HMI/images/phone/bg.pngbin0 -> 13851 bytes
-rw-r--r--src/components/HMI/images/phone/del.pngbin0 -> 207 bytes
-rw-r--r--src/components/HMI/images/phone/dial.pngbin0 -> 510 bytes
-rw-r--r--src/components/HMI/images/phone/end.pngbin0 -> 499 bytes
-rw-r--r--src/components/HMI/images/phone/ico_phone.pngbin0 -> 1204 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/center_btn.pngbin0 -> 706 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/center_btn_pressed.pngbin0 -> 699 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/left_btn.pngbin0 -> 636 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/left_btn_pressed.pngbin0 -> 624 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/right_btn.pngbin0 -> 571 bytes
-rw-r--r--src/components/HMI/images/phone/keypad/right_btn_pressed.pngbin0 -> 563 bytes
-rw-r--r--src/components/HMI/images/phone/menu_active.pngbin0 -> 172 bytes
-rw-r--r--src/components/HMI/images/phone/menu_bg.pngbin0 -> 555 bytes
-rw-r--r--src/components/HMI/images/sdl/Warning.pngbin0 -> 7546 bytes
-rw-r--r--src/components/HMI/images/sdl/audio_icon.jpgbin0 -> 5560 bytes
-rw-r--r--src/components/HMI/images/sdl/devices.pngbin0 -> 632 bytes
-rw-r--r--src/components/HMI/images/sdl/new_apps.pngbin0 -> 1424 bytes
-rw-r--r--src/components/HMI/images/sdl/progress.gifbin0 -> 2327 bytes
-rw-r--r--src/components/HMI/images/sdl/progressindicator.gifbin0 -> 7703 bytes
-rw-r--r--src/components/HMI/images/settings/ico_settings.pngbin0 -> 2561 bytes
-rw-r--r--src/components/HMI/index.html189
-rw-r--r--src/components/HMI/lib/ember-1.0.pre.js20709
-rw-r--r--src/components/HMI/lib/ember-1.0.pre.min.js18
-rw-r--r--src/components/HMI/lib/handlebars-1.0.0.beta.6.js1550
-rw-r--r--src/components/HMI/lib/iscroll-lite.js594
-rw-r--r--src/components/HMI/lib/jquery-1.7.2.js9404
-rw-r--r--src/components/HMI/lib/jquery-1.7.2.min.js4
-rw-r--r--src/components/HMI/locale/eng.js62
-rw-r--r--src/components/HMI/locale/locale.js42
255 files changed, 67072 insertions, 1 deletions
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index 16dd81f49b..9b90a962bc 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -270,7 +270,11 @@ else ()
)
endif ()
-if (${QT_HMI})
+if (${WEB_HMI})
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ install( DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/components/HMI/ DESTINATION bin/HMI)
+ endif ()
+elseif (${QT_HMI})
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
install(FILES start-qml.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
diff --git a/src/components/HMI/IVSU/PROPRIETARY_REQUEST b/src/components/HMI/IVSU/PROPRIETARY_REQUEST
new file mode 100644
index 0000000000..e9009f7229
--- /dev/null
+++ b/src/components/HMI/IVSU/PROPRIETARY_REQUEST
@@ -0,0 +1 @@
+{"Content-Type":"application/json"} \ No newline at end of file
diff --git a/src/components/HMI/app/AppViews.js b/src/components/HMI/app/AppViews.js
new file mode 100644
index 0000000000..ec31c13399
--- /dev/null
+++ b/src/components/HMI/app/AppViews.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL
+ * @desc Setup application container for all views
+ * @category Application
+ * @filesource app/AppViews.js
+ * @version 1.0
+ */
+
+/** Appending views */
+SDL.AppViews = Em.ContainerView.extend( {
+
+ elementId: 'app',
+
+ childViews: [
+ SDL.HomeView,
+ SDL.MediaView,
+ SDL.NavigationAppView,
+ SDL.InfoView,
+ SDL.PhoneView,
+ SDL.ClimateView,
+ SDL.NavigationView,
+ SDL.ControlButtons,
+ SDL.SettingsView,
+ SDL.TurnByTurnView,
+ SDL.TBTTurnList,
+ SDL.OptionsView,
+ SDL.InteractionChoicesView,
+ SDL.Keyboard,
+ SDL.VRHelpListView,
+ SDL.ScrollableMessage,
+ SDL.SliderView,
+ SDL.StatusClimateView,
+ SDL.StatusMediaView,
+ SDL.StatusNavigationView,
+ SDL.StatusInfoView,
+ SDL.StatusPhoneView,
+ SDL.TopControls,
+ SDL.BottomControls,
+ SDL.TTSPopUp,
+ SDL.AlertPopUp,
+ SDL.AlertManeuverPopUp,
+ SDL.AudioPassThruPopUp,
+ SDL.VRPopUp,
+ SDL.VehicleInfo,
+ SDL.TBTClientStateView,
+ SDL.DriverDistraction,
+ SDL.ExitApp,
+ SDL.SystemRequest
+ ],
+
+ /*
+ * This method is called when the app is fully rendered and ready to be
+ * displayed. We notify the backend to hide the splash and load internal
+ * view modules
+ */
+ didInsertElement: function() {
+
+ this._super();
+
+ SDL.set('appReady', true);
+
+ $(window).bind("beforeunload", function(e) {
+
+ FFW.BasicCommunication.OnIgnitionCycleOver();
+
+ FFW.BasicCommunication.disconnect();
+ FFW.UI.disconnect();
+ FFW.VR.disconnect();
+ FFW.VehicleInfo.disconnect();
+ FFW.TTS.disconnect();
+ FFW.Buttons.disconnect();
+ FFW.Navigation.disconnect();
+
+ if(confirm('The "ignition off" emulation executed!')){
+ return 'OK, Good Bye then';
+ }
+ else {
+ e = e || event;
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ e.returnValue = false;
+ return 'The "ignition off" emulation executed!';
+ }
+ })
+
+ }
+});
diff --git a/src/components/HMI/app/Flags.js b/src/components/HMI/app/Flags.js
new file mode 100644
index 0000000000..c1e755a510
--- /dev/null
+++ b/src/components/HMI/app/Flags.js
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL
+ * @desc flags for application flags used for diffeerent configurations of
+ * application As the same code base is used fro Production and RnD work
+ * pakackages, it is necessary to configare application for different
+ * needs/releases It is NOT recommended to extend this object with new
+ * flags. Each modification should be discussed with PM in advance
+ * @category Application
+ * @filesource app/AppFlags.js
+ * @version 1.0
+ */
+
+FLAGS = Em.Object.create( {
+ /**
+ * Set language for localization
+ */
+ SET_LOCALIZATION: 'eng',
+
+ WEBSOCKET_URL: "ws://127.0.0.1:8087",
+
+ TOUCH_EVENT_STARTED: false,
+
+ BC: true,
+
+ UI: true,
+
+ VI: true,
+
+ VR: true,
+
+ Buttons: true,
+
+ TTS: true,
+
+ Navi: true
+
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/SDLApp.js b/src/components/HMI/app/SDLApp.js
new file mode 100644
index 0000000000..bbe4644008
--- /dev/null
+++ b/src/components/HMI/app/SDLApp.js
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL
+ * @desc Setup application namespace and settings
+ * @category Application
+ * @filesource app/App.js
+ * @version 1.0
+ */
+
+SDL = Em.Application.create( {
+
+ /** Override for mouse/touch events */
+ customEvents: ('ontouchstart' in document.documentElement) ? {
+ touchstart: 'actionDown',
+ touchend: 'actionUp',
+ touchmove: 'actionMove'
+ } : {
+ mousedown: 'actionDown',
+ mouseup: 'actionUp',
+ mousemove: 'actionMove'
+ },
+
+ /** Help mode flag {boolean} */
+ helpMode: false,
+
+ // determine home view {string}
+ homeView: 'home',
+
+ /** Set language for localization */
+ localization: 'eng',
+
+ // Application ready flag
+ appReady: false,
+
+ // Debug text
+ debugText: 'debug&nbsp;mode',
+
+ init: function() {
+
+ Em.Logger.log('SDL: Application init!');
+
+ this._super();
+ },
+
+ /** Application ready event */
+ ready: function() {
+
+ Em.Logger.log('SDL: Application ready!');
+
+ /** State manager init */
+ SDL.States = StateManager.create();
+
+ /** container for all views */
+ SDL.views = SDL.AppViews.create().appendTo('body');
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/StateManager.js b/src/components/HMI/app/StateManager.js
new file mode 100644
index 0000000000..b11ce0b835
--- /dev/null
+++ b/src/components/HMI/app/StateManager.js
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.States
+ * @desc State manager definition
+ * @category State Manager
+ * @filesource app/StateManager.js
+ * @version 1.0
+ */
+
+ // Extend base Em.State object
+Em.State.reopen({
+
+ // used for determine display status
+ active: false,
+
+ enter: function () {
+
+ this.set('active', true);
+ },
+
+ exit: function () {
+
+ this.set('active', false);
+ SDL.SDLController.triggerState();
+ }
+});
+
+// State Manager class
+var StateManager = Em.StateManager.extend({
+
+ // default state
+ initialState: 'home',
+
+ /**
+ * Name of the next state to which at the moment is a transition
+ */
+ nextState: 'home',
+
+ /**
+ * Method used for determine previous currentState and make
+ */
+ goToStates: function (stateName) {
+
+ SDL.SDLController.userStateAction();
+ this.set('nextState', stateName);
+ this.transitionTo(stateName);
+ },
+
+ /** Go to parent state */
+ back: function () {
+
+ if (this.currentState.parentState.hasOwnProperty('name')) {
+ this.goToStates(this.currentState.parentState.get('path'));
+ } else {
+ this.goToStates('home');
+ }
+
+ SDL.StateVisitor.visit(this.currentState);
+ },
+
+ /** Home state */
+ home: Em.State.create({
+
+ }),
+
+ /** Climate state */
+ climate: Em.State.create({
+
+ }),
+
+ /** info state */
+ info: Em.State.create({
+
+ exit: function () {
+
+ SDL.InfoController.set('activeState', SDL.States.currentState.get('path'));
+ this._super();
+ },
+
+ services: Em.State.create({
+
+ }),
+
+ travelLink: Em.State.create({
+
+ }),
+
+ alerts: Em.State.create({
+
+ }),
+
+ calendar: Em.State.create({
+
+ }),
+
+ apps: Em.State.create({
+
+ /**
+ * Calls function from BasicCommunicationRPC to get new list of
+ * applications
+ */
+ enter: function () {
+
+ this._super();
+ FFW.BasicCommunication.OnFindApplications();
+ }
+ }),
+
+ devicelist: Em.State.create({
+ /**
+ * Calls function to clear device list on DeviceListView
+ */
+ enter: function () {
+
+ this._super();
+ SDL.DeviceListView.clearDeviceList();
+ FFW.BasicCommunication.OnStartDeviceDiscovery();
+ }
+ }),
+
+ nonMedia: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+ SDL.SDLController.activateTBT();
+ },
+
+ exit: function () {
+
+ this._super();
+
+ SDL.SDLAppController.deactivateApp();
+ }
+ })
+ }),
+
+ /** settings state */
+ settings: Em.State.create({
+
+ exit: function () {
+
+ SDL.SettingsController.set('activeState', SDL.States.currentState.get('path'));
+ this._super();
+ },
+
+ policies: Em.State.create({
+ statisticsInfo: Em.State.create({
+
+ }),
+
+ deviceConfig: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+ SDL.DeviceConfigView.showDeviceList();
+ }
+ }),
+
+ appPermissionsList: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+
+ }
+ }),
+
+ appPermissions: Em.State.create({
+
+ }),
+
+ systemError: Em.State.create({
+
+ }),
+
+ deviceStateChange: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+ SDL.DeviceStateChangeView.showDeviceList();
+ }
+ })
+ })
+ }),
+
+ /** Media state */
+ media: Em.State.create({
+
+ exit: function () {
+
+ SDL.MediaController.set('activeState', SDL.States.currentState.get('path'));
+ this._super();
+ },
+
+ player: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+ if (SDL.SDLModel.stateLimited) {
+
+ FFW.BasicCommunication.OnAppDeactivated('AUDIO', SDL.SDLModel.stateLimited);
+ SDL.SDLModel.stateLimited = null;
+ SDL.SDLModel.set('limitedExist', false);
+ }
+ }
+ }),
+
+ sdlmedia: Em.State.create({
+
+ enter: function () {
+
+ this._super();
+ SDL.SDLController.activateTBT();
+ },
+
+ exit: function () {
+
+ this._super();
+
+ SDL.SDLModel.stateLimited = SDL.SDLAppController.model.appID;
+ SDL.SDLModel.set('limitedExist', true);
+ SDL.SDLAppController.deactivateApp();
+ }
+
+ })
+ }),
+
+ navigationApp: Em.State.create({
+
+ baseNavigation: Em.State.create({
+
+ }),
+
+ exit: function () {
+
+ this._super();
+
+ SDL.SDLModel.stateLimited = SDL.SDLAppController.model.appID;
+ SDL.SDLModel.set('limitedExist', true);
+ SDL.SDLAppController.deactivateApp();
+ }
+ }),
+
+ /** Navigation state */
+ navigation: Em.State.create({
+
+ }),
+
+ /** Phone state */
+ phone: Em.State.create({
+
+ dialpad: Em.State.create({
+
+ })
+ })
+});
diff --git a/src/components/HMI/app/controller/AppController.js b/src/components/HMI/app/controller/AppController.js
new file mode 100644
index 0000000000..c655463391
--- /dev/null
+++ b/src/components/HMI/app/controller/AppController.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.AppController
+ * @desc App general logic
+ * @category Controller
+ * @filesource app/controller/AppController.js
+ * @version 1.0
+ */
+
+SDL.AppController = Em.Object.create( {
+ active: false
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/InfoController.js b/src/components/HMI/app/controller/InfoController.js
new file mode 100644
index 0000000000..8ad129dd4f
--- /dev/null
+++ b/src/components/HMI/app/controller/InfoController.js
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoController
+ * @desc Info Controller logic
+ * @category Controller
+ * @filesource app/controller/InfoController.js
+ * @version 1.0
+ */
+
+SDL.InfoController = Em.Object.create( {
+
+ activeState: 'info.apps',
+
+ hiddenLeftMenu: false,
+
+ onState: function(event) {
+
+ SDL.States.goToStates('info.' + event.goToState);
+ },
+
+ onChildState: function(event) {
+
+ SDL.States.goToStates(SDL.States.currentState.get('path') + '.'
+ + event.goToState);
+ },
+
+ /**
+ * Switching on Application
+ */
+ turnOnSDL: function () {
+
+ //SDL.CDModel.set('active', false);
+ /**
+ * Set SDL Data active, flag for status bar
+ */
+ if (SDL.SDLAppController.model) {
+ SDL.SDLAppController.model.set('active', true);
+ }
+ /**
+ * Go to SDL state
+ */
+ if (SDL.SDLAppController.model.appType) {
+ for (var i = 0; i < SDL.SDLAppController.model.appType.length; i++) {
+ if (SDL.SDLAppController.model.appType[i] == "NAVIGATION") {
+ SDL.BaseNavigationView.update();
+ SDL.States.goToStates('navigationApp.baseNavigation');
+ return;
+ }
+ }
+ }
+
+ SDL.States.goToStates('info.nonMedia');
+ //SDL.States.goToStates('media.sdlmedia');
+
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/MediaController.js b/src/components/HMI/app/controller/MediaController.js
new file mode 100644
index 0000000000..45b46437be
--- /dev/null
+++ b/src/components/HMI/app/controller/MediaController.js
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.MediaController
+ * @desc Media module logic
+ * @category Controller
+ * @filesource app/controller/MediaController.js
+ * @version 1.0
+ */
+SDL.MediaController = Em.Object.create({
+
+ /**
+ * Initial substate
+ */
+ activeState: 'media.player',
+
+ /**
+ * Turn on CD
+ */
+ turnOnCD: function () {
+
+ if (!SDL.States.media.player.active) {
+ SDL.States.goToStates('media.player');
+ }
+
+ if (SDL.SDLAppController.model) {
+ SDL.SDLAppController.model.set('active', false);
+ }
+ SDL.CDModel.set('active', true);
+ },
+
+ /**
+ * Switching on Application
+ */
+ turnOnSDL: function () {
+
+ SDL.CDModel.set('active', false);
+ /**
+ * Set SDL Data active, flag for status bar
+ */
+ if (SDL.SDLAppController.model) {
+ SDL.SDLAppController.model.set('active', true);
+ }
+ /**
+ * Go to SDL state
+ */
+ if (SDL.SDLAppController.model.appType) {
+ for (var i = 0; i < SDL.SDLAppController.model.appType.length; i++) {
+ if (SDL.SDLAppController.model.appType[i] == "NAVIGATION") {
+ SDL.BaseNavigationView.update();
+ SDL.States.goToStates('navigationApp.baseNavigation');
+ return;
+ }
+ }
+ }
+
+ SDL.States.goToStates('media.sdlmedia');
+
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/PhoneController.js b/src/components/HMI/app/controller/PhoneController.js
new file mode 100644
index 0000000000..c29cae064d
--- /dev/null
+++ b/src/components/HMI/app/controller/PhoneController.js
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PhoneController
+ * @desc Phone module logic
+ * @category Controller
+ * @filesource app/controller/PhoneController.js
+ * @version 1.0
+ */
+
+SDL.PhoneController = Em.Object.create( {
+
+ /**
+ * Model binding
+ */
+ modelBinding: "SDL.PhoneModel",
+
+ /**
+ * Dialpad delete key press handeler
+ */
+ onDelete: function() {
+
+ this.model.deleteDialpadNumber();
+ },
+
+ /**
+ * Dial call handeler
+ */
+ onEndCall: function() {
+
+ FFW.BasicCommunication.OnPhoneCall(false);
+ this.model.endCall();
+ },
+
+ /**
+ * Dial call handeler
+ */
+ onDialCall: function() {
+
+ FFW.BasicCommunication.OnPhoneCall(true);
+ this.model.dialCall();
+ },
+
+ /**
+ * Dialpad key press handler
+ */
+ keyPress: function(element) {
+ this.model.setDialpadNumber(element.text)
+ },
+
+ /**
+ *
+ */
+ incomingCall: function(request) {
+
+ this.model.setDialpadNumber(request.params.number);
+ this.onDialCall();
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/SettingsController.js b/src/components/HMI/app/controller/SettingsController.js
new file mode 100644
index 0000000000..32f4e4762a
--- /dev/null
+++ b/src/components/HMI/app/controller/SettingsController.js
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SettingsController
+ * @desc Info Controller logic
+ * @category Controller
+ * @filesource app/controller/SettingsController.js
+ * @version 1.0
+ */
+
+SDL.SettingsController = Em.Object.create( {
+
+ activeState: 'settings.policies',
+
+ hiddenLeftMenu: false,
+
+ /**
+ * File name for SDL.OnSystemRequest
+ * Came in SDL.PolicyUpdate request
+ */
+ policyUpdateFile: null,
+
+ /**
+ * Data of current requested devices which access will be allowed or disallowed.
+ */
+ currentDeviceAllowance: null,
+
+ onState: function(event) {
+
+ SDL.States.goToStates('settings.' + event.goToState);
+ },
+
+ onChildState: function(event) {
+
+ SDL.States.goToStates(SDL.States.currentState.get('path') + '.'
+ + event.goToState);
+ },
+
+ getStatusUpdate: function(){
+ FFW.BasicCommunication.GetStatusUpdate();
+ },
+
+ phoneCall: function() {
+
+ FFW.BasicCommunication.OnPhoneCall(true);
+
+ SDL.SDLModel.phoneCallActive = true;
+
+ var appID = null;
+
+ if (SDL.SDLAppController.model) {
+ appID = SDL.SDLAppController.model.appID;
+ }
+
+
+ if (appID) {
+ SDL.SDLModel.onDeactivateApp('call', appID);
+ SDL.States.goToStates('phone.dialpad');
+
+ setTimeout(function () {
+ FFW.BasicCommunication.OnPhoneCall(false);
+ SDL.SDLController.getApplicationModel(appID).turnOnSDL(appID);
+ SDL.SDLModel.phoneCallActive = false;
+ }, 5000); //Magic number - 5 seconds timeout for emulating conversation call
+ } else {
+ setTimeout(function () {
+ FFW.BasicCommunication.OnPhoneCall(false);
+ SDL.SDLModel.phoneCallActive = false;
+ }, 5000); //Magic number - 5 seconds timeout for emulating conversation call
+ }
+ },
+
+ allDeviceAccess: function(){
+
+ var allowedValue, allowedText;
+
+ if (SDL.DeviceConfigView.globalConfigurationValue) {
+ SDL.DeviceConfigView.set('globalConfigurationValue', false);
+ allowedValue = false;
+ allowedText = " - Not allowed";
+ } else {
+ SDL.DeviceConfigView.set('globalConfigurationValue', true);
+ allowedValue = true;
+ allowedText = " - Allowed";
+ }
+
+ var dev = SDL.SDLModel.connectedDevices;
+ for (var key in dev) {
+ if (dev.hasOwnProperty(key)) {
+ dev[key].allowed = allowedValue;
+ }
+ }
+
+ SDL.DeviceConfigView.showDeviceList();
+
+ FFW.BasicCommunication.OnAllowSDLFunctionality(allowedValue, "GUI");
+ },
+
+ changeDeviceAccess: function(event) {
+
+ var dev = SDL.SDLModel.connectedDevices;
+ for (var key in dev) {
+
+ if (dev.hasOwnProperty(key)) {
+
+ if (dev[key].id == event.id) {
+
+ if (dev[key].allowed) {
+
+ dev[key].allowed = false;
+ event.set('text', event.name + " - Not allowed");
+ } else {
+
+ dev[key].allowed = true;
+ event.set('text', event.name + " - Allowed");
+ }
+
+ var device = {
+ "name": dev[key].name,
+ "id": dev[key].id
+ };
+
+ SDL.DeviceConfigView.set('globalConfigurationValue', null);
+
+ FFW.BasicCommunication.OnAllowSDLFunctionality(dev[key].allowed, "GUI", device);
+ break;
+ }
+ }
+ }
+ },
+
+ changeAppPermission: function(element) {
+
+ if (element.allowed) {
+
+ element.allowed = false;
+ element.set('text', element.name + " - Not allowed");
+ } else {
+
+ element.allowed = true;
+ element.set('text', element.name + " - Allowed");
+ }
+ },
+
+ /**
+ * Method to send request to update array with app permissions
+ *
+ * @param {Object} element
+ *
+ */
+ GetListOfPermissions: function(element) {
+ FFW.BasicCommunication.GetListOfPermissions(element.appID);
+ },
+
+ /**
+ * Method to update array with app permissions which came from SDL
+ *
+ * @param {Object} message
+ *
+ */
+ GetListOfPermissionsResponse: function(message) {
+
+ if (message.id in SDL.SDLModel.getListOfPermissionsPull) {
+
+ var appID = SDL.SDLModel.getListOfPermissionsPull[message.id],
+ messageCodes = [];
+
+ for (var i = 0; i < message.result.allowedFunctions.length; i++) {
+ messageCodes.push(message.result.allowedFunctions[i].name);
+ }
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.permissionsFriendlyMessageUpdate, appID, messageCodes);
+
+ SDL.AppPermissionsView.update(message.result.allowedFunctions, appID);
+
+ delete SDL.SDLModel.getListOfPermissionsPull[message.id];
+ }
+ },
+
+ /**
+ * Method to update array with app permissions with UserFriendlyMessage from SDL
+ *
+ * @param {Object} message
+ *
+ */
+ permissionsFriendlyMessageUpdate: function(message) {
+
+
+ SDL.SettingsController.simpleParseUserFriendlyMessageData(message);
+
+ SDL.States.goToStates('settings.policies.appPermissions');
+
+ },
+
+ updateSDL: function() {
+ FFW.BasicCommunication.UpdateSDL();
+ },
+
+ getURLS: function() {
+ FFW.BasicCommunication.GetURLS(7);
+ },
+
+ AllowSDLFunctionality: function(messages) {
+
+ if (messages.length > 0) {
+ SDL.SettingsController.simpleParseUserFriendlyMessageData(messages, SDL.SettingsController.OnAllowSDLFunctionality);
+ } else {
+ SDL.PopUp.create().appendTo('body').popupActivate(
+ 'WARNING!!!!!!!!!!!!!! '
+ + 'There is no text from SDL in GetUserFriendlyMessage for DataConsent parameter!!! Please allow the device...',
+ SDL.SettingsController.OnAllowSDLFunctionality);
+ }
+
+ },
+
+ userFriendlyMessagePopUp: function(appId, messageCode) {
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appId, messageCode);
+ },
+
+ simpleParseUserFriendlyMessageData: function (messages, func) {
+ var tts = "",
+ text = "";
+
+ messages.forEach(function (x) {
+ if (x.ttsString) {
+ tts += x.ttsString;
+ }
+ if (x.textBody) {
+ text += x.textBody;
+ }
+ if (x.line1) {
+ text += x.line1;
+ }
+ if (x.line2) {
+ text += x.line2;
+ }
+ });
+
+ if (tts) {
+ SDL.TTSPopUp.ActivateTTS(tts);
+ }
+
+
+ if (text) {
+ SDL.PopUp.create().appendTo('body').popupActivate(text, func);
+ }
+ },
+
+ OnAllowSDLFunctionality: function(result) {
+
+ var dev = SDL.SDLModel.connectedDevices;
+ for (var key in dev) {
+ if (dev.hasOwnProperty(key)) {
+ if (dev[key].id == SDL.SettingsController.currentDeviceAllowance.id) {
+ dev[key].allowed = result;
+ }
+ }
+ }
+
+ SDL.DeviceConfigView.set('globalConfigurationValue', null);
+
+ SDL.DeviceConfigView.showDeviceList();
+
+ FFW.BasicCommunication.OnAllowSDLFunctionality(result, "GUI", SDL.SettingsController.currentDeviceAllowance);
+
+ SDL.SDLModel.connectedDevices[SDL.SettingsController.currentDeviceAllowance.id].sdlFunctionality.allowed = result;
+
+ SDL.SDLModel.connectedDevices[SDL.SettingsController.currentDeviceAllowance.id].sdlFunctionality.popUpId = null;
+
+ SDL.SettingsController.currentDeviceAllowance = null;
+ },
+
+ /**
+ * Method responsible for PolicyUpdate retry sequence
+ * abort parameter if set to true means that retry sequence if finished
+ *
+ * @param {Boolean} abort
+ */
+ policyUpdateRetry: function(abort) {
+
+ clearTimeout(SDL.SDLModel.policyUpdateRetry.timer);
+ SDL.SDLModel.policyUpdateRetry.timer = null;
+
+ if (abort !== "ABORT" && (SDL.SDLModel.policyUpdateRetry.try < SDL.SDLModel.policyUpdateRetry.retry.length)) {
+
+ SDL.SDLModel.policyUpdateRetry.oldTimer = SDL.SDLModel.policyUpdateRetry.oldTimer +
+ SDL.SDLModel.policyUpdateRetry.timeout * 1000 +
+ SDL.SDLModel.policyUpdateRetry.retry[SDL.SDLModel.policyUpdateRetry.try] * 1000;
+
+ SDL.SDLModel.policyUpdateRetry.timer = setTimeout(
+ function(){
+ FFW.BasicCommunication.OnSystemRequest(
+ "PROPRIETARY",
+ SDL.SDLModel.policyURLs[0].policyAppId,
+ SDL.SettingsController.policyUpdateFile,
+ SDL.SDLModel.policyURLs[0].url
+ );
+ SDL.SettingsController.policyUpdateRetry();
+ }, SDL.SDLModel.policyUpdateRetry.oldTimer
+ );
+
+ SDL.SDLModel.policyUpdateRetry.try++;
+ } else {
+ clearTimeout(SDL.SDLModel.policyUpdateRetry.timer);
+ SDL.SDLModel.policyUpdateRetry = {
+ timeout: null,
+ retry: [],
+ try: null,
+ timer: null,
+ oldTimer: 0
+ };
+ }
+ }
+});
diff --git a/src/components/HMI/app/controller/sdl/AppController.js b/src/components/HMI/app/controller/sdl/AppController.js
new file mode 100644
index 0000000000..9cf5d1f153
--- /dev/null
+++ b/src/components/HMI/app/controller/sdl/AppController.js
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLAppController
+ * @desc SDL abstract application controller
+ * @category Controller
+ * @filesource app/controller/sdl/AppController.js
+ * @version 1.0
+ */
+
+SDL.SDLAppController = Em.Object.create({
+
+ init: function () {
+
+ this._super();
+
+ //FFW.UI.set('isReady', true);
+ //FFW.Navigation.set('isReady', true);
+ },
+
+ /**
+ * Active application model binding type {SDLAppModel}
+ */
+ model: null,
+
+ /**
+ * Function to add application to application list
+ */
+ showAppList: function() {
+
+ SDL.AppPermissionsListView.showAppList();
+ }.observes('SDL.SDLModel.registeredApps.@each'),
+
+ /**
+ * Handeler for command button press
+ *
+ * @param element:
+ * SDL.Button
+ */
+ onCommand: function (element) {
+
+ if (element.commandID < 0) {
+
+ switch (element.commandID) {
+ case -1: {
+ FFW.BasicCommunication.ExitApplication(SDL.SDLAppController.model.appID, "DRIVER_DISTRACTION_VIOLATION");
+ break;
+ }
+ case -2: {
+ FFW.BasicCommunication.ExitApplication(SDL.SDLAppController.model.appID, "USER_EXIT");
+ break;
+ }
+ default: {
+ console.log("Unknown command with ID: " + element.commandID);
+ }
+ }
+
+ SDL.OptionsView.deactivate();
+ SDL.States.goToStates('info.apps');
+
+ } else if (element.menuID >= 0) {
+
+ // if subMenu
+ // activate driver destruction if necessary
+ if (SDL.SDLModel.driverDistractionState) {
+ SDL.DriverDistraction.activate();
+ } else {
+ this.onSubMenu(element.menuID);
+ }
+
+ return;
+ } else {
+
+ FFW.UI.onCommand(element.commandID, this.model.appID);
+ SDL.OptionsView.deactivate();
+ }
+ },
+
+ /**
+ * Handeler for VR command button press
+ *
+ * @param element: SDL.Button
+ */
+ VRPerformAction: function (element) {
+
+ SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode["SUCCESS"], element.commandID);
+
+ if (SDL.SDLModel.VRActive) {
+ SDL.SDLModel.toggleProperty('VRActive');
+ }
+ },
+
+ /**
+ * Open commands submenu
+ *
+ * @param {Number}
+ */
+ onSubMenu: function (id) {
+
+ this.model.set('currentSubMenuId', id);
+ },
+
+ /**
+ * Comparison function for sort array of buttons in options list by 'position' parameter
+ *
+ * @param {Number}
+ */
+ buttonsSort: function (arrayId, appID) {
+
+ SDL.SDLController.getApplicationModel(appID).commandsList[arrayId].sort(function (a, b) {
+ return a.position - b.position;
+ })
+ },
+
+ /**
+ * Handeler for command button press
+ *
+ * @param element:
+ * SDL.Button
+ */
+ onVRCommand: function (element) {
+
+ if (SDL.SDLModel.VRActive) {
+ SDL.SDLModel.toggleProperty('VRActive');
+ }
+ FFW.VR.onCommand(element.commandID, element.appID);
+ },
+
+ /**
+ * Handler for preform interaction choice send response to device and
+ * deactivate interactions window
+ *
+ * @param element:
+ * SDL.Button
+ */
+ onChoiceInteraction: function (element) {
+
+ SDL.InteractionChoicesView.deactivate("SUCCESS", element.choiceID);
+ },
+
+ /**
+ * Handeler for Navigation preform interaction choice send response to device and
+ * deactivate interactions window
+ *
+ * @param {Object}
+ */
+ onChoiceNaviInteraction: function(element) {
+
+ SDL.SDLModel.uiShowKeyboard();
+
+ FFW.UI.interactionResponse(SDL.SDLModel.resultCode["SUCCESS"], element.choiceID);
+
+ SDL.InteractionChoicesView.deactivate("SUCCESS");
+ },
+
+ /**
+ * Open commands list
+ */
+ openCommandsList: function () {
+
+ SDL.OptionsView.activate();
+ },
+
+ /**
+ * Notification of deactivation of current application model initiated in
+ * StateManager
+ */
+ deactivateApp: function () {
+
+ if (this.model) {
+ SDL.SDLModel.onDeactivateApp(SDL.States.nextState, this.model.appID);
+ }
+
+ SDL.SDLAppController.onSubMenu('top');
+ SDL.SDLAppController.model.set('tbtActivate', false);
+ this.set('model', null);
+ },
+
+ /**
+ * Method clears all applications data and unregister models
+ */
+ onSDLDisconected: function () {
+
+ var i = 0, apps = SDL.SDLModel.registeredApps;
+
+ for (i = 0; i < apps.length; i++) {
+ SDL.SDLModel.onAppUnregistered({
+ "appID": apps[i].appID
+ });
+ }
+ }
+});
diff --git a/src/components/HMI/app/controller/sdl/Controller.js b/src/components/HMI/app/controller/sdl/Controller.js
new file mode 100644
index 0000000000..e33656ecf4
--- /dev/null
+++ b/src/components/HMI/app/controller/sdl/Controller.js
@@ -0,0 +1,942 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLController
+ * @desc Main SDL Controller
+ * @category Controller
+ * @filesource app/controller/sdl/SDLController.js
+ * @version 1.0
+ */
+SDL.SDLController = Em.Object
+ .create( {
+
+ init: function () {
+
+ /**
+ * Added object size counter
+ */
+ Object.size = function(obj) {
+ var size = 0, key;
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) size++;
+ }
+ return size;
+ }
+
+ },
+
+ /**
+ * Current system context
+ *
+ * @type {String}
+ */
+ sysContext: function() {
+
+ if (SDL.SDLModel.VRActive) {
+ return 'VRSESSION';
+ }
+ if (SDL.AlertPopUp.active) {
+ return 'ALERT';
+ }
+ if ( SDL.SliderView.active
+ || SDL.InteractionChoicesView.active
+ || SDL.ScrollableMessage.active
+ || SDL.SDLModel.AudioPassThruState
+ || SDL.Keyboard.active) {
+
+ return 'HMI_OBSCURED';
+ }
+ if (SDL.OptionsView.active) {
+ return 'MENU';
+ }
+
+ return 'MAIN';
+
+ }.property('SDL.OptionsView.active',
+ 'SDL.SliderView.active',
+ 'SDL.SDLModel.AudioPassThruState',
+ 'SDL.SDLModel.VRActive',
+ 'SDL.AlertPopUp.active',
+ 'SDL.States.info.nonMedia.active',
+ 'SDL.States.media.sdlmedia.active',
+ 'SDL.States.navigationApp.baseNavigation.active',
+ 'SDL.ScrollableMessage.active',
+ 'SDL.InteractionChoicesView.active',
+ 'SDL.VRHelpListView.active',
+ 'SDL.Keyboard.active'),
+
+ /**
+ * Flag consider that previously alert request was received from SDL for app in BACKGROUND HMI level
+ * the applications appID will be stashed as current value
+ *
+ * @type number
+ */
+ backgroundAlertAppID: null,
+
+ /**
+ * List of SDL application models
+ *
+ * @type object
+ */
+ applicationModels: {
+ 0: SDL.SDLMediaModel,
+ 1: SDL.SDLNonMediaModel
+ },
+
+ /**
+ * Registered components handler
+ *
+ * @type object
+ */
+ activateTBT: function(){
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.tbtActivate) {
+ SDL.TurnByTurnView.activate(SDL.SDLAppController.model.appID);
+ }
+ },
+
+ /**
+ * Registered components handler
+ *
+ * @type object
+ */
+ registeredComponentStatus: function(component) {
+
+ for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
+ if (SDL.SDLModel.registeredComponents[i].type == component) {
+ SDL.SDLModel.set('registeredComponents.' + i + '.state', true);
+ return;
+ }
+ }
+ },
+
+ /**
+ * Registered components handler
+ *
+ * @type object
+ */
+ unregisterComponentStatus: function(component) {
+
+ for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
+ if (SDL.SDLModel.registeredComponents[i].type == component) {
+ SDL.SDLModel.set('registeredComponents.' + i + '.state', false);
+ return;
+ }
+ }
+ },
+
+ /**
+ * Notification from state manager about triggered state
+ * Method aborts all popups and requests currently in process
+ *
+ * @type object
+ */
+ triggerState: function(){
+ if (SDL.SliderView.active) {
+ SDL.SliderView.deactivate(false);
+ }
+ },
+
+ /**
+ * Notify SDLCore that HMI is ready and all components are registered
+ *
+ * @type {String}
+ */
+ componentsReadiness: function(component) {
+
+ for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
+ if (!SDL.SDLModel.registeredComponents[i].state) {
+ return;
+ }
+ }
+ FFW.BasicCommunication.onReady();
+ SDL.SDLModel.timeStamp = new Date().getTime();
+
+ console.log(SDL.SDLModel.timeStamp);
+
+ }.observes('SDL.SDLModel.registeredComponents.@each.state'),
+
+ /**
+ * Show VrHelpItems popup with necessary params
+ * if VRPopUp is active - show data from Global Properties
+ * if VRPopUp and InteractionChoicesView are active - show data from PerformInteraction request
+ *
+ */
+ showVRHelpItems: function() {
+
+ if (SDL.SDLAppController.model) {
+ if (SDL.SDLModel.VRActive && SDL.SDLModel.interactionData.vrHelp) {
+
+ SDL.SDLModel.ShowVrHelp(SDL.SDLModel.interactionData.vrHelpTitle, SDL.SDLModel.interactionData.vrHelp);
+ } else if (SDL.SDLModel.VRActive && !SDL.SDLModel.interactionData.vrHelp && SDL.SDLAppController.model.globalProperties.vrHelp) {
+
+ if (SDL.SDLAppController.model) {
+ SDL.SDLModel.ShowVrHelp(SDL.SDLAppController.model.globalProperties.vrHelpTitle, SDL.SDLAppController.model.globalProperties.vrHelp );
+ }
+ } else {
+ if (SDL.VRHelpListView.active) {
+ SDL.VRHelpListView.deactivate();
+ }
+ }
+ } else if (SDL.VRHelpListView.active) {
+ SDL.VRHelpListView.deactivate();
+ }
+ }.observes('SDL.SDLModel.VRActive', 'SDL.SDLModel.interactionData.vrHelp'),
+
+ /**
+ * Handler for Help button in VR menu
+ * triggers helpPrompt on HMI
+ *
+ */
+ vrHelpAction: function() {
+ if (SDL.SDLModel.interactionData.helpPrompt) {
+ SDL.SDLModel.onPrompt(SDL.SDLModel.interactionData.helpPrompt);
+ } else if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.helpPrompt.length) {
+ SDL.SDLModel.onPrompt(SDL.SDLAppController.model.globalProperties.helpPrompt);
+ }
+ },
+
+ /**
+ * Notify SDLCore that TTS haas finished processing
+ *
+ * @type {String}
+ */
+ TTSResponseHandler: function() {
+
+ if (FFW.TTS.requestId) {
+ if (FFW.TTS.aborted) {
+ FFW.TTS.sendError(SDL.SDLModel.resultCode["ABORTED"], FFW.TTS.requestId, "TTS.Speak", "TTS Speak request aborted");
+ } else {
+ FFW.TTS.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"], FFW.TTS.requestId, "TTS.Speak");
+ }
+ FFW.TTS.requestId = null;
+ FFW.TTS.aborted = false;
+ }
+ },
+
+ /**
+ * Move VR list to right side when VRHelpList was activated
+ *
+ * @type {String}
+ */
+ VRMove: function() {
+
+ if (SDL.VRHelpListView.active || SDL.InteractionChoicesView.active) {
+ SDL.SDLModel.set('VRHelpListActivated', true);
+ } else {
+ SDL.SDLModel.set('VRHelpListActivated', false);
+ }
+ },
+
+ /**
+ * Activate navigationApp method to set navigationApp data to controlls on main screen
+ */
+ navigationAppUpdate: function() {
+ SDL.BaseNavigationView.update(SDL.SDLAppController.model.appID);
+ },
+
+ /**
+ * Default action for SoftButtons: closes window, popUp or clears
+ * applications screen
+ *
+ * @param {Object}
+ */
+ defaultActionSoftButton: function(element) {
+
+ switch (element.groupName) {
+ case "AlertPopUp": {
+ SDL.AlertPopUp.deactivate();
+ break;
+ }
+ case "ScrollableMessage": {
+ SDL.ScrollableMessage.deactivate(true);
+ break;
+ }
+ }
+ },
+
+ /**
+ * SDL notification call function
+ * to notify that SDL Core should reset timeout for some method
+ */
+ onResetTimeout: function (appID, methodName) {
+ FFW.UI.onResetTimeout(appID, methodName);
+ },
+ /**
+ * Action to show Voice Recognition PopUp
+ */
+ activateVRPopUp: function() {
+
+ if (FFW.TTS.requestId) {
+ FFW.TTS.aborted = true;
+ SDL.TTSPopUp.DeactivateTTS();
+ }
+ if (SDL.AlertPopUp.active) {
+ SDL.AlertPopUp.deactivate('ABORTED');
+ }
+ SDL.SDLModel.toggleProperty('VRActive');
+
+ },
+ /**
+ * Action for SoftButtons that closes popUp or window and opens
+ * applications screen
+ *
+ * @param {Object}
+ */
+ stealFocusSoftButton: function(element) {
+
+ switch (element.groupName) {
+ case "AlertPopUp": {
+ SDL.AlertPopUp.deactivate();
+ this.onActivateSDLApp(element);
+ break;
+ }
+ case "ScrollableMessage": {
+ SDL.ScrollableMessage.deactivate();
+ this.onActivateSDLApp(element);
+ break;
+ }
+ }
+ },
+ /**
+ * Action for SoftButtons that clears popUps timer and it become visible
+ * all the time until user user closes it
+ *
+ * @param {Object}
+ */
+ keepContextSoftButton: function(element) {
+
+ switch (element.groupName) {
+ case "AlertPopUp": {
+ clearTimeout(SDL.AlertPopUp.timer);
+ SDL.AlertPopUp.timer = setTimeout(function() {
+ SDL.AlertPopUp.deactivate();
+ }, SDL.AlertPopUp.timeout);
+ this.onResetTimeout(element.appID, "UI.Alert");
+ break;
+ }
+ case "ScrollableMessage": {
+ clearTimeout(SDL.ScrollableMessage.timer);
+ SDL.ScrollableMessage.timer = setTimeout(function() {
+ SDL.ScrollableMessage.deactivate();
+ }, SDL.ScrollableMessage.timeout);
+ this.onResetTimeout(element.appID, "UI.ScrollableMessage");
+ break;
+ }
+ }
+ },
+ /**
+ * Action for ClosePopUp request that triggers deactivate function from
+ * opened popUp
+ */
+ closePopUp: function(methodName) {
+
+ if (methodName == "UI.Alert") {
+ SDL.AlertPopUp.deactivate();
+ }
+ if (methodName == "UI.PerformAudioPassThru") {
+ SDL.AudioPassThruPopUp.deactivate();
+ this.performAudioPassThruResponse(SDL.SDLModel.resultCode["SUCCESS"]);
+ }
+ if (methodName == "UI.PerformInteraction") {
+ SDL.InteractionChoicesView.deactivate("ABORTED");
+ }
+ if (methodName == "UI.ScrollableMessage") {
+ SDL.ScrollableMessage.deactivate(true);
+ }
+ if (methodName == "UI.Slider") {
+ SDL.SliderView.deactivate(true);
+ }
+// if (SDL.VRHelpListView.active) {
+// SDL.VRHelpListView.deactivate();
+// }
+ },
+
+ /**
+ * Method to close InteractionChoices view
+ */
+ InteractionChoicesDeactivate: function() {
+
+ SDL.InteractionChoicesView.deactivate("ABORTED");
+ },
+
+ /**
+ * Method to close AlertMeneuverPopUp view
+ */
+ closeAlertMeneuverPopUp: function() {
+
+ SDL.AlertManeuverPopUp.set('activate', false);
+ },
+ /**
+ * Method to open Turn List view from TBT
+ *
+ * @param {Number}
+ * appID AppID of activated sdl application
+ */
+ tbtTurnList: function(appID) {
+
+ SDL.TBTTurnList.activate(appID);
+ },
+ /**
+ * Method to sent notification with selected state of TBT Client State
+ *
+ * @param {String}
+ */
+ tbtClientStateSelected: function(state) {
+
+ FFW.Navigation.onTBTClientState(state);
+ },
+ /**
+ * Method to sent notification with selected reason of Exit Application
+ *
+ * @param {String}
+ */
+ exitAppViewSelected: function(state) {
+
+ //if ignition off if executed than OnIgnitionCycleOver must be sent
+ if (state == SDL.SDLModel.exitAppState[0].name) {
+
+ FFW.BasicCommunication.OnIgnitionCycleOver();
+ }
+
+ FFW.BasicCommunication.ExitAllApplications(state);
+ },
+ /**
+ * OnAwakeSDL from HMI returns SDL to normal operation
+ * after OnExitAllApplications(SUSPEND)
+ *
+ */
+ onAwakeSDLNotificationSend: function() {
+ FFW.BasicCommunication.OnAwakeSDL();
+ },
+
+ /**
+ * Method to sent notification with selected reason of OnSystemRequest
+ *
+ * @param {String}
+ */
+ systemRequestViewSelected: function(state) {
+
+ if (SDL.SDLModel.policyURLs.length) {
+ FFW.BasicCommunication.OnSystemRequest(state, SDL.SDLModel.policyURLs[0].policyAppId, null, SDL.SDLModel.policyURLs[0].url);
+ } else {
+ FFW.BasicCommunication.OnSystemRequest(state);
+ }
+
+ },
+ /**
+ * Method to sent notification ABORTED for PerformInteractionChoise
+ */
+ interactionChoiseCloseResponse: function(appID, result, choiceID, manualTextEntry) {
+
+ FFW.UI.interactionResponse(SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry);
+ SDL.SDLModel.set('interactionData.vrHelpTitle', null);
+ SDL.SDLModel.set('interactionData.vrHelp', null);
+
+ SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction = null;
+
+ if (SDL.TTSPopUp.active && FFW.TTS.requestId == null) {
+ SDL.TTSPopUp.DeactivateTTS();
+ }
+ },
+ /**
+ * Method to sent notification ABORTED for VR PerformInteraction
+ */
+ vrInteractionResponse: function(result, choiceID) {
+
+ FFW.VR.interactionResponse(SDL.SDLModel.vrActiveRequests.vrPerformInteraction, result, choiceID);
+
+ SDL.SDLModel.vrActiveRequests.vrPerformInteraction = null;
+
+ SDL.SDLModel.set('VRActive', false);
+
+ SDL.InteractionChoicesView.timerUpdate();
+
+ if (choiceID && SDL.TTSPopUp.active && FFW.TTS.requestId == null) {
+ SDL.TTSPopUp.DeactivateTTS();
+ }
+
+ SDL.SDLModel.interactionData.helpPrompt = null;
+ },
+ /**
+ * Method to sent notification for Alert
+ *
+ * @param {String}
+ * result
+ * @param {Number}
+ * alertRequestID
+ */
+ alertResponse: function(result, alertRequestID) {
+
+ FFW.UI.alertResponse(result, alertRequestID);
+ },
+ /**
+ * Method to sent notification for Scrollable Message
+ *
+ * @param {String}
+ * result
+ * @param {Number}
+ * messageRequestId
+ */
+ scrollableMessageResponse: function(result, messageRequestId) {
+
+ if (result == SDL.SDLModel.resultCode['SUCCESS']) {
+ FFW.UI.sendUIResult(result,
+ messageRequestId,
+ 'UI.ScrollableMessage');
+ } else {
+ FFW.UI.sendError(result,
+ messageRequestId,
+ 'UI.ScrollableMessage',
+ "ScrollableMessage aborted!");
+ }
+ },
+ /**
+ * Method to do necessary actions when user navigate throught the menu
+ */
+ userStateAction: function() {
+ if (SDL.ScrollableMessage.active) {
+ SDL.ScrollableMessage.deactivate(true);
+ }
+ },
+ /**
+ * Method to sent notification for Slider
+ *
+ * @param {String}
+ * result
+ * @param {Number}
+ * sliderRequestId
+ */
+ sliderResponse: function(result, sliderRequestId) {
+
+ FFW.UI.sendUIResult(result, sliderRequestId, 'UI.Slider');
+ },
+ /**
+ * Method to call performAudioPassThruResponse with Result code
+ * parameters
+ *
+ * @param {Object}
+ * element Button object
+ */
+ callPerformAudioPassThruPopUpResponse: function(element) {
+
+ this.performAudioPassThruResponse(element.responseResult);
+ },
+ /**
+ * Method close PerformAudioPassThruPopUp and call response from UI RPC
+ * back to SDLCore
+ *
+ * @param {String}
+ * result Result code
+ */
+ performAudioPassThruResponse: function(result) {
+
+ SDL.SDLModel.set('AudioPassThruState', false);
+ FFW.UI.sendUIResult(result,
+ FFW.UI.performAudioPassThruRequestID,
+ "UI.PerformAudioPassThru");
+ FFW.UI.performAudioPassThruRequestID = -1;
+ },
+ /**
+ * Method close PerformAudioPassThruPopUp and call error response from
+ * UI RPC back to SDLCore
+ *
+ * @param {String}
+ * result Result code
+ */
+ callPerformAudioPassThruPopUpErrorResponse: function(element) {
+
+ SDL.SDLModel.set('AudioPassThruState', false);
+ FFW.UI.sendError(element.responseResult,
+ FFW.UI.performAudioPassThruRequestID,
+ "UI.PerformAudioPassThru",
+ "PerformAudioPassThru was not completed successfuly!");
+ FFW.UI.performAudioPassThruRequestID = -1;
+ },
+ /**
+ * Method to set language for UI component with parameters sent from
+ * SDLCore to UIRPC
+ */
+ onLanguageChangeUI: function() {
+
+ FFW.UI.OnLanguageChange(SDL.SDLModel.hmiUILanguage);
+ FFW.BasicCommunication.OnSystemInfoChanged(SDL.SDLModel.hmiUILanguage);
+ }.observes('SDL.SDLModel.hmiUILanguage'),
+ /**
+ * Method to set language for TTS and VR components with parameters sent
+ * from SDLCore to UIRPC
+ */
+ onLanguageChangeTTSVR: function() {
+
+ FFW.TTS.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
+ FFW.VR.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
+ }.observes('SDL.SDLModel.hmiTTSVRLanguage'),
+ /**
+ * Register application
+ *
+ * @param {Object}
+ * params
+ * @param {Number}
+ * applicationType
+ */
+ registerApplication: function(params, applicationType) {
+
+ if (applicationType === undefined || applicationType === null) {
+
+ SDL.SDLModel.get('registeredApps').pushObject(this.applicationModels[0].create( { //Magic number 0 - Default media model for not initialized applications
+ appID: params.appID,
+ appName: params.appName,
+ deviceName: params.deviceName,
+ isMedia: 0,
+ disabledToActivate: params.disabled ? true : false
+ }));
+ } else {
+
+ SDL.SDLModel.get('registeredApps').pushObject(this.applicationModels[applicationType].create( {
+ appID: params.appID,
+ appName: params.appName,
+ deviceName: params.deviceName,
+ appType: params.appType,
+ isMedia: applicationType == 0 ? true : false,
+ initialized: true,
+ disabledToActivate: params.disabled ? true : false
+ }));
+ }
+
+ var exitCommand = {
+ "id": -10,
+ "params": {
+ "menuParams":{
+ "parentID": 0,
+ "menuName": "Exit 'DRIVER_DISTRACTION_VIOLATION'",
+ "position": 0
+ },
+ cmdID: -1
+ }
+ };
+
+ SDL.SDLController.getApplicationModel(params.appID).addCommand(exitCommand);
+
+ exitCommand = {
+ "id": -10,
+ "params": {
+ "menuParams":{
+ "parentID": 0,
+ "menuName": "Exit 'USER_EXIT'",
+ "position": 0
+ },
+ cmdID: -2
+ }
+ };
+
+ SDL.SDLController.getApplicationModel(params.appID).addCommand(exitCommand);
+ },
+ /**
+ * Unregister application
+ *
+ * @param {Number}
+ * appID
+ */
+ unregisterApplication: function(appID) {
+
+ this.getApplicationModel(appID).VRCommands = [];
+
+ this.getApplicationModel(appID).onDeleteApplication(appID);
+
+ var len = SDL.SDLModel.VRCommands.length;
+ for (var i = len - 1; i >= 0; i--) {
+ if (SDL.SDLModel.VRCommands[i].appID == appID) {
+ SDL.SDLModel.VRCommands.splice(i, 1);
+ }
+ }
+
+ SDL.VRPopUp.DeleteActivateApp(appID);
+ if (SDL.SDLModel.stateLimited == appID) {
+ SDL.SDLModel.set('stateLimited', null);
+ }
+
+ if (SDL.VRHelpListView.active) {
+ this.showVRHelpItems();
+ }
+ },
+ /**
+ * SDL Driver Distraction ON/OFF switcher
+ */
+ selectDriverDistraction: function() {
+
+ if (SDL.SDLModel.driverDistractionState) {
+ FFW.UI.onDriverDistraction("DD_ON");
+ } else {
+ FFW.UI.onDriverDistraction("DD_OFF");
+ }
+ }.observes('SDL.SDLModel.driverDistractionState'),
+
+ /**
+ * Ondisplay keyboard event handler
+ * Sends notification on SDL Core with changed value
+ */
+ onKeyboardChanges: function() {
+ if (null !== SDL.SDLModel.keyboardInputValue) {
+
+ var str = SDL.SDLModel.keyboardInputValue;
+
+ if (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
+ switch (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
+ case 'SINGLE_KEYPRESS':{
+ FFW.UI.OnKeyboardInput(str.charAt( str.length-1 ), "KEYPRESS");
+ break;
+ }
+ case 'QUEUE_KEYPRESS':{
+ break;
+ }
+ case 'RESEND_CURRENT_ENTRY':{
+ if (str) {
+ FFW.UI.OnKeyboardInput(str, "KEYPRESS");
+ }
+ break;
+ }
+ }
+ }
+ }
+ }.observes('SDL.SDLModel.keyboardInputValue'),
+
+ /**
+ * Get application model
+ *
+ * @param {Number}
+ */
+ getApplicationModel: function(applicationId) {
+
+ return SDL.SDLModel.registeredApps.filterProperty('appID', applicationId)[0];
+ },
+ /**
+ * Function returns ChangeDeviceView back to previous state
+ */
+ turnChangeDeviceViewBack: function() {
+
+ SDL.States.goToStates('info.apps');
+ },
+ /**
+ * Enter screen vith list of devices application model
+ */
+ onGetDeviceList: function() {
+
+ SDL.States.goToStates('info.devicelist');
+ SDL.SDLModel.set('deviceSearchProgress', true);
+ },
+ /**
+ * Send notification if device was choosed
+ *
+ * @param element:
+ * SDL.Button
+ */
+ onDeviceChoosed: function(element) {
+
+ SDL.SDLModel.set('CurrDeviceInfo.name', element.deviceName);
+ SDL.SDLModel.set('CurrDeviceInfo.id', element.id);
+ FFW.BasicCommunication.OnDeviceChosen(element.deviceName,
+ element.id);
+ this.turnChangeDeviceViewBack();
+ },
+ /**
+ * Method call's request to get list of applications
+ */
+ findNewApps: function() {
+
+ FFW.BasicCommunication.OnFindApplications();
+ },
+ /**
+ * Method activates selected registered application
+ *
+ * @param {Object}
+ */
+ onActivateSDLApp: function(element) {
+
+ if (SDL.SDLModel.VRActive) {
+ SDL.SDLModel.toggleProperty('VRActive');
+ }
+ FFW.BasicCommunication.ActivateApp(element.appID);
+ },
+ /**
+ * Method sent custom softButtons pressed and event status to RPC
+ *
+ * @param {Object}
+ */
+ onSoftButtonActionUpCustom: function(element) {
+
+ if (element.time > 0) {
+ FFW.Buttons.buttonEventCustom(
+ "CUSTOM_BUTTON",
+ "BUTTONUP",
+ element.softButtonID,
+ element.appID
+ );
+ } else {
+ FFW.Buttons.buttonEventCustom(
+ "CUSTOM_BUTTON",
+ "BUTTONUP",
+ element.softButtonID,
+ element.appID
+ );
+ FFW.Buttons.buttonPressedCustom(
+ "CUSTOM_BUTTON",
+ "SHORT",
+ element.softButtonID,
+ element.appID
+ );
+ }
+ clearTimeout(element.timer);
+ element.time = 0;
+ },
+ /**
+ * Method sent custom softButtons pressed and event status to RPC
+ *
+ * @param {Object}
+ */
+ onSoftButtonActionDownCustom: function(element) {
+
+ FFW.Buttons.buttonEventCustom(
+ "CUSTOM_BUTTON",
+ "BUTTONDOWN",
+ element.softButtonID,
+ element.appID
+ );
+ element.time = 0;
+ element.timer = setTimeout(function() {
+
+ FFW.Buttons.buttonPressedCustom(
+ "CUSTOM_BUTTON",
+ "LONG",
+ element.softButtonID,
+ element.appID
+ );
+ element.time++;
+ }, 2000);
+ },
+ /**
+ * Method sent softButtons pressed and event status to RPC
+ *
+ * @param {String}
+ * @param {Object}
+ */
+ onSoftButtonActionUp: function(element) {
+
+ if (element.time > 0) {
+ FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
+ } else {
+ FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
+ FFW.Buttons.buttonPressed(element.presetName, "SHORT");
+ }
+ clearTimeout(element.timer);
+ element.time = 0;
+ },
+ /**
+ * Method sent softButtons Ok pressed and event status to RPC
+ *
+ * @param {String}
+ */
+ onSoftButtonOkActionDown: function(name) {
+
+ FFW.Buttons.buttonEvent(name, "BUTTONDOWN");
+ },
+ /**
+ * Method sent softButton OK pressed and event status to RPC
+ *
+ * @param {String}
+ */
+ onSoftButtonOkActionUp: function(name) {
+
+ FFW.Buttons.buttonEvent(name, "BUTTONUP");
+ FFW.Buttons.buttonPressed(name, "SHORT");
+ if (SDL.SDLAppController.model) {
+ SDL.SDLAppController.model.set('isPlaying',
+ !SDL.SDLAppController.model.isPlaying);
+ }
+ },
+ /**
+ * Method to send OnEmergencyEvent to SDL
+ *
+ * @param {String}
+ */
+ OnEmergencyEventNotificationSend: function(element) {
+
+ FFW.BasicCommunication.OnEmergencyEvent(element.enabled);
+ element.set('enabled', !element.enabled);
+ },
+ /**
+ * Method sent softButtons pressed and event status to RPC
+ *
+ * @param {String}
+ * @param {Object}
+ */
+ onSoftButtonActionDown: function(element) {
+
+ FFW.Buttons.buttonEvent(element.presetName, "BUTTONDOWN");
+ element.time = 0;
+ element.timer = setTimeout(function() {
+
+ FFW.Buttons.buttonPressed(element.presetName, "LONG");
+ element.time++;
+ }, 2000);
+ },
+ /**
+ * Send system context
+ */
+ onSystemContextChange: function(appID) {
+
+ var sysContextValue = this.get('sysContext');
+
+ if ((appID && SDL.SDLController.getApplicationModel(appID) != SDL.SDLAppController.model)
+ || this.backgroundAlertAppID){
+
+ if (SDL.SDLAppController.model == null
+ || (SDL.SDLAppController.model.appID != appID
+ && this.backgroundAlertAppID == null)) {
+
+ this.backgroundAlertAppID = appID;
+ FFW.UI.OnSystemContext(sysContextValue, appID);
+ if (SDL.SDLAppController.model) {
+ FFW.UI.OnSystemContext('HMI_OBSCURED', SDL.SDLAppController.model.appID);
+ }
+
+ } else if (SDL.SDLAppController.model != null
+ && SDL.SDLAppController.model.appID != appID
+ && this.backgroundAlertAppID != null
+ && SDL.SDLAppController.model.appID != this.backgroundAlertAppID) {
+
+ FFW.UI.OnSystemContext('MAIN', this.backgroundAlertAppID);
+ FFW.UI.OnSystemContext(sysContextValue, appID);
+ }
+ } else {
+ if (SDL.SDLAppController.model) {
+ appID = SDL.SDLAppController.model.appID;
+ } else {
+ appID = null;
+ }
+
+ FFW.UI.OnSystemContext(sysContextValue, appID);
+ }
+ }
+ });
diff --git a/src/components/HMI/app/controller/sdl/MediaController.js b/src/components/HMI/app/controller/sdl/MediaController.js
new file mode 100644
index 0000000000..b09d26b76f
--- /dev/null
+++ b/src/components/HMI/app/controller/sdl/MediaController.js
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLMediaController
+ * @desc SDL Media Controller logic
+ * @category Controller
+ * @filesource app/controller/sdl/SDLMediaController.js
+ * @version 1.0
+ */
+
+SDL.SDLMediaController = Em.Object.create( {
+
+ /**
+ * Current Media application id
+ *
+ * @type {Number}
+ */
+ currentAppId: 0,
+
+ /**
+ * Return current Media application name used for application button
+ */
+ currentAppName: function() {
+
+ if (this.currentAppId) {
+ return SDL.SDLController.getApplicationModel(this.currentAppId).appName;
+ }
+ }.property('this.currentAppId'),
+
+ /**
+ * Return current Media application icon used for application button
+ */
+ currentAppIcon: function() {
+
+ if (this.currentAppId) { return SDL.SDLController
+ .getApplicationModel(this.currentAppId).appIcon; }
+ }.property('this.currentAppId', 'SDL.SDLAppController.model.appIcon'),
+
+ /** Call notification OnCommand on UIRPC */
+ onCommand: function(element) {
+
+ FFW.UI.onCommand(element.commandID, element.appID);
+ },
+
+ /** Call notification OnCommandSoftButton on UIRPC */
+ onCommandSoftButton: function(element) {
+
+ FFW.UI.onCommandSoftButton(element.softButtonID, element.appID);
+ },
+
+ /** Switching on Application */
+ activateApp: function(applicationModel) {
+
+ // store active application id
+ this.set('currentAppId', applicationModel.appID);
+
+ // set active model
+ SDL.SDLAppController.set('model', applicationModel);
+
+ SDL.MediaController.turnOnSDL();
+
+ },
+
+ /**
+ * Restore current application to active state
+ */
+ activateCurrentApp: function() {
+
+ FFW.BasicCommunication.OnAppActivated(this.currentAppId);
+ },
+
+ /** SDL perform interaction action from VR */
+ onVRPerformInteractionChoosed: function(element) {
+
+ if (SDL.States.media.sdl.sdlperforminteractionchoise.active) {
+ FFW.VR.onChoise(element.choiceID);
+ SDL.States.back();
+ }
+
+ },
+
+ /** SDL perform interaction action */
+ onPerformInteractionChoosed: function(element) {
+
+ if (SDL.States.media.sdl.sdlperforminteractionchoise.active) {
+ FFW.UI.interactionResponse("SUCCESS", element.choiceID);
+ SDL.States.back();
+ }
+
+ },
+
+ /**
+ * Method hides sdl activation button and sdl application
+ *
+ * @param {Number}
+ */
+ onDeleteApplication: function(appID) {
+
+ if (this.currentAppId == appID) {
+
+ if (SDL.States.media.sdlmedia.active
+ || SDL.SDLAppController.model) {
+
+ SDL.SDLController.getApplicationModel(appID).set('active', false);
+
+ SDL.States.goToStates('info.apps');
+
+ SDL.MediaController.set('activeState', 'media.player');
+ }
+
+ this.set('currentAppId', 0);
+ }
+
+ SDL.SDLModel.stopStream(appID);
+ SDL.SDLModel.get('registeredApps').removeObjects(SDL.SDLModel.get('registeredApps').filterProperty('appID', appID));
+ SDL.SDLModel.get('updatedAppsList').removeObjects(SDL.SDLModel.get('updatedAppsList').filterProperty('appID', appID));
+ SDL.InfoAppsView.showAppList();
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/sdl/NonMediaController.js b/src/components/HMI/app/controller/sdl/NonMediaController.js
new file mode 100644
index 0000000000..fc4ff03717
--- /dev/null
+++ b/src/components/HMI/app/controller/sdl/NonMediaController.js
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.NonMediaController
+ * @desc SDL NonMedia Controller logic
+ * @category Controller
+ * @filesource app/controller/sdl/NonMediaController.js
+ * @version 1.0
+ */
+
+SDL.NonMediaController = Em.Object.create( {
+
+ /**
+ * Current NonMedia application id
+ *
+ * @type {Number}
+ */
+ currentAppId: 0,
+
+ /**
+ * Return current NonMedia application name used for application button
+ */
+ currentAppName: function() {
+
+ if (this.currentAppId) { return SDL.SDLController
+ .getApplicationModel(this.currentAppId).appName; }
+ }.property('this.currentAppId'),
+
+ /**
+ * Return current NonMedia application icon used for application button
+ */
+ currentAppIcon: function() {
+
+ if (this.currentAppId) { return SDL.SDLController
+ .getApplicationModel(this.currentAppId).appIcon; }
+ }.property('this.currentAppId', 'SDL.SDLAppController.model.appIcon'),
+
+ /**
+ * Activate application model
+ *
+ * @param {SDLAppModel}
+ */
+ activateApp: function(applicationModel) {
+
+ // store active application id
+ this.set('currentAppId', applicationModel.appID);
+
+ // set active model
+ SDL.SDLAppController.set('model', applicationModel);
+
+ // send response
+ // FFW.BasicCommunication.ActivateApp( applicationModel.appID );
+
+ // Go to SDL state
+ SDL.InfoController.turnOnSDL();
+ //SDL.States.goToStates('info.nonMedia');
+ },
+
+ /**
+ * Restore current application to active state
+ */
+ activateCurrentApp: function() {
+
+ FFW.BasicCommunication.OnAppActivated(this.currentAppId);
+ },
+
+ /**
+ * Method hides sdl activation button and sdl application
+ *
+ * @param {Number}
+ */
+ onDeleteApplication: function(appID) {
+
+ if (this.currentAppId == appID) {
+ if (SDL.States.info.nonMedia.active
+ || SDL.SDLAppController.model) {
+
+ SDL.SDLController.getApplicationModel(appID).set('active', false);
+
+ SDL.States.goToStates('info.apps');
+ }
+
+ SDL.InfoController.set('activeState', 'info.apps');
+
+ this.set('currentAppId', 0);
+ }
+ SDL.SDLModel.get('registeredApps').removeObjects(SDL.SDLModel.get('registeredApps').filterProperty('appID', appID));
+ SDL.SDLModel.get('updatedAppsList').removeObjects(SDL.SDLModel.get('updatedAppsList').filterProperty('appID', appID));
+ SDL.InfoAppsView.showAppList();
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/sdl/RPCController.js b/src/components/HMI/app/controller/sdl/RPCController.js
new file mode 100644
index 0000000000..44cbd6978e
--- /dev/null
+++ b/src/components/HMI/app/controller/sdl/RPCController.js
@@ -0,0 +1,3069 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.RPCController
+ * @desc RPC Controller
+ * @category Controller
+ * @filesource app/controller/sdl/RPCController.js
+ * @version 1.0
+ */
+
+SDL.RPCController = Em.Object
+ .create( {
+
+ capabilityCheckResult: null,
+
+ /**
+ * Start register RPC components on controller init
+ */
+ ConnectToSDL: function() {
+
+ if (FLAGS.Buttons) {
+ FFW.Buttons.connect();
+ }
+
+ if (FLAGS.TTS) {
+ FFW.TTS.connect();
+ }
+
+ if (FLAGS.VR) {
+ FFW.VR.connect();
+ }
+
+ if (FLAGS.BC) {
+ FFW.BasicCommunication.connect();
+ }
+
+ if (FLAGS.UI) {
+ FFW.UI.connect();
+ }
+
+ if (FLAGS.VI) {
+ FFW.VehicleInfo.connect();
+ }
+
+ if (FLAGS.Navi) {
+ FFW.Navigation.connect();
+ }
+ },
+
+ capabilitiesCheck: function(key, value) {
+ if (key == "imageType" && value == "STATIC") {
+ SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value};
+ }
+ if (key == "type" && value == "PRE_RECORDED") {
+ SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value};
+ }
+ if (key == "type" && value == "SAPI_PHONEMES") {
+ SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value};
+ }
+ if (key == "type" && value == "LHPLUS_PHONEMES") {
+ SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value};
+ }
+ if (key == "type" && value == "SILENCE") {
+ SDL.RPCController.capabilityCheckResult = {code: SDL.SDLModel.resultCode['UNSUPPORTED_RESOURCE'], type: value};
+ }
+ return value;
+ },
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ BasicCommunication: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request UpdateAppList
+ *
+ * @param {Object}
+ * params
+ */
+ UpdateAppList: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request DialNumber
+ *
+ * @param {Object}
+ * params
+ */
+ DialNumber: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (params.number == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'number' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (typeof params.number != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'number'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request UpdateDeviceList
+ *
+ * @param {Object}
+ * params
+ */
+ UpdateDeviceList: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.deviceList == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'deviceList' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.deviceList.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'deviceList'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+
+ /**
+ * Validate method for request PolicyUpdate
+ *
+ * @param {Object}
+ * params
+ */
+ PolicyUpdate: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.file == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'file' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.file != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'file'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.retry == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'retry' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.retry.length < 1) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'retry'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SystemRequest
+ *
+ * @param {Object}
+ * params
+ */
+ SystemRequest: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.fileName == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'fileName' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.fileName != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'fileName'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.requestType == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'requestType' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ActivateApp
+ *
+ * @param {Object}
+ * params
+ */
+ ActivateApp: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AllowSDLFunctionality
+ *
+ * @param {Object}
+ * params
+ */
+ AllowSDLFunctionality: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.device == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'device' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.device != 'object') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'device'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AllowDeviceToConnect
+ *
+ * @param {Object}
+ * params
+ */
+ AllowDeviceToConnect: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.device == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'device' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetSystemInfo
+ *
+ * @param {Object}
+ * params
+ */
+ GetSystemInfo: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request MixingAudioSupported
+ *
+ * @param {Object}
+ * params
+ */
+ MixingAudioSupported: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AllowAllApps
+ *
+ * @param {Object}
+ * params
+ */
+ AllowAllApps: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AllowApp
+ *
+ * @param {Object}
+ * params
+ */
+ AllowApp: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appPermissions == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'app' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appPermissions.length < 1) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appPermissions'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+
+ }),
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ TTS: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request IsReady
+ *
+ * @param {Object}
+ * params
+ */
+ IsReady: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetLanguage
+ *
+ * @param {Object}
+ * params
+ */
+ GetLanguage: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SetGlobalProperties
+ *
+ * @param {Object}
+ * params
+ */
+ SetGlobalProperties: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetSupportedLanguages
+ *
+ * @param {Object}
+ * params
+ */
+ GetSupportedLanguages: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request StopSpeaking
+ *
+ * @param {Object}
+ * params
+ */
+ StopSpeaking: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Speak
+ *
+ * @param {Object}
+ * params
+ */
+ Speak: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.ttsChunks == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'ttsChunks' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.ttsChunks.length < 1) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'ttsChunks'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ChangeRegistration
+ *
+ * @param {Object}
+ * params
+ */
+ ChangeRegistration: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.language == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'language' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.language != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'language'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request OnLanguageChange
+ *
+ * @param {Object}
+ * params
+ */
+ OnLanguageChange: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.language == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'language' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.language != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'language'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+ }),
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ Navigation: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request IsReady
+ *
+ * @param {Object}
+ * params
+ */
+ IsReady: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Navigation.SendLocation
+ *
+ * @param {Object}
+ * params
+ */
+ SendLocation: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Navigation.AlertManeuver
+ *
+ * @param {Object}
+ * params
+ */
+ AlertManeuver: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request StartStream
+ *
+ * @param {Object}
+ * params
+ */
+ StartStream: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.url == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'url' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.url != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'url'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request StopStream
+ *
+ * @param {Object}
+ * params
+ */
+ StopStream: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request StartAudioStream
+ *
+ * @param {Object}
+ * params
+ */
+ StartAudioStream: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.url == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'url' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.url != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'url'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request StopAudioStream
+ *
+ * @param {Object}
+ * params
+ */
+ StopAudioStream: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Navigation.ShowConstantTBT
+ *
+ * @param {Object}
+ * params
+ */
+ ShowConstantTBT: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("turnIcon" in params
+ && ((params.turnIcon.imageType !== "DYNAMIC") && (params.turnIcon.imageType !== "STATIC"))) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("nextTurnIcon" in params
+ && ((params.nextTurnIcon.imageType !== "DYNAMIC") && (params.nextTurnIcon.imageType !== "STATIC"))) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.navigationTexts == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'navigationTexts' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.navigationTexts.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'navigationTexts'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Navigation.UpdateTurnList
+ *
+ * @param {Object}
+ * params
+ */
+ UpdateTurnList: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("turnList" in params) {
+
+ for ( var i = 0; i < params.turnList.length; i++) {
+ if (params.turnList[i].image
+ && ((params.turnIcon.imageType !== "DYNAMIC")
+ && (params.turnIcon.imageType !== "STATIC"))) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ e;
+ }
+ }
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+
+ }),
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ UI: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request SetDisplayLayout
+ *
+ * @param {Object}
+ * params
+ */
+ SetDisplayLayout: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request IsReady
+ *
+ * @param {Object}
+ * params
+ */
+ IsReady: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request UI.Alert
+ *
+ * @param {Object}
+ * params
+ */
+ Alert: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.alertStrings == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'alertStrings' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.alertStrings.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'alertStrings'!"
+ };
+
+ return this.resultStruct;
+ }
+ if ('duration' in params && typeof params.duration != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'duration'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Show
+ *
+ * @param {Object}
+ * params
+ */
+ ShowNotification: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("icon" in params &&
+ ((params.turnIcon.imageType !== "DYNAMIC") && (params.turnIcon.imageType !== "STATIC"))) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.text == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'text' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.text.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'text'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ },
+
+ /**
+ * Validate method for request Show
+ *
+ * @param {Object}
+ * params
+ */
+ Show: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("graphic" in params
+ && ((params.graphic.imageType !== "DYNAMIC") && (params.graphic.imageType !== "STATIC"))) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.showStrings == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'showStrings' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.showStrings.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'showStrings'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AddCommand
+ *
+ * @param {Object}
+ * params
+ */
+ AddCommand: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("cmdIcon" in params
+ && (params.cmdIcon.imageType !== "DYNAMIC" && params.cmdIcon.imageType !== "STATIC")) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.cmdID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'cmdID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.cmdID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'cmdID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.menuParams == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'menuParams' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.menuParams != 'object') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'menuParams'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.menuParams.menuName == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'menuName' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.menuParams.menuName != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'menuName'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request DeleteCommand
+ *
+ * @param {Object}
+ * params
+ */
+ DeleteCommand: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.cmdID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'cmdID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.cmdID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'cmdID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AddSubMenu
+ *
+ * @param {Object}
+ * params
+ */
+ AddSubMenu: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.menuID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'menuID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.menuID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'menuID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (!params.menuParams) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'menuParams' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request DeleteSubMenu
+ *
+ * @param {Object}
+ * params
+ */
+ DeleteSubMenu: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.menuID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'menuID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.menuID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'menuID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+ // don't delete if current submenu active
+ if (SDL.SDLController.getApplicationModel(params.appID)
+ .get('currentSubMenuId') == params.menuID) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["IN_USE"],
+ "resultMessage": "SubMenu is already in use!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request PerformInteraction
+ *
+ * @param {Object}
+ * params
+ */
+ PerformInteraction: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SetMediaClockTimer
+ *
+ * @param {Object}
+ * params
+ */
+ SetMediaClockTimer: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.updateMode == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'updateMode' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.updateMode != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'updateMode'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SetGlobalProperties
+ *
+ * @param {Object}
+ * params
+ */
+ SetGlobalProperties: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetCapabilities
+ *
+ * @param {Object}
+ * params
+ */
+ GetCapabilities: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ChangeRegistration
+ *
+ * @param {Object}
+ * params
+ */
+ ChangeRegistration: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.language == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'language' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.language != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'language'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetSupportedLanguages
+ *
+ * @param {Object}
+ * params
+ */
+ GetSupportedLanguages: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetLanguage
+ *
+ * @param {Object}
+ * params
+ */
+ GetLanguage: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SetAppIcon
+ *
+ * @param {Object}
+ * params
+ */
+ SetAppIcon: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.syncFileName == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'syncFileName' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.syncFileName != 'object') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'syncFileName'!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("syncFileName" in params
+ && ((params.syncFileName.imageType !== "DYNAMIC") && (params.syncFileName.imageType !== "STATIC"))) {
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Unsupported image type!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request Slider
+ *
+ * @param {Object}
+ * params
+ */
+ Slider: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.numTicks == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'numTicks' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.numTicks != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'numTicks'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.position == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'position' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.position != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'position'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.sliderHeader == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'sliderHeader' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.sliderHeader != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'sliderHeader'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number' || params.timeout < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ScrollableMessage
+ *
+ * @param {Object}
+ * params
+ */
+ ScrollableMessage: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.messageText == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'messageText' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.messageText.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'messageText'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request PerformAudioPassThru
+ *
+ * @param {Object}
+ * params
+ */
+ PerformAudioPassThru: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.audioPassThruDisplayTexts == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'audioPassThruDisplayTexts' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.audioPassThruDisplayTexts.length < 0
+ || params.audioPassThruDisplayTexts.length > 2) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'audioPassThruDisplayTexts'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request EndAudioPassThru
+ *
+ * @param {Object}
+ * params
+ */
+ EndAudioPassThru: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ClosePopUp
+ *
+ * @param {Object}
+ * params
+ */
+ ClosePopUp: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ShowVrHelp
+ *
+ * @param {Object}
+ * params
+ */
+ ShowVrHelp: function(params) {
+
+ if (params) {
+ if ("appID" in params) {
+
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+ }
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+ }),
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ VehicleInfo: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request IsReady
+ *
+ * @param {Object}
+ * params
+ */
+ IsReady: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request DiagnosticMessage
+ *
+ * @param {Object}
+ * params
+ */
+ DiagnosticMessage: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetVehicleType
+ *
+ * @param {Object}
+ * params
+ */
+ GetVehicleType: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ReadDID
+ *
+ * @param {Object}
+ * params
+ */
+ ReadDID: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.ecuName == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'ecuName' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.ecuName != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'ecuName'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.didLocation == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'didLocation' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.didLocation.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'didLocation'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetDTCs
+ *
+ * @param {Object}
+ * params
+ */
+ GetDTCs: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.ecuName == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'ecuName' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.ecuName != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'ecuName'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetVehicleData
+ *
+ * @param {Object}
+ * params
+ */
+ GetVehicleData: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ /*if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }*/
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request SubscribeVehicleData
+ *
+ * @param {Object}
+ * params
+ */
+ SubscribeVehicleData: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request UnsubscribeVehicleData
+ *
+ * @param {Object}
+ * params
+ */
+ UnsubscribeVehicleData: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+ }),
+
+ /**
+ * Object that contains check methods that returns true if mandatory
+ * fields is successful and returns false if not
+ */
+ VR: Em.Object
+ .create( {
+
+ resultStruct: {},
+
+ /**
+ * Validate method for request IsReady
+ *
+ * @param {Object}
+ * params
+ */
+ IsReady: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request PerformInteraction
+ *
+ * @param {Object}
+ * params
+ */
+ PerformInteraction: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.timeout == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'timeout' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.timeout != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'timeout'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetCapabilities
+ *
+ * @param {Object}
+ * params
+ */
+ GetCapabilities: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetLanguage
+ *
+ * @param {Object}
+ * params
+ */
+ GetLanguage: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request GetSupportedLanguages
+ *
+ * @param {Object}
+ * params
+ */
+ GetSupportedLanguages: function(params) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request AddCommand
+ *
+ * @param {Object}
+ * params
+ */
+ AddCommand: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.cmdID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'cmdID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.cmdID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'cmdID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.vrCommands == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'vrCommands' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.vrCommands.length < 0) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'vrCommands'!"
+ };
+
+ return this.resultStruct;
+ }
+ if ("appID" in params) {
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request DeleteCommand
+ *
+ * @param {Object}
+ * params
+ */
+ DeleteCommand: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.cmdID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'cmdID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.cmdID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'cmdID'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
+ * Validate method for request ChangeRegistration
+ *
+ * @param {Object}
+ * params
+ */
+ ChangeRegistration: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.language == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'language' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.language != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'language'!"
+ };
+
+ return this.resultStruct;
+ }
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ }
+ })
+ });
diff --git a/src/components/HMI/app/controlls/AZERTYLayout.js b/src/components/HMI/app/controlls/AZERTYLayout.js
new file mode 100755
index 0000000000..d6ae033884
--- /dev/null
+++ b/src/components/HMI/app/controlls/AZERTYLayout.js
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.QWERTYLayout
+ * @desc General list component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/QWERTYLayout.js
+ * @version 1.0
+ */
+
+SDL.AZERTYLayout = Em.ContainerView.extend( {
+
+ classNames: 'keyboardLayout AZERTYLayout wide',
+
+ childViews: [
+ 'a',
+ 'z',
+ 'e',
+ 'r',
+ 't',
+ 'y',
+ 'u',
+ 'i',
+ 'o',
+ 'p',
+ 'q',
+ 's',
+ 'd',
+ 'f',
+ 'g',
+ 'h',
+ 'j',
+ 'k',
+ 'l',
+ 'm',
+ 'w',
+ 'x',
+ 'c',
+ 'v',
+ 'b',
+ 'n',
+ 'dash',
+ 'ampersand'
+ ],
+
+ a: SDL.Button.extend({
+ classNames: 'a k0',
+ text : 'a',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ z: SDL.Button.extend({
+ classNames: 'z k1',
+ text : 'z',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ e: SDL.Button.extend({
+ classNames: 'e k2',
+ text : 'e',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ r: SDL.Button.extend({
+ classNames: 'r k3',
+ text : 'r',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ t: SDL.Button.extend({
+ classNames: 't k4',
+ text : 't',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ y: SDL.Button.extend({
+ classNames: 'y k5',
+ text : 'y',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ u: SDL.Button.extend({
+ classNames: 'u k6',
+ text : 'u',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ i: SDL.Button.extend({
+ classNames: 'i k7',
+ text : 'i',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ o: SDL.Button.extend({
+ classNames: 'o k8',
+ text : 'o',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ p: SDL.Button.extend({
+ classNames: 'p k9',
+ text : 'p',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ q: SDL.Button.extend({
+ classNames: 'q k10',
+ text : 'q',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ s: SDL.Button.extend({
+ classNames: 's k11',
+ text : 's',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ d: SDL.Button.extend({
+ classNames: 'd k12',
+ text : 'd',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ f: SDL.Button.extend({
+ classNames: 'f k13',
+ text : 'f',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ g: SDL.Button.extend({
+ classNames: 'g k14',
+ text : 'g',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ h: SDL.Button.extend({
+ classNames: 'h k15',
+ text : 'h',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ j: SDL.Button.extend({
+ classNames: 'j k16',
+ text : 'j',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ k: SDL.Button.extend({
+ classNames: 'k k17',
+ text : 'k',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ l: SDL.Button.extend({
+ classNames: 'l k18',
+ text : 'l',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ m: SDL.Button.extend({
+ classNames: 'm k19',
+ text : 'm',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ w: SDL.Button.extend({
+ classNames: 'w k21',
+ text : 'w',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ x: SDL.Button.extend({
+ classNames: 'x k22',
+ text : 'x',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ c: SDL.Button.extend({
+ classNames: 'c k23',
+ text : 'c',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ v: SDL.Button.extend({
+ classNames: 'v k24',
+ text : 'v',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ b: SDL.Button.extend({
+ classNames: 'b k25',
+ text : 'b',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ n: SDL.Button.extend({
+ classNames: 'n k26',
+ text : 'n',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ dash: SDL.Button.extend({
+ classNames: 'dash k27',
+ text : '-',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ ampersand: SDL.Button.extend({
+ classNames: 'ampersand k28',
+ text : '&',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/Button.js b/src/components/HMI/app/controlls/Button.js
new file mode 100644
index 0000000000..7d5b4f4ed2
--- /dev/null
+++ b/src/components/HMI/app/controlls/Button.js
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.Button
+ * @desc Universal button component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/Button.js
+ * @version 1.0
+ */
+
+SDL.Button = Em.View
+ .extend(Ember.TargetActionSupport,
+ {
+ classNames: [
+ 'ffw-button', 'notpressed'
+ ],
+
+ classNameBindings: [
+ 'pressed', 'disabled', 'hidden'
+ ],
+
+ /** Pressed state binding */
+ pressed: false,
+
+ /** Disable actions on button */
+ disabled: false,
+
+ /** Button icon class */
+ icon: null,
+
+ /** Button text */
+ text: null,
+
+ rightText: null,
+
+ target: this.target ? this.target : this,
+
+ /** Arrow icon */
+ arrow: false,
+
+ /** Button timer flag */
+ timer: 0,
+
+ timerId: null,
+ /** Touch leave event flag */
+ touchleave: false,
+
+ onDown: true,
+
+ helpMode: false,
+ /** */
+ targetElement: null,
+
+ actionDown: function(event) {
+
+ if (this.get('disabled')) { return; }
+
+ var self = this;
+
+ this.set('pressed', true);
+ /** Set Mouse Leave Event Flag to false */
+ this.set('mouseleave', false);
+
+ // Default trigger action
+ if (this.onDown) {
+ this.triggerAction();
+ }
+
+ // Call trigger with timeout
+ if (this.timer) {
+ this.timerId = setInterval(function() {
+
+ self.triggerAction();
+ }, this.timer);
+ }
+ },
+
+ actionUp: function(event) {
+
+ this.set('pressed', false);
+
+ if (this.timer) {
+ clearInterval(this.timerId);
+ }
+
+ if (this.get('disabled')) {
+ if (this.touchleave == true) {
+ this.set('touchleave', false);
+ }
+ return;
+ }
+
+ if (!this.onDown) {
+ this.triggerAction();
+ }
+ },
+
+ /** Only for desktop */
+ mouseLeave: function(event) {
+
+ this.set('pressed', false);
+
+ if (this.timer) {
+ clearInterval(this.timerId);
+ }
+ },
+
+ /**
+ * Only for IOS Simulation of mouseleave event for touch devices If
+ * target element looses focus during touch move event events dont
+ * trigger
+ */
+ touchMove: function(event) {
+
+ /** Set Mouse Leave Event Flag to true */
+ this.set('touchleave', this.targetElement !== document
+ .elementFromPoint(event.originalEvent.touches[0].pageX,
+ event.originalEvent.touches[0].pageY));
+ },
+
+ // component default template
+ defaultTemplate: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'
+ + '<span>{{view.text}}</span>'),
+
+ templates: {
+ text: Em.Handlebars.compile('<span class="text">{{view.text}}</span>'),
+
+ icon: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'),
+
+ rightText: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'
+ + '<span class="right_text">{{view.text}}</span>'),
+
+ arrow: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'
+ + '<span>{{view.text}}</span>'
+ + '<img class="arrow-ico" src="images/common/arrow_ico.png" />'),
+
+ rightIcon: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'
+ + '<span>{{view.text}}</span>'
+ + '<img class="right_ico" {{bindAttr src="view.righticon"}} />')
+ }
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/Indicator.js b/src/components/HMI/app/controlls/Indicator.js
new file mode 100644
index 0000000000..4d3804e730
--- /dev/null
+++ b/src/components/HMI/app/controlls/Indicator.js
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.Indicator
+ * @desc Universal button component with value indicator for SDL application
+ * @category Controlls
+ * @filesource app/controlls/Indicator.js
+ * @version 1.0
+ */
+
+SDL.Indicator = Em.View.extend(Ember.TargetActionSupport, {
+
+ /** Content binding */
+ content: null,
+
+ /** internal indicators array */
+ indicators: null,
+
+ /** indicator active class */
+ indActiveClass: null,
+
+ /** indicator default class */
+ indDefaultClass: null,
+
+ /** Set active indicator from the start */
+ startFrom: null,
+
+ /** binding property to enable/disable indicators */
+ enabledBinding: 'content.enabled',
+
+ /**
+ * Before rendering view handeler need to generate indicators array based on
+ * indicator range value
+ */
+ beforeRender: function() {
+
+ // define variables
+ var length = this.content.range, view = this, i;
+
+ // generate indicators
+ this.indicators = [];
+
+ for (i = 0; i < length; i++) {
+ this.indicators.push(Em.Object.create( {
+ index: i,
+ className: this.indDefaultClass
+ }));
+ }
+ // apply indicator visualization rule
+ view.setRecord();
+
+ if (this.startFrom) {
+ this.indicators[this.startFrom].set('className',
+ this.indActiveClass);
+ }
+
+ // add observer to content record
+ this.addObserver('content', function() {
+
+ view.setRecord();
+ });
+
+ // view internal call
+ this.applyAttributesToBuffer(this.buffer);
+ },
+
+ actionDown: function() {
+
+ this.triggerAction();
+ },
+
+ // change record binding
+ setRecord: function() {
+
+ var view = this;
+
+ if (this.content.observersForKey('value').length == 0) {
+
+ this.content.addObserver('value', function() {
+
+ view.toggleIndicators();
+ });
+
+ }
+
+ this.toggleIndicators();
+ },
+
+ // Toggle indicator handeler
+ toggleIndicators: function() {
+
+ var length = this.indicators.length, i;
+
+ for (i = 0; i < length; i++) {
+ if (i >= this.content.value) {
+ this.indicators[i].set('className', 'SDL_indicator '
+ + this.indDefaultClass);
+ } else {
+ this.indicators[i].set('className', 'SDL_indicator '
+ + this.indActiveClass);
+ }
+ }
+ },
+
+ /** Define indicator template */
+ template: Ember.Handlebars.compile('{{#with view}}'
+ + '{{#each indicators}}'
+ + '<div {{bindAttr class="className view.enabled:show"}}></div>'
+ + '{{/each}}' + '{{/with}}')
+
+});
diff --git a/src/components/HMI/app/controlls/Label.js b/src/components/HMI/app/controlls/Label.js
new file mode 100644
index 0000000000..2fc9e6604f
--- /dev/null
+++ b/src/components/HMI/app/controlls/Label.js
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.Label
+ * @desc Universal label component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/Label.js
+ * @version 1.0
+ */
+
+SDL.Label = Em.View.extend( {
+ classNameBindings: [
+ 'disabled'
+ ],
+ classNames: 'label',
+
+ // component default template
+ defaultTemplate: Em.Handlebars.compile('<span>{{view.content}}</span>'),
+
+ templates: {
+ icon: Em.Handlebars
+ .compile('<img class="ico" {{bindAttr src="view.icon"}} />'
+ + '<span>{{view.content}}</span>')
+ }
+
+/** Define button template */
+/*
+ * template: Ember.Handlebars.compile( '{{#with view}}'+ '{{#if icon}}<img
+ * class="ico" {{bindAttr src="icon"}} />{{/if}}'+ '<span>{{content}}</span>'+
+ * '{{/with}}' )
+ */
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/List.js b/src/components/HMI/app/controlls/List.js
new file mode 100644
index 0000000000..e0fc551f40
--- /dev/null
+++ b/src/components/HMI/app/controlls/List.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.List
+ * @desc General list component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/List.js
+ * @version 1.0
+ */
+
+SDL.List = Em.ContainerView.extend( {
+
+ classNames: 'list',
+
+ /** flag for scrollbar */
+ disableScrollbar: false,
+
+ /** Set count of items at one time */
+ itemsOnPage: 0,
+
+ /** Speed of scrolling in milliseconds */
+ scrollBarSpeed: 200,
+
+ /** Number of columns on page */
+ columnsNumber: 1,
+
+ itemheight: 50,
+
+ /** Current scroll page */
+ currentPage: 0,
+
+ /** Css style of list */
+ listScrollingAttributes: '',
+
+ /** Count of items in menu */
+ /*
+ * listCount: function(){ if( this.items ) { return this.items.length; }
+ * }.property('items.@each.type'),
+ */
+ listCount: function() {
+
+ if ( (this.get('this.list.childViews.length') / this.get('columnsNumber') / this.get('itemsOnPage') ) < this.get('currentPage')) {
+ this.set('currentPage', 0);
+ }
+ // console.log(this.get('this.list.childViews.length'));
+ return this.get('this.list.childViews.length');
+ }.property('this.list.childViews.length'),
+
+ /** Pages count */
+ pageCount: function() {
+
+ return Math.ceil(this.get('listCount') / this.get('columnsNumber')
+ / this.get('itemsOnPage'));
+ }.property('listCount', 'itemsOnPage'),
+
+ listHeight: function() {
+
+ return this.itemsOnPage * this.itemheight;
+ }.property('itemsOnPage'),
+
+ /** Action of element "sb-top" which show previous list page */
+ sbUp: function() {
+
+ if (this.get('currentPage') > 0) {
+ this.set('currentPage', this.get('currentPage') - 1);
+ }
+ },
+
+ /** Action of element "sb-bottom" which show previous list page */
+ sbDown: function() {
+
+ if (this.get('currentPage') < this.get('pageCount') - 1) {
+ this.set('currentPage', this.get('currentPage') + 1);
+ }
+ },
+
+ /** Scroll content according to current page */
+ onCurrentPageChange: function() {
+
+ this.set('listScrollingAttributes', 'margin-top: '
+ + (this.get('currentPage') * this.itemsOnPage * (-50)) + 'px');
+ }.observes('currentPage'),
+
+ /** Method for delete certain item from list */
+ deleteItem: function(id) {
+
+ this.items.splice(id, 1);
+ this.list.refresh();
+ },
+
+ /** List components */
+ childViews: [
+ 'list', 'scrollbar'
+ ],
+
+ /** List view */
+ list: Em.ContainerView.extend( {
+
+ classNames: 'list-content',
+
+ listStyleBinding: 'parentView.listScrollingAttributes',
+
+ attributeBindings: [
+ 'listStyle:style'
+ ],
+
+ refresh: function() {
+
+ this.rerender();
+ }.observes('_parentView.items.@each.type'),
+
+ afterRender: function() {
+
+ var items = this._parentView.items, element, i, key, binding;
+
+ for (i = 0; i < items.length; i++) {
+
+ element = items[i].type.create( {
+ // element id
+ elementId: this._parentView.elementId + '_item' + i,
+
+ // list item css class
+ classNames: 'list-item',
+
+ classNameBindings: [
+ 'this.voiceOver'
+ ],
+
+ // Dynamic property set
+ init: function() {
+
+ for (key in items[i].params) {
+ if (key.match('Binding') != null) {
+ binding = Ember.Binding
+ .from(items[i].params[key]).to(key
+ .replace('Binding', ''));
+ binding.connect(this);
+ // Set one way binding
+ binding.oneWay();
+ } else {
+ this.set(key, items[i].params[key]);
+ }
+ }
+ this._super();
+ // synchronize bindings
+ Ember.run.sync();
+ }
+ })
+
+ // Push element to list
+ this.get('childViews').pushObject(element);
+ }
+ }
+ }),
+
+ /** Scrollbar view */
+ scrollbar: SDL.ScrollBar.extend( {
+ currentPageBinding: 'parentView.currentPage',
+ pageCountBinding: 'parentView.pageCount',
+ listHeightBinding: 'parentView.listHeight',
+ scrollBarIsDisabledBinding: 'parentView.disableScrollbar'
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/MenuList.js b/src/components/HMI/app/controlls/MenuList.js
new file mode 100644
index 0000000000..b4ba9207ef
--- /dev/null
+++ b/src/components/HMI/app/controlls/MenuList.js
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.MenuList
+ * @desc
+ * @category Controlls
+ * @filesource app/controlls/MenuList.js
+ * @version 1.0
+ */
+
+SDL.MenuList = Em.ContainerView
+ .extend( {
+
+ /**
+ * Add new item to container
+ *
+ * @param buttons:
+ * SoftButton[]
+ */
+ addItems: function(buttons, appID) {
+
+ this.deleteItems();
+
+ if (buttons) {
+ for ( var i = 0; i < buttons.length; i++) {
+ this.get('content.childViews').pushObject(SDL.Button
+ .create(SDL.PresetEventsCustom, {
+ text: buttons[i].text,
+ icon: buttons[i].image ? buttons[i].image.value : "",
+ templateName: buttons[i].image ? 'rightText' : 'text',
+ groupName: "AlertPopUp",
+ classNameBindings: ['isHighlighted:isHighlighted'],
+ isHighlighted: buttons[i].isHighlighted ? true : false,
+ softButtonID: buttons[i].softButtonID,
+ systemAction: buttons[i].systemAction,
+ groupName: this.groupName,
+ classNames: 'softButton',
+ appID: appID
+ }));
+ }
+ }
+ },
+
+ /**
+ * Delete existing Soft Buttons from container
+ */
+ deleteItems: function() {
+
+ this.get('content.childViews').removeObjects(this.get('content.childViews').filterProperty('softButtonID'));
+ this.get('content.childViews').removeObjects(this.get('content.childViews').filterProperty('softButtonID', 0));
+ },
+
+ classNames: [
+ 'ffw_list_menu'
+ ],
+
+ attributeBindings: [
+ 'elementHeight:style'
+ ],
+
+ // Position of current page
+ page: 0,
+
+ // Items per one page
+ itemsOnPage: 5,
+
+ // Height of one item
+ ITEM_HEIGHT: 50,
+
+ pageHeight: function() {
+
+ return this.itemsOnPage * this.ITEM_HEIGHT;
+ }.property('this.itemsOnPage'),
+
+ elementHeight: function() {
+
+ return 'height:'
+ + String(this.get('pageHeight') + this.ITEM_HEIGHT - 2) + 'px;';
+ }.property('this.pageHeight'),
+
+ // Position of content block
+ contentPositon: function() {
+
+ return 'top:'
+ + String(-(this.get('page') * this.get('pageHeight')))
+ + 'px; height:'
+ + String(this.get('pageHeight')
+ - (Boolean(this.get('onLastPage') && this.get('page')) * this.ITEM_HEIGHT))
+ + 'px;';
+ }.property('onLastPage'),
+
+ // Property for show or hide 'down' button
+ onLastPage: function() {
+
+ return ((this.get('page') * this.itemsOnPage) < (this
+ .get('content.childViews.length') - this.itemsOnPage));
+ }.property('page', 'content.childViews.length'),
+
+ // Handeler to go previous page
+ pageUp: function() {
+
+ if (this.get('page')) {
+ this.set('page', (this.get('page') - 1));
+ }
+ },
+
+ // Handeler to go next page
+ pageDown: function() {
+
+ if (this.get('onLastPage')) {
+ this.set('page', (this.get('page') + 1));
+ }
+ },
+
+ childViews: [
+ 'upButton', 'content', 'downButton'
+ ],
+
+ upButton: SDL.Button.extend( {
+
+ classNames: [
+ 'control', 'up_button'
+ ],
+
+ hidden: function() {
+
+ if (this.get('parentView.page')) {
+ return false;
+ } else {
+ return true;
+ }
+ }.property('parentView.page'),
+
+ templateName: 'icon',
+
+ icon: 'images/media/ico_arrow_up.png',
+
+ action: 'pageUp',
+
+ onDown: false,
+
+ target: 'parentView'
+ }),
+
+ downButton: SDL.Button.extend( {
+
+ classNames: [
+ 'control', 'down_button'
+ ],
+
+ hidden: function() {
+
+ if (this.get('parentView.onLastPage')) {
+ return false;
+ } else {
+ return true;
+ }
+ }.property('parentView.onLastPage'),
+
+ templateName: 'icon',
+
+ icon: 'images/media/ico_arrow_down.png',
+
+ action: 'pageDown',
+
+ onDown: false,
+
+ target: 'parentView'
+ }),
+
+ content: Em.ContainerView.extend( {
+
+ classNames: [
+ 'content'
+ ],
+
+ attributeBindings: [
+ 'parentView.contentPositon:style'
+ ]
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/QWERTYLayout.js b/src/components/HMI/app/controlls/QWERTYLayout.js
new file mode 100755
index 0000000000..336587d02a
--- /dev/null
+++ b/src/components/HMI/app/controlls/QWERTYLayout.js
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.QWERTYLayout
+ * @desc General list component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/QWERTYLayout.js
+ * @version 1.0
+ */
+
+SDL.QWERTYLayout = Em.ContainerView.extend( {
+
+ classNames: 'keyboardLayout QWERTYLayout',
+
+ childViews: [
+ 'q',
+ 'w',
+ 'e',
+ 'r',
+ 't',
+ 'y',
+ 'u',
+ 'i',
+ 'o',
+ 'p',
+ 'a',
+ 's',
+ 'd',
+ 'f',
+ 'g',
+ 'h',
+ 'j',
+ 'k',
+ 'l',
+ 'z',
+ 'x',
+ 'c',
+ 'v',
+ 'b',
+ 'n',
+ 'm',
+ 'dash',
+ 'ampersand'
+ ],
+
+ q: SDL.Button.extend({
+ classNames: 'q k0',
+ text : 'q',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ w: SDL.Button.extend({
+ classNames: 'w k1',
+ text : 'w',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ e: SDL.Button.extend({
+ classNames: 'e k2',
+ text : 'e',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ r: SDL.Button.extend({
+ classNames: 'r k3',
+ text : 'r',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ t: SDL.Button.extend({
+ classNames: 't k4',
+ text : 't',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ y: SDL.Button.extend({
+ classNames: 'y k5',
+ text : 'y',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ u: SDL.Button.extend({
+ classNames: 'u k6',
+ text : 'u',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ i: SDL.Button.extend({
+ classNames: 'i k7',
+ text : 'i',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ o: SDL.Button.extend({
+ classNames: 'o k8',
+ text : 'o',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ p: SDL.Button.extend({
+ classNames: 'p k9',
+ text : 'p',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ a: SDL.Button.extend({
+ classNames: 'a k10',
+ text : 'a',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ s: SDL.Button.extend({
+ classNames: 's k11',
+ text : 's',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ d: SDL.Button.extend({
+ classNames: 'd k12',
+ text : 'd',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ f: SDL.Button.extend({
+ classNames: 'f k13',
+ text : 'f',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ g: SDL.Button.extend({
+ classNames: 'g k14',
+ text : 'g',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ h: SDL.Button.extend({
+ classNames: 'h k15',
+ text : 'h',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ j: SDL.Button.extend({
+ classNames: 'j k16',
+ text : 'j',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ k: SDL.Button.extend({
+ classNames: 'k k17',
+ text : 'k',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ l: SDL.Button.extend({
+ classNames: 'l k18',
+ text : 'l',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ z: SDL.Button.extend({
+ classNames: 'z k21',
+ text : 'z',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ x: SDL.Button.extend({
+ classNames: 'x k22',
+ text : 'x',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ c: SDL.Button.extend({
+ classNames: 'c k23',
+ text : 'c',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ v: SDL.Button.extend({
+ classNames: 'v k24',
+ text : 'v',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ b: SDL.Button.extend({
+ classNames: 'b k25',
+ text : 'b',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ n: SDL.Button.extend({
+ classNames: 'n k26',
+ text : 'n',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ m: SDL.Button.extend({
+ classNames: 'm k27',
+ text : 'm',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ dash: SDL.Button.extend({
+ classNames: 'dash k28',
+ text : '-',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ ampersand: SDL.Button.extend({
+ classNames: 'ampersand k29',
+ text : '&',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/QWERTZLayout.js b/src/components/HMI/app/controlls/QWERTZLayout.js
new file mode 100755
index 0000000000..4374c5f78b
--- /dev/null
+++ b/src/components/HMI/app/controlls/QWERTZLayout.js
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.QWERTYLayout
+ * @desc General list component for SDL application
+ * @category Controlls
+ * @filesource app/controlls/QWERTYLayout.js
+ * @version 1.0
+ */
+
+SDL.QWERTZLayout = Em.ContainerView.extend( {
+
+ classNames: 'keyboardLayout QWERTZLayout',
+
+ childViews: [
+ 'q',
+ 'w',
+ 'e',
+ 'r',
+ 't',
+ 'z',
+ 'u',
+ 'i',
+ 'o',
+ 'p',
+ 'a',
+ 's',
+ 'd',
+ 'f',
+ 'g',
+ 'h',
+ 'j',
+ 'k',
+ 'l',
+ 'y',
+ 'x',
+ 'c',
+ 'v',
+ 'b',
+ 'n',
+ 'm',
+ 'dash',
+ 'ampersand'
+ ],
+
+ q: SDL.Button.extend({
+ classNames: 'q k0',
+ text : 'q',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ w: SDL.Button.extend({
+ classNames: 'w k1',
+ text : 'w',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ e: SDL.Button.extend({
+ classNames: 'e k2',
+ text : 'e',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ r: SDL.Button.extend({
+ classNames: 'r k3',
+ text : 'r',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ t: SDL.Button.extend({
+ classNames: 't k4',
+ text : 't',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ z: SDL.Button.extend({
+ classNames: 'z k5',
+ text : 'z',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ u: SDL.Button.extend({
+ classNames: 'u k6',
+ text : 'u',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ i: SDL.Button.extend({
+ classNames: 'i k7',
+ text : 'i',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ o: SDL.Button.extend({
+ classNames: 'o k8',
+ text : 'o',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ p: SDL.Button.extend({
+ classNames: 'p k9',
+ text : 'p',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ a: SDL.Button.extend({
+ classNames: 'a k10',
+ text : 'a',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ s: SDL.Button.extend({
+ classNames: 's k11',
+ text : 's',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ d: SDL.Button.extend({
+ classNames: 'd k12',
+ text : 'd',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ f: SDL.Button.extend({
+ classNames: 'f k13',
+ text : 'f',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ g: SDL.Button.extend({
+ classNames: 'g k14',
+ text : 'g',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ h: SDL.Button.extend({
+ classNames: 'h k15',
+ text : 'h',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ j: SDL.Button.extend({
+ classNames: 'j k16',
+ text : 'j',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ k: SDL.Button.extend({
+ classNames: 'k k17',
+ text : 'k',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ l: SDL.Button.extend({
+ classNames: 'l k18',
+ text : 'l',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ y: SDL.Button.extend({
+ classNames: 'y k21',
+ text : 'y',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ x: SDL.Button.extend({
+ classNames: 'x k22',
+ text : 'x',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ c: SDL.Button.extend({
+ classNames: 'c k23',
+ text : 'c',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ v: SDL.Button.extend({
+ classNames: 'v k24',
+ text : 'v',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ b: SDL.Button.extend({
+ classNames: 'b k25',
+ text : 'b',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ n: SDL.Button.extend({
+ classNames: 'n k26',
+ text : 'n',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ m: SDL.Button.extend({
+ classNames: 'm k27',
+ text : 'm',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ dash: SDL.Button.extend({
+ classNames: 'dash k28',
+ text : '-',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ ampersand: SDL.Button.extend({
+ classNames: 'ampersand k29',
+ text : '&',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/ScrollBar.js b/src/components/HMI/app/controlls/ScrollBar.js
new file mode 100644
index 0000000000..466a29e409
--- /dev/null
+++ b/src/components/HMI/app/controlls/ScrollBar.js
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.ScrollBar
+ * @desc ScrollBar component for List component
+ * @category Controlls
+ * @filesource app/controlls/ScrollBar.js
+ * @version 1.0
+ */
+
+SDL.ScrollBar = Em.ContainerView
+ .extend( {
+
+ /** Define enable/disable scrollbar */
+ classNameBindings: [
+ 'scrollBarIsDisabled:is-disabled'
+ ],
+
+ /** Componet class */
+ classNames: 'scrollbar',
+
+ /** Childs views */
+ childViews: [
+ 'upButton', 'bar', 'downButton'
+ ],
+
+ /** current page */
+ currentPage: 1,
+
+ /** Pages count */
+ pageCount: 0,
+
+ listHeight: 250,
+
+ /** On/OF scrollbar */
+ scrollBarIsDisabled: false,
+
+ /** Define bar height */
+ sbHeight: function() {
+
+ /** Max bar height */
+ this.maxHeight = this.listHeight - 102;
+ if (this.pageCount <= 1) {
+ return this.maxHeight + 1;
+ } else {
+ return (this.maxHeight / this.pageCount);
+ }
+ }.property('pageCount'),
+
+ /** Position of bar */
+ sbTop: function() {
+
+ if (this.get('currentPage') == 0) {
+ return 0;
+ } else {
+ return (this.maxHeight - this.get('sbHeight'))
+ / (this.get('pageCount') - 1) * this.get('currentPage') + 1;
+ }
+ }.property('currentPage', 'pageCount'),
+
+ /** Support function */
+ scrollbarBodyStyleAttributes: function() {
+
+ return 'height: ' + (this.get('listHeight') - 1) + 'px;';
+ }.property('listHeight'),
+
+ /** Support function */
+ sbBodyStyleAttributes: function() {
+
+ return 'height: ' + (this.get('listHeight') - 100 - 1) + 'px;';
+ }.property('listHeight'),
+
+ sbStyleAttributes: function() {
+
+ return 'height: ' + this.get('sbHeight') + 'px; ' + 'top: '
+ + this.get('sbTop') + 'px';
+ }.property('currentPage', 'pageCount'),
+
+ /** Define scroll up button "disable" status */
+ sbUpButtonIsDisabled: function() {
+
+ if (this.get('currentPage') < 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('currentPage', 'pageCount'),
+
+ /** Define scroll down button "disable" status */
+ sbDownButtonIsDisabled: function() {
+
+ if ((this.pageCount - 1) > this.get('currentPage')) {
+ return false;
+ } else {
+ return true;
+ }
+ }.property('currentPage', 'pageCount'),
+
+ attributeBindings: [
+ 'scrollbarBodyStyleAttributes:style'
+ ],
+
+ /** Bottom for scroll up */
+ upButton: SDL.Button.extend( {
+ classNames: [
+ 'sb-top', 'button'
+ ],
+ action: 'sbUp',
+ target: 'parentView.parentView',
+ disabledBinding: 'parentView.sbUpButtonIsDisabled',
+ icon: 'images/list/scrollbar/button-up-active.png',
+ timer: 200
+ }),
+
+ /** Bottom for scroll down */
+ downButton: SDL.Button.extend( {
+ classNames: [
+ 'sb-bottom', 'button'
+ ],
+ action: 'sbDown',
+ target: 'parentView.parentView',
+ disabledBinding: 'parentView.sbDownButtonIsDisabled',
+ icon: 'images/list/scrollbar/button-down-active.png',
+ timer: 200
+ }),
+
+ /** Scrollbar track */
+ bar: Em.View
+ .extend( {
+ barBodyStyleBinding: 'parentView.sbBodyStyleAttributes',
+ barStyleBinding: 'parentView.sbStyleAttributes',
+ cancelAnimationBinding: 'parentView.parentView.cancelAnimation',
+
+ layout: Em.Handlebars
+ .compile('<div class="sb-body" {{bindAttr style="view.barBodyStyle"}}>'
+ + '{{yield}}' + '</div>'),
+
+ template: Em.Handlebars
+ .compile('<div class="sb-bar" '
+ + '{{bindAttr style="view.barStyle"}}'
+ + '{{bindAttr class="view.cancelAnimation:cancelBarAnimation"}}>'
+ + '</div>')
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/controlls/ScrollableText.js b/src/components/HMI/app/controlls/ScrollableText.js
new file mode 100644
index 0000000000..40d35f012b
--- /dev/null
+++ b/src/components/HMI/app/controlls/ScrollableText.js
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.ScrollableText
+ * @desc General ScrollableText component
+ * @category Controlls
+ * @filesource app/controlls/scrollableText.js
+ * @version 1.0
+ */
+
+SDL.ScrollableText = Em.ContainerView
+ .extend( {
+
+ classNames: 'scrollableText',
+
+ /** flag for scrollbar */
+ disableScrollbar: false,
+
+ /** Set count of items at one time */
+ itemsOnPage: 0,
+
+ /** Speed of scrolling in milliseconds */
+ scrollBarSpeed: 200,
+
+ /** Number of columns on page */
+ columnsNumber: 1,
+
+ itemheight: 50,
+
+ /** Current scroll page */
+ currentPage: 0,
+
+ /** Css style of scrollableText */
+ scrollableTextScrollingAttributes: '',
+
+ /** Css style of line-height of rows */
+ linesHeght: 23,
+
+ linesCount: 1,
+
+ scrollHeight: null,
+
+ scrollableTextCount: function() {
+
+ if ($('#' + this.get('childViews')[1].elementId)) {
+ $('#' + this.get('childViews')[1].elementId)
+ .removeAttr('style');
+ this.set('scrollHeight', $('#'
+ + this.get('childViews')[1].elementId)[0].scrollHeight);
+ $('#' + this.get('childViews')[1].elementId)
+ .height(this.scrollHeight);
+ this.set('linesCount', $('#'
+ + this.get('childViews')[1].elementId)[0].scrollHeight
+ / this.linesHeght);
+ }
+ },
+
+ /** Pages count */
+ pageCount: function() {
+
+ return Math.ceil(this.get('linesCount') / this.get('itemsOnPage'));
+ }.property('linesCount', 'itemsOnPage'),
+
+ scrollableTextHeight: function() {
+
+ return this.itemsOnPage * this.itemheight;
+ }.property('itemsOnPage'),
+
+ /** Action of element "sb-top" which show previous scrollableText page */
+ sbUp: function() {
+
+ if (this.get('currentPage') > 0) {
+ this.set('currentPage', this.get('currentPage') - 1);
+ }
+ },
+
+ /** Action of element "sb-bottom" which show previous scrollableText page */
+ sbDown: function() {
+
+ if (this.get('currentPage') < this.get('pageCount') - 1) {
+ this.set('currentPage', this.get('currentPage') + 1);
+ }
+ },
+
+ /** Scroll content according to current page */
+ onCurrentPageChange: function() {
+
+ this.set('scrollableTextScrollingAttributes', 'height: '
+ + this.scrollHeight + 'px; top: '
+ + (this.get('currentPage') * this.itemsOnPage * (-23)) + 'px');
+ }.observes('currentPage'),
+
+ /** Method for delete certain item from scrollableText */
+ deleteItem: function(id) {
+
+ this.items.splice(id, 1);
+ this.scrollableText.refresh();
+ },
+
+ /** scrollableText components */
+ childViews: [
+ 'scrollbar',
+ // 'scrollableText'
+ ],
+
+ refreshTextArea: function() {
+
+ if (this.get('childViews')[1]) {
+ this.get('childViews').removeObject(this.get('childViews')[1]);
+ }
+
+ $('#scrollableTextArea').height(23);
+ this.set('scrollHeight', 23);
+ this.set('linesCount', 1);
+ this.set('currentPage', 0);
+
+ this
+ .get('childViews')
+ .pushObject(Ember.TextArea
+ .create( {
+
+ classNames: 'scrollableTextArea',
+
+ elementId: 'scrollableTextArea',
+
+ scrollableTextStyleBinding: 'parentView.scrollableTextScrollingAttributes',
+
+ attributeBindings: [
+ 'scrollableTextStyle:style'
+ ],
+
+ valueBinding: 'this.parentView.items',
+
+ actionDown: function() {
+
+ return false;
+ },
+
+ didInsertElement: function() {
+
+ this.get('parentView').scrollableTextCount();
+ }
+ }));
+ }.observes('items'),
+
+ /** scrollableText view */
+ scrollableText: Ember.TextArea
+ .extend( {
+
+ classNames: 'scrollableTextArea',
+
+ elementId: 'scrollableTextArea',
+
+ scrollableTextStyleBinding: 'parentView.scrollableTextScrollingAttributes',
+
+ attributeBindings: [
+ 'scrollableTextStyle:style'
+ ],
+
+ valueBinding: 'this.parentView.items',
+
+ actionDown: function() {
+
+ return false;
+ },
+
+ didInsertElement: function() {
+
+ this._parentView.scrollableTextCount();
+ },
+
+ refresh: function() {
+
+ this.rerender();
+ }.observes('_parentView.items')
+
+ }),
+
+ /** Scrollbar view */
+ scrollbar: SDL.ScrollBar.extend( {
+ currentPageBinding: 'parentView.currentPage',
+ pageCountBinding: 'parentView.pageCount',
+ scrollableTextHeightBinding: 'parentView.scrollableTextHeight',
+ scrollBarIsDisabledBinding: 'parentView.disableScrollbar'
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/mixins/PresetEventCustom.js b/src/components/HMI/app/mixins/PresetEventCustom.js
new file mode 100644
index 0000000000..b28468e471
--- /dev/null
+++ b/src/components/HMI/app/mixins/PresetEventCustom.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PresetEventsCustom
+ * @desc Handler of custom preset butons events
+ * @category mixin
+ * @filesource app/mixins/PresetEventsCustom.js
+ * @version 1.0
+ */
+SDL.PresetEventsCustom = Ember.Mixin.create( {
+ actionDown: function() {
+
+ this._super();
+ SDL.SDLController.onSoftButtonActionDownCustom(this);
+ },
+ actionUp: function() {
+
+ this._super();
+ SDL.SDLController.onSoftButtonActionUpCustom(this);
+ if (this.systemAction == 'DEFAULT_ACTION') {
+
+ SDL.SDLController.defaultActionSoftButton(this);
+
+ } else if (this.systemAction == 'STEAL_FOCUS') {
+
+ SDL.SDLController.stealFocusSoftButton(this);
+
+ } else if (this.systemAction == 'KEEP_CONTEXT') {
+
+ SDL.SDLController.keepContextSoftButton(this);
+
+ }
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/mixins/PresetEvents.js b/src/components/HMI/app/mixins/PresetEvents.js
new file mode 100644
index 0000000000..08e58b6f31
--- /dev/null
+++ b/src/components/HMI/app/mixins/PresetEvents.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PresetEvents
+ * @desc Handler of preset butons events
+ * @category mixin
+ * @filesource app/mixins/PresetEvents.js
+ * @version 1.0
+ */
+SDL.PresetEvents = Ember.Mixin.create( {
+ actionDown: function() {
+
+ this._super();
+ SDL.SDLController.onSoftButtonActionDown(this);
+ },
+ actionUp: function() {
+
+ this._super();
+ SDL.SDLController.onSoftButtonActionUp(this);
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/model/PhoneModel.js b/src/components/HMI/app/model/PhoneModel.js
new file mode 100644
index 0000000000..7273be7a9c
--- /dev/null
+++ b/src/components/HMI/app/model/PhoneModel.js
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PhoneModel
+ * @desc Phone model
+ * @category Model
+ * @filesource app/model/PhoneModel.js
+ * @version 1.0
+ */
+
+SDL.PhoneModel = Em.Object.create( {
+
+ /** Dial number */
+ dialpadNumber: '',
+
+ readyForCall: true,
+
+ onCall: false,
+
+ /** Text for phone status bar */
+ statusModeText: null,
+
+ /** Start call */
+ dialCall: function() {
+
+ if (this.dialpadNumber.length) {
+ this.set('onCall', true);
+ this.set('readyForCall', false);
+ }
+ },
+
+ /** End call */
+ endCall: function() {
+
+ this.set('onCall', false);
+ this.set('readyForCall', true);
+ this.set('dialpadNumber', '');
+
+ this.set('statusModeText', null);
+
+ if (SDL.SDLModel.phoneCall) {
+ SDL.SDLModel.set('phoneCall', false);
+ SDL.SDLController
+ .getApplicationModel(SDL.SDLAppController.model.appID)
+ .turnOnSDL();
+ }
+ },
+
+ /** Add symbol to dial pad number */
+ setDialpadNumber: function(key) {
+
+ if (this.dialpadNumber.length < 14) {
+ key = this.dialpadNumber + key;
+ this.set('dialpadNumber', key);
+ }
+ },
+
+ /** Delete last number symbol */
+ deleteDialpadNumber: function() {
+
+ if (this.dialpadNumber.length) {
+ this.set('dialpadNumber', this.dialpadNumber.slice(0, -1));
+ }
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/app/model/abstract/RangedValue.js b/src/components/HMI/app/model/abstract/RangedValue.js
new file mode 100644
index 0000000000..425e41806a
--- /dev/null
+++ b/src/components/HMI/app/model/abstract/RangedValue.js
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name Ranged Value
+ * @desc Abstract ranged value class
+ * @category Model
+ * @filesource app/model/abstract/RangedValue.js
+ * @version 1.0
+ */
+
+SDL.RangedValue = Em.Object.extend( {
+
+ range: 3,
+ minValue: 1,
+ value: 0,
+ cycle: true,
+ enabled: true,
+
+ /**
+ * @desc Cyclically increases seat value until it reaches the range value
+ * than value is switched to off (0)
+ */
+ increase: function() {
+
+ if (!this.enabled) {
+ this.enable();
+ return;
+ }
+
+ if (this.value < this.range) {
+ this.set('value', this.value + 1);
+ } else {
+ if (!this.cycle) { return; }
+ this.set('value', 0);
+ }
+ },
+ /**
+ * Toggle indicators one by one
+ */
+ toggleIndicators: function() {
+
+ if (!this.enabled) {
+ this.enable();
+ return;
+ }
+
+ if (this.value < this.range - 1) {
+ this.set('value', this.value + 1);
+ } else {
+ this.set('value', 0);
+ }
+ },
+ /**
+ * @desc Cyclically increases seat value until it reaches zero value (off)
+ * than value is changed to the range value
+ */
+ decrease: function() {
+
+ if (!this.enabled) {
+ this.enable();
+ return;
+ }
+
+ if (this.value >= this.minValue) {
+ if (!this.cycle && (this.value == this.minValue)) { return; }
+ this.set('value', this.value - 1);
+ } else {
+ this.set('value', this.range);
+ }
+ },
+
+ /**
+ * @desc Switch off
+ */
+ off: function() {
+
+ this.set('beforeOff', this.value);
+ this.set('value', 0);
+ },
+
+ /**
+ * Switch on
+ */
+ on: function() {
+
+ this.set('value', this.range);
+ },
+
+ /**
+ * Switch visual enable
+ */
+ enable: function() {
+
+ this.set('enabled', true);
+ },
+
+ /**
+ * Switch visual disable
+ */
+ disable: function() {
+
+ this.set('enabled', false);
+ },
+
+ /**
+ * Revert to value before toggle Off
+ */
+ revert: function() {
+
+ if (this.beforeOff) {
+ this.set('value', this.beforeOff);
+ }
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/app/model/media/CDModel.js b/src/components/HMI/app/model/media/CDModel.js
new file mode 100644
index 0000000000..9ded512c5d
--- /dev/null
+++ b/src/components/HMI/app/model/media/CDModel.js
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.CDModel
+ * @desc CD Media data model
+ * @category Model
+ * @filesource app/model/media/CDModel.js
+ * @version 1.0
+ */
+
+SDL.CDModel = Em.Object.create( {
+ active: true,
+
+ statusBar: 'The Electric Broncos',
+
+ init: function() {
+
+ this.set('active', true);
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/model/sdl/AppModel.js b/src/components/HMI/app/model/sdl/AppModel.js
new file mode 100644
index 0000000000..682eee592b
--- /dev/null
+++ b/src/components/HMI/app/model/sdl/AppModel.js
@@ -0,0 +1,452 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLAppModel
+ * @desc Abstarct model for SDL applications
+ * @category Model
+ * @filesource app/model/sdl/AppModel.js
+ * @version 1.0
+ */
+
+SDL.SDLAppModel = Em.Object.extend({
+
+ /**
+ * List of subscribed data on VehicleInfo model
+ *
+ * @type {Object}
+ */
+ subscribedData: {},
+
+ /**
+ * Application's container for current processed requests on HMI
+ *
+ * @type {Object}
+ */
+ activeRequests: {},
+
+ /**
+ * Application Id
+ *
+ * @type {Number}
+ */
+ appID: null,
+
+ /**
+ * Application name
+ *
+ * @type {String}
+ */
+ appName: '',
+
+ /**
+ * Flag to define if application was initialized (registered) correctly
+ * Has correct application type
+ *
+ * @type {Boolean}
+ */
+ initialized: false,
+
+ /**
+ * Media application flag
+ * If application was successfully initialized this flag it set into correct value
+ *
+ * @type {Boolean}
+ */
+ isMedia: null,
+
+ /**
+ * Flag to determine if app in application list can not be activated from HMI
+ *
+ * @type {Boolean}
+ */
+ disabledToActivate: false,
+
+ /**
+ * Application type
+ * If application was successfully initialized this parameter it set into correct value
+ *
+ * @type {String}
+ */
+ appType: "",
+
+ /**
+ * Navigation streaming url
+ */
+ navigationStream: null,
+
+ /**
+ * Navigation streaming url
+ */
+ navigationAudioStream: null,
+
+ /**
+ * Chosen device name
+ *
+ * @type {String}
+ */
+ deviceName: '',
+
+ /**
+ * Chosen device id
+ *
+ * @type {String}
+ */
+ deviceID: null,
+
+ /**
+ * Global properties for current application
+ *
+ * @type {Object}
+ */
+ globalProperties: {},
+
+ /**
+ * Statusbar text
+ *
+ * @type {String}
+ */
+ statusText: '',
+
+ /**
+ * Info data
+ *
+ * @type: {Em.Object}
+ */
+ appInfo: null,
+
+ /**
+ * Current language of applications UI component
+ *
+ * @type {String}
+ */
+ UILanguage: 'EN-US',
+
+ /**
+ * Current language of applications TTS and applications VR component
+ *
+ * @type {String}
+ */
+ TTSVRLanguage: 'EN-US',
+
+ /**
+ * List of VR commands
+ */
+ VRCommands: [],
+
+ /**
+ * Array of Soft Buttons
+ *
+ * @type {Array}
+ */
+ softButtons: [],
+
+ /**
+ * Array of Soft Buttons
+ *
+ * @type {Array}
+ */
+ turnListSoftButtons: [],
+
+ /**
+ * Array of Objects for TBTTurnList
+ *
+ * @type {Array}
+ */
+ turnList: [],
+
+ /**
+ * Policies
+ * Array of avaliable permission codes for current app
+ * came from SDLCore in SDL.GetListOfPermissions response
+ *
+ * @type {Array}
+ */
+ allowedFunctions: [],
+
+ /**
+ * URL to application Icon
+ *
+ * @type {String}
+ */
+ appIcon: 'images/info/info_leftMenu_apps_ico.png',
+
+ /**
+ * Application commands list
+ *
+ * @type {Array}
+ */
+ commandsList: {
+ 0: []
+ },
+
+ /**
+ * Flag to open ShowConstantTBTview when entering to current screen
+ *
+ * @type {Boolean}
+ */
+ tbtActivate: false,
+
+ /**
+ * Return current menu commands
+ *
+ * @return {Array}
+ */
+ currentCommandsList: function () {
+
+ return this.get('commandsList.' + this.get('currentSubMenuId'));
+ }.property('this.currentSubMenuId'),
+
+ /**
+ * Current command submenu identificator
+ *
+ * @type {Number}
+ */
+ currentSubMenuId: 'top',
+
+ /**
+ * Return current submenu name
+ *
+ * @return {String}
+ */
+ currentSubMenuLabel: function () {
+
+ //Param "top" is Top level menu index
+ var submenu, commands = this.commandsList["top"];
+
+ for (var i = 0; i < commands.length; i++) {
+ if (commands[i].menuID == this.currentSubMenuId) {
+ submenu = commands[i].name;
+ }
+ }
+
+ return this.get('currentSubMenuId') != 'top' ? submenu : 'Options';
+ }.property('this.currentSubMenuId'),
+
+ /**
+ * Interaction chooses data
+ *
+ * @type {Object}
+ */
+ interactionChoices: {},
+
+ /**
+ * Method to remove deleted by SDL Core images used in HMI
+ *
+ * @param imageName
+ */
+ onImageRemoved: function(imageName){
+
+ var result = false;
+
+ // Get list of subMenus with commands
+ for (var commands in this.commandsList) {
+
+ // Check if object item (subMenu list of commands) is added list with command in object and not an inherited method of object
+ if(this.commandsList.hasOwnProperty(commands)){
+
+ var len = this.commandsList[commands].length;
+ for (var i = 0; i < len; i++) {
+
+ // Check image name with each command in each subMenu
+ if (this.commandsList[commands][i].icon) {
+ if (this.commandsList[commands][i].icon.indexOf(imageName) != -1
+ && imageName.length == this.commandsList[commands][i].icon.length) {
+
+ // If found same image path than set default icon path
+ this.commandsList[commands][i].icon = SDL.SDLModel.defaultListOfIcons.command;
+ result = true;
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ },
+
+ /**
+ * Update Soft Buttons will handle on command Show
+ *
+ * @param {Array}
+ */
+ updateSoftButtons: function (buttons) {
+
+ // delete existing buttons from array
+ this.softButtons.splice(0);
+
+ // push new buttons to array
+ this.get('softButtons').pushObjects(buttons);
+ },
+
+ /**
+ * Add command to list
+ *
+ * @param {Object}
+ */
+ addCommand: function (request) {
+
+ var parentID = request.params.menuParams.parentID > 0 ? request.params.menuParams.parentID : 'top';
+
+ if (!this.get('commandsList.' + parentID)) {
+ this.commandsList[parentID] = [];
+ }
+
+ var commands = this.get('commandsList.' + parentID);
+
+ // Magic number is limit of 1000 commands added on one menu
+ if (commands.length <= 999) {
+
+ commands[commands.length] = {
+ commandID: request.params.cmdID,
+ name : request.params.menuParams.menuName,
+ parent : parentID,
+ position : request.params.menuParams.position ? request.params.menuParams.position : 0,
+ icon : request.params.cmdIcon ? request.params.cmdIcon.value : null
+ };
+
+ if (SDL.SDLController.getApplicationModel(request.params.appID) && SDL.OptionsView.active) {
+ SDL.SDLAppController.buttonsSort(parentID, this.appID);
+ SDL.OptionsView.commands.refreshItems();
+ }
+
+ console.log(commands.length);
+ if (request.id >= 0) {
+ FFW.UI.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+ }
+ } else {
+ FFW.UI.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, request.method, 'Adding more than 1000 item to the top menu or to submenu is not allowed.');
+ }
+
+ },
+
+ /**
+ * Delete command from list
+ *
+ * @param {Number}
+ */
+ deleteCommand: function (commandID, requestID) {
+
+ for (var i in this.commandsList) {
+ if (this.commandsList[i].filterProperty('commandID', commandID).length) {
+ if (i != this.currentSubMenuId || this.currentSubMenuId == 'top') {
+ this.get('commandsList.' + i).removeObjects(this.get('commandsList.' + i).filterProperty('commandID', commandID));
+ SDL.SDLModel.deleteCommandResponse(SDL.SDLModel.resultCode["SUCCESS"], requestID);
+ return;
+ } else {
+ SDL.SDLModel.deleteCommandResponse(SDL.SDLModel.resultCode["IN_USE"], requestID);
+ return;
+ }
+ }
+ }
+ },
+
+ /**
+ * Add submenu to commands list
+ *
+ * @param {Object}
+ */
+ addSubMenu: function (request) {
+
+ // parentID is equal to 'top' cause Top level menu ID
+ var parentID = 'top';
+
+ var commands = this.get('commandsList.' + parentID);
+
+ // Magic number is limit of 1000 commands added on one menu
+ if (commands.length <= 999) {
+
+ this.commandsList[request.params.menuID] = [];
+ commands[commands.length] = {
+ menuID : request.params.menuID,
+ name : request.params.menuParams.menuName ? request.params.menuParams.menuName : '',
+ parent : 0,
+ position: request.params.menuParams.position ? request.params.menuParams.position : 0
+ };
+
+ if (SDL.SDLController.getApplicationModel(request.params.appID) && SDL.OptionsView.active) {
+ SDL.SDLAppController.buttonsSort(parentID, this.appID);
+ SDL.OptionsView.commands.refreshItems();
+ }
+
+ FFW.UI.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+ } else {
+ FFW.UI.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, request.method, 'Adding more than 1000 item to the top menu or to submenu is not allowed.');
+ }
+ },
+
+ /**
+ * Delete submenu and related commands from list
+ *
+ * @param {Number}
+ */
+ deleteSubMenu: function (menuID) {
+
+ if (this.commandsList['top'].filterProperty('commandID', menuID)) {
+ this.get('commandsList.top').removeObjects(this.get('commandsList.top').filterProperty('menuID', menuID));
+ delete(this.commandsList[menuID]);
+ }
+
+ return SDL.SDLModel.resultCode['SUCCESS'];
+ },
+
+ /**
+ * SDL UI CreateInteraction response handeler push set of commands to
+ * voice recognition list
+ *
+ * @param {Object}
+ */
+ onCreateInteraction: function (message) {
+
+ this.interactionChoices[message.interactionChoiceSetID] = message.choiceSet;
+
+ },
+
+ /**
+ * SDL UI DeleteInteraction response handeler close current interaction
+ * set window (if opened) and delete current set commands from voice
+ * recognition list
+ *
+ * @param {Object}
+ */
+ onDeleteInteraction: function (message) {
+
+ delete this.interactionChoices[message.interactionChoiceSetID];
+ },
+
+ /**
+ * SDL UI Slider response handeler open Slider window with received
+ * parameters
+ *
+ * @param {Object}
+ */
+ onSlider: function (message) {
+
+ SDL.SliderView.loadData(message);
+
+ SDL.SliderView.activate(this.appName, message.params.timeout);
+
+ }
+ });
diff --git a/src/components/HMI/app/model/sdl/MediaModel.js b/src/components/HMI/app/model/sdl/MediaModel.js
new file mode 100644
index 0000000000..0feceb2119
--- /dev/null
+++ b/src/components/HMI/app/model/sdl/MediaModel.js
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLMediaModel
+ * @desc SDL data model
+ * @category Model
+ * @filesource app/model/media/SDLMediaModel.js
+ * @version 1.0
+ */
+
+SDL.SDLMediaModel = SDL.SDLAppModel.extend({
+
+ init: function () {
+
+ this._super();
+
+ var subscribeVIData = {};
+
+ for (var key in SDL.SDLVehicleInfoModel.vehicleData) {
+ if (key != "externalTemperature") {
+ subscribeVIData[key] = false;
+ }
+ }
+
+ this.set('subscribedData', subscribeVIData);
+
+ // init properties here
+ this.set('appInfo', Em.Object.create({
+ field1 : '<field1>',
+ field2 : '<field2>',
+ field3 : '<field3>',
+ mediaClock : '<mediaClock>',
+ trackIcon : SDL.SDLModel.defaultListOfIcons.trackIcon,
+ customPresets: [
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>'
+ ],
+ alignment : "text-align:center"
+ }));
+
+ this.set('activeRequests', Em.Object.create({
+ uiPerformInteraction: null
+ }));
+
+ this.set('VRCommands', []);
+ this.set('tbtActivate', false);
+ this.set('isPlaying', true);
+ this.set('globalProperties.helpPrompt', []);
+ this.set('globalProperties.timeoutPrompt', []);
+ this.set('globalProperties.keyboardProperties', Em.Object.create());
+ this.set('globalProperties.keyboardProperties.keyboardLayout', 'QWERTY');
+ this.set('globalProperties.keyboardProperties.limitedCharacterList', []);
+
+ this.set('commandsList', {"top": []});
+ this.set('softButtons', []);
+ },
+
+ /**
+ * Parameter for presets for Media App to show presets on media screen
+ *
+ * @type bool
+ */
+ mediaPreset: false,
+
+ /**
+ * Flag for media playing state
+ *
+ * @param {Boolean}
+ */
+ isPlaying: false,
+
+ /**
+ * Flag for model active state currently used for status bar
+ *
+ * @param {Boolean}
+ */
+ active: false,
+
+ /**
+ * Timer for Media Clock
+ */
+ timer: null,
+
+ /**
+ * Current sdl Sub Menu identificator
+ */
+ currentSDLSubMenuid: null,
+
+ /**
+ * Current sdl Perform Interaction Choise identificator
+ */
+ currentSDLPerformInteractionChoiseId: null,
+
+ countUp : true,
+ pause : null,
+ maxTimeValue: 68400, // 19 hours
+ duration : 0,
+ currTime : 0,
+
+ /**
+ * Method hides sdl activation button and sdl application
+ *
+ * @param {Number}
+ */
+ onDeleteApplication: function (appID) {
+
+ SDL.SDLMediaController.onDeleteApplication(appID);
+ },
+
+ /**
+ * Activate current application model
+ */
+ turnOnSDL: function () {
+
+ SDL.SDLMediaController.activateApp(this);
+ },
+
+ startTimer: function () {
+
+ var self = this;
+
+ if (this.pause === false) {
+ this.timer = setInterval(function () {
+
+ self.set('currTime', self.currTime + 1);
+ }, 1000);
+ } else {
+ clearInterval(this.timer);
+ }
+ }.observes('this.pause'),
+
+ stopTimer: function () {
+
+ clearInterval(this.timer);
+ this.pause = null;
+ this.appInfo.set('mediaClock', '');
+ },
+
+ setDuration: function () {
+
+ var number, str = '', hrs = 0, min = 0, sec = 0;
+ if (this.countUp) {
+ number = this.duration + this.currTime;
+ } else {
+ if (this.duration <= this.currTime) {
+ clearInterval(this.timer);
+ this.currTime = 0;
+ this.appInfo.set('mediaClock', '00:00:00');
+ return;
+ }
+ number = this.duration - this.currTime;
+ }
+
+ hrs = parseInt(number / 3600), // hours
+ min = parseInt(number / 60) % 60, // minutes
+ sec = number % 60; // seconds
+
+ str = (hrs < 10 ? '0' : '') + hrs + ':';
+ str += (min < 10 ? '0' : '') + min + ":";
+ str += (sec < 10 ? '0' : '') + sec;
+ this.appInfo.set('mediaClock', str);
+
+ if (!this.get('countUp') && this.duration == this.currTime) {
+ clearInterval(this.timer);
+ return;
+ }
+
+ }.observes('this.currTime'),
+
+ changeDuration: function () {
+
+ clearInterval(this.timer);
+ this.currTime = -1;
+ this.startTimer();
+ }.observes('this.duration'),
+
+ /**
+ * SDL Setter for Media Clock Timer
+ *
+ * @param {Object}
+ */
+ sdlSetMediaClockTimer: function (params) {
+
+ if ((params.updateMode == "PAUSE" && this.pause) || (params.updateMode == "RESUME" && !this.pause) || ((params.updateMode == "RESUME" || params.updateMode == "PAUSE") && this.pause === null )) {
+ return SDL.SDLModel.resultCode['IGNORED'];
+ }
+
+ if (params.updateMode == "CLEAR") {
+ this.stopTimer();
+ return SDL.SDLModel.resultCode['SUCCESS'];
+ }
+
+ if (params.updateMode == "PAUSE") {
+ this.set('pause', true);
+ } else if (params.updateMode == "RESUME") {
+ this.set('pause', false);
+ } else {
+ if (params.startTime) {
+ this.set('countUp', params.updateMode == "COUNTUP" ? true : false);
+ this.set('duration', null);
+ this.set('duration', params.startTime.hours * 3600 + params.startTime.minutes * 60 + params.startTime.seconds);
+ }
+ this.set('pause', false);
+ }
+
+ return SDL.SDLModel.resultCode['SUCCESS'];
+ },
+
+ /**
+ * Method to clear App OverLay
+ */
+ clearAppOverLay: function () {
+
+ clearInterval(this.timer);
+ this.appInfo.set('field1', '');
+ this.appInfo.set('field2', '');
+ this.appInfo.set('field3', '');
+ this.appInfo.set('field4', '');
+ this.appInfo.set('alignment', '');
+ this.set('statusText', '');
+ this.appInfo.set('mediaClock', '');
+ this.appInfo.set('mediaTrack', '');
+ this.appInfo.set('trackIcon', 'images/sdl/audio_icon.jpg');
+ this.updateSoftButtons();
+ for (i = 0; i < 10; i++) {
+ this.appInfo.set('customPresets.' + i, '');
+ }
+ this.set('mediaPreset', false);
+
+ },
+
+ /**
+ * Applin UI Show handler
+ *
+ * @param {Object}
+ */
+ onSDLUIShow: function (params) {
+
+ clearInterval(this.timer);
+
+ for (var i = 0; i < params.showStrings.length; i++) {
+ switch (params.showStrings[i].fieldName) {
+ case 'mainField1':
+ {
+ this.appInfo.set('field1', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField2':
+ {
+ this.appInfo.set('field2', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField3':
+ {
+ this.appInfo.set('field3', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField4':
+ {
+ this.appInfo.set('field4', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'statusBar':
+ {
+ this.set('statusText', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mediaClock':
+ {
+ this.appInfo.set('mediaClock', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mediaTrack':
+ {
+ this.appInfo.set('mediaTrack', params.showStrings[i].fieldText);
+ break;
+ }
+ default :
+ {
+ break;
+ }
+ }
+ }
+
+ if (params.alignment) {
+ switch (params.alignment) {
+ case "CENTERED":
+ {
+ this.appInfo.set('alignment', "text-align:center");
+ break;
+ }
+ case "LEFT_ALIGNED":
+ {
+ this.appInfo.set('alignment', "text-align:left");
+ break;
+ }
+ case "RIGHT_ALIGNED":
+ {
+ this.appInfo.set('alignment', "text-align:right");
+ break;
+ }
+ }
+ } else {
+
+ this.appInfo.set('alignment', "text-align:center");
+ }
+
+ if (params.graphic != null) {
+ if (params.graphic.value != "") {
+ this.appInfo.set('trackIcon', params.graphic.value);
+ } else {
+ this.appInfo.set('trackIcon', 'images/sdl/audio_icon.jpg');
+ }
+ }
+
+ if ("softButtons" in params) {
+ this.updateSoftButtons(params.softButtons);
+ }
+
+ // Magic number is a count of Preset Buttons on HMI = 8
+ for (var i = 0; i < 10; i++) {
+ if (!params.customPresets || (params.customPresets[i] == '' || params.customPresets[i] == null)) {
+ this.appInfo.set('customPresets.' + i, 'PRESET_' + i);
+ } else {
+ this.appInfo.set('customPresets.' + i, params.customPresets[i]);
+ }
+ }
+ this.set('mediaPreset', true);
+ }
+ });
diff --git a/src/components/HMI/app/model/sdl/Model.js b/src/components/HMI/app/model/sdl/Model.js
new file mode 100644
index 0000000000..0dfcf0394d
--- /dev/null
+++ b/src/components/HMI/app/model/sdl/Model.js
@@ -0,0 +1,1564 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLModel
+ * @desc General model for SDL applications
+ * @category Model
+ * @filesource app/model/sdl/SDLModel.js
+ * @version 1.0
+ */
+
+SDL.SDLModel = Em.Object.create({
+
+ /**
+ * Data came from UI.PerformInteractionRequest for ShowVRHelpItems popup
+ *
+ * @type {Object}
+ */
+ interactionData: {
+ 'vrHelpTitle': null,
+ 'vrHelp': null
+ },
+
+ /**
+ * Structure specified for PoliceUpdate retry sequence
+ * contains timeout seconds param, array of retry seconds and counter of number of retries
+ *
+ * @type {Objetc}
+ */
+ policyUpdateRetry:{
+ timeout: null,
+ retry: [],
+ try: null,
+ timer: null,
+ oldTimer: 0
+ },
+
+ /**
+ * Application's container for current processed requests on VR component of HMI
+ *
+ * @type {Object}
+ */
+ vrActiveRequests: {
+ vrPerformInteraction: null
+ },
+
+ /**
+ * List of callback functions for request SDL.GetUserFriendlyMessage
+ * where key is requestId
+ * and parameter is a function that will handle data came in respone from SDL
+ *
+ * @type {Object}
+ */
+ userFriendlyMessagePull: {},
+
+ /**
+ * List of appID functions for request SDL.GetListOfPermissions
+ * where key is requestId
+ * and parameter is a appID that will handle data came in respone from SDL
+ *
+ * @type {Object}
+ */
+ getListOfPermissionsPull: {},
+
+ /**
+ * List of application id's for request SDL.ActivateApp
+ * where key is requestId
+ * and parameter is a id of application to be activated
+ *
+ * @type {Object}
+ */
+ activateAppRequestsList: {},
+
+ /**
+ * ID of app in LIMITED HMI state
+ */
+ stateLimited: null,
+
+ /**
+ * Active state of phone call on HMI for Deactivate app to handle event
+ */
+ phoneCallActive: false,
+
+ /**
+ * FLAG of any app in limited level exists
+ */
+ limitedExist: false,
+
+ applicationStatusBar: function () {
+
+ if (this.limitedExist && SDL.SDLController.getApplicationModel(this.stateLimited)) {
+ return SDL.SDLController.getApplicationModel(this.stateLimited).statusText;
+ } else {
+ return '';
+ }
+ }.property("this.limitedExist"),
+
+ /**
+ * IScroll object to manage scroll on PerformInteraction view
+ *
+ * @type {Object}
+ */
+ interactionListWrapper: null,
+
+ /**
+ * TimeStamp of current started HMI session
+ *
+ * @type {Number}
+ */
+ timeStamp: null,
+
+ /**
+ * List of VR commands
+ */
+ VRCommands: [],
+
+ /**
+ * Video player object for navigationApp
+ *
+ * @type {Object}
+ */
+ naviVideo: {},
+
+/**
+ * Array of strings came in SDL.GetURLS response
+ *
+ * @type {Object}
+ */
+ policyURLs: [],
+
+ /**
+ * Policy Settings Info state value
+ *
+ * @type {String}
+ */
+ settingsInfoListState: 'iAPP_BUFFER_FULL',
+
+ /**
+ * Policy Settings Info list
+ *
+ * @type {Object}
+ */
+ settingsInfoList: [
+ 'iAPP_BUFFER_FULL',
+ 'blah'
+ ],
+
+ /**
+ * Policy Settings Info state value
+ *
+ * @type {String}
+ */
+ systemErrorListState: 'SYNC_REBOOTED',
+
+ /**
+ * Policy Settings Info list
+ *
+ * @type {Object}
+ */
+ systemErrorList: [
+ 'SYNC_REBOOTED',
+ 'SYNC_OUT_OF_MEMMORY'
+ ],
+
+ /**
+ * Flag to indicate AudioPassThruPopUp activity
+ *
+ * @type {Boolean}
+ */
+ AudioPassThruState: false,
+
+ /**
+ * Current device information
+ *
+ * @type {Object}
+ */
+ CurrDeviceInfo: {
+ "name": null,
+ "id": null
+ },
+
+ /**
+ * Driver Distraction State
+ *
+ * @type bool
+ */
+ driverDistractionState: false,
+
+ /**
+ * Flag to sent Send Data extended params
+ *
+ * @type {Boolean}
+ */
+ sendDataExtend: false,
+
+ /**
+ * VR active status
+ *
+ * @type {Boolean}
+ */
+ VRActive: false,
+
+ /**
+ * Flag to be set true when phone call is initialised
+ *
+ * @type {Boolean}
+ */
+ phoneCall: false,
+
+ /**
+ * Device list search progress flag
+ *
+ * @param {Boolean}
+ */
+ deviceSearchProgress: false,
+
+ /**
+ * Flag to be set true when VRHelpList are activated
+ *
+ * @param {Boolean}
+ */
+ VRHelpListActivated: false,
+
+ /**
+ * Flag to be set true when VRHelpList are activated
+ *
+ * @type {String}
+ */
+ keyboardInputValue: "",
+
+ /**
+ * List of states for OnTBTClientState notification
+ */
+ tbtClientStates: [
+ {
+ name: "ROUTE_UPDATE_REQUEST",
+ id: 0
+ }, {
+ name: "ROUTE_ACCEPTED",
+ id: 1
+ }, {
+ name: "ROUTE_REFUSED",
+ id: 2
+ }, {
+ name: "ROUTE_CANCELLED",
+ id: 3
+ }, {
+ name: "ETA_REQUEST",
+ id: 4
+ }, {
+ name: "NEXT_TURN_REQUEST",
+ id: 5
+ }, {
+ name: "ROUTE_STATUS_REQUEST",
+ id: 6
+ }, {
+ name: "ROUTE_SUMMARY_REQUEST",
+ id: 7
+ }, {
+ name: "TRIP_STATUS_REQUEST",
+ id: 8
+ }, {
+ name: "ROUTE_UPDATE_REQUEST_TIMEOUT",
+ id: 9
+ }
+ ],
+
+ /**
+ * List of states for ExitApplication notification
+ */
+ exitAppState: [
+ {
+ name: "IGNITION_OFF",
+ id : 0
+ },
+ {
+ name: "MASTER_RESET",
+ id : 1
+ },
+ {
+ name: "FACTORY_DEFAULTS",
+ id : 2
+ },
+ {
+ name: "SUSPEND",
+ id : 3
+ }
+ ],
+
+ /**
+ * List of states for OnSystemRequest notification
+ */
+ systemRequestState: [
+ {
+ name: "HTTP",
+ id : 0
+ },
+ {
+ name: "FILE_RESUME",
+ id : 1
+ },
+ {
+ name: "AUTH_REQUEST",
+ id : 2
+ },
+ {
+ name: "AUTH_CHALLENGE",
+ id : 3
+ },
+ {
+ name: "AUTH_ACK",
+ id : 4
+ },
+ {
+ name: "PROPRIETARY",
+ id : 5
+ }
+ ],
+
+ /**
+ * Data for AudioPassThruPopUp that contains params for visualisation
+ *
+ * @type {Object}
+ */
+ AudioPassThruData: {},
+
+ /**
+ * Enum with result codes for RPC
+ */
+ resultCode: {
+ "SUCCESS" : 0,
+ "UNSUPPORTED_REQUEST" : 1,
+ "UNSUPPORTED_RESOURCE" : 2,
+ "DISALLOWED" : 3,
+ "REJECTED" : 4,
+ "ABORTED" : 5,
+ "IGNORED" : 6,
+ "RETRY" : 7,
+ "IN_USE" : 8,
+ "DATA_NOT_AVAILABLE" : 9,
+ "TIMED_OUT" : 10,
+ "INVALID_DATA" : 11,
+ "CHAR_LIMIT_EXCEEDED" : 12,
+ "INVALID_ID" : 13,
+ "DUPLICATE_NAME" : 14,
+ "APPLICATION_NOT_REGISTERED": 15,
+ "WRONG_LANGUAGE" : 16,
+ "OUT_OF_MEMORY" : 17,
+ "TOO_MANY_PENDING_REQUESTS" : 18,
+ "NO_APPS_REGISTERED" : 19,
+ "NO_DEVICES_CONNECTED" : 20,
+ "WARNINGS" : 21,
+ "GENERIC_ERROR" : 22,
+ "USER_DISALLOWED" : 23
+ },
+
+ /**
+ * Info navigationApp data for ShowConstantTBT request
+ *
+ * @type: {Object}
+ */
+ constantTBTParams: {
+ "navigationTexts":[
+ {
+ "fieldName": "navigationText1",
+ "fieldText": "mainField1"
+ },
+ {
+ "fieldName": "navigationText2",
+ "fieldText": "mainField2"
+ },
+ {
+ "fieldName": "ETA",
+ "fieldText": "mainField3"
+ },
+ {
+ "fieldName": "totalDistance",
+ "fieldText": "mainField4"
+ },
+ {
+ "fieldName": "navigationText",
+ "fieldText": "mainField5"
+ },
+ {
+ "fieldName": "timeToDestination",
+ "fieldText": "mainField6"
+ }
+ ],
+ "softButtons": [
+ {
+ "text" : "Menu",
+ "isHighlighted" : true,
+ "softButtonID" : 1
+ },
+ {
+ "text" : "Custom button",
+ "isHighlighted" : false,
+ "softButtonID" : 2
+ },
+ {
+ "text" : "+",
+ "isHighlighted" : true,
+ "softButtonID" : 3
+ },
+ {
+ "text" : "-",
+ "isHighlighted" : false,
+ "softButtonID" : 4
+ }
+ ]
+ },
+
+ /**
+ * List of registered applications, To prevent errors without registered
+ * application "-1" used as test appID
+ *
+ * @type object
+ */
+ registeredApps: [],
+
+ /**
+ * List of unregistered applications, to verify which app is reestablished connection
+ *
+ * @type object
+ */
+ unRegisteredApps: [],
+
+ /**
+ * List of applications to show on appList view came in BC.UpdateAppList
+ *
+ * @type object
+ */
+ updatedAppsList: [],
+
+ /**
+ * List of objects with params for connected devices
+ *
+ * @type object
+ */
+ connectedDevices: {},
+
+ /**
+ * List of devices with registered applications
+ *
+ * @type object
+ */
+ conectedDevices: [],
+
+ /**
+ * List of registered components
+ *
+ * @type object
+ */
+ registeredComponents: [
+ {
+ type: "UI",
+ state: false
+ }, {
+ type: "TTS",
+ state: false
+ }, {
+ type: "VR",
+ state: false
+ }, {
+ type: "BasicCommunication",
+ state: false
+ }, {
+ type: "VehicleInfo",
+ state: false
+ }, {
+ type: "Buttons",
+ state: false
+ }, {
+ type: "Navigation",
+ state: false
+ }
+ ],
+
+ /**
+ * List of icons
+ *
+ * @type {Object}
+ */
+ defaultListOfIcons: {
+ // appID: syncFileName
+ //0: "images/media/ico_li.png"
+ 'app': 'images/info/info_leftMenu_apps_ico.png',
+ 'command': 'images/common/defaultButtonImage.png',
+ 'trackIcon': 'images/sdl/audio_icon.jpg'
+ },
+
+ /**
+ * Array of active applications
+ *
+ * @type {Array}
+ */
+ applicationsList: [],
+
+ /**
+ * Array of connected devices
+ *
+ * @type {Array}
+ */
+ devicesList: [],
+
+ /**
+ * TTS + VR language
+ *
+ * @type {String}
+ */
+ hmiTTSVRLanguage: 'EN-US',
+
+ /**
+ * UI language
+ *
+ * @type {String}
+ */
+ hmiUILanguage: 'EN-US',
+
+ /**
+ * Parameter describes if performInteraction session was started on HMI
+ * this flag set to true when UI.PerformInteraction request came on HMI
+ * and set to false when HMI send response to SDL Core on UI.PerformInteraction request
+ *
+ * @type {Boolean}
+ */
+ performInteractionSession: [],
+
+/**
+ * Array with app permissions
+ * used for policies
+ *
+ * @type {Object}
+ */
+ appPermissions: [],
+
+ /**
+ * List of supported languages
+ *
+ * @type {Array}
+ */
+ sdlLanguagesList: [
+ 'EN-US',
+ 'ES-MX',
+ 'FR-CA',
+ 'DE-DE',
+ 'ES-ES',
+ 'EN-GB',
+ 'RU-RU',
+ 'TR-TR',
+ 'PL-PL',
+ 'FR-FR',
+ 'IT-IT',
+ 'SV-SE',
+ 'PT-PT',
+ 'NL-NL',
+ 'ZH-TW',
+ 'JA-JP',
+ 'AR-SA',
+ 'KO-KR',
+ 'PT-BR',
+ 'CS-CZ',
+ 'DA-DK',
+ 'NO-NO'
+ ],
+
+ /**
+ * Function make diff between two arrays of permissions
+ * remove argument array from existed array of permissions
+ */
+ setAppPermissions: function(appID, permissions){
+
+ var messageCodes = [];
+
+ permissions.forEach(function (x) {
+ messageCodes.push(x.name);
+ });
+
+ messageCodes.push("AppPermissionsRevoked");
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appID, messageCodes);
+
+ },
+
+ /**
+ * Method to set selected state of settings Info List
+ */
+ settingsInfoListStateChange: function() {
+
+ FFW.BasicCommunication.AddStatisticsInfo(this.settingsInfoListState);
+ }.observes('this.settingsInfoListState'),
+
+ /**
+ * Method to set selected state of settings Info List
+ */
+ systemErrorListStateChange: function() {
+
+ FFW.BasicCommunication.OnSystemError(this.systemErrorListState);
+ }.observes('this.systemErrorListState'),
+
+ /**
+ * Method to open Phone view and dial phone number
+ *
+ * @param {Object}
+ */
+ dialNumber: function(params) {
+
+ this.set('phoneCall', true);
+ SDL.States.goToStates('phone.dialpad');
+ SDL.PhoneModel.set('dialpadNumber', params.number);
+ SDL.PhoneController.onDialCall();
+ },
+
+ /**
+ * Notification method to send touch event data to SDLCore
+ *
+ * @param {Object}
+ */
+ onTouchEvent: function(event){
+
+ if (event.target.parentElement.className.indexOf("navButton") >= 0 || event.target.className.indexOf("navButton") >= 0) {
+ return;
+ }
+
+ var type = "",
+ changedTouches = event.originalEvent.changedTouches ? event.originalEvent.changedTouches.length : 1;
+
+ switch (event.originalEvent.type) {
+ case "touchstart": {
+ FLAGS.TOUCH_EVENT_STARTED = true;
+ type = "BEGIN";
+ break;
+ }
+ case "touchmove": {
+ type = "MOVE";
+ break;
+ }
+ case "touchend": {
+ type = "END";
+ break;
+ }
+ case "mousedown": {
+ FLAGS.TOUCH_EVENT_STARTED = true;
+ type = "BEGIN";
+ break;
+ }
+ case "mousemove": {
+ type = "MOVE";
+ break;
+ }
+ case "mouseup": {
+ type = "END";
+ break;
+ }
+ }
+
+ if (FLAGS.TOUCH_EVENT_STARTED ) {
+
+ var events = [];
+ for(var i = 0; i < changedTouches; i++){
+
+ if (event.originalEvent.changedTouches && (event.originalEvent.changedTouches[i].pageX > SDL.SDLVehicleInfoModel.vehicleData.displayResolution.width || event.originalEvent.changedTouches[i].pageY > SDL.SDLVehicleInfoModel.vehicleData.displayResolution.height)) {
+ return;
+ }
+
+ events[i] = {};
+ events[i].c = [{}];
+
+ events[i].id = event.originalEvent.changedTouches ? event.originalEvent.changedTouches[i].identifier : 0;
+ events[i].c[0].x = event.originalEvent.changedTouches ? event.originalEvent.changedTouches[i].pageX : event.originalEvent.pageX;
+ events[i].c[0].y = event.originalEvent.changedTouches ? event.originalEvent.changedTouches[i].pageY : event.originalEvent.pageY;
+ events[i].ts = [event.timeStamp - SDL.SDLModel.timeStamp];
+
+
+
+ }
+ FFW.UI.onTouchEvent(type, events);
+ }
+
+ if (event.originalEvent.type == "mouseup") {
+ FLAGS.TOUCH_EVENT_STARTED = false;
+ }
+ },
+
+ /**
+ * Method to remove deleted by SDL Core images used in HMI
+ * check images came in request from SDLCore like UI.Show, UI.AddCommand, UI.SetGlobalProperties,
+ * UI.SeAppIcon, Navigation.ShowConstantTBT, Navigation.UpdateTurnList, UI.ShowNotification
+ *
+ * @param {Object}
+ */
+ onFileRemoved: function(params) {
+
+ var result = false;
+
+ if ((params.fileType === "GRAPHIC_PNG" || params.fileType === "GRAPHIC_BMP" || params.fileType === "GRAPHIC_JPEG") && SDL.SDLController.getApplicationModel(params.appID)) {
+ result = SDL.SDLController.getApplicationModel(params.appID).onImageRemoved(params.fileName);
+
+ if (SDL.SDLController.getApplicationModel(params.appID).appIcon.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLController.getApplicationModel(params.appID).appIcon.length) {
+ SDL.SDLController.getApplicationModel(params.appID).set('appIcon', SDL.SDLModel.defaultListOfIcons.app);
+ }
+
+ if (SDL.SDLController.getApplicationModel(params.appID).constantTBTParams) {
+
+ if (SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.turnIcon
+ && SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.turnIcon.value.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.turnIcon.value.length) {
+ SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.turnIcon.value = SDL.SDLModel.defaultListOfIcons.command;
+ SDL.TurnByTurnView.activate(params.appID);
+ }
+
+ if (SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.nextTurnIcon
+ && SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.nextTurnIcon.value.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.nextTurnIcon.value.length) {
+ SDL.SDLController.getApplicationModel(params.appID).constantTBTParams.nextTurnIcon.value = SDL.SDLModel.defaultListOfIcons.command;
+ SDL.TurnByTurnView.activate(params.appID);
+ }
+ }
+
+ if (SDL.SDLAppController.model.appInfo.trackIcon && SDL.SDLAppController.model.appInfo.trackIcon.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLAppController.model.appInfo.trackIcon.length) {
+ SDL.SDLAppController.model.appInfo.set('trackIcon', SDL.SDLModel.defaultListOfIcons.trackIcon);
+ }
+
+ if (SDL.SDLAppController.model.appInfo.mainImage && SDL.SDLAppController.model.appInfo.mainImage.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLAppController.model.appInfo.mainImage.length) {
+ SDL.SDLAppController.model.appInfo.set('mainImage', SDL.SDLModel.defaultListOfIcons.trackIcon);
+ }
+
+ var len = SDL.SDLController.getApplicationModel(params.appID).turnList.length;
+ for (var i = 0; i < len; i++) {
+ if (!SDL.SDLController.getApplicationModel(params.appID).turnList[i].turnIcon) {
+ continue;
+ }
+ if (SDL.SDLController.getApplicationModel(params.appID).turnList[i].turnIcon.value.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLController.getApplicationModel(params.appID).turnList[i].turnIcon.value.length) {
+ SDL.SDLController.getApplicationModel(params.appID).turnList[i].turnIcon.value = SDL.SDLModel.defaultListOfIcons.command;
+ }
+ }
+
+ SDL.TBTTurnList.updateList(params.appID);
+
+ if (SDL.SDLController.getApplicationModel(params.appID).softButtons) {
+ var len = SDL.SDLController.getApplicationModel(params.appID).softButtons.length;
+ for (var i = 0; i < len; i++) {
+ if (!SDL.SDLController.getApplicationModel(params.appID).softButtons[i].image) {
+ continue;
+ }
+ if (SDL.SDLController.getApplicationModel(params.appID).softButtons[i].image.value.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.SDLController.getApplicationModel(params.appID).softButtons[i].image.value.length) {
+ SDL.SDLController.getApplicationModel(params.appID).softButtons[i].image.value = SDL.SDLModel.defaultListOfIcons.command;
+ }
+ }
+
+ if (params.appID == SDL.SDLAppController.model.appID) {
+ SDL.sdlView.innerMenu.refreshItems();
+ }
+ }
+
+ var len = SDL.VRHelpListView.helpList.items.length;
+ for (var i = 0; i < len; i++) {
+ if (!SDL.VRHelpListView.helpList.items[i].params.icon) {
+ continue;
+ }
+ if (SDL.VRHelpListView.helpList.items[i].params.icon.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.VRHelpListView.helpList.items[i].params.icon.length) {
+ SDL.VRHelpListView.helpList.items[i].params.icon = SDL.SDLModel.defaultListOfIcons.command;
+ }
+ }
+
+ SDL.VRHelpListView.helpList.list.refresh();
+
+ var len = SDL.InteractionChoicesView.listOfChoices.items.length;
+ for (var i = 0; i < len; i++) {
+ if (!SDL.InteractionChoicesView.listOfChoices.items[i].params.icon) {
+ continue;
+ }
+ if (SDL.InteractionChoicesView.listOfChoices.items[i].params.icon.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.InteractionChoicesView.listOfChoices.items[i].params.icon.length) {
+ SDL.InteractionChoicesView.listOfChoices.items[i].params.icon = SDL.SDLModel.defaultListOfIcons.command;
+ }
+ }
+
+ SDL.InteractionChoicesView.listOfChoices.list.refresh();
+
+ var len = SDL.InteractionChoicesView.listWrapper.naviChoises._childViews.length;
+ for (var i = 0; i < len; i++) {
+ if (!SDL.InteractionChoicesView.listWrapper.naviChoises._childViews[i].icon) {
+ continue;
+ }
+ if (SDL.InteractionChoicesView.listWrapper.naviChoises._childViews[i].icon.indexOf(params.fileName) != -1
+ && params.fileName.length == SDL.InteractionChoicesView.listWrapper.naviChoises._childViews[i].icon.length) {
+ SDL.InteractionChoicesView.listWrapper.naviChoises._childViews[i].icon = SDL.SDLModel.defaultListOfIcons.command;
+ }
+ }
+
+ SDL.InteractionChoicesView.listWrapper.naviChoises.rerender();
+
+ }
+
+
+ if (result && SDL.OptionsView.active && SDL.SDLAppController.model.appID == params.appID) {
+ SDL.OptionsView.commands.refreshItems();
+ }
+ },
+
+ /**
+ * Method to start playing video from streaming video source
+ * provided by SDLCore
+ *
+ * @param {Object}
+ */
+ startStream: function(request) {
+
+ var text = "Would you like to start Video stream?";
+
+ SDL.PopUp.create().appendTo('body').popupActivate(text, function(result){
+ if (result) {
+
+ SDL.SDLController.getApplicationModel(request.params.appID).set('navigationStream', request.params.url);
+ SDL.SDLModel.playVideo(request.params.appID);
+
+ FFW.Navigation.sendNavigationResult(
+ SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method
+ );
+
+ } else if (result === false) {
+
+ FFW.Navigation.sendError(
+ SDL.SDLModel.resultCode["REJECTED"],
+ request.id,
+ request.method,
+ "Ignored by USER!"
+ );
+ }
+ });
+
+ },
+
+ /**
+ * Method to stop playing video streaming
+ *
+ * @param {Number}
+ */
+ stopStream: function(appID) {
+
+ var createVideoView = Ember.View.create({
+ templateName: "video",
+ template: Ember.Handlebars.compile('<video id="html5Player"></video>')
+ }),
+ videoChild = null;
+
+ SDL.NavigationAppView.videoView.remove();
+ SDL.NavigationAppView.videoView.destroy();
+
+ SDL.SDLController.getApplicationModel(appID).set('navigationStream', null);
+
+ //this.pauseVideo();
+
+ videoChild = SDL.NavigationAppView.createChildView(createVideoView);
+
+ SDL.NavigationAppView.get('childViews').pushObject(videoChild);
+ SDL.NavigationAppView.set('videoView', videoChild);
+ },
+
+ /**
+ * Method to start playing audio from streaming audio source
+ * provided by SDLCore
+ *
+ * @param {Object}
+ */
+ startAudioStream: function(params) {
+
+ var text = "Would you like to start Audio stream?";
+
+ SDL.PopUp.create().appendTo('body').popupActivate(text, function(result){
+ if (result) {
+
+ SDL.SDLController.getApplicationModel(params.appID).set('navigationAudioStream', params.url);
+ SDL.StreamAudio.play(params.url);
+
+ FFW.Navigation.sendNavigationResult(
+ SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method
+ );
+
+ } else if (result === false) {
+
+ FFW.Navigation.sendError(
+ SDL.SDLModel.resultCode["REJECTED"],
+ request.id,
+ request.method,
+ "Ignored by USER!"
+ );
+ }
+ });
+ },
+
+ /**
+ * Method to set navigationApp streaming url to current app model
+ *
+ * @param {Number}
+ */
+ stoptAudioStream: function(appID) {
+
+ SDL.SDLController.getApplicationModel(appID).set('navigationAudioStream', null);
+ SDL.StreamAudio.stop();
+ },
+
+ /**
+ * Method to reset navigationApp streaming url from current app model
+ */
+ playVideo: function(appID){
+ if (SDL.SDLController.getApplicationModel(appID).navigationStream !== null) {
+
+ SDL.SDLModel.naviVideo = document.getElementById("html5Player");
+ SDL.SDLModel.naviVideo.src = SDL.SDLController.getApplicationModel(appID).navigationStream;
+ SDL.SDLModel.naviVideo.play();
+ }
+ },
+
+ /**
+ * Video player trigger to stop playing video
+ */
+ pauseVideo: function(){
+ if (SDL.SDLModel.naviVideo != null) {
+
+ SDL.SDLModel.naviVideo.pause();
+ }
+ },
+
+ /**
+ * Method to open Turn By Turn view
+ *
+ * @param {Object}
+ */
+ tbtActivate: function(params) {
+
+ SDL.SDLController.getApplicationModel(params.appID).set('constantTBTParams', params);
+ SDL.SDLController.getApplicationModel(params.appID).set('tbtActivate', true);
+
+ if (SDL.SDLAppController.model) {
+ SDL.SDLController.activateTBT();
+ }
+ },
+
+ /**
+ * Method to set data for Turn List in applications model
+ *
+ * @param {Object}
+ */
+ tbtTurnListUpdate: function(params) {
+
+ SDL.SDLController.getApplicationModel(params.appID).turnList = params.turnList ? params.turnList : [];
+ SDL.SDLController.getApplicationModel(params.appID).turnListSoftButtons = params.softButtons ? params.softButtons : [];
+ SDL.TBTTurnList.updateList(params.appID);
+ },
+
+ /**
+ * Method to VRHelpList on UI with request parameters
+ * It opens VrHelpList PopUp with current list of readable VR commands
+ *
+ * @param {Object}
+ */
+ ShowVrHelp: function(vrHelpTitle, vrHelp) {
+
+ SDL.VRHelpListView.showVRHelp(vrHelpTitle, vrHelp);
+ },
+
+ /**
+ * Method to set language for UI component with parameters sent from
+ * SDLCore to UIRPC
+ *
+ * @type {String} lang
+ */
+ changeRegistrationUI: function (lang, appID, appName) {
+
+ if (SDL.SDLController.getApplicationModel(appID)) {
+ SDL.SDLController.getApplicationModel(appID).set('UILanguage', lang);
+ }
+
+ if (appName) {
+ SDL.SDLMediaController.currentAppId = 0;
+ SDL.SDLController.getApplicationModel(appID).appName = appName;
+ SDL.SDLMediaController.set('currentAppId', appID);
+ }
+ },
+
+ /**
+ * Method to set language for TTS and VR components with parameters sent
+ * from SDLCore to UIRPC
+ *
+ * @type {String} lang
+ */
+ changeRegistrationTTSVR: function (lang, appID) {
+
+ if (SDL.SDLController.getApplicationModel(appID)) {
+ SDL.SDLController.getApplicationModel(appID).set('TTSVRLanguage', lang);
+ }
+ },
+
+ /**
+ * Method to add activation button to VR commands and set device
+ * parameters to model
+ *
+ * @param {Object}
+ */
+ onAppRegistered: function (params) {
+
+ var applicationType = null,//Default value - NonMediaModel see SDL.SDLController.applicationModels
+ app = SDL.SDLController.getApplicationModel(params.appID);
+
+ if (app != undefined && app.initialized == false) {
+
+ if (app.isMedia != params.isMediaApplication) { // If current not initialized model doe not matches the registered application type
+ this.convertModel(params); // then model should be changed
+ } else {
+ app.disabledToActivate = params.disabled;
+ }
+ return;
+ } else if (app != undefined && app.initialized == true) {
+ console.error("Application with appID " + params.appID + " already registered!");
+ return; // if application already registered and correctly initialized and BC.UpdateAppList came from SDL than nothing shoul happend
+ }
+
+ if (params.vrSynonyms) {
+
+ var message = {"cmdID": 0, "vrCommands": params.vrSynonyms, "appID": params.appID, "type": "Application"};
+ this.addCommandVR(message);
+ }
+
+ if (params.isMediaApplication === true) {
+
+ applicationType = 0;
+ } else if (params.isMediaApplication === false) {
+
+ applicationType = 1;
+ }
+
+ SDL.SDLController.registerApplication(params, applicationType);
+
+ if (SDL.SDLModel.unRegisteredApps.indexOf(params.appID) >= 0) {
+ setTimeout(function(){ SDL.PopUp.create().appendTo('body').popupActivate("Connection with " + params.appName + " is re-established.")}, 1000);
+ this.unRegisteredApps.pop(params.appID);
+ }
+ },
+
+ /**
+ * Method to convert existed model to registered type
+ */
+ convertModel: function(params) {
+
+ SDL.SDLModel.get('registeredApps').removeObjects(SDL.SDLModel.get('registeredApps').filterProperty('appID', params.appID));
+
+ this.onAppRegistered(params);
+ },
+
+ /**
+ * Method to delete activation button from VR commands and delete device
+ * parameters from model
+ *
+ * @param {Object}
+ */
+ onAppUnregistered: function (params) {
+
+ if (SDL.SDLController.getApplicationModel(params.appID)) {
+
+ if (params.unexpectedDisconnect) {
+ SDL.PopUp.create().appendTo('body').popupActivate("The connection with the " + SDL.SDLController.getApplicationModel(params.appID).appName + " was unexpectedly lost.");
+ this.unRegisteredApps.push(params.appID);
+ }
+
+ if (SDL.SDLController.getApplicationModel(params.appID).activeRequests.uiPerformInteraction) {
+ SDL.InteractionChoicesView.deactivate("ABORTED");
+ }
+ SDL.SDLController.unregisterApplication(params.appID);
+ }
+ },
+
+ /**
+ * SDL UI ScrolableMessage activation function dependent of Driver
+ * Distraction toggle state
+ *
+ * @param {Object}
+ * params Object with parameters come from SDLCore.
+ * @param {Number}
+ * messageRequestId Identification of unique request
+ */
+ onSDLScrolableMessage: function (request, messageRequestId) {
+
+ if (!SDL.ScrollableMessage.active) {
+ if (SDL.SDLModel.driverDistractionState) {
+ SDL.DriverDistraction.activate();
+ FFW.UI.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, request.method, 'DD mode is active!');
+ } else {
+ SDL.ScrollableMessage.activate(SDL.SDLController.getApplicationModel(request.params.appID).appName, request.params, messageRequestId);
+ }
+ return true;
+ } else {
+ FFW.UI.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, request.method, 'Higher priority request is being processed on HMI!');
+ return false;
+ }
+ },
+
+ /**
+ * setGlobalProperties
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore.
+ */
+ setProperties: function(params) {
+
+ if (SDL.SDLController.getApplicationModel(params.appID)) {
+ for (var i in params) {
+ if (i === "keyboardProperties") {
+ if (params[i].language) {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.language', params[i].language);
+ }
+ if (params[i].keyboardLayout) {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.keyboardLayout', params[i].keyboardLayout);
+ }
+ if (params[i].keypressMode) {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.keypressMode', params[i].keypressMode);
+ }
+ if (params[i].limitedCharacterList) {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.limitedCharacterList', params[i].limitedCharacterList);
+ } else {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.limitedCharacterList', []);
+ }
+ if (params[i].autoCompleteText) {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', params[i].autoCompleteText);
+ } else {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', '');
+ }
+ } else {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.' + i, params[i]);
+ }
+ }
+ } else {
+ console.error("CriticalError! No app registered with current appID!");
+ }
+ },
+
+ /**
+ * Method to call function from DeviceListView to show list of connected
+ * devices
+ *
+ * @param {Object}
+ * params
+ */
+ onGetDeviceList: function (params) {
+
+ //SDL.SDLModel.set('connectedDevices', params.deviceList);
+ var exist = false;
+
+ for (var i = 0; i < params.deviceList.length; i++) {
+
+ if (params.deviceList[i].id in SDL.SDLModel.connectedDevices) {
+ exist = true;
+ }
+
+ if (!exist) {
+ SDL.SDLModel.connectedDevices[params.deviceList[i].id] = {
+ "name": params.deviceList[i].name,
+ "id": params.deviceList[i].id,
+ "sdlFunctionality": {
+ "popUpId": null,
+ "allowed": false
+ }
+ }
+ } else {
+
+ exist = false;
+ }
+ }
+
+ if (SDL.States.info.devicelist.active) {
+ SDL.DeviceListView.ShowDeviceList(params);
+ }
+
+ SDL.SDLModel.set('deviceSearchProgress', false);
+ },
+
+ /**
+ * SDL UI SetAppIcon handler
+ *
+ * @param {Object}
+ * message
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ onSDLSetAppIcon: function (message, id, method) {
+
+ if (!SDL.SDLController.getApplicationModel(message.appID)){
+ FFW.UI.sendUIResult(SDL.SDLModel.resultCode["APPLICATION_NOT_REGISTERED"], id, method);
+ } else {
+
+ var img = new Image();
+ img.onload = function () {
+
+ // code to set the src on success
+ SDL.SDLController.getApplicationModel(message.appID).set('appIcon', message.syncFileName.value);
+ FFW.UI.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], id, method);
+ };
+ img.onerror = function (event) {
+
+ // doesn't exist or error loading
+ FFW.UI.sendError(SDL.SDLModel.resultCode["INVALID_DATA"], id, method, 'Image does not exist!');
+ return false;
+ };
+
+ img.src = message.syncFileName.value;
+ }
+ },
+
+ /**
+ * SDL UI Alert response handler show popup window
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore
+ * @param {Number}
+ * alertRequestId Id of current handled request
+ */
+ onUIAlert: function (message, alertRequestId) {
+
+ if (!SDL.AlertPopUp.active) {
+ SDL.AlertPopUp.AlertActive(message, alertRequestId);
+ return true;
+ } else {
+ SDL.SDLController.alertResponse(this.resultCode['REJECTED'], alertRequestId);
+ return false;
+ }
+ },
+
+ /**
+ * SDL UI PerformInteraction response handler show popup window
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore
+ */
+ uiPerformInteraction: function (message) {
+
+ if (!SDL.SDLController.getApplicationModel(message.params.appID).activeRequests.uiPerformInteraction) {
+ SDL.SDLController.getApplicationModel(message.params.appID).activeRequests.uiPerformInteraction = message.id;
+
+ if (message.params && message.params.vrHelpTitle && message.params.vrHelp) {
+
+ SDL.SDLModel.set('interactionData.vrHelpTitle', message.params.vrHelpTitle);
+ SDL.SDLModel.set('interactionData.vrHelp', message.params.vrHelp);
+ }
+
+ SDL.InteractionChoicesView.activate(message);
+ SDL.SDLController.VRMove();
+
+ return true;
+ } else {
+
+ FFW.UI.sendError(SDL.SDLModel.resultCode['REJECTED'], message.id, message.method, "UI PerformInterection REJECTED on HMI");
+ return false;
+ }
+ },
+
+ /**
+ * SDL VR PerformInteraction response handler
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore
+ */
+ vrPerformInteraction: function (message) {
+
+ if (!SDL.SDLModel.vrActiveRequests.vrPerformInteraction) {
+ SDL.SDLModel.vrActiveRequests.vrPerformInteraction = message.id;
+ } else {
+ FFW.VR.sendError(SDL.SDLModel.resultCode['REJECTED'], message.id, message.method, "VR PerformInterection REJECTED on HMI")
+ return;
+ }
+
+ setTimeout(function(){
+ if (SDL.SDLModel.vrActiveRequests.vrPerformInteraction) {
+ SDL.SDLModel.onPrompt(message.params.timeoutPrompt);
+ }
+ }, message.params.timeout - 2000); //Magic numer is a platform depended HMI behavior: -2 seconds for timeout prompt
+
+ SDL.SDLModel.onPrompt(message.params.initialPrompt);
+
+ SDL.SDLModel.interactionData.helpPrompt = message.params.helpPrompt;
+
+ if (message.params.grammarID) {
+
+ this.set('performInteractionSession', message.params.grammarID);
+ SDL.SDLModel.set('VRActive', true);
+
+ setTimeout(function(){
+ if (SDL.SDLModel.VRActive) {
+ if (SDL.SDLAppController.model && SDL.SDLModel.vrActiveRequests.vrPerformInteraction) {
+ SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode['TIMED_OUT']);
+ }
+
+ SDL.SDLModel.set('VRActive', false);
+ }
+ }, message.params.timeout);
+
+ SDL.InteractionChoicesView.timerUpdate();
+ } else {
+
+ SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode['SUCCESS']);
+ }
+ },
+
+ /**
+ * SDL UI Slider response handler show popup window
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore
+ */
+ uiSlider: function (message) {
+
+ if (!SDL.SliderView.active) {
+ SDL.SDLController.getApplicationModel(message.params.appID).onSlider(message);
+ return true;
+ } else {
+ FFW.UI.sendSliderResult(this.resultCode["REJECTED"], message.id);
+ return false;
+ }
+ },
+
+ /**
+ * SDL ShowKeyboard show method with incoming parameters of layout, language etc...
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore
+ */
+ uiShowKeyboard: function(element){
+ SDL.Keyboard.activate(element);
+ },
+
+ /**
+ * SDL UI AudioPassThru response handler show popup window
+ *
+ * @param {Object}
+ * message Object with parameters come from SDLCore.
+ */
+ UIPerformAudioPassThru: function(message) {
+
+ this.set('AudioPassThruData', message);
+ this.set('AudioPassThruState', true);
+ },
+
+ /**
+ * Method ends processing of AudioPassThru and call AudioPassThru UI
+ * response handler
+ */
+ UIEndAudioPassThru: function () {
+
+ if (this.AudioPassThruState) {
+ FFW.UI.sendUIResult(this.resultCode["SUCCESS"], FFW.UI.endAudioPassThruRequestID, "UI.EndAudioPassThru");
+ SDL.SDLController.performAudioPassThruResponse(this.resultCode["SUCCESS"]);
+ } else {
+ FFW.UI.sendError(this.resultCode["REJECTED"], FFW.UI.endAudioPassThruRequestID, "UI.EndAudioPassThru", "UI.PerformAudioPassThru are not processed at the moment!");
+ }
+ },
+
+ /**
+ * Prompt activation
+ *
+ * @param {Object}
+ * @param {Number}
+ */
+ onPrompt: function (ttsChunks, appID) {
+
+ var message = '';
+ if (ttsChunks) {
+ for (var i = 0; i < ttsChunks.length; i++) {
+ message += ttsChunks[i].text + '\n';
+ }
+ SDL.TTSPopUp.ActivateTTS(message, appID);
+ }
+ },
+
+ /**
+ * Play audio file on PlayTone notification
+ */
+ onPlayTone: function () {
+
+ SDL.Audio.play('audio/initial.wav');
+ },
+
+ /**
+ * Prompt deactivation
+ */
+ TTSStopSpeaking: function () {
+ //true parameter makes send error response ABORTED
+ FFW.TTS.set('aborted', true);
+ SDL.TTSPopUp.DeactivateTTS();
+ },
+
+ /**
+ * SDL DeleteCommand response handler to sent delete command error or normal result
+ *
+ * @param {Number}
+ * @param {Number}
+ */
+ deleteCommandResponse: function (resultCode, requestID) {
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+ FFW.UI.sendUIResult(resultCode, requestID, "UI.DeleteCommand");
+ } else {
+ FFW.UI.sendError(resultCode, requestID, "UI.DeleteCommand", "SubMenu is opened")
+ }
+ },
+
+ /**
+ * SDL VR AddCommand response handler add command to voice recognition
+ * window
+ *
+ * @param {Object}
+ */
+ addCommandVR: function (message) {
+
+ if (message.type == "Application") {
+
+ SDL.SDLModel.VRCommands.push(message);
+ SDL.VRPopUp.AddCommand(message.cmdID, message.vrCommands, message.appID, message.type);
+ } else if ("appID" in message) {
+
+ SDL.SDLController.getApplicationModel(message.appID).VRCommands.push(message);
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.appID == message.appID) {
+
+ SDL.VRPopUp.AddCommand(message.cmdID, message.vrCommands, message.appID, message.type, message.grammarID);
+ }
+ } else {
+
+ SDL.SDLModel.VRCommands.push(message);
+ SDL.VRPopUp.AddCommand(message.cmdID, message.vrCommands, 0, message.type, message.grammarID);
+ }
+ },
+
+ /**
+ * SDL VR DeleteCommand response handler delete command from voice
+ * recognition window
+ *
+ * @param {Number}
+ */
+ deleteCommandVR: function (request) {
+
+ var appModel = SDL.SDLController.getApplicationModel(request.params.appID);
+
+ if (appModel.currentSubMenuId != 'top') {
+ for (var i in appModel.commandsList) {
+ if (appModel.commandsList[i].filterProperty('commandID', request.params.cmdID).length) {
+ if (i == appModel.currentSubMenuId) {
+
+ FFW.VR.sendError(SDL.SDLModel.resultCode["IN_USE"], request.id, request.method, "SubMenu is currently opened on UI!");
+ return;
+ }
+ }
+ }
+ }
+
+ SDL.VRPopUp.DeleteCommand(request.params.cmdID, request.params.appID);
+ var len = appModel.VRCommands.length;
+
+ for (var i = len - 1; i >= 0 ; i--) {
+ if (appModel.VRCommands[i].appID == request.params.appID &&
+ appModel.VRCommands[i].cmdID == request.params.cmdID) {
+ appModel.VRCommands.splice(i, 1);
+ }
+ }
+
+ FFW.VR.sendVRResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+
+ },
+
+ onDeactivateApp: function (target, appID) {
+
+ if (SDL.SDLController.getApplicationModel(appID)) {
+ /**
+ * Close Options menu if opened
+ */
+ if (SDL.OptionsView.active) {
+ SDL.OptionsView.set('active', false);
+ }
+
+ var dest = target.split('.'), reason;
+
+ switch (dest[0]) {
+ case 'media':
+ {
+ reason = 'AUDIO';
+ break;
+ }
+ case "phone":
+ {
+ reason = 'PHONEMENU';
+ break;
+ }
+ case "navigation":
+ {
+ reason = 'NAVIGATIONMAP';
+ break;
+ }
+ case "settings":
+ {
+ reason = 'SYNCSETTINGS';
+ break;
+ }
+ case "call":
+ {
+ reason = 'PHONECALL';
+ break;
+ }
+ default:
+ {
+ reason = 'GENERAL';
+ break;
+ }
+ }
+
+ if (SDL.SDLModel.stateLimited && reason === 'AUDIO') {
+
+ SDL.SDLModel.stateLimited = null;
+ SDL.SDLModel.set('limitedExist', false);
+ }
+
+ SDL.TurnByTurnView.deactivate();
+
+ if (!SDL.SDLModel.phoneCallActive) {
+ FFW.BasicCommunication.OnAppDeactivated(reason, appID);
+ }
+ }
+ }
+});
diff --git a/src/components/HMI/app/model/sdl/NonMediaModel.js b/src/components/HMI/app/model/sdl/NonMediaModel.js
new file mode 100644
index 0000000000..42ac14bc0c
--- /dev/null
+++ b/src/components/HMI/app/model/sdl/NonMediaModel.js
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLNonMediaModel
+ * @desc Concrate model for SDL NonMedia application
+ * @category Model
+ * @filesource app/model/sdl/NonMediaModel.js
+ * @version 1.0
+ */
+
+SDL.SDLNonMediaModel = SDL.SDLAppModel.extend({
+
+ init: function () {
+
+ this._super();
+
+ var subscribeVIData = {};
+
+ for (var key in SDL.SDLVehicleInfoModel.vehicleData) {
+ if (key != "externalTemperature") {
+ subscribeVIData[key] = false;
+ }
+ }
+
+ this.set('subscribedData', subscribeVIData);
+
+ // init properties here
+ this.set('appInfo', Em.Object.create({
+ field1 : '<field1>',
+ field2 : '<field2>',
+ field3 : '<field3>',
+ field4 : '<field4>',
+ mainImage : SDL.SDLModel.defaultListOfIcons.trackIcon,
+ image : '',
+ customPresets: [
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>',
+ '<no definition>'
+ ],
+ alignment : "text-align:center"
+ }));
+
+ this.set('activeRequests', Em.Object.create({
+ uiPerformInteraction: null
+ }));
+
+ this.set('constantTBTParams', null);
+
+ this.set('VRCommands', []);
+ this.set('tbtActivate', false);
+ this.set('globalProperties.helpPrompt', []);
+ this.set('globalProperties.timeoutPrompt', []);
+ this.set('globalProperties.keyboardProperties', Em.Object.create());
+ this.set('globalProperties.keyboardProperties.keyboardLayout', 'QWERTY');
+ this.set('globalProperties.keyboardProperties.limitedCharacterList', []);
+
+ this.set('commandsList', {'top': []});
+ this.set('softButtons', []);
+ },
+
+ /**
+ * Method hides sdl activation button and sdl application
+ *
+ * @param {Number}
+ */
+ onDeleteApplication: function (appID) {
+
+ SDL.NonMediaController.onDeleteApplication(appID);
+ },
+
+ /**
+ * Activate current application model
+ */
+ turnOnSDL: function () {
+
+ SDL.NonMediaController.activateApp(this);
+ },
+
+ /**
+ * Method to clear App OverLay
+ */
+ clearAppOverLay: function () {
+
+ clearInterval(this.timer);
+ this.appInfo.set('field1', '');
+ this.appInfo.set('field2', '');
+ this.appInfo.set('field3', '');
+ this.appInfo.set('field4', '');
+ this.appInfo.set('alignment', '');
+ this.appInfo.set('mainImage', 'images/sdl/audio_icon.jpg');
+ this.updateSoftButtons();
+ for (i = 0; i < 10; i++) {
+ this.appInfo.set('customPresets.' + i, '');
+ }
+
+ },
+
+ /**
+ * Applin UI Show handler
+ *
+ * @param {Object}
+ */
+ onSDLUIShow: function (params) {
+
+ for (var i = 0; i < params.showStrings.length; i++) {
+ switch (params.showStrings[i].fieldName) {
+ case 'mainField1':
+ {
+ this.appInfo.set('field1', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField2':
+ {
+ this.appInfo.set('field2', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField3':
+ {
+ this.appInfo.set('field3', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mainField4':
+ {
+ this.appInfo.set('field4', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'statusBar':
+ {
+ this.appInfo.set('statusText', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mediaClock':
+ {
+ this.appInfo.set('mediaClock', params.showStrings[i].fieldText);
+ break;
+ }
+ case 'mediaTrack':
+ {
+ this.appInfo.set('mediaTrack', params.showStrings[i].fieldText);
+ break;
+ }
+ default :{
+ break;
+ }
+ }
+ }
+
+ if (params.alignment) {
+ switch (params.alignment) {
+ case "CENTERED":
+ {
+ this.appInfo.set('alignment', "text-align:center");
+ break;
+ }
+ case "LEFT_ALIGNED":
+ {
+ this.appInfo.set('alignment', "text-align:left");
+ break;
+ }
+ case "RIGHT_ALIGNED":
+ {
+ this.appInfo.set('alignment', "text-align:right");
+ break;
+ }
+ }
+ } else {
+
+ this.appInfo.set('alignment', "text-align:center");
+ }
+
+ if (params.graphic != null) {
+ if (params.graphic.value != "") {
+ this.appInfo.set('mainImage', params.graphic.value);
+ } else {
+ this.appInfo.set('mainImage', 'images/sdl/audio_icon.jpg');
+ }
+ }
+
+ // Magic number is a count of Preset Buttons on HMI = 8
+ this.appInfo.set('customPresets', []);
+ for (var i = 0; i < 10; i++) {
+ if (!params.customPresets || (params.customPresets[i] == '' || params.customPresets[i] == null)) {
+ this.appInfo.get('customPresets').pushObject('PRESET_' + i);
+ } else {
+ this.appInfo.get('customPresets').pushObject(params.customPresets[i]);
+ }
+ }
+
+ if ("softButtons" in params) {
+ this.updateSoftButtons(params.softButtons);
+ }
+ },
+
+ sdlSetMediaClockTimer: function () {
+
+ return;
+ }
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/model/sdl/VehicleInfoModel.js b/src/components/HMI/app/model/sdl/VehicleInfoModel.js
new file mode 100644
index 0000000000..f9fe33d97c
--- /dev/null
+++ b/src/components/HMI/app/model/sdl/VehicleInfoModel.js
@@ -0,0 +1,501 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLVehicleInfoModel
+ * @desc SDL model with vehicle information used instead of CAN network.
+ * VehicleInfoModel is simulation of real CAN network.
+ * @category Model
+ * @filesource app/model/sdl/SDLVehicleInfoModel.js
+ * @version 1.0
+ */
+
+SDL.SDLVehicleInfoModel = Em.Object
+ .create( {
+
+ /**
+ * Stored VehicleInfo transmission state Data
+ *
+ * @type {Array}
+ */
+ vehicleInfoPRNDL: [
+ "PARK",
+ "REVERSE",
+ "NEUTRAL",
+ "DRIVE",
+ "SPORT",
+ "LOWGEAR",
+ "FIRST",
+ "SECOND",
+ "THIRD",
+ "FOURTH",
+ "FIFTH",
+ "SIXTH"
+ ],
+
+ /**
+ * Data changed in Odometr Input in VehicleInfo popUp
+ *
+ * @type {String}
+ */
+ odometrInputBinding: 'this.vehicleData.odometer',
+
+ /**
+ * PRNDL state value
+ *
+ * @type {String}
+ */
+ prndlSelectState: 'PARK',
+
+ /**
+ * Stored VehicleInfo Data
+ *
+ * @type {Array}
+ */
+ ecuDIDData: [
+ {
+ 'data': "ECU 1 Test Data"
+ }, {
+ 'data': "ECU 2 Test Data"
+ }
+ ],
+
+ /**
+ * Type of current vehicle: make of the vehicle, model of the vehicle,
+ * model Year of the vehicle, trim of the vehicle.
+ *
+ * @type {Object}
+ */
+ vehicleType: {
+ make: "Ford",
+ model: "Fiesta",
+ modelYear: "2013",
+ trim: "SE"
+ },
+
+ eVehicleDataType:{
+ "gps" :"VEHICLEDATA_GPS",
+ "speed": "VEHICLEDATA_SPEED",
+ "rpm": "VEHICLEDATA_RPM",
+ "fuelLevel": "VEHICLEDATA_FUELLEVEL",
+ "fuelLevel_State": "VEHICLEDATA_FUELLEVEL_STATE",
+ "instantFuelConsumption": "VEHICLEDATA_FUELCONSUMPTION",
+ "prndl": "VEHICLEDATA_PRNDL",
+ "externalTemperature": "VEHICLEDATA_EXTERNTEMP",
+ "tirePressure": "VEHICLEDATA_TIREPRESSURE",
+ "odometer": "VEHICLEDATA_ODOMETER",
+ "beltStatus": "VEHICLEDATA_BELTSTATUS",
+ "bodyInformation": "VEHICLEDATA_BODYINFO",
+ "deviceStatus": "VEHICLEDATA_DEVICESTATUS",
+ "eCallInfo": "VEHICLEDATA_ECALLINFO",
+ "airbagStatus": "VEHICLEDATA_AIRBAGSTATUS",
+ "emergencyEvent": "VEHICLEDATA_EMERGENCYEVENT",
+ "clusterModes": "VEHICLEDATA_CLUSTERMODESTATUS",
+ "myKey": "VEHICLEDATA_MYKEY",
+ "driverBraking": "VEHICLEDATA_BRAKING",
+ "wiperStatus": "VEHICLEDATA_WIPERSTATUS",
+ "headLampStatus": "VEHICLEDATA_HEADLAMPSTATUS",
+ "engineTorque":"VEHICLEDATA_ENGINETORQUE",
+ "accPedalPosition": "VEHICLEDATA_ACCPEDAL",
+ "steeringWheelAngle": "VEHICLEDATA_STEERINGWHEEL"
+ },
+
+ /**
+ * Stored VehicleInfo Data
+ *
+ * @type {Object}
+ */
+ vehicleData: {
+ 'displayResolution':{
+ 'width': 800,
+ 'height': 480
+ },
+ 'speed': 80.08E0,
+ 'fuelLevel': 0.2E0,
+ 'fuelLevel_State': "UNKNOWN",
+ 'instantFuelConsumption': 2.2E0,
+ 'tirePressure': {
+ 'pressureTelltale': 'OFF',
+ 'leftFront': {
+ 'status': 'UNKNOWN'
+ },
+ 'rightFront': {
+ 'status': 'UNKNOWN'
+ },
+ 'leftRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'rightRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'innerLeftRear': {
+ 'status': 'UNKNOWN'
+ },
+ 'innerRightRear': {
+ 'status': 'UNKNOWN'
+ }
+ },
+ 'beltStatus': {
+ 'driverBeltDeployed': "NOT_SUPPORTED",
+ 'passengerBeltDeployed': "NOT_SUPPORTED",
+ 'passengerBuckleBelted': "NOT_SUPPORTED",
+ 'driverBuckleBelted': "NOT_SUPPORTED",
+ 'leftRow2BuckleBelted': "NOT_SUPPORTED",
+ 'passengerChildDetected': "NOT_SUPPORTED",
+ 'rightRow2BuckleBelted': "NOT_SUPPORTED",
+ 'middleRow2BuckleBelted': "NOT_SUPPORTED",
+ 'middleRow3BuckleBelted': "NOT_SUPPORTED",
+ 'leftRow3BuckleBelted': "NOT_SUPPORTED",
+ 'rightRow3BuckleBelted': "NOT_SUPPORTED",
+ 'leftRearInflatableBelted': "NOT_SUPPORTED",
+ 'rightRearInflatableBelted': "NOT_SUPPORTED",
+ 'middleRow1BeltDeployed': "NOT_SUPPORTED",
+ 'middleRow1BuckleBelted': "NOT_SUPPORTED"
+ },
+ 'bodyInformation': {
+ 'parkBrakeActive': false,
+ 'ignitionStableStatus': "MISSING_FROM_TRANSMITTER",
+ 'ignitionStatus': "UNKNOWN",
+ 'driverDoorAjar': true,
+ 'passengerDoorAjar': true,
+ 'rearLeftDoorAjar': true,
+ 'rearRightDoorAjar': true
+ },
+ 'deviceStatus': {
+ 'voiceRecOn': false,
+ 'btIconOn': false,
+ 'callActive': false,
+ 'phoneRoaming': false,
+ 'textMsgAvailable': false,
+ 'battLevelStatus': "NOT_PROVIDED",
+ 'stereoAudioOutputMuted': false,
+ 'monoAudioOutputMuted': false,
+ 'signalLevelStatus': "NOT_PROVIDED",
+ 'primaryAudioSource': "NO_SOURCE_SELECTED",
+ 'eCallEventActive': false
+ },
+ 'driverBraking': "NOT_SUPPORTED",
+ 'wiperStatus': "NO_DATA_EXISTS",
+ 'headLampStatus': {
+ "lowBeamsOn": false,
+ "highBeamsOn": false,
+ "ambientLightSensorStatus": "NIGHT"
+ },
+ 'engineTorque': 2.5E0,
+ 'accPedalPosition': 10.5E0,
+ 'steeringWheelAngle': 1.2E0,
+ 'myKey': {
+ "e911Override": "NO_DATA_EXISTS"
+ },
+ 'avgFuelEconomy': 0.1,
+ 'batteryVoltage': 12.5,
+ 'vin': '52-452-52-752',
+ 'prndl': 'PARK',
+ 'odometer': 23,
+ 'batteryPackVoltage': 12.5,
+ 'batteryPackCurrent': 7.0,
+ 'batteryPackTemperature': 30,
+ 'tripOdometer': 0,
+ 'genericbinary': '165165650',
+ 'satRadioESN': "165165650",
+ 'rainSensor': 165165650,
+ 'gps': {
+ 'longitudeDegrees': 42.5E0,
+ 'latitudeDegrees': -83.3E0,
+ 'utcYear': 2013,
+ 'utcMonth': 2,
+ 'utcDay': 14,
+ 'utcHours': 13,
+ 'utcMinutes': 16,
+ 'utcSeconds': 54,
+ 'compassDirection': 'SOUTHWEST',
+ 'pdop': 8.4E0,
+ 'hdop': 5.9E0,
+ 'vdop': 3.2E0,
+ 'actual': false,
+ 'satellites': 8,
+ 'dimension': '2D',
+ 'altitude': 7.7E0,
+ 'heading': 173.99E0,
+ 'speed': 2.78E0
+ },
+ 'eCallInfo': {
+ 'eCallNotificationStatus': 'NORMAL',
+ 'auxECallNotificationStatus': 'NORMAL',
+ 'eCallConfirmationStatus': 'NORMAL'
+ },
+ 'airbagStatus': {
+ 'driverAirbagDeployed': 'NO_EVENT',
+ 'driverSideAirbagDeployed': 'NO_EVENT',
+ 'driverCurtainAirbagDeployed': 'NO_EVENT',
+ 'passengerAirbagDeployed': 'NO_EVENT',
+ 'passengerCurtainAirbagDeployed': 'NO_EVENT',
+ 'driverKneeAirbagDeployed': 'NO_EVENT',
+ 'passengerSideAirbagDeployed': 'NO_EVENT',
+ 'passengerKneeAirbagDeployed': 'NO_EVENT'
+ },
+ 'emergencyEvent': {
+ 'emergencyEventType': 'NO_EVENT',
+ 'fuelCutoffStatus': 'NORMAL_OPERATION',
+ 'rolloverEvent': 'NO_EVENT',
+ 'maximumChangeVelocity': 'NO_EVENT',
+ 'multipleEvents': 'NO_EVENT'
+ },
+ 'clusterModeStatus': {
+ 'powerModeActive': false,
+ 'powerModeQualificationStatus': 'POWER_MODE_EVALUATION_IN_PROGRESS',
+ 'carModeStatus': 'FACTORY',
+ 'powerModeStatus': 'KEY_OUT'
+ }
+
+ },
+
+ /**
+ * Method to set selected state of vehicle transmission to vehicleData
+ */
+ onPRNDLSelected: function() {
+
+ if (this.prndlSelectState) {
+ this.set('vehicleData.prndl', this.prndlSelectState);
+ }
+ }.observes('this.prndlSelectState'),
+
+ /**
+ * Method calls GetVehicleType response
+ *
+ * @type {Number}
+ */
+ getVehicleType: function(id) {
+
+ FFW.VehicleInfo.GetVehicleTypeResponse(this.vehicleType, id);
+ },
+
+ /**
+ * SDL VehicleInfo.GetDTCs handler fill data for response about vehicle
+ * errors
+ *
+ * @type {Object} params
+ * @type {Number} id
+ */
+ vehicleInfoGetDTCs: function(params, id) {
+
+ var dtc = [], result = "", ecuHeader = 2;
+
+ for ( var i = 0; i < 3; i++) {
+ dtc.push("line " + i);
+ }
+
+ result = "SUCCESS";
+
+ FFW.VehicleInfo.vehicleInfoGetDTCsResponse(ecuHeader,
+ dtc,
+ result,
+ id);
+
+ },
+
+ /**
+ * SDL VehicleInfo.ReadDID handler send response about vehicle
+ * conditions
+ *
+ * @type {Object} params
+ * @type {Number} id
+ */
+ vehicleInfoReadDID: function(params, id) {
+
+ var didResult = [], resultCode = "";
+ // magic number used because there is no huge database on HMI of
+ // vehicle
+ // data
+ if (this.ecuDIDData[1].data) {
+ resultCode = "SUCCESS";
+ } else {
+ resultCode = "INVALID_DATA";
+ }
+
+ for ( var i = 0; i < params.didLocation.length; i++) {
+ if (i < 10) {
+ didResult[i] = {};
+ didResult[i].resultCode = 'SUCCESS';
+ didResult[i].didLocation = params.didLocation[i];
+ didResult[i].data = '0';
+ } else {
+ didResult[i] = {};
+ didResult[i].resultCode = "VEHICLE_DATA_NOT_AVAILABLE";
+ didResult[i].didLocation = params.didLocation[i];
+ didResult[i].data = '0';
+ }
+ }
+
+ FFW.VehicleInfo.vehicleInfoReadDIDResponse(didResult,
+ resultCode,
+ id);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ SubscribeVehicleData: function(message) {
+ if (SDL.SDLController.getApplicationModel(message.params.appID)) {
+
+ var subscribeVIData = {};
+ for (var key in message.params) {
+
+ if (key === "clusterModeStatus") {
+ key = "clusterModes";
+ }
+
+ if (key != 'appID' && SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] === true) {
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "DATA_ALREADY_SUBSCRIBED"
+ };
+ } else if (key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData) {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = true;
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "SUCCESS"
+ };
+ } else if (key === "externalTemperature") {
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
+ };
+ }
+ }
+ }
+ FFW.VehicleInfo.sendVISubscribeVehicleDataResult(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, subscribeVIData);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ UnsubscribeVehicleData: function(message) {
+ if (SDL.SDLController.getApplicationModel(message.params.appID)) {
+
+ var subscribeVIData = {};
+ for (var key in message.params) {
+
+ if (key === "clusterModeStatus") {
+ key = "clusterModes";
+ }
+
+ if (key != 'appID' && SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] === false) {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = false;
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "DATA_NOT_SUBSCRIBED"
+ };
+ } else if (key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData) {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = false;
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "SUCCESS"
+ };
+ } else if (key === "externalTemperature") {
+ subscribeVIData[key] = {
+ dataType: this.eVehicleDataType[key],
+ resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
+ };
+ }
+ }
+ }
+ FFW.VehicleInfo.sendVISubscribeVehicleDataResult(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, subscribeVIData);
+ },
+
+ /**
+ * Function returns response message to VehicleInfoRPC
+ *
+ * @type {Object} message
+ */
+ getVehicleData: function(message) {
+
+ var data = {}
+ text = "Params ", result = true;
+
+ for ( var key in message.params) {
+ if (key != "appID") {
+ if (this.vehicleData[key]) {
+ data[key] = this.vehicleData[key];
+ } else {
+ if (!result) {
+
+ text += ", " + key;
+ } else {
+
+ text += key;
+ result = false;
+ }
+ }
+ }
+ }
+
+ text += " are not available";
+
+ if (result) {
+ FFW.VehicleInfo.sendGetVehicleDataResut(SDL.SDLModel.resultCode["SUCCESS"], message.id, message.method, data);
+ } else {
+ FFW.VehicleInfo.sendGetVehicleDataError(SDL.SDLModel.resultCode["DATA_NOT_AVAILABLE"], message.id, message.method, text, data);
+ }
+ },
+
+ /**
+ * Function send all vehicle conditions on FFW.VehicleInfo.OnVehicleData
+ * for notification when data changes
+ */
+ onVehicleDataChanged: function() {
+
+ var appID = null;
+
+ for (var i = 0; i < SDL.SDLModel.registeredApps.length; i++) {
+ appID = SDL.SDLModel.registeredApps[i].appID;
+ if (SDL.SDLController.getApplicationModel(appID).subscribedData["prndl"]) {
+
+ var jsonData = {};
+ jsonData["prndl"] = this.vehicleData["prndl"];
+ FFW.VehicleInfo.OnVehicleData(jsonData);
+ return;
+ }
+ }
+
+ }.observes('this.vehicleData.prndl'),
+
+ /**
+ * Function send all vehicle conditions on FFW.VehicleInfo.OnVehicleData
+ * for notification when data changes
+ */
+ onOdometerDataChanged: function() {
+
+ var jsonData = {};
+
+ jsonData["odometer"] = parseInt(this.odometrInput);
+ FFW.VehicleInfo.OnVehicleData(jsonData);
+
+ }.observes('this.odometrInput')
+ });
diff --git a/src/components/HMI/app/util/Audio.js b/src/components/HMI/app/util/Audio.js
new file mode 100644
index 0000000000..9684d5b4e4
--- /dev/null
+++ b/src/components/HMI/app/util/Audio.js
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.Audio
+ * @desc HTML5 Audio player
+ * @category utils
+ * @filesource app/util/Audio.js
+ * @version 1.0
+ */
+
+SDL.Audio = {
+
+ audio: new Audio(),
+
+ play: function(path) {
+
+ this.audio.src = path;
+ this.audio.play();
+ }
+} \ No newline at end of file
diff --git a/src/components/HMI/app/util/StreamAudio.js b/src/components/HMI/app/util/StreamAudio.js
new file mode 100644
index 0000000000..de78abae7f
--- /dev/null
+++ b/src/components/HMI/app/util/StreamAudio.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StreamAudio
+ * @desc HTML5 Audio player
+ * @category utils
+ * @filesource app/util/StreamAudio.js
+ * @version 1.0
+ */
+
+SDL.StreamAudio = {
+
+ audio: new Audio(),
+
+ play: function(path) {
+
+ this.audio.src = path;
+ this.audio.play();
+ },
+
+ stop: function() {
+
+ this.audio.src = "";
+ this.audio.pause();
+ }
+} \ No newline at end of file
diff --git a/src/components/HMI/app/view/WarningView.js b/src/components/HMI/app/view/WarningView.js
new file mode 100644
index 0000000000..8fa40b4547
--- /dev/null
+++ b/src/components/HMI/app/view/WarningView.js
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.WarningViewg
+ * @desc Warning representation
+ * @category View
+ * @filesource app/view/WarningView.js
+ * @version 1.0
+ */
+
+SDL.warningView = Em.ContainerView
+ .extend( {
+
+ classNameBindings: [
+ 'fade:fadeAnimation:fadeWarning', 'hide:inactive_state',
+ ],
+
+ elementId: 'warning_view',
+
+ childViews: [
+ 'content', 'button'
+ ],
+
+ content: Em.View
+ .extend( {
+
+ classNames: 'message',
+
+ template: Ember.Handlebars
+ .compile('<div class="warning_text"> {{SDL.locale.label.view_warning}}</div>'
+ + '<div class="text">'
+ + '<br>'
+ + '<p>{{SDL.locale.label.view_warning_paragraph1}} </p><br>'
+ + '<p> {{SDL.locale.label.view_warning_paragraph2}} </p><br>'
+ + '</div>')
+ }),
+
+ button: Em.View.create( {
+
+ elementId: 'warning_ok_button',
+
+ classNameBindings: [
+ 'isReady: visible_display', 'pressed:pressed'
+ ],
+
+ classNames: [
+ 'okbut', 'ffw-button'
+ ],
+ /**
+ * Check for webkit fillmode animation support Android < 4 version
+ * doesnt support webkit animation fillmode
+ */
+ checkForCCS3AnimationSupport: function() {
+
+ if (FFW.isAndroid) {
+ return $('body')[0].style.webkitAnimationFillMode === '';
+ } else {
+ return false;
+ }
+ },
+
+ template: Ember.Handlebars.compile('<span>OK</span>'),
+
+ /* this method is called when the web part is fully loaded */
+ appLoaded: function() {
+
+ var self = this;
+ /** Show OK Button after 2 second delay */
+ setTimeout(function() {
+
+ self.set('isReady', true);
+ }, 2000);
+
+ var components = Em.ContainerView.create({
+
+ classNames: 'components',
+
+ childViews: [
+ 'BasicCommunication',
+ 'Buttons',
+ 'Navigation',
+ 'TTS',
+ 'UI',
+ 'VI',
+ 'VR'
+ ],
+
+ BasicCommunication: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'basicCommunicationCheckBox',
+
+ classNames: 'basicCommunicationCheckBox item',
+
+ checkedBinding: 'FLAGS.BC'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'basicCommunicationText item',
+
+ content: 'BasicCommunication'
+
+ })
+ }),
+
+ Buttons: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'buttonsCheckBox',
+
+ classNames: 'buttonsCheckBox item',
+
+ checkedBinding: 'FLAGS.Buttons'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'buttonsText item',
+
+ content: 'Buttons'
+
+ })
+ }),
+
+ Navigation: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'navigationCheckBox',
+
+ classNames: 'navigationCheckBox item',
+
+ checkedBinding: 'FLAGS.Navi'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'navigationText item',
+
+ content: 'Navigation'
+
+ })
+ }),
+
+ TTS: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'ttsCheckBox',
+
+ classNames: 'ttsCheckBox item',
+
+ checkedBinding: 'FLAGS.TTS'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'ttsText item',
+
+ content: 'TTS'
+
+ })
+ }),
+
+ UI: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'uiCheckBox',
+
+ classNames: 'uiCheckBox item',
+
+ checkedBinding: 'FLAGS.UI'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'uiText item',
+
+ content: 'UI'
+
+ })
+ }),
+
+ VI: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'viCheckBox',
+
+ classNames: 'viCheckBox item',
+
+ checkedBinding: 'FLAGS.VI'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'viText item',
+
+ content: 'VI'
+
+ })
+ }),
+
+ VR: Em.ContainerView.extend({
+
+ classNames: 'component',
+
+ childViews: [
+ 'checkBox',
+ 'text'
+ ],
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'vrCheckBox',
+
+ classNames: 'vrCheckBox item',
+
+ checkedBinding: 'FLAGS.VR'
+
+ }),
+
+ text: SDL.Label.extend({
+
+ classNames: 'vrText item',
+
+ content: 'VR'
+
+ })
+ })
+
+ });
+
+ components.appendTo('#warning_view');
+
+ }.observes('SDL.appReady'),
+
+ actionDown: function(event) {
+
+ this.set('pressed', true);
+ },
+
+ actionUp: function(event) {
+
+ this.set('pressed', false);
+
+ var self = this;
+
+ this._parentView.set('fade', this
+ .checkForCCS3AnimationSupport());
+
+ setTimeout(function() {
+
+ self._parentView.set('hide', true);
+ }, 1000);
+
+ SDL.RPCController.ConnectToSDL();
+ }
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/climateView.js b/src/components/HMI/app/view/climateView.js
new file mode 100644
index 0000000000..626c2a2353
--- /dev/null
+++ b/src/components/HMI/app/view/climateView.js
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PlayerControllsView
+ * @desc Video player visual representation
+ * @category View
+ * @filesource app/view/player/PlayerView.js
+ * @version 1.0
+ */
+SDL.ClimateView = Em.ContainerView.create( {
+ /** View Id */
+ elementId: 'climateView',
+
+ classNameBindings:
+ [
+ 'SDL.States.climate.active:active_state:inactive_state'
+ ],
+
+ childViews:
+ [
+ 'windowText'
+ ],
+
+
+ windowText: SDL.Label.extend( {
+
+ classNames: 'windowText',
+
+ content: 'Climate'
+ } )
+
+} );
diff --git a/src/components/HMI/app/view/home/bottomControls.js b/src/components/HMI/app/view/home/bottomControls.js
new file mode 100644
index 0000000000..46fcb768cf
--- /dev/null
+++ b/src/components/HMI/app/view/home/bottomControls.js
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.BottomControlls
+ * @desc BottomControlls module visual representation
+ * @category View
+ * @filesource app/view/BottomControls.js
+ * @version 1.0
+ */
+
+SDL.BottomControls = Em.ContainerView.extend( {
+
+ elementId: 'app_bottom_controlls',
+
+ childViews: [
+ 'information', 'home', 'settings'
+ ],
+
+ information: Em.View.extend( {
+ elementId: 'info_but',
+ classNameBindings: [
+ 'SDL.States.info.active:selected'
+ ],
+
+ template: Em.Handlebars.compile('<div id="info_but_click"></div>'),
+
+ actionDown: function(event) {
+
+ if (!SDL.States.info.active) {
+ if (SDL.InfoController.activeState === 'info.nonMedia') {
+ SDL.NonMediaController.activateCurrentApp();
+ } else {
+ SDL.States.goToStates(SDL.InfoController.activeState);
+ }
+ }
+ }
+ }),
+
+ home: Em.View.extend( {
+ elementId: 'home_but',
+ classNameBindings: [
+ 'SDL.States.home.active:selected'
+ ],
+
+ template: Em.Handlebars.compile('<div id="home_but_click"></div>'),
+
+ actionDown: function(event) {
+
+ SDL.States.goToStates('home');
+ }
+ }),
+
+ settings: Em.View.extend( {
+ elementId: 'setting_but',
+
+ classNameBindings: 'SDL.States.settings.active:selected',
+
+ template: Em.Handlebars.compile('<div id="setting_but_click"></div>'),
+
+ actionDown: function(event) {
+
+ if (!SDL.States.settings.active) {
+ SDL.States.goToStates(SDL.SettingsController.activeState);
+ }
+ }
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/controlButtons.js b/src/components/HMI/app/view/home/controlButtons.js
new file mode 100644
index 0000000000..3b32d47368
--- /dev/null
+++ b/src/components/HMI/app/view/home/controlButtons.js
@@ -0,0 +1,579 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.controlButtons
+ * @desc Climate module visual representation
+ * @category View
+ * @filesource app/view/home/controlButtons.js
+ * @version 1.0
+ */
+
+SDL.ControlButtons = Em.ContainerView
+ .create( {
+
+ elementId: 'app_controlButtons',
+
+ childViews: [
+ 'VRButton',
+ 'buttonControls',
+ 'driverDistractionControl',
+ 'infoTable',
+ 'vehicleInfo',
+ 'tbtClientState',
+ 'ExitApp',
+ 'SystemRequest',
+ 'UILanguages',
+ 'TTSVRLanguages',
+ 'UILanguagesLabel',
+ 'TTSVRLanguagesLabel',
+ 'appUILanguagesLabel',
+ 'appTTSVRLanguagesLabel',
+ 'appUILang',
+ 'appTTSVRLang',
+ 'phoneCall'
+ ],
+
+ /**
+ * Button to initiate phone call emulation on HMI
+ */
+ phoneCall: SDL.Button.extend( {
+ elementId: 'phone_call_button',
+
+ classNames: ['phone_call_button', 'button'],
+
+ expand: false,
+
+ classNameBindings: ['this.expand:expand'],
+
+ mouseEnter: function(){
+ this.set('expand', true);
+ },
+
+ mouseLeave: function(){
+ this.set('expand', false);
+ },
+
+ action: 'phoneCall',
+
+ target: 'SDL.SettingsController',
+
+ text: 'Incoming call!'
+ }),
+
+ /*
+ * Label with name of UILanguages select
+ */
+ appUILang: SDL.Label.extend( {
+
+ elementId: 'appUILang',
+
+ classNames: 'appUILang',
+
+ contentBinding: 'SDL.SDLAppController.model.UILanguage'
+ }),
+
+ /*
+ * Label with name of TTSVRLanguages select
+ */
+ appTTSVRLang: SDL.Label.extend( {
+
+ elementId: 'appTTSVRLang',
+
+ classNames: 'appTTSVRLang',
+
+ contentBinding: 'SDL.SDLAppController.model.TTSVRLanguage'
+ }),
+
+ /*
+ * Label with name of UILanguages select
+ */
+ appUILanguagesLabel: SDL.Label.extend( {
+
+ elementId: 'appUILanguagesLabel',
+
+ classNames: 'appUILanguagesLabel',
+
+ content: 'application UI Languages'
+ }),
+
+ /*
+ * Label with name of TTSVRLanguages select
+ */
+ appTTSVRLanguagesLabel: SDL.Label.extend( {
+
+ elementId: 'appTTSVRLanguagesLabel',
+
+ classNames: 'appTTSVRLanguagesLabel',
+
+ content: 'application (TTS + VR) Languages'
+ }),
+
+ /*
+ * Label with name of UILanguages select
+ */
+ UILanguagesLabel: SDL.Label.extend( {
+
+ elementId: 'UILanguagesLabel',
+
+ classNames: 'UILanguagesLabel',
+
+ content: 'UI Languages'
+ }),
+
+ /*
+ * Label with name of TTSVRLanguages select
+ */
+ TTSVRLanguagesLabel: SDL.Label.extend( {
+
+ elementId: 'TTSVRLanguagesLabel',
+
+ classNames: 'TTSVRLanguagesLabel',
+
+ content: 'TTS + VR Languages'
+ }),
+
+ /*
+ * HMI element Select with list of supported UI component languages
+ */
+ UILanguages: Em.Select.extend( {
+
+ elementId: 'UILanguages',
+
+ classNames: 'languageSelect',
+
+ contentBinding: 'SDL.SDLModel.sdlLanguagesList',
+
+ valueBinding: 'SDL.SDLModel.hmiUILanguage'
+ }),
+
+ /*
+ * HMI element Select with list of supported TTS and VR component
+ * languages
+ */
+ TTSVRLanguages: Em.Select.extend( {
+
+ elementId: 'TTSVRLanguages',
+
+ classNames: 'languageSelect',
+
+ contentBinding: 'SDL.SDLModel.sdlLanguagesList',
+
+ valueBinding: 'SDL.SDLModel.hmiTTSVRLanguage'
+ }),
+
+ /**
+ * VehicleInfo button
+ */
+ vehicleInfo: SDL.Button.create( {
+ elementId: 'vehicleInfoButton',
+ classNames: 'vehicleInfoButton btn',
+ text: 'Vehicle Info',
+ action: function() {
+
+ // this._super();
+ SDL.VehicleInfo.toggleActivity();
+ },
+ templateName: 'text'
+ }),
+
+ /**
+ * TBT Client State button
+ */
+ tbtClientState: SDL.Button.create( {
+ elementId: 'tbtClientStateButton',
+ classNames: 'tbtClientStateButton btn',
+ text: 'TBT Client State',
+ action: function() {
+
+ // this._super();
+ SDL.TBTClientStateView.toggleActivity();
+ },
+ templateName: 'text'
+ }),
+
+ /**
+ * Exit Application button opens Exit Application reasons popup
+ */
+ ExitApp: SDL.Button.create( {
+ elementId: 'exitApp',
+ classNames: 'exitApp btn',
+ text: 'Exit Application',
+ action: function() {
+
+ // this._super();
+ SDL.ExitApp.toggleActivity();
+ },
+ templateName: 'text'
+ }),
+
+ /**
+ * Exit Application button opens Exit Application reasons popup
+ */
+ SystemRequest: SDL.Button.create( {
+ elementId: 'systemRequest',
+ classNames: 'systemRequest btn',
+ text: 'System Request',
+ action: function() {
+
+ // this._super();
+ SDL.SystemRequest.toggleActivity();
+ },
+ templateName: 'text'
+ }),
+
+ /**
+ * Voice Recognition button
+ */
+ VRButton: SDL.Button.create( {
+ elementId: 'VRButton',
+ classNames: 'VRButton',
+ action: 'activateVRPopUp',
+ target: 'SDL.SDLController'
+ }),
+
+ infoTable: Em.ContainerView
+ .extend( {
+ elementId: 'infoTable',
+
+ classNames: 'infoTable',
+
+ childViews: [
+ 'globalPropertiesLabel',
+ 'gpHelpData',
+ 'gpTimeoutData',
+ 'gpAUTOCOMPLETE',
+ 'policyURLs'
+ ],
+
+ globalPropertiesLabel: SDL.Label.extend( {
+
+ elementId: 'sdlGPLabel',
+
+ classNames: 'sdlGPLabel',
+
+ content: 'HELP_PROMPT: TIMEOUT_PROMPT: AUTOCOMPLETE_TEXT: POLICY_GetURLS:'
+ }),
+
+ policyURLs: SDL.Label.extend( {
+
+ elementId: 'policyURLs',
+
+ classNames: 'sdlGPData',
+
+ contentBinding: 'this.propertiesData',
+
+ propertiesData: function() {
+
+ var str = '';
+ for (var i = 0; i < SDL.SDLModel.policyURLs.length; i++) {
+ str += SDL.SDLModel.policyURLs[i] + '; ';
+ }
+
+ return str;
+ }.property('SDL.SDLModel.policyURLs')
+ }),
+
+ gpHelpData: SDL.Label.extend( {
+
+ elementId: 'sdlGPHData',
+
+ classNames: 'sdlGPData',
+
+ contentBinding: 'this.propertiesData',
+
+ propertiesData: function() {
+
+ var str = '';
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.helpPrompt) {
+ var i = 0;
+
+ for (i = 0; i < SDL.SDLAppController.model.globalProperties.helpPrompt.length; i++) {
+ str += SDL.SDLAppController.model.globalProperties.helpPrompt[i].text
+ + ' ';
+ }
+ }
+ return str;
+ }.property('SDL.SDLAppController.model.globalProperties.helpPrompt.@each.text')
+ }),
+
+ gpTimeoutData: SDL.Label.extend( {
+
+ elementId: 'sdlGPTData',
+
+ classNames: 'sdlGPData',
+
+ contentBinding: 'this.propertiesData',
+
+ propertiesData: function() {
+
+ var str = '';
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.timeoutPrompt) {
+ var i = 0;
+ for (i = 0; i < SDL.SDLAppController.model.globalProperties.timeoutPrompt.length; i++) {
+ str += SDL.SDLAppController.model.globalProperties.timeoutPrompt[i].text
+ + ' ';
+ }
+ }
+
+ return str;
+ }.property('SDL.SDLAppController.model.globalProperties.timeoutPrompt.@each.text')
+ }),
+
+ gpAUTOCOMPLETE: SDL.Label.extend( {
+
+ elementId: 'sdlGPAUTOCOMPLETE',
+
+ classNames: 'sdlGPData',
+
+ contentBinding: 'SDL.SDLAppController.model.globalProperties.keyboardProperties.autoCompleteText',
+
+ propertiesData: function() {
+
+// var str = '';
+// if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.timeoutPrompt) {
+// var i = 0;
+// for (i = 0; i < SDL.SDLAppController.model.globalProperties.timeoutPrompt.length; i++) {
+// str += SDL.SDLAppController.model.globalProperties.timeoutPrompt[i].text
+// + ' ';
+// }
+// }
+//
+// return str;
+ }.property('SDL.SDLAppController.model.globalProperties.keyboardProperties.autoCompleteText.@each')
+ })
+ }),
+
+ driverDistractionControl: Em.ContainerView.extend( {
+ elementId: 'driverDistractionControl',
+
+ classNames: 'driverDistractionControl',
+
+ childViews: [
+ 'driverDistractionLabel', 'driverDistractionCheckBox'
+ ],
+
+ driverDistractionLabel: SDL.Label.extend( {
+
+ elementId: 'driverDistractionControlLabel',
+
+ classNames: 'driverDistractionControlLabel',
+
+ content: 'DD'
+ }),
+
+ driverDistractionCheckBox: Em.Checkbox.extend( {
+
+ elementId: 'driverDistractionControlCheckBox',
+
+ classNames: 'driverDistractionControlCheckBox',
+
+ checkedBinding: 'SDL.SDLModel.driverDistractionState'
+
+ })
+ }),
+
+ buttonControls: Em.ContainerView.extend( {
+ elementId: 'buttonControls',
+
+ classNames: 'buttonControls',
+
+ childViews: [
+ 'ContainerControlls',
+ 'OneBtn',
+ 'TwoBtn',
+ 'ThreeBtn',
+ 'FourBtn',
+ 'FiveBtn',
+ 'SixBtn',
+ 'SevenBtn',
+ 'EightBtn',
+ 'NineBtn',
+ 'ZiroBtn'
+ ],
+
+ ContainerControlls: Em.ContainerView.extend( {
+ elementId: 'ContainerControlls',
+
+ classNames: 'ContainerControlls',
+
+ childViews: [
+ 'UpBtn', 'DownBtn', 'LeftBtn', 'RightBtn', 'OkBtn'
+ ],
+
+ /** Up button */
+ UpBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'TUNEUP',
+ classNames: 'UpBtn',
+ time: 0,
+ presetName: 'TUNEUP'
+ }),
+
+ /** Down button */
+ DownBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'TUNEDOWN',
+ classNames: 'DownBtn',
+ time: 0,
+ presetName: 'TUNEDOWN'
+ }),
+
+ /** Left button */
+ LeftBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'SEEKLEFT',
+ classNames: 'LeftBtn',
+ time: 0,
+ presetName: 'SEEKLEFT'
+ }),
+
+ /** Right button */
+ RightBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'SEEKRIGHT',
+ classNames: 'RightBtn',
+ time: 0,
+ presetName: 'SEEKRIGHT'
+ }),
+
+ /** Ok button */
+ OkBtn: SDL.Button.create( {
+ elementId: 'OK',
+ classNames: 'OkBtn',
+ time: 0,
+ presetName: 'OK',
+ actionDown: function() {
+
+ this._super();
+ SDL.SDLController
+ .onSoftButtonOkActionDown(this.presetName);
+ },
+ actionUp: function() {
+
+ this._super();
+ SDL.SDLController
+ .onSoftButtonOkActionUp(this.presetName);
+ }
+ })
+ }),
+
+ /** One button */
+ OneBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_1',
+ classNames: 'OneBtn btnNotPressed',
+ text: '1',
+ time: 0,
+ presetName: 'PRESET_1',
+ templateName: 'text'
+ }),
+
+ /** Two button */
+ TwoBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_2',
+ classNames: 'TwoBtn btnNotPressed',
+ text: '2',
+ time: 0,
+ presetName: 'PRESET_2',
+ templateName: 'text'
+ }),
+
+ /** Three button */
+ ThreeBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_3',
+ classNames: 'ThreeBtn btnNotPressed',
+ text: '3',
+ time: 0,
+ presetName: 'PRESET_3',
+ templateName: 'text'
+ }),
+
+ /** Four button */
+ FourBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_4',
+ classNames: 'FourBtn btnNotPressed',
+ text: '4',
+ time: 0,
+ presetName: 'PRESET_4',
+ templateName: 'text'
+ }),
+
+ /** Five button */
+ FiveBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_5',
+ classNames: 'FiveBtn btnNotPressed',
+ text: '5',
+ time: 0,
+ presetName: 'PRESET_5',
+ templateName: 'text'
+ }),
+
+ /** One button */
+ SixBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_6',
+ classNames: 'SixBtn btnNotPressed',
+ text: '6',
+ time: 0,
+ presetName: 'PRESET_6',
+ templateName: 'text'
+ }),
+
+ /** One button */
+ SevenBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_7',
+ classNames: 'SevenBtn btnNotPressed',
+ text: '7',
+ time: 0,
+ presetName: 'PRESET_7',
+ templateName: 'text'
+ }),
+
+ /** One button */
+ EightBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_8',
+ classNames: 'EightBtn btnNotPressed',
+ text: '8',
+ time: 0,
+ presetName: 'PRESET_8',
+ templateName: 'text'
+ }),
+
+ /** One button */
+ NineBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_9',
+ classNames: 'NineBtn btnNotPressed',
+ text: '9',
+ time: 0,
+ presetName: 'PRESET_9',
+ templateName: 'text'
+ }),
+
+ /** One button */
+ ZiroBtn: SDL.Button.create(SDL.PresetEvents, {
+ elementId: 'PRESET_0',
+ classNames: 'ZiroBtn btnNotPressed',
+ text: '0',
+ time: 0,
+ presetName: 'PRESET_0',
+ templateName: 'text'
+ })
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/statusClimateView.js b/src/components/HMI/app/view/home/statusClimateView.js
new file mode 100644
index 0000000000..01b6dc636b
--- /dev/null
+++ b/src/components/HMI/app/view/home/statusClimateView.js
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StatusClimateView
+ * @desc Climate statusbar visual representation
+ * @category View
+ * @filesource app/view/climate/StatusClimateView.js
+ * @version 1.0
+ */
+
+SDL.StatusClimateView = Em.ContainerView.extend( {
+
+ elementId: 'status_climate',
+
+ classNames: [
+ 'status_bar'
+ ],
+
+ /** Climate components */
+ childViews: [
+ 'statusHome'
+ ],
+
+ /** Label for Home screen */
+ statusHome: SDL.Label.create( {
+ elementId: 'status_climate_label',
+
+ classNames: [
+ 'visible'
+ ],
+
+ content: 'Climate'
+ }),
+
+ /**
+ * Select phone state should be called when user press phone statusbar
+ */
+ actionUp: function(event) {
+
+ SDL.States.goToStates('climate');
+ }
+
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/statusInfoView.js b/src/components/HMI/app/view/home/statusInfoView.js
new file mode 100644
index 0000000000..1241d87c39
--- /dev/null
+++ b/src/components/HMI/app/view/home/statusInfoView.js
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StatusInfoView
+ * @desc Component for Information Status bar
+ * @category view
+ * @filesource app/view/home/statusNavigationView.js
+ * @version 1.0
+ */
+SDL.StatusInfoView = Em.ContainerView.extend( {
+ /** View Id */
+ elementId: 'status_info',
+
+ classNames: [
+ 'status_bar', 'hidden'
+ ],
+
+ classNameBindings: [
+ 'SDL.States.info.active:selected'
+ ],
+
+ /** Navigation components */
+ childViews: [
+ 'statusHome'
+ ],
+
+ /** Label for Home screen */
+ statusHome: SDL.Label.create( {
+ elementId: 'status_info_label',
+ content: 'Information'
+ }),
+
+ actionUp: function(event) {
+
+ SDL.States.goToStates(SDL.InfoController.activeState);
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/statusMediaView.js b/src/components/HMI/app/view/home/statusMediaView.js
new file mode 100644
index 0000000000..bc94c9e22f
--- /dev/null
+++ b/src/components/HMI/app/view/home/statusMediaView.js
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StatusMediaView
+ * @desc Component for Media Status bar
+ * @category view
+ * @filesource app/view/media/StatusMediaView.js
+ * @version 1.0
+ */
+SDL.StatusMediaView = Em.ContainerView
+ .extend( {
+
+ elementId: 'media_status',
+
+ classNameBindings: [
+ 'SDL.States.media.active:selected'
+ ],
+
+ /** Climate components */
+ childViews: [
+ 'statusHome', 'statusInfo'
+ ],
+
+ /** Label for Home screen */
+ statusHome: SDL.Label.extend( {
+ elementId: 'media_status_homestatus',
+ classNameBindings: [
+ 'SDL.States.home.active:visible'
+ ],
+ contentBinding: Ember.Binding
+ .oneWay('SDL.locale.label.view_mediaStatus_entertainment')
+ }),
+
+ statusInfo: Em.ContainerView
+ .extend( {
+ elementId: 'media_status_radio_container',
+
+ childViews: [
+ 'info'
+ ],
+
+ info: Em.View
+ .extend( {
+ elementId: 'media_status_radio_info',
+ controlerBinding: 'SDL.MediaController',
+ /** Bind class for visual representation */
+ classNameBindings: [
+ 'SDL.States.home.active:hidden_display:visible_display'
+ ],
+ /** Define module layout */
+ template: Em.Handlebars
+ .compile('<div class="statusInfo">'
+ + '<div class="station">'
+ + '<span {{bindAttr class="SDL.CDModel.active:visible_display"}}>{{SDL.CDModel.statusBar}}</span>'
+ + // title
+ '<span {{bindAttr class="SDL.SDLModel.limitedExist:visible_display"}}>{{SDL.SDLModel.applicationStatusBar}}</span>'
+ + // SDL
+ '</div>'
+ + '<div class="icon cdIco"'
+ + '{{bindAttr class="SDL.CDModel.active:cdIco"}}'
+ + // CD
+ // icon
+ '{{bindAttr class="SDL.SDLModel.limitedExist:appIco"}}>'
+ + // SDL
+ '</div>' + '</div>')
+ })
+ }),
+ actionUp: function(event) {
+
+ if (SDL.MediaController.activeState.indexOf('media.sdlmedia') >= 0) {
+ SDL.SDLMediaController.activateCurrentApp();
+ } else {
+ SDL.States.goToStates(SDL.MediaController.activeState);
+ }
+ }
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/statusNavigationView.js b/src/components/HMI/app/view/home/statusNavigationView.js
new file mode 100644
index 0000000000..e1d5bac3df
--- /dev/null
+++ b/src/components/HMI/app/view/home/statusNavigationView.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StatusNavigationView
+ * @desc Component for Navigation Status bar
+ * @category view
+ * @filesource app/view/home/statusNavigationView.js
+ * @version 1.0
+ */
+SDL.StatusNavigationView = Em.ContainerView.extend( {
+ /** View Id */
+ elementId: 'status_nav',
+
+ classNames: 'status_bar',
+
+ /** Navigation components */
+ childViews: [
+ 'statusHome'
+ ],
+
+ /** Label for Home screen */
+ statusHome: SDL.Label.create( {
+ elementId: 'navigation_status_label',
+ classNames: 'visible',
+ content: 'Navigation'
+ }),
+
+ /**
+ * Select phone state should be called when user press phone statusbar
+ */
+ actionUp: function(event) {
+
+ SDL.States.goToStates('navigation');
+ }
+
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/statusPhoneView.js b/src/components/HMI/app/view/home/statusPhoneView.js
new file mode 100644
index 0000000000..32fb878608
--- /dev/null
+++ b/src/components/HMI/app/view/home/statusPhoneView.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.StatusPhoneView
+ * @desc Phone statusbar visual representation
+ * @category View
+ * @filesource app/view/phone/StatusPhoneView.js
+ * @version 1.0
+ */
+
+SDL.StatusPhoneView = Em.ContainerView.extend( {
+
+ elementId: 'status_phone',
+
+ classNames: [
+ 'status_bar'
+ ],
+
+ /** Bind class for visual representation */
+ classNameBindings: [
+ 'SDL.States.phone.active:selected'
+ ],
+
+ /** Climate components */
+ childViews: [
+ 'statusHome'
+ ],
+
+ /** Label for Home screen */
+ statusHome: SDL.Label.extend( {
+ elementId: 'status_phone_label',
+
+ classNames: 'visible',
+
+ content: 'Phone'
+ }),
+
+ /**
+ * Select phone state should be called when user press phone statusbar
+ */
+ actionUp: function(event) {
+
+ SDL.States.goToStates('phone.dialpad');
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/home/topControls.js b/src/components/HMI/app/view/home/topControls.js
new file mode 100644
index 0000000000..6eb9323b32
--- /dev/null
+++ b/src/components/HMI/app/view/home/topControls.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.TopControls
+ *
+ * @desc Component for Home top controls
+ *
+ * @category view
+ * @filesource app/view/home/topControls.js
+ * @version 1.0
+ */
+
+SDL.TopControls = Em.ContainerView.extend( {
+
+ elementId: 'app_top_menu_cont',
+
+ childViews: [
+ 'controls'
+ ],
+
+ controls: Em.ContainerView.extend( {
+ elementId: 'top_controls',
+
+ childViews: [
+ 'clock'
+ ],
+
+ clock: Em.View.extend( {
+ elementId: 'clock',
+
+ template: Em.Handlebars
+ .compile('<div id="time_num">1:47 86°</div>')
+
+ })
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/homeView.js b/src/components/HMI/app/view/homeView.js
new file mode 100644
index 0000000000..4663996afc
--- /dev/null
+++ b/src/components/HMI/app/view/homeView.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.HomeView
+ * @desc Home screen visual representation
+ * @category View
+ * @filesource app/view/home/HomeView.js
+ * @version 1.0
+ */
+
+SDL.HomeView = Em.ContainerView.create( {
+
+ classNameBindings: 'SDL.States.home.active:active_state:inactive_state',
+
+ elementId: 'home'
+} );
diff --git a/src/components/HMI/app/view/info/alertsView.js b/src/components/HMI/app/view/info/alertsView.js
new file mode 100644
index 0000000000..6e4e935f58
--- /dev/null
+++ b/src/components/HMI/app/view/info/alertsView.js
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoAlertsView
+ * @desc Info Alerts module visual representation
+ * @category View
+ * @filesource app/view/sinfo/InfoAlertsView.js
+ * @version 1.0
+ */
+
+SDL.InfoAlertsView = Em.ContainerView.create( {
+ /** Bind class for visual representation */
+ classNameBindings: [
+ 'SDL.States.info.alerts.active:active_state:inactive_state'
+ ],
+
+ elementId: 'info_alerts',
+
+ childViews: [
+ 'listCaption', 'mainlist', 'rightlist'
+ ],
+
+ listCaption: SDL.LabelPlusToggleButton.extend( {
+ elementId: 'info_alerts_listCaption',
+ labelContentBinding: 'SDL.locale.label.view_info_alerts_sort',
+ tButtonValue: 0,
+ tButtonRange: 2,
+ tButtonLabelsBinding: 'SDL.locale.label.view_info_alerts_dateIcon',
+ labelDisabled: true,
+ tButtonDisabled: true
+ }),
+
+ mainlist: SDL.List.extend( {
+
+ elementId: 'info_alerts_list',
+
+ itemsOnPage: 6,
+
+ items: [
+ {
+ type: SDL.Label,
+
+ params: {
+ disabled: true
+ }
+ }, {
+ type: SDL.Button,
+ params: {
+ classNames: [
+ 'ember-view ffw-button notpressed list-item disabled active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_alerts_911Assist',
+ templateName: 'rightIcon',
+ icon: 'images/info/ico_emergcyAndEnvelope.png',
+ righticon: 'images/info/ico_arrowLock.png',
+ disabled: true
+ }
+ }
+ ]
+ }),
+
+ rightlist: SDL.List.extend( {
+
+ elementId: 'info_alerts_rightList',
+
+ itemsOnPage: 5,
+
+ disableScrollbar: true,
+
+ items: [
+ {
+ type: SDL.Button,
+ params: {
+ className: 'button',
+ textBinding: 'SDL.locale.label.view_info_alerts_view',
+ disabled: true
+ }
+ }, {
+ type: SDL.Button,
+ params: {
+ className: 'button',
+ textBinding: 'SDL.locale.label.view_info_alerts_delete',
+ disabled: true
+ }
+ }, {
+ type: SDL.Button,
+ params: {
+ className: 'button',
+ textBinding: 'SDL.locale.label.view_info_alerts_deleteAll',
+ disabled: true
+ }
+ }
+ ]
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/info/appsView.js b/src/components/HMI/app/view/info/appsView.js
new file mode 100644
index 0000000000..81d1ce5104
--- /dev/null
+++ b/src/components/HMI/app/view/info/appsView.js
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoAppsview
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/info/AppsView.js
+ * @version 1.0
+ */
+
+SDL.InfoAppsView = Em.ContainerView
+ .create( {
+
+ elementId: 'info_apps',
+
+ classNameBindings: [
+ 'SDL.States.info.apps.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'vehicleHealthReport',
+ 'Asist911',
+ 'installButton',
+ 'findNewApps',
+ 'getDeviceList',
+ 'listOfApplications'
+ ],
+
+ /**
+ * Function to add application to application list
+ */
+ showAppList: function() {
+
+ this.get('listOfApplications.list').removeAllChildren();
+
+ this.listOfApplications.list.refresh();
+
+ var i, apps = SDL.SDLModel.updatedAppsList, btn, appIndex;
+
+ for (i = 0; i < apps.length; i++) {
+
+ btn = {
+ action: 'onActivateSDLApp',
+ target: 'SDL.SDLController',
+ text: apps[i].appName + " - " + apps[i].deviceName,
+ appName: apps[i].appName,
+ appID: apps[i].appID,
+ classNames: 'list-item button',
+ disabled: apps[i].greyOut
+ };
+
+ if (SDL.SDLController.getApplicationModel(apps[i].appID)) {
+ var index = SDL.SDLModel.registeredApps.indexOf(
+ SDL.SDLController.getApplicationModel(apps[i].appID)
+ );
+ btn.iconBinding = 'SDL.SDLModel.registeredApps.' + index + '.appIcon';
+ } else {
+ btn.icon = apps[i].icon ? apps[i].icon : SDL.SDLModel.defaultListOfIcons.app;
+ }
+
+ this.get('listOfApplications.list.childViews').pushObject(SDL.Button.create(btn));
+ }
+
+ },
+
+ vehicleHealthReport: SDL.Button
+ .extend( {
+ goToState: 'vehicle.healthReport',
+ classNames: 'button vehicleHealthReport leftButtons',
+ icon: 'images/info/ico_vehicle.png',
+ textBinding: 'SDL.locale.label.view_info_apps_vehicle_VehicleHealthReport',
+ elementId: 'infoAppsVehicleHealthReport',
+ arrow: true,
+ onDown: false
+ }),
+
+ Asist911: SDL.Button.extend( {
+ goToState: 'help.helpAssist',
+ classNames: 'button Asist911 leftButtons',
+ icon: 'images/info/ico_assist.png',
+ textBinding: 'SDL.locale.label.view_info_apps_911Assist',
+ elementId: 'infoAppsAsist911',
+ arrow: true,
+ onDown: false
+ }),
+
+ installButton: SDL.Button
+ .extend( {
+ goToState: 'settings.system.installApplications',
+ icon: 'images/info/ico_info_install.png',
+ textBinding: 'SDL.locale.label.view_info_apps_vehicle_InstallApplicationsUp',
+ elementId: 'infoAppsInstallButton',
+ classNames: 'button installButton leftButtons',
+ arrow: true,
+ onDown: false
+ }),
+
+ findNewApps: SDL.Button
+ .extend( {
+ goToState: 'settings.system.installApplications',
+ icon: 'images/sdl/new_apps.png',
+ textBinding: 'SDL.locale.label.view_info_apps_vehicle_FindNewApplications',
+ elementId: 'infoAppsFindNewApps',
+ classNames: 'button findNewApps leftButtons',
+ arrow: true,
+ action: 'findNewApps',
+ target: 'SDL.SDLController',
+ onDown: false
+ }),
+
+ getDeviceList: SDL.Button
+ .extend( {
+ icon: 'images/sdl/devices.png',
+ textBinding: 'SDL.locale.label.view_info_apps_vehicle_GetDeviceList',
+ elementId: 'infoAppsGetDeviceList',
+ classNames: 'button getDeviceList leftButtons',
+ arrow: true,
+ action: 'onGetDeviceList',
+ target: 'SDL.SDLController',
+ onDown: false
+ }),
+
+ listOfApplications: SDL.List.extend( {
+
+ elementId: 'info_apps_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: new Array()
+ })
+ });
diff --git a/src/components/HMI/app/view/info/calendarView.js b/src/components/HMI/app/view/info/calendarView.js
new file mode 100644
index 0000000000..235938a90e
--- /dev/null
+++ b/src/components/HMI/app/view/info/calendarView.js
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoCalendarView
+ * @desc Info Calendar module visual representation
+ * @category View
+ * @filesource app/view/sinfo/CalendarView.js
+ * @version 1.0
+ */
+
+SDL.InfoCalendarView = Em.View
+ .create( {
+ /** Bind class for visual representation */
+ classNameBindings: [
+ 'SDL.States.info.calendar.active:active_state:inactive_state'
+ ],
+
+ elementId: 'info_calendar',
+
+ template: Ember.Handlebars
+ .compile('<div class="inner-wrapper">'
+ + '<div class="label-20 disabled date">{{SDL.locale.label.view_info_calendar_date}}</div>'
+ +
+
+ '{{view SDL.Button '
+ + 'class= "today button" '
+ + 'textBinding="SDL.locale.label.view_info_calendar_today" '
+ + 'disabled=true '
+ + '}}'
+ +
+
+ '<div class="day day-1">{{SDL.locale.label.view_info_calendar_day1}}</div>'
+ + '<div class="day day-2">{{SDL.locale.label.view_info_calendar_day2}}</div>'
+ + '<div class="day day-3">{{SDL.locale.label.view_info_calendar_day3}}</div>'
+ + '<div class="day day-4">{{SDL.locale.label.view_info_calendar_day4}}</div>'
+ + '<div class="day day-5">{{SDL.locale.label.view_info_calendar_day5}}</div>'
+ + '<div class="day day-6">{{SDL.locale.label.view_info_calendar_day6}}</div>'
+ + '<div class="day day-7 active">{{SDL.locale.label.view_info_calendar_day7}}</div>'
+ +
+
+ '<div class="c-btn disabled btn-1">1</div>'
+ + '<div class="c-btn disabled btn-8">8</div>'
+ + '<div class="c-btn disabled btn-15">15</div>'
+ + '<div class="c-btn disabled btn-22">22</div>'
+ + '<div class="c-btn disabled btn-29">29</div>' +
+
+ '<div class="c-btn disabled btn-7">7</div>'
+ + '<div class="c-btn disabled btn-14">14</div>'
+ + '<div class="c-btn disabled btn-21">21</div>'
+ + '<div class="c-btn disabled active btn-28">28</div>' +
+
+ '<div class="c-btn disabled btn-6">6</div>'
+ + '<div class="c-btn disabled btn-13">13</div>'
+ + '<div class="c-btn disabled btn-20">20</div>'
+ + '<div class="c-btn disabled btn-27">27</div>' +
+
+ '<div class="c-btn disabled btn-5">5</div>'
+ + '<div class="c-btn disabled btn-12">12</div>'
+ + '<div class="c-btn disabled btn-19">19</div>'
+ + '<div class="c-btn disabled btn-26">26</div>' +
+
+ '<div class="c-btn disabled btn-4">4</div>'
+ + '<div class="c-btn disabled btn-11">11</div>'
+ + '<div class="c-btn disabled btn-18">18</div>'
+ + '<div class="c-btn disabled btn-25">25</div>' +
+
+ '<div class="c-btn disabled btn-3">3</div>'
+ + '<div class="c-btn disabled btn-10">10</div>'
+ + '<div class="c-btn disabled btn-17">17</div>'
+ + '<div class="c-btn disabled btn-24">24</div>'
+ + '<div class="c-btn disabled btn-31">31</div>' +
+
+ '<div class="c-btn disabled btn-2">2</div>'
+ + '<div class="c-btn disabled btn-9">9</div>'
+ + '<div class="c-btn disabled btn-16">16</div>'
+ + '<div class="c-btn disabled btn-23">23</div>'
+ + '<div class="c-btn disabled btn-30">30</div>' +
+
+ '</div>')
+
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/info/devicelistView.js b/src/components/HMI/app/view/info/devicelistView.js
new file mode 100644
index 0000000000..5bd6b8e686
--- /dev/null
+++ b/src/components/HMI/app/view/info/devicelistView.js
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceListView
+ * @desc Media App Options module visual representation
+ * @category View
+ * @filesource app/view/media/devicelistView.js
+ * @version 1.0
+ */
+
+SDL.DeviceListView = Em.ContainerView.create( {
+
+ classNames: [
+ 'info_apps_deviceList_view'
+ ],
+
+ classNameBindings: [
+ 'SDL.States.info.devicelist.active:active_state:inactive_state'
+ ],
+
+ /**
+ * View Id
+ */
+ elementId: 'info_apps_deviceList_view',
+
+ /**
+ * View Components
+ */
+ childViews: [
+ 'backButton',
+ 'listOfDevices',
+ 'deviceListLabel',
+ 'progress'
+ ],
+
+ /**
+ * Animation of search devices progress
+ */
+ progress: Em.View.extend( {
+ classNames: [
+ 'progress'
+ ],
+ classNameBindings: ['SDL.SDLModel.deviceSearchProgress:progress']
+ }),
+
+
+ /**
+ * Button to return to previous view
+ */
+ backButton: SDL.Button.extend( {
+ classNames: [
+ 'backButton', 'button'
+ ],
+ action: 'turnChangeDeviceViewBack',
+ target: 'SDL.SDLController',
+ icon: 'images/media/ico_back.png'
+ }),
+
+ /**
+ * Label in title
+ */
+ deviceListLabel: SDL.Label.extend( {
+
+ elementId: 'deviceListLabel',
+
+ classNames: 'deviceListLabel',
+
+ content: 'Change Devices'
+ }),
+
+ /**
+ * Function calls when notification from RPC comes and creates buttons to
+ * choose devices
+ */
+ ShowDeviceList: function(params) {
+
+ this.clearDeviceList();
+
+ var i, len = params.deviceList.length;
+ for (i = 0; i < len; i++) {
+ this.get('listOfDevices.list.childViews').pushObject(SDL.Button
+ .create( {
+ deviceName: params.deviceList[i].name,
+ icon: params.deviceList[i].icon,
+ text: params.deviceList[i].name,
+ classNames: 'ffw-button notpressed list-item',
+ templateName: params.deviceList[i].icon ? 'rightIcon'
+ : 'text',
+ action: 'onDeviceChoosed',
+ target: 'SDL.SDLController',
+ onDown: false,
+ id: params.deviceList[i].id
+ }));
+ }
+ },
+
+ /**
+ * Function calls each time when user enters Change Device menu and clear
+ * all old data about devices
+ */
+ clearDeviceList: function() {
+
+ this.get('listOfDevices.list').removeAllChildren();
+ this.listOfDevices.rerender();
+ },
+
+ /**
+ * List for option on DeviceListView screen
+ */
+ listOfDevices: SDL.List.extend( {
+
+ elementId: 'info_apps_deviceList_list',
+
+ itemsOnPage: 5,
+
+ /** Items array */
+ items: []
+ })
+});
diff --git a/src/components/HMI/app/view/info/nonMediaView.js b/src/components/HMI/app/view/info/nonMediaView.js
new file mode 100644
index 0000000000..12dd8a654e
--- /dev/null
+++ b/src/components/HMI/app/view/info/nonMediaView.js
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoNonMedia
+ * @desc NonMedia application visual representation
+ * @category View
+ * @filesource app/view/info/nonMedia.js
+ * @version 1.0
+ */
+
+SDL.InfoNonMedia = Em.ContainerView
+ .create( {
+
+ elementId: 'info_nonMedia',
+
+ controller: SDL.SDLAppController,
+
+ childViews: [
+ 'content'
+ ],
+
+ classNameBindings: [
+ 'this.activeState:active_state:inactive_state'
+ ],
+
+ activeState: function(){
+ if (SDL.TurnByTurnView.activeTBT) {
+ return false;
+ } else if (SDL.States.info.nonMedia.active) {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.States.info.nonMedia.active', 'SDL.TurnByTurnView.activeTBT'),
+
+ content: Em.ContainerView
+ .extend( {
+ classNames: [
+ 'inner_content'
+ ],
+
+ childViews: [
+ 'deviceName', 'image', 'fields', 'innerMenu', 'presets'
+ ],
+
+ /**
+ * Deactivate View
+ */
+ deactivate: function() {
+
+ SDL.States.goToStates('info.apps');
+ },
+
+ deviceName: SDL.Label.extend( {
+
+ classNames: [
+ 'app_title'
+ ],
+
+ contentBinding: 'SDL.SDLAppController.model.deviceName'
+ }),
+
+ image: Em.View
+ .extend( {
+
+ classNames: [
+ 'app_image'
+ ],
+
+ template: Ember.Handlebars
+ .compile('<img width="150px" {{bindAttr src="SDL.SDLAppController.model.appInfo.mainImage"}}>')
+ }),
+
+ fields: Em.ContainerView.extend( {
+
+ classNames: [
+ 'app_fields'
+ ],
+
+ childViews: [
+ 'field1', 'field2', 'field3', 'field4'
+ ],
+
+ field1: SDL.Label.extend( {
+ contentBinding: 'controller.model.appInfo.field1',
+ attributeBindings: ["style"],
+ style: function(){
+ if (SDL.SDLAppController.model) {
+ return SDL.SDLAppController.model.appInfo.alignment;
+ } else {
+ return null;
+ }
+ }.property("SDL.SDLAppController.model.appInfo.alignment")
+ }),
+
+ field2: SDL.Label.extend( {
+ contentBinding: 'controller.model.appInfo.field2',
+ attributeBindings: ["style"],
+ style: function(){
+ if (SDL.SDLAppController.model) {
+ return SDL.SDLAppController.model.appInfo.alignment;
+ } else {
+ return null;
+ }
+ }.property("SDL.SDLAppController.model.appInfo.alignment")
+ }),
+
+ field3: SDL.Label.extend( {
+ contentBinding: 'controller.model.appInfo.field3'
+ }),
+
+ field4: SDL.Label.extend( {
+ contentBinding: 'controller.model.appInfo.field4'
+ })
+
+ }),
+
+ innerMenu: SDL.MenuList
+ .extend( {
+
+ refreshItems: function() {
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.appID == SDL.NonMediaController.currentAppId) {
+ this
+ .addItems(SDL.SDLAppController.model.softButtons,
+ SDL.SDLAppController.model.appID);
+ }
+ }
+ .observes('SDL.SDLAppController.model.softButtons.@each'),
+
+ groupName: "NonMediaView",
+
+ content: Em.ContainerView.extend( {
+
+ classNames: [
+ 'content'
+ ],
+
+ attributeBindings: [
+ 'parentView.contentPositon:style'
+ ],
+
+ childViews: [
+ 'optionsButton'
+ ],
+
+ optionsButton: SDL.Button.extend( {
+ text: 'Options',
+
+ templateName: 'arrow',
+
+ action: 'openCommandsList',
+ target: 'SDL.SDLAppController'
+ })
+ })
+ }),
+
+ presets: Em.ContainerView
+ .extend( {
+ classNames: [
+ 'presets'
+ ],
+
+ classNameBindings: [
+ 'hidden'
+ ],
+
+ hidden: function() {
+
+ if (SDL.SDLAppController.model) { return !Boolean(SDL.SDLAppController.model
+ .get('appInfo.customPresets').length); }
+
+ }
+ .property('SDL.SDLAppController.model.appInfo.customPresets.@each'),
+
+ childViews: [
+ 'perset1',
+ 'perset2',
+ 'perset3',
+ 'perset4',
+ 'perset5',
+ 'perset6',
+ 'perset7',
+ 'perset8',
+ 'perset9',
+ 'perset10'
+ ],
+
+ perset1: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.0',
+ presetName: 'PRESET_0',
+ templateName: 'text'
+ }),
+ perset2: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.1',
+ presetName: 'PRESET_1',
+ templateName: 'text'
+ }),
+ perset3: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.2',
+ presetName: 'PRESET_2',
+ templateName: 'text'
+ }),
+ perset4: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.3',
+ presetName: 'PRESET_3',
+ templateName: 'text'
+ }),
+ perset5: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.4',
+ presetName: 'PRESET_4',
+ templateName: 'text'
+ }),
+ perset6: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.5',
+ presetName: 'PRESET_5',
+ templateName: 'text'
+ }),
+ perset7: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.6',
+ presetName: 'PRESET_6',
+ templateName: 'text'
+ }),
+ perset8: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.7',
+ presetName: 'PRESET_7',
+ templateName: 'text'
+ }),
+ perset9: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.8',
+ presetName: 'PRESET_8',
+ templateName: 'text'
+ }),
+ perset10: SDL.Button.extend(SDL.PresetEvents, {
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.9',
+ presetName: 'PRESET_9',
+ templateName: 'text'
+ })
+ })
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/info/servicesView.js b/src/components/HMI/app/view/info/servicesView.js
new file mode 100644
index 0000000000..f4bac6d0ee
--- /dev/null
+++ b/src/components/HMI/app/view/info/servicesView.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.ServicesView
+ * @desc Info Services module visual representation
+ * @category Info
+ * @filesource app/view/ServicesView.js
+ * @version 1.0
+ */
+
+SDL.InfoServicesView = Em.View
+ .create( {
+
+ elementId: 'info_services_view',
+
+ classNameBindings: [
+ 'SDL.States.info.services.active:active_state:inactive_state'
+ ],
+
+ /** Define module template */
+ template: Ember.Handlebars
+ .compile('<div class="inner-content">'
+ + '<div id="info_sync_services" class="info-text">{{SDL.locale.label.view_info_services_syncServices}}</div>'
+ + '<div id="info_traff" class="info-text">{{SDL.locale.label.view_info_services_trafficDirectionsAndInformation}}</div>'
+ + '<div id="info_traffic_report" class="info-text">{{SDL.locale.label.view_info_services_getTheLatestTrafficRreport}}</div>'
+ + '<div id="info_traffic_pts" class="info-text">{{SDL.locale.label.view_info_services_findBusinessesAndDownloadSaved}}<br>{{SDL.locale.label.view_info_services_Pts}}</div>'
+ + '<div id="info_traffic_hear" class="info-text">{{SDL.locale.label.view_info_services_hearPersonalizedInformationMore}}</div>'
+ + '<div id="info_connect" class="info-text">{{SDL.locale.label.view_info_services_connecttoServices}}</div>'
+ + '<div id="info_log" class="info-text">{{SDL.locale.label.view_info_services_toActivate}}</div>'
+ + '</div>')
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/info/travelLinkView.js b/src/components/HMI/app/view/info/travelLinkView.js
new file mode 100644
index 0000000000..2bf6b90a95
--- /dev/null
+++ b/src/components/HMI/app/view/info/travelLinkView.js
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoTravelLinkView
+ * @desc Info Travel Link Help module visual representation
+ * @category View
+ * @filesource app/view/settings/InfoTravelLinkView.js
+ * @version 1.0
+ */
+
+SDL.InfoTravelLinkView = Em.ContainerView
+ .create( {
+
+ classNameBindings: [
+ 'SDL.States.info.travelLink.active:active_state:inactive_state'
+ ],
+
+ elementId: 'info_travelLink',
+
+ childViews: [
+ 'imageLogo', 'listLeft', 'listRight',
+ ],
+
+ imageLogo: SDL.Label.extend( {
+ elementId: 'info_travelLink_logo',
+ icon: 'images/info/info_travelLink_sirius_logo.png',
+ templateName: 'icon'
+ }),
+
+ listLeft: SDL.List
+ .extend( {
+ elementId: 'info_travelLink_listLeft',
+
+ disableScrollbar: true,
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: [
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_trafficOnRoute',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_trafficNearby',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_fuelPrices',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_movieListings',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ ]
+ }),
+
+ listRight: SDL.List
+ .extend( {
+ elementId: 'info_travelLink_listRight',
+
+ disableScrollbar: true,
+
+ /** Items */
+ items: [
+ {
+
+ type: SDL.Button,
+
+ params: {
+
+ textBinding: 'SDL.locale.label.view_info_travelLink_subscriptionInfo',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_weather',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_sportsInfo',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ },
+ {
+
+ type: SDL.Button,
+
+ params: {
+ textBinding: 'SDL.locale.label.view_info_travelLink_skiConditions',
+ templateName: 'arrow',
+ disabled: true
+ }
+
+ }
+ ]
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/infoView.js b/src/components/HMI/app/view/infoView.js
new file mode 100644
index 0000000000..397553d9fa
--- /dev/null
+++ b/src/components/HMI/app/view/infoView.js
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InfoView
+ * @desc Info module visual representation
+ * @category Info
+ * @filesource app/view/InfoView.js
+ * @version 1.0
+ */
+
+SDL.InfoView = Em.ContainerView.create( {
+
+ elementId: 'info_view',
+
+ /** Bind class for visual representation */
+ classNameBindings:
+ [
+ 'SDL.States.info.active:active_state:inactive_state'
+ ],
+
+ controllerBinding: Ember.Binding.oneWay( 'SDL.InfoController' ),
+
+ /** Settings components */
+ childViews:
+ [
+ 'leftMenu',
+ SDL.InfoServicesView,
+ SDL.InfoTravelLinkView,
+ SDL.InfoCalendarView,
+ SDL.InfoAppsView,
+ SDL.InfoNonMedia,
+ SDL.DeviceListView
+ ],
+
+ /** Left menu */
+ leftMenu: Em.ContainerView.extend( {
+ elementId: 'info_leftMenu',
+
+ classNameBindings:
+ [
+ 'parentView.controller.hiddenLeftMenu:hidden'
+ ],
+
+ classNames: 'menu-items',
+
+ childViews:
+ [
+ 'border',
+ 'items'
+ ],
+
+ border: Em.View.extend( {
+ classNames: 'ls_border'
+ } ),
+
+ items: Em.ContainerView.extend( {
+ classNames: 'ls-items',
+
+ childViews:
+ [
+ 'servicesButton',
+ 'travelLinkButton',
+ 'calendarButton',
+ 'appsButton',
+ 'sdlButton',
+ 'goToCD'
+ ],
+
+ servicesButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_services',
+ goToState: 'services',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.services.active:info_active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_leftmenu_services',
+ icon: 'images/info/info_leftMenu_services_ico.png',
+ action: 'onState',
+ target: 'SDL.InfoController'
+ } ),
+
+ travelLinkButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_travelLink',
+ goToState: 'travelLink',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.travelLink.active:info_active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_leftmenu_travelLink',
+ icon: 'images/info/info_leftMenu_travelLink_ico.png',
+ action: 'onState',
+ target: 'SDL.InfoController'
+ } ),
+
+ alertsButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_alerts',
+ goToState: 'alerts',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.alerts.active:info_active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_leftmenu_alerts',
+ icon: 'images/info/info_leftMenu_alerts_ico.png',
+ action: 'onState',
+ target: 'SDL.InfoController'
+ } ),
+
+ calendarButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_calendar',
+ goToState: 'calendar',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.calendar.active:info_active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_leftmenu_calendar',
+ icon: 'images/info/info_leftMenu_calendar_ico.png',
+ action: 'onState',
+ target: 'SDL.InfoController'
+ } ),
+
+ appsButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_apps',
+ goToState: 'apps',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.apps.active:info_active'
+ ],
+ textBinding: 'SDL.locale.label.view_info_leftmenu_apps',
+ icon: 'images/info/info_leftMenu_apps_ico.png',
+ action: 'onState',
+ target: 'SDL.InfoController'
+ } ),
+
+ sdlButton: SDL.Button.extend( {
+ elementId: 'info_leftMenu_sdl',
+ goToState: 'nonMedia',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.info.nonMedia.active:info_active'
+ ],
+ hidden: function() {
+ return !SDL.NonMediaController.currentAppId;
+ }.property( 'SDL.NonMediaController.currentAppId' ),
+ textBinding: 'SDL.NonMediaController.currentAppName',
+ iconBinding: 'SDL.NonMediaController.currentAppIcon',
+ action: 'activateCurrentApp',
+ target: 'SDL.NonMediaController'
+ } ),
+
+ goToCD: SDL.Button.extend( {
+ elementId: 'info_leftMenu_goToCD',
+ classNames: 'menu-item lsp1_p',
+ text: 'Go To CD',
+ action: 'turnOnCD',
+ icon: 'images/media/ico_cd.png',
+ target: 'SDL.MediaController'
+ } )
+ } )
+ } )
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/media/common/LeftMenuView.js b/src/components/HMI/app/view/media/common/LeftMenuView.js
new file mode 100644
index 0000000000..ba4495681f
--- /dev/null
+++ b/src/components/HMI/app/view/media/common/LeftMenuView.js
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.LeftMenuView
+ * @desc Media Left Menu module visual representation
+ * @category View
+ * @filesource app/view/media/SiriusView.js
+ * @version 1.0
+ */
+
+SDL.LeftMenuView = Em.ContainerView.extend( {
+ /** View ID */
+ elementId: 'media_leftmenu',
+
+ /** View components */
+ childViews:
+ [
+ 'border',
+ 'cdButton',
+ 'sdlButton'
+ ],
+ /** Border decoration */
+ border: Em.View.extend( {
+ elementId: 'media_left_menu_border',
+ classNames: 'ls_border'
+ } ),
+
+ /** CD Station Button */
+ cdButton: SDL.Button.extend( {
+ classNameBindings:
+ [
+ 'SDL.CDModel.active:active_state'
+ ],
+ elementId: 'media_cdButton',
+ classNames: 'media-ls-item',
+ action: 'turnOnCD',
+ icon: 'images/media/ico_cd.png',
+ target: 'SDL.MediaController',
+ textBinding: Ember.Binding.oneWay( 'SDL.locale.label.view_media_cd' )
+ } ),
+ /** SDL Button */
+ sdlButton: SDL.Button.extend( {
+ classNameBindings:
+ [
+ 'SDL.States.media.sdlmedia.active:active_state'
+ ],
+ elementId: 'media_sdlButton',
+ classNames: 'media-ls-item',
+ hidden: function() {
+ return !SDL.SDLMediaController.currentAppId;
+ }.property( 'SDL.SDLMediaController.currentAppId' ),
+ textBinding: 'SDL.SDLMediaController.currentAppName',
+ iconBinding: 'SDL.SDLMediaController.currentAppIcon',
+ action: 'activateCurrentApp',
+ target: 'SDL.SDLMediaController'
+ } )
+
+} );
diff --git a/src/components/HMI/app/view/media/playerView.js b/src/components/HMI/app/view/media/playerView.js
new file mode 100644
index 0000000000..406a6dba46
--- /dev/null
+++ b/src/components/HMI/app/view/media/playerView.js
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.MediaPlayerView
+ * @desc Media Player module visual representation
+ * @category View
+ * @filesource app/view/media/common/MediaPalyerView.js
+ * @version 1.0
+ */
+SDL.playerView = Em.View.create( {
+
+ elementId: 'media_player_view_container',
+
+ classNameBindings:
+ [
+ 'SDL.States.media.player.active:active_state:inactive_state'
+ ]
+
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/media/sdl/controllsView.js b/src/components/HMI/app/view/media/sdl/controllsView.js
new file mode 100644
index 0000000000..8e73f0ba0e
--- /dev/null
+++ b/src/components/HMI/app/view/media/sdl/controllsView.js
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLMediaControlls
+ * @desc SDLMediaControlls visual representation
+ * @category View
+ * @filesource app/view/media/sdl/controllsView.js
+ * @version 1.0
+ */
+
+SDL.SDLMediaControlls = Em.ContainerView.create( {
+
+ childViews:
+ [
+ 'info',
+ 'Controls',
+ 'tuneButtons'
+ ],
+
+ /**
+ * Verification paramiter
+ */
+ sdlMediaControlls: "V2",
+
+ info: Em.View.extend( {
+
+ elementId: 'app_view_info',
+
+ template: Em.Handlebars
+ .compile('{{#with view}}'
+ + '<div class="track-info">'
+ + '<div class="device">{{SDL.SDLAppController.model.deviceName}}</div>'
+ + '<div class="divider_o"></div>'
+ + '<div class="title textLimit" {{bindAttr style="SDL.SDLAppController.model.appInfo.alignment"}}>{{SDL.SDLAppController.model.appInfo.field1}}</div>'
+ + '<div class="album textLimit" {{bindAttr style="SDL.SDLAppController.model.appInfo.alignment"}}>{{SDL.SDLAppController.model.appInfo.field2}}</div>'
+ + '<div class="artist textLimit"{{bindAttr class="SDL.SDLAppController.model.mediaPreset:hidden"}}>{{SDL.SDLAppController.model.appInfo.field3}}</div>'
+ + '<div class="time"{{bindAttr class="SDL.SDLAppController.model.mediaPreset:timeV2"}}>{{SDL.SDLAppController.model.appInfo.mediaClock}}</div>'
+ + '<img class="cd_logo" {{bindAttr src="SDL.SDLAppController.model.appInfo.trackIcon" class="SDL.SDLAppController.model.mediaPreset:cd_logoV2"}} />'
+ + '</div>' + '{{/with}}')
+ }),
+
+ Controls: Em.ContainerView.create( {
+
+ elementId: 'app_view_controlls',
+
+ /** View components */
+ childViews:
+ [
+ 'PrevTrackButton',
+ 'PlayButton',
+ 'NextTrackButton'
+ ],
+
+ classNames: 'player_controlls',
+
+ classNameBindings: 'SDL.SDLAppController.model.mediaPreset:player_controllsV2',
+
+ PrevTrackButton: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'app_view_controlls_prev_track_button_v2',
+ classNames:
+ [
+ 'bc-item-big',
+ 'prevcd'
+ ],
+ icon: 'images/media/ico_prew.png',
+ presetName: 'SEEKLEFT'
+ } ),
+
+ PlayButton: SDL.Button.extend( {
+ elementId: 'app_view_controlls_play_button_v2',
+ classNames:
+ [
+ 'bc-item-big',
+ 'playcd'
+ ],
+ presetName: 'OK',
+ actionUp: function() {
+ SDL.SDLController.onSoftButtonOkActionUp( this.presetName );
+ },
+ actionDown: function() {
+ SDL.SDLController.onSoftButtonOkActionDown( this.presetName );
+ },
+ /**
+ * Define button
+ * template
+ */
+ template: Ember.Handlebars
+ .compile( '<img class="playIcon" {{bindAttr class="SDL.SDLAppController.model.isPlaying:visible:not-visible"}} src="images/media/ico_pause.png" />'
+ + '<img class="playIcon not-visible" {{bindAttr class="SDL.SDLAppController.model.isPlaying:not-visible:visible"}} src="images/media/ico-play.png" />' )
+ } ),
+ NextTrackButton: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'app_view_controlls_next_track_button_v2',
+ classNames:
+ [
+ 'bc-item-big',
+ 'nextcd'
+ ],
+ icon: 'images/media/ico_next.png',
+ presetName: 'SEEKRIGHT'
+ } )
+ } ),
+
+ tuneButtons: Em.ContainerView.create( {
+
+ elementId: 'sdl_media_presetButtons',
+
+ classNameBindings:
+ [
+ 'SDL.SDLAppController.model.mediaPreset::hidden'
+ ],
+
+ classNames:
+ [
+ 'main-preset-buttons-wraper'
+ ],
+
+ childViews:
+ [
+ 'wrapper'
+ ],
+
+ wrapper: Em.ContainerView.extend( {
+
+ elementId: 'sdl_media_presetButtons_wrapper',
+
+ classNames: 'preset-items',
+
+ childViews:
+ [
+ '1',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '10'
+ ],
+
+ 1: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button1',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.0',
+ templateName: 'text',
+ presetName: 'PRESET_0'
+ } ),
+ 2: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button2',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.1',
+ templateName: 'text',
+ presetName: 'PRESET_1'
+ } ),
+ 3: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button3',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.2',
+ templateName: 'text',
+ presetName: 'PRESET_2'
+ } ),
+ 4: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button4',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.3',
+ templateName: 'text',
+ presetName: 'PRESET_3'
+ } ),
+ 5: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button5',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.4',
+ templateName: 'text',
+ presetName: 'PRESET_4'
+ } ),
+ 6: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button6',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.5',
+ templateName: 'text',
+ presetName: 'PRESET_5'
+ } ),
+ 7: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button7',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.6',
+ templateName: 'text',
+ presetName: 'PRESET_6'
+ } ),
+ 8: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button8',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.7',
+ templateName: 'text',
+ presetName: 'PRESET_7'
+ } ),
+ 9: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button9',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.8',
+ templateName: 'text',
+ presetName: 'PRESET_8'
+ } ),
+ 10: SDL.Button.extend( SDL.PresetEvents, {
+ elementId: 'sdl_media_preset_button10',
+ classNames: 'preset-item',
+ textBinding: 'SDL.SDLAppController.model.appInfo.customPresets.9',
+ templateName: 'text',
+ presetName: 'PRESET_9'
+ } )
+ } )
+ } )
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/media/sdlmediaView.js b/src/components/HMI/app/view/media/sdlmediaView.js
new file mode 100644
index 0000000000..78371e7ea7
--- /dev/null
+++ b/src/components/HMI/app/view/media/sdlmediaView.js
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.sdlView
+ * @desc SDL Media application module visual representation
+ * @category View
+ * @filesource app/view/media/sdlView.js
+ * @version 1.0
+ */
+SDL.sdlView = Em.ContainerView
+ .create( {
+
+ /**
+ * View Id
+ */
+ elementId: 'sdl_view_container',
+
+ classNameBindings: [
+ 'this.activeState:active_state:inactive_state'
+ ],
+
+ activeState: function(){
+ if (SDL.TurnByTurnView.activeTBT) {
+ return false;
+ } else if (SDL.States.media.sdlmedia.active) {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.States.media.sdlmedia.active', 'SDL.TurnByTurnView.activeTBT'),
+
+ /**
+ * View Components
+ */
+ childViews: [
+ 'innerMenu',
+ 'controlls'
+ ],
+
+ controlls: SDL.SDLMediaControlls,
+
+ /**
+ * Deactivate View
+ */
+ deactivate: function() {
+
+ SDL.States.goToStates('info.apps');
+ },
+
+ innerMenu: SDL.MenuList
+ .extend( {
+
+ refreshItems: function() {
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.appID == SDL.SDLMediaController.currentAppId) {
+ this.addItems(SDL.SDLAppController.model.softButtons,
+ SDL.SDLAppController.model.appID);
+ }
+ }.observes('SDL.SDLAppController.model.softButtons.@each'),
+
+ groupName: "MediaView",
+
+ content: Em.ContainerView.extend( {
+
+ classNames: [
+ 'content'
+ ],
+
+ attributeBindings: [
+ 'parentView.contentPositon:style'
+ ],
+
+ childViews: [
+ 'optionsButton'
+ ],
+
+ optionsButton: SDL.Button.extend( {
+ text: 'Options',
+
+ templateName: 'arrow',
+
+ action: 'openCommandsList',
+ target: 'SDL.SDLAppController'
+ })
+ })
+ })
+ }); \ No newline at end of file
diff --git a/src/components/HMI/app/view/mediaView.js b/src/components/HMI/app/view/mediaView.js
new file mode 100644
index 0000000000..647b593065
--- /dev/null
+++ b/src/components/HMI/app/view/mediaView.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.MediaView
+ * @desc Media module visual representation
+ * @category View
+ * @filesource app/view/media/MediaView.js
+ * @version 1.0
+ */
+SDL.MediaView = Em.ContainerView.create( {
+ /** View Id */
+ elementId: 'media',
+
+ classNameBindings: 'SDL.States.media.active:active_state:inactive_state',
+
+ /** Media components */
+ childViews:
+ [
+ 'leftMenu',
+ SDL.playerView,
+ SDL.sdlView
+ ],
+ /** Left Menu view component */
+ leftMenu: SDL.LeftMenuView
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/navigationApp/baseNavigationView.js b/src/components/HMI/app/view/navigationApp/baseNavigationView.js
new file mode 100644
index 0000000000..1b373b615a
--- /dev/null
+++ b/src/components/HMI/app/view/navigationApp/baseNavigationView.js
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.BaseNavigationView
+ * @desc Navigation component base screen
+ * @category View
+ * @filesource app/view/navigationApp/baseNavigationView.js
+ * @version 1.0
+ */
+SDL.BaseNavigationView = Em.ContainerView.create({
+ /** View Id */
+ elementId: 'baseNavigation',
+
+ classNameBindings: [
+ 'SDL.States.navigationApp.baseNavigation.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'mainField1',
+ 'mainField2',
+ 'mainField3',
+ 'mainField4',
+ 'mainField5',
+ 'mainField6',
+ 'optionsBtn'
+ ],
+
+ mainField1: null,
+ mainField2: null,
+ mainField3: null,
+ mainField4: null,
+ mainField5: null,
+ mainField6: null,
+
+ update: function(){
+
+ var naviParams = SDL.SDLModel.constantTBTParams;
+
+ if (naviParams) {
+
+ for ( var i = 0; i < naviParams.navigationTexts.length; i++) {
+ switch (naviParams.navigationTexts[i].fieldName) {
+ case 'navigationText1': {
+ this.set('mainField1',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'navigationText2': {
+ this.set('mainField2',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'ETA': {
+ this.set('mainField4', naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'totalDistance': {
+ this.set('mainField5',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'navigationText': {
+ this.set('mainField6',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'timeToDestination': {
+ this.set('mainField3',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ default :{
+ break;
+ }
+ }
+ }
+
+ if (naviParams.softButtons) {
+ for ( var i = 0; i < naviParams.softButtons.length; i++) {
+ this.get('childViews').pushObject(SDL.Button.create(SDL.PresetEventsCustom, {
+ text: naviParams.softButtons[i].text,
+ icon: naviParams.softButtons[i].image ? naviParams.softButtons[i].image.value : "",
+ templateName: naviParams.softButtons[i].image ? 'rightText' : 'text',
+ groupName: "NaviBase",
+ classNameBindings: ['isHighlighted:isHighlighted'],
+ isHighlighted: naviParams.softButtons[i].isHighlighted ? true : false,
+ softButtonID: naviParams.softButtons[i].softButtonID,
+ systemAction: naviParams.softButtons[i].systemAction,
+ classNames: 'navButton softButton softButton' + (i + 1),
+ appID: SDL.SDLAppController.model.appID
+ }));
+ }
+ }
+ }
+ },
+
+ mainField1: SDL.Label.extend({
+
+ classNames: 'mainField1 mainField',
+
+ contentBinding: 'SDL.SDLAppController.model.appInfo.field1'
+ }),
+
+ mainField2: SDL.Label.extend({
+
+ classNames: 'mainField2 mainField',
+
+ contentBinding: 'SDL.SDLAppController.model.appInfo.field2'
+ }),
+
+ mainField3: SDL.Label.extend({
+
+ classNames: 'mainField3 mainField',
+
+ contentBinding: 'SDL.SDLAppController.model.appInfo.field3'
+ }),
+
+ mainField4: SDL.Label.extend({
+
+ classNames: 'mainField4 mainField',
+
+ contentBinding: 'SDL.SDLAppController.model.appInfo.field4'
+ }),
+
+ mainField5: SDL.Label.extend({
+
+ classNames: 'mainField5 mainField',
+
+ contentBinding: 'parentView.mainField5'
+ }),
+
+ mainField6: SDL.Label.extend({
+
+ classNames: 'mainField6 mainField',
+
+ contentBinding: 'parentView.mainField6'
+ }),
+
+ optionsBtn: SDL.Button.extend({
+ classNames: 'naviOptionsBtn navButton',
+ text : "Options",
+ action: 'openCommandsList',
+ target: 'SDL.SDLAppController'
+ })
+
+});
diff --git a/src/components/HMI/app/view/navigationAppView.js b/src/components/HMI/app/view/navigationAppView.js
new file mode 100644
index 0000000000..29a69e1904
--- /dev/null
+++ b/src/components/HMI/app/view/navigationAppView.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.NavigationAppView
+ * @desc Navigation component
+ * @category View
+ * @filesource app/view/navigationAppView.js
+ * @version 1.0
+ */
+SDL.NavigationAppView = Em.ContainerView.create( {
+ /** View Id */
+ elementId: 'NavigationAppView',
+
+ classNameBindings: [
+ 'this.activeState:active_state:inactive_state'
+ ],
+
+ activeState: function(){
+ if (SDL.TurnByTurnView.activeTBT) {
+ return false;
+ } else if (SDL.States.navigationApp.active) {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.States.navigationApp.active', 'SDL.TurnByTurnView.activeTBT'),
+
+ childViews: [
+ 'videoView',
+ SDL.BaseNavigationView
+ ],
+
+ actionMove:function(event){
+
+ SDL.SDLModel.onTouchEvent(event);
+ },
+
+ actionUp:function(event){
+
+ SDL.SDLModel.onTouchEvent(event);
+ },
+
+ actionDown:function(event){
+
+ SDL.SDLModel.onTouchEvent(event);
+ },
+
+ videoView: Ember.View.create({
+ templateName: "video",
+ template: Ember.Handlebars.compile('<video id="html5Player"></video>')
+ })
+
+});
diff --git a/src/components/HMI/app/view/navigationView.js b/src/components/HMI/app/view/navigationView.js
new file mode 100644
index 0000000000..787da23310
--- /dev/null
+++ b/src/components/HMI/app/view/navigationView.js
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.NavigationView
+ * @desc Navigation component
+ * @category View
+ * @filesource app/view/navigationView.js
+ * @version 1.0
+ */
+SDL.NavigationView = Em.ContainerView.create( {
+ /** View Id */
+ elementId: 'navigationView',
+
+ classNameBindings: [
+ 'SDL.States.navigation.active:active_state:inactive_state'
+ ],
+
+ childViews:
+ [
+ 'windowText'
+ ],
+
+ windowText: SDL.Label.extend( {
+
+ classNames: 'windowText',
+
+ content: 'Navigation'
+ } )
+
+});
diff --git a/src/components/HMI/app/view/phone/dialpadView.js b/src/components/HMI/app/view/phone/dialpadView.js
new file mode 100644
index 0000000000..06b535bda4
--- /dev/null
+++ b/src/components/HMI/app/view/phone/dialpadView.js
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DialpadPhoneView
+ * @desc Phone Dialpad module visual representation
+ * @category View
+ * @filesource app/view/phone/DialpadView.js
+ * @version 1.0
+ */
+
+SDL.DialpadPhoneView = Em.ContainerView.create( {
+
+ elementId: 'phone_dialpad',
+
+ classNameBindings: 'SDL.States.phone.dialpad.active:active_state:inactive_state',
+
+ childViews:
+ [
+ 'number',
+ 'keypad',
+ 'deleteButton',
+ 'dialButton',
+ 'endButton'
+ ],
+
+ /** Number area */
+ number: SDL.Label.extend( {
+ elementId: 'phone_dialpad_number',
+
+ contentBinding: Em.Binding.oneWay( 'SDL.PhoneController.model.dialpadNumber' )
+ } ),
+
+ /** Keypad block */
+ keypad: Em.ContainerView.extend( {
+ elementId: 'phone_dialpad_keypad',
+
+ childViews:
+ [
+ 'key1',
+ 'key2',
+ 'key3',
+ 'key4',
+ 'key5',
+ 'key6',
+ 'key7',
+ 'key8',
+ 'key9',
+ 'key0',
+ 'keyStar',
+ 'keyDiez'
+ ],
+
+ key1: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key1',
+
+ classNames: 'left',
+
+ text: '1',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key2: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key2',
+
+ classNames: 'center',
+
+ text: '2',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key3: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key3',
+
+ classNames: 'right',
+
+ text: '3',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key4: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key4',
+
+ classNames: 'left',
+
+ text: '4',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key5: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key5',
+
+ classNames: 'center',
+
+ text: '5',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key6: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key6',
+
+ classNames: 'right',
+
+ text: '6',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key7: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key7',
+
+ classNames: 'left',
+
+ text: '7',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key8: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key8',
+
+ classNames: 'center',
+
+ text: '8',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key9: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key9',
+
+ classNames: 'right',
+
+ text: '9',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ key0: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_key0',
+
+ classNames: 'center',
+
+ text: '0',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ keyStar: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_keyStar',
+
+ classNames: 'left',
+
+ text: '*',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } ),
+
+ keyDiez: SDL.Button.extend( {
+ elementId: 'phone_dialpad_keypad_keyDiez',
+
+ classNames: 'right',
+
+ text: '#',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
+ } )
+ } ),
+
+ deleteButton: SDL.Button.extend( {
+ elementId: 'phone_dialpad_deleteButton',
+
+ classNameBindings:
+ [
+ 'SDL.PhoneController.model.dialpadNumber.length:show'
+ ],
+
+ icon: 'images/phone/del.png',
+
+ action: 'onDelete',
+ target: 'SDL.PhoneController',
+
+ disabledBinding: Em.Binding.oneWay( 'SDL.PhoneController.model.onCall' )
+ } ),
+
+ dialButton: SDL.Button.extend( {
+ elementId: 'phone_dialpad_dialButton',
+
+ textBinding: Em.Binding.oneWay( 'SDL.locale.label.view_phone_dial' ),
+ icon: 'images/phone/dial.png',
+
+ action: 'onDialCall',
+ target: 'SDL.PhoneController',
+
+ disabledBinding: Em.Binding.oneWay( 'SDL.PhoneController.model.onCall' )
+ } ),
+
+ endButton: SDL.Button.extend( {
+ elementId: 'phone_dialpad_endButton',
+
+ textBinding: Em.Binding.oneWay( 'SDL.locale.label.view_phone_end' ),
+ icon: 'images/phone/end.png',
+
+ action: 'onEndCall',
+ target: 'SDL.PhoneController',
+
+ disabledBinding: Em.Binding.oneWay( 'SDL.PhoneController.model.readyForCall' )
+ } )
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/phoneView.js b/src/components/HMI/app/view/phoneView.js
new file mode 100644
index 0000000000..ec3413eb72
--- /dev/null
+++ b/src/components/HMI/app/view/phoneView.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PhoneView
+ * @desc Phone module visual representation
+ * @category View
+ * @filesource app/view/phone/PhoneView.js
+ * @version 1.0
+ */
+
+SDL.PhoneView = Em.ContainerView.create( {
+
+ elementId: 'phone',
+
+ /** Bind class for visual representation */
+ classNameBindings: [
+ 'SDL.States.phone.active:active_state:inactive_state'
+ ],
+
+ /** Initial phone components */
+ childViews: [
+ 'menu', SDL.DialpadPhoneView
+ ],
+
+ /** Left menu */
+ menu: Em.ContainerView.extend( {
+ elementId: 'phone_menu',
+
+ // classNameBindings: ['SDL.PhoneController.hideMenu:hide'],
+
+ childViews: [
+ 'border', 'items'
+ ],
+
+ border: Em.View.extend( {
+ classNames: 'ls_border',
+
+ template: Ember.Handlebars
+ .compile('<img class="bg" src="images/common/ls_border.png">')
+ }),
+
+ items: Em.ContainerView.extend( {
+ classNames: 'ls-items',
+
+ childViews: [
+ 'dialpadButton'
+ ],
+
+ dialpadButton: SDL.Button.extend( {
+ elementId: 'phone_menu_dialpadButton',
+
+ classNames: 'ls-item lsp1_p active_in_helpmode',
+ classNameBindings: [
+ 'SDL.States.phone.dialpad.active:phone_active'
+ ],
+ textBinding: Em.Binding
+ .oneWay('SDL.locale.label.view_phone_phone'),
+ icon: 'images/phone/ico_phone.png',
+ action: 'subState',
+ target: 'SDL.PhoneController',
+
+ stateName: 'dialpad'
+ })
+ })
+ }),
+
+ /** End call message window */
+ endCallMessage: SDL.Label.extend( {
+ elementId: 'phone_endCallMessage',
+
+ contentBinding: Em.Binding
+ .oneWay('SDL.locale.label.view_phone_popUp_callEnded')
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/AlertManeuverPopUp.js b/src/components/HMI/app/view/sdl/AlertManeuverPopUp.js
new file mode 100644
index 0000000000..b675b32cf5
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/AlertManeuverPopUp.js
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.AlertManeuverPopUp
+ * @desc AlertManeuverPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/AlertManeuverPopUp.js
+ * @version 1.0
+ */
+
+SDL.AlertManeuverPopUp = Em.ContainerView.create( {
+
+ elementId: 'AlertManeuverPopUp',
+
+ classNames: 'AlertManeuverPopUp',
+
+ classNameBindings:
+ ['activate:AlertManeuverActive'
+ ],
+
+ childViews:
+ [
+ 'applicationName',
+ // 'image',
+ // 'message1',
+ // 'message2',
+ // 'message3',
+ 'softbuttons',
+ 'closeButton'
+ ],
+
+ content1: 'Title',
+
+ content2: 'Text',
+
+ activate: false,
+
+ timer: null,
+
+ /**
+ * Wagning image on Alert Maneuver PopUp
+ */
+ image: Em.View.extend( {
+ elementId: 'alertManeuverPopUpImage',
+
+ classNames: 'alertManeuverPopUpImage'
+ } ),
+
+ applicationName: SDL.Label.extend( {
+
+ elementId: 'applicationName',
+
+ classNames: 'applicationName',
+
+ contentBinding: 'parentView.appName'
+ } ),
+
+ message1: SDL.Label.extend( {
+
+ elementId: 'message1',
+
+ classNames: 'message1',
+
+ contentBinding: 'parentView.content1'
+ } ),
+
+ message2: SDL.Label.extend( {
+
+ elementId: 'message2',
+
+ classNames: 'message2',
+
+ contentBinding: 'parentView.content2'
+ } ),
+
+ message3: SDL.Label.extend( {
+
+ elementId: 'message3',
+
+ classNames: 'message3',
+
+ contentBinding: 'parentView.content3'
+ } ),
+
+ /**
+ * Container for softbuttons
+ */
+ softbuttons: Em.ContainerView.extend( {
+ elementId: 'alertManeuverSoftButtons',
+
+ classNames: 'alertManeuverSoftButtons'
+ } ),
+
+ /**
+ * Close button
+ */
+ closeButton: SDL.Button.create( {
+ text: 'Close',
+ classNames: 'closeButton softButton',
+ action: 'closeAlertMeneuverPopUp',
+ target: 'SDL.SDLController',
+ templateName: 'text'
+ } ),
+
+ /**
+ * @desc Function creates Soft Buttons on AlertPoUp
+ * @param {Object} params
+ */
+ addSoftButtons: function( params ) {
+
+ var count = this.get( 'softbuttons' ).removeAllChildren();
+
+ if( params ){
+
+ var softButtonsClass;
+ switch( params.length ){
+ case 1:
+ softButtonsClass = 'one';
+ break;
+ case 2:
+ softButtonsClass = 'two';
+ break;
+ case 3:
+ softButtonsClass = 'three';
+ break;
+ case 4:
+ softButtonsClass = 'four';
+ break;
+ }
+
+ for( var i = 0; i < params.length; i++ ){
+ this.get( 'softbuttons.childViews' ).pushObject( SDL.Button.create( SDL.PresetEventsCustom, {
+ softButtonID: params[i].softButtonID,
+ icon: params[i].image,
+ text: params[i].text,
+ classNames: 'list-item softButton ' + softButtonsClass,
+ elementId: 'softButton' + i,
+ templateName: params[i].image ? 'rightIcon' : 'text',
+ systemAction: params[i].systemAction,
+ appID: params.appID
+ } ) );
+ }
+ }
+ },
+
+ AlertManeuverActive: function( message ) {
+// var self = this;
+//
+// if (message.softButtons) {
+// this.addSoftButtons( message.softButtons );
+// }
+//
+// this.set( 'activate', true );
+//
+// clearTimeout( this.timer );
+// this.timer = setTimeout( function() {
+// self.set( 'activate', false );
+// }, 5000 );
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/AlertPopUp.js b/src/components/HMI/app/view/sdl/AlertPopUp.js
new file mode 100644
index 0000000000..0589da3649
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/AlertPopUp.js
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.AlertPopUp
+ * @desc AlertPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/AlertPopUp.js
+ * @version 1.0
+ */
+
+SDL.AlertPopUp = Em.ContainerView.create({
+
+ elementId: 'AlertPopUp',
+
+ classNames: 'AlertPopUp',
+
+ classNameBindings:
+ [
+ 'active:AlertActive'
+ ],
+
+ childViews:
+ [
+ 'applicationName',
+ 'image',
+ 'message1',
+ 'message2',
+ 'message3',
+ 'softbuttons',
+ 'progressIndicatorView'
+ ],
+
+ /**
+ * Id of current request
+ *
+ * @type {Number}
+ */
+ alertRequestId: null,
+
+ content1: '',
+
+ content2: '',
+
+ content3: '',
+
+ active: false,
+
+ timer: null,
+
+ timeout: null,
+
+ progressIndicator: false,
+
+ /**
+ * Wagning image on Alert PopUp
+ */
+ image: Em.View.extend({
+ elementId: 'alertPopUpImage',
+
+ classNames: 'alertPopUpImage'
+ }),
+
+ /**
+ * Wagning image on Alert PopUp
+ */
+ progressIndicatorView: Em.View.extend({
+ elementId: 'progressIndicator',
+
+ classNameBindings: 'this.parentView.progressIndicator:progressIndicator'
+ }),
+
+ applicationName: SDL.Label.extend({
+
+ elementId: 'applicationName',
+
+ classNames: 'applicationName',
+
+ contentBinding: 'parentView.appName'
+ }),
+
+ message1: SDL.Label.extend({
+
+ elementId: 'message1',
+
+ classNames: 'message1',
+
+ contentBinding: 'parentView.content1'
+ }),
+
+ message2: SDL.Label.extend({
+
+ elementId: 'message2',
+
+ classNames: 'message2',
+
+ contentBinding: 'parentView.content2'
+ }),
+
+ message3: SDL.Label.extend({
+
+ elementId: 'message3',
+
+ classNames: 'message3',
+
+ contentBinding: 'parentView.content3'
+ }),
+
+ /**
+ * Deactivate PopUp
+ */
+ deactivate: function(reason) {
+ this.set('active', false);
+ clearTimeout(this.timer);
+
+ this.set('content1', '');
+ this.set('content2', '');
+ this.set('content3', '');
+
+ if (reason == 'timeout' && this.softbuttons.buttons._childViews.length > 0 && reason === 'ABORTED') {
+ SDL.SDLController.alertResponse(SDL.SDLModel.resultCode['ABORTED'], this.alertRequestId);
+ } else {
+ SDL.SDLController.alertResponse(SDL.SDLModel.resultCode['SUCCESS'], this.alertRequestId);
+ }
+
+ SDL.SDLController.onSystemContextChange();
+ },
+
+ /**
+ * Container for softbuttons
+ */
+ softbuttons: Em.ContainerView.extend({
+
+ childViews:
+ [
+ 'buttons'
+ ],
+
+ buttons: Em.ContainerView.extend({
+ elementId: 'alertSoftButtons',
+
+ classNames: 'alertSoftButtons'
+ })
+ }),
+
+ /**
+ * @desc Function creates Soft Buttons on AlertPoUp
+ * @param {Object} params
+ */
+ addSoftButtons: function(params, appID) {
+
+ this.softbuttons.buttons.removeAllChildren();
+ this.softbuttons.buttons.rerender();
+
+ if(params){
+
+ var softButtonsClass;
+ switch(params.length){
+ case 1:
+ softButtonsClass = 'one';
+ break;
+ case 2:
+ softButtonsClass = 'two';
+ break;
+ case 3:
+ softButtonsClass = 'three';
+ break;
+ case 4:
+ softButtonsClass = 'four';
+ break;
+ }
+
+ for(var i = 0; i < params.length; i++){
+ this.get('softbuttons.buttons.childViews')
+ .pushObject(SDL.Button.create(SDL.PresetEventsCustom, {
+ systemAction: params[i].systemAction,
+ groupName: "AlertPopUp",
+ classNameBindings: ['isHighlighted:isHighlighted'],
+ isHighlighted: params[i].isHighlighted ? true : false,
+ softButtonID: params[i].softButtonID,
+ icon: params[i].image ? params[i].image.value : "",
+ text: params[i].text,
+ classNames: 'list-item softButton ' + softButtonsClass,
+ elementId: 'softButton' + i,
+ templateName: params[i].image ? 'rightText' : 'text',
+ appID: appID
+ }));
+ }
+ }
+ },
+
+ AlertActive: function(message, alertRequestId) {
+ var self = this;
+
+ this.set('alertRequestId', alertRequestId);
+
+ this.addSoftButtons(message.softButtons, message.appID);
+
+ this.set('progressIndicator', message.progressIndicator);
+
+ this.set('appName', SDL.SDLController.getApplicationModel(message.appID).appName);
+
+ for (var i = 0; i < message.alertStrings.length; i++) {
+ switch (message.alertStrings[i].fieldName) {
+ case 'alertText1': {
+ this.set('content1', message.alertStrings[i].fieldText);
+ break;
+ }
+ case 'alertText2': {
+ this.set('content2', message.alertStrings[i].fieldText);
+ break;
+ }
+ case 'alertText3': {
+ this.set('content3', message.alertStrings[i].fieldText);
+ break;
+ }
+ }
+ }
+
+ this.set('active', true);
+ this.set('timeout', message.duration ? message.duration : 30000); //default timeout defined for Alert popUp
+
+ clearTimeout(this.timer);
+ this.timer = setTimeout(function() {
+ self.deactivate('timeout');
+ }, this.timeout);
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/AudioPassThruPopUp.js b/src/components/HMI/app/view/sdl/AudioPassThruPopUp.js
new file mode 100644
index 0000000000..849daa2243
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/AudioPassThruPopUp.js
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.AudioPassThruPopUp
+ * @desc AudioPassThruPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/AudioPassThruPopUp.js
+ * @version 1.0
+ */
+
+SDL.AudioPassThruPopUp = Em.ContainerView.create( {
+
+ elementId: 'AudioPassThruPopUp',
+
+ classNames: 'AudioPassThruPopUp',
+
+ classNameBindings:
+ [
+ 'activate:AudioPassThruActive'
+ ],
+
+ childViews:
+ [
+ 'applicationName',
+ 'image',
+ 'message1',
+ 'message2',
+ 'message3',
+ 'buttonRetry',
+ 'buttonDone',
+ 'buttonCancel'
+ ],
+
+ content1: 'Title',
+
+ content2: 'Text',
+
+ activateBinding: 'SDL.SDLModel.AudioPassThruState',
+
+ timer: null,
+
+ applicationName: SDL.Label.extend( {
+
+ elementId: 'AudioPassThruPopUpApplicationName',
+
+ classNames: 'applicationName',
+
+ contentBinding: 'parentView.appName'
+ } ),
+
+ /**
+ * Wagning image on Alert PopUp
+ */
+ image: Em.View.extend( {
+ elementId: 'audioPassThruImage',
+
+ classNames: 'audioPassThruImage'
+ } ),
+
+ message1: SDL.Label.extend( {
+
+ elementId: 'AudioPassThruPopUpMessage1',
+
+ classNames: 'message1',
+
+ contentBinding: 'parentView.content1'
+ } ),
+
+ message2: SDL.Label.extend( {
+
+ elementId: 'AudioPassThruPopUpMessage2',
+
+ classNames: 'message2',
+
+ contentBinding: 'parentView.content2'
+ } ),
+
+ message3: SDL.Label.extend( {
+
+ elementId: 'AudioPassThruPopUpMessage3',
+
+ classNames: 'message3',
+
+ contentBinding: 'parentView.content3'
+ } ),
+
+ buttonRetry: SDL.Button.create( {
+ elementId: 'AudioPassThruPopUpButtonRetry',
+ classNames: 'buttonRetry softButton',
+ text: 'Retry',
+ responseResult: SDL.SDLModel.resultCode['RETRY'],
+ actionUp: function() {
+ SDL.SDLController.callPerformAudioPassThruPopUpErrorResponse( this );
+ }
+ } ),
+
+ buttonDone: SDL.Button.create( {
+ elementId: 'AudioPassThruPopUpButtonDone',
+ classNames: 'buttonDone softButton',
+ text: 'Done',
+ responseResult: SDL.SDLModel.resultCode['SUCCESS'],
+ actionUp: function() {
+ SDL.SDLController.callPerformAudioPassThruPopUpResponse( this );
+ }
+ } ),
+
+ buttonCancel: SDL.Button.create( {
+ elementId: 'AudioPassThruPopUpButtonCancel',
+ classNames: 'buttonCancel softButton',
+ text: 'Cancel',
+ responseResult: SDL.SDLModel.resultCode['ABORTED'],
+ actionUp: function() {
+ SDL.SDLController.callPerformAudioPassThruPopUpErrorResponse( this );
+ }
+ } ),
+
+ /**
+ * Method to start AudioPassThru timer to deactivate popUp and send response to SDL
+ */
+ StartAudioPassThruTimer: function() {
+ clearTimeout( this.timer );
+ this.timer = setTimeout( function() {
+ SDL.SDLController.performAudioPassThruResponse( SDL.SDLModel.resultCode["SUCCESS"] );
+ }, SDL.SDLModel.AudioPassThruData.maxDuration );
+ },
+
+ /**
+ * Method clears PopUp's timer when activity flag become false, and show
+ * PopUp with data come from SDLCorel when activity flag become true
+ */
+ AudioPassThruActivity: function() {
+
+ if( this.activate ){
+
+ var self = this, data = SDL.SDLModel.AudioPassThruData;
+
+ this.set( 'appName', SDL.SDLController.getApplicationModel( data.appID ).appName );
+
+ for (var i = 0; i < data.audioPassThruDisplayTexts.length; i++) {
+ switch (data.audioPassThruDisplayTexts[i].fieldName) {
+ case 'audioPassThruDisplayText1': {
+ this.set('content1', data.audioPassThruDisplayTexts[i].fieldText);
+ break;
+ }
+ case 'audioPassThruDisplayText2': {
+ this.set('content2', data.audioPassThruDisplayTexts[i].fieldText);
+ break;
+ }
+ }
+ }
+ }else{
+ if( this.timer ){
+ clearTimeout( this.timer );
+ this.timer = null;
+ }
+
+ SDL.SDLController.onSystemContextChange();
+ }
+ }.observes( 'activate' )
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/ExitAppView.js b/src/components/HMI/app/view/sdl/ExitAppView.js
new file mode 100644
index 0000000000..81e9c7ad5f
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/ExitAppView.js
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.ExitApp
+ * @desc Exit All Applications reason select visual representation
+ * @category View
+ * @filesource app/view/sdl/ExitAppView.js
+ * @version 1.0
+ */
+
+SDL.ExitApp = Em.ContainerView.create( {
+
+ elementId: 'exitAppView',
+
+ classNames: 'exitAppView',
+
+ classNameBindings:
+ [
+ 'active'
+ ],
+
+ childViews:
+ [
+ 'exitAppViewLabel',
+ 'exitAppViewTitle',
+ 'exitAppViewSelect',
+ 'onAwakeSDLLabel',
+ 'onAwakeSDLButton'
+ ],
+
+ /**
+ * Title of VehicleInfo PopUp view
+ */
+ exitAppViewLabel: SDL.Label.extend( {
+
+ elementId: 'exitAppViewLabel',
+
+ classNames: 'exitAppViewLabel',
+
+ content: 'Exit Application'
+ } ),
+
+ /**
+ * Property indicates the activity state of TBTClientStateView
+ */
+ active: false,
+
+ /**
+ * Title of tbtClientState group of parameters
+ */
+ exitAppViewTitle: SDL.Label.extend( {
+
+ elementId: 'exitAppViewTitle',
+
+ classNames: 'exitAppViewTitle',
+
+ content: 'Exit Application reason'
+ } ),
+
+ /**
+ * HMI element Select with parameters of TBTClientStates
+ */
+ exitAppViewSelect: Em.Select.extend( {
+
+ elementId: 'exitAppViewSelect',
+
+ classNames: 'exitAppViewSelect',
+
+ contentBinding: 'SDL.SDLModel.exitAppState',
+
+ optionValuePath: 'content.id',
+
+ optionLabelPath: 'content.name',
+
+ /**
+ * Selected data sent on model for further processing
+ */
+ click: function() {
+
+ SDL.SDLController.exitAppViewSelected( this.selection.name );
+
+ }
+ } ),
+
+ onAwakeSDLLabel: SDL.Label.extend( {
+
+ elementId: 'onAwakeSDLLabel',
+
+ classNames: 'onAwakeSDLLabel',
+
+ content: 'onAwakeSDL notification send'
+ } ),
+
+ onAwakeSDLButton: SDL.Button.extend( {
+ classNames: 'button onAwakeSDLButton',
+ text: 'Send onAwakeSDL',
+ action: 'onAwakeSDLNotificationSend',
+ target: 'SDL.SDLController',
+ buttonAction: true,
+ onDown: false
+ }),
+
+ /**
+ * Trigger function that activates and deactivates tbtClientStateView
+ */
+ toggleActivity: function() {
+ this.toggleProperty( 'active' );
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/PopUp.js b/src/components/HMI/app/view/sdl/PopUp.js
new file mode 100644
index 0000000000..6da36feb4f
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/PopUp.js
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PopUp
+ * @desc PopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/PopUp.js
+ * @version 1.0
+ */
+
+SDL.PopUp = Em.ContainerView.extend({
+
+ classNames: 'PopUp',
+
+ childViews:
+ [
+ 'message',
+ 'buttonOk',
+ 'buttonCancel',
+ 'backButton'
+ ],
+
+ classNameBindings: [
+ 'this.active:active_state:inactive_state'
+ ],
+
+ popUpId: 0,
+
+ /**
+ * Callback function to return result of made action by user
+ */
+ callback: null,
+
+ content: 'Title',
+
+ active: false,
+
+ timer: null,
+
+ backButton: SDL.Button.extend( {
+ classNames: 'button backButton',
+ text: 'X',
+ click: function () {
+ this._parentView.deactivate();
+ },
+ buttonAction: true,
+ onDown: false,
+ disabledBinding: 'parentView.buttons'
+ }),
+
+ buttons: true,
+
+ buttonOk: SDL.Button.extend( {
+ classNames: 'button vehicleHealthReport OkButton',
+ text: 'Ok',
+ action: 'deactivate',
+ target: 'parentView',
+ buttonAction: true,
+ onDown: false,
+ disabledBinding: 'parentView.buttons'
+ }),
+
+ buttonCancel: SDL.Button.extend( {
+ classNames: 'button vehicleHealthReport CancelButton',
+ text: 'Cancel',
+ action: 'deactivate',
+ target: 'parentView',
+ buttonAction: false,
+ onDown: false,
+ disabledBinding: 'parentView.buttons'
+ }),
+
+ message: SDL.Label.extend({
+
+ elementId: 'text',
+
+ classNames: 'text',
+
+ contentBinding: 'parentView.content'
+ }),
+
+ /**
+ * Deactivate PopUp
+ */
+ deactivate: function(event) {
+ this.set('active', false);
+
+ if (this.callback && event) {
+ this.callback(event.buttonAction);
+ }
+
+ this.set('callback', null);
+ this.set('content', '');
+ this.remove();
+ },
+
+ /**
+ * HMI modal window popUp Activation method
+ * @param textBody - main text to be displayes on PopUp
+ * @param callback - Callback function handled result parameter made by user action, if null - popUp will be closed by timer
+ * @param indicator - popUp will not be closed by timer and
+ * should be deactivated manually by developer in code using method's returned parameter this.
+ * callback shuld be null if indicator is true
+ * @param label
+ * @param line1
+ * @param line2
+ * @returns {SDL.PopUp} - returns current instance of PopUp
+ */
+ popupActivate: function(textBody, callback, indicator, label, line1, line2) {
+ this.set('active', true);
+
+ clearTimeout(this.timer);
+ this.timer = null;
+
+ if (indicator) {
+ this.set('buttons', true);
+ } else if (callback) {
+ this.set('callback', callback);
+ this.set('buttons', false);
+ } else {
+ this.set('buttons', true);
+ var self = this;
+ this.timer = setTimeout(function(){
+ self.deactivate();
+ },
+ 5000);
+ }
+
+ this.set('content', textBody);
+ this.set('label', label);
+ this.set('line1', line1);
+ this.set('line2', line2);
+
+ return this;
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/SystemRequestView.js b/src/components/HMI/app/view/sdl/SystemRequestView.js
new file mode 100644
index 0000000000..0701cd2206
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/SystemRequestView.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.systemRequest
+ * @desc Exit All Applications reason select visual representation
+ * @category View
+ * @filesource app/view/sdl/systemRequestView.js
+ * @version 1.0
+ */
+
+SDL.SystemRequest = Em.ContainerView.create( {
+
+ elementId: 'systemRequestView',
+
+ classNames: 'systemRequestView',
+
+ classNameBindings:
+ [
+ 'active'
+ ],
+
+ childViews:
+ [
+ 'systemRequestViewLabel',
+ 'systemRequestViewTitle',
+ 'systemRequestViewSelect'
+ ],
+
+ /**
+ * Title of VehicleInfo PopUp view
+ */
+ systemRequestViewLabel: SDL.Label.extend( {
+
+ elementId: 'systemRequestViewLabel',
+
+ classNames: 'systemRequestViewLabel',
+
+ content: 'System Request'
+ } ),
+
+ /**
+ * Property indicates the activity state of TBTClientStateView
+ */
+ active: false,
+
+ /**
+ * Title of tbtClientState group of parameters
+ */
+ systemRequestViewTitle: SDL.Label.extend( {
+
+ elementId: 'systemRequestViewTitle',
+
+ classNames: 'systemRequestViewTitle',
+
+ content: 'System Request reason'
+ } ),
+
+ /**
+ * HMI element Select with parameters of TBTClientStates
+ */
+ systemRequestViewSelect: Em.Select.extend( {
+
+ elementId: 'systemRequestViewSelect',
+
+ classNames: 'systemRequestViewSelect',
+
+ contentBinding: 'SDL.SDLModel.systemRequestState',
+
+ optionValuePath: 'content.id',
+
+ optionLabelPath: 'content.name',
+
+ /**
+ * Selected data sent on model for further processing
+ */
+ click: function() {
+
+ SDL.SDLController.systemRequestViewSelected( this.selection.name );
+
+ }
+ } ),
+
+ /**
+ * Trigger function that activates and deactivates tbtClientStateView
+ */
+ toggleActivity: function() {
+ this.toggleProperty( 'active' );
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/TTSPopUp.js b/src/components/HMI/app/view/sdl/TTSPopUp.js
new file mode 100644
index 0000000000..ae45786f5c
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/TTSPopUp.js
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.TTSPopUp
+ * @desc TTSPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/TTSPopUp.js
+ * @version 1.0
+ */
+
+SDL.TTSPopUp = Em.ContainerView.create( {
+
+ elementId: 'TTSPopUp',
+
+ classNames: 'TTSPopUp',
+
+ classNameBindings: [
+ 'active'
+ ],
+
+ childViews: [
+ 'popUp',
+ 'message',
+ 'okButton',
+ 'timerText',
+ 'checkBoxLabel',
+ 'checkBox'
+ ],
+
+ requestId: null,
+
+ content: 'Messaage',
+
+ active: false,
+
+ timer: null,
+
+ appID: null,
+
+ timerSeconds: 5,
+
+ popUp: Ember.TextArea.extend( {
+
+ elementId: 'popUp',
+
+ classNames: 'popUp',
+
+ valueBinding: 'parentView.content'
+ }),
+
+ message: SDL.Label.extend( {
+
+ elementId: 'message',
+
+ classNames: 'message'
+ }),
+
+ okButton: SDL.Button.extend( {
+ classNames: 'button okButton',
+ text: 'Reset Timeout',
+ action: 'resetTimeout',
+ target: 'parentView',
+ buttonAction: true,
+ onDown: false,
+ disabledBinding: 'parentView.buttons'
+ }),
+
+ checkBoxLabel: SDL.Label.extend({
+
+ elementId: 'checkBoxLabel',
+
+ classNames: 'checkBoxLabel',
+
+ content: 'Send response'
+ }),
+
+ checkBox: Em.Checkbox.extend( {
+
+ elementId: 'checkBoxTTS',
+
+ classNames: 'checkBoxTTS',
+
+ checked: true
+
+ }),
+
+ timerText: SDL.Label.extend({
+
+ elementId: 'timerText',
+
+ classNames: 'timerText',
+
+ contentBinding: 'parentView.timerSeconds'
+ }),
+
+
+
+ resetTimeout: function () {
+ this.set('timerSeconds', 10);
+ FFW.TTS.OnResetTimeout(this.appID, "TTS.Speak");
+ },
+
+ ActivateTTS: function(msg, appID) {
+
+ var self = this;
+
+ this.set('appID', appID);
+ this.set('content', msg);
+ this.set('active', true);
+
+ clearInterval(this.timer);
+ this.timer = setInterval(function() {
+
+ self.set('timerSeconds', self.timerSeconds - 1);
+ }, 1000); // timeout for TTS popUp timer interval in milliseconds
+ FFW.TTS.Started();
+ },
+
+ timerHandler: function () {
+ if (this.timerSeconds === 0) {
+ this.DeactivateTTS();
+ }
+ }.observes('this.timerSeconds'),
+
+ DeactivateTTS: function() {
+ clearInterval(this.timer);
+ this.set('active', false);
+ this.appID = null;
+ this.set('timerSeconds', 5);
+ this.checkBox.set('checked', true);
+
+ if (this.checkBox.checked) {
+ SDL.SDLController.TTSResponseHandler();
+ FFW.TTS.Stopped();
+ }
+ },
+
+ /**
+ * This event triggered when component is placed to document DOM structure
+ */
+ didInsertElement: function() {
+
+ this._super();
+ }
+});
diff --git a/src/components/HMI/app/view/sdl/VRHelpListView.js b/src/components/HMI/app/view/sdl/VRHelpListView.js
new file mode 100644
index 0000000000..bf93137fac
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/VRHelpListView.js
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InteractionChoicesView
+ * @desc Interaction Choices visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/interactionChoicesView.js
+ * @version 1.0
+ */
+
+SDL.VRHelpListView = SDL.SDLAbstractView.create( {
+
+ elementId: 'vr_help_list_view',
+
+ childViews: [
+ 'backButton', 'captionText', 'helpList'
+ ],
+
+ helpList: SDL.List.extend( {
+ elementId: 'vr_help_list_view_list',
+ itemsOnPage: 5,
+ items: []
+ }),
+
+ /**
+ * Deactivate window
+ */
+ deactivate: function() {
+
+ this._super();
+
+ if (SDL.SDLAppController.model && SDL.SDLModel.vrActiveRequests.vrPerformInteraction) {
+ SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode['ABORTED']);
+ }
+
+ SDL.SDLController.VRMove();
+ },
+
+ /**
+ * Clean choices caption and list before new proform
+ */
+ clean: function() {
+
+ this.set('captionText.content', 'vrHelp');
+ this.helpList.items = [];
+ this.helpList.list.refresh();
+ },
+
+ /**
+ * Update choises list with actual set id
+ *
+ * @param data:
+ * Array
+ */
+ showVRHelp: function(vrHelpTitle, vrHelp) {
+
+ this.clean();
+
+ this.set('active', true);
+
+ SDL.SDLController.VRMove();
+
+ if (vrHelpTitle) {
+ this.captionText.set('content', vrHelpTitle);
+ }
+
+ if (vrHelp) {
+ for (i = 0; i < vrHelp.length; i++) {
+ this.helpList.items.push( {
+ type: SDL.Label,
+ params: {
+ content: vrHelp[i].text,
+ icon: vrHelp[i].image
+ ? vrHelp[i].image.value : null,
+ templateName: vrHelp[i].image ? "icon" : null
+ }
+ });
+ }
+ }
+
+ this.helpList.list.refresh();
+ }
+});
diff --git a/src/components/HMI/app/view/sdl/VRPopUp.js b/src/components/HMI/app/view/sdl/VRPopUp.js
new file mode 100644
index 0000000000..5a26a9ee80
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/VRPopUp.js
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.VRPopUp
+ * @desc VRPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/VRPopUp.js
+ * @version 1.0
+ */
+
+SDL.VRPopUp = Em.ContainerView.create( {
+
+ elementId: 'VRPopUp',
+
+ classNames: 'VRPopUp',
+
+ classNameBindings:
+ [
+ 'SDL.SDLModel.VRActive:active',
+ 'SDL.SDLModel.VRHelpListActivated:move'
+ ],
+
+ childViews:
+ [
+ 'popUp',
+ 'VRLabel',
+ 'VRImage',
+ 'listOfCommands'
+ ],
+
+ VRImage: Em.View.extend( {
+
+ elementId: 'VRImage',
+
+ classNames: 'VRImage'
+ } ),
+
+ VRLabel: SDL.Label.extend( {
+
+ elementId: 'VRLabel',
+
+ classNames: 'VRLabel',
+
+ content: 'Speak the command'
+ } ),
+
+ VRActiveBinding: 'SDL.SDLModel.VRActive',
+
+ popUp: Em.View.extend( {
+
+ elementId: 'popUp',
+
+ classNames: 'popUp'
+ } ),
+
+ AddCommand: function(cmdID, vrCommands, appID, type, grammarID) {
+
+ if (type == "Application") {
+ for( var i = 0; i < vrCommands.length; i++ ){
+ this.get( 'listOfCommands.list.childViews' ).pushObject( SDL.Button.create( {
+ action: 'onActivateSDLApp',
+ target: 'SDL.SDLController',
+ appID: appID,
+ text: vrCommands[i],
+ classNames: 'list-item',
+ templateName: 'text'
+ } ) );
+ }
+ } else {
+ for( var j = 0; j < vrCommands.length; j++ ){
+
+ this.get( 'listOfCommands.list.childViews' ).pushObject( SDL.Button.create( {
+ action: type == 'Command' ? 'onVRCommand' : 'VRPerformAction',
+ target: 'SDL.SDLAppController',
+ appID: appID,
+ grammarID: grammarID,
+ commandID: cmdID,
+ text: vrCommands[j],
+ type: type,
+ hideButtons: function() {
+ if (this.type == "Command" && SDL.SDLModel.performInteractionSession.length == 0) {
+ return false;
+ } else if (SDL.SDLModel.performInteractionSession && SDL.SDLModel.performInteractionSession.indexOf(this.grammarID) >= 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }.property('SDL.SDLModel.performInteractionSession'),
+ classNameBindings: ['this.hideButtons:hide'],
+ classNames: 'list-item',
+ templateName: 'text'
+ } ) );
+ }
+ }
+ },
+
+ updateVR: function(){
+
+ this.listOfCommands.list.removeAllChildren();
+ this.listOfCommands.list.refresh();
+
+ var len = SDL.SDLModel.VRCommands.length;
+ for (var i = 0; i < len; i++) {
+ this.AddCommand(SDL.SDLModel.VRCommands[i].cmdID, SDL.SDLModel.VRCommands[i].vrCommands, SDL.SDLModel.VRCommands[i].appID, SDL.SDLModel.VRCommands[i].type);
+ }
+
+ if (SDL.SDLAppController.model) {
+
+ len = SDL.SDLAppController.model.VRCommands.length;
+ for (var i = 0; i < len; i++) {
+ this.AddCommand(SDL.SDLAppController.model.VRCommands[i].cmdID,
+ SDL.SDLAppController.model.VRCommands[i].vrCommands,
+ SDL.SDLAppController.model.VRCommands[i].appID,
+ SDL.SDLAppController.model.VRCommands[i].type,
+ SDL.SDLAppController.model.VRCommands[i].grammarID);
+ }
+ }
+
+ if (SDL.SDLModel.stateLimited) {
+ len = SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands.length;
+ for (var i = 0; i < len; i++) {
+ this.AddCommand(SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands[i].cmdID,
+ SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands[i].vrCommands,
+ SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands[i].appID,
+ SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands[i].type,
+ SDL.SDLController.getApplicationModel(SDL.SDLModel.stateLimited).VRCommands[i].grammarID);
+ }
+ }
+
+ }.observes('SDL.SDLAppController.model'),
+
+ DeleteCommand: function(commandID, appID) {
+
+ if (commandID != 0) {
+ var t = this.get('listOfCommands.list.childViews').filterProperty('commandID', commandID);
+ for (var i = 0; i < t.length; i++) {
+ t[i].remove();
+ t[i].destroy();
+ }
+ } else {
+ var t = this.get('listOfCommands.list.childViews').filterProperty('appID', appID);
+ for (var i = 0; i < t.length; i++) {
+ t[i].remove();
+ t[i].destroy();
+ }
+ }
+ },
+
+ DeleteActivateApp: function(appID) {
+
+ var t = this.get('listOfCommands.list.childViews').filterProperty('appID', appID);
+ for (var i = 0; i < t.length; i++) {
+ t[i].remove();
+ t[i].destroy();
+ }
+ },
+
+ /**
+ * List for option on SDLOptionsView screen
+ */
+ listOfCommands: SDL.List.extend( {
+
+ elementId: 'VR_list',
+
+ itemsOnPage: 5,
+
+ /** Items array */
+ items: [
+ {
+ type: SDL.Button,
+ params: {
+ //templateName: template,
+ text: 'Help',
+ target: 'SDL.SDLController',
+ action: 'vrHelpAction',
+ onDown: false
+ }
+ }
+ ]
+ } ),
+
+ // deactivate VR on change application state
+ onStateChange: function() {
+ if (this.VRActive) {
+ FFW.VR.Started();
+ this.set( 'VRActive', false );
+ } else {
+ FFW.VR.Stopped();
+ }
+ }.observes('SDL.TransitionIterator.ready'),
+
+ onActivate: function() {
+ SDL.SDLController.VRMove();
+ if (this.VRActive) {
+
+ FFW.VR.Started();
+ SDL.SDLController.onSystemContextChange();
+ } else {
+
+ FFW.VR.Stopped();
+ SDL.SDLController.onSystemContextChange();
+ }
+ }.observes('this.VRActive'),
+
+ /**
+ * This event triggered when component is placed to
+ * document DOM structure
+ */
+ didInsertElement: function() {
+ this._super();
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/VehicleInfoView.js b/src/components/HMI/app/view/sdl/VehicleInfoView.js
new file mode 100644
index 0000000000..915d416d76
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/VehicleInfoView.js
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.VehicleInfo
+ * @desc VehicleInfo module visual representation
+ * @category View
+ * @filesource app/view/sdl/VehicleInfo.js
+ * @version 1.0
+ */
+
+SDL.VehicleInfo = Em.ContainerView.create( {
+
+ elementId: 'VehicleInfo',
+
+ classNames: 'VehicleInfo',
+
+ classNameBindings:
+ [
+ 'active'
+ ],
+
+ childViews:
+ [
+ 'prndl',
+ 'vehicleInfoLabel',
+ 'prndlSelect',
+ 'ecu1Title',
+ 'ecu1',
+ 'ecu2',
+ 'ecu1Data',
+ 'ecu2Data',
+ 'odometrTitle',
+ 'odometrInput',
+ 'onAwakeSDLButton'
+ ],
+
+ /**
+ * Title of odometr group of parameters stored data in VehicleInfo model
+ */
+ odometrTitle: SDL.Label.extend( {
+
+ elementId: 'odometrTitle',
+
+ classNames: 'odometrTitle',
+
+ content: 'Odometr'
+ } ),
+
+ /**
+ * Input for odometr value changes
+ */
+ odometrInput: Ember.TextField.extend({
+ elementId: "odometrInput",
+ classNames: "odometrInput",
+ keyUp: function(event, view) {
+ if(event.which == 13){
+ SDL.SDLVehicleInfoModel.set('odometrInput', parseInt(this.value));
+ }
+ }
+ }),
+
+ /**
+ * Label with stored data in VehicleInfo model
+ */
+ ecu2Data: SDL.Label.extend( {
+
+ elementId: 'ecu2Data',
+
+ classNames: 'ecu2Data',
+
+ contentBinding: 'SDL.SDLVehicleInfoModel.ecuDIDData.1.data'
+ } ),
+
+ /**
+ * Label with stored data in VehicleInfo model
+ */
+ ecu1Data: SDL.Label.extend( {
+
+ elementId: 'ecu1Data',
+
+ classNames: 'ecu1Data',
+
+ contentBinding: 'SDL.SDLVehicleInfoModel.ecuDIDData.0.data'
+ } ),
+
+ /**
+ * Label with name of some parameter stored data in VehicleInfo model
+ */
+ ecu2: SDL.Label.extend( {
+
+ elementId: 'ecu2',
+
+ classNames: 'ecu2',
+
+ content: 'ECU 2:'
+ } ),
+
+ /**
+ * Label with name of some parameter stored data in VehicleInfo model
+ */
+ ecu1: SDL.Label.extend( {
+
+ elementId: 'ecu1',
+
+ classNames: 'ecu1',
+
+ content: 'ECU 1:'
+ } ),
+
+ /**
+ * Title of ecu group of parameters stored data in VehicleInfo model
+ */
+ ecu1Title: SDL.Label.extend( {
+
+ elementId: 'ecu1Title',
+
+ classNames: 'ecu1Title',
+
+ content: 'ECU'
+ } ),
+
+ /**
+ * Title of VehicleInfo PopUp view
+ */
+ vehicleInfoLabel: SDL.Label.extend( {
+
+ elementId: 'vehicleInfoLabel',
+
+ classNames: 'vehicleInfoLabel',
+
+ content: 'Vehicle Information'
+ } ),
+
+ /**
+ * Property indicates the activity state of VehicleInfo PopUp
+ */
+ active: false,
+
+ /**
+ * Title of prndl group of parameters stored in VehicleInfo model
+ */
+ prndl: SDL.Label.extend( {
+
+ elementId: 'prndl',
+
+ classNames: 'prndl',
+
+ content: 'PRNDL'
+ } ),
+
+ /**
+ * HMI element Select with parameters of transmission state from VehicleInfo
+ * Model
+ */
+ prndlSelect: Em.Select.extend( {
+
+ elementId: 'prndlSelect',
+
+ classNames: 'prndlSelect',
+
+ contentBinding: 'SDL.SDLVehicleInfoModel.vehicleInfoPRNDL',
+
+ valueBinding: 'SDL.SDLVehicleInfoModel.prndlSelectState'
+ } ),
+
+ /**
+ * Button to send OnEmergencyEvent to SDL
+ */
+ onAwakeSDLButton: SDL.Button.extend( {
+ classNames: 'button onEmergencyEvent',
+ textBinding: 'this.displayText',
+ action: 'OnEmergencyEventNotificationSend',
+ target: 'SDL.SDLController',
+ enabled: false,
+ onDown: false,
+ displayText: function () {
+ return this.enabled ? 'Send OnEmergencyEvent On' : 'Send OnEmergencyEvent Off';
+ }.property('this.enabled')
+ }),
+
+ /**
+ * Trigger function that activates and deactivates VehicleInfo PopUp
+ */
+ toggleActivity: function() {
+ this.set( 'active', !this.active );
+ },
+
+ /**
+ * This event triggered when component is placed to
+ * document DOM structure
+ */
+ didInsertElement: function() {
+ this._super();
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/driverDistraction.js b/src/components/HMI/app/view/sdl/driverDistraction.js
new file mode 100644
index 0000000000..e2f57105c7
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/driverDistraction.js
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DriverDistraction
+ * @desc DriverDistractionPopUp module visual representation
+ * @category View
+ * @filesource app/view/sdl/driverDistraction.js
+ * @version 1.0
+ */
+
+SDL.DriverDistraction = Em.ContainerView.create( {
+
+ elementId: 'driverDistraction',
+
+ classNames: 'driverDistractionWindow',
+
+ classNameBindings:
+ [
+ 'active'
+ ],
+
+ childViews:
+ [
+ 'driverDistractionPopUp',
+ 'driverDistractionText'
+ ],
+
+ content: 'Not accessible while driving',
+
+ active: false,
+
+ driverDistractionPopUp: Em.View.create( {
+
+ classNames: 'driverDistraction'
+ } ),
+
+ driverDistractionText: SDL.Label.extend( {
+
+ elementId: 'driverDistractionText',
+
+ classNames: 'driverDistractionText',
+
+ contentBinding: 'parentView.content'
+ } ),
+
+ activate: function() {
+ this.set( 'active', true );
+ setTimeout( function() {
+ SDL.DriverDistraction.deactivate();
+ }, 3000 );
+
+ SDL.SDLController.onSystemContextChange();
+ },
+
+ deactivate: function() {
+ this.set( 'active', false );
+
+ SDL.SDLController.onSystemContextChange();
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/shared/AbstractView.js b/src/components/HMI/app/view/sdl/shared/AbstractView.js
new file mode 100644
index 0000000000..0294c17732
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/AbstractView.js
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SDLAbstractView
+ * @desc SDL application abstract shared view
+ * @category View
+ * @filesource app/view/sdl/shared/AbstractView.js
+ * @version 1.0
+ */
+
+SDL.SDLAbstractView = Em.ContainerView.extend( {
+
+ classNames:
+ [
+ 'sdl-window'
+ ],
+
+ classNameBindings:
+ [
+ 'active:active_state:inactive_state'
+ ],
+
+ active: false,
+
+ caption: 'Caption Text',
+
+ /**
+ * Activate window and set caption text
+ *
+ * @param text: String
+ */
+ activate: function( text ) {
+ if( text ){
+ this.set( 'caption', text );
+ }
+ this.set( 'active', true );
+ },
+
+ /**
+ * Deactivate window
+ */
+ deactivate: function() {
+ this.set( 'active', false );
+ },
+
+ onStateChange: function() {
+ if( this.active ){
+ this.deactivate();
+ }
+ }.observes( 'SDL.TransitionIterator.ready' ),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'back-button'
+ ],
+ target: 'this.parentView',
+ action: 'deactivate',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ captionText: SDL.Label.extend( {
+ classNames:
+ [
+ 'caption-text'
+ ],
+
+ contentBinding: 'this.parentView.caption'
+ } )
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js
new file mode 100644
index 0000000000..288031ab17
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/interactionChoicesView.js
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.InteractionChoicesView
+ * @desc Interaction Choices visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/interactionChoicesView.js
+ * @version 1.0
+ */
+
+SDL.InteractionChoicesView = SDL.SDLAbstractView.create({
+
+ elementId: 'perform_interaction_view',
+
+ childViews: [
+ 'backButton',
+ 'captionText',
+ 'listOfChoices',
+ 'input',
+ 'listWrapper'
+ ],
+
+ didInsertElement: function(){
+
+ SDL.SDLModel.interactionListWrapper = new iScroll('listWrapper', { hideScrollbar:false, hScrollbar: true, vScrollbar: true, hScroll: true, vScroll: true });
+ },
+
+ backButton: SDL.Button.extend({
+ classNames: [
+ 'back-button'
+ ],
+ target: 'SDL.SDLController',
+ action: 'InteractionChoicesDeactivate',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ }),
+
+ input: Ember.TextArea.extend({
+ classNameBindings: ['this.parentView.search::hide'],
+ tagName: 'input',
+ attribute: ['type:text'],
+ attributeBindings: ['disabled'],
+ disabled: false,
+ click: function(){
+ SDL.SDLModel.uiShowKeyboard(this);
+ },
+ search: function(){
+ FFW.UI.OnKeyboardInput(SDL.SDLModel.keyboardInputValue, "ENTRY_SUBMITTED");
+ this.get('parentView').deactivate("SUCCESS");
+ }
+ }),
+
+ listWrapper: Em.ContainerView.extend({
+
+ classNameBindings: ['this.parentView.icon::hide'],
+
+ elementId: 'listWrapper',
+
+ classNames: 'listWrapper',
+
+ childViews: [
+ 'naviChoises'
+ ],
+
+ click: function() {
+ if (this._parentView.active) {
+ SDL.InteractionChoicesView.timerUpdate();
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction");
+ }
+ },
+
+ naviChoises: Em.ContainerView.extend({
+ classNames: 'naviChoises',
+ childViews: [
+ 'captionText'
+ ],
+
+ captionText: SDL.Label.extend({
+
+ classNameBindings: ['this.parentView.search:hide'],
+ classNames: ['caption-text'],
+ contentBinding: 'this.parentView.caption'
+ })
+
+ })
+ }),
+
+ captionText: SDL.Label.extend({
+
+ classNameBindings: ['this.parentView.search:hide'],
+ classNames: ['caption-text'],
+ contentBinding: 'this.parentView.caption'
+ }),
+
+ listOfChoices: SDL.List.extend({
+ classNameBindings: ['this.parentView.list::hide'],
+ elementId: 'perform_interaction_view_list',
+ itemsOnPage: 5,
+ items: [],
+ click: function() {
+ if (this._parentView.active) {
+ SDL.InteractionChoicesView.timerUpdate();
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction");
+ }
+ }
+ }),
+
+ timer: null,
+
+ timeout: null,
+
+ search: false,
+
+ list: false,
+
+ icon: false,
+
+ /**
+ * Id of app initiated performInteraction request
+ */
+ appID: null,
+
+ /**
+ * Method updates popup timer when data changes through keyboard
+ */
+ timerUpdate: function (){
+ if (this.timeout) {
+ clearTimeout(this.timer);
+ var self = this;
+ this.timer = setTimeout(function () {
+
+ self.deactivate("TIMED_OUT");
+ }, this.timeout);
+ }
+ }.observes('this.input.value'),
+
+ /**
+ * Activate window and set caption text
+ *
+ * @param text: String
+ */
+ activate: function (message) {
+
+ this.clean();
+
+ if (message.params && message.params.initialText) {
+ this.set('caption', message.params.initialText.fieldText);
+ }
+
+ this.appID = message.params.appID;
+
+ if (message.params.interactionLayout) {
+
+ switch (message.params.interactionLayout) {
+ case "ICON_ONLY" : {
+
+ this.preformChoicesNavigation(message.params.choiceSet, message.params.timeout);
+
+
+ this.set('search', false);
+ this.set('list', false);
+ this.set('icon', true);
+ this.set('active', true);
+ break;
+ }
+ case "ICON_WITH_SEARCH" : {
+
+ this.preformChoicesNavigation(message.params.choiceSet, message.params.timeout);
+
+ this.set('icon', true);
+ this.set('search', true);
+ this.set('list', false);
+ this.set('active', true);
+ break;
+ }
+ case "LIST_ONLY" : {
+
+ this.preformChoices(message.params.choiceSet, message.params.timeout);
+
+ this.set('list', true);
+ this.set('icon', false);
+ this.set('search', false);
+ this.set('active', true);
+ break;
+ }
+ case "LIST_WITH_SEARCH" : {
+
+ this.preformChoices(message.params.choiceSet, message.params.timeout);
+
+ this.set('list', true);
+ this.set('search', true);
+ this.set('icon', false);
+ this.set('active', true);
+ break;
+ }
+ case "KEYBOARD" : {
+ this.preformChoices(null, message.params.timeout);
+ SDL.SDLModel.uiShowKeyboard(this.input);
+
+
+ this.set('list', false);
+ this.set('search', false);
+ this.set('icon', false);
+ // this.set('active', true);
+
+ break;
+ }
+ default:
+ {
+ // default action
+ }
+ }
+ } else {
+
+ if (message.params.choiceSet) {
+ this.preformChoices(message.params.choiceSet, message.params.timeout);
+
+ this.set('list', true);
+ this.set('icon', false);
+ this.set('search', false);
+ this.set('active', true);
+ } else {
+
+ this.timer = setTimeout(function () {
+ SDL.InteractionChoicesView.deactivate("TIMED_OUT");
+ }, message.params.timeout);
+ }
+ }
+
+ },
+
+ /**
+ * Deactivate window
+ */
+ deactivate: function (result, choiceID) {
+
+ if (SDL.SDLModel.performInteractionSession.length > 0 && result != "ABORTED") {
+ this.timerUpdate();
+ } else {
+
+ clearTimeout(this.timer);
+ this.timer = null;
+ this.set('active', false);
+ SDL.SDLController.VRMove();
+ SDL.Keyboard.deactivate();
+
+ switch (result) {
+ case "ABORTED":
+ {
+ SDL.SDLController.interactionChoiseCloseResponse(this.appID, SDL.SDLModel.resultCode["ABORTED"]);
+ break;
+ }
+ case "TIMED_OUT":
+ {
+ SDL.SDLController.interactionChoiseCloseResponse(this.appID, SDL.SDLModel.resultCode["TIMED_OUT"]);
+ break;
+ }
+ case "SUCCESS":
+ {
+ SDL.SDLController.interactionChoiseCloseResponse(this.appID, SDL.SDLModel.resultCode["SUCCESS"], choiceID, this.input.value);
+ break;
+ }
+ default:
+ {
+ // default action
+ }
+ }
+
+ this.appID = null;
+
+ SDL.SDLController.onSystemContextChange();
+ }
+ },
+
+ /**
+ * Clean choices caption and list before new proform
+ */
+ clean: function () {
+
+ this.input.set('value', null);
+ this.set('captionText.content', 'Interaction Choices');
+ this.set('timeout', null);
+ this.listOfChoices.items = [];
+ this.listOfChoices.list.refresh();
+ var length = this.get('listWrapper.naviChoises.childViews').length;
+ for (var i=0; i < length; i++) {
+ SDL.InteractionChoicesView.get('listWrapper.naviChoises.childViews').shiftObject();
+ }
+ },
+
+ /**
+ * Update choises list with actual set id
+ *
+ * @param data:
+ * Array
+ */
+ preformChoices: function (data, timeout) {
+
+ this.set('timeout', timeout);
+
+ if (data) {
+
+ // temp for testing
+ for (var i = 0; i < data.length; i++) {
+ this.listOfChoices.items
+ .push({
+ type: SDL.Button,
+ params: {
+ text: data[i].menuName,
+ choiceID: data[i].choiceID,
+ action: 'onChoiceInteraction',
+ onDown: false,
+ target: 'SDL.SDLAppController',
+ templateName: data[i].image ? 'rightIcon' : 'text',
+ icon: data[i].image ? data[i].image.value : null
+ }
+ });
+ }
+
+ this.listOfChoices.list.refresh();
+ }
+
+ var self = this;
+
+ clearTimeout(this.timer);
+ this.timer = setTimeout(function () {
+
+ self.deactivate("TIMED_OUT");
+ }, timeout);
+ },
+
+ /**
+ * Update choises list with actual set id
+ *
+ * @param data:
+ * Array
+ */
+ preformChoicesNavigation: function (data, timeout) {
+
+ this.set('timeout', timeout);
+
+ if (data) {
+
+ // temp for testing
+ for (var i = 0; i < data.length; i++) {
+ this.get('listWrapper.naviChoises.childViews').pushObject(SDL.Button.create({
+ text: data[i].menuName,
+ choiceID: data[i].choiceID,
+ action: 'onChoiceInteraction',
+ onDown: false,
+ target: 'SDL.SDLAppController',
+ templateName: data[i].image ? 'rightIcon' : 'text',
+ icon: data[i].image ? data[i].image.value : null
+ })
+ );
+ }
+
+ }
+
+ var self = this;
+
+ setTimeout(function(){
+
+ SDL.SDLModel.interactionListWrapper.refresh();
+ }, 0);
+
+ clearTimeout(this.timer);
+ this.timer = setTimeout(function () {
+ self.deactivate("TIMED_OUT");
+ }, timeout);
+ }
+});
diff --git a/src/components/HMI/app/view/sdl/shared/keyboard.js b/src/components/HMI/app/view/sdl/shared/keyboard.js
new file mode 100644
index 0000000000..e47cc5956a
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/keyboard.js
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.Keyboard
+ * @desc Slider visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/keyboard.js
+ * @version 1.0
+ */
+
+SDL.Keyboard = SDL.SDLAbstractView.create({
+
+ elementId: 'keyboard_view',
+
+ childViews: [
+ 'backButton',
+ 'microphone',
+ 'searchBar',
+ 'controlls',
+ 'buttonsAreaQWERTY',
+ 'buttonsAreaQWERTZ',
+ 'buttonsAreaAZERTY'
+ ],
+
+ /**
+ * Activate keyboard method
+ *
+ * @param {Object}
+ */
+ activate: function( element ) {
+ if( element.tagName === 'input' ){
+
+ this.set( 'active', true );
+ this.set('target', element);
+ }
+ },
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'back-button'
+ ],
+ action: function() {
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.activeRequests.uiPerformInteraction && !SDL.InteractionChoicesView.active) {
+ FFW.UI.OnKeyboardInput("", "ENTRY_CANCELLED");
+ SDL.InteractionChoicesView.deactivate("ABORTED");
+ }
+ SDL.Keyboard.deactivate();
+ },
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ /**
+ * Extend deactivate method send SUCCESS response on deactivate with current
+ * slider value
+ */
+ deactivate: function () {
+
+ this._super();
+ this.searchBar.input.set('value', null);
+ this.set('target', null);
+ },
+
+ inputChanges: function (element) {
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.activeRequests.uiPerformInteraction) {
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction");
+ }
+
+ if (this.searchBar.input.value == null) {
+ this.searchBar.input.set('value', "");
+ }
+
+ switch (element.text) {
+ case "Space": {
+ this.searchBar.input.set('value', this.searchBar.input.value + " ");
+ this.target.set('value', this.searchBar.input.value);
+ break;
+ }
+ case "Search": {
+ if (this.target.value == null) {
+ this.target.set('value', "");
+ }
+ this.target.search();
+ this.deactivate();
+ break;
+ }
+ default:{
+ this.searchBar.input.set('value', this.searchBar.input.value + element.text);
+ this.target.set('value', this.searchBar.input.value);
+ }
+
+ }
+ },
+
+ clearBtn: function (element) {
+ this.searchBar.input.set('value', this.searchBar.input.value.slice(0, -1));
+ this.target.set('value', this.searchBar.input.value);
+ if (this.searchBar.input.value == "") {
+ FFW.UI.OnKeyboardInput("", "ENTRY_CANCELLED");
+ }
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.PerformInteraction");
+ },
+
+ /**
+ * Tearget element that initiated keyboard
+ */
+ target: null,
+
+ microphone: SDL.Button.extend({
+ classNames: 'microphone',
+ text: 'mic'
+ }),
+
+ searchBar: Em.ContainerView.extend({
+
+ classNames: 'searchBar',
+
+ childViews: [
+ 'input',
+ 'clearBtn',
+ 'serchIcon'
+ ],
+
+ clearBtn: SDL.Button.extend({
+ classNames: 'clearBtn',
+ text: 'X',
+ action: 'clearBtn',
+ target: 'parentView.parentView'
+ }),
+
+ serchIcon: Em.View.extend({
+ classNames: 'serchIcon'
+ }),
+
+ input: Ember.TextField.extend({
+ elementId: "keyboardInput",
+ classNames: "keyboardInput",
+ valueBinding: 'SDL.SDLModel.keyboardInputValue'
+ })
+
+ }),
+
+ controlls: Em.ContainerView.extend({
+
+ classNames: 'controlls',
+
+ childViews: [
+ 'numericBtn',
+ 'symbolBtn',
+ 'spaceBtn',
+ 'caseSwitchBtn',
+ 'localisationBtn',
+ 'searchBtn'
+ ],
+
+ numericBtn: SDL.Button.extend({
+ classNames: 'numericBtn controll',
+ text: '123'
+ }),
+
+ symbolBtn: SDL.Button.extend({
+ classNames: 'symbolBtn controll',
+ text: '!@#'
+ }),
+
+ spaceBtn: SDL.Button.extend({
+ classNames: 'spaceBtn controll',
+ text: 'Space',
+ target : 'parentView.parentView',
+ action : 'inputChanges'
+ }),
+
+ caseSwitchBtn: SDL.Button.extend({
+ classNames: 'caseSwitchBtn controll',
+ text: 'ABC'
+ }),
+
+ localisationBtn: SDL.Button.extend({
+ classNames: 'localisationBtn controll',
+ icon: 'images/info/info_leftMenu_apps_ico.png'
+ }),
+
+ searchBtn: SDL.Button.extend(SDL.PresetEvents, {
+ classNames: 'searchBtn controll',
+ text: 'Search',
+ click: function(){
+ this.get('parentView.parentView').inputChanges(this);
+ },
+ presetName: 'SEARCH'
+ })
+ }),
+
+ disableButtons: function(){
+
+ if (SDL.SDLAppController.model) {
+ if (!SDL.SDLAppController.model.globalProperties.keyboardProperties) {
+ return;
+ }
+ var list = SDL.SDLAppController.model.globalProperties.keyboardProperties.limitedCharacterList ? SDL.SDLAppController.model.globalProperties.keyboardProperties.limitedCharacterList : [];
+
+ for (var i = 0; i < list.length; i++) {
+ list[i] = list[i].toLowerCase();
+ }
+
+ if (SDL.SDLAppController.model && list.length){
+
+ for (var i = 0; i < this.buttonsAreaQWERTY._childViews.length; i++) {
+
+ if (list.indexOf(this.buttonsAreaQWERTY._childViews[i].text) < 0) {
+ this.buttonsAreaQWERTY._childViews[i].set('disabled', true);
+ this.buttonsAreaQWERTZ._childViews[i].set('disabled', true);
+ this.buttonsAreaAZERTY._childViews[i].set('disabled', true);
+ } else {
+ this.buttonsAreaQWERTY._childViews[i].set('disabled', false);
+ this.buttonsAreaQWERTZ._childViews[i].set('disabled', false);
+ this.buttonsAreaAZERTY._childViews[i].set('disabled', false);
+ }
+ }
+ } else if (SDL.SDLAppController.model && !list.length) {
+ for (var i = 0; i < this.buttonsAreaQWERTY._childViews.length; i++) {
+ this.buttonsAreaQWERTY._childViews[i].set('disabled', false);
+ }
+ }
+ }
+
+ }.observes('SDL.SDLAppController.model.globalProperties.keyboardProperties.limitedCharacterList.@each'),
+
+ buttonsAreaQWERTY: SDL.QWERTYLayout.create({
+
+ classNameBindings: 'this.pQWERTY::hide',
+
+ pQWERTY: function(){
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout == "QWERTY") {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout')
+
+ }),
+
+ buttonsAreaQWERTZ: SDL.QWERTZLayout.create({
+
+ classNameBindings: 'this.pQWERTZ::hide',
+
+ pQWERTZ: function(){
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout == "QWERTZ") {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout')
+
+ }),
+
+ buttonsAreaAZERTY: SDL.AZERTYLayout.create({
+
+ classNameBindings: 'this.pAZERTY::hide',
+
+ pAZERTY: function(){
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout == "AZERTY") {
+ return true;
+ } else {
+ return false;
+ }
+ }.property('SDL.SDLAppController.model.globalProperties.keyboardProperties.keyboardLayout')
+
+ })
+
+});
diff --git a/src/components/HMI/app/view/sdl/shared/optionsView.js b/src/components/HMI/app/view/sdl/shared/optionsView.js
new file mode 100644
index 0000000000..a4858255a5
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/optionsView.js
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.OptionsView
+ * @desc Options visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/optionsView.js
+ * @version 1.0
+ */
+
+SDL.OptionsView = SDL.SDLAbstractView.create({
+
+ elementId: 'sdl_options',
+
+ childViews:
+ [
+ 'backButton',
+ 'captionText',
+ 'commands'
+ ],
+
+ // Menu caption text
+ captionBinding: 'SDL.SDLAppController.model.currentSubMenuLabel',
+
+ commands: SDL.List.extend({
+
+ elementId: 'info_nonMedia_options_list',
+
+ itemsOnPage: 5,
+
+ items: [],
+
+ /*
+ * itemsDefault: [ { type: SDL.Button,
+ *
+ * params: { templateName: 'text', text: 'Exit', target:
+ * 'this.parentView.parentView.parentView', action: 'deactivate',
+ * onDown: false } }, { type: SDL.Button,
+ *
+ * params: { templateName: 'arrow', text: 'Device Information', } } ],
+ */
+
+ refreshItems: function() {
+
+ if (SDL.SDLAppController.model) {
+
+ var commands = SDL.SDLAppController.model.get('currentCommandsList'),
+ i,
+ len,
+ template;
+
+ this.items = [];
+
+ len = commands.length;
+
+ for(i = 0; i < len; i++){
+
+ if(commands[i].menuID >= 0){
+ template = 'arrow';
+ }else{
+ template = commands[i].icon ? 'rightText' : 'text';
+ }
+
+ this.items.push({
+ type: SDL.Button,
+ params: {
+ templateName: template,
+ text: commands[i].name,
+ commandID: commands[i].commandID,
+ menuID: commands[i].menuID,
+ icon: commands[i].icon,
+ target: 'SDL.SDLAppController',
+ action: 'onCommand',
+ onDown: false
+ }
+ })
+ }
+
+ this.list.refresh();
+ }
+
+ }.observes('SDL.SDLAppController.model.currentSubMenuId', 'SDL.SDLAppController.model.currentCommandsList.@each')
+ }),
+
+ activate: function(text) {
+ this._super();
+
+ SDL.SDLAppController.buttonsSort('top', SDL.SDLAppController.model.appID);
+ SDL.OptionsView.commands.refreshItems();
+
+ SDL.SDLController.onSystemContextChange();
+ },
+
+ // Extend deactivate window
+ deactivate: function() {
+
+ if (SDL.SDLAppController.model) {
+
+ if (SDL.SDLAppController.model.get('currentSubMenuId') >= 0) {
+ SDL.SDLAppController.onSubMenu('top');
+ }else{
+ this._super();
+ SDL.SDLController.onSystemContextChange();
+ }
+ }
+
+ }
+});
diff --git a/src/components/HMI/app/view/sdl/shared/scrollableMessage.js b/src/components/HMI/app/view/sdl/shared/scrollableMessage.js
new file mode 100644
index 0000000000..3c42378749
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/scrollableMessage.js
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.ScrollableMessage
+ * @desc ScrollableMessage module visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/scrollableMessage.js
+ * @version 1.0
+ */
+
+SDL.ScrollableMessage = SDL.SDLAbstractView.create({
+
+ elementId: 'ScrollableMessage',
+
+ classNames: 'ScrollableMessage',
+
+ classNameBindings: [
+ 'active:active'
+ ],
+
+ /**
+ * Id of current request
+ *
+ * @type {Number}
+ */
+ messageRequestId: null,
+
+ active: false,
+
+ appID: null,
+
+ timer: null,
+
+ timeout: null,
+
+ childViews: [
+ 'backButton', 'captionText', 'softButtons', 'listOfCommands'
+ ],
+
+ /**
+ * Deactivate View
+ *
+ * @param {Object} ABORTED Parameter to indicate status for
+ * UI.ScrollableMessageResponse
+ */
+ deactivate: function (ABORTED) {
+ clearTimeout(this.timer);
+ this.set('active', false);
+ this.softButtons.set('page', 0);
+
+ this.timeout = null;
+
+ SDL.SDLController.scrollableMessageResponse(ABORTED ? SDL.SDLModel.resultCode['ABORTED'] : SDL.SDLModel.resultCode['SUCCESS'], this.messageRequestId);
+
+ SDL.SDLController.onSystemContextChange();
+ },
+
+ activate: function (appName, params, messageRequestId) {
+ if (appName) {
+
+ var self = this;
+
+ if (params.messageText.fieldName == 'scrollableMessageBody') {
+ this.set('listOfCommands.items', params.messageText.fieldText);
+ }
+
+ this.set('messageRequestId', messageRequestId);
+ this.set('captionText.content', appName);
+ this.softButtons.addItems(params.softButtons, params.appID);
+ this.set('active', true);
+ clearTimeout(this.timer);
+ this.timeout = params.timeout;
+ this.timer = setTimeout(function () {
+ self.deactivate();
+ }, params.timeout);
+ }
+ },
+
+ softButtons: SDL.MenuList.extend({
+
+ itemsOnPage: 4,
+
+ groupName: "ScrollableMessage",
+
+ content: Em.ContainerView.extend({
+
+ classNames: [
+ 'content'
+ ],
+
+ attributeBindings: [
+ 'parentView.contentPositon:style'
+ ]
+
+ })
+ }),
+
+ /**
+ * List for option on SDLOptionsView screen
+ */
+ listOfCommands: SDL.ScrollableText.extend({
+
+ elementId: 'scrollable_message_list',
+
+ itemsOnPage: 11,
+
+ /** Items array */
+ items: 'asdasdasd',
+
+ /**
+ * Reset timeout function
+ */
+ click: function(){
+
+ var self = this._parentView;
+
+ clearTimeout(this._parentView.timer);
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.ScrollableMessage");
+ this._parentView.timer = setTimeout(function () {
+ self.deactivate();
+ }, this._parentView.timeout);
+ }
+ })
+});
diff --git a/src/components/HMI/app/view/sdl/shared/sliderView.js b/src/components/HMI/app/view/sdl/shared/sliderView.js
new file mode 100644
index 0000000000..033ab5ab91
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/sliderView.js
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.SliderView
+ * @desc Slider visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/sliderView.js
+ * @version 1.0
+ */
+
+SDL.SliderView = SDL.SDLAbstractView.create( {
+
+ elementId: 'slider_view',
+
+ childViews:
+ [
+ 'backButton',
+ 'okButton',
+ 'captionText',
+ 'headerLabel',
+ 'footerLabel',
+ 'adjustControl'
+ ],
+
+ headerLabel: SDL.Label.extend( {
+ classNames: 'slider-header',
+ content: 'Header Label'
+ } ),
+
+ footerLabel: SDL.Label.extend( {
+ classNames: 'slider-footer',
+ content: 'Footer Label',
+ data: []
+ } ),
+
+ /**
+ * Identifier of current request
+ */
+ sliderRequestId: null,
+
+ timer: null,
+
+ timeout: null,
+
+ /**
+ * Extend deactivate method send SUCCESS response on deactivate with current
+ * slider value
+ */
+ deactivate: function(timeout) {
+ this._super();
+ this.timeout = null;
+ clearTimeout(this.timer);
+ this.timer = null;
+
+ if (timeout === true) {
+ FFW.UI.sendSliderResult(SDL.SDLModel.resultCode["TIMED_OUT"], this.get('sliderRequestId'));
+ } else if (timeout === false) {
+ FFW.UI.sendSliderResult(SDL.SDLModel.resultCode["SUCCESS"], this.get('sliderRequestId'), this.get('adjustControl.sliderValue.value'));
+ } else {
+ FFW.UI.sendSliderResult(SDL.SDLModel.resultCode["ABORTED"], this.get('sliderRequestId'), this.get('adjustControl.sliderValue.value'));
+ }
+
+ SDL.SDLController.onSystemContextChange();
+ },
+
+ activate: function(text, timeout) {
+ if( text ){
+ this.set( 'caption', text );
+ }
+
+ this.set( 'active', true );
+
+ this.set('timeout', timeout);
+
+ this.timer = setTimeout(function () {
+ if (SDL.SliderView.active) {
+ SDL.SliderView.deactivate(true);
+ }
+ }, timeout);
+ },
+
+ dataChange: function(){
+ if (this.timeout){
+ var self = this;
+
+ clearTimeout(this.timer);
+ SDL.SDLController.onResetTimeout(SDL.SDLAppController.model.appID, "UI.Slider");
+ this.timer = setTimeout(function () {
+ self.deactivate(true);
+ }, this.timeout);
+ }
+ }.observes('this.adjustControl.sliderValue.value'),
+
+ okButton: SDL.Button.extend( {
+ classNames: 'okButton',
+ text: 'Submit',
+ onDown: false,
+ click: function() {
+ SDL.SliderView.deactivate(false);
+ }
+ } ),
+
+ adjustControl: Em.ContainerView.extend( {
+
+ classNames: 'sliderControl',
+
+ childViews:
+ [
+ 'minusBtn',
+ 'led',
+ 'plusBtn'
+ ],
+
+ sliderValue: Em.Object.create( {
+ range: 10,
+ value: 0
+ } ),
+
+ minusBtn: SDL.Button.extend( {
+ classNames: 'control minus',
+ icon: 'images/common/minus-ico.png',
+ actionDown: function() {
+ this._super();
+ if (this._parentView.sliderValue.value > 1) {
+ this.set( 'parentView.sliderValue.value', this._parentView.sliderValue.value - 1 );
+ }
+ }
+ } ),
+
+ led: SDL.Indicator.create( {
+ classNames: 'ledContainer ico',
+ contentBinding: 'parentView.sliderValue',
+ indActiveClass: 'led',
+ indDefaultClass: 'led-inactive'
+ } ),
+
+ plusBtn: SDL.Button.extend( {
+ classNames: 'control plus',
+ icon: 'images/common/plus-ico.png',
+ actionDown: function() {
+ this._super();
+ if (this._parentView.sliderValue.value < this._parentView.sliderValue.range) {
+ this.set( 'parentView.sliderValue.value', this._parentView.sliderValue.value + 1 );
+ }
+ }
+ } )
+ } ),
+
+ loadData: function( message ) {
+
+ var data = message.params;
+
+ this.set( 'sliderRequestId', message.id );
+
+ this.set( 'headerLabel.content', data.sliderHeader );
+ this.get( 'adjustControl.sliderValue' ).set( 'range', data.numTicks );
+ this.get( 'adjustControl.sliderValue' ).set( 'value', data.position );
+
+ setTimeout( function() {
+ SDL.SliderView.adjustControl.rerender();
+ }, 1 );
+
+ if (!data.sliderFooter) {
+ this.set('footerLabel.content', '');
+ return;
+ }
+
+ this.footerLabel.data = data.sliderFooter;
+
+ if (data.sliderFooter.length != data.numTicks) {
+ this.set( 'footerLabel.content', data.sliderFooter[0] );
+ } else {
+ // Magick number is array index correction
+ this.set( 'footerLabel.content', data.sliderFooter[data.position - 1] );
+ }
+ },
+
+ /**
+ * Change footer text depends on current slider position works only for
+ * dynamic footer mode
+ */
+ changeFooterText: function() {
+ if( this.footerLabel.data && this.footerLabel.data.length > 1 ){
+ this.set( 'footerLabel.content', this.footerLabel.data[this.adjustControl.sliderValue.value - 1] );
+ }
+ }.observes( 'adjustControl.sliderValue.value' )
+} );
diff --git a/src/components/HMI/app/view/sdl/shared/tbtTurnList.js b/src/components/HMI/app/view/sdl/shared/tbtTurnList.js
new file mode 100644
index 0000000000..6c5a5588c5
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/tbtTurnList.js
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.TBTTurnList
+ * @desc TBT Turn List visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/tbtTurnList.js
+ * @version 1.0
+ */
+
+SDL.TBTTurnList = SDL.SDLAbstractView.create({
+
+ elementId: 'tbtTurnListView',
+
+ childViews: [
+ 'backButton',
+ 'captionText',
+ 'tbtTurnListList'
+ ],
+
+ /**
+ * Activate window
+ */
+ activate: function (appID) {
+
+ this.set('active', true);
+ this.updateList(appID);
+ },
+
+ /**
+ * Deactivate window if TurnByTurnView window was closed
+ */
+ closeTurnList: function () {
+
+ if (!SDL.TurnByTurnView.get('activeTBT')) {
+ this.set('active', false);
+ }
+ }.observes('SDL.TurnByTurnView.activeTBT'),
+
+ /**
+ * Title Labes of window
+ */
+ captionText: SDL.Label.extend({
+ classNames: 'caption-text',
+
+ content: 'Turn List'
+ }),
+
+ /**
+ * Turn List
+ */
+ tbtTurnListList: SDL.List.extend({
+ elementId : 'tbtTurnListList',
+ itemsOnPage: 5,
+ items : []
+ }),
+
+ /**
+ * Function updates content of Turn List with data from application's
+ * model
+ *
+ * @type {Number}
+ */
+ updateList: function (appID) {
+
+ this.get('tbtTurnListList.list').removeAllChildren();
+
+ this.tbtTurnListList.list.refresh();
+
+ var turnListArray = SDL.SDLController.getApplicationModel(appID).turnList,
+ length = turnListArray.length;
+ for (var i = 0; i < length; i++) {
+ this.get('tbtTurnListList.list.childViews').pushObject(SDL.Label.create({
+ icon : turnListArray[i].turnIcon ? turnListArray[i].turnIcon.value : "",
+ content : turnListArray[i].navigationText ? turnListArray[i].navigationText.fieldText : "",
+ classNames : 'list-item',
+ templateName: turnListArray[i].turnIcon ? 'icon' : ''
+ }));
+ }
+
+ turnListArray = SDL.SDLController.getApplicationModel(appID).turnListSoftButtons;
+ length = turnListArray.length;
+
+ for (var i = 0; i < length; i++) {
+ this.get('tbtTurnListList.list.childViews').pushObject(SDL.Button.create(SDL.PresetEventsCustom, {
+ systemAction : turnListArray[i].systemAction,
+ groupName : "TBTList",
+ classNameBindings: [
+ 'isHighlighted:isHighlighted'
+ ],
+ isHighlighted : turnListArray[i].isHighlighted ? true : false,
+ softButtonID : turnListArray[i].softButtonID,
+ icon : turnListArray[i].image ? turnListArray[i].image.value : "",
+ text : turnListArray[i].text,
+ classNames : 'list-item softButton',
+ elementId : 'softButton' + i,
+ templateName : turnListArray[i].image ? 'rightIcon' : 'text',
+ appID : appID
+ }));
+ }
+ }
+ });
diff --git a/src/components/HMI/app/view/sdl/shared/turnByTurnView.js b/src/components/HMI/app/view/sdl/shared/turnByTurnView.js
new file mode 100644
index 0000000000..1cb7ddfad0
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/shared/turnByTurnView.js
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.TurnByTurnView
+ * @desc TurnByTurnView module visual representation
+ * @category View
+ * @filesource app/view/sdl/shared/turnByTurnView.js
+ * @version 1.0
+ */
+
+SDL.TurnByTurnView = SDL.SDLAbstractView.create( {
+
+ elementId: 'TurnByTurnView',
+
+ classNames: 'TurnByTurnView',
+
+ classNameBindings: [
+ 'activeTBT:active_state:inactive_state'
+ ],
+
+ active: false,
+
+ activeTBT: false,
+
+ childViews: [
+ 'captionText',
+ 'softButtons',
+ 'totalDistanceLabel',
+ 'etaLabel',
+ 'turnList',
+ 'homeScreen',
+ 'navigationText2',
+ 'turnIconImage',
+ 'nextTurnIconImage',
+ 'distanceToManeuver',
+ 'distanceToManeuverScale',
+ 'timeToDestination'
+ ],
+
+ appID: -1,
+ navigationText2: null,
+ eta: null,
+ totalDistance: null,
+ turnIcon: null,
+ nextturnIcon: null,
+ distanceToManeuver: null,
+ distanceToManeuverScale: null,
+ timeToDestination: null,
+ maneuverComplete: null,
+
+ activate: function(appID) {
+
+ var naviParams = SDL.SDLController.getApplicationModel(appID).constantTBTParams;
+
+ if (naviParams) {
+
+ for ( var i = 0; i < naviParams.navigationTexts.length; i++) {
+ switch (naviParams.navigationTexts[i].fieldName) {
+ case 'navigationText1': {
+ this.set('captionText.content',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'navigationText2': {
+ this.set('navigationText2',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'ETA': {
+ this.set('eta', naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ case 'totalDistance': {
+ this.set('totalDistance',
+ naviParams.navigationTexts[i].fieldText);
+ break;
+ }
+ }
+ }
+
+ this.softButtons.addItems(naviParams.softButtons, appID);
+
+ if (naviParams.maneuverComplete) {
+ this.set('maneuverComplete', naviParams.maneuverComplete);
+ }
+
+ this.set('appID', naviParams.appID);
+
+ if (naviParams.turnIcon) {
+
+ this.set('turnIcon', naviParams.turnIcon.value);
+ }
+
+ if (naviParams.nextTurnIcon) {
+
+ this.set('nextTurnIcon', naviParams.nextTurnIcon.value);
+ }
+ this.set('distanceToManeuver', naviParams.distanceToManeuver);
+ this.set('distanceToManeuverScale', naviParams.distanceToManeuverScale);
+ this.set('timeToDestination', naviParams.timeToDestination);
+
+ this.set('activeTBT', true);
+ }
+ },
+
+ /**
+ * Deactivate View
+ */
+ deactivate: function() {
+
+ this.set('activeTBT', false);
+ },
+
+ totalDistanceLabel: SDL.Label.extend( {
+ classNames: 'totalDistanceLabel',
+ contentBinding: 'parentView.totalDistance'
+ }),
+
+ distanceToManeuverScale: SDL.Label.extend( {
+ classNames: 'distanceToManeuverScale',
+ contentBinding: 'parentView.distanceToManeuverScale'
+ }),
+
+ distanceToManeuver: SDL.Label.extend( {
+ classNames: 'distanceToManeuver',
+ contentBinding: 'parentView.distanceToManeuver'
+ }),
+
+ timeToDestination: SDL.Label.extend( {
+ classNames: 'timeToDestination',
+ contentBinding: 'parentView.timeToDestination'
+ }),
+
+ etaLabel: SDL.Label.extend( {
+ classNames: 'etaLabel',
+ contentBinding: 'parentView.eta'
+ }),
+
+ turnList: SDL.Button.create( {
+ elementID: 'turnList',
+ classNames: 'turnList btn',
+ text: 'Turn List',
+ action: function() {
+
+ SDL.SDLController.tbtTurnList(this._parentView.appID);
+ },
+ target: '',
+ onDown: false,
+ templateName: 'arrow'
+ }),
+
+ turnIconImage: Em.View.create( {
+ classNames: 'turnIcon btn',
+ attributeBindings: [
+ 'style'
+ ],
+ style: function() {
+
+ if (this._parentView.turnIcon) {
+ return 'background-image: URL(' + this._parentView.turnIcon
+ + ');';
+ } else {
+ return '';
+ }
+ }.property('this.parentView.turnIcon')
+ }),
+
+ nextTurnIconImage: Em.View.create( {
+ classNames: 'nextTurnIcon btn',
+ attributeBindings: [
+ 'style'
+ ],
+ style: function() {
+
+ if (this._parentView.nextTurnIcon) {
+ return 'background-image: URL(' + this._parentView.nextTurnIcon
+ + ');';
+ } else {
+ return '';
+ }
+ }.property('this.parentView.nextTurnIcon')
+ }),
+
+ navigationText2: SDL.Label.extend( {
+ classNames: 'navigationText2',
+ contentBinding: 'parentView.navigationText2'
+ }),
+
+ homeScreen: SDL.Button.create( {
+ elementId: 'homeScreen',
+ classNames: 'homeScreen btn',
+ text: 'Home Screen',
+ iconBinding: 'SDL.SDLAppController.model.appIcon',
+ target: 'this.parentView',
+ action: 'deactivate',
+ onDown: false
+ }),
+
+ softButtons: SDL.MenuList.extend( {
+
+ itemsOnPage: 3,
+
+ groupName: "TurnByTurnView",
+
+ content: Em.ContainerView.extend( {
+
+ classNames: [
+ 'content'
+ ]
+
+ })
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/sdl/tbtClientStateView.js b/src/components/HMI/app/view/sdl/tbtClientStateView.js
new file mode 100644
index 0000000000..2d2571d372
--- /dev/null
+++ b/src/components/HMI/app/view/sdl/tbtClientStateView.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.TBTClientStateView
+ * @desc TBTClientStateView module visual representation
+ * @category View
+ * @filesource app/view/sdl/TBTClientStateView.js
+ * @version 1.0
+ */
+
+SDL.TBTClientStateView = Em.ContainerView.create( {
+
+ elementId: 'tbtClientStateView',
+
+ classNames: 'tbtClientStateView',
+
+ classNameBindings:
+ [
+ 'active'
+ ],
+
+ childViews:
+ [
+ 'tbtClientStateLabel',
+ 'tbtClientState',
+ 'tbtClientStateSelect'
+ ],
+
+ /**
+ * Title of VehicleInfo PopUp view
+ */
+ tbtClientStateLabel: SDL.Label.extend( {
+
+ elementId: 'tbtClientStateLabel',
+
+ classNames: 'tbtClientStateLabel',
+
+ content: 'TBT Client State'
+ } ),
+
+ /**
+ * Property indicates the activity state of TBTClientStateView
+ */
+ active: false,
+
+ /**
+ * Title of tbtClientState group of parameters
+ */
+ tbtClientState: SDL.Label.extend( {
+
+ elementId: 'tbtClientState',
+
+ classNames: 'tbtClientState',
+
+ content: 'Client State'
+ } ),
+
+ /**
+ * HMI element Select with parameters of TBTClientStates
+ */
+ tbtClientStateSelect: Em.Select.extend( {
+
+ elementId: 'tbtClientStateSelect',
+
+ classNames: 'tbtClientStateSelect',
+
+ contentBinding: 'SDL.SDLModel.tbtClientStates',
+
+ optionValuePath: 'content.id',
+
+ optionLabelPath: 'content.name',
+
+ /**
+ * Selected data sent on model for further processing
+ */
+ click: function() {
+
+ SDL.SDLController.tbtClientStateSelected( this.selection.name );
+
+ }
+ } ),
+
+ /**
+ * Trigger function that activates and deactivates tbtClientStateView
+ */
+ toggleActivity: function() {
+ this.toggleProperty( 'active' );
+ }
+} ); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/appPermissionsListView.js b/src/components/HMI/app/view/settings/policies/appPermissionsListView.js
new file mode 100644
index 0000000000..4fc83ad261
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/appPermissionsListView.js
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.AppPermissionsListView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_appPermissionsList',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.appPermissionsList.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'appList',
+ 'label'
+ ],
+
+ globalConfigurationValue: false,
+
+ globalConfigurationMessage: function() {
+ if (this.globalConfigurationValue === true) {
+ return "All devices Allowed";
+ } else if (this.globalConfigurationValue === false) {
+ return "All devices Not Allowed";
+ } else {
+ return "All devices manual Configuration";
+ }
+ }.property('this.globalConfigurationValue'),
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ classNames: 'label',
+
+ content: 'Choose devices to be allowed for SDL functionality:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ /**
+ * Function to add application to application list
+ */
+ showAppList: function() {
+
+ this.get('appList.list').removeAllChildren();
+
+ this.appList.list.refresh();
+
+ var i,
+ appIndex,
+ apps = SDL.SDLModel.registeredApps
+ len = apps.length;
+
+ for (i = 0; i < len; i++) {
+
+ appIndex = SDL.SDLModel.registeredApps.indexOf(apps[i]);
+
+ this.get('appList.list.childViews').pushObject(SDL.Button.create( {
+ action: 'GetListOfPermissions',
+ target: 'SDL.SettingsController',
+ text: apps[i].appName,
+ appID: apps[i].appID,
+ classNames: 'list-item button',
+ iconBinding: 'SDL.SDLModel.registeredApps.' + appIndex
+ + '.appIcon'
+ }));
+ }
+
+ this.appList.list.refresh();
+
+ },
+
+ appList: SDL.List.extend( {
+
+ elementId: 'polocies_app_permissions_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: new Array()
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/appPermissionsView.js b/src/components/HMI/app/view/settings/policies/appPermissionsView.js
new file mode 100644
index 0000000000..165ae90008
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/appPermissionsView.js
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.AppPermissionsView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_appPermissions',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.appPermissions.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'appList',
+ 'label'
+ ],
+
+ currentAppId: null,
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ classNames: 'label',
+
+ content: 'Choose devices to be allowed for SDL functionality:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: function(element){
+
+ SDL.SettingsController.onState(element);
+
+ var permissions = [];
+
+ for (var i = 0; i < SDL.AppPermissionsView.appList.list._childViews.length; i++) {
+ permissions.push({
+ "name": SDL.AppPermissionsView.appList.list._childViews[i].name,
+ "id": SDL.AppPermissionsView.appList.list._childViews[i].id,
+ "allowed": SDL.AppPermissionsView.appList.list._childViews[i].allowed
+ });
+ }
+
+ FFW.BasicCommunication.OnAppPermissionConsent(permissions, "GUI", SDL.AppPermissionsView.currentAppId);
+
+ SDL.AppPermissionsView.currentAppId = null;
+ },
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ /**
+ * Function to add application to application list
+ */
+ update: function(message, appID) {
+
+ SDL.AppPermissionsView.currentAppId = appID;
+
+ this.appList.items = [];
+
+ for (var i = 0; i < message.length; i++) {
+
+ var text = " - Undefined";
+
+ if (message[i].allowed === true) {
+ text = " - Allowed";
+ } else if (message[i].allowed === false) {
+ text = " - Not allowed";
+ }
+
+ this.appList.items.push({
+ type: SDL.Button,
+ params: {
+ action: 'changeAppPermission',
+ target: 'SDL.SettingsController',
+ text: message[i].name + text,
+ name: message[i].name,
+ allowed: message[i].allowed,
+ id: message[i].id,
+ appID: appID
+ }
+ });
+ }
+
+ this.appList.list.refresh();
+
+ },
+
+ appList: SDL.List.extend( {
+
+ elementId: 'polocies_app_permissions_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: new Array()
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/deviceConfigView.js b/src/components/HMI/app/view/settings/policies/deviceConfigView.js
new file mode 100644
index 0000000000..37cb33d338
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/deviceConfigView.js
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.DeviceConfigView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_deviceConfig',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.deviceConfig.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'listOfDevices',
+ 'label'
+ ],
+
+ globalConfigurationValue: false,
+
+ globalConfigurationMessage: function() {
+ if (this.globalConfigurationValue === true) {
+ return "All devices Allowed";
+ } else if (this.globalConfigurationValue === false) {
+ return "All devices Not Allowed";
+ } else {
+ return "All devices manual Configuration";
+ }
+ }.property('this.globalConfigurationValue'),
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ elementId: 'label',
+
+ classNames: 'label',
+
+ content: 'Choose devices to be allowed for SDL functionality:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ /**
+ * Function to add application to application list
+ */
+ showDeviceList: function() {
+
+ this.listOfDevices.items = [];
+
+ this.listOfDevices.items.push({
+ type: SDL.Button,
+ params: {
+ action: 'allDeviceAccess',
+ target: 'SDL.SettingsController',
+ textBinding: 'SDL.DeviceConfigView.globalConfigurationMessage',
+ classNameBinding: 'SDL.DeviceConfigView.globalConfigurationValue:disabled'
+ }
+ });
+
+ var dev = SDL.SDLModel.connectedDevices;
+
+ for (var key in dev) {
+
+ if (dev.hasOwnProperty(key)) {
+
+ this.listOfDevices.items.push({
+ type: SDL.Button,
+ params: {
+ action: 'changeDeviceAccess',
+ target: 'SDL.SettingsController',
+ text: dev[key].allowed ? dev[key].name + " - Allowed" : dev[key].name + " - Not allowed",
+ name: dev[key].name,
+ id: dev[key].id
+ }
+ });
+ }
+ }
+
+ this.listOfDevices.list.refresh();
+
+ },
+
+ listOfDevices: SDL.List.extend( {
+
+ elementId: 'polocies_device_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: new Array()
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/deviceStateChangeView.js b/src/components/HMI/app/view/settings/policies/deviceStateChangeView.js
new file mode 100644
index 0000000000..44e61066bf
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/deviceStateChangeView.js
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.DeviceStateChangeView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_deviceStateChange',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.deviceStateChange.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'listOfDevices',
+ 'label'
+ ],
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ elementId: 'label',
+
+ classNames: 'label',
+
+ content: 'Choose devices to be Unpaired:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } ),
+
+ /**
+ * Function to add application to application list
+ */
+ showDeviceList: function() {
+
+ this.listOfDevices.items = [];
+
+ var dev = SDL.SDLModel.connectedDevices;
+
+ for (var key in dev) {
+
+ if (dev.hasOwnProperty(key)) {
+
+ this.listOfDevices.items.push({
+ type: SDL.Button,
+ params: {
+ action: 'OnDeviceStateChanged',
+ target: 'FFW.BasicCommunication',
+ text: dev[key].name,
+ deviceName: dev[key].name,
+ deviceID: dev[key].id
+ }
+ });
+ }
+ }
+
+ this.listOfDevices.list.refresh();
+
+ },
+
+ listOfDevices: SDL.List.extend( {
+
+ elementId: 'polocies_device_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: new Array()
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/statisticsInfoView.js b/src/components/HMI/app/view/settings/policies/statisticsInfoView.js
new file mode 100644
index 0000000000..52ae2847b9
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/statisticsInfoView.js
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.StatisticsInfoView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_status_info',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.statisticsInfo.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'label',
+ 'listSelect'
+ ],
+
+ /**
+ * HMI element Select with parameters of transmission state from VehicleInfo
+ * Model
+ */
+ listSelect: Em.Select.extend( {
+
+ elementId: 'listSelect',
+
+ classNames: 'listSelect',
+
+ contentBinding: 'SDL.SDLModel.settingsInfoList',
+
+ valueBinding: 'SDL.SDLModel.settingsInfoListState'
+ } ),
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ elementId: 'label',
+
+ classNames: 'label',
+
+ content: 'Choose devices to be allowed for SDL functionality:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } )
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policies/systemErrorView.js b/src/components/HMI/app/view/settings/policies/systemErrorView.js
new file mode 100644
index 0000000000..2ccae596cf
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policies/systemErrorView.js
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.DeviceConfigView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/policies/deviceConfigView.js
+ * @version 1.0
+ */
+
+SDL.SystemErrorView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings_system_error',
+
+ classNames: 'in_settings_separate_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.systemError.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'backButton',
+ 'label',
+ 'listSelect'
+ ],
+
+ /**
+ * HMI element Select with parameters of transmission state from VehicleInfo
+ * Model
+ */
+ listSelect: Em.Select.extend( {
+
+ elementId: 'systemErrorListSelect',
+
+ classNames: 'listSelect',
+
+ contentBinding: 'SDL.SDLModel.systemErrorList',
+
+ valueBinding: 'SDL.SDLModel.systemErrorListState'
+ } ),
+
+ /**
+ * Label in title
+ */
+ label: SDL.Label.extend( {
+
+ elementId: 'label',
+
+ classNames: 'label',
+
+ content: 'Send OnSystemError notification:'
+ }),
+
+ backButton: SDL.Button.extend( {
+ classNames:
+ [
+ 'backButton'
+ ],
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ goToState: 'policies',
+ icon: 'images/media/ico_back.png',
+ onDown: false
+ } )
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settings/policiesView.js b/src/components/HMI/app/view/settings/policiesView.js
new file mode 100644
index 0000000000..cb1b59be30
--- /dev/null
+++ b/src/components/HMI/app/view/settings/policiesView.js
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PoliciesSettingsView
+ * @desc Info Apps visual representation
+ * @category View
+ * @filesource app/view/settings/AppsView.js
+ * @version 1.0
+ */
+
+SDL.PoliciesView = Em.ContainerView.create( {
+
+ elementId: 'policies_settings',
+
+ classNames: 'in_settings_view',
+
+ classNameBindings: [
+ 'SDL.States.settings.policies.active:active_state:inactive_state'
+ ],
+
+ childViews: [
+ 'SettingsList'
+ ],
+
+ SettingsList: SDL.List.extend( {
+
+ elementId: 'policies_settings_list',
+
+ classNames: 'policies_settings_list',
+
+ itemsOnPage: 5,
+
+ /** Items */
+ items: [
+ {
+ type: SDL.Button,
+ params: {
+ goToState: 'policies.deviceConfig',
+ text: 'Allow SDL Functionality',
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ templateName: 'arrow',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Update SDL',
+ action: 'updateSDL',
+ target: 'SDL.SettingsController',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Policy table update status',
+ action: 'getStatusUpdate',
+ target: 'SDL.SettingsController',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Send request GetURLS',
+ action: 'getURLS',
+ target: 'SDL.SettingsController',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Statistics Info settings',
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ templateName: 'arrow',
+ goToState: 'policies.statisticsInfo',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'App permissions',
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ templateName: 'arrow',
+ goToState: 'policies.appPermissionsList',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Get list of permissions',
+ click: function () {
+ FFW.BasicCommunication.GetListOfPermissions();
+ },
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'Device state change',
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ templateName: 'arrow',
+ goToState: 'policies.deviceStateChange',
+ onDown: false
+ }
+ },
+ {
+ type: SDL.Button,
+ params: {
+ text: 'System Error',
+ action: 'onState',
+ target: 'SDL.SettingsController',
+ templateName: 'arrow',
+ goToState: 'policies.systemError',
+ onDown: false
+ }
+ }
+ ]
+ })
+}); \ No newline at end of file
diff --git a/src/components/HMI/app/view/settingsView.js b/src/components/HMI/app/view/settingsView.js
new file mode 100644
index 0000000000..956f75aaa2
--- /dev/null
+++ b/src/components/HMI/app/view/settingsView.js
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * · Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * · Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * · Neither the name of the Ford Motor Company nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.PlayerControllsView
+ * @desc Video player visual representation
+ * @category View
+ * @filesource app/view/player/PlayerView.js
+ * @version 1.0
+ */
+SDL.SettingsView = Em.ContainerView.create( {
+ /** View Id */
+ elementId: 'settingsView',
+
+ classNameBindings: [
+ 'SDL.States.settings.active:active_state:inactive_state'
+ ],
+
+ /** Settings components */
+ childViews:
+ [
+ 'leftMenu',
+ SDL.DeviceStateChangeView,
+ SDL.PoliciesView,
+ SDL.AppPermissionsListView,
+ SDL.AppPermissionsView,
+ SDL.DeviceConfigView,
+ SDL.StatisticsInfoView,
+ SDL.SystemErrorView
+ ],
+
+ /** Left menu */
+ leftMenu: Em.ContainerView.extend( {
+ elementId: 'settings_leftMenu',
+
+ classNameBindings:
+ [
+ 'parentView.controller.hiddenLeftMenu:hidden'
+ ],
+
+ classNames: 'menu-items',
+
+ childViews:
+ [
+ 'border',
+ 'items'
+ ],
+
+ border: Em.View.extend( {
+ classNames: 'ls_border'
+ } ),
+
+ items: Em.ContainerView.extend( {
+ classNames: 'ls-items',
+
+ childViews:
+ [
+ 'policies'
+ ],
+
+ policies: SDL.Button.extend( {
+ elementId: 'policies_leftMenu',
+ goToState: 'policies',
+ classNames: 'menu-item lsp1_p',
+ classNameBindings:
+ [
+ 'SDL.States.settings.policies.active:info_active'
+ ],
+ text: 'Policies',
+ icon: 'images/settings/ico_settings.png',
+ action: 'onState',
+ target: 'SDL.SettingsController'
+ } )
+ } )
+ } )
+
+});
diff --git a/src/components/HMI/audio/alert.wav b/src/components/HMI/audio/alert.wav
new file mode 100644
index 0000000000..bde18695e2
--- /dev/null
+++ b/src/components/HMI/audio/alert.wav
Binary files differ
diff --git a/src/components/HMI/audio/initial.wav b/src/components/HMI/audio/initial.wav
new file mode 100644
index 0000000000..61a549fbc6
--- /dev/null
+++ b/src/components/HMI/audio/initial.wav
Binary files differ
diff --git a/src/components/HMI/audio/listen.wav b/src/components/HMI/audio/listen.wav
new file mode 100644
index 0000000000..0f087c8d2e
--- /dev/null
+++ b/src/components/HMI/audio/listen.wav
Binary files differ
diff --git a/src/components/HMI/audio/positive.wav b/src/components/HMI/audio/positive.wav
new file mode 100644
index 0000000000..464af1f88c
--- /dev/null
+++ b/src/components/HMI/audio/positive.wav
Binary files differ
diff --git a/src/components/HMI/audio/say.wav b/src/components/HMI/audio/say.wav
new file mode 100644
index 0000000000..0975fe9766
--- /dev/null
+++ b/src/components/HMI/audio/say.wav
Binary files differ
diff --git a/src/components/HMI/css/buttonControls.css b/src/components/HMI/css/buttonControls.css
new file mode 100644
index 0000000000..39ef852853
--- /dev/null
+++ b/src/components/HMI/css/buttonControls.css
@@ -0,0 +1,546 @@
+/**
+ * buttonControls module CSS
+ *
+ * @category Style Sheets
+ * @filesource css/buttonControls.css
+ * @version 2.0
+ */
+#buttonControls.buttonControls {
+ width: 270px;
+ height: 200px;
+ top: 0px;
+ left: 790px;
+}
+
+#driverDistractionControl.driverDistractionControl {
+ width: 302px;
+ height: 20px;
+ top: 423px;
+ left: 810px;
+}
+
+#driverDistractionControl .driverDistractionControlLabel {
+ left: 20px;
+}
+
+#keyboard_view .back-button{
+ top: 58px;
+}
+
+#keyboard_view .controlls{
+ top: 350px;
+ width: 800px;
+ height: 75px;
+}
+
+#keyboard_view .controll{
+ margin: 10px;
+ height: 60px;
+ border: 1px solid #333;
+ text-align: center;
+ line-height: 60px;
+ border-radius: 3px;
+}
+
+#keyboard_view .controlls .leftBtn{
+ width: 130px;
+ left: 0px;
+}
+
+#keyboard_view .controlls .numericBtn{
+ width: 60px;
+ left: 145px;
+}
+
+#keyboard_view .controlls .symbolBtn{
+ width: 60px;
+ left: 220px;
+}
+
+#keyboard_view .controlls .spaceBtn{
+ width: 215px;
+ left: 295px;
+}
+
+#keyboard_view .controlls .caseSwitchBtn{
+ width: 60px;
+ left: 525px;
+}
+
+#keyboard_view .controlls .localisationBtn{
+ width: 60px;
+ left: 600px;
+}
+
+#keyboard_view .controlls .searchBtn{
+ width: 100px;
+ left: 677px;
+}
+
+#keyboard_view .keyboardLayout{
+ width: 750px;
+ height: 185px;
+ top: 170px;
+ left: 25px;
+}
+
+#keyboard_view .keyboardLayout.wide{
+ left: 5px !important;
+}
+
+#keyboard_view .searchBar{
+ top: 58px;
+ width: 666px;
+ height: 49px;
+ left: 120px;
+}
+
+#keyboard_view input{
+ width: 597px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ background: rgba(119, 119, 119, 0.42);
+ cursor: pointer;
+ font-size: 32px;
+ color: #FFF;
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#keyboard_view .microphone{
+ text-align: center;
+ line-height: 49px;
+}
+
+#keyboard_view .clearBtn{
+ right: 0px;
+ top: 0px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ font-size: 32px;
+ text-align: center;
+ line-height: 50px;
+}
+
+#keyboard_view .microphone{
+ left: 63px;
+ top: 58px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+#keyboard_view .keyboardLayout .ffw-button{
+ width: 60px;
+ height: 50px;
+ border-radius: 3px;
+ border: 1px solid #333;
+ margin: 5px;
+ font-size: 42px;
+ text-align: center;
+ line-height: 50px;
+}
+#keyboard_view .keyboardLayout .k1{
+ left: 75px;
+}
+#keyboard_view .keyboardLayout .k2{
+ left: 150px;
+}
+#keyboard_view .keyboardLayout .k3{
+ left: 225px;
+}
+#keyboard_view .keyboardLayout .k4{
+ left: 300px;
+}
+#keyboard_view .keyboardLayout .k5{
+ left: 375px;
+}
+#keyboard_view .keyboardLayout .k6{
+ left: 450px;
+}
+#keyboard_view .keyboardLayout .k7{
+ left: 525px;
+}
+#keyboard_view .keyboardLayout .k8{
+ left: 600px;
+}
+#keyboard_view .keyboardLayout .k9{
+ left: 675px;
+}
+#keyboard_view .keyboardLayout .k10{
+ left: 38px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k11{
+ left: 113px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k12{
+ left: 188px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k13{
+ left: 263px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k14{
+ left: 338px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k15{
+ left: 413px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k16{
+ left: 488px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k17{
+ left: 563px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k18{
+ left: 638px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k19{
+ left: 713px;
+ top: 62px;
+}
+#keyboard_view .keyboardLayout .k20{
+ left: 0px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k21{
+ left: 75px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k22{
+ left: 150px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k23{
+ left: 225px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k24{
+ left: 300px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k25{
+ left: 375px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k26{
+ left: 450px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k27{
+ left: 525px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k28{
+ left: 600px;
+ top: 124px;
+}
+#keyboard_view .keyboardLayout .k29{
+ left: 675px;
+ top: 124px;
+}
+#infoTable.infoTable {
+ width: 400px;
+ height: 96px;
+ top: 308px;
+ left: 801px;
+ background-color: #383737;
+ color: white;
+ border: 1px solid gray;
+ overflow: hidden;
+}
+
+#infoTable .sdlGPLabel {
+ width: 190px;
+ border-right: 1px solid #14100F;
+ height: 96px;
+ position: relative;
+ float: left;
+}
+
+#infoTable .sdlGPData {
+ position: relative;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ width: 203px;
+ height: 18px;
+}
+
+#buttonControls .ContainerControlls {
+ left: 34px;
+ background:
+ url(../images/home/controlButtons/backGroundControllButtons.png)
+ no-repeat;
+ width: 200px;
+ height: 200px;
+}
+
+#buttonControls .UpBtn {
+ background: url(../images/home/controlButtons/UpButton.png) no-repeat;
+ background-position: -32px 0;
+ width: 137px;
+ height: 64px;
+ left: 32px;
+ -webkit-transition: 0.2s;
+}
+
+#TUNEUP.pressed {
+ background: url(../images/home/controlButtons/UpButton_pressed.png)
+ !important;
+ background-position: -32px 0 !important;
+ width: 137px !important;
+ height: 69px !important;
+ left: 32px !important;
+}
+
+#buttonControls .DownBtn {
+ background: url(../images/home/controlButtons/DownButton.png) no-repeat;
+ background-position: -32px -132px;
+ width: 137px;
+ height: 65px;
+ top: 132px;
+ left: 32px;
+ -webkit-transition: 0.2s;
+}
+
+#TUNEDOWN.pressed {
+ background: url(../images/home/controlButtons/DownButton_pressed.png)
+ no-repeat;
+ background-position: -32px -132px !important;
+ width: 137px !important;
+ height: 65px !important;
+ top: 132px !important;
+ left: 32px !important;
+}
+
+#buttonControls .LeftBtn {
+ background: url(../images/home/controlButtons/LeftButton.png) no-repeat;
+ width: 63px;
+ height: 138px;
+ background-position: -3px -31px;
+ left: 3px;
+ top: 31px;
+ -webkit-transition: 0.2s;
+}
+
+#SEEKLEFT.pressed {
+ background: url(../images/home/controlButtons/LeftButton_pressed.png)
+ no-repeat;
+ width: 63px !important;
+ height: 138px !important;
+ background-position: -3px -31px !important;
+ left: 3px !important;
+ top: 31px !important;
+}
+
+#buttonControls .RightBtn {
+ background: url(../images/home/controlButtons/RightButton.png) no-repeat;
+ background-position: -131px -31px;
+ width: 68px;
+ height: 139px;
+ left: 131px;
+ top: 31px;
+ -webkit-transition: 0.2s;
+}
+
+#SEEKRIGHT.pressed {
+ background: url(../images/home/controlButtons/RightButton_pressed.png)
+ no-repeat;
+ background-position: -131px -31px !important;
+ width: 68px !important;
+ height: 139px !important;
+ left: 131px !important;
+ top: 31px !important;
+}
+
+#buttonControls .OkBtn {
+ background: url(../images/home/controlButtons/OkButton.png) no-repeat;
+ background-position: -55px -55px;
+ width: 89px;
+ height: 90px;
+ left: 55px;
+ top: 55px;
+ -webkit-transition: 0.2s;
+}
+
+#OK.pressed {
+ background: url(../images/home/controlButtons/OkButton_pressed.png)
+ no-repeat;
+ background-position: -55px -55px !important;
+ width: 89px !important;
+ height: 90px !important;
+ left: 55px !important;
+ top: 55px !important;
+}
+
+#app_controlButtons{
+ z-index: 2;
+}
+#app_controlButtons .systemRequest {
+ top: 252px !important;
+ left: 1059px !important;
+ width: 135px !important;
+ font-size: 16px !important;
+ text-align: center;
+ line-height: 48px;
+}
+
+#app_controlButtons .btnNotPressed {
+ width: 40px;
+ height: 40px;
+ left: 0px;
+ top: 200px;
+ -webkit-transition: 0.2s;
+ border-radius: 8px;
+ background-color: #1D1D1D;
+ border: 1px solid #383737;
+ box-shadow: inset 5px 5px 10px #383737, inset -3px -3px 10px black;
+ -webkit-transition: 0.2s;
+ font-size: 38px;
+ line-height: 42px;
+ text-align: center;
+ position: relative;
+ float: left;
+ margin-left: 10px;
+ margin-top: 10px;
+}
+
+}
+#app_controlButtons .languageSelect {
+ position: absolute;
+ width: 150px;
+ height: 30px;
+ color: white;
+ background: #393939;
+}
+
+#app_controlButtons .languageSelect option {
+ background: #393939;
+}
+
+#UILanguages.languageSelect {
+ top: 110px;
+ left: 1028px;
+}
+
+#TTSVRLanguages.languageSelect {
+ top: 170px;
+ left: 1028px;
+}
+
+#app_controlButtons .UILanguagesLabel {
+ top: 91px;
+ left: 1028px;
+ width: 150px;
+}
+
+#app_controlButtons .TTSVRLanguagesLabel {
+ top: 151px;
+ left: 1028px;
+ width: 160px;
+}
+
+#app_controlButtons .appUILanguagesLabel {
+ top: 91px;
+ left: 1195px;
+ width: 250px;
+}
+
+#app_controlButtons .appTTSVRLanguagesLabel {
+ top: 151px;
+ left: 1195px;
+ width: 250px;
+}
+
+#app_controlButtons .appUILang {
+ top: 117px;
+ left: 1195px;
+ width: 150px;
+}
+
+#app_controlButtons .appTTSVRLang {
+ top: 176px;
+ left: 1195px;
+ width: 150px;
+}
+
+#app_controlButtons .sendDataCheckBox {
+ left: 1158px;
+ position: absolute;
+ top: 275px;
+}
+
+#app_controlButtons .sendDataLabel {
+ top: 275px;
+ left: 1180px;
+ width: 160px;
+}
+
+#buttonControls .btnNotPressed.pressed {
+ box-shadow: inset 5px 5px 10px black, inset -3px -3px 10px #383737;
+ line-height: 45px;
+}
+
+#app_controlButtons .languageSelect {
+ position: absolute;
+ width: 150px;
+ height: 30px;
+ color: white;
+ background: #393939;
+}
+
+#app_controlButtons .languageSelect option {
+ background: #393939;
+}
+
+#UILanguages.languageSelect {
+ top: 110px;
+ left: 1028px;
+}
+
+#TTSVRLanguages.languageSelect {
+ top: 170px;
+ left: 1028px;
+}
+
+#app_controlButtons .UILanguagesLabel {
+ top: 91px;
+ left: 1028px;
+ width: 150px;
+}
+
+#app_controlButtons .TTSVRLanguagesLabel {
+ top: 151px;
+ left: 1028px;
+ width: 160px;
+}
+
+#app_controlButtons .phone_call_button{
+ height: 40px;
+ width: 163px;
+ font-size: 20px;
+ line-height: 41px;
+ border: 1px solid #FFFF30;
+ top: 2px;
+ color: #FFFF30;
+ padding-left: 10px;
+ left: 244px;
+ transition: left 2s;
+}
+
+#app_controlButtons .phone_call_button.expand{
+ left: 156px;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/general.css b/src/components/HMI/css/general.css
new file mode 100644
index 0000000000..1eab49e6e1
--- /dev/null
+++ b/src/components/HMI/css/general.css
@@ -0,0 +1,1560 @@
+/*GENERAL CSS*/
+* {
+ /*Reset default browser styles*/
+ margin: 0;
+ padding: 0;
+ border: none;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ -webkit-user-select: none;
+}
+
+html, body {
+ /*GLOBAL HTML and BODE Dimansions*/
+ width: 100%;
+ min-height: 100%;
+}
+
+body {
+ /*FONT FAMILY*/
+ font-family: sans-serif;
+ /*Defaul font size*/
+ font-size: 16px;
+ background-color: #000;
+ color: #fff;
+ overflow: hidden;
+}
+
+/*Default style for all images*/
+img {
+ border-width: 0px;
+ border-style: none;
+ margin: 0px;
+ padding: 0px;
+ z-index: 1000;
+ pointer-events: none;
+}
+
+/*Default style for all DIVs*/
+div {
+ position: absolute;
+ margin: 0;
+ padding: 0;
+}
+
+.ffw-button {
+ cursor: pointer;
+ background: url(../images/common/button.png) repeat-x;
+}
+
+.ffw-button.pressed {
+ background-position: bottom;
+}
+
+.windowText {
+ top: 190px;
+ width: 800px;
+ font-size: 80px;
+ color: white;
+ text-align: center;
+}
+
+/* Home view */
+#home {
+ background: url(../images/home/home_main_image.png) no-repeat;
+ width: 800px;
+ height: 369px;
+ top: 56px;
+}
+
+/* Climate Status */
+#status_climate {
+ bottom: 0px;
+ right: 0px;
+ text-align: right;
+ font-size: 21px;
+ width: 324px;
+ height: 48px;
+ cursor: pointer;
+ background: url(../images/common/climate-status-bg.png) no-repeat;
+ z-index: 1;
+}
+
+#status_climate_label {
+ display: block;
+ width: 100%;
+ visibility: hidden;
+}
+
+#status_climate_label span {
+ padding-right: 11px;
+}
+
+/* Navigation Status */
+#status_nav {
+ top: 0px;
+ right: 0px;
+ text-align: right;
+ font-size: 21px;
+ width: 324px;
+ height: 48px;
+ cursor: pointer;
+ background: url(../images/common/nav-status-bg.png) no-repeat;
+ z-index: 1;
+}
+
+#navigation_status_label {
+ width: 100%;
+ display: block;
+ visibility: hidden;
+}
+
+#navigation_status_label span {
+ padding-right: 11px;
+}
+
+/*FORD CONTAINER DEFAULT DIMANSIONS */
+#app {
+ /*position:relative;*/
+ width: 800px;
+ height: 480px;
+ /*overflow: hidden;
+ Mac font smoothing */
+ -webkit-font-smoothing: antialiased;
+ /*margin: 25px auto;*/
+}
+
+/* TTS popUp*/
+#TTSPopUp.TTSPopUp {
+ opacity: 0;
+ left: 500px;
+ width: 295px;
+ height: 100px;
+ z-index: 1;
+ border-radius: 10 PX;
+ top: 8px;
+ -webkit-transition: opacity 1s ease-in-out;
+ display: none;
+}
+
+#TTSPopUp .popUp {
+ width: 294px;
+ height: 98px;
+ border: 1px solid black;
+ border-radius: 10px;
+ background-color: black;
+ border: #A6A6A6 solid 2px;
+ color: white;
+}
+
+#TTSPopUp .message {
+ top: 10px;
+ right: 10px;
+ width: 278px;
+ height: 81px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#TTSPopUp .timerText {
+ color: #FFD93F;
+ margin-top: 3px;
+ right: 5px;
+ font-size: 30px;
+}
+
+#TTSPopUp .checkBoxLabel {
+ color: white;
+ top: 106px;
+ width: 72px;
+ height: 35px;
+ left: 25px;
+ background-color: rgb(90, 90, 90);
+ border-radius: 3px;
+ border: 1px solid rgb(255,255,255);
+ padding: 2px;
+}
+
+#TTSPopUp .checkBoxTTS {
+ top: 118px;
+ position: absolute;
+ left: 8px;
+}
+
+#TTSPopUp .okButton {
+ right: 52px;
+ width: 113px;
+ height: 19px;
+ padding: 10px;
+ border-radius: 4px;
+ border: 1px solid white;
+}
+
+#TTSPopUp.active {
+ opacity: 1;
+ display: block;
+ z-index: 10000;
+}
+
+/* Diver Distraction PopUp */
+#driverDistraction.driverDistractionWindow {
+ left: 0;
+ top: 0;
+ width: 800px;
+ height: 480px;
+ background: rgba(0, 0, 0, 0.7);
+ z-index: 30000;
+ opacity: 0;
+ display: none;
+}
+
+#driverDistraction .driverDistraction {
+ left: 200px;
+ width: 400px;
+ height: 200px;
+ z-index: 2;
+ top: 140px;
+ -webkit-transition: opacity 1s ease-in-out;
+ background-color: black;
+ border: #A6A6A6 solid 2px;
+ border-radius: 6px;
+}
+
+#driverDistraction.active {
+ opacity: 1;
+ display: block;
+}
+
+#driverDistraction .driverDistractionText {
+ top: 224px;
+ left: 210px;
+ width: 374px;
+ height: 20px;
+ text-align: center;
+ font-size: 28px;
+ z-index: 2;
+}
+
+/* UI popUp*/
+/* VR popUp*/
+#VRPopUp.VRPopUp {
+ opacity: 0;
+ left: 50px;
+ width: 700px;
+ height: 340px;
+ background-color: black;
+ z-index: 2;
+ border-radius: 10 PX;
+ top: 70px;
+ -webkit-transition: opacity 1s ease-in-out;
+ display: none;
+}
+
+#VRPopUp span {
+ margin-left: 15px;
+}
+
+#VRPopUp .popUp {
+ width: 698px;
+ height: 338px;
+ border: 1px solid white;
+ border-radius: 10px;
+}
+
+#VRPopUp .message1 {
+ top: 10px;
+ left: 10px;
+ width: 278px;
+ height: 81px;
+}
+
+#VRPopUp .message2 {
+ top: 40px;
+ left: 10px;
+ width: 278px;
+ height: 81px;
+}
+
+#VRPopUp.active {
+ opacity: 1;
+ display: block;
+ transition: all 1s;
+}
+
+#VRPopUp .list {
+ position: absolute;
+ width: 629px;
+ height: 251px;
+ border-radius: 2px;
+ left: 35px;
+ top: 70px;
+}
+
+#VRPopUp .list-content {
+ border: none;
+}
+
+#VRPopUp .list-item {
+ position: relative;
+ width: 100%;
+ height: 48px;
+ font-size: 20px;
+ line-height: 50px;
+ border: 1px solid #393939;
+}
+
+#VRPopUp .list-content {
+ width: 578px;
+}
+
+#VRPopUp .VRLabel {
+ top: 10px;
+ width: 550px;
+ left: 35px;
+ height: 20px;
+ padding: 15px;
+ background: #393939;
+}
+
+#VRPopUp .VRImage {
+ right: 25px;
+ width: 50px;
+ height: 50px;
+ top: 10px;
+ background: url(../images/home/controlButtons/vrImage.png) no-repeat;
+ background-size: contain;
+}
+
+/*WRAPER FOR CONTENT VIEW*/
+#app_active_view {
+ position: absolute;
+ width: 800px;
+ height: 480px;
+}
+
+#html5Player {
+ position: absolute;
+ z-index: 1;
+ width: 800px;
+ height: 480px;
+}
+
+#html5Player.visible {
+ -webkit-transform: translateX(0px) !important;
+}
+
+#mode {
+ position: relative;
+ margin: 150px auto;
+ width: 150px;
+}
+
+/* Image preloader block*/
+#preloader {
+ position: absolute;
+ left: -9999px;
+ top: -9999px;
+}
+
+/*CLOCK*/
+#clock {
+ font-size: 28px;
+ text-align: center;
+ width: 225px;
+ height: 50px;
+ position: relative;
+ float: left;
+ pointer-events: all;
+ cursor: pointer;
+}
+
+#clock.mcs {
+ width: 225px;
+}
+
+#time_num {
+ width: 100%;
+ padding: 10px;
+ margin-left: 5px;
+}
+
+#app_top_menu_cont {
+ z-index: 10000;
+ top: 0px;
+ left: 275px;
+ position: relative;
+ pointer-events: none;
+}
+
+#top_controls {
+ width: 322px;
+ height: 58px;
+ background: url("../images/common/header_bg.png") no-repeat;
+ z-index: 2;
+}
+
+.not-visible {
+ visibility: hidden !important;
+}
+
+/* Universal class to show hidden elements */
+.visible {
+ visibility: visible !important;
+}
+
+/* Universal class to show transparent elements */
+.show {
+ opacity: 1 !important;
+}
+
+.arrow-ico {
+ position: absolute;
+ right: 10px;
+}
+
+.right_text {
+ float: right;
+ margin-right: 5px;
+}
+
+.hidden_display {
+ display: none !important;
+}
+
+.visible_display {
+ display: block !important;
+}
+
+/*STATUS BAR*/
+.status_bar {
+ z-index: 2001;
+ line-height: 50px;
+}
+
+.selected {
+ display: none;
+}
+
+/*BOTTOM Control BUTTONS*/
+#app_bottom_controlls {
+ z-index: 11000;
+ bottom: 0px;
+ left: 275px;
+ width: 252px;
+ height: 59px;
+ /*background: url(../images/common/bottom_cont_bg.png) no-repeat;*/
+ overflow: hidden;
+ pointer-events: none;
+}
+
+#home_active {
+ z-index: 2002;
+ bottom: 0px;
+ left: 275px;
+ width: 250px;
+ height: 58px;
+ background: url("../../images/common/home_active.png") no-repeat;
+}
+
+#home_but {
+ height: 59px;
+ width: 73px;
+ cursor: pointer;
+ z-index: 1000;
+ background: url(../images/home/bottom_controlls_full.png) no-repeat;
+ background-position: -90px -59px;
+ position: relative;
+ float: left;
+ pointer-events: none;
+}
+
+#home_but.large {
+ width: 126px;
+ background-position: 0px -177px;
+}
+
+#home_but.large.selected {
+ width: 126px;
+ background-position: 0px -118px;
+}
+
+#home_but.selected {
+ background-position: -90px 0px;
+ display: block;
+}
+
+#home_but_click {
+ height: 59px;
+ width: 73px;
+ cursor: pointer;
+ z-index: 1001;
+ position: absolute;
+ pointer-events: all;
+}
+
+#home_but_click.large {
+ width: 125px;
+ height: 115px;
+ -webkit-transform: skew(0deg, -42deg);
+}
+
+/*INFO BUTTON*/
+#info_but_click {
+ height: 117px;
+ width: 88px;
+ cursor: pointer;
+ z-index: 1001;
+ position: absolute;
+ pointer-events: all;
+ -webkit-transform: skew(0deg, -52deg);
+}
+
+#info_but {
+ height: 59px;
+ width: 90px;
+ cursor: pointer;
+ background: url(../images/home/bottom_controlls_full.png) no-repeat;
+ background-position: 0px -59px;
+ position: relative;
+ float: left;
+ z-index: 1001;
+ pointer-events: none;
+ -webkit-border-top-left-radius: 10px;
+}
+
+#info_but.selected {
+ background-position: 0px 0px;
+ display: block;
+}
+
+/*SETTINGS BUTTON*/
+#setting_but {
+ width: 89px;
+ height: 59px;
+ cursor: pointer;
+ background: url(../images/home/bottom_controlls_full.png) no-repeat;
+ background-position: -162px -59px;
+ position: relative;
+ float: left;
+ pointer-events: none;
+}
+
+#setting_but.large {
+ width: 126px;
+ background-position: -126px -177px;
+}
+
+#setting_but.large.selected {
+ width: 126px;
+ background-position: -126px -118px;
+}
+
+#setting_but.selected {
+ background-position: -162px 0px;
+ display: block;
+}
+
+#setting_but_click {
+ width: 83px;
+ height: 110px;
+ cursor: pointer;
+ position: absolute;
+ -webkit-transform: skew(0deg, 52deg);
+ left: 1px;
+ top: 4px;
+ z-index: 1000;
+ pointer-events: all;
+}
+
+#setting_but_click.large {
+ width: 158px;
+ height: 155px;
+}
+
+/*HIDDEN FOR CONTENT BLOCKS*/
+.hidden {
+ -webkit-transform: translateX(-2000px);
+ -moz-transform: translateX(-2000px);
+}
+
+/*ACTIVE VISIBLE FOR CONTENT BLOCK*/
+.inactive_state {
+ -webkit-transform: translateX(-2000px);
+ -moz-transform: translateX(-2000px);
+ overflow: hidden;
+}
+
+.active_state {
+ -webkit-transform: translateX(0px) !important;
+ -moz-transform: translateX(0px) !important;
+}
+
+.passive_button_color {
+ color: #999 !important;
+}
+
+/*MEDIA BLOCK CONTAINER*/
+#media {
+ width: 800px;
+ height: 480px;
+ background: url(../images/media/bg.png) no-repeat;
+}
+
+/****************************** FOR MEDIA VIEW************************************************/
+/*#media, #browseUsbHD {
+background: url(../images/media/bg.png) no-repeat;
+}
+
+#media_view {
+width: 800px;
+height: 480px;
+}
+
+#media_view #cntrlMenu {
+position: relative;
+margin-top: 90px;
+}*/
+/*Video Player*/
+/*******Player Controlls View********/
+#video_player_view {
+ top: 85px;
+ left: 93px;
+ z-index: 2002;
+ display: block;
+}
+
+/*Holder for all progressbar elements*/
+#video_player_view .progressline_holder {
+ display: block;
+ width: 537px;
+ height: 10px;
+ cursor: pointer;
+ background: url(../images/player/player_prog_bg.png) no-repeat;
+}
+
+/*Style to fix actual width for progress bar concerning width of progrees bar mark*/
+.progressline_width_fix {
+ width: 537px;
+ position: absolute;
+}
+
+/*Progressbar*/
+#video_player_view .progressbar {
+ display: block;
+ height: 10px;
+ background: url(../images/player/prog_ind.png) no-repeat;
+ position: relative;
+ float: left;
+}
+
+/*Current time*/
+.current_time {
+ width: 33px;
+ height: 15px;
+ top: -4px;
+ left: -55px;
+ font-weight: bold;
+}
+
+/*Total time*/
+.total_time {
+ width: 33px;
+ height: 15px;
+ left: 546px;
+ top: -4px;
+ font-weight: bold;
+}
+
+/*Drag Area*/
+.drag_area {
+ width: 561px;
+ position: relative;
+ float: left;
+ height: 10px;
+}
+
+/*Progress bar mark*/
+#mark {
+ position: relative;
+ float: left;
+ bottom: 19px;
+ left: -20px;
+ background: url(../images/player/player_free_control.png) no-repeat;
+ width: 50px;
+ height: 50px;
+}
+
+#mark.active {
+ background: url(../images/player/player_active_control.png) no-repeat !important;
+ bottom: 20px !important;
+ left: -21px !important;
+ width: 52px !important;
+ height: 52px !important;
+}
+
+/*Back Button*/
+#back {
+ width: 80px;
+ height: 50px;
+ cursor: pointer;
+ top: 60px;
+ left: 140px;
+ border: 1px solid #393939;
+}
+
+#back .ico {
+ top: 13px;
+ left: 20px;
+ position: relative;
+}
+
+/* Forward Button*/
+#frw {
+ width: 79px;
+ height: 49px;
+ cursor: pointer;
+ top: 60px;
+ left: 347px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+}
+
+#frw .ico {
+ top: 13px;
+ left: 24px;
+ position: relative;
+}
+
+/*Play Button*/
+#play {
+ width: 79px;
+ height: 49px;
+ cursor: pointer;
+ top: 60px;
+ left: 244px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+}
+
+#play .play {
+ top: 13px;
+ left: 31px;
+ position: relative;
+}
+
+#play .pause {
+ top: 10px;
+ left: 28px;
+ position: relative;
+}
+
+/*Stop Button*/
+#stop {
+ width: 79px;
+ height: 49px;
+ cursor: pointer;
+ top: -18px;
+ left: 585px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+}
+
+#stop .ico {
+ top: 17px;
+ left: 18px;
+ position: relative;
+}
+
+/********************FOR TEST PURPOSE ONLY********************/
+.centered {
+ position: absolute;
+ width: 300px;
+ height: 200px;
+ border: 2px solid #999;
+ color: white;
+ text-align: center;
+ margin: 100px auto;
+ line-height: 190px;
+ font-size: 24px;
+ left: 240px;
+}
+
+/**************************FOR LIST***************************/
+/* List */
+.list {
+ position: relative;
+ overflow: hidden;
+}
+
+.list-content {
+ border-top: 1px solid #393939;
+ border-left: 1px solid #393939;
+ border-right: 1px solid #393939;
+}
+
+/* List item */
+.list-item {
+ position: relative;
+ width: 100%;
+ height: 49px;
+ font-size: 20px;
+ line-height: 50px;
+ border-bottom: 1px solid #393939;
+}
+
+.list-item .ico {
+ height: 49px;
+ float: left;
+}
+
+.list-item span {
+ /*position: absolute*/
+}
+
+/* List item background */
+.list-item.notpressed {
+ background-image: url(../images/list/list_item_bg.png);
+}
+
+.list-item .highLighted {
+
+}
+
+/*************************FOR SCROLLBAR*************************/
+/*
+.scrollBar{
+ position: relative;
+ width: 48px;
+ background: black;
+ border: 1px solid #393939;
+ border-top-right-radius: 1px;
+ border-top-left-radius: 1px;
+ border-bottom-right-radius: 1px;
+ border-bottom-left-radius: 1px;
+ float: right;
+}
+*/
+.scrollbar {
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ width: 48px;
+ background: black;
+ border: 1px solid #393939;
+ border-top-right-radius: 2px;
+ border-top-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+ border-bottom-left-radius: 2px;
+}
+
+.sb-content {
+ width: 48px;
+ background: black;
+ border: 1px solid #393939;
+ border-top-right-radius: 2px;
+ border-top-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+ border-bottom-left-radius: 2px;
+}
+
+/* Top button */
+.sb-top {
+ height: 48px;
+ width: 48px;
+ border-bottom: #393939 1px solid;
+ position: relative;
+ cursor: pointer;
+}
+
+/* Background of scrollbar */
+.sb-body {
+ height: 148px;
+ width: 46px;
+ background-color: #262626;
+ margin: 1px;
+ position: relative;
+}
+
+/* Bar */
+.sb-bar {
+ width: 46px;
+ height: 146px;
+ background: #464646;
+ position: relative;
+ bottom: 10px;
+ -webkit-transition: top 0.2s ease-out;
+}
+
+/* Bottom button */
+.sb-bottom {
+ height: 48px;
+ width: 48px;
+ border-top: #393939 1px solid;
+ position: absolute;
+ cursor: pointer;
+ bottom: 0px;
+}
+
+/* Buttons image position */
+.sb-bottom img, .sb-top img {
+ margin-top: 13px;
+ margin-left: 13px;
+}
+
+/* List item button background */
+.list-item.pressed {
+ background-image: url(../images/list/list_item_pressed.png);
+}
+
+/** Background for pressed button */
+.button.pressed {
+ background-image: url(../images/list/list_item_pressed.png);
+}
+
+/* Hide function */
+.is-disabled {
+ display: none;
+}
+
+.hide {
+ visibility: hidden;
+ display: none;
+}
+
+/* Disabled list items */
+.disabled {
+ color: #999;
+ cursor: default!important;
+}
+
+.disabled .ico, .disabled .right_ico {
+ opacity: .3;
+}
+
+.disabled .arrow-ico {
+ opacity: .3;
+}
+
+#sing {
+ width: 19px;
+ height: 27px;
+ left: 13px;
+ top: 13px;
+}
+
+#sing.white {
+ background: url(../images/help/white_help.png) no-repeat;
+}
+
+#sing.yellow {
+ background: url(../images/help/yellow_help.png) no-repeat;
+}
+
+/******************** FOR FAQ ********************************/
+#faq_btn {
+ cursor: pointer;
+ width: 145px;
+ height: 53px;
+ background: url(../images/help/faq_top_btn.png) no-repeat;
+ top: 0;
+ left: 110px;
+ z-index: 0;
+ pointer-events: none;
+ -webkit-transition: left 0.5s ease-in-out;
+}
+
+.faq-pressed {
+ left: 0px !important;
+}
+
+#faq_btn.pressed {
+ background: url(../images/help/faq_top_btn_pressed.png) no-repeat !important;
+}
+
+#faq_btn .ico {
+ position: absolute;
+ right: 32px;
+ top: 8px;
+}
+
+#faq_btn_c {
+ width: 118px;
+ height: 50px;
+ -webkit-transform: skewX(-43deg);
+ z-index: 1;
+ cursor: pointer;
+ pointer-events: all;
+}
+
+#faq_btn .ind_inact {
+ background: url(../images/help/ind_vert_def.png) no-repeat;
+ position: absolute;
+ right: 32px;
+ top: 8px;
+ width: 19px;
+ height: 32px;
+}
+
+#faq_btn .ind_act {
+ background: url(../images/help/ind_vert_active.png) no-repeat;
+ position: absolute;
+ right: 32px;
+ top: 8px;
+ width: 19px;
+ height: 32px;
+}
+
+.button {
+ background-image: url(../images/list/list_item_bg.png);
+ cursor: pointer;
+}
+
+.button img {
+ float: left;
+}
+
+/* default style */
+* {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ -webkit-user-select: none;
+}
+
+/******************* For FAQ View *******************/
+#fag_view {
+ font-size: 20px;
+ display: block;
+ background: url(../images/help/faq_bg.png) no-repeat;
+ width: 800px;
+ height: 384px;
+ position: absolute;
+ top: 48px;
+}
+
+#faq_view_list {
+ position: relative;
+ margin-left: 115px;
+ margin-top: 34px;
+ height: 251px;
+ width: 630px;
+ float: left;
+}
+
+#faq_view_list .list-content {
+ width: 570px;
+}
+
+#fag_view .list-item {
+ position: relative;
+ width: 570px;
+ height: 49px;
+ font-size: 20px;
+ line-height: 50px;
+ border-bottom: 1px solid #393939;
+ cursor: pointer;
+ float: left;
+}
+
+#fag_view .list-item span {
+ left: 5px;
+ margin-top: 18px;
+ margin-left: 17px;
+}
+
+/* Faq bottom text*/
+#faq_bottom {
+ bottom: 19px;
+ width: 764px;
+ height: 50px;
+ font-size: 18px;
+ float: left;
+ margin-top: 31px;
+ margin-left: 36px;
+}
+
+#faq_bottom div {
+ float: left;
+ width: 764px;
+}
+
+#faq_bottom .second-line {
+ top: 22px;
+}
+
+#settings_view {
+ width: 800px;
+ height: 480px;
+}
+
+.block {
+ display: block !important;
+}
+
+.test_blur {
+ width: 800px;
+ height: 480px;
+ top: -55px;
+ z-index: 1001;
+ opacity: .6;
+ background-color: black;
+ box-shadow: 3px;
+}
+
+.pointer {
+ cursor: pointer !important;
+}
+
+/*CAUTION MESSAGE*/
+#warning_view {
+ width: 800px;
+ height: 480px;
+ z-index: 12001;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(218, 218, 218)), color-stop(0.3, rgb(0, 0, 0)));
+}
+
+#warning_view.fr .text {
+ font-size: 23px;
+}
+
+#warning_view .message {
+ width: 744px;
+ height: 340px;
+ position: relative;
+ margin: 0 auto;
+ top: 15px;
+}
+
+#warning_view .warning_text {
+ position: relative;
+ margin: 0 auto;
+ width: 216px;
+ font-size: 42px;
+ font-weight: bold;
+ top: 20px;
+ text-shadow: 1px 1px 3px white;
+ color: #CC2A2A;
+}
+
+#warning_view .text {
+ font-size: 25px;
+ position: relative;
+ top: 15px;
+ font-weight: bold;
+}
+
+#warning_view .okbut {
+ width: 130px;
+ height: 51px;
+ position: relative;
+ top: 30px;
+ cursor: pointer;
+ float: right;
+ margin-right: 83px;
+ display: none;
+ font-size: 20px;
+ text-align: center;
+ line-height: 50px;
+}
+
+#warning_view .components{
+ margin-top: 20px;
+ width: 420px;
+}
+
+#warning_view .component{
+ width: 200px;
+ height: 20px;
+ float: right;
+ position: relative;
+}
+
+#warning_view .item{
+ position: relative;
+ float: left;
+ margin-left: 10px;
+}
+
+.hideWarning {
+ width: 0px !important;
+ overflow: hidden;
+ z-index: -1 !important;
+}
+
+.fadeWarning {
+ opacity: 0;
+ transition: opacity 1s;
+ -moz-transition: opacity 1s;
+ -webkit-transition: opacity 1s;
+ -o-transition: opacity 1s;
+}
+
+#warning_view.fadeAnimation {
+ -webkit-animation-name: opacity;
+ -webkit-animation-duration: 1s;
+ -webkit-animation-timing-function: linear;
+ -webkit-animation-fill-mode: forwards;
+}
+
+@
+-webkit-keyframes opacity {
+
+from {
+ opacity: 1;
+
+}
+
+to {
+ opacity: 0;
+}
+
+ }
+
+/* Welcome Orientation View*/
+#app_welcome_orientation_view {
+ width: 800px;
+ height: 480px;
+ z-index: 12000;
+}
+
+#app_welcome_orientation_balck_mask_view {
+ width: 800px;
+ height: 480px;
+ background: #000;
+ opacity: 0.75;
+}
+
+#app_welcome_orientation_popup_text {
+ position: relative;
+ margin: 0px auto;
+ font-size: 30px;
+ text-align: center;
+ width: 410px;
+ margin-top: 18px;
+}
+
+#app_welcome_orientation_denypopup_text {
+ position: relative;
+ margin: 0px auto;
+ font-size: 28px;
+ text-align: center;
+ width: 460px;
+ margin-top: 53px;
+}
+
+#app_welcome_orientation_popup_buttons {
+ width: 266px;
+ height: 53px;
+ border: 1px solid #333;
+ position: relative;
+ margin: 20px auto 0px;
+}
+
+#app_welcome_orientation_popup_lable {
+ position: relative;
+ width: 479px;
+ height: 70px;
+ border: 1px solid #fff;
+ text-align: center;
+ margin: 0px auto;
+ margin-top: 70px;
+ font-size: 25px;
+ font-family: Helvetica;
+}
+
+#app_welcome_orientation_popup_lable span {
+ position: relative;
+ top: 5px;
+ width: 432px;
+}
+
+#app_welcome_orientation_popup_view, #wo_denypopup {
+ width: 546px;
+ height: 346px;
+ background: #000;
+ z-index: 12002;
+ left: 134px;
+ top: 46px;
+ border: 2px solid #A28542;
+ -webkit-border-radius: 4px;
+}
+
+#wo_popup_btn_divider {
+ width: 4px;
+ height: 48px;
+ background: url(../images/common/divider.png) no-repeat;
+ left: 131px;
+ z-index: 1;
+}
+
+#wo_popup_yes_button, #wo_popup_no_button {
+ height: 52px;
+ width: 132px;
+ cursor: pointer;
+ position: relative;
+ float: left;
+ font-size: 20px;
+ text-align: center;
+ line-height: 52px;
+}
+
+#wo_popup_yes_button {
+ border-right: 1px solid #000;
+}
+
+#wo_popup_no_button {
+ border-left: 1px solid #393939;
+}
+
+#wo_popup_denypopup_ok_button {
+ width: 238px;
+ height: 48px;
+ background: url(../images/common/bt_bg.png) repeat-x;
+ cursor: pointer;
+ position: relative;
+ float: left;
+ font-size: 20px;
+ font-weight: bold;
+ text-align: center;
+ line-height: 50px;
+ border: 1px solid #333;
+ left: 155px;
+ top: 80px;
+ -webkit-border-radius: 4px;
+}
+
+#woSkippButton {
+ width: 80px;
+ height: 50px;
+ cursor: pointer;
+ top: 370px;
+ left: 710px;
+ font-size: 21px;
+ text-align: center;
+ line-height: 48px;
+ z-index: 10000;
+ border: 1px solid white;
+ -webkit-border-radius: 3px;
+ background: url(../images/common/skippbuttonbg_pressed.png) no-repeat;
+ opacity: 0.75;
+ display: none;
+}
+
+#woSkippButton .right_text {
+ margin-top: 2px;
+}
+
+#woSkippButton.pressed {
+ background: url(../images/common/skippbuttonbg_pressed.png) no-repeat !important;
+}
+
+#wo_popup_yes_button.pressed, #wo_popup_no_button.pressed, #wo_popup_denypopup_ok_button.pressed {
+ background: url(../images/common/bt_bg_pressed.png) repeat-x !important;
+}
+
+/* END Welcome Orientation View*/
+/* Video Error Popup*/
+#video_error_popup {
+ background: black;
+ border: 1px solid #A03333;
+ -webkit-border-radius: 3px;
+ font-size: 23px;
+ font-weight: bold;
+ left: 308px;
+ text-align: center;
+ top: 170px;
+ z-index: 12100;
+ position: absolute;
+ padding: 10px;
+ display: none;
+}
+
+.mft_indicator {
+ opacity: 0;
+}
+
+/* Lable plus Button*/
+.lablePlusButton .button {
+ float: right;
+ right: 0px;
+ width: 323px;
+ height: 49px;
+ border-left: 1px solid #393939;
+}
+
+.lablePlusButton .lable span, .lablePlusButton .button span {
+ margin-left: 13px;
+}
+
+.lablePlusButton .button.single {
+ width: 148px;
+ height: 28px;
+ border: 1px solid #393939;
+ border-radius: 2px;
+ margin-top: 10px;
+ margin-right: 10px;
+ text-align: center;
+ line-height: 28px;
+ float: right;
+}
+
+.lablePlusButton .button.single span {
+ margin: 0px;
+}
+
+/* ****************Select System Popup *********************** */
+#select_sysytem_view {
+ width: 796px;
+ height: 475px;
+ top: 1px;
+ border: 2px solid #926100;
+ background: #000;
+ z-index: 12002;
+ -webkit-border-radius: 4px;
+}
+
+/* header lable*/
+#select_system_heading_lable {
+ position: relative;
+ font-size: 30px;
+ text-align: center;
+ margin-top: 25px;
+ margin-bottom: 30px;
+}
+
+/* content container*/
+#select_system_container {
+ width: 756px;
+ height: 200px;
+ position: relative;
+ margin: 0px auto;
+ border: 1px solid #393939;
+}
+
+/* vehicle select list*/
+#settings_list {
+ height: 130px;
+ position: relative;
+}
+
+/* vehicle select list container*/
+#select_system_list {
+ width: 545px;
+ position: relative;
+ float: right;
+ margin-top: 15px;
+ margin-right: 20px;
+}
+
+/* vehicle select list buttons*/
+#settings_list .button {
+ position: relative;
+ width: 135px;
+ height: 48px;
+ font-size: 20px;
+ text-align: center;
+ line-height: 48px;
+ float: left;
+ border-right: 1px solid #393939;
+ border-top: 1px solid #393939;
+ border-bottom: 1px solid #393939;
+}
+
+#settings_list .button.left-border {
+ border-left: 1px solid #393939;
+}
+
+#settings_list .button.active {
+ background: url(../images/settings/btn-48h-gray-active.png) repeat-x !important;
+ color: #000;
+}
+
+#settings_list .button.bottom {
+ margin-top: 2px;
+}
+
+/* select climate style lable*/
+#select_system_label {
+ font-size: 20px;
+ width: 135px;
+ position: relative;
+ float: left;
+ margin-left: 10px;
+ margin-top: 15px;
+}
+
+/* Navigation select block*/
+#navsdcard {
+ height: 70px;
+ position: relative;
+ border-bottom: 1px solid #393939;
+}
+
+/* Navigation select block button container*/
+#sdnav_buttons {
+ position: relative;
+ float: right;
+ margin-top: 10px;
+ margin-right: 20px;
+}
+
+/* Navigation select block button*/
+#navsdcard .button {
+ width: 120px;
+ height: 48px;
+ border: 1px solid #393939;
+ text-align: center;
+ font-size: 20px;
+ line-height: 48px;
+ font-weight: bold;
+}
+
+#navsdcard .button.active {
+ background: url(../images/settings/btn-48h-gray-active.png) repeat-x !important;
+ color: #000;
+}
+
+#navsdcard_no_btn {
+ position: relative;
+ float: right;
+}
+
+#navsdcard_yes_btn {
+ position: relative;
+ float: left;
+}
+
+/* navigationApp select lable*/
+#sdnav_label {
+ position: relative;
+ float: left;
+ font-size: 20px;
+ margin-top: 15px;
+ margin-left: 10px;
+}
+
+/* Submit button*/
+#select_system_submit {
+ width: 130px;
+ height: 50px;
+ z-index: 12002;
+ position: relative;
+ border: 1px solid #393939;
+ text-align: center;
+ font-size: 25px;
+ font-weight: bold;
+ line-height: 50px;
+ margin: 50px auto;
+}
+
+/* Info Lable*/
+#select_system_info {
+ position: relative;
+ text-align: center;
+ font-size: 25px;
+ margin-top: 25px;
+}
+
+#select_system_info span {
+ border: 1px solid #fff;
+ padding: 5px 15px 5px 15px;
+}
diff --git a/src/components/HMI/css/info.css b/src/components/HMI/css/info.css
new file mode 100644
index 0000000000..34776e6cbf
--- /dev/null
+++ b/src/components/HMI/css/info.css
@@ -0,0 +1,671 @@
+#status_info {
+ top: 0px;
+ right: 0px;
+ text-align: right;
+ font-size: 21px;
+ width: 324px;
+ height: 48px;
+ cursor: pointer;
+ background: url(../images/common/nav-status-bg.png) no-repeat;
+ z-index: 1;
+}
+
+#status_info_label {
+ width: 100%;
+ display: block;
+}
+
+#status_info_label span {
+ padding-right: 11px;
+}
+
+#info_view {
+ width: 800px;
+ height: 480px;
+}
+
+#info_view.green_bg {
+ background: url(../images/nav/bg.png) no-repeat;
+}
+
+#info_leftMenu {
+ background: #333;
+ width: 150px;
+ height: 300px;
+ top: 90px;
+}
+
+#info_leftMenu .menu-item.info_active {
+ background: url("../images/info/menu_active.png") repeat-x;
+}
+
+#info_leftMenu .menu-item {
+ z-index: 201;
+ position: relative;
+ width: 150px;
+ height: 50px;
+ cursor: pointer;
+}
+
+#info_leftMenu .menu-item span {
+ position: absolute;
+ left: 50px;
+ width: 100px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+#info_leftMenu .ico {
+ height: 50px;
+ width: 50px;
+}
+
+#info_leftMenu .settings_active {
+ background: url("../images/settings/menu_active.png") repeat-x;
+}
+
+#info_right_menu {
+ left: 183px;
+ top: 6px;
+}
+
+#info_sync_services {
+ font-size: 32px;
+ width: 280px;
+}
+
+#info_traff {
+ font-size: 20px;
+ width: 410px;
+ top: 36px;
+}
+
+#info_traffic_report {
+ width: 300px;
+ top: 85px;
+ font-size: 20px;
+ color: #a6a6a6;
+}
+
+#info_traffic_pts {
+ width: 400px;
+ top: 120px;
+ font-size: 20px;
+ color: #65cdd9;
+}
+
+#info_traffic_hear {
+ width: 355px;
+ top: 192px;
+ font-size: 20px;
+ color: #a6a6a6;
+}
+
+#info_connect {
+ width: 300px;
+ top: 241px;
+ font-size: 20px;
+ left: 15px;
+}
+
+#info_log {
+ width: 500px;
+ top: 285px;
+ font-size: 20px;
+}
+
+#info_left_menu {
+ top: 6px;
+}
+
+#info_left_menu div {
+ font-size: 20px;
+ left: 49px;
+}
+
+#info_left_services {
+ top: 17px;
+}
+
+#info_left_travel_link {
+ top: 66px;
+ width: 200px;
+}
+
+#info_left_alerts {
+ top: 118px;
+}
+
+#info_left_calendar {
+ top: 166px;
+}
+
+#info_left_apps {
+ top: 216px;
+}
+
+/******************* For Info.Services *******************/
+#info_services_view {
+ top: 48px;
+ left: 153px;
+ background: url(../images/info/info_services_bg.png) no-repeat 0px 39px;
+ height: 384px;
+ width: 647px;
+}
+
+#info_services_view .inner-content {
+ left: 30px;
+ top: 49px;
+}
+
+/******************* For Info.travelLink *******************/
+#info_travelLink {
+ position: absolute;
+ top: 48px;
+ left: 153px;
+ width: 647px;
+ height: 384px;
+ float: left;
+ z-index: 1001;
+}
+
+#info_travelLink_logo {
+ margin-top: 48px;
+ margin-left: 22px;
+}
+
+#info_travelLink .inner-content {
+ top: 71px;
+}
+
+#info_travelLink .block-header-title {
+ top: 21px;
+ left: 75px;
+}
+
+#info_travelLink .list {
+ width: 308px;
+ border-radius: 2px;
+ max-height: 248px;
+ border: 1px solid #393939;
+}
+
+#info_travelLink .list .list-item:last-of-type {
+ height: 50px;
+ border: none;
+}
+
+#info_travelLink .list-content {
+ position: relative;
+ float: left;
+ width: 100%;
+ border: none;
+}
+
+#info_travelLink_listLeft {
+ left: 12px;
+ top: 92px;
+}
+
+#info_travelLink_listRight {
+ position: absolute;
+ top: 43px;
+ right: 5px;
+ width: 310px;
+}
+
+#info_travelLink_listLeft .list-item span,#info_travelLink_listRight .list-item span
+ {
+ margin-left: 44px;
+}
+
+#info_travelLink.fr #info_travelLink_listLeft .list-item span,#info_travelLink.fr #info_travelLink_listRight .list-item span
+ {
+ margin-left: 22px;
+}
+
+#info_travelLink_listRight_item0 span {
+ margin-left: 0px !important;
+}
+
+#info_travelLink_listRight_item0 {
+ text-align: center;
+}
+
+#info_travelLink_listRight .list-item:first-of-type {
+ height: 48px !important;
+}
+
+/******************* For Info.Alerts menu *****************/
+ /******************* For Info.Calendar menu ***************/
+#info_calendar {
+ left: 153px;
+ top: 48px;
+ width: 647px;
+ height: 384px;
+ background-image: url(../images/info/view_info_calendar.png);
+ background-repeat: no-repeat;
+ background-position: 4px 38px;
+}
+
+#info_calendar .inner-wrapper {
+ left: 99px;
+ top: 99px;
+}
+
+#info_calendar .c-btn {
+ width: 90px;
+ height: 34px;
+ background: url(../images/info/callendar-btn.png) no-repeat 0px 0px;
+ text-align: center;
+ line-height: 33px;
+}
+
+#info_calendar .c-btn.active {
+ background: #3b3b3b url(../images/common/btn-28h-gray-active.png)
+ repeat-x 0 5px !important;
+}
+
+#info_calendar .date {
+ white-space: nowrap;
+ font-size: 26px;
+ top: -43px;
+ left: 178px;
+}
+
+#info_calendar .today {
+ white-space: nowrap;
+ top: -58px;
+ left: 414px;
+ height: 48px;
+ width: 130px;
+ font-size: 20px;
+ line-height: 48px;
+ border: 1px #333 solid;
+ text-align: center;
+ border-radius: 2px;
+}
+
+#info_calendar .day {
+ width: 89px;
+ height: 36px;
+ text-align: center;
+ top: 5px;
+ line-height: 25px;
+}
+
+#info_calendar .day.active {
+ background: #f28b06;
+}
+
+#info_calendar .day-1 {
+ left: -86px;
+}
+
+#info_calendar .day-2 {
+ left: 3px;
+}
+
+#info_calendar .day-3 {
+ left: 93px;
+}
+
+#info_calendar .day-4 {
+ left: 183px;
+}
+
+#info_calendar .day-5 {
+ left: 272px;
+}
+
+#info_calendar .day-6 {
+ left: 363px;
+}
+
+#info_calendar .day-7 {
+ left: 453px;
+}
+
+#info_calendar .btn-1 {
+ left: -88px;
+ top: 40px;
+}
+
+#info_calendar .btn-8 {
+ left: -88px;
+ top: 75px;
+}
+
+#info_calendar .btn-15 {
+ left: -87px;
+ top: 108px;
+}
+
+#info_calendar .btn-22 {
+ left: -88px;
+ top: 141px;
+}
+
+#info_calendar .btn-29 {
+ left: -88px;
+ top: 174px;
+}
+
+#info_calendar .btn-7 {
+ left: 452px;
+ top: 40px;
+}
+
+#info_calendar .btn-14 {
+ left: 452px;
+ top: 75px;
+}
+
+#info_calendar .btn-21 {
+ left: 452px;
+ top: 108px;
+}
+
+#info_calendar .btn-28 {
+ left: 452px;
+ top: 141px;
+}
+
+#info_calendar .btn-6 {
+ left: 362px;
+ top: 40px;
+}
+
+#info_calendar .btn-13 {
+ left: 362px;
+ top: 75px;
+}
+
+#info_calendar .btn-20 {
+ left: 362px;
+ top: 108px;
+}
+
+#info_calendar .btn-27 {
+ left: 362px;
+ top: 141px;
+}
+
+#info_calendar .btn-5 {
+ left: 272px;
+ top: 40px;
+}
+
+#info_calendar .btn-12 {
+ left: 272px;
+ top: 75px;
+}
+
+#info_calendar .btn-19 {
+ left: 272px;
+ top: 108px;
+}
+
+#info_calendar .btn-26 {
+ left: 272px;
+ top: 141px;
+}
+
+#info_calendar .btn-4 {
+ left: 182px;
+ top: 40px;
+}
+
+#info_calendar .btn-11 {
+ left: 182px;
+ top: 75px;
+}
+
+#info_calendar .btn-18 {
+ left: 182px;
+ top: 108px;
+}
+
+#info_calendar .btn-25 {
+ left: 182px;
+ top: 141px;
+}
+
+#info_calendar .btn-3 {
+ left: 92px;
+ top: 40px;
+}
+
+#info_calendar .btn-10 {
+ left: 92px;
+ top: 75px;
+}
+
+#info_calendar .btn-17 {
+ left: 92px;
+ top: 108px;
+}
+
+#info_calendar .btn-24 {
+ left: 92px;
+ top: 141px;
+}
+
+#info_calendar .btn-31 {
+ left: 92px;
+ top: 174px;
+}
+
+#info_calendar .btn-2 {
+ left: 2px;
+ top: 40px;
+}
+
+#info_calendar .btn-9 {
+ left: 2px;
+ top: 75px;
+}
+
+#info_calendar .btn-16 {
+ left: 2px;
+ top: 108px;
+}
+
+#info_calendar .btn-23 {
+ left: 2px;
+ top: 141px;
+}
+
+#info_calendar .btn-30 {
+ left: 2px;
+ top: 174px;
+}
+
+/******************* For Info.DeviceList *******************/
+#info_view .info_apps_deviceList_view {
+ background: black;
+ width: 800px;
+ height: 480px;
+ z-index: 201;
+}
+
+#info_apps_deviceList_view .backButton {
+ top: 80px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ left: 5px;
+}
+
+#info_apps_deviceList_view .backButton .ico {
+ margin-top: 13px;
+ margin-left: 8px;
+}
+
+#info_apps_deviceList_view .list {
+ position: absolute;
+ width: 629px;
+ height: 251px;
+ border-radius: 2px;
+ left: 100px;
+ top: 154px;
+}
+
+#info_apps_deviceList_view .list-content {
+ width: 578px;
+ border: none;
+}
+
+#info_apps_deviceList_view .list-item {
+ border: 1px solid #393939 !important;
+}
+
+/******************* For Info.Apps menu*******************/
+#info_apps {
+ position: absolute;
+ top: 48px;
+ left: 153px;
+ width: 647px;
+ height: 384px;
+ float: left;
+ z-index: 1001;
+}
+
+#info_apps .backButton {
+ top: 59px;
+}
+
+#info_apps .block-header-title {
+ top: 67px;
+ left: 73px;
+}
+
+#info_apps_pushToTalk_buttton {
+ top: 80px;
+ right: 5px;
+ height: 48px;
+ width: 48px;
+ border: 1px solid #4bffff;
+ border-radius: 2px;
+}
+
+#info_apps_list {
+ top: 70px;
+ left: 13px;
+}
+
+#info_appst {
+ height: 250px;
+ position: relative;
+ float: left;
+ margin-top: 5px;
+ width: 554px;
+}
+
+#info_apps .list {
+ width: 629px;
+ height: 251px;
+}
+
+#info_apps_list .list-item .ico {
+ width: 50px;
+ height: 50px;
+ position: absolute;
+}
+
+#info_apps_list .list-item span {
+ margin-left: 50px;
+}
+
+#info_apps_list .list-item {
+ height: 48px !important;
+ border: 1px solid #393939;
+}
+
+#info_apps_list .list-content {
+ width: 279px;
+ border: none !important;
+}
+
+#info_apps .leftButtons {
+ width: 278px;
+ float: left;
+ margin-right: 10px;
+ height: 51px;
+ font-size: 20px;
+ line-height: 50px;
+ border: 1px solid #393939;
+ cursor: pointer;
+ left: 10px;
+}
+
+#info_apps .vehicleHealthReport {
+ top: 70px;
+}
+
+#info_apps .Asist911 {
+ top: 122px;
+}
+
+#info_apps .installButton {
+ top: 174px;
+}
+
+#info_apps .findNewApps {
+ top: 226px;
+}
+
+#info_apps .findNewApps img {
+ margin: 9px;
+ width: 32px;
+}
+
+#info_apps .getDeviceList {
+ top: 278px;
+}
+
+#info_apps .getDeviceList img {
+ width: 38px;
+ margin: 6px;
+}
+
+#info_apps .list {
+ float: right;
+ margin-right: 41px;
+ width: 330px
+}
+
+#info_apps_install_Button span {
+ position: absolute;
+}
+
+#info_apps.fr #info_apps_install_Button span {
+ position: absolute;
+ line-height: 20px;
+ width: 170px;
+ top: 3px;
+}
+
+#info_apps .list-item .ico {
+ float: left;
+}
+
+#info_apps .list-item span {
+ height: 23px;
+}
+
+#info_apps .inner-wrapper {
+ left: 100px;
+ top: 71px;
+}
+
+#info_apps_install_Button {
+ border: 1px solid #393939;
+ border-radius: 2px;
+ top: 269px;
+ left: 303px;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/mcs.css b/src/components/HMI/css/mcs.css
new file mode 100644
index 0000000000..304e2ee8d6
--- /dev/null
+++ b/src/components/HMI/css/mcs.css
@@ -0,0 +1,3703 @@
+/*** Multi Contour Seat ** */
+#back-button {
+ background: url(../images/common/page-back-button.png) no-repeat center
+ 12px, url(../images/common/btn-48h.png);
+ width: 48px;
+ z-index: 5000;
+ left: -107px;
+ top: -72px;
+}
+
+#back-button.pressed {
+ background: url(../images/common/page-back-button.png) no-repeat center
+ 12px, url(../images/common/btn-48h-pressed.png);
+}
+
+#MultiContourSeat_customMassage {
+ visibility: hidden;
+ background-color: #000;
+ z-index: 200;
+ width: 800px;
+ height: 345px;
+ position: absolute;
+ top: -60px;
+ left: -112px;
+}
+
+#MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#MultiContourSeat_customMassage_caption2 {
+ top: 35px;
+ width: 350px;
+ text-align: center;
+ left: 225px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .MultiContourSeat_customMassage_previewButton
+ {
+ top: 172px;
+ left: 620px;
+ width: 120px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .MultiContourSeat_customMassage_previewButtonTop
+ {
+ top: 113px;
+ left: 535px;
+ width: 120px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .MultiContourSeat_customMassage_previewButtonBottom
+ {
+ top: 239px;
+ left: 535px;
+ width: 120px;
+ text-align: center;
+}
+
+#MultiContourSeat_customMassage_backButton {
+ top: 220px;
+ left: 535px;
+ width: 120px;
+ text-align: center;
+}
+
+#MultiContourSeat_customMassage_backButtonCenter {
+ bottom: 10px;
+ left: 340px;
+ width: 120px;
+ text-align: center;
+}
+
+#MultiContourSeatContainer .led {
+ width: 12px;
+ height: 40px;
+ background: url("../images/common/seat-act-led.png") no-repeat;
+ position: relative !important;
+ float: left;
+ background-position: -4px 0;
+}
+
+#MultiContourSeatContainer .led-inactive {
+ background: url("../images/common/seat-inact-led.png") no-repeat;
+ background-position: 3px 8px;
+ width: 12px;
+ height: 40px;
+ position: relative !important;
+ float: left;
+}
+
+#MultiContourSeat_customMassage .led {
+ /*background-position: -4px -6px;*/
+
+}
+
+#MultiContourSeat_customMassage .led-inactive {
+ /*background-position: 3px 2px;*/
+
+}
+
+#contentMCS {
+ top: 83px;
+ left: 112px;
+}
+
+#MultiContourSeatContainer {
+ position: absolute;
+ background-color: black;
+ width: 800px;
+ height: 384px;
+ top: -38px;
+ left: -160px;
+ z-index: 1001;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .block-header-title {
+ font-size: 26px;
+ width: 400px;
+ top: -72px;
+ left: -38px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .view_settings_vehicle_MultiContourSeat-left-s
+ {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat-left-s.png)
+ no-repeat;
+ width: 193px;
+ height: 263px;
+ left: -70px;
+ top: -40px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .view_settings_vehicle_MultiContourSeat-Massage-left-s
+ {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat-driver_massage_seat.png)
+ no-repeat;
+ width: 193px;
+ height: 263px;
+ left: -70px;
+ top: -40px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .notActiveSeat {
+ opacity: 0.5;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .not_selected .active {
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .driver {
+ width: 158px;
+ left: -54px;
+ top: 226px;
+ text-align: center;
+ line-height: 49px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .btn-48.active {
+ background: url(../images/common/btn-48h-active-gray.png) repeat-x
+ !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .btn-28.active {
+ background: url(../images/settings/btn-28h-gray-active.png) repeat-x
+ !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .adjust {
+ width: 158px;
+ left: -54px;
+ top: 226px;
+ text-align: center;
+ line-height: 49px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .massage {
+ width: 144px;
+ left: 299px;
+ top: -60px;
+ text-align: center;
+ line-height: 49px;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+ -webkit-border-top-right-radius: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -moz-border-radius-bottomright: 3px;
+ border-top-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .adjust {
+ width: 144px;
+ left: 154px;
+ top: -60px;
+ text-align: center;
+ line-height: 49px;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+ -webkit-border-top-left-radius: 3px;
+ -webkit-border-bottom-left-radius: 3px;
+ -moz-border-radius-topleft: 3px;
+ -moz-border-radius-bottomleft: 3px;
+ border-top-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .passenger {
+ width: 158px;
+ left: 496px;
+ top: 227px;
+ text-align: center;
+ line-height: 49px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .pressed {
+ background: url(../images/common/btn-48h-pressed.png) bottom repeat-x
+ !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-1 {
+ width: 32px;
+ height: 39px;
+ left: 414px;
+ top: 3px;
+ background: url(../images/settings/seats.png) no-repeat;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-2 {
+ width: 32px;
+ height: 39px;
+ left: 414px;
+ top: 61px;
+ background: url(../images/settings/seats.png) no-repeat 0 -61px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-3 {
+ width: 32px;
+ height: 39px;
+ left: 414px;
+ top: 118px;
+ background: url(../images/settings/seats.png) no-repeat 0 -117px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-4 {
+ width: 32px;
+ height: 39px;
+ left: 414px;
+ top: 179px;
+ background: url(../images/settings/seats.png) no-repeat 0 -177px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-5 {
+ width: 32px;
+ height: 39px;
+ left: 414px;
+ top: 236px;
+ background: url(../images/settings/seats.png) no-repeat 0 -233px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-1 {
+ width: 32px;
+ height: 38px;
+ left: 414px;
+ top: 3px;
+ background: url(../images/settings/seats-message.png) no-repeat;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-2 {
+ width: 32px;
+ height: 38px;
+ left: 414px;
+ top: 63px;
+ background: url(../images/settings/seats-message.png) no-repeat 0 -61px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seat-right {
+ width: 193px;
+ height: 263px;
+ left: 480px;
+ top: -40px;
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat-right-s.png)
+ no-repeat;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .massage-seat-right {
+ width: 193px;
+ height: 263px;
+ left: 480px;
+ top: -40px;
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat-Passenger_massage_seat.png)
+ no-repeat;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control {
+ width: 238px;
+ height: 41px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+}
+
+#MultiContourSeat_customMassage .control {
+ width: 213px;
+ /*height: 28px;*/
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .indButtonMCS.active,#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-actions.active,#view_settings_vehicle_MultiContourSeat_Adjust .control.active
+ {
+ border: 1px solid #ff9900;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control .minus {
+ width: 58px;
+ height: 41px;
+ border-right: 1px solid #393939;
+ -webkit-border-top-right-radius: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -moz-border-radius-bottomright: 3px;
+ border-top-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ top: 0;
+ left: 0;
+ background: url(../images/common/btn-48h.png);
+ position: relative;
+ float: left;
+ cursor: pointer;
+}
+
+#MultiContourSeat_customMassage .control .minus { /* height: 28px;*/
+
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .ledContainer {
+ position: relative;
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control .plus {
+ width: 58px;
+ height: 41px;
+ border-left: 1px solid #393939;
+ -webkit-border-top-left-radius: 3px;
+ -webkit-border-bottom-left-radius: 3px;
+ -moz-border-radius-topleft: 3px;
+ -moz-border-radius-bottomleft: 3px;
+ border-top-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ top: 0px;
+ right: 0;
+ background: url(../images/common/btn-48h.png);
+ cursor: pointer;
+}
+
+#MultiContourSeat_customMassage .control .plus { /* height: 28px;*/
+
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control .minus .ico {
+ top: 19px;
+ left: 20px;
+ position: absolute;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control .plus .ico {
+ top: 12px;
+ left: 20px;
+ position: absolute;
+}
+
+#MultiContourSeat_customMassage .control .minus .ico { /*top: 13px;*/
+
+}
+
+#MultiContourSeat_customMassage .control .plus .ico { /*top: 6px;;*/
+
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control-1 {
+ top: 1px;
+ left: 155px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control-2 {
+ top: 60px;
+ left: 155px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control-3 {
+ top: 119px;
+ left: 155px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control-4 {
+ top: 177px;
+ left: 155px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .control-5 {
+ top: 235px;
+ left: 154px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-1 {
+ left: 60px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-2 {
+ left: 71px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-3 {
+ left: 82px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-4 {
+ left: 93px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-5 {
+ left: 104px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-6 {
+ left: 115px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-7 {
+ left: 126px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-8 {
+ left: 137px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-9 {
+ left: 148px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .led-10 {
+ left: 159px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-actions {
+ width: 238px;
+ height: 48px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ left: 154px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-actions-1
+ {
+ top: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .seats-message-actions-2
+ {
+ top: 60px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .quality {
+ width: 79px;
+ height: 48px;
+ background: url(../images/common/btn-48h.png);
+ font-size: 20px;
+ text-align: center;
+ line-height: 48px;
+ cursor: pointer;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .delim {
+ width: 4px;
+ height: 48px;
+ background: url(../images/common/delim.png) no-repeat;
+ z-index: 100;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .active.quality {
+ background: url(../images/common/btn-48h-active-gray.png) !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .delim-0 {
+ left: 76px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .delim-1 {
+ left: 158px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .button0 {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .button1 {
+ left: 80px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust .button2 {
+ left: 159px;
+}
+
+#MultiContourSeatContainer .indButtonMCS {
+ width: 84px;
+ height: 49px;
+ cursor: pointer;
+}
+
+#MultiContourSeatContainer .indButtonMCS .ico {
+ top: 1px;
+ left: 26px;
+ position: absolute;
+}
+
+#MultiContourSeatContainer .indButtonMCS div {
+ width: 22px;
+ height: 17px;
+ top: 35px;
+ left: 25px;
+ position: relative;
+ float: left;
+ margin-left: -9px;
+}
+
+#MultiContourSeatContainer .indButtonMCS div.small_ind_def {
+ background: url(../images/climate/small_ind_def.png) no-repeat;
+}
+
+#MultiContourSeatContainer .indButtonMCS div.small_ind_active {
+ background: url(../images/climate/small_ind_active.png) no-repeat;
+}
+
+#MultiContourSeatContainer .indButtonMCS.notpressed {
+ background: url(../images/common/btn-48h.png);
+ background-size: contain;
+ border-radius: 3px;
+ border: 1px solid #393939;
+}
+
+#MultiContourSeatContainer .indButtonMCS.pressed {
+ background: url(../images/climate/left_person_control/rb_bg_pressed.png)
+ no-repeat;
+}
+
+/* BEGIN concept 1.1 */
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions
+ {
+ left: 186px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageTop1
+ {
+ width: 18px;
+ height: 27px;
+ left: 150px;
+ background-image: url(../images/settings/massageTop.png) !important;
+ background-repeat: no-repeat;
+ top: 8px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageTop2
+ {
+ width: 30px;
+ height: 27px;
+ left: 150px;
+ background-image: url(../images/settings/massageBottom.png) !important;
+ background-repeat: no-repeat;
+ top: 52px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageTop3
+ {
+ width: 30px;
+ height: 27px;
+ left: 143px;
+ background-image: url(../images/settings/massageVertical.png) !important;
+ background-repeat: no-repeat;
+ top: 96px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .dividerBlocks
+ {
+ width: 292px;
+ height: 0px;
+ border: 1px solid #525252;
+ left: 154px;
+ top: 139px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageBottom1
+ {
+ width: 29px;
+ height: 21px;
+ left: 143px;
+ background-image: url(../images/settings/MassageCircle.png) !important;
+ background-repeat: no-repeat;
+ top: 162px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageBottom2
+ {
+ width: 29px;
+ height: 30px;
+ left: 144px;
+ background-image: url(../images/settings/massageRound.png) !important;
+ background-repeat: no-repeat;
+ top: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .massageBottom3
+ {
+ width: 27px;
+ height: 30px;
+ left: 144px;
+ background-image: url(../images/settings/massageHorisontal.png)
+ !important;
+ background-repeat: no-repeat;
+ top: 245px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-1
+ {
+ top: 46px;
+ left: 428px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-2
+ {
+ top: 196px;
+ left: 428px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .quality
+ {
+ width: 56px;
+ height: 38px;
+ line-height: 38px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions
+ {
+ width: 224px;
+ height: 38px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions-top2
+ {
+ top: 45px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions-top3
+ {
+ top: 90px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions-bottom1
+ {
+ top: 150px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions-bottom2
+ {
+ top: 195px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .seats-message-actions-bottom3
+ {
+ top: 240px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .delim
+ {
+ height: 38px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .delim-0
+ {
+ left: 54px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .delim-1
+ {
+ left: 110px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .delim-2
+ {
+ left: 166px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .button1
+ {
+ left: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .button2
+ {
+ left: 112px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1 .button3
+ {
+ left: 168px;
+}
+
+/* END concept 1.1 */ /* BEGIN concept 1.2 */
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-actions
+ {
+ left: 154px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-1
+ {
+ top: 35px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-2
+ {
+ top: 203px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .quality
+ {
+ width: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .quality img
+ {
+ margin-top: 10px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-actions
+ {
+ width: 224px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-actions-top2
+ {
+ top: 60px;
+ left: 210px;
+ width: 168px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-actions-bottom1
+ {
+ top: 170px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .seats-message-actions-bottom2
+ {
+ top: 230px;
+ left: 210px;
+ width: 168px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .delim-0
+ {
+ left: 54px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .delim-1
+ {
+ left: 110px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .delim-2
+ {
+ left: 166px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .button1
+ {
+ left: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .button2
+ {
+ left: 112px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2 .button3
+ {
+ left: 168px;
+}
+
+/* END concept 1.2 */ /* BEGIN concept 1.3 */
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .indButtonMCS div.small_ind_active
+ {
+ background: url(../images/climate/small_ind_green.png) no-repeat;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .patternTextIndicator
+ {
+ top: -29px;
+ width: 80px;
+ text-align: center;
+ font-size: 18px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .patternTextTop
+ {
+ left: 280px;
+ width: 150px;
+ text-align: center;
+ font-size: 18px;
+ top: 30px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .patternTextBottom
+ {
+ left: 280px;
+ width: 150px;
+ text-align: center;
+ font-size: 18px;
+ top: 140px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions
+ {
+ left: 154px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-1
+ {
+ top: 35px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-2
+ {
+ top: 203px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .quality
+ {
+ width: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .quality img
+ {
+ margin-top: 10px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions
+ {
+ width: 224px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions-top1
+ {
+ left: 159px;
+ top: 60px;
+ width: 78px;
+ height: 20px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions-top2
+ {
+ left: 270px;
+ top: 60px;
+ width: 168px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions-bottom1
+ {
+ top: 170px;
+ left: 159px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .seats-message-actions-bottom2
+ {
+ top: 170px;
+ left: 270px;
+ width: 168px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .delim-0
+ {
+ left: 54px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .delim-1
+ {
+ left: 110px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .delim-2
+ {
+ left: 166px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .button1
+ {
+ left: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .button2
+ {
+ left: 112px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_3 .button3
+ {
+ left: 168px;
+}
+
+/* END concept 1.3 */ /* BEGIN concept 1.4 */
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .patternText1
+ {
+ width: 78px;
+ height: 20px;
+ top: 65px;
+ left: 270px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .pattern1
+ {
+ background-image: url('../images/settings/massageTop.png');
+ background-repeat: no-repeat;
+ background-position: 53px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 65px;
+ left: 209px;
+ text-align: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .pattern2
+ {
+ background-image: url('../images/settings/massageBottom.png');
+ background-repeat: no-repeat;
+ background-position: 53px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 65px;
+ left: 209px;
+ text-align: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .pattern3
+ {
+ background-image: url('../images/settings/massageVertical.png');
+ background-repeat: no-repeat;
+ background-position: 52px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 65px;
+ left: 202px;
+ text-align: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .patternbottom1
+ {
+ background-image: url('../images/settings/massageCircle.png');
+ background-repeat: no-repeat;
+ background-position: 53px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 165px;
+ left: 196px;
+ text-align: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .patternbottom2
+ {
+ background-image: url('../images/settings/massageRound.png');
+ background-repeat: no-repeat;
+ background-position: 55px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 165px;
+ left: 196px;
+ text-align: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .patternbottom3
+ {
+ background-image: url('../images/settings/massageHorisontal.png');
+ background-repeat: no-repeat;
+ background-position: 55px 0px;
+ background-size: contain;
+ width: 83px;
+ height: 20px;
+ top: 165px;
+ left: 202px;
+ text-align: left;
+}
+
+#seatsMassageView1_4 .seatsMassageView1_4_seatLabel {
+ top: 172px;
+ left: 45px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .seats-message-2
+ {
+ top: 105px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .patternText2
+ {
+ width: 78px;
+ height: 20px;
+ top: 165px;
+ left: 271px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .labelTitle
+ {
+ width: 600px;
+ text-align: left;
+ height: 30px;
+ line-height: 30px;
+ font-size: 26px;
+ left: 74px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Settings
+ {
+ top: 200px;
+ left: 197px;
+ width: 138px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Settings span
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Settings .ico
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Massage
+ {
+ text-align: center;
+ height: 48px;
+ line-height: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Massage.button0
+ {
+ top: 70px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Massage.button1
+ {
+ top: 130px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Massage.button2
+ {
+ top: 190px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5Back
+ {
+ top: 280px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .concept1_5SettingsScreen
+ {
+ top: -60px;
+ left: -112px;
+ width: 800px;
+ height: 345px;
+ background: black;
+ z-index: 100;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .btn-48
+ {
+ line-height: 48px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .show
+ {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .hide
+ {
+ visibility: hidden;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .quality
+ {
+ width: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .quality img
+ {
+ margin-top: 10px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .seats-message-actions-top
+ {
+ left: 355px;
+ top: 120px;
+ width: 168px !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .seats-message-actions-bottom
+ {
+ left: 355px;
+ top: 210px;
+ width: 168px !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .seats-message-actions
+ {
+ width: 224px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .seats-message-actions-2
+ {
+ top: 100px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .delim-0
+ {
+ left: 54px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .delim-1
+ {
+ left: 110px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .delim-2
+ {
+ left: 166px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .button1
+ {
+ left: 56px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .button2
+ {
+ left: 112px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 .button3
+ {
+ left: 168px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 #alternatingMassage .seats-message-1
+ {
+ width: 32px;
+ height: 38px;
+ top: 126px;
+ background: url(../images/settings/seats-message.png) no-repeat;
+ left: 285px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_4 #alternatingMassage .seats-message-2
+ {
+ width: 32px;
+ height: 38px;
+ top: 216px;
+ left: 285px;
+ background: url(../images/settings/seats-message.png) no-repeat 0 -61px;
+}
+
+/* END concept 1.4 */ /* BEGIN concept 1.5 */
+#seatsMassageView1_5 .seatsMassageView1_5_seatLabel {
+ top: 160px;
+ left: 0px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .labelTitle
+ {
+ width: 600px;
+ text-align: left;
+ height: 30px;
+ line-height: 30px;
+ font-size: 26px;
+ left: 74px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .labelText
+ {
+ top: 97px;
+ width: 672px;
+ text-align: center;
+ left: 140px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Settings
+ {
+ top: 120px;
+ left: 205px;
+ width: 138px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Settings span
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Settings .ico
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Massage
+ {
+ text-align: center;
+ height: 48px;
+ line-height: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Massage.button0
+ {
+ top: 147px;
+ left: 240px;
+ width: 150px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Massage.button1
+ {
+ top: 147px;
+ left: 400px;
+ width: 150px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Massage.button2
+ {
+ top: 147px;
+ left: 560px;
+ width: 150px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5Back
+ {
+ top: 280px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .concept1_5SettingsScreen
+ {
+ top: -60px;
+ left: -112px;
+ width: 800px;
+ height: 345px;
+ background: black;
+ z-index: 100;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Settings .ico
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .btn-48
+ {
+ line-height: 48px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .show
+ {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView1_5 .hide
+ {
+ visibility: hidden;
+}
+
+/* END concept 1.5 */ /* BEGIN HMI concept 2.1 */
+#seatsMassageView2_1 .seatsMassageView2_1_seatLabel {
+ top: 160px;
+ left: 0px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView2_1 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView2_1 .control {
+ width: 237px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .quality
+ {
+ width: 50px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .seats-message-actions
+ {
+ width: 250px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .delim-0
+ {
+ left: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .delim-1
+ {
+ left: 98px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .delim-2
+ {
+ left: 148px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .button1
+ {
+ left: 50px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .button2
+ {
+ left: 100px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .button3
+ {
+ left: 150px;
+ width: 100px;
+}
+
+#seatsMassageView2_1_settingsButton {
+ width: 210px;
+ left: 175px;
+ top: 130px;
+ line-height: 49px;
+}
+
+#seatsMassageView2_1_settingsButton .ico {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .control-11
+ {
+ top: 60px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .control-12
+ {
+ top: 105px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .control-13
+ {
+ top: 150px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .control-14
+ {
+ top: 210px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_1 .control-15
+ {
+ top: 255px;
+ left: 370px;
+}
+
+#seatsMassageView2_1 #MultiContourSeat_customMassage .seats-message-1 {
+ left: 150px;
+ top: 107px;
+}
+
+#seatsMassageView2_1 #MultiContourSeat_customMassage .seats-message-2 {
+ left: 150px;
+ top: 234px;
+}
+
+#seatsMassageView2_1_upperLabel {
+ top: 73px;
+ left: 645px;
+}
+
+#seatsMassageView2_1_middleLabel {
+ top: 117px;
+ left: 645px;
+}
+
+#seatsMassageView2_1_lowerLabel {
+ top: 162px;
+ left: 645px;
+}
+
+#seatsMassageView2_1_frontLabel {
+ top: 223px;
+ left: 645px;
+}
+
+#seatsMassageView2_1_rearLabel {
+ top: 266px;
+ left: 645px;
+}
+
+/* END HMI concept 2.1 */ /* BEGIN HMI concept 2.2 */
+#seatsMassageView2_2 .MultiContourSeat_customMassage_previewButtonTop {
+ top: 134px;
+ left: 625px;
+ width: 120px;
+ text-align: center;
+}
+
+#seatsMassageView2_2 .MultiContourSeat_customMassage_previewButtonBottom
+ {
+ top: 282px;
+ left: 625px;
+ width: 120px;
+ text-align: center;
+}
+
+#seatsMassageView2_2 .control {
+ width: 240px;
+ /*height: 28px;*/
+}
+
+#seatsMassageView2_2 .seatsMassageView2_2_seatLabel {
+ top: 172px;
+ left: 0px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .quality
+ {
+ width: 100px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .seats-message-actions
+ {
+ width: 200px;
+ left: 198px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .delim-0
+ {
+ left: 98px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .button0
+ {
+ left: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .button1
+ {
+ left: 100px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .control-11
+ {
+ top: 80px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .control-12
+ {
+ top: 125px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .control-13
+ {
+ top: 170px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .control-14
+ {
+ top: 253px;
+ left: 370px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView2_2 .control-15
+ {
+ top: 298px;
+ left: 370px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .seats-message-1 {
+ left: 230px;
+ top: 128px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .seats-message-2 {
+ left: 720px;
+ top: 275px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .seats-message-actions-3
+ {
+ top: 45px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .seats-message-actions-4
+ {
+ top: 218px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .seats-message-actions
+ {
+ left: 358px;
+ width: 265px;
+ height: 28px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .quality {
+ width: 50px;
+ height: 28px;
+ line-height: 29px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .delim {
+ height: 28px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .delim-0 {
+ left: 48px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .delim-1 {
+ left: 98px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .delim-2 {
+ left: 148px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .button0 {
+ left: 0;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .button1 {
+ left: 50px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .button2 {
+ left: 100px;
+}
+
+#seatsMassageView2_2 #MultiContourSeat_customMassage .button3 {
+ left: 150px;
+ width: 115px;
+}
+
+#seatsMassageView2_2_upperLabel {
+ top: 93px;
+ left: 645px;
+}
+
+#seatsMassageView2_2_middleLabel {
+ top: 138px;
+ left: 645px;
+}
+
+#seatsMassageView2_2_lowerLabel {
+ top: 182px;
+ left: 645px;
+}
+
+#seatsMassageView2_2_frontLabel {
+ top: 266px;
+ left: 645px;
+}
+
+#seatsMassageView2_2_rearLabel {
+ top: 310px;
+ left: 645px;
+}
+
+#seatsMassageView2_2_settingsButton {
+ width: 210px;
+ left: 192px;
+ top: 130px;
+ line-height: 49px;
+}
+
+#seatsMassageView2_2_settingsButton .ico {
+ float: left;
+}
+
+/* END HMI concept 2.2 */ /* BEGIN HMI concept 4.1 */
+#seatsMassageView4_1 .seatsMassageView4_1_seatLabel {
+ top: 172px;
+ left: 45px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView4_1_settingsButton {
+ width: 140px;
+ left: 200px;
+ top: 130px;
+ line-height: 49px;
+}
+
+#seatsMassageView4_1_settingsButton .ico {
+ float: left;
+}
+
+#seatsMassageView4_1 #MultiContourSeat_customMassage .seats-message-actions
+ {
+ left: 280px;
+}
+
+#seatsMassageView4_1 #MultiContourSeat_customMassage .seats-message-actions-3
+ {
+ top: 115px;
+}
+
+#seatsMassageView4_1 #MultiContourSeat_customMassage .seats-message-actions-4
+ {
+ top: 205px;
+}
+
+#seatsMassageView4_1 #MultiContourSeat_customMassage .seats-message-3 {
+ right: 220px;
+ top: 120px;
+ width: 32px;
+ height: 38px;
+ background: url(../images/settings/seats-message.png) no-repeat;
+}
+
+#seatsMassageView4_1 #MultiContourSeat_customMassage .seats-message-4 {
+ right: 220px;
+ top: 210px;
+ width: 32px;
+ height: 38px;
+ background: url(../images/settings/seats-message.png) no-repeat 0 -61px;
+}
+
+/* END HMI concept 4.1 */ /* BEGIN HMI concept 5.1 */
+#seatsMassageView5_1 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView5_1 .seatsMassageView5_1_seatLabel {
+ top: 187px;
+ left: 0px;
+ font-size: 24px;
+ width: 140px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 #MultiContourSeat_customMassage_backButtonCenter
+ {
+ bottom: 0px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .lableToggleButton
+ {
+ height: 48px;
+ border: 1px solid gray;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .lableToggleButton .btn-48
+ {
+ height: 46px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .lableToggleButton .lableToggle
+ {
+ line-height: 30px;
+ margin-left: 10px;
+ margin-top: 10px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .toogleButtonContainer
+ {
+ width: 100px;
+ margin: 0px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .toogleButtonContainer .toggles
+ {
+ position: absolute;
+ float: left;
+ width: 50px;
+ height: 28px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .seatsMassageView_settingsButton
+ {
+ width: 140px;
+ left: 200px;
+ top: 130px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .seatsMassageView_settingsButton span
+ {
+ position: absolute;
+ line-height: 50px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .toogleButtonContainer span
+ {
+ position: absolute;
+ width: 50px;
+ margin-top: 0px;
+ text-align: center;
+ line-height: 28px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .seats-message-actions-3
+ {
+ left: 247px;
+ margin-top: 10px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Settings
+ {
+ top: 200px;
+ left: 197px;
+ width: 138px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Settings span
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Settings .ico
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Massage
+ {
+ text-align: center;
+ height: 48px;
+ line-height: 48px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist {
+ top: 76px;
+ left: 139px;
+ height: 251px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-content {
+ width: 674px;
+ border-right: none;
+ border-top: none;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item:first-child,#seatsMassageView5_1 .MCSSettingslist .soundButton:first-child
+ {
+ border-top: 1px solid #393939;
+ height: 48px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item {
+ position: relative;
+ width: 577px;
+ float: left;
+ height: 49px;
+ border-bottom: 1px solid #393939;
+ border-right: 1px solid #393939;
+ line-height: 50px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item.soundButton {
+ width: 48px;
+ border-left: 1px solid #393939;
+ margin-left: 10px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item.soundButton .ico {
+ border: none;
+ margin-top: 12px;
+ margin-right: 11px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item.pressed {
+ background: url(../images/phone/phone_button_bg_active.png) repeat-x
+ !important;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item>span {
+ margin-left: 13px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item .ico {
+ float: right;
+ border: 1px solid #393939;
+ border-radius: 2px;
+ margin-top: 9px;
+ margin-right: 9px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .list-item.big-ico img {
+ float: right;
+ border: none;
+ margin-top: 4px;
+ margin-right: 9px;
+}
+
+#seatsMassageView5_1 .MCSSettingslist .toggles,#seatsMassageView5_1 .MCSSettingslist .toggles span
+ {
+ width: 148px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .MCSSettingslist .button1
+ {
+ left: 148px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .MCSSettingslist .delim
+ {
+ height: 29px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .MCSSettingslist .delim-0
+ {
+ left: 147px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .toogleButtonContainer .button1
+ {
+ left: 50px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .toogleButtonContainer .delim-0
+ {
+ left: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5Back
+ {
+ top: 280px;
+ left: 45px;
+ width: 200px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .concept1_5SettingsScreen
+ {
+ top: -60px;
+ left: 154px;
+ width: 291px;
+ height: 345px;
+ background: black;
+ z-index: 100;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .btn-48
+ {
+ line-height: 48px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .show
+ {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView5_1 .hide
+ {
+ visibility: hidden;
+}
+
+/* END HMI concept 5.1 */ /* BEGIN HMI concept 5.2 */
+#seatsMassageView5_2_settingsButton {
+ width: 140px;
+ left: 200px;
+ top: 130px;
+ line-height: 49px;
+}
+
+#seatsMassageView5_2 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView5_2 .seatsMassageView5_2_seatLabel {
+ top: 160px;
+ left: 0px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView5_2_settingsButton .ico {
+ float: left;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .seats-message-actions
+ {
+ left: 275px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .seats-message-actions-3
+ {
+ top: 90px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .seats-message-actions-4
+ {
+ top: 190px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .quality {
+ width: 50px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .seats-message-actions
+ {
+ width: 250px;
+}
+
+#MultiContourSeat_customMassage_5_2_topLabel {
+ top: 65px;
+ left: 275px;
+ width: 250px;
+ text-align: center;
+}
+
+#MultiContourSeat_customMassage_5_2_bottomLabel {
+ top: 165px;
+ left: 275px;
+ width: 250px;
+ text-align: center;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .delim-0 {
+ left: 48px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .delim-1 {
+ left: 98px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .delim-2 {
+ left: 148px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .delim-3 {
+ left: 198px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .button0 {
+ left: 0;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .button1 {
+ left: 50px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .button2 {
+ left: 100px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .button3 {
+ left: 150px;
+}
+
+#seatsMassageView5_2 #MultiContourSeat_customMassage .button4 {
+ left: 200px;
+}
+
+/* END HMI concept 5.2 */ /* BEGIN HMI concept 6.1 */
+#seatsMassageView6_1 #settingsScreen .seatsMassageView6_1_seatLabel {
+ top: 13px;
+ left: 600px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView6_1 .mySettingsPopUpTitle {
+ width: 143px;
+ height: 25px;
+ position: absolute;
+ top: 163px;
+ left: 216px !important;
+ background: gray;
+ text-align: center;
+ line-height: 25px;
+ font-size: 16px !important;
+ font-weight: bold;
+}
+
+#seatsMassageView6_1 .mySettingsLabel {
+ z-index: 100;
+ left: 102px;
+}
+
+#seatsMassageView6_1 .MultiContourSeat_customMassage .btn-28.active {
+ background: url(../images/common/btn-48h-active-gray.png) repeat-x
+ !important;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .quality,#seatsMassageView6_1 #settingsScreen .pauseButtons .quality
+ {
+ width: 60px;
+}
+
+#seatsMassageView6_1 #settingsScreen .quality {
+ height: 35px;
+ width: 130px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+#seatsMassageView6_1 #settingsScreen .btn-28 {
+ text-align: center;
+ line-height: 34px;
+}
+
+#seatsMassageView6_1 .settingsScreen {
+ width: 800px;
+ height: 368px;
+ top: -15px;
+ background: black;
+ visibility: hidden;
+}
+
+#seatsMassageView6_1 .settingsScreen2 {
+ width: 800px;
+ height: 368px;
+ top: -15px;
+ background: black;
+ visibility: hidden;
+}
+
+#seatsMassageView6_1 #settingsScreen .seats-message-actions {
+ height: 39px;
+ border: none;
+}
+
+#seatsMassageView6_1 #settingsScreen .button0 {
+ left: 0;
+}
+
+#seatsMassageView6_1 #settingsScreen .button1 {
+ left: 140px;
+}
+
+#seatsMassageView6_1 #settingsScreen .button2 {
+ left: 280px;
+}
+
+#seatsMassageView6_1 #settingsScreen .button3 {
+ left: 420px;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .button0,#seatsMassageView6_1 #settingsScreen .pauseButtons .button0
+ {
+ left: 0;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .button1,#seatsMassageView6_1 #settingsScreen .pauseButtons .button1
+ {
+ left: 70px;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .button2,#seatsMassageView6_1 #settingsScreen .pauseButtons .button2
+ {
+ left: 140px;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .button3,#seatsMassageView6_1 #settingsScreen .pauseButtons .button3
+ {
+ left: 210px;
+}
+
+#seatsMassageView6_1 #settingsScreen .durationButtons .button4,#seatsMassageView6_1 #settingsScreen .pauseButtons .button4
+ {
+ left: 280px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .control-11
+ {
+ top: 60px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .control-12
+ {
+ top: 105px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .control-13
+ {
+ top: 150px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .control-14
+ {
+ top: 230px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .control-15
+ {
+ top: 275px;
+ left: 350px;
+}
+
+#seatsMassageView6_1 #settingsScreen2 .seats-message-1 {
+ left: 280px;
+ top: 110px;
+}
+
+#seatsMassageView6_1 #settingsScreen2 .seats-message-2 {
+ left: 280px;
+ top: 252px;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_seatLabel {
+ top: 172px;
+ left: 45px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView6_1 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_upperLabel {
+ top: 73px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_middleLabel {
+ top: 118px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_lowerLabel {
+ top: 163px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_frontLabel {
+ top: 243px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_1 .seatsMassageView6_1_rearLabel {
+ top: 287px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_1 .label {
+ font-size: 26px;
+ left: 20px;
+}
+
+#seatsMassageView6_1 .massageLabel {
+ top: 51px;
+}
+
+#seatsMassageView6_1 .pattern {
+ top: 91px;
+}
+
+#seatsMassageView6_1 .intensity {
+ top: 131px;
+}
+
+#seatsMassageView6_1 .speed {
+ top: 211px;
+}
+
+#seatsMassageView6_1 .duration {
+ top: 251px;
+}
+
+#seatsMassageView6_1 .pause {
+ top: 291px;
+}
+
+#seatsMassageView6_1 .editMenu {
+ left: 70px;
+ width: 240px;
+ top: 12px;
+ text-align: center;
+}
+
+#seatsMassageView6_1 .massageButtons {
+ top: 50px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .massageButtons img {
+ height: 34px;
+}
+
+#seatsMassageView6_1 .patternButtons {
+ top: 90px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .intensityButtons {
+ top: 130px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .intensityEditCustom {
+ top: 170px;
+ left: 520px;
+ width: 270px;
+ height: 34px;
+}
+
+#seatsMassageView6_1 .speedButtons {
+ top: 210px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .durationButtons {
+ top: 250px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .pauseButtons {
+ top: 290px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_1 .preview {
+ top: 330px;
+ left: 289px;
+ width: 214px;
+ height: 34px;
+}
+
+#seatsMassageView6_1 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView6_1 .settingsScreen2 .MultiContourSeat_customMassage_caption
+ {
+ top: 14px;
+}
+
+#seatsMassageView6_1 .SettingsBlocks {
+ margin-left: auto;
+ margin-right: auto;
+ width: 315px;
+ height: 50px;
+ position: relative;
+ -webkit-transition: width 1s;
+}
+
+#seatsMassageView6_1 .MultiContourSeat_customMassage {
+ visibility: hidden;
+ background-color: #000;
+ z-index: 200;
+ width: 800px;
+ height: 345px;
+ position: absolute;
+ top: -60px;
+ left: -112px;
+ background-image: url('../images/settings/mcsBlockBackArrow6_1.png');
+ background-position: 339px 39px;
+ background-repeat: no-repeat;
+}
+
+#seatsMassageView6_1 .btn-48 {
+ line-height: 48px;
+ text-align: center;
+}
+
+#seatsMassageView6_1 .show {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButtonUp
+ {
+ width: 200px;
+ left: 560px;
+ top: 101px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButtonDown
+ {
+ width: 200px;
+ left: 560px;
+ bottom: 143px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButtonEdit
+ {
+ width: 250px;
+ left: 275px;
+ bottom: 40px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButtonNew
+ {
+ width: 100px;
+ left: 275px;
+ bottom: 0px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButtonTrash
+ {
+ width: 140px;
+ left: 385px;
+ bottom: 0px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsBlock
+ {
+ width: 220px;
+ top: 130px;
+ text-align: center !important;
+ transition: 1s;
+ -webkit-transition: top 1s; /* Safari and Chrome */
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButton
+ {
+ width: 159px;
+ left: 154px;
+ top: 205px;
+ line-height: 49px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButton2
+ {
+ width: 50px;
+ left: 365px;
+ top: 205px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .seatsMassageView_settingsButton3
+ {
+ width: 50px;
+ left: 403px;
+ top: 130px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .hide
+ {
+ visibility: hidden;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_1 .captionMySettings
+ {
+ top: 157px;
+ left: 138px;
+ width: 300px;
+ height: 90px;
+ border: 1px solid;
+ padding: 8px 13px 13px 13px;
+ font-size: 26px;
+}
+
+/* END HMI concept 6.1 */ /* BEGIN HMI concept 6.2 */
+#seatsMassageView6_2 #settingsScreen .seatsMassageView6_2_seatLabel {
+ top: 13px;
+ left: 600px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView6_2 .MultiContourSeat_customMassage .seatsMassageView6_2_seatLabel_custom
+ {
+ top: 60px;
+ left: 300px !important;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButton
+ {
+ width: 159px;
+ left: 154px;
+ top: 205px;
+ line-height: 49px;
+ z-index: 1;
+}
+
+#seatsMassageView6_2 .mySettingsPopUpTitle {
+ width: 143px;
+ height: 25px;
+ position: absolute;
+ top: 163px;
+ left: 216px !important;
+ background: gray;
+ text-align: center;
+ line-height: 25px;
+ font-size: 16px !important;
+ font-weight: bold;
+}
+
+#seatsMassageView6_2 .mySettingsLabel {
+ z-index: 100;
+ left: 102px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .captionMySettings
+ {
+ top: 157px;
+ left: 138px;
+ width: 300px;
+ height: 90px;
+ border: 1px solid;
+ padding: 8px 13px 13px 13px;
+ font-size: 26px;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .quality,#seatsMassageView6_2 #settingsScreen .pauseButtons .quality
+ {
+ width: 60px;
+}
+
+#seatsMassageView6_2 #settingsScreen .quality {
+ height: 35px;
+ width: 130px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+}
+
+#seatsMassageView6_2 #settingsScreen .btn-28 {
+ text-align: center;
+ line-height: 34px;
+}
+
+#seatsMassageView6_2 .settingsScreen {
+ width: 800px;
+ height: 368px;
+ top: -15px;
+ background: black;
+ visibility: hidden;
+}
+
+#seatsMassageView6_2 .settingsScreen2 {
+ width: 800px;
+ height: 368px;
+ top: -15px;
+ background: black;
+ visibility: hidden;
+}
+
+#seatsMassageView6_2 #settingsScreen .seats-message-actions {
+ height: 39px;
+ border: none;
+}
+
+#seatsMassageView6_2 #settingsScreen .button0 {
+ left: 0;
+}
+
+#seatsMassageView6_2 #settingsScreen .button1 {
+ left: 140px;
+}
+
+#seatsMassageView6_2 #settingsScreen .button2 {
+ left: 280px;
+}
+
+#seatsMassageView6_2 #settingsScreen .button3 {
+ left: 420px;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .button0,#seatsMassageView6_2 #settingsScreen .pauseButtons .button0
+ {
+ left: 0;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .button1,#seatsMassageView6_2 #settingsScreen .pauseButtons .button1
+ {
+ left: 70px;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .button2,#seatsMassageView6_2 #settingsScreen .pauseButtons .button2
+ {
+ left: 140px;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .button3,#seatsMassageView6_2 #settingsScreen .pauseButtons .button3
+ {
+ left: 210px;
+}
+
+#seatsMassageView6_2 #settingsScreen .durationButtons .button4,#seatsMassageView6_2 #settingsScreen .pauseButtons .button4
+ {
+ left: 280px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .control-11
+ {
+ top: 60px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .control-12
+ {
+ top: 105px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .control-13
+ {
+ top: 150px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .control-14
+ {
+ top: 230px;
+ left: 350px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .control-15
+ {
+ top: 275px;
+ left: 350px;
+}
+
+#seatsMassageView6_2 #settingsScreen2 .seats-message-1 {
+ left: 280px;
+ top: 110px;
+}
+
+#seatsMassageView6_2 #settingsScreen2 .seats-message-2 {
+ left: 280px;
+ top: 252px;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_seatLabel {
+ top: 172px;
+ left: 45px;
+ font-size: 24px;
+ width: 199px;
+ text-align: center;
+}
+
+#seatsMassageView6_2 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_upperLabel {
+ top: 73px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_middleLabel {
+ top: 118px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_lowerLabel {
+ top: 163px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_frontLabel {
+ top: 243px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_2 .seatsMassageView6_2_rearLabel {
+ top: 287px;
+ left: 615px !important;
+ font-size: 18px !important;
+}
+
+#seatsMassageView6_2 .label {
+ font-size: 26px;
+ left: 20px;
+}
+
+#seatsMassageView6_2 .massageLabel {
+ top: 51px;
+}
+
+#seatsMassageView6_2 .pattern {
+ top: 91px;
+}
+
+#seatsMassageView6_2 .intensity {
+ top: 131px;
+}
+
+#seatsMassageView6_2 .speed {
+ top: 211px;
+}
+
+#seatsMassageView6_2 .duration {
+ top: 251px;
+}
+
+#seatsMassageView6_2 .pause {
+ top: 291px;
+}
+
+#seatsMassageView6_2 .editMenu {
+ width: 240px;
+ top: 12px;
+ text-align: center;
+ left: 70px;
+}
+
+#seatsMassageView6_2 .massageButtons {
+ top: 50px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .massageButtons img {
+ height: 34px;
+}
+
+#seatsMassageView6_2 .patternButtons {
+ top: 90px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .intensityButtons {
+ top: 130px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .intensityEditCustom {
+ top: 170px;
+ left: 520px;
+ width: 270px;
+ height: 34px;
+}
+
+#seatsMassageView6_2 .speedButtons {
+ top: 210px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .durationButtons {
+ top: 250px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .pauseButtons {
+ top: 290px;
+ left: 240px;
+ width: 560px;
+}
+
+#seatsMassageView6_2 .preview {
+ top: 330px;
+ left: 289px;
+ width: 214px;
+ height: 34px;
+}
+
+#seatsMassageView6_2 .settingsScreen2 .MultiContourSeat_customMassage_caption
+ {
+ top: 14px;
+}
+
+#seatsMassageView6_2 .MultiContourSeat_customMassage_caption {
+ width: 600px;
+ height: 28px;
+ line-height: 29px;
+ left: 74px;
+ font-size: 26px;
+}
+
+#seatsMassageView6_2 .SettingsBlocks {
+ margin-left: auto;
+ margin-right: auto;
+ width: 315px;
+ height: 50px;
+ position: relative;
+ -webkit-transition: width 1s;
+}
+
+#seatsMassageView6_2 .MultiContourSeat_customMassage {
+ visibility: hidden;
+ background-color: #000;
+ z-index: 200;
+ width: 800px;
+ height: 345px;
+ position: absolute;
+ top: -60px;
+ left: -112px;
+ background-image: url('../images/settings/mcsBlockBackArrow6_2.png');
+ background-position: 39px 145px;
+ background-repeat: no-repeat;
+}
+
+#seatsMassageView6_2 .btn-48 {
+ line-height: 48px;
+ text-align: center;
+}
+
+#seatsMassageView6_2 .show {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButtonNew
+ {
+ width: 100px;
+ left: 270px;
+ bottom: 20px;
+ line-height: 49px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButtonTrash
+ {
+ width: 71px;
+ left: 446px;
+ bottom: 5px;
+ line-height: 49px;
+ height: 78px;
+ background-image: url("../images/settings/trash.png");
+ background-repeat: no-repeat;
+ background-size: contain;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButtonSave
+ {
+ width: 100px;
+ left: 480px;
+ bottom: 20px;
+ line-height: 49px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsBlock
+ {
+ width: 100px;
+ top: 130px;
+ line-height: 49px;
+ text-align: center !important;
+ transition: left 1s;
+ -webkit-transition: left 1s; /* Safari and Chrome */
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButton2
+ {
+ width: 50px;
+ left: 365px;
+ top: 205px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .seatsMassageView_settingsButton3
+ {
+ width: 50px;
+ left: 403px;
+ top: 130px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView6_2 .hide
+ {
+ visibility: hidden;
+}
+
+/* END HMI concept 6.2 */ /* BEGIN HMI concept 7.1 */
+#seatsMassageView7_1_appendix .localBack {
+ background: url(../images/common/page-back-button.png) no-repeat center
+ 12px, url(../images/common/btn-48h.png);
+ width: 48px;
+ z-index: 5000;
+ left: 5px;
+ top: 59px;
+ visibility: hidden;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .seatsMassageView_settingsButton2
+ {
+ width: 50px;
+ left: 365px;
+ top: 205px;
+ line-height: 49px;
+ text-align: left !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .seatsMassageView_settingsButton
+ {
+ width: 159px;
+ left: 154px;
+ top: 205px;
+ line-height: 49px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .captionMySettings
+ {
+ top: 157px;
+ left: 138px;
+ width: 300px;
+ height: 90px;
+ border: 1px solid;
+ padding: 8px 13px 13px 13px;
+ font-size: 26px;
+}
+
+#seatsMassageView7_1 .mySettingsPopUpTitle {
+ width: 143px;
+ height: 25px;
+ position: absolute;
+ top: 163px;
+ left: 216px !important;
+ background: gray;
+ text-align: center;
+ line-height: 25px;
+ font-size: 16px !important;
+ font-weight: bold;
+}
+
+#seatsMassageView7_1 .mySettingsLabel {
+ z-index: 100;
+ left: 102px;
+}
+
+#seatsMassageView7_1_appendix .btn-48 {
+ line-height: 48px;
+ text-align: center;
+}
+
+#seatsMassageView7_1_appendix .seats-message-actions-3 {
+ top: 165px;
+ left: 59px;
+}
+
+#seatsMassageView7_1_appendix .show {
+ visibility: visible !important;
+}
+
+#seatsMassageView7_1_appendix {
+ z-index: 2003;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView {
+ visibility: hidden;
+ background-color: whiteSmoke;
+ width: 350px;
+ height: 368px;
+ position: absolute;
+ top: 56px;
+ left: 305px !important;
+ background: black;
+ border: #A6A6A6 solid 2px;
+ border-radius: 6px;
+ font-size: 18px;
+ font-family: Arial;
+}
+
+#seatsMassageView7_1_appendix .titleQuestion {
+ font-size: 21px;
+ font-family: Arial;
+ width: 350px;
+ text-align: center;
+ top: 25px;
+}
+
+#seatsMassageView7_1_appendix .question {
+ font-size: 18px;
+ font-family: Arial;
+ width: 350px;
+ text-align: center;
+ top: 65px;
+}
+
+#seatsMassageView7_1_appendix .titleAnswer {
+ font-size: 21px;
+ font-family: Arial;
+ width: 350px;
+ text-align: center;
+ top: 103px;
+}
+
+#seatsMassageView7_1_appendix .View1 .seats-message-actions-3 {
+ top: 194px;
+ left: 7px;
+}
+
+#seatsMassageView7_1_appendix .View1 .titleQuestion {
+ left: 0px;
+ width: 500px;
+ top: 40px;
+}
+
+#seatsMassageView7_1_appendix .View1 .question {
+ left: 0px;
+ top: 90px;
+ text-align: center;
+ width: 500px;
+}
+
+#seatsMassageView7_1_appendix .View1 .titleAnswer {
+ left: 0px;
+ width: 500px;
+ top: 134px;
+}
+
+#seatsMassageView7_1_appendix .View1 .button0 {
+ left: 0;
+ top: 0 !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .button1 {
+ left: 0;
+ top: 45px !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .button2 {
+ left: 0;
+ top: 90px !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .button3 {
+ left: 258px !important;
+ top: 0px !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .button4 {
+ left: 258px !important;
+ top: 45px !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .button5 {
+ left: 258px !important;
+ top: 90px !important;
+}
+
+#seatsMassageView7_1_appendix .View1 .btn-48 {
+ height: 35px !important;
+ line-height: 35px !important;
+}
+
+#seatsMassageView7_1_appendix .seatsMassageDialogView4 {
+ visibility: hidden;
+ font-size: 26px !important;
+ font-family: Arial;
+ font-size: 18px;
+ font-family: Arial;
+ left: 300px;
+ top: 140px;
+ width: 232px;
+ height: 127px;
+ background: white;
+ border-radius: 6px;
+ border: 1px solid gray;
+ color: black;
+ text-align: center;
+ padding: 10px;
+}
+
+#seatsMassageView7_1_appendix .seatsMassageDialogView5 {
+ visibility: hidden;
+ font-size: 26px !important;
+ font-family: Arial;
+ font-size: 18px;
+ font-family: Arial;
+ left: 300px;
+ top: 132px;
+ width: 326px;
+ height: 165px;
+ background: white;
+ border-radius: 6px;
+ border: 1px solid gray;
+ color: black;
+ text-align: center;
+ padding: 10px;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView.View1 {
+ visibility: hidden;
+ background-color: whiteSmoke;
+ width: 520px;
+ height: 368px;
+ position: absolute;
+ top: 56px;
+ left: 265px !important;
+ background: black;
+ border: #A6A6A6 solid 2px;
+ border-radius: 6px;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView .button0 {
+ left: 0;
+ top: 0;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView .button1 {
+ left: 0;
+ top: 60px;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView .button2 {
+ left: 0;
+ top: 120px;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView .button3 {
+ left: 0;
+ top: 180px;
+}
+
+#seatsMassageView7_1_appendix .SeatsMassageDialogView .button {
+ width: 245px;
+ border-radius: 3px;
+ border: 1px solid #393939;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .concept1_5Settings
+ {
+ top: 200px;
+ left: 197px;
+ width: 138px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .concept1_5Settings span
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .concept1_5Settings .ico
+ {
+ float: left;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .concept1_5Massage
+ {
+ text-align: center;
+ height: 48px;
+ line-height: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .toogleButtonContainer .button1
+ {
+ left: 50px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .toogleButtonContainer .delim-0
+ {
+ left: 48px;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .concept1_5SettingsScreen
+ {
+ top: -60px;
+ left: 154px;
+ width: 291px;
+ height: 345px;
+ background: black;
+ z-index: 100;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .btn-48
+ {
+ line-height: 48px;
+ text-align: center;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .show
+ {
+ visibility: visible !important;
+}
+
+#view_settings_vehicle_MultiContourSeat_Adjust #seatsMassageView7_1 .hide
+ {
+ visibility: hidden;
+}
+
+/* END HMI concept 7.1 */ /* lumbars */ /* driver */
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion1 .active {
+ background: url(../images/settings/TopLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 38px;
+ height: 29px;
+ top: 70px;
+ left: 22px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion2 .active {
+ background: url(../images/settings/MiddleLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 34px;
+ height: 30px;
+ top: 84px;
+ left: 18px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion3 .active {
+ background: url(../images/settings/LowerLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 33px;
+ height: 36px;
+ top: 99px;
+ left: 14px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion4 .active {
+ background: url(../images/settings/lumbar_cushion_top-active.png)
+ no-repeat;
+ width: 70px;
+ height: 70px;
+ top: 71px;
+ left: -2px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion5 .active {
+ background: url(../images/settings/lumbar_cushion_bot-active.png)
+ no-repeat;
+ width: 91px;
+ height: 59px;
+ top: 112px;
+ left: -37px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion6 .active {
+ background: url(../images/settings/whiteOutline_driver-lumbar-all.png)
+ no-repeat;
+ width: 47px;
+ height: 68px;
+ top: 70px;
+ left: 16px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion7 .active {
+ background: url(../images/settings/Cushion_WhiteOutline_driver.png)
+ no-repeat;
+ width: 74px;
+ height: 36px;
+ top: 119px;
+ left: -32px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion1 .lumbar {
+ background: url(../images/settings/driver-lumbar-top.png) no-repeat;
+ width: 36px;
+ height: 31px;
+ top: 69px;
+ left: 22px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion2 .lumbar {
+ background: url(../images/settings/driver-lumbar-mid.png) no-repeat;
+ width: 34px;
+ height: 31px;
+ top: 84px;
+ left: 17px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion3 .lumbar {
+ background: url(../images/settings/driver-lumbar-low.png) no-repeat;
+ width: 31px;
+ height: 35px;
+ top: 99px;
+ left: 15px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion4 .lumbar {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat_adj1.png)
+ no-repeat;
+ width: 70px;
+ height: 70px;
+ top: 68px;
+ left: -4px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion5 .lumbar {
+ background: url(../images/settings/lumbar_cushion.png) no-repeat;
+ width: 91px;
+ height: 59px;
+ top: 111px;
+ left: -36px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion6 .lumbar {
+ background: url(../images/settings/driver-lumbar-all.png) no-repeat;
+ width: 47px;
+ height: 68px;
+ top: 68px;
+ left: 12px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_driverSeat_cushion7 .lumbar {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat_adj2.png)
+ no-repeat;
+ width: 73px;
+ height: 37px;
+ top: 119px;
+ left: -30px;
+ opacity: 0;
+}
+
+/* passenger */
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion1 .active {
+ background: url(../images/settings/TopLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 38px;
+ height: 29px;
+ top: 70px;
+ left: 541px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion2 .active {
+ background:
+ url(../images/settings/MiddleLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 34px;
+ height: 30px;
+ top: 84px;
+ left: 549px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion3 .active {
+ background:
+ url(../images/settings/LowerLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 33px;
+ height: 36px;
+ top: 99px;
+ left: 555px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion4 .active {
+ background:
+ url(../images/settings/lumbar_cushion_top_passenger-active.png)
+ no-repeat;
+ width: 70px;
+ height: 70px;
+ top: 71px;
+ left: 535px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion5 .active {
+ background:
+ url(../images/settings/lumbar_cushion_bot_passanger-active.png)
+ no-repeat;
+ width: 91px;
+ height: 59px;
+ top: 112px;
+ left: 546px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion6 .active {
+ background:
+ url(../images/settings/WhiteOutline_passenger-lumbar-all.png)
+ no-repeat;
+ width: 47px;
+ height: 68px;
+ top: 70px;
+ left: 544px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion7 .active {
+ background: url(../images/settings/Cushion_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 74px;
+ height: 36px;
+ top: 120px;
+ left: 558px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion1 .lumbar {
+ background: url(../images/settings/passenger-lumbar-top.png) no-repeat;
+ width: 37px;
+ height: 31px;
+ top: 68px;
+ left: 542px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion2 .lumbar {
+ background: url(../images/settings/passenger-lumbar-mid.png) no-repeat;
+ width: 34px;
+ height: 31px;
+ top: 84px;
+ left: 550px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion3 .lumbar {
+ background: url(../images/settings/passenger-lumbar-low.png) no-repeat;
+ width: 32px;
+ height: 35px;
+ top: 99px;
+ left: 555px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion4 .lumbar {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat_adj1_passenger.png)
+ no-repeat;
+ width: 69px;
+ height: 69px;
+ top: 70px;
+ left: 535px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion5 .lumbar {
+ background: url(../images/settings/passenger_lumbar_cushion.png)
+ no-repeat;
+ width: 91px;
+ height: 59px;
+ top: 111px;
+ left: 546px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion6 .lumbar {
+ background: url(../images/settings/passenger-lumbar-all.png) no-repeat;
+ width: 47px;
+ height: 68px;
+ top: 68px;
+ left: 540px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_passengerSeat_cushion7 .lumbar {
+ background:
+ url(../images/settings/view_settings_vehicle_MultiContourSeat_adj2_passenger.png)
+ no-repeat;
+ width: 72px;
+ height: 37px;
+ top: 119px;
+ left: 559px;
+ opacity: 0;
+}
+
+/* CUSTOM MASSAGE */ /* Driver cushions */
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion6 .active
+ {
+ background: url(../images/settings/TopLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 38px;
+ height: 29px;
+ top: 70px;
+ left: 22px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion7 .active
+ {
+ background: url(../images/settings/MiddleLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 34px;
+ height: 30px;
+ top: 84px;
+ left: 18px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion8 .active
+ {
+ background: url(../images/settings/LowerLumbar_WhiteOutline_driver.png)
+ no-repeat;
+ width: 33px;
+ height: 36px;
+ top: 99px;
+ left: 14px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion9 .active
+ {
+ background: url(../images/settings/driver-lumbar-m-top-selected.png)
+ no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 119px;
+ left: -30px;
+ z-index: 1;
+ opacity: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion10 .active
+ {
+ background: url(../images/settings/driver-lumbar-m-bottom-selected.png)
+ no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 119px;
+ left: -30px;
+ z-index: 1;
+ opacity: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion6 .lumbar
+ {
+ background: url(../images/settings/driver-lumbar-top.png) no-repeat;
+ width: 36px;
+ height: 31px;
+ top: 69px;
+ left: 22px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion7 .lumbar
+ {
+ background: url(../images/settings/driver-lumbar-mid.png) no-repeat;
+ width: 34px;
+ height: 31px;
+ top: 84px;
+ left: 17px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion8 .lumbar
+ {
+ background: url(../images/settings/driver-lumbar-low.png) no-repeat;
+ width: 31px;
+ height: 35px;
+ top: 99px;
+ left: 15px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion9 .lumbar
+ {
+ background: url(../images/settings/driver-lumbar-m-top.png) no-repeat;
+ width: 73px;
+ height: 37px;
+ top: 119px;
+ left: -30px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_driverSeat_cushion10 .lumbar
+ {
+ background: url(../images/settings/driver-lumbar-m-bottom.png) no-repeat;
+ width: 73px;
+ height: 37px;
+ top: 119px;
+ left: -30px;
+ opacity: 0;
+}
+
+/* Passenger cushions */
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion6 .active
+ {
+ background: url(../images/settings/TopLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 38px;
+ height: 29px;
+ top: 70px;
+ left: 541px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion7 .active
+ {
+ background:
+ url(../images/settings/MiddleLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 34px;
+ height: 30px;
+ top: 84px;
+ left: 549px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion8 .active
+ {
+ background:
+ url(../images/settings/LowerLumbar_WhiteOutline_passenger.png)
+ no-repeat;
+ width: 33px;
+ height: 36px;
+ top: 99px;
+ left: 555px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion9 .active
+ {
+ background: url(../images/settings/passenger-lumbar-m-top-selected.png)
+ no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 120px;
+ left: 558px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion10 .active
+ {
+ background:
+ url(../images/settings/passenger-lumbar-m-bottom-selected.png)
+ no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 120px;
+ left: 558px;
+ z-index: 1;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion6 .lumbar
+ {
+ background: url(../images/settings/passenger-lumbar-top.png) no-repeat;
+ width: 36px;
+ height: 31px;
+ top: 70px;
+ left: 541px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion7 .lumbar
+ {
+ background: url(../images/settings/passenger-lumbar-mid.png) no-repeat;
+ width: 34px;
+ height: 31px;
+ top: 84px;
+ left: 549px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion8 .lumbar
+ {
+ background: url(../images/settings/passenger-lumbar-low.png) no-repeat;
+ width: 31px;
+ height: 35px;
+ top: 99px;
+ left: 555px;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion9 .lumbar
+ {
+ background: url(../images/settings/passenger-lumbar-m-top.png) no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 120px;
+ left: 558px;;
+ opacity: 0;
+}
+
+#view_settings_vehicle_MultiContourSeat_customMassage_passengerSeat_cushion10 .lumbar
+ {
+ background: url(../images/settings/passenger-lumbar-m-bottom.png)
+ no-repeat;
+ width: 77px;
+ height: 41px;
+ top: 120px;
+ left: 558px;
+ opacity: 0;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/media.css b/src/components/HMI/css/media.css
new file mode 100644
index 0000000000..85688d5e6b
--- /dev/null
+++ b/src/components/HMI/css/media.css
@@ -0,0 +1,528 @@
+#media_leftmenu {
+ z-index: 301;
+ position: absolute;
+ top: 90px;
+ left: 0px;
+ width: 150px;
+ height: 300px;
+ background: #333;
+}
+
+#media_cdButton {
+ font-size: 18px;
+ padding-left: 48px;
+ line-height: 48px;
+}
+
+#media_sdlButton {
+ font-size: 18px;
+ line-height: 48px;
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#media_sdlButton span {
+ margin-left: 50px;
+}
+
+#media_status {
+ bottom: 0px;
+ left: 0px;
+ font-size: 21px;
+ width: 324px;
+ height: 48px;
+ cursor: pointer;
+ background: url(../images/common/media-status-bg.png) no-repeat;
+ z-index: 1;
+}
+
+#media_status_homestatus {
+ position: absolute;
+ visibility: hidden;
+ width: 100%;
+ line-height: 50px;
+}
+
+#media_status_homestatus span {
+ padding-left: 11px;
+}
+
+.ls_border {
+ z-index: 201;
+ position: absolute;
+ top: -3px;
+ left: 0px;
+ width: 153px;
+ height: 306px;
+ background: url(../images/common/ls_border.png) no-repeat;
+}
+
+.media-ls-items {
+ position: relative;
+ width: 150px;
+ height: 300px;
+}
+
+.media-ls-item {
+ z-index: 201;
+ position: relative;
+ height: 50px;
+ cursor: pointer;
+ background: url(../images/media/ls-item_bg.png) no-repeat;
+}
+
+.media-ls-item.active_state {
+ background: url(../images/media/ls-item_bg_act.png) no-repeat !important;
+}
+
+.media-ls-item>.bg {
+ z-index: 201;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 150px;
+ height: 50px;
+}
+
+.media-ls-item>.ico {
+ z-index: 299;
+ position: absolute;
+ left: 0px;
+ width: 50px;
+ height: 50px;
+}
+
+.media-ls-item>.ico.more {
+ left: 50px;
+}
+
+.media-ls-item>p {
+ z-index: 298;
+ position: absolute;
+ left: 48px;
+ width: 86px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+.media-ls-item>.led {
+ z-index: 299;
+ position: absolute;
+ top: 0px;
+ right: 8px;
+ width: 24px;
+ height: 50px;
+}
+
+.media-ls-item.empty {
+ background: #333333;
+}
+
+.main-preset-buttons-wraper {
+ position: relative;
+ width: 468px;
+ height: 100px;
+ float: left;
+ left: 165px;
+ top: 290px;
+ z-index: 503;
+}
+
+.main-preset-buttons-wraper .preset-items {
+ position: relative;
+ width: 467px;
+ height: 99px;
+ border: 1px solid #393939;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ z-index: 1;
+}
+
+.main-preset-buttons-wraper .preset-item {
+ position: relative;
+ display: inline-block;
+ vertical-align: top;
+ border-right: 1px solid #393939;
+ border-bottom: 1px solid #393939;
+ width: 92.6px;
+ height: 49px;
+ cursor: pointer;
+}
+
+.main-preset-buttons-wraper .preset-item.a0 {
+ background: url(../images/media/bcs-item_bgL.png) no-repeat;
+ border-right: 1px solid #393939;
+ border-bottom: 1px solid #393939;
+}
+
+.main-preset-buttons-wraper .preset-item.a0.pressed {
+ background: url(../images/media/bcs-item_bgL_pressed.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a0.active {
+ background: url(../images/media/bcs-item_bg_act.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a1 {
+ background: url(../images/media/bcs-item_bgS.png) no-repeat;
+ border-right: 1px solid #393939;
+ border-bottom: 1px solid #393939;
+ width: 157px;
+}
+
+.main-preset-buttons-wraper .preset-item.a1.pressed {
+ background: url(../images/media/bcs-item_bgS_pressed.png) no-repeat;
+ width: 157px;
+}
+
+.main-preset-buttons-wraper .preset-item.a1.active {
+ background: url(../images/media/bcs-item_bg_act.png) repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a2 {
+ background: url(../images/media/bcs-item_bgR.png) no-repeat;
+ border-bottom: 1px solid #393939;
+ width: 153px;
+}
+
+.main-preset-buttons-wraper .preset-item.a2.pressed {
+ background: url(../images/media/bcs-item_bgR_pressed.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a2.active {
+ background: url(../images/media/bcs-item_bg_act.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a3 {
+ background: url(../images/media/bcs-item_bgL.png) no-repeat;
+ border-right: 1px solid #393939;
+}
+
+.main-preset-buttons-wraper .preset-item.a3.pressed {
+ background: url(../images/media/bcs-item_bgL_pressed.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a3.active {
+ background: url(../images/media/bcs-item_bg_act.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a4 {
+ background: url(../images/media/bcs-item_bgS.png) no-repeat;
+ border-right: 1px solid #393939;
+ width: 157px;
+}
+
+.main-preset-buttons-wraper .preset-item.a4.pressed {
+ background: url(../images/media/bcs-item_bgS_pressed.png) no-repeat;
+ width: 157px;
+}
+
+.main-preset-buttons-wraper .preset-item.a4.active {
+ background: url(../images/media/bcs-item_bg_act.png) repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a5 {
+ background: url(../images/media/bcs-item_bgR.png) no-repeat;
+ width: 153px;
+}
+
+.main-preset-buttons-wraper .preset-item.a5.pressed {
+ background: url(../images/media/bcs-item_bgR_pressed.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item.a5.active {
+ background: url(../images/media/bcs-item_bg_act.png) no-repeat;
+}
+
+.main-preset-buttons-wraper .preset-item>.bg {
+ z-index: 201;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 155px;
+ height: 49px;
+}
+
+.main-preset-buttons-wraper .preset-item>span {
+ z-index: 202;
+ display: block;
+ position: absolute;
+ left: 10px;
+ width: 30px;
+ height: 50px;
+ font-size: 32px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+ color: #999;
+}
+
+.main-preset-buttons-wraper .preset-item>p {
+ z-index: 202;
+ position: absolute;
+ left: 40px;
+ width: 100px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+.home-preset-buttons-wraper {
+ top: 82px;
+ left: 34px;
+ z-index: 50;
+}
+
+.home-preset-buttons-wraper .preset-items {
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ border: 1px solid #393939;
+ width: 328px;
+ height: 79px;
+}
+
+.bc-item2>p {
+ z-index: 202;
+ position: absolute;
+ left: 40px;
+ width: 100px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+.bc-item-big {
+ position: relative;
+ float: left;
+ width: 156px;
+ height: 100px;
+ line-height: 100px;
+ text-align: center;
+ font-size: 20px;
+}
+
+.bc-item-big.prevcd,.bc-item-big.prevusb,.bc-item-big.prevsd,.bc-item-big.prevblue
+ {
+ width: 155px;
+ height: 98px;
+ border-right: 1px solid #393939;
+ cursor: pointer;
+ background: url(../images/media/cd-prev-btn.png) no-repeat;
+}
+
+.bc-item-big.prevcd.pressed,.bc-item-big.prevusb.pressed,.bc-item-big.prevsd.pressed,.bc-item-big.prevblue.pressed
+ {
+ background: url(../images/media/cd-prev-btn_pressed.png) no-repeat;
+}
+
+.bc-item-big.playcd {
+ width: 157px;
+ height: 98px;
+ border-right: 1px solid #393939;
+ cursor: pointer;
+ background: url(../images/media/cd_play_btn.png) no-repeat;
+}
+
+.playIcon {
+ position: absolute;
+ left: 66px;
+}
+
+.playIcon.hideicon {
+ visibility: hidden;
+}
+
+.playIcon.showicon {
+ visibility: visible;
+}
+
+.bc-item-big.playcd.pressed,.bc-item-big.playusb.pressed,.bc-item-big.playsd.pressed,.bc-item-big.playblue.pressed
+ {
+ background: url(../images/media/cd_play_btn_pressed.png) no-repeat;
+}
+
+.bc-item-big.nextcd,.bc-item-big.nextusb,.bc-item-big.nextsd,.bc-item-big.nextblue
+ {
+ width: 154px;
+ height: 98px;
+ cursor: pointer;
+ background: url(../images/media/cd-next-btn.png) no-repeat;
+}
+
+.bc-item-big.nextcd.pressed,.bc-item-big.nextusb.pressed,.bc-item-big.nextsd.pressed,.bc-item-big.nextblue.pressed
+ {
+ background: url(../images/media/cd-next-btn_pressed.png) no-repeat;
+}
+
+#bt-bg {
+ position: relative;
+ float: left;
+ margin-left: 10px;
+ margin-top: -8px;
+}
+
+#bt-dis-controls {
+ background: url(../images/media/disabled_player_controls.png) no-repeat;
+ width: 470px;
+ height: 100px;
+ position: relative;
+ bottom: 17px;
+ float: left;
+ margin-left: 13px;
+}
+
+#avin-line {
+ z-index: 200;
+ position: relative;
+ width: 151px;
+ height: 297px;
+ margin-top: 100px;
+ margin-left: 171px;
+}
+
+.player_controlls {
+ z-index: 199;
+ position: absolute;
+ top: 237px;
+ left: 13px;
+ width: 468px;
+ height: 99px;
+ background: url("../images/media/btn_bg.png") repeat;
+ border: 1px solid #393939;
+ -webkit-border-radius: 3px;
+}
+
+#sdl_view_container .track-info {
+ left: 165px;
+ top: 55px;
+}
+
+#sdl_view_container .list-content {
+ border: none;
+}
+
+#sdl_view_container .list-item {
+ position: relative;
+ width: 100%;
+ height: 48px;
+ font-size: 20px;
+ line-height: 50px;
+ border: 1px solid #393939;
+}
+
+.track-info {
+ z-index: 199;
+ position: absolute;
+ left: 13px;
+ width: 470px;
+ overflow: hidden;
+ height: 237px;
+}
+
+.track-info>.total {
+ position: absolute;
+ top: 30px;
+ left: 10px;
+ width: 300px;
+ text-align: left;
+ font-size: 20px;
+ color: #999999;
+}
+
+.track-info>.title {
+ top: 110px;
+ font-size: 38px;
+ left: 7px;
+}
+
+.track-info>.track-number {
+ top: 153px;
+ font-size: 26px;
+ left: 10px;
+}
+
+.track-info>.time {
+ top: 190px;
+ font-size: 26px;
+ left: 10px;
+}
+
+.track-info>.divider_o {
+ top: 65px;
+}
+
+.track-info>.device {
+ position: absolute;
+ top: 30px;
+ left: 10px;
+ width: 300px;
+ text-align: left;
+ font-size: 20px;
+ color: #999999;
+}
+
+.divider_o {
+ position: absolute;
+ top: 120px;
+ left: 0px;
+ width: 470px;
+ height: 1px;
+ background: url("../images/media/divider_o.png") no-repeat;
+}
+
+.statusInfo {
+ width: 275px;
+ height: 48px;
+}
+
+.statusInfo .station {
+ top: 12px;
+ left: 11px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ height: 21px;
+ width: 220px;
+}
+
+.statusInfo .station span {
+ display: none;
+}
+
+.statusInfo .icon {
+ width: 50px;
+ height: 50px;
+ left: 224px;
+}
+
+.cdIco {
+ background: url(../images/media/ico_cd.png) no-repeat !important
+}
+
+.appIco {
+ background: url(../images/info/info_leftMenu_apps_ico.png) no-repeat
+ !important
+}
+
+#media_player_view_container {
+ background: url(../images/media/player_view.png) no-repeat;
+ width: 635px;
+ height: 323px;
+ top: 70px;
+ left: 161px;
+ z-index: 501;
+}
+
+#sdl_view_container .ffw_list_menu {
+ top: 90px;
+ left: 650px;
+ width: 140px;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/navigation.css b/src/components/HMI/css/navigation.css
new file mode 100644
index 0000000000..55cab5b140
--- /dev/null
+++ b/src/components/HMI/css/navigation.css
@@ -0,0 +1,102 @@
+/*NAVIGATION CSS*/
+#baseNavigation{
+ z-index: 2;
+ position: absolute;
+ top: 48px;
+ width: 800px;
+ height: 384px;
+}
+#baseNavigation .mainField{
+ position: absolute;
+ background: rgba(124, 124, 124, 0.3);
+ border: 1px solid;
+ border-color: rgba(90, 90, 90, 0.31);
+ border-radius: 3px;
+ box-shadow: inset 2px 2px 10px 0px rgba(112, 112, 112, 0.3), inset -2px -2px 10px 0px rgba(112, 112, 112, 0.3);
+ padding-top: 10px;
+ padding-left: 10px;
+ font-size: 18px;
+}
+#baseNavigation .softButton{
+ position: absolute;
+ border-radius: 3px;
+ border: 1px solid #393939;
+}
+#baseNavigation .mainField1{
+ top: 0;
+ height: 30px;
+ width: 190px;
+ left: 0;
+}
+#baseNavigation .mainField2{
+ top: 0;
+ height: 40px;
+ width: 380px;
+ left: 204px;
+}
+#baseNavigation .mainField3{
+ top: 0;
+ height: 30px;
+ width: 190px;
+ right: 0;
+}
+#baseNavigation .mainField4{
+ top: 50px;
+ height: 30px;
+ width: 90px;
+ right: 0;
+ overflow: hidden;
+ white-space: nowrap;
+}
+#baseNavigation .mainField5{
+ top: 100px;
+ height: 30px;
+ width: 90px;
+ right: 0;
+}
+#baseNavigation .mainField6{
+ bottom: 0;
+ height: 40px;
+ width: 280px;
+ left: 254px;
+}
+#baseNavigation .softButton1{
+ width: 250px;
+ bottom: 0;
+ left: 0;
+ position: absolute!important;
+ margin: 0px!important;
+ height: 49px!important;
+ font-size: 32px;
+ line-height: 50px!important;
+}
+#baseNavigation .softButton2{
+ width: 250px;
+ bottom: 0px;
+ right: 0px;
+ position: absolute!important;
+ margin: 0px!important;
+ height: 49px!important;
+ font-size: 32px;
+ line-height: 50px!important;
+}
+#baseNavigation .softButton3{
+ width: 100px;
+ top: 100px;
+ left: 0;
+ position: absolute!important;
+ margin: 0px!important;
+ height: 49px!important;
+ font-size: 32px;
+ line-height: 50px!important;
+}
+#baseNavigation .softButton4{
+ width: 100px;
+ top: 150px;
+ left: 0;
+ position: absolute!important;
+ margin: 0px!important;
+ height: 49px!important;
+ font-size: 32px;
+ line-height: 50px!important;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/phone.css b/src/components/HMI/css/phone.css
new file mode 100644
index 0000000000..d8e6855d7a
--- /dev/null
+++ b/src/components/HMI/css/phone.css
@@ -0,0 +1,300 @@
+/**
+ * Phone module CSS
+ *
+ * @category Style Sheets
+ * @filesource css/phone.css
+ * @version 2.0
+ */
+#phone {
+ width: 800px;
+ height: 480px;
+ background: url(../images/phone/bg.png) no-repeat;
+ background-position: top;
+} /*
+
+
+ Backgrpund for active toogleButton
+#phone .toogleButtonContainer .active {
+ background: url(../images/phone/bcs-item_bg_act.png);
+}
+
+#phone .delim {
+ position: relative;
+ float: left;
+ border: #393939 1px solid;
+ height: 26px;
+ width: 0px;
+}
+
+ LEFT MENU
+*/
+#phone_menu {
+ position: absolute;
+ top: 90px;
+ left: 0px;
+ width: 150px;
+ height: 300px;
+ background: #333;
+}
+
+.ls_border {
+ z-index: 201;
+ position: absolute;
+ top: -3px;
+ left: 0px;
+ width: 153px;
+ height: 306px;
+}
+
+.ls-items {
+ position: relative;
+ width: 150px;
+ height: 300px;
+}
+
+.ls-item {
+ z-index: 201;
+ position: relative;
+ width: 150px;
+}
+
+/*.ls-item > .bg{z-index:201;position:absolute;top:0px;left:0px;width:150px;height:50px;}
+ */
+.ls-item>.ico {
+ z-index: 299;
+ position: absolute;
+ left: 10px;
+ width: 30px;
+ height: 30px;
+ top: 10px;
+} /*
+ .ls-item > .ico.more {left:50px;}
+ */
+.ls-item span {
+ z-index: 298;
+ position: absolute;
+ left: 50px;
+ width: 100px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+/*.ls-item > .led{z-index:299;position:absolute;top:0px;right:8px;width:24px;height:50px;}
+ .ls-item.empty{background:#333333;}
+ .firts_item{-webkit-border-top-right-radius:3px;border-top-right-radius:3px;}
+ .last_item{-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;}
+ */
+.lsp1_p {
+ background: url("../images/phone/menu_bg.png") repeat-x bottom;
+}
+
+.phone_active {
+ background: url("../images/phone/menu_active.png") repeat-x bottom
+ !important;
+ border-top: 1px solid #3e3115;
+ border-bottom: 1px solid #4a3a17
+}
+
+#phone_menu .ls-item {
+ height: 48px;
+ border-bottom: 1px solid #656565;
+ border-top: 1px solid #393939;
+} /*
+ .navigationApp {width:26px;height:25px;background:url("../images/phone/ico_navigation.png") no-repeat;left:60px;top:10px;}
+
+#phone_menu.hide {
+ left: -170px;
+}
+
+#phone_menu_quickdialButton,
+#phone_menu_messagingButton,
+#phone_menu_settingsButton {
+ z-index: 203;
+}
+
+#phone .list-item.active {
+ background: url(../images/phone/phone_button_bg_active.png) repeat-x;
+}
+ PHONE STATUS BAR
+*/
+#status_phone {
+ top: 0px;
+ left: 0px;
+ font-size: 21px;
+ cursor: pointer;
+ width: 324px;
+ height: 48px;
+ background: url(../images/common/phone-statusbar-bg.png) no-repeat;
+ z-index: 1;
+}
+
+#status_phone_label {
+ width: 100%;
+ display: block;
+ visibility: hidden;
+}
+
+#status_phone_label span {
+ padding-left: 11px;
+}
+#phone_dialpad_number {
+ width: 283px;
+ height: 30px;
+ position: absolute;
+ left: 258px;
+ top: 87px;
+ text-align: center;
+ font-size: 22px;
+ padding: 10px 0 0 0;
+ background: black;
+ border: 1px solid #393939;
+ border-radius: 3px;
+}
+
+#phone_dialpad_keypad {
+ width: 282px;
+ height: 200px;
+ position: absolute;
+ left: 259px;
+ top: 141px;
+}
+
+#phone_dialpad_keypad div {
+ font-size: 26px;
+ text-align: center;
+ line-height: 32px;
+}
+#phone_dialpad_keypad .left {
+ left: 0px;
+ width: 93px;
+ height: 49px;
+ border-left: 1px solid #393939;
+ border-right: 1px solid #000;
+ border-top: 1px solid #393939;
+}
+
+#phone_dialpad_keypad .center {
+ left: 95px;
+ width: 93px;
+ height: 49px;
+ border-top: 1px solid #393939;
+ border-left: 1px solid #393939;
+ border-right: 1px solid #000;
+}
+
+#phone_dialpad_keypad .right {
+ left: 190px;
+ width: 93px;
+ height: 49px;
+ border-left: 1px solid #393939;
+ border-right: 1px solid #393939;
+ border-top: 1px solid #393939;
+}
+
+#phone_dialpad_keypad_key4,#phone_dialpad_keypad_key5,#phone_dialpad_keypad_key6
+ {
+ top: 50px;
+}
+
+#phone_dialpad_keypad_key7,#phone_dialpad_keypad_key8,#phone_dialpad_keypad_key9
+ {
+ top: 100px;
+}
+
+#phone_dialpad_keypad_key0,#phone_dialpad_keypad_keyDiez,#phone_dialpad_keypad_keyStar
+ {
+ top: 150px;
+ border-bottom: 1px solid #393939;
+}
+
+#phone_dialpad_keypad_key1 {
+ -webkit-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+}
+
+#phone_dialpad_keypad_key3 {
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+#phone_dialpad_keypad_keyStar {
+ -webkit-border-bottom-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+}
+
+#phone_dialpad_keypad_keyDiez {
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+}
+#phone_dialpad_deleteButton {
+ opacity: 0;
+ cursor: pointer;
+ width: 93px;
+ height: 49px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ left: 554px;
+ top: 291px;
+ border: 1px solid #393939;
+}
+
+#phone_dialpad_deleteButton .ico {
+ position: absolute;
+ left: 34px;
+ top: 15px;
+}
+
+#phone_dialpad_dialButton {
+ cursor: pointer;
+ border: 1px solid #393939;
+ left: 661px;
+ top: 241px;
+ width: 128px;
+ height: 49px;
+ -webkit-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+#phone_dialpad_dialButton span {
+ font-size: 18px;
+ position: absolute;
+ left: 14px;
+ top: 14px;
+}
+
+#phone_dialpad_dialButton .ico {
+ position: absolute;
+ right: 14px;
+ top: 11px;
+}
+
+#phone_dialpad_endButton {
+ cursor: pointer;
+ border: 1px solid #393939;
+ left: 661px;
+ top: 291px;
+ width: 128px;
+ height: 49px;
+ -webkit-border-bottom-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+}
+
+#phone_dialpad_endButton span {
+ font-size: 18px;
+ position: absolute;
+ left: 14px;
+ top: 14px;
+}
+
+#phone_dialpad_endButton .ico {
+ position: absolute;
+ right: 9px;
+ top: 16px;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/sdl.css b/src/components/HMI/css/sdl.css
new file mode 100644
index 0000000000..e6bf641513
--- /dev/null
+++ b/src/components/HMI/css/sdl.css
@@ -0,0 +1,1254 @@
+/**
+ * CSS for sdl aplications
+ */
+.ffw_list_menu {
+ left: 440px;
+ width: 158px;
+ border: 1px solid #393939;
+ overflow: hidden;
+}
+
+.ffw_list_menu .control {
+ z-index: 2000;
+ text-align: center;
+}
+
+.ffw_list_menu .ffw-button {
+ position: relative;
+ height: 49px;
+ border-bottom: 1px solid #393939;
+ line-height: 50px;
+ display: -webkit-flex;
+ display: -moz-flex;
+ display: flex;
+}
+
+.ffw_list_menu .ffw-button span {
+ height: 50px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ padding-left: 10px;
+}
+
+.ffw_list_menu .content {
+ position: relative;
+}
+
+.ffw_list_menu .ffw-button.hidden {
+ display: none;
+}
+
+.sdl-window {
+ width: 800px;
+ height: 480px;
+ background-color: #000;
+ z-index: 1;
+}
+
+/**
+ * Important Class for SoftButtons Highlightening
+ */
+.isHighlighted{
+ color: gold;
+}
+
+.isHighlighted .ico{
+ border-style: solid;
+ border-color: #FFA300 #F7DA9C;
+ border-width: 1px;
+}
+
+.softButton .ico{
+ width: 50px;
+ height: 49px;
+ -webkit-flex: 0 0 50px;
+ float: left;
+}
+
+.softButton .right_text{
+ padding-left: 5px !important;
+}
+
+.sdl-window .back-button {
+ top: 80px;
+ left: 5px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+.sdl-window .back-button .ico {
+ margin-top: 13px;
+ margin-left: 8px;
+}
+
+#info_apps_deviceList_view .deviceListLabel,.sdl-window .caption-text {
+ top: 80px;
+ left: 75px;
+ width: 620px;
+ background: #393939;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ line-height: 50px;
+ height: 50px;
+ padding-left: 15px;
+ padding-right: 15px;
+}
+
+#info_apps_deviceList_view .progress{
+ top: 175px;
+ left: 254px;
+ background: URL('../images/sdl/progress.gif') no-repeat;
+ width: 300px;
+ height: 200px;
+}
+
+#info_nonMedia {
+ z-index: 1001;
+}
+
+#info_nonMedia .backButton {
+ top: 80px;
+ left: 20px;
+}
+
+#info_nonMedia .inner_content {
+ left: 180px;
+ top: 90px;
+ width: 600px;
+ height: 300px;
+ overflow: hidden;
+}
+
+#info_nonMedia .app_title {
+ width: 390px;
+ padding: 15px;
+ top: 1px;
+ background-color: #393939;
+}
+
+#info_nonMedia .app_image {
+ top: 60px;
+}
+
+#info_nonMedia .app_fields {
+ left: 160px;
+ top: 60px;
+ width: 260px;
+}
+
+#info_nonMedia .app_fields .label {
+ position: relative;
+ border: 1px solid #393939;
+ padding: 7px;
+ margin-bottom: 5px;
+}
+
+#info_nonMedia .presets {
+ top: 220px;
+ width: 420px;
+ height: 80px;
+}
+
+#info_nonMedia .presets .ffw-button {
+ width: 82px;
+ height: 38px;
+ position: relative;
+ float: left;
+ line-height: 40px;
+ border-bottom: 1px solid #393939;
+ border-right: 1px solid #393939;
+ border-top: 1px solid #222;
+ border-left: 1px solid #222;
+ text-align: center;
+}
+
+#info_nonMedia .presets .ffw-button .text{
+ margin-left: 5px;
+ width: 77px;
+ position: absolute;
+ left: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ text-align: left;
+}
+
+#info_nonMedia .app_image img {
+ border: 1px solid #393939;
+}
+
+#sdl_options .list {
+ width: 650px;
+ height: 251px;
+ border-radius: 2px;
+ left: 75px;
+ top: 150px;
+}
+
+/*#sdl_view_container .list-content,*/
+#sdl_options .list-content {
+ width: 590px;
+}
+
+#VRPopUp.move{
+ left: 800px;
+}
+
+#VRPopUp span,#info_apps_deviceList_list .list-content span,#sdl_view_container .list-content span,#sdl_options .list-content span
+ {
+ margin-left: 15px;
+ position: relative;
+ text-overflow: ellipsis;
+ width: 521px;
+ overflow: hidden;
+ float: left;
+}
+
+#sdl_options .list-content .ico {
+ height: 49px;
+ width: 49px;
+ float: left;
+ position: relative;
+}
+
+#info_nonMedia_options_submenu {
+ z-index: 11000;
+ width: 800px;
+ height: 480px;
+ background-color: black;
+ top: 0px;
+ left: 0px;
+}
+
+#sdl_media_presetButtons .preset-item>span {
+ z-index: 202;
+ display: block;
+ position: absolute;
+ left: 10px;
+ width: 84px;
+ height: 50px;
+ font-size: 20px;
+ line-height: 50px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: white;
+}
+
+#sdl_view_container .preset-items {
+ width: 468px;
+}
+
+#sdl_view_container .main-preset-buttons-wraper .preset-item.a3,#sdl_view_container .main-preset-buttons-wraper .preset-item.a6
+ {
+ width: 155px;
+}
+
+#sdl_view_container .player_controllsV2 {
+ top: 241px !important;
+ height: 48px;
+}
+
+#sdl_view_container .player_controllsV2 .ffw-button {
+ height: 48px;
+}
+
+#sdl_view_container .player_controllsV2 img {
+ margin-top: -26px;
+}
+
+/* ScrollableMessage */
+#ScrollableMessage.ScrollableMessage {
+ left: 0;
+ top: 0;
+ width: 800px;
+ height: 480px;
+ /*z-index: 1000;*/
+ background: url(../images/media/bg.png) no-repeat;
+}
+
+#ScrollableMessage.active {
+ opacity: 1;
+ display: block;
+}
+
+#ScrollableMessage .backButton {
+ top: 80px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+#ScrollableMessage .titleText {
+ top: 80px;
+ left: 75px;
+ width: 620px;
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+}
+
+#ScrollableMessage .scrollableText {
+ position: absolute;
+ width: 525px;
+ height: 251px;
+ border-radius: 2px;
+ left: 200px;
+ top: 154px;
+ overflow: hidden;
+}
+
+#ScrollableMessage .scrollableText-content {
+ border: none;
+ width: 474px;
+}
+
+#ScrollableMessage .scrollableText-item {
+ position: relative;
+ width: 100%;
+ height: 48px;
+ font-size: 20px;
+ line-height: 50px;
+ border: 1px solid #393939;
+}
+
+#ScrollableMessage .ffw_list_menu {
+ top: 154px !important;
+ left: 25px !important;
+}
+
+#ScrollableMessage .scrollableTextArea {
+ margin: 0px;
+ /*height: 251px;*/
+ width: 469px;
+ font-family: sans-serif;
+ font-size: 16px;
+ color: white;
+ background-color: transparent;
+ resize: none;
+ line-height: 23px;
+ position: absolute;
+}
+
+/* SDL Slider */
+.slider-header {
+ top: 167px;
+ left: 145px;
+ width: 480px;
+ background: #393939;
+ line-height: 50px;
+ height: 50px;
+ padding-left: 15px;
+ padding-right: 15px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.slider-footer {
+ top: 325px;
+ left: 145px;
+ width: 480px;
+ background: #393939;
+ line-height: 50px;
+ height: 50px;
+ padding-left: 15px;
+ padding-right: 15px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#slider_view .okButton{
+ top: 379px;
+ left: 364px;
+ width: 54px;
+ height: 17px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ padding: 10px;
+}
+
+#slider_view .sliderControl {
+ width: 600px;
+ left: 100px;
+ top: 250px;
+ text-align: center;
+}
+
+#slider_view .control {
+ width: 58px;
+ height: 38px;
+ border: 1px solid #393939;
+ position: relative;
+ display: inline-block;
+}
+
+#slider_view .ledContainer {
+ position: relative;
+ display: inline-block;
+ border: 1px solid #393939;
+ height: 38px;
+}
+
+#slider_view .control.minus .ico {
+ top: 19px;
+ left: 20px;
+ position: absolute;
+}
+
+#slider_view .control.plus .ico {
+ top: 12px;
+ left: 20px;
+ position: absolute;
+}
+
+#slider_view .led {
+ width: 12px;
+ height: 40px;
+ background: url("../images/common/seat-act-led.png") no-repeat;
+ position: relative !important;
+ background-position: -4px 0;
+ display: inline-block;
+}
+
+#slider_view .led-inactive {
+ background: url("../images/common/seat-inact-led.png") no-repeat;
+ background-position: 3px 8px;
+ width: 12px;
+ height: 40px;
+ position: relative !important;
+ display: inline-block;
+}
+
+/* SDL Perform Interaction Choise,
+ SDL TBT Turn List */
+#tbtTurnListView .list,
+#perform_interaction_view .list,
+#vr_help_list_view .list {
+ position: absolute;
+ width: 650px;
+ height: 251px;
+ border-radius: 2px;
+ left: 75px;
+ top: 154px;
+}
+
+#tbtTurnListView .list span,
+#perform_interaction_view .list span,
+#vr_help_list_view .list span{
+ margin-left: 15px;
+}
+
+#tbtTurnListView .list-content,
+#perform_interaction_view .list-content,
+#vr_help_list_view .list-content {
+ width: 578px;
+}
+
+#perform_interaction_view input{
+ width: 720px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ background: rgba(119, 119, 119, 0.42);
+ cursor: pointer;
+ font-size: 32px;
+ color: #FFF;
+ top: 80px;
+ left: 65px;
+ position: absolute;
+}
+#perform_interaction_view .listWrapper{
+ top: 140px;
+ width: 750px;
+ height: 275px;
+ left: 25px;
+}
+
+#perform_interaction_view .naviChoises .ffw-button{
+ width: 110px;
+ height: 110px;
+ margin: 20px;
+ float: left;
+ position: relative;
+ border: 1px solid #333;
+ border-radius: 2px;
+ background-repeat: repeat;
+}
+
+#sdl_view_container .cd_logo {
+ position: absolute;
+ top: 90px;
+ right: 10px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 2px;
+ width: 109px;
+ height: 109px;
+}
+
+#sdl_view_container .cd_logoV2 {
+ position: absolute;
+ top: 70px;
+ right: 10px;
+ border: 1px solid #393939;
+ -webkit-border-radius: 2px;
+ width: 109px;
+ height: 109px;
+}
+
+#sdl_view_container .timeV2 {
+ top: 155px;
+}
+
+#sdl_view_container .textLimit {
+ width: 460px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+
+#VRButton.VRButton {
+ background: url(../images/home/controlButtons/vr.png) no-repeat;
+ width: 89px;
+ height: 90px;
+ left: 1024px;;
+ top: 2px;
+ -webkit-transition: 0.2s;
+}
+
+#VRButton.pressed {
+ background: url(../images/home/controlButtons/vr_pressed.png) no-repeat;
+}
+
+#vehicleInfoButton.vehicleInfoButton {
+ width: 117px;
+ height: 48px;
+ left: 1059px;
+ top: 206px;
+ text-align: center;
+ line-height: 48px;
+}
+
+#tbtClientStateButton.tbtClientStateButton {
+ width: 158px;
+ height: 48px;
+ left: 865px;
+ top: 418px;
+ text-align: center;
+ line-height: 48px;
+}
+
+#exitApp.exitApp {
+ width: 135px;
+ height: 48px;
+ left: 1043px;
+ top: 418px;
+ text-align: center;
+ line-height: 48px;
+}
+
+#exitAppView,#tbtClientStateView,#VehicleInfo,#systemRequestView {
+ opacity: 0;
+ left: 50px;
+ width: 700px;
+ height: 340px;
+ background-color: black;
+ z-index: 2;
+ border-radius: 10PX;
+ top: 70px;
+ -webkit-transition: opacity 1s ease-in-out;
+ display: none;
+ border: 1px solid white;
+}
+
+#exitAppView .exitAppViewLabel,#systemRequestView .systemRequestViewLabel, #tbtClientStateView .tbtClientStateLabel,#VehicleInfo .vehicleInfoLabel
+ {
+ top: 10px;
+ width: 600px;
+ left: 35px;
+ height: 20px;
+ padding: 15px;
+ background: #393939;
+}
+
+#exitAppView.active,#systemRequestView.active,#tbtClientStateView.active,#VehicleInfo.active {
+ opacity: 1;
+ display: block;
+}
+
+#exitAppView .exitAppViewTitle, #systemRequestView .systemRequestViewTitle, #tbtClientStateView .tbtClientState,#VehicleInfo .prndl
+ {
+ top: 70px;
+ width: 600px;
+ left: 40px;
+ height: 20px;
+ padding: 10px;
+ background: #535353;
+}
+
+#exitAppView .exitAppViewSelect, #systemRequestView .systemRequestViewSelect, #tbtClientStateView .tbtClientStateSelect,#VehicleInfo .prndlSelect
+ {
+ top: 125px;
+ position: absolute;
+ width: 150px;
+ left: 275px;
+ height: 40px;
+ color: white;
+ background: #393939;
+}
+
+#exitAppView .exitAppViewSelect option,#tbtClientStateView .tbtClientStateSelect option,#VehicleInfo .prndlSelect option
+ {
+ background: #393939;
+}
+
+#exitAppView .onAwakeSDLLabel{
+ top: 200px;
+ width: 600px;
+ left: 40px;
+ height: 20px;
+ padding: 10px;
+ background: #535353;
+}
+
+#exitAppView .onAwakeSDLButton{
+ right: 268px;
+ top: 250px;
+ width: 150px;
+ height: 19px;
+ padding: 10px;
+ border-radius: 4px;
+ border: 1px solid white;
+}
+
+#VehicleInfo .odometrTitle{
+ top: 180px;
+ width: 290px;
+ left: 360px;
+ height: 20px;
+ padding: 10px;
+ background: #535353;
+}
+
+#VehicleInfo .odometrInput{
+ width: 265px;
+ position: absolute;
+ top: 242px;
+ left: 373px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ background: rgba(119, 119, 119, 0.42);
+ cursor: pointer;
+ font-size: 32px;
+ color: #FFF;
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#VehicleInfo .onEmergencyEvent{
+ width: 265px;
+ position: absolute;
+ top: 301px;
+ left: 207px;
+ height: 28px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ cursor: pointer;
+ font-size: 18px;
+ color: #FFF;
+ padding-left: 10px;
+ padding-right: 10px;
+ line-height: 28px;
+}
+
+#VehicleInfo .ecu1Title {
+ top: 180px;
+ width: 290px;
+ left: 30px;
+ height: 20px;
+ padding: 10px;
+ background: #535353;
+}
+
+#VehicleInfo .ecu1 {
+ top: 233px;
+ width: 80px;
+ left: 65px;
+ height: 20px;
+ padding: 10px;
+}
+
+#VehicleInfo .ecu2 {
+ top: 265px;
+ width: 80px;
+ left: 65px;
+ height: 20px;
+ padding: 10px;
+}
+
+#VehicleInfo .ecu1Data {
+ top: 233px;
+ width: 155px;
+ left: 155px;
+ height: 20px;
+ padding: 10px;
+}
+
+#VehicleInfo .ecu2Data {
+ top: 265px;
+ width: 155px;
+ left: 155px;
+ height: 20px;
+ padding: 10px;
+}
+.PopUp{
+ left: 200px;
+ width: 400px;
+ height: 245px;
+ z-index: 2;
+ top: 110px;
+ -webkit-transition: opacity 1s ease-in-out;
+ background-color: black;
+ border: #A6A6A6 solid 2px;
+ border-radius: 6px;
+}
+
+.PopUp .text{
+ top: 41px;
+ left: 5px;
+ width: 390px;
+ height: 120px;
+ line-height: 20px;
+ position: absolute;
+ overflow: hidden;
+ text-align: center;
+ text-overflow: ellipsis;
+}
+
+.PopUp .OkButton{
+ top: 190px;
+ left: 5px;
+ width: 190px;
+ border: 1px solid #393939;
+}
+
+.PopUp .OkButton span{
+ font-size: 20px;
+ line-height: 50px;
+ cursor: pointer;
+ margin-left: 82px;
+}
+
+.PopUp .CancelButton{
+ top: 190px;
+ left: 205px;
+ width: 190px;
+ border: 1px solid #393939;
+}
+
+.PopUp .CancelButton span{
+ font-size: 20px;
+ line-height: 50px;
+ cursor: pointer;
+ margin-left: 65px;
+}
+
+/* Alert, AudioPassThruPopUp popup*/
+#AlertManeuverPopUp.AlertManeuverPopUp,#AudioPassThruPopUp.AudioPassThruPopUp,#AlertPopUp.AlertPopUp
+ {
+ opacity: 0;
+ left: 200px;
+ width: 400px;
+ height: 245px;
+ z-index: 2;
+ top: 110px;
+ -webkit-transition: opacity 1s ease-in-out;
+ background-color: black;
+ border: #A6A6A6 solid 2px;
+ border-radius: 6px;
+ display: none;
+}
+
+#AlertManeuverPopUp .applicationName,#AudioPassThruPopUp .applicationName,#AlertPopUp .applicationName
+ {
+ width: 380px;
+ left: 10px;
+ text-align: center;
+ font-size: 25px;
+ line-height: 30px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#AlertPopUp .alertPopUpImage {
+ width: 83px;
+ height: 74px;
+ background: url(../images/sdl/Warning.png) no-repeat;
+ top: 45px;
+ left: 10px;
+}
+
+#AlertPopUp .progressIndicator {
+ width: 50px;
+ height: 50px;
+ background: url(../images/sdl/progressindicator.gif) no-repeat;
+ top: 0px;
+ background-size: contain;
+ left: 0px;
+}
+
+#AudioPassThruPopUp .audioPassThruImage {
+ width: 83px;
+ height: 74px;
+ background: url(../images/home/controlButtons/vrImage.png) no-repeat;
+ top: 45px;
+ left: 25px;
+}
+
+#AudioPassThruPopUp .message1,#AlertPopUp .message1 {
+ top: 37px;
+ left: 105px;
+ width: 285px;
+ height: 30px;
+ text-align: center;
+ font-size: 23px;
+ line-height: 30px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#AudioPassThruPopUp .message2,#AlertPopUp .message2 {
+ top: 70px;
+ left: 105px;
+ width: 285px;
+ height: 28px;
+ text-align: center;
+ font-size: 23px;
+ line-height: 30px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#AudioPassThruPopUp .message3,#AlertPopUp .message3 {
+ top: 100px;
+ left: 105px;
+ width: 285px;
+ height: 28px;
+ text-align: center;
+ font-size: 23px;
+ line-height: 30px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#AlertManeuverPopUp.AlertManeuverActive,#AudioPassThruPopUp.AudioPassThruActive,#AlertPopUp.AlertActive
+ {
+ opacity: 1;
+ display: block;
+}
+
+#baseNavigation .softButton,#AlertManeuverPopUp .softButton,#AudioPassThruPopUp .softButton,#AlertPopUp .softButton
+ {
+ border: 1px solid #393939;
+ border-radius: 3px;
+ height: 42px;
+ line-height: 42px;
+ text-align: center;
+ float: left;
+ margin: 10px;
+ position: relative;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+
+#baseNavigation .naviOptionsBtn{
+ border: 1px solid #393939;
+ border-radius: 3px;
+ height: 42px;
+ line-height: 42px;
+ text-align: center;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ top: 283px;
+ right: 6px;
+ width: 105px;
+ position: absolute;
+}
+
+#AlertManeuverPopUp .closeButton {
+ width: 170px;
+ top: 180px;
+ left: 110px;
+}
+
+#AlertPopUp .alertSoftButtons {
+ margin-left: 8px;
+ top: 120px;
+ width: 386px;
+}
+
+#AlertManeuverPopUp .one,#softButton0.one {
+ margin-top: 42px;
+ width: 362px;
+}
+
+#softButton0.two {
+ margin-top: 42px;
+ width: 170px;
+}
+
+#softButton1.two {
+ margin-top: 42px;
+ width: 170px;
+}
+
+#softButton0.three {
+ width: 170px;
+}
+
+#AudioPassThruPopUp .buttonDone,#softButton1.three {
+ width: 170px;
+}
+
+#AudioPassThruPopUp .buttonCancel,#softButton2.three {
+ width: 362px;
+}
+
+#softButton0.four {
+ width: 170px;
+}
+
+#softButton1.four {
+ width: 170px;
+}
+
+#softButton2.four {
+ width: 170px;
+}
+
+#softButton3.four {
+ width: 170px;
+}
+
+#AudioPassThruPopUp .buttonRetry {
+ top: 120px;
+ width: 175px;
+}
+
+#AudioPassThruPopUp .buttonDone {
+ top: 120px;
+ width: 175px;
+}
+
+#AudioPassThruPopUp .buttonCancel {
+ top: 120px;
+ width: 372px;
+}
+
+#info_leftMenu_sdl {
+ font-size: 18px;
+ line-height: 48px;
+}
+
+#info_leftMenu_sdl img {
+ float: left;
+}
+
+#info_leftMenu_sdl span {
+ float: left;
+ position: relative;
+ width: 100px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ left: 0;
+}
+
+/* TurnByTurnView */
+#TurnByTurnView.TurnByTurnView {
+ top: 48px;
+ height: 384px;
+ left: 153px;
+ width: 647px;
+ background: none;
+}
+
+#TurnByTurnView .caption-text {
+ left: 5px;
+ width: 607px;
+ top: 15px;
+}
+
+#TurnByTurnView .label {
+ overflow: hidden;
+}
+
+#TurnByTurnView .totalDistanceLabel {
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+ left: 5px;
+ top: 80px;
+ width: 170px;
+}
+
+#TurnByTurnView .etaLabel {
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+ left: 206px;
+ top: 80px;
+ width: 170px;
+}
+
+#TurnByTurnView .turnList {
+ left: 5px;
+ top: 145px;
+ width: 379px;
+ padding: 10px;
+ text-align: center;
+}
+
+#TurnByTurnView .ffw_list_menu {
+ height: 198px;
+ top: 200px;
+ left: 5px;
+ width: 401px;
+ border: none;
+}
+
+#TurnByTurnView .ffw-button {
+ border-radius: 3px;
+ border: 1px solid #393939;
+ margin-bottom: 5px;
+ text-align: center;
+ font-size: 20px;
+}
+
+
+#TurnByTurnView .ffw-button .text {
+ margin: auto;
+}
+
+#TurnByTurnView .turnList .arrow-ico {
+ margin-top: -13px;
+}
+
+#turnList img {
+ margin-top: -10px;
+}
+
+#TurnByTurnView .homeScreen {
+ left: 440px;
+ top: 312px;
+ padding: 0 0 0 5px;
+ width: 195px;
+}
+
+#TurnByTurnView .homeScreen span {
+ width: 140px;
+}
+
+#TurnByTurnView .homeScreen>img {
+ float: left;
+ width: 50px;
+ height: 50px;
+}
+
+#TurnByTurnView .homeScreen>span {
+ float: left;
+ line-height: 50px;
+ padding-left: 5px;
+}
+
+#TurnByTurnView .navigationText2 {
+ left: 440px;
+ top: 268px;
+ width: 182px;
+ padding: 10px;
+ height: 20px;
+ background: #393939;
+}
+
+#TurnByTurnView .turnIcon,
+#TurnByTurnView .nextTurnIcon {
+ border: 1px solid #222;
+ left: 540px;
+ width: 100px;
+ height: 100px;
+ background-size: contain;
+ background-repeat: no-repeat;
+}
+
+#TurnByTurnView .distanceToManeuver{
+ top: 80px;
+ left: 419px;
+ background: #393939;
+ padding: 15px;
+}
+
+#TurnByTurnView .distanceToManeuverScale{
+ top: 144px;
+ left: 419px;
+ background: #393939;
+ padding: 15px;
+}
+
+#TurnByTurnView .timeToDestination{
+ top: 207px;
+ left: 419px;
+ background: #393939;
+ padding: 15px;
+}
+
+#TurnByTurnView .turnIcon {
+ top: 65px;
+}
+
+#TurnByTurnView .nextTurnIcon {
+ top: 166px;
+}
+
+#tbtTurnListList .list-content .label>img {
+ width: 50px;
+ height: 50px;
+ float: left;
+}
+
+#info_apps_list .ffw-button {
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#sdl_view_container {
+ z-index: 501;
+}
+
+#sdl_view_container .title {
+ top: 79px;
+ font-size: 38px;
+ left: 7px;
+ width: 340px;
+ height: 44px;
+}
+
+#sdl_view_container .album {
+ top: 123px;
+ font-size: 26px;
+ left: 10px;
+ width: 330px;
+ height: 32px;
+}
+
+#sdl_view_container .artist {
+ top: 155px;
+ font-size: 26px;
+ left: 10px;
+ width: 330px;
+ height: 32px;
+}
+
+#sdl_view_container .player_controlls {
+ top: 292px;
+ left: 165px;
+}
+
+/* SDL Slider*/
+#media_sdl_slider_view {
+ width: 800px;
+ height: 480px;
+ z-index: 1000;
+ background: url(../images/media/bg.png) no-repeat;
+}
+
+#media_sdl_slider_view .backButton {
+ top: 80px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+#media_sdl_slider_view .initialText {
+ top: 80px;
+ left: 75px;
+ width: 620px;
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+}
+
+/* SDL Perform Interaction Choise */
+#media_app_perform_interaction_view {
+ width: 800px;
+ height: 480px;
+ z-index: 1000;
+ background: url(../images/media/bg.png) no-repeat;
+}
+
+#media_app_perform_interaction_view .backButton {
+ top: 80px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+#media_app_perform_interaction_view .list {
+ position: absolute;
+ width: 629px;
+ height: 251px;
+ border-radius: 2px;
+ left: 100px;
+ top: 154px;
+}
+
+#media_app_perform_interaction_view .initialText {
+ top: 80px;
+ left: 75px;
+ width: 620px;
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+}
+
+#media_app_perform_interaction_view .list-content {
+ width: 578px;
+}
+
+/* SDL Media Options */
+#media_app_options_view {
+ width: 800px;
+ height: 480px;
+ z-index: 2002;
+ background: url(../images/media/bg.png) no-repeat;
+}
+
+#media_app_options_view .backButton {
+ top: 80px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+}
+
+#media_app_options_view .list {
+ position: absolute;
+ width: 650px;
+ height: 251px;
+ border-radius: 2px;
+ left: 75px;
+ top: 154px;
+}
+
+#media_app_options_view .optionsLabel {
+ top: 80px;
+ left: 75px;
+ width: 620px;
+ height: 20px;
+ background: #393939;
+ padding: 15px;
+}
+
+#media_app_options_view .list-content {
+ width: 578px;
+} \ No newline at end of file
diff --git a/src/components/HMI/css/settings.css b/src/components/HMI/css/settings.css
new file mode 100644
index 0000000000..b8142924bb
--- /dev/null
+++ b/src/components/HMI/css/settings.css
@@ -0,0 +1,129 @@
+#settingsView .in_settings_separate_view{
+ top: 48px;
+ width: 800px;
+ height: 382px;
+ background: black;
+ z-index: 5000;
+}
+
+#settingsView .in_settings_separate_view .backButton {
+ top: 35px;
+ width: 48px;
+ height: 48px;
+ border: 1px solid #333;
+ border-radius: 2px;
+ left: 25px;
+}
+#settingsView .in_settings_separate_view .list{
+ height: 251px;
+ width: 700px;
+ top: 106px;
+ left: 50px;
+}
+#settingsView .in_settings_separate_view .list-item{
+ width: 639px;
+ padding-left: 10px;
+}
+
+#settingsView .in_settings_separate_view .label{
+ top: 35px;
+ left: 100px;
+ width: 620px;
+ background: #393939;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ line-height: 50px;
+ height: 50px;
+ padding-left: 15px;
+ padding-right: 15px;
+}
+
+#settingsView .backButton .ico {
+ margin-top: 13px;
+ margin-left: 8px;
+}
+
+#settings_leftMenu {
+ background: #333;
+ width: 150px;
+ height: 300px;
+ top: 90px;
+}
+
+#settings_leftMenu .menu-item.info_active {
+ background: url("../images/info/menu_active.png") repeat-x;
+}
+
+#settings_leftMenu .menu-item {
+ z-index: 201;
+ position: relative;
+ width: 150px;
+ height: 50px;
+ cursor: pointer;
+}
+
+#settings_leftMenu .menu-item span {
+ position: absolute;
+ left: 50px;
+ width: 100px;
+ height: 50px;
+ font-size: 18px;
+ line-height: 50px;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+#settings_leftMenu .ico {
+ height: 50px;
+ width: 50px;
+}
+
+#settings_leftMenu .settings_active {
+ background: url("../images/info/menu_active.png") repeat-x;
+}
+
+#settingsView .in_settings_view{
+ position: absolute;
+ top: 48px;
+ left: 153px;
+ width: 647px;
+ height: 384px;
+ float: left;
+ z-index: 1001;
+ margin-top: 70px;
+}
+
+#settingsView .policies_settings_list{
+ height: 251px;
+ width: 598px;
+ left: 10px;
+}
+
+#policies_settings_list .list-content .ffw-button{
+ width: 537px;
+ padding-left: 10px;
+}
+
+#settingsView .settingsButton{
+ float: left;
+ width: 536px;
+ margin-right: 10px;
+ height: 48px;
+ font-size: 20px;
+ line-height: 50px;
+ border: 1px solid #393939;
+ cursor: pointer;
+ padding-left: 10px;
+ position: relative;
+}
+
+#policies_settings_system_error .listSelect,
+#policies_settings_status_info .listSelect{
+ top: 125px;
+ position: absolute;
+ width: 150px;
+ left: 320px;
+ height: 40px;
+ color: white;
+ background: #393939;
+} \ No newline at end of file
diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js
new file mode 100644
index 0000000000..6ef3fc60fc
--- /dev/null
+++ b/src/components/HMI/ffw/BasicCommunicationRPC.js
@@ -0,0 +1,1339 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * Reference implementation of BasicCommunication component. Interface to get or
+ * set some essential information from OS. BasicCommunication responsible for
+ * handling the basic commands of non-graphical part such as the registration of
+ * mobile apps, geting the list of devices and applications and data transfer.
+ */
+
+FFW.BasicCommunication = FFW.RPCObserver
+ .create( {
+
+ /**
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "BasicCommunication"
+ }),
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+
+ //OnPutFile
+
+
+ onPutFileSubscribeRequestID: -1,
+ onStatusUpdateSubscribeRequestID: -1,
+ onAppPermissionChangedSubscribeRequestID: -1,
+ onSDLPersistenceCompleteSubscribeRequestID: -1,
+ onFileRemovedSubscribeRequestID: -1,
+ onAppRegisteredSubscribeRequestID: -1,
+ onAppUnregisteredSubscribeRequestID: -1,
+ onPlayToneSubscribeRequestID: -1,
+ onSDLCloseSubscribeRequestID: -1,
+ onSDLConsentNeededSubscribeRequestID: -1,
+ onResumeAudioSourceSubscribeRequestID: -1,
+
+ onPutFileUnsubscribeRequestID: -1,
+ onStatusUpdateUnsubscribeRequestID: -1,
+ onAppPermissionChangedUnsubscribeRequestID: -1,
+ onSDLPersistenceCompleteUnsubscribeRequestID: -1,
+ onFileRemovedUnsubscribeRequestID: -1,
+ onAppRegisteredUnsubscribeRequestID: -1,
+ onAppUnregisteredUnsubscribeRequestID: -1,
+ onPlayToneUnsubscribeRequestID: -1,
+ onSDLCloseUnsubscribeRequestID: -1,
+ onSDLConsentNeededUnsubscribeRequestID: -1,
+ onResumeAudioSourceUnsubscribeRequestID: -1,
+
+ // const
+ onStatusUpdateNotification: "SDL.OnStatusUpdate",
+ onAppPermissionChangedNotification: "SDL.OnAppPermissionChanged",
+ onSDLPersistenceCompleteNotification: "BasicCommunication.OnSDLPersistenceComplete",
+ onPutFileNotification: "BasicCommunication.OnPutFile",
+ onFileRemovedNotification: "BasicCommunication.OnFileRemoved",
+ onAppRegisteredNotification: "BasicCommunication.OnAppRegistered",
+ onAppUnregisteredNotification: "BasicCommunication.OnAppUnregistered",
+ onPlayToneNotification: "BasicCommunication.PlayTone",
+ onSDLCloseNotification: "BasicCommunication.OnSDLClose",
+ onSDLConsentNeededNotification: "SDL.OnSDLConsentNeeded",
+ onResumeAudioSourceNotification: "BasicCommunication.OnResumeAudioSource",
+
+
+ /**
+ * init object
+ */
+ init: function() {
+
+ },
+
+ /**
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 600); // Magic number is unique identifier
+ // for component
+ },
+
+ /**
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /**
+ * Client is registered - we can send request starting from this point
+ * of time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCRegistered");
+ this._super();
+
+ // subscribe to notifications
+ this.onPutFileSubscribeRequestID = this.client
+ .subscribeToNotification(this.onPutFileNotification);
+ this.onStatusUpdateSubscribeRequestID = this.client
+ .subscribeToNotification(this.onStatusUpdateNotification);
+ this.onAppPermissionChangedSubscribeRequestID = this.client
+ .subscribeToNotification(this.onAppPermissionChangedNotification);
+ this.onSDLPersistenceCompleteSubscribeRequestID = this.client
+ .subscribeToNotification(this.onSDLPersistenceCompleteNotification);
+ this.onFileRemovedSubscribeRequestID = this.client
+ .subscribeToNotification(this.onFileRemovedNotification);
+ this.onAppRegisteredSubscribeRequestID = this.client
+ .subscribeToNotification(this.onAppRegisteredNotification);
+ this.onAppUnregisteredSubscribeRequestID = this.client
+ .subscribeToNotification(this.onAppUnregisteredNotification);
+ this.onPlayToneSubscribeRequestID = this.client
+ .subscribeToNotification(this.onPlayToneNotification);
+ this.onSDLCloseSubscribeRequestID = this.client
+ .subscribeToNotification(this.onSDLCloseNotification);
+ this.onSDLConsentNeededSubscribeRequestID = this.client
+ .subscribeToNotification(this.onSDLConsentNeededNotification);
+ this.onResumeAudioSourceSubscribeRequestID = this.client
+ .subscribeToNotification(this.onResumeAudioSourceNotification);
+ },
+
+ /**
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCUnregistered");
+ this._super();
+
+ // unsubscribe from notifications
+
+ this.onPutFileUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onPutFileNotification);
+ this.onStatusUpdateUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onStatusUpdateNotification);
+ this.onAppPermissionChangedUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onAppPermissionChangedNotification);
+ this.onSDLPersistenceCompleteUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onSDLPersistenceCompleteNotification);
+ this.onFileRemovedUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onFileRemovedNotification);
+ this.onAppRegisteredUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onAppRegisteredNotification);
+ this.onAppUnregisteredUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onAppUnregisteredNotification);
+ this.onPlayToneUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onPlayToneNotification);
+ this.onSDLCloseUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onSDLCloseNotification);
+ this.onSDLConsentNeededUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onSDLConsentNeededNotification);
+ this.onResumeAudioSourceUnsubscribeRequestID = this.client
+ .unsubscribeFromNotification(this.onResumeAudioSourceNotification);
+ },
+
+ /**
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ if (SDL.SDLAppController) {
+ SDL.SDLAppController.onSDLDisconected();
+ }
+ },
+
+ /**
+ * when result is received from RPC component this function is called It
+ * is the propriate place to check results of reuqest execution Please
+ * use previously store reuqestID to determine to which request repsonse
+ * belongs to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCResult");
+ this._super();
+
+ if ("result" in response
+ && response.result.code === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ if (response.result.method == "SDL.GetUserFriendlyMessage") {
+
+ Em.Logger.log("SDL.GetUserFriendlyMessage: Response from SDL!");
+
+ if (response.id in SDL.SDLModel.userFriendlyMessagePull) {
+ var callbackObj = SDL.SDLModel.userFriendlyMessagePull[response.id];
+ callbackObj.callbackFunc(response.result.messages);
+ delete SDL.SDLModel.userFriendlyMessagePull[response.id];
+ }
+ }
+
+ if (response.result.method == "SDL.ActivateApp") {
+
+ Em.Logger.log("SDL.ActivateApp: Response from SDL!");
+
+ if (response.id in SDL.SDLModel.activateAppRequestsList) {
+
+ var appID = SDL.SDLModel.activateAppRequestsList[response.id].appID,
+ popUp = SDL.SDLModel.activateAppRequestsList[response.id].popUp;
+
+ popUp.deactivate();
+
+ if (response.error && response.error.code === SDL.SDLModel.resultCode["APPLICATION_NOT_REGISTERED"]) {
+
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED!");
+ return;
+ }
+
+ if (!response.result.isSDLAllowed) {
+
+ SDL.SettingsController.currentDeviceAllowance = response.result.device;
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.AllowSDLFunctionality, appID, ["DataConsent"]);
+ }
+
+ if (response.result.isPermissionsConsentNeeded) {
+
+ this.GetListOfPermissions(appID);
+ }
+
+ if (response.result.isAppPermissionsRevoked) {
+
+ SDL.SDLModel.setAppPermissions(appID, response.result.appRevokedPermissions);
+ }
+
+ if (response.result.isAppRevoked) {
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, appID, ["AppUnsupported"]);
+ } else {
+
+ SDL.SDLController.getApplicationModel(appID).deviceID = response.result.device ? response.result.device.id : null;
+
+ if (SDL.SDLAppController.model && SDL.SDLAppController.model.appID != appID) {
+ SDL.States.goToStates('info.apps');
+ }
+
+ if (SDL.SDLModel.stateLimited == appID) {
+ SDL.SDLModel.stateLimited = null;
+ SDL.SDLModel.set('limitedExist', false);
+ }
+
+ if (response.result.isSDLAllowed) {
+ SDL.SDLController.getApplicationModel(appID).turnOnSDL(appID);
+ }
+ }
+
+ delete SDL.SDLModel.activateAppRequestsList[response.id];
+ }
+ } else if (response.result.method == "SDL.ActivateApp" && response.result.code != 0) {
+ Em.Logger.error("SDL.ActivateApp: Wrong Response from SDL!");
+ }
+
+ if (response.result.method == "SDL.GetListOfPermissions") {
+
+ Em.Logger.log("SDL.GetListOfPermissions: Response from SDL!");
+
+ SDL.SettingsController.GetListOfPermissionsResponse(response);
+ }
+
+ if (response.result.method == "SDL.GetStatusUpdate") {
+
+ Em.Logger.log("SDL.GetStatusUpdate: Response from SDL!");
+
+ SDL.PopUp.create().appendTo('body').popupActivate(response.result);
+ }
+
+ if (response.result.method == "SDL.GetURLS") {
+
+ SDL.SDLModel.set('policyURLs', response.result.urls);
+
+ if (response.result.urls.length) {
+ this.OnSystemRequest("PROPRIETARY", response.result.urls[0].policyAppId, SDL.SettingsController.policyUpdateFile, response.result.urls[0].url);
+ } else {
+ this.OnSystemRequest("PROPRIETARY");
+ }
+
+ SDL.SettingsController.policyUpdateRetry();
+
+ }
+ } else if ("error" in response
+ && "code" in response.error
+ && response.error.code !== SDL.SDLModel.resultCode["SUCCESS"]) {
+
+
+ if ("data" in response.error && "method" in response.error.data) {
+ //&& response.error.data.method == "SDL.ActivateApp" && response.error.code === 15) {
+
+ if (response.error.data.method == "SDL.ActivateApp") {
+
+ var appID = SDL.SDLModel.activateAppRequestsList[response.id].appID,
+ popUp = SDL.SDLModel.activateAppRequestsList[response.id].popUp;
+
+ popUp.deactivate();
+
+ if (SDL.SDLModel.resultCode["APPLICATION_NOT_REGISTERED"]) {
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED! Application not registered!");
+ }
+
+ delete SDL.SDLModel.activateAppRequestsList[response.id];
+ }
+ } else {
+ console.error("Wrong JSON response structure!");
+ }
+ } else {
+ console.error("Wrong JSON response structure!");
+ }
+ },
+
+ /**
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCError");
+ this._super();
+ },
+
+ /**
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCNotification");
+ this._super();
+
+ if (notification.method == this.onFileRemovedNotification) {
+ SDL.SDLModel.onFileRemoved(notification.params);
+ }
+
+ if (notification.method == this.onStatusUpdateNotification) {
+
+ SDL.TTSPopUp.ActivateTTS(notification.params.status);
+
+ var messageCode = '';
+ switch(notification.params.status){
+ case "UP_TO_DATE":{
+ messageCode = "StatusUpToDate";
+ break;
+ }
+ case "UPDATING":{
+ messageCode = "StatusPending";
+ break;
+ }
+ case "UPDATE_NEEDED":{
+ messageCode = "StatusNeeded";
+ break;
+ }
+ }
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, SDL.SDLAppController.model?SDL.SDLAppController.model.appID:null, [messageCode]);
+ }
+
+ if (notification.method == this.onAppPermissionChangedNotification) {
+
+ if (notification.params.appPermissionsConsentNeeded) {
+
+ this.GetListOfPermissions(notification.params.appID);
+ }
+
+ if (notification.params.isAppPermissionsRevoked) {
+
+ SDL.SDLModel.setAppPermissions(notification.params.appID, notification.params.appRevokedPermissions);
+ }
+
+ if (notification.params.appRevoked) {
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, notification.params.appID, ["AppUnsupported"]);
+ }
+
+ if (notification.params.appUnauthorized) {
+
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.simpleParseUserFriendlyMessageData, notification.params.appID, ["AppUnauthorized"]);
+ }
+ }
+
+ if (notification.method == this.onAppRegisteredNotification) {
+ SDL.SDLModel.onAppRegistered(notification.params.application);
+ this.OnFindApplications();
+ }
+
+ if (notification.method == this.onAppUnregisteredNotification) {
+ // remove app from list
+ SDL.SDLModel.onAppUnregistered(notification.params);
+ }
+
+ if (notification.method == this.onPlayToneNotification) {
+ SDL.SDLModel.onPlayTone();
+ }
+
+ if (notification.method == this.onSDLCloseNotification) {
+ //notification handler method
+ }
+ if (notification.method == this.onSDLConsentNeededNotification) {
+
+ SDL.SettingsController.currentDeviceAllowance = notification.params.device;
+ FFW.BasicCommunication.GetUserFriendlyMessage(SDL.SettingsController.AllowSDLFunctionality, null, ["DataConsent"]);
+ }
+ if (notification.method == this.onResumeAudioSourceNotification) {
+
+ SDL.SDLModel.stateLimited = notification.params.device;
+ SDL.VRPopUp.updateVR();
+ }
+ },
+
+ /**
+ * handle RPC requests here
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.BasicCommunicationRPC.onRPCRequest");
+ this._super();
+
+ if (this.validationCheck(request)) {
+
+ if (request.method == "BasicCommunication.MixingAudioSupported") {
+ this.MixingAudioSupported(request.id, true);
+ }
+ if (request.method == "BasicCommunication.AllowAllApps") {
+ this.AllowAllApps(true);
+ }
+ if (request.method == "BasicCommunication.AllowApp") {
+ this.AllowApp(request);
+ }
+ if (request.method == "BasicCommunication.AllowDeviceToConnect") {
+ this.AllowDeviceToConnect(request.id, request.method, allow);
+ }
+ if (request.method == "BasicCommunication.UpdateDeviceList") {
+ SDL.SDLModel.onGetDeviceList(request.params);
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+ }
+ if (request.method == "BasicCommunication.UpdateAppList") {
+
+ var message = "Was found " + request.params.applications.length + " apps";
+
+ SDL.PopUp.create().appendTo('body').popupActivate(message);
+
+ SDL.SDLModel.set('updatedAppsList', request.params.applications);
+
+ SDL.InfoAppsView.showAppList();
+
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ SDL.InfoAppsView.showAppList();
+ }
+ if (request.method == "BasicCommunication.SystemRequest") {
+
+ SDL.SettingsController.policyUpdateRetry("ABORT");
+
+ this.OnReceivedPolicyUpdate(request.params.fileName);
+
+ SDL.SettingsController.policyUpdateFile = null;
+
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+ }
+ if (request.method == "BasicCommunication.DialNumber") {
+
+ SDL.PopUp.create().appendTo('body').popupActivate(
+ "Would you like to dial " + request.params.number + " ?",
+ function (result) {
+ if (result) {
+
+ FFW.BasicCommunication.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ SDL.SDLModel.onDeactivateApp('call', request.params.appID);
+ SDL.States.goToStates('phone.dialpad');
+ SDL.PhoneController.incomingCall(request);
+ } else {
+
+
+ FFW.BasicCommunication.sendError(SDL.SDLModel.resultCode["REJECTED"],
+ request.id,
+ request.method,
+ "No paired device!"
+ );
+ }
+ },
+ false);
+ }
+ if (request.method == "BasicCommunication.ActivateApp") {
+
+ if (!request.params.level || request.params.level == "FULL") {
+ if ((SDL.SDLAppController.model && SDL.SDLAppController.model.appID != request.params.appID) || (request.params.level == "NONE" || request.params.level == "BACKGROUND")) {
+ SDL.States.goToStates('info.apps');
+ }
+
+ if (SDL.SDLModel.stateLimited == request.params.appID) {
+ SDL.SDLModel.stateLimited = null;
+ SDL.SDLModel.set('limitedExist', false);
+ }
+
+ SDL.SDLController.getApplicationModel(request.params.appID).turnOnSDL(request.params.appID);
+ }
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+ }
+ if (request.method == "BasicCommunication.GetSystemInfo") {
+
+ Em.Logger.log("BasicCommunication.GetSystemInfo Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type (enum) from SDL protocol
+ "method": request.method,
+ "ccpu_version": "ccpu_version",
+ "language": SDL.SDLModel.hmiUILanguage,
+ "wersCountryCode": "wersCountryCode"
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ if (request.method == "BasicCommunication.PolicyUpdate") {
+ SDL.SettingsController.policyUpdateFile = request.params.file;
+
+ SDL.SDLModel.policyUpdateRetry.timeout = request.params.timeout;
+ SDL.SDLModel.policyUpdateRetry.retry = request.params.retry;
+ SDL.SDLModel.policyUpdateRetry.try = 0;
+
+ this.GetURLS(7); //Service type for policies
+
+ this.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+ }
+ }
+ },
+
+ /********************* Requests *********************/
+
+
+ /**
+ * Send request if application was activated
+ *
+ * @param {Number} appID
+ */
+ ActivateApp: function(appID) {
+
+ var itemIndex = this.client.generateId();
+
+ SDL.SDLModel.activateAppRequestsList[itemIndex] = {
+ "appID": appID,
+ "popUp": SDL.PopUp.create().appendTo('body').popupActivate("Activation in progress...", null, true)
+ };
+
+ Em.Logger.log("FFW.SDL.OnAppActivated: Request from HMI!");
+
+ // send notification
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": itemIndex,
+ "method": "SDL.ActivateApp",
+ "params": {
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+
+ setTimeout(function(){
+ if (itemIndex in SDL.SDLModel.activateAppRequestsList) {
+
+ SDL.SDLModel.activateAppRequestsList[itemIndex].popUp.deactivate();
+
+ SDL.PopUp.create().appendTo('body').popupActivate("Activation FAILED! Application not registered!");
+
+ delete SDL.SDLModel.activateAppRequestsList[itemIndex];
+ }
+ }, 20000);
+ },
+
+ /**
+ * Send request if application was activated
+ *
+ * @param {Number} type
+ */
+ GetURLS: function(type) {
+
+ Em.Logger.log("FFW.SDL.GetURLS: Request from HMI!");
+
+ // send notification
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": this.client.generateId(),
+ "method": "SDL.GetURLS",
+ "params": {
+ "service": type
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Request from HMI to find out Policy Table status
+ */
+ GetStatusUpdate: function() {
+
+ Em.Logger.log("SDL.GetStatusUpdate: Request from HMI!");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": this.client.generateId(),
+ "method": "SDL.GetStatusUpdate",
+ "params": {}
+ };
+ this.client.send(JSONMessage);
+ },
+
+ UpdateSDL: function() {
+
+ Em.Logger.log("SDL.UpdateSDL: Request from HMI!");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": this.client.generateId(),
+ "method": "SDL.UpdateSDL",
+ "params": {}
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Request to SDLCore to get user friendly message
+ * callback function uses text message came in response from SDLCore
+ *
+ * @callback callbackFunc
+ */
+ GetUserFriendlyMessage: function(callbackFunc, appID, messageCodes) {
+
+ var itemIndex = this.client.generateId();
+
+ SDL.SDLModel.userFriendlyMessagePull[itemIndex] = {"callbackFunc": callbackFunc, "appID": appID};
+
+ Em.Logger.log("SDL.GetUserFriendlyMessage: Request from HMI!");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": itemIndex,
+ "method": "SDL.GetUserFriendlyMessage",
+ "params": {
+ "language": SDL.SDLModel.hmiUILanguage,
+ "messageCodes": messageCodes
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Request to SDLCore to get user friendly message
+ * callback function uses text message came in response from SDLCore
+ *
+ * @param {Number} appID
+ */
+ GetListOfPermissions: function(appID) {
+
+ var itemIndex = this.client.generateId();
+
+ SDL.SDLModel.getListOfPermissionsPull[itemIndex] = appID;
+
+ Em.Logger.log("SDL.GetListOfPermissions: Request from HMI!");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": itemIndex,
+ "method": "SDL.GetListOfPermissions",
+ "params": {
+ }
+ };
+
+ if (appID) {
+ JSONMessage.params.appID = appID;
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /********************* Responses *********************/
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendBCResult: function(resultCode, id, method) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Notifies if functionality was changed
+ *
+ * @param {Boolean}
+ * allowed
+ * @param {String}
+ * source
+ * @param {String}
+ * device
+ */
+ OnAllowSDLFunctionality: function(allowed, source) {
+
+ Em.Logger.log("FFW.SDL.OnAllowSDLFunctionality");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnAllowSDLFunctionality",
+ "params": {
+ "allowed": allowed,
+ "source": source
+ }
+ };
+
+ if (SDL.SettingsController.currentDeviceAllowance) {
+ JSONMessage.params.device = SDL.SettingsController.currentDeviceAllowance;
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+
+ /**
+ * Notifies if language was changed
+ *
+ * @param {String} lang
+ */
+ OnSystemInfoChanged: function(lang) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnSystemInfoChanged");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnSystemInfoChanged",
+ "params": {
+ "language": lang
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+
+ /**
+ * Notification of decrypted policy table available
+ *
+ * @param {String} policyfile
+ */
+ OnReceivedPolicyUpdate: function(policyfile) {
+
+ Em.Logger.log("FFW.SDL.OnReceivedPolicyUpdate");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnReceivedPolicyUpdate",
+ "params": {
+ "policyfile": policyfile
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if functionality was changed
+ *
+ * @param {Boolean}
+ * allowed
+ * @param {String}
+ * source
+ * @param {String}
+ * device
+ */
+ OnAppPermissionConsent: function(consentedFunctions, source, appID) {
+
+ Em.Logger.log("FFW.SDL.OnAppPermissionConsent");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnAppPermissionConsent",
+ "params": {
+ "consentedFunctions": consentedFunctions,
+ "source": source
+ }
+ };
+
+ if (appID) {
+ JSONMessage.params.appID = appID;
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ * @param {Boolean}
+ * allow
+ */
+ AllowDeviceToConnect: function(id, method, allow) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type (enum)
+ // from SDL
+ // protocol
+ "method": method,
+ "allow": true
+ }
+ };
+ this.client.send(JSONMessage);
+
+ },
+
+ /**
+ * notification that UI is ready BasicCommunication should be sunscribed
+ * to this notification
+ */
+ onReady: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.onReady");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnReady"
+ };
+ this.client.send(JSONMessage);
+ },
+
+/**
+ * Sent notification to SDL when HMI closes
+ */
+ OnIgnitionCycleOver: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.OnIgnitionCycleOver");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnIgnitionCycleOver"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Send request if application was activated
+ *
+ * @param {number} appID
+ */
+ OnAppActivated: function(appID) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnAppActivated");
+
+ // send notification
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnAppActivated",
+ "params": {
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Send request if device was unpaired from HMI
+ *
+ * @param {number} appID
+ */
+ OnDeviceStateChanged: function(elemet) {
+
+ Em.Logger.log("FFW.SDL.OnDeviceStateChanged");
+
+ // send notification
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnDeviceStateChanged",
+ "params": {
+ "deviceState": "UNPAIRED",
+ "deviceInternalId": "",
+ "deviceId": {
+ "name": elemet.deviceName,
+ "id": elemet.deviceID
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * This methos is request to get list of registered apps.
+ */
+ OnFindApplications: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.OnFindApplications");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnFindApplications"
+ };
+
+ if (SDL.SDLModel.CurrDeviceInfo.name
+ || SDL.SDLModel.CurrDeviceInfo.id) {
+
+ JSONMessage.params = {
+ "deviceInfo": SDL.SDLModel.CurrDeviceInfo
+ };
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Send notification to SDL Core about system errors
+ */
+ OnSystemError: function(error) {
+
+ Em.Logger.log("FFW.SDL.OnSystemError");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.OnSystemError",
+ "params": {
+ "error": error
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * This methos is request to get list of registered apps.
+ */
+ AddStatisticsInfo: function(statisticType) {
+
+ Em.Logger.log("FFW.SDL.AddStatisticsInfo");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "SDL.AddStatisticsInfo",
+ "params": {
+ "statisticType": statisticType
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Request for list of avaliable devices
+ */
+ getDeviceList: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.GetDeviceList");
+
+ this.getDeviceListRequestID = this.client.generateID();
+
+ var JSONMessage = {
+ "id": this.getDeviceListRequestID,
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.GetDeviceList"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Invoked by UI component when user switches to any functionality which
+ * is not other mobile application.
+ *
+ * @params {String}
+ * @params {Number}
+ */
+ OnAppDeactivated: function(reason, appID) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnAppDeactivated");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnAppDeactivated",
+ "params": {
+ "appID": appID,
+ "reason": reason
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Sender: HMI->SDL. When: upon phone-call event started or ended
+ *
+ * @params {Boolean}
+ */
+ OnPhoneCall: function(isActive) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnPhoneCall");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnPhoneCall",
+ "params": {
+ "isActive": isActive
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Initiated by HMI user. In response optional list of found devices -
+ * if not provided, not were found.
+ */
+ OnStartDeviceDiscovery: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.OnStartDeviceDiscovery");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnStartDeviceDiscovery"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * OnAwakeSDL from HMI returns SDL to normal operation
+ * after OnExitAllApplications(SUSPEND)
+ */
+ OnAwakeSDL: function() {
+
+ Em.Logger.log("FFW.BasicCommunication.OnAwakeSDL");
+
+ // send request
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnAwakeSDL"
+ };
+ this.client.send(JSONMessage);
+ },
+
+
+
+ /**
+ * Used by HMI when User chooses to exit application.
+ *
+ * @params {Number}
+ */
+ ExitApplication: function(appID, reason) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnExitApplication");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnExitApplication",
+ "params": {
+ "reason": reason,
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Sent by HMI to SDL to close all registered applications.
+ *
+ * @params {String}
+ */
+ ExitAllApplications: function(reason) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnExitAllApplications");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnExitAllApplications",
+ "params": {
+ "reason": reason
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Response with params of the last one supports mixing audio (ie
+ * recording TTS command and playing audio).
+ *
+ * @params {Number}
+ */
+ MixingAudioSupported: function(requestid, attenuatedSupported) {
+
+ Em.Logger.log("FFW.BasicCommunication.MixingAudioSupportedResponse");
+
+ // send request
+
+ var JSONMessage = {
+ "id": requestid,
+ "jsonrpc": "2.0",
+ "result": {
+ "code": 0,
+ "attenuatedSupported": attenuatedSupported,
+ "method": "BasicCommunication.MixingAudioSupported"
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Response with Results by user/HMI allowing SDL functionality or
+ * disallowing access to all mobile apps.
+ *
+ * @params {Number}
+ */
+ AllowAllApps: function(allowed) {
+
+ Em.Logger.log("FFW.BasicCommunication.AllowAllAppsResponse");
+
+ // send request
+
+ var JSONMessage = {
+ "id": this.client.idStart,
+ "jsonrpc": "2.0",
+ "result": {
+ "code": 0,
+ "method": "BasicCommunication.AllowAllApps",
+ "allowed": allowed
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Response with result of allowed application
+ *
+ * @params {Number}
+ */
+ AllowApp: function(request) {
+
+ Em.Logger.log("FFW.BasicCommunication.AllowAppResponse");
+
+ var allowedFunctions = [];
+ request.params.appPermissions.forEach(function(entry) {
+ allowedFunctions.push(
+ {
+ name: entry,
+ allowed: true
+ }
+ )
+ }
+ );
+
+ // send request
+
+ var JSONMessage = {
+ "id": request.id,
+ "jsonrpc": "2.0",
+ "result": {
+ "code": 0,
+ "method": "BasicCommunication.AllowApp",
+ "allowedFunctions": allowedFunctions
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if device was choosed
+ *
+ * @param {String}
+ * deviceName
+ * @param {Number}
+ * appID
+ */
+ OnDeviceChosen: function(deviceName, appID) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnDeviceChosen");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnDeviceChosen",
+ "params": {
+ "deviceInfo": {
+ "name": deviceName,
+ "id": appID
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if audio state was changed
+ *
+ * @param {Boolean} enabled
+ */
+ OnEmergencyEvent: function(enabled) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnEmergencyEvent");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnEmergencyEvent",
+ "params": {
+ "enabled": enabled
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Initiated by HMI.
+ */
+ OnSystemRequest: function(type, appID, fileName, url) {
+
+ Em.Logger.log("FFW.BasicCommunication.OnSystemRequest");
+
+ // send request
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "BasicCommunication.OnSystemRequest",
+ "params":{
+ "requestType": type,
+ "url": url,
+ "fileType": "JSON",
+ "offset": 1000,
+ "length": 10000,
+ "timeout": 500,
+ "fileName": fileName ? fileName : document.location.pathname.replace("index.html", "IVSU/PROPRIETARY_REQUEST"),
+ "appID": appID ? appID : "default"
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+
+ })
diff --git a/src/components/HMI/ffw/ButtonsRPC.js b/src/components/HMI/ffw/ButtonsRPC.js
new file mode 100644
index 0000000000..d4dc198ce2
--- /dev/null
+++ b/src/components/HMI/ffw/ButtonsRPC.js
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of Buttons component.
+ *
+ * Buttons sends to SDLCore press and hold events of soft buttons, presets and
+ * some hard keys.
+ */
+
+FFW.Buttons = FFW.RPCObserver.create( {
+
+ /*
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "Buttons"
+ }),
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /*
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 200); // Magic number is unique identifier for
+ // component
+ },
+
+ /*
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /*
+ * Client is registered - we can send request starting from this point of
+ * time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.Buttons.onRPCRegistered");
+ this._super();
+ },
+
+ /*
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.Buttons.onRPCUnregistered");
+ this._super();
+ },
+
+ /*
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ },
+
+ /*
+ * when result is received from RPC component this function is called It is
+ * the propriate place to check results of reuqest execution Please use
+ * previously store reuqestID to determine to which request repsonse belongs
+ * to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.Buttons.onRPCResult");
+ this._super();
+ },
+
+ /*
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.Buttons.onRPCError");
+ this._super();
+ },
+
+ /*
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.Buttons.onRPCNotification");
+ this._super();
+ },
+
+ /*
+ * handle RPC requests here
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.Buttons.onRPCRequest");
+ this._super();
+
+ if (request.method == "Buttons.GetCapabilities") {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "capabilities": [
+ {
+ "name": "PRESET_0",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_1",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_2",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_3",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_4",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_5",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_6",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_7",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_8",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_9",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "OK",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "SEEKLEFT",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "SEEKRIGHT",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "TUNEUP",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "TUNEDOWN",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }
+ ],
+ "presetBankCapabilities": {
+ "onScreenPresetsAvailable": true
+ },
+ "code": 0,
+ "method": "Buttons.GetCapabilities"
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /*
+ * Notifies the ButtonsRPC that the web is all set. Should be called twice:
+ * when the RPC link is up or failed to connect and all the views are
+ * rendered.
+ */
+ buttonPressed: function(id, type) {
+
+ Em.Logger.log("FFW.Buttons.buttonPressed " + type);
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "Buttons.OnButtonPress",
+ "params": {
+ "name": id,
+ "mode": type
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /*
+ * Notifies the ButtonsRPC that the web is all set. Should be called twice:
+ * when the RPC link is up or failed to connect and all the views are
+ * rendered.
+ */
+ buttonEvent: function(id, type) {
+
+ Em.Logger.log("FFW.Buttons.OnButtonEvent " + type);
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "Buttons.OnButtonEvent",
+ "params": {
+ "name": id,
+ "mode": type
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ },
+
+ /*
+ * Notifies the ButtonsRPC that the web is all set. Should be called twice:
+ * when the RPC link is up or failed to connect and all the views are
+ * rendered.
+ */
+ buttonPressedCustom: function(name, type, softButtonID, appID) {
+
+ Em.Logger.log("FFW.Buttons.OnButtonPress " + type);
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "Buttons.OnButtonPress",
+ "params": {
+ "name": name,
+ "mode": type,
+ "customButtonID": softButtonID,
+ "appID": appID
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /*
+ * Notifies the ButtonsRPC that the web is all set. Should be called twice:
+ * when the RPC link is up or failed to connect and all the views are
+ * rendered.
+ */
+ buttonEventCustom: function(name, type, softButtonID, appID) {
+
+ Em.Logger.log("FFW.Buttons.OnButtonEvent " + type);
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "Buttons.OnButtonEvent",
+ "params": {
+ "name": name,
+ "mode": type,
+ "customButtonID": softButtonID,
+ "appID": appID
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ }
+});
diff --git a/src/components/HMI/ffw/Framework.js b/src/components/HMI/ffw/Framework.js
new file mode 100644
index 0000000000..4ab772528f
--- /dev/null
+++ b/src/components/HMI/ffw/Framework.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name FFW
+ * @desc Setup framework namespace and settings
+ * @category Framework
+ * @filesource app/Framework.js
+ * @version 1.0
+ */
+
+FFW = Em.Object.create( {
+
+ init: function() {
+
+ Em.Logger.log('FFW: Framework init');
+ }
+}); \ No newline at end of file
diff --git a/src/components/HMI/ffw/NavigationRPC.js b/src/components/HMI/ffw/NavigationRPC.js
new file mode 100644
index 0000000000..463dbfe976
--- /dev/null
+++ b/src/components/HMI/ffw/NavigationRPC.js
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of Navigation component.
+ *
+ * Interface to get or set some essential information sent from SDLCore.
+ * Navigation is responsible for the navigationApp functionality provided by the
+ * application: display graphics and multimedia components, is responsible for
+ * the transfer of managed manipulations, generated by the user to the server.
+ *
+ */
+
+FFW.Navigation = FFW.RPCObserver.create( {
+
+ /**
+ * If true then Navigation is present and ready to communicate with SDL.
+ *
+ * @type {Boolean}
+ */
+ isReady: true,
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /**
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "Navigation"
+ }),
+
+ // temp var for debug
+ appID: 1,
+
+ /**
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 800); // Magic number is unique identifier for
+ // component
+ },
+
+ /**
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /**
+ * Client is registered - we can send request starting from this point of
+ * time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.Navigation.onRPCRegistered");
+ this._super();
+
+ // subscribe to notifications
+ },
+
+ /**
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.Navigation.onRPCUnregistered");
+ this._super();
+
+ // unsubscribe from notifications
+ },
+
+ /**
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ },
+
+ /**
+ * when result is received from RPC component this function is called It is
+ * the propriate place to check results of request execution Please use
+ * previously store reuqestID to determine to which request repsonse belongs
+ * to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.Navigation.onRPCResult");
+ this._super();
+ },
+
+ /**
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.Navigation.onRPCError");
+ this._super();
+ },
+
+ /**
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.Navigation.onRPCNotification");
+ this._super();
+
+ if (notification.method == this.onStopStreamNotification) {
+ SDL.SDLModel.onStopStream(notification.params.appID);
+ }
+ },
+
+ /**
+ * handle RPC requests here
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.Navigation.onRPCRequest");
+ if (this.validationCheck(request)) {
+
+ var resultCode = null;
+
+ switch (request.method) {
+ case "Navigation.IsReady": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "available": this.get('isReady'),
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "Navigation.IsReady"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "Navigation.AlertManeuver": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("softButtons" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "Navigation.ShowConstantTBT": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ }
+
+ SDL.SDLModel.tbtActivate(request.params);
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "Navigation.UpdateTurnList": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("turnList" in request.params || "softButtons" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.tbtTurnListUpdate(request.params);
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "Navigation.StartAudioStream": {
+
+ SDL.SDLModel.startAudioStream(request);
+
+ break;
+ }
+ case "Navigation.StopAudioStream": {
+
+ SDL.SDLModel.stoptAudioStream(request.params.appID);
+
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "Navigation.StartStream": {
+
+ SDL.SDLModel.startStream(request);
+
+ break;
+ }
+ case "Navigation.StopStream": {
+
+ SDL.SDLModel.stopStream(request.params.appID);
+
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "Navigation.SendLocation": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ }
+
+ this.sendNavigationResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ }
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendNavigationResult: function(resultCode, id, method) {
+
+ if (this.errorResponsePull[id]) {
+
+ this.sendError(this.errorResponsePull[id].code, id, method,
+ "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed.");
+ this.errorResponsePull[id] = null;
+ return;
+ }
+
+ Em.Logger.log("FFW.UI." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Notifies if TBTClientState was activated
+ *
+ * @param {String}
+ * state
+ * @param {Number}
+ * appID
+ */
+ onTBTClientState: function(state, appID) {
+
+ Em.Logger.log("FFW.Navigation.OnTBTClientState");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "Navigation.OnTBTClientState",
+ "params": {
+ "state": state
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/ffw/RPCClient.js b/src/components/HMI/ffw/RPCClient.js
new file mode 100644
index 0000000000..5df06334d2
--- /dev/null
+++ b/src/components/HMI/ffw/RPCClient.js
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Base class for RPC client
+ *
+ * Class provides access to basic functionality of RPC components Message Broker
+ * as: registerComponent unregisterComponent subscription to notifications logic
+ * to calculate request id
+ */
+
+FFW.RPCClient = Em.Object
+ .extend( {
+
+ /*
+ * transport layer for messages exchange
+ */
+ socket: null, // instance of websocket
+
+ /*
+ * url for message broker
+ */
+ url: FLAGS.WEBSOCKET_URL,
+
+ /*
+ * Component name in RPC system It is unique.
+ */
+ componentName: null,
+
+ /*
+ * observer of RPC states
+ */
+ observer: null,
+
+ /*
+ * these variables are used to have unique request ids for different
+ * components in RPC bus idStart is received as a response for
+ * registerRPCComponent messages. space for ids for specific RPC
+ * component is allocated by message broker
+ */
+ idStart: -1,
+ idRange: 1000,
+ requestId: -1,
+
+ registerRequestId: -1,
+ unregisterRequestId: -1,
+
+ /*
+ * Open WebSocket and initialize handlers
+ */
+ connect: function(observer, startId) {
+
+ this.observer = observer;
+ this.idStart = startId;
+
+ this.socket = new WebSocket(this.url);
+
+ var self = this;
+
+ this.socket.onopen = function(evt) {
+
+ self.onWSOpen(evt)
+ };
+ this.socket.onclose = function(evt) {
+
+ self.onWSClose(evt)
+ };
+ this.socket.onmessage = function(evt) {
+
+ self.onWSMessage(evt)
+ };
+ this.socket.onerror = function(evt) {
+
+ self.onWSError(evt)
+ };
+
+ },
+
+ /*
+ * Close WebSocket connection Please make sure that component was
+ * unregistered in advance
+ */
+ disconnect: function() {
+
+ this.unregisterRPCComponent();
+ SDL.SDLController.unregisterComponentStatus(this.observer.client.componentName);
+ },
+
+ /*
+ * WebSocket connection is ready Now RPC component can be registered in
+ * message broker
+ */
+ onWSOpen: function(evt) {
+
+ Em.Logger.log("RPCCLient.onWSOpen");
+
+ this.registerRPCComponent();
+ },
+
+ /*
+ * when result is received from RPC component this function is called It
+ * is the propriate place to check results of reuqest execution Please
+ * use previously store reuqestID to determine to which request repsonse
+ * belongs to
+ */
+ onWSMessage: function(evt) {
+
+ Em.Logger.log("Message received: " + evt.data);
+
+ var jsonObj = JSON.parse(evt.data, SDL.RPCController.capabilitiesCheck);
+
+ if (SDL.RPCController.capabilityCheckResult != null) {
+ this.observer.errorResponsePull[jsonObj.id] = SDL.RPCController.capabilityCheckResult;
+ SDL.RPCController.capabilityCheckResult = null;
+ this.observer.checkImage(jsonObj.params);
+ this.observer.checkSoftButtons(jsonObj.params);
+ this.observer.checkChoice(jsonObj.params);
+ this.observer.checkChunk(jsonObj.params);
+ this.observer.checkHelpItems(jsonObj.params);
+ this.observer.checkTurnList(jsonObj.params);
+ }
+
+ // handle component registration
+ if (jsonObj.id == this.registerRequestId && jsonObj.method == null && typeof jsonObj.result == 'number') {
+ if (jsonObj.error == null) {
+ this.requestId = this.idStart = jsonObj.result;
+ this.observer.onRPCRegistered();
+ }
+ // handle component unregistration
+ } else if (jsonObj.id == this.unregisterRequestId) {
+ if (jsonObj.error == null) {
+ this.socket.close();
+ this.observer.onRPCUnregistered();
+ }
+ // handle result, error, notification, requests
+ } else {
+ if (jsonObj.id == null) {
+ this.observer.onRPCNotification(jsonObj);
+ } else {
+ if (jsonObj.result != null)
+ this.observer.onRPCResult(jsonObj);
+ else if (jsonObj.error != null)
+ this.observer.onRPCError(jsonObj);
+ else
+ this.observer.onRPCRequest(jsonObj);
+ }
+ }
+ },
+
+ /*
+ * WebSocket connection is closed Please make sure that RPCComponent was
+ * dunregistered in advance
+ */
+ onWSClose: function(evt) {
+
+ Em.Logger.log("RPCClient: Connection is closed");
+
+ SDL.SDLController.unregisterComponentStatus(this.observer.client.componentName);
+
+ var self = this;
+ setTimeout(function(){
+ self.connect(self.observer, self.idStart);
+ }, 5000);
+ this.observer.onRPCDisconnected();
+ },
+
+ /*
+ * WebSocket connection errors handling
+ */
+ onWSError: function(evt) {
+
+ // Em.Logger.log("ERROR: " + evt.data);
+ Em.Logger.log("ERROR: ");
+ },
+
+ /*
+ * register component is RPC bus
+ */
+ registerRPCComponent: function() {
+
+ this.registerRequestId = this.idStart;
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": this.registerRequestId,
+ "method": "MB.registerComponent",
+ "params": {
+ "componentName": this.componentName
+ }
+ };
+ this.send(JSONMessage);
+ },
+
+ /*
+ * unregister component is RPC bus
+ */
+ unregisterRPCComponent: function() {
+
+ this.unregisterRequestId = this.generateId();
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": this.unregisterRequestId,
+ "method": "MB.unregisterComponent",
+ "params": {
+ "componentName": this.componentName
+ }
+ };
+ this.send(JSONMessage);
+ },
+
+ /*
+ * Subscribes to notification. Returns the request's id.
+ */
+ subscribeToNotification: function(notification) {
+
+ var msgId = this.generateId();
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": msgId,
+ "method": "MB.subscribeTo",
+ "params": {
+ "propertyName": notification
+ }
+ };
+ this.send(JSONMessage);
+ return msgId;
+ },
+
+ /*
+ * Unsubscribes from notification. Returns the request's id.
+ */
+ unsubscribeFromNotification: function(notification) {
+
+ var msgId = this.generateId();
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": msgId,
+ "method": "MB.unsubscribeFrom",
+ "params": {
+ "propertyName": notification
+ }
+ };
+ this.send(JSONMessage);
+ return msgId;
+ },
+
+ /*
+ * stringify object and send via socket connection
+ */
+ send: function(obj) {
+
+ if (this.socket.readyState == this.socket.OPEN) {
+
+ var strJson = JSON.stringify(obj);
+ Em.Logger.log(strJson);
+
+ var logTime = new Date();
+ console.log(logTime.getHours() + ":" + logTime.getMinutes() + ":" + logTime.getSeconds() + ":" + logTime.getMilliseconds());
+
+ this.socket.send(strJson);
+ } else {
+ Em.Logger
+ .error("RPCClient: Can't send message since socket is not ready");
+ }
+ },
+
+ /*
+ * Generate id for new request to RPC component Function has to be used
+ * as private
+ */
+ generateId: function() {
+
+ this.requestId++;
+ if (this.requestId >= this.idStart + this.idRange)
+ this.requestId = this.idStart;
+ return this.requestId;
+ }
+
+ })
diff --git a/src/components/HMI/ffw/RPCObserver.js b/src/components/HMI/ffw/RPCObserver.js
new file mode 100644
index 0000000000..76b002aa8b
--- /dev/null
+++ b/src/components/HMI/ffw/RPCObserver.js
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @desc Observer of RPCClient
+ */
+
+FFW.RPCObserver = Em.Object
+ .extend( {
+
+ onRPCRegistered: function() {
+
+ // request necessary parameters from Backend
+ SDL.SDLController.registeredComponentStatus(this.client.componentName);
+ },
+
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.RPCObserver.onUnregistered");
+ },
+
+ onRPCDisconnected: function() {
+
+ Em.Logger.log("FFW.RPCObserver.onRPCDisconnected");
+ },
+
+ /*
+ * when result is received from RPC component this function is called It
+ * is the propriate place to check results of reuqest execution Please
+ * use previously store reuqestID to determine to which request repsonse
+ * belongs to
+ */
+ onRPCResult: function(result) {
+
+ // parse JSON string and set necessary properties
+ },
+
+ /*
+ */
+ onRPCError: function(error) {
+
+ // parse JSON string and set necessary properties
+ },
+
+ /*
+ */
+ onRPCNotification: function(notification) {
+
+ // parse JSON string and set necessary properties
+ },
+
+ onRPCRequest: function(request, error) {
+
+ // parse JSON string and send back necessary data
+ },
+
+ /**
+ * Check for unsupported image type
+ * Return false if unsupported image type was found and delete unsupported resource
+ * @param params
+ * @returns {boolean}
+ */
+ checkImage: function(params){
+ if ("graphic" in params) {
+ if (params.graphic.imageType === "STATIC") {
+ delete params.graphic;
+ return false;
+ }
+ }
+ if ("secondaryGraphic" in params) {
+ if (params.secondaryGraphic.imageType === "STATIC") {
+ delete params.secondaryGraphic;
+ return false;
+ }
+ }
+ if ("image" in params) {
+ if (params.image.imageType === "STATIC") {
+ delete params.image;
+ return false;
+ }
+ }
+ if ("secondaryImage" in params) {
+ if (params.image.imageType === "STATIC") {
+ delete params.image;
+ return false;
+ }
+ }
+ if ("turnIcon" in params) {
+ if (params.turnIcon.imageType === "STATIC") {
+ delete params.turnIcon;
+ return false;
+ }
+ }
+ if ("nextTurnIcon" in params) {
+ if (params.nextTurnIcon.imageType === "STATIC") {
+ delete params.nextTurnIcon;
+ return false;
+ }
+ }
+ if ("cmdIcon" in params) {
+ if (params.cmdIcon.imageType === "STATIC") {
+ delete params.cmdIcon;
+ return false;
+ }
+ }
+ if ("menuIcon" in params) {
+ if (params.menuIcon.imageType === "STATIC") {
+ delete params.menuIcon;
+ return false;
+ }
+ }
+ if ("syncFileName" in params) {
+ if (params.syncFileName.imageType === "STATIC") {
+ delete params.syncFileName;
+ return false;
+ }
+ }
+ if ("locationImage" in params) {
+ if (params.locationImage.imageType === "STATIC") {
+ delete params.locationImage;
+ return false;
+ }
+ }
+ return true;
+ },
+
+ /**
+ * Check for unsupported image type
+ * If unsupported image type was found delete unsupported resource
+ * @param params
+ */
+ checkSoftButtons: function(params){
+
+ if ("softButtons" in params) {
+ for (var i = params.softButtons.length-1; i >= 0 ; i--) {
+ if (!this.checkImage(params.softButtons[i])) {
+ if (!("text" in params.softButtons[i])) {
+
+ params.softButtons.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.softButtons.length == 0) {
+ delete params.softButtons;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported image type
+ * If unsupported image type was found delete unsupported resource
+ * @param params
+ */
+ checkTurnList: function(params){
+
+ if ("turnList" in params) {
+ for (var i = params.turnList.length-1; i >= 0 ; i--) {
+ if (!this.checkImage(params.turnList[i])) {
+ if (!("navigationText" in params.turnList[i])) {
+
+ params.turnList.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.turnList.length == 0) {
+ delete params.turnList;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported tts type
+ * If unsupported tts type was found delete unsupported resource
+ * @param params
+ */
+ checkChunk: function(params){
+
+ if ("ttsName" in params) {
+ for (var i = params.ttsName.length-1; i >= 0 ; i--) {
+ if (params.ttsName[i].type != "TEXT") {
+
+ params.ttsName.splice(i, 1);
+ }
+ }
+
+ if (params.ttsName.length == 0) {
+ delete params.ttsName;
+ }
+ }
+ if ("helpPrompt" in params) {
+ for (var i = params.helpPrompt.length-1; i >= 0 ; i--) {
+ if (params.helpPrompt[i].type != "TEXT") {
+
+ params.helpPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.helpPrompt.length == 0) {
+ delete params.helpPrompt;
+ }
+ }
+ if ("initialPrompt" in params) {
+ for (var i = params.initialPrompt.length-1; i >= 0 ; i--) {
+ if (params.initialPrompt[i].type != "TEXT") {
+
+ params.initialPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.initialPrompt.length == 0) {
+ delete params.initialPrompt;
+ }
+ }
+ if ("timeoutPrompt" in params) {
+ for (var i = params.timeoutPrompt.length-1; i >= 0 ; i--) {
+ if (params.timeoutPrompt[i].type != "TEXT") {
+
+ params.timeoutPrompt.splice(i, 1);
+ }
+ }
+
+ if (params.timeoutPrompt.length == 0) {
+ delete params.timeoutPrompt;
+ }
+ }
+ if ("ttsChunks" in params) {
+ for (var i = params.ttsChunks.length-1; i >= 0 ; i--) {
+ if (params.ttsChunks[i].type != "TEXT") {
+
+ params.ttsChunks.splice(i, 1);
+ }
+ }
+
+ if (params.ttsChunks.length == 0) {
+ delete params.ttsChunks;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported choiceSet type
+ * If unsupported choiceSet type was found delete unsupported resource
+ * @param params
+ */
+ checkChoice: function(params){
+
+ if ("choiceSet" in params) {
+ for (var i = params.choiceSet.length-1; i >= 0 ; i--) {
+ if (this.checkImage(params.choiceSet[i])) {
+ if (!("menuName" in params.choiceSet[i])
+ || !("secondaryText" in params.choiceSet[i])
+ || !("tertiaryText" in params.choiceSet[i])) {
+
+ params.choiceSet.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.choiceSet.length == 0) {
+ delete params.choiceSet;
+ }
+ }
+ },
+
+ /**
+ * Check for unsupported vrHelp type
+ * If unsupported vrHelp type was found delete unsupported resource
+ * @param params
+ */
+ checkHelpItems: function(params){
+
+ if ("vrHelp" in params) {
+ for (var i = params.vrHelp.length-1; i >= 0 ; i--) {
+ if (this.checkImage(params.vrHelp[i])) {
+ if (!("text" in params.vrHelp[i])) {
+
+ params.vrHelp.splice(i, 1);
+ }
+ }
+ }
+
+ if (params.vrHelp.length == 0) {
+ delete params.vrHelp;
+ }
+ }
+ },
+
+ validationCheck: function(request) {
+
+ if (request && request.method) {
+ var parsedMethod = request.method.split(/[.]/), validateFunc, result;
+
+ //if (request.params && "appID" in request.params && SDL.SDLModel.registeredApps.filterProperty('appID', request.params.appID).length > 0) {
+
+ if (request.params && "appID" in request.params && typeof(request.params.appID) == "number" && SDL.SDLModel.registeredApps.filterProperty('appID', request.params.appID).length <= 0) {
+ Em.Logger.error('No application registered with current appID!');
+ return false;
+ }
+
+ if (SDL.RPCController[parsedMethod[0]][parsedMethod[1]]) {
+ validateFunc = SDL.RPCController[parsedMethod[0]][parsedMethod[1]];
+ result = validateFunc(request.params);
+
+ if (result.resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+ this.sendError(result.resultCode,
+ request.id,
+ request.method,
+ result.resultMessage);
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ this.sendError(SDL.SDLModel.resultCode["UNSUPPORTED_REQUEST"],
+ request.id,
+ request.method,
+ 'Unsupported incoming request! ' + parsedMethod[0]
+ + '.' + parsedMethod[1]);
+ Em.Logger.error('No method "' + parsedMethod[0] + '.'
+ + parsedMethod[1] + '"');
+ return false;
+ }
+ }
+ }
+ });
diff --git a/src/components/HMI/ffw/TTSRPC.js b/src/components/HMI/ffw/TTSRPC.js
new file mode 100644
index 0000000000..0e0b92acd4
--- /dev/null
+++ b/src/components/HMI/ffw/TTSRPC.js
@@ -0,0 +1,476 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of TTS component.
+ *
+ * TTS is responsible for playing sound data sent from SDLCore to notify user
+ * about some events happened.
+ */
+
+FFW.TTS = FFW.RPCObserver.create( {
+
+ /**
+ * If true then TTS is present and ready to communicate with SDL.
+ *
+ * @type {Boolean}
+ */
+ isReady: true,
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /**
+ * Request id of current running Speak request
+ *
+ * @type {Boolean}
+ */
+ requestId: null,
+
+ /**
+ * Flag to determine if Speak request was aborted
+ *
+ * @type {Boolean}
+ */
+ aborted: false,
+
+ /*
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "TTS"
+ }),
+
+ /*
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 300); // Magic number is unique identifier for
+ // component
+ },
+
+ /*
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /*
+ * Client is registered - we can send request starting from this point of
+ * time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.TTS.onRPCRegistered");
+ this._super();
+ },
+
+ /*
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.TTS.onRPCUnregistered");
+ this._super();
+ },
+
+ /*
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ },
+
+ /*
+ * when result is received from RPC component this function is called It is
+ * the propriate place to check results of reuqest execution Please use
+ * previously store reuqestID to determine to which request repsonse belongs
+ * to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.TTS.onRPCResult");
+ this._super();
+ },
+
+ /*
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.TTS.onRPCError");
+ this._super();
+ },
+
+ /*
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.TTS.onRPCNotification");
+ this._super();
+ },
+
+ /*
+ * handle RPC requests here
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.TTS.onRPCRequest");
+ this._super();
+
+ switch (request.method) {
+ case "TTS.Speak": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("ttsChunks" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ if (SDL.TTSPopUp.active) {
+ FFW.TTS.sendError(SDL.SDLModel.resultCode["REJECTED"], request.id, "TTS.Speak", "TTS in progress. Rejected.");
+ } else {
+ this.requestId = request.id;
+ SDL.SDLModel.onPrompt(request.params.ttsChunks, request.params.appID);
+ }
+
+ break;
+ }
+ case "TTS.SetGlobalProperties": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("helpPrompt" in request.params
+ || "timeoutPrompt" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.setProperties(request.params);
+
+ this.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "TTS.StopSpeaking": {
+
+ SDL.SDLModel.TTSStopSpeaking();
+
+ this.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "TTS.GetCapabilities": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "speechCapabilities": [
+ "TEXT",
+ "PRE_RECORDED"
+ ],
+ "prerecordedSpeechCapabilities": [
+ "HELP_JINGLE",
+ "INITIAL_JINGLE",
+ "LISTEN_JINGLE",
+ "POSITIVE_JINGLE",
+ "NEGATIVE_JINGLE"
+ ],
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type (enum)
+ // from SDL
+ // protocol
+ "method": "TTS.GetCapabilities"
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "TTS.GetSupportedLanguages": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type (enum)
+ // from SDL
+ "method": "TTS.GetSupportedLanguages",
+ "languages": SDL.SDLModel.sdlLanguagesList
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "TTS.GetLanguage": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type (enum)
+ // from SDL
+ "method": "TTS.GetLanguage",
+ "language": SDL.SDLModel.hmiTTSVRLanguage
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "TTS.ChangeRegistration": {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("ttsName" in request.params
+ || "language" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.changeRegistrationTTSVR(request.params.language, request.params.appID);
+
+ this.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+
+ case "TTS.IsReady": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "available": this.get('isReady'),
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "TTS.IsReady"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+
+ default: {
+ // statements_def
+ break;
+ }
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendTTSResult: function(resultCode, id, method) {
+
+ if (this.errorResponsePull[id]) {
+
+ this.sendError(this.errorResponsePull[id].code, id, method,
+ "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed.");
+ this.errorResponsePull[id] = null;
+ return;
+ }
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /*
+ * Notifies if sdl TTS components language was changed
+ */
+ OnLanguageChange: function(lang) {
+
+ Em.Logger.log("FFW.TTS.OnLanguageChange");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "TTS.OnLanguageChange",
+ "params": {
+ "language": lang
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Initiated by TTS module to let SDL know that TTS session has started.
+ */
+ Started: function() {
+
+ Em.Logger.log("FFW.TTS.Started");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "TTS.Started"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Sent OnResetTimeout notification to SDLCore to inform when
+ * HMI pronounces text longer than 10 seconds
+ */
+ OnResetTimeout: function(appID, methodName) {
+
+ Em.Logger.log("FFW.TTS.OnResetTimeout");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "TTS.OnResetTimeout",
+ "params": {
+ "appID": appID,
+ "methodName": methodName
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Initiated by TTS module to let SDL know that TTS session has stopped.
+ */
+ Stopped: function() {
+
+ Em.Logger.log("FFW.TTS.Stopped");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "TTS.Stopped"
+ };
+ this.client.send(JSONMessage);
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/ffw/UIRPC.js b/src/components/HMI/ffw/UIRPC.js
new file mode 100644
index 0000000000..5feb304d20
--- /dev/null
+++ b/src/components/HMI/ffw/UIRPC.js
@@ -0,0 +1,1857 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of UI component.
+ *
+ * Interface to get or set some essential information sent from SDLCore. UI is
+ * responsible for the functionality provided by the application: display
+ * graphics and multimedia components, is responsible for the transfer of
+ * managed manipulations, generated by the user to the server.
+ *
+ */
+
+FFW.UI = FFW.RPCObserver.create({
+
+ /**
+ * If true then UI is present and ready to communicate with SDL.
+ *
+ * @type {Boolean}
+ */
+ isReady: true,
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /**
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create({
+ componentName: "UI"
+ }),
+
+ // temp var for debug
+ appID: 1,
+
+ onRecordStartSubscribeRequestID: -1,
+
+ onRecordStartUnsubscribeRequestID: -1,
+
+ // const
+ onRecordStartNotification: "UI.OnRecordStart",
+
+ /**
+ * ids for requests AudioPassThru
+ */
+ performAudioPassThruRequestID: -1,
+ endAudioPassThruRequestID: -1,
+
+ /**
+ * connect to RPC bus
+ */
+ connect: function () {
+
+ this.client.connect(this, 400); // Magic number is unique identifier
+ // for component
+ },
+
+ /**
+ * disconnect from RPC bus
+ */
+ disconnect: function () {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /**
+ * Client is registered - we can send request starting from this point
+ * of time
+ */
+ onRPCRegistered: function () {
+
+ Em.Logger.log("FFW.UI.onRPCRegistered");
+ this._super();
+
+ // subscribe to notifications
+ this.onRecordStartSubscribeRequestID = this.client.subscribeToNotification(this.onRecordStartNotification);
+ },
+
+ /**
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function () {
+
+ Em.Logger.log("FFW.UI.onRPCUnregistered");
+ this._super();
+
+ // unsubscribe from notifications
+ this.onRecordStartUnsubscribeRequestID = this.client.unsubscribeFromNotification(this.onRecordStartNotification);
+ },
+
+ /**
+ * Client disconnected.
+ */
+ onRPCDisconnected: function () {
+
+ },
+
+ /**
+ * when result is received from RPC component this function is called It
+ * is the propriate place to check results of request execution Please
+ * use previously store reuqestID to determine to which request repsonse
+ * belongs to
+ */
+ onRPCResult: function (response) {
+
+ Em.Logger.log("FFW.UI.onRPCResult");
+ this._super();
+ },
+
+ /**
+ * handle RPC erros here
+ */
+ onRPCError: function (error) {
+
+ Em.Logger.log("FFW.UI.onRPCError");
+ this._super();
+ },
+
+ /**
+ * handle RPC notifications here
+ */
+ onRPCNotification: function (notification) {
+
+ Em.Logger.log("FFW.UI.onRPCNotification");
+ this._super();
+
+ if (notification.method == this.onRecordStartNotification) {
+ SDL.AudioPassThruPopUp.StartAudioPassThruTimer();
+ }
+ },
+
+ /**
+ * handle RPC requests here
+ */
+ onRPCRequest: function (request) {
+
+ Em.Logger.log("FFW.UI.onRPCRequest");
+
+ if (this.validationCheck(request)) {
+
+ switch (request.method) {
+ case "UI.Alert":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if (request.params.alertStrings.length > 0
+ || "softButtons" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ if (SDL.SDLModel.onUIAlert(request.params, request.id)) {
+ SDL.SDLController.onSystemContextChange(request.params.appID);
+ }
+
+ break;
+ }
+ case "UI.Show":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if (request.params.showStrings.length > 0
+ || "graphic" in request.params
+ || "secondaryGraphic" in request.params
+ || "softButtons" in request.params
+ || "customPresets" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.TurnByTurnView.deactivate();
+ SDL.SDLController.getApplicationModel(request.params.appID).onSDLUIShow(request.params);
+ this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+
+ break;
+ }
+ case "UI.SetGlobalProperties":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("menuTitle" in request.params
+ || "keyboardProperties" in request.params
+ || "vrHelp" in request.params
+ || "menuIcon" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.setProperties(request.params);
+
+ this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+
+ break;
+ }
+ case "UI.AddCommand":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("cmdIcon" in request.params
+ || "menuParams" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLController.getApplicationModel(request.params.appID).addCommand(request);
+
+ break;
+ }
+ case "UI.DeleteCommand":
+ {
+
+ SDL.SDLController.getApplicationModel(request.params.appID).deleteCommand(request.params.cmdID, request.id);
+
+ break;
+ }
+ case "UI.AddSubMenu":
+ {
+
+ SDL.SDLController.getApplicationModel(request.params.appID).addSubMenu(request);
+
+ break;
+ }
+ case "UI.DeleteSubMenu":
+ {
+
+ var resultCode = SDL.SDLController.getApplicationModel(request.params.appID).deleteSubMenu(request.params.menuID);
+ this.sendUIResult(resultCode, request.id, request.method);
+
+ break;
+ }
+ case "UI.PerformInteraction":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("choiceSet" in request.params
+ && request.params
+ && request.params.interactionLayout != "KEYBOARD") {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code,
+ request.id,
+ request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ if (SDL.SDLModel.uiPerformInteraction(request)) {
+ SDL.SDLController.onSystemContextChange();
+ }
+
+ break;
+ }
+ case "UI.SetMediaClockTimer":
+ {
+
+ var resultCode = SDL.SDLController.getApplicationModel(request.params.appID).sdlSetMediaClockTimer(request.params);
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+ this.sendUIResult(resultCode, request.id, request.method);
+ } else {
+ this.sendError(resultCode,
+ request.id,
+ request.method,
+ 'Request is ignored, because the intended result is already in effect.');
+ }
+
+ break;
+ }
+ case "UI.Slider":
+ {
+
+ if (SDL.SDLModel.uiSlider(request)) {
+ SDL.SDLController.onSystemContextChange();
+ }
+
+ break;
+ }
+ case "UI.ScrollableMessage":
+ {
+
+ if (SDL.SDLModel.onSDLScrolableMessage(request, request.id)) {
+ SDL.SDLController.onSystemContextChange();
+ }
+
+ break;
+ }
+ case "UI.ChangeRegistration":
+ {
+
+ if (request.params.appName) {
+ SDL.SDLController.getApplicationModel(request.params.appID).set('appName',
+ request.params.appName);
+ }
+
+ SDL.SDLModel.changeRegistrationUI(request.params.language,
+ request.params.appID,
+ request.params.appName);
+ this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+
+ break;
+ }
+ case "UI.SetDisplayLayout":
+ {
+
+ var senResponseFlag = false;
+
+ switch (request.params.displayLayout){
+ case "MEDIA": {
+ senResponseFlag = true;
+ break;
+ }
+ case "NON-MEDIA": {
+ senResponseFlag = true;
+ break;
+ }
+ case "DEFAULT": {
+ senResponseFlag = true;
+ break;
+ }
+ case "ONSCREEN_PRESETS": {
+ senResponseFlag = true;
+ break;
+ }
+ case "NAV_FULLSCREEN_MAP": {
+ senResponseFlag = true;
+ break;
+ }
+ case "NAV_KEYBOARD": {
+ senResponseFlag = true;
+ break;
+ }
+ case "NAV_LIST": {
+ senResponseFlag = true;
+ break;
+ }
+ }
+
+ if (senResponseFlag) {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "displayCapabilities": {
+ "displayType": "GEN2_8_DMA",
+ "textFields": [{
+ "name": "mainField1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField4",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "statusBar",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaClock",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaTrack",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "scrollableMessageBody",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "initialInteractionText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "ETA",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "totalDistance",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderHeader",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderFooter",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "notificationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuName",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "secondaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "tertiaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "timeToDestination",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "turnText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuTitle",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "locationName",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "locationDescription",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "addressLines",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "phoneNumber",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ }
+ ],
+ "imageFields": [
+ {
+ "name": "softButtonImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "choiceImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "choiceSecondaryImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "vrHelpItem",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "turnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "menuIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "cmdIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "graphic",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTNextTurnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTNextTurnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ }
+ ],
+ "mediaClockFormats": [
+ "CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4"
+ ],
+ "graphicSupported": true,
+ "imageCapabilities": ["DYNAMIC", "STATIC"],
+ "templatesAvailable": [request.params.displayLayout],
+ "screenParams": {
+ "resolution": {
+ "resolutionWidth": 800,
+ "resolutionHeight": 480
+ },
+ "touchEventAvailable": {
+ "pressAvailable": true,
+ "multiTouchAvailable": true,
+ "doublePressAvailable": false
+ }
+ },
+ "numCustomPresetsAvailable": 10
+ },
+ "buttonCapabilities": [
+ {
+ "name": "PRESET_0",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_1",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_2",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_3",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_4",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_5",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_6",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_7",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_8",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "PRESET_9",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "OK",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "SEEKLEFT",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "SEEKRIGHT",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "TUNEUP",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }, {
+ "name": "TUNEDOWN",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ }
+ ],
+ "softButtonCapabilities": [{
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true,
+ "imageSupported": true
+ }],
+ "presetBankCapabilities": {
+ "onScreenPresetsAvailable": true
+ },
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "UI.SetDisplayLayout"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ } else {
+ this.sendError(SDL.SDLModel.resultCode["UNSUPPORTED_RESOURCE"], request.id, request.method, "Unsupported display layout!")
+ }
+
+ break;
+ }
+ case "UI.SetAppIcon":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if (!("syncFileName" in request.params)) {
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.onSDLSetAppIcon(request.params, request.id, request.method);
+
+ break;
+ }
+ case "UI.PerformAudioPassThru":
+ {
+
+ if (this.performAudioPassThruRequestID > 0) {
+ this.sendError(
+ SDL.SDLModel.resultCode["REJECTED"],
+ request.id,
+ request.method,
+ 'PerformAudioPassThru request aborted!');
+ } else {
+
+ this.performAudioPassThruRequestID = request.id;
+ SDL.SDLModel.UIPerformAudioPassThru(request.params);
+
+ SDL.SDLController.onSystemContextChange();
+ }
+
+ break;
+ }
+ case "UI.EndAudioPassThru":
+ {
+
+ this.endAudioPassThruRequestID = request.id;
+
+ SDL.SDLModel.UIEndAudioPassThru();
+
+ break;
+ }
+ case "UI.GetSupportedLanguages":
+ {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "id": request.id,
+ "jsonrpc": "2.0",
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type
+ // (enum)
+ // from
+ // SDL
+ "method": "UI.GetSupportedLanguages",
+ "languages": SDL.SDLModel.sdlLanguagesList
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "UI.GetLanguage":
+ {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type
+ // (enum)
+ // from
+ // SDL
+ "method": "UI.GetLanguage",
+ "language": SDL.SDLModel.hmiUILanguage
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "UI.GetCapabilities":
+ {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "displayCapabilities": {
+ "displayType": "GEN2_8_DMA",
+ "textFields": [{
+ "name": "mainField1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField4",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "statusBar",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaClock",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaTrack",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "scrollableMessageBody",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "initialInteractionText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "ETA",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "totalDistance",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderHeader",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderFooter",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "notificationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuName",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "secondaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "tertiaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "timeToDestination",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "turnText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuTitle",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "locationName",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "locationDescription",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "addressLines",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "phoneNumber",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ }
+ ],
+ "imageFields": [
+ {
+ "name": "softButtonImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "choiceImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "choiceSecondaryImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "vrHelpItem",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "turnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "menuIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "cmdIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "graphic",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTNextTurnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ },
+ {
+ "name": "showConstantTBTNextTurnIcon",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_BMP",
+ "GRAPHIC_JPEG",
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth": 64,
+ "resolutionHeight": 64
+ }
+ }
+ ],
+ "mediaClockFormats": [
+ "CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4"
+ ],
+ "graphicSupported": true,
+ "imageCapabilities": ["DYNAMIC", "STATIC"],
+ "templatesAvailable": ["TEMPLATE"],
+ "screenParams": {
+ "resolution": {
+ "resolutionWidth": 800,
+ "resolutionHeight": 480
+ },
+ "touchEventAvailable": {
+ "pressAvailable": true,
+ "multiTouchAvailable": true,
+ "doublePressAvailable": false
+ }
+ },
+ "numCustomPresetsAvailable": 10
+ },
+ "audioPassThruCapabilities": {
+ "samplingRate": "44KHZ",
+ "bitsPerSample": "8_BIT",
+ "audioType": "PCM"
+ },
+ "hmiZoneCapabilities": "FRONT",
+ "softButtonCapabilities": {
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true,
+ "imageSupported": true
+ },
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "UI.GetCapabilities"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "UI.IsReady":
+ {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "available": this.get('isReady'),
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "UI.IsReady"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "UI.ClosePopUp":
+ {
+
+ SDL.SDLController.closePopUp(request.params.methodName);
+
+
+ Em.Logger.log("FFW." + request.method + "Response");
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "UI.ClosePopUp"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "UI.ShowVrHelp":
+ {
+
+ //SDL.SDLModel.ShowVrHelp(request.params);
+
+ this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);
+
+ break;
+ }
+ default:
+ {
+ // statements_def
+ break;
+ }
+ }
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function (resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode !== 0) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendUIResult: function (resultCode, id, method) {
+
+ if (this.errorResponsePull[id]) {
+
+ this.sendError(this.errorResponsePull[id].code, id, method,
+ "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed.");
+ this.errorResponsePull[id] = null;
+ return;
+ }
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ */
+ alertResponse: function (resultCode, id) {
+
+ Em.Logger.log("FFW.UI.AlertResponse");
+
+ switch (resultCode) {
+ case SDL.SDLModel.resultCode["SUCCESS"]: {
+
+ this.sendUIResult(resultCode, id, 'UI.Alert');
+
+ break;
+ }
+ case SDL.SDLModel.resultCode["ABORTED"]: {
+
+ this.sendError(resultCode, id, "UI.Alert", 'Alert request aborted.');
+ break;
+ }
+ case SDL.SDLModel.resultCode["REJECTED"]: {
+
+ this.sendError(resultCode, id, "UI.Alert", 'Another Alert is active.');
+ break;
+ }
+ }
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * sliderRequestID
+ * @param {Number}
+ * sliderPosition
+ */
+ sendSliderResult: function (resultCode, sliderRequestID, sliderPosition) {
+
+
+ Em.Logger.log("FFW.UI.SliderResponse");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ this.sendUIResult(resultCode, id, 'UI.Alert');
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": sliderRequestID,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": 'UI.Slider'
+ }
+ };
+
+ if (sliderPosition) {
+ JSONMessage.result.sliderPosition = sliderPosition;
+ }
+ } else {
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": sliderRequestID,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": 'Slider request ABORTED or TIMED OUT.',
+ "data": {
+ "method": 'UI.Slider'
+ }
+ }
+ };
+
+ if (sliderPosition) {
+ JSONMessage.error.data.sliderPosition = sliderPosition;
+ }
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notification method to send touch event data to SDLCore
+ *
+ * @param {Number} appID
+ * @param {String} methodName
+ */
+ onResetTimeout: function (appID, methodName) {
+
+ Em.Logger.log("FFW.UI.OnResetTimeout");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnResetTimeout",
+ "params": {
+ "methodName": methodName,
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send notification when command was triggered
+ *
+ * @param {Number}
+ * commandID
+ * @param {Number}
+ * appID
+ */
+ onCommand: function (commandID, appID) {
+
+ Em.Logger.log("FFW.UI.onCommand");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnCommand",
+ "params": {
+ "cmdID": commandID,
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notification method to send touch event data to SDLCore
+ *
+ * @param {String} type
+ * @param {Object} touchLists
+ * @param {Object} info
+ */
+ onTouchEvent: function (type, event) {
+
+ Em.Logger.log("FFW.UI.OnTouchEvent");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnTouchEvent",
+ "params": {
+ "type": type,
+ "event": event
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send notification when command was triggered
+ *
+ * @param {Number}
+ * softButtonID
+ * @param {Number}
+ * appID
+ */
+ onCommandSoftButton: function (softButtonID, appID) {
+
+ Em.Logger.log("FFW.UI.onCommand");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnCommand",
+ "params": {
+ "commandID": softButtonID,
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send notification when command was triggered
+ *
+ * @param {Number} requestID
+ * @param {Number} resultCode
+ * @param {Number} commandID
+ * @param {String} manualTextEntry
+ */
+ interactionResponse: function (requestID, resultCode, commandID, manualTextEntry) {
+
+ Em.Logger.log("FFW.UI.PerformInteractionResponse");
+
+ if (this.errorResponsePull[requestID]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "error": {
+ "code": this.errorResponsePull[requestID].code,
+ "message": "Unsupported " + this.errorResponsePull[requestID].type
+ + " type. Available data in request was processed.",
+ "data": {
+ "method": "UI.PerformInteraction"
+ }
+ }
+ };
+
+ if (commandID) {
+ JSONMessage.error.data.choiceID = commandID;
+ }
+
+ if (manualTextEntry != null) {
+ JSONMessage.error.data.manualTextEntry = manualTextEntry;
+ }
+
+ this.client.send(JSONMessage);
+ this.errorResponsePull[requestID] = null;
+ return;
+ }
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "result": {
+ "code": resultCode,
+ "method": "UI.PerformInteraction"
+ }
+ };
+
+ if (commandID) {
+ JSONMessage.result.choiceID = commandID;
+ }
+
+ if (manualTextEntry != null) {
+ JSONMessage.result.manualTextEntry = manualTextEntry;
+ }
+ } else {
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": "Perform Interaction error response.",
+ "data": {
+ "method": "UI.PerformInteraction"
+ }
+ }
+ };
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send notification when DriverDistraction PopUp is visible
+ *
+ * @param {String}
+ * driverDistractionState
+ */
+ onDriverDistraction: function (driverDistractionState) {
+
+ Em.Logger.log("FFW.UI.DriverDistraction");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnDriverDistraction",
+ "params": {
+ "state": driverDistractionState
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if system context is changed
+ *
+ * @param {String}
+ * systemContextValue
+ */
+ OnSystemContext: function (systemContextValue, appID) {
+
+ Em.Logger.log("FFW.UI.OnSystemContext");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnSystemContext",
+ "params": {
+ "systemContext": systemContextValue
+ }
+ };
+
+ if (appID) {
+ JSONMessage.params.appID = appID;
+ }
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if sdl UI components language was changed
+ *
+ * @param {String}
+ * lang
+ */
+ OnLanguageChange: function (lang) {
+
+ Em.Logger.log("FFW.UI.OnLanguageChange");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnLanguageChange",
+ "params": {
+ "language": lang
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Sends notification on SDL Core display keyboard value
+ *
+ * @param {String}
+ *
+ */
+ OnKeyboardInput: function (value, event) {
+
+ Em.Logger.log("FFW.UI.OnKeyboardInput");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "UI.OnKeyboardInput",
+ "params": {
+ "data": value,
+ "event": event
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+})
diff --git a/src/components/HMI/ffw/VRRPC.js b/src/components/HMI/ffw/VRRPC.js
new file mode 100644
index 0000000000..ce8188b6c0
--- /dev/null
+++ b/src/components/HMI/ffw/VRRPC.js
@@ -0,0 +1,520 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of VR component.
+ *
+ * Interface to get or set some essential information sent from SDLCore. VR is
+ * responsible for receiving voice commands choosed by user and sending
+ * notification of chosen commands to SDLCore.
+ *
+ */
+
+FFW.VR = FFW.RPCObserver.create( {
+
+ /**
+ * If true then VR is present and ready to communicate with SDL.
+ *
+ * @type {Boolean}
+ */
+ isReady: true,
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /*
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "VR"
+ }),
+
+ /*
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 500); // Magic number is unique identifier for
+ // component
+ },
+
+ /*
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /*
+ * Client is registered - we can send request starting from this point of
+ * time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.VR.onRPCRegistered");
+ this._super();
+ },
+
+ /*
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.VR.onRPCUnregistered");
+ this._super();
+ },
+
+ /*
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ },
+
+ /*
+ * when result is received from RPC component this function is called It is
+ * the propriate place to check results of reuqest execution Please use
+ * previously store reuqestID to determine to which request repsonse belongs
+ * to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.VR.onRPCResult");
+ this._super();
+ },
+
+ /*
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.VR.onRPCError");
+ this._super();
+ },
+
+ /*
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.VR.onRPCNotification");
+ this._super();
+ },
+
+ /*
+ * send notification when command was triggered
+ */
+ onCommand: function(element) {
+
+ Em.Logger.log("FFW.VR.onCommand");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.OnCommand",
+ "params": {
+ "commandID": element.commandID
+ }
+ };
+ this.client.send(JSONMessage);
+
+ SDL.VRPopUp.set('VRActive', false);
+ },
+
+ /*
+ * handle RPC requests here
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.VR.onRPCRequest");
+ if (this.validationCheck(request)) {
+
+ switch (request.method) {
+ case "VR.AddCommand": {
+
+ SDL.SDLModel.addCommandVR(request.params);
+
+ this.sendVRResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "VR.DeleteCommand": {
+
+ SDL.SDLModel.deleteCommandVR(request);
+
+ break;
+ }
+ case "VR.GetSupportedLanguages": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type
+ // (enum)
+ // from SDL
+ "method": "VR.GetSupportedLanguages",
+ "languages": SDL.SDLModel.sdlLanguagesList
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "VR.GetLanguage": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"], // type
+ // (enum)
+ // from SDL
+ "method": "VR.GetLanguage",
+ "language": SDL.SDLModel.hmiTTSVRLanguage
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "VR.ChangeRegistration": {
+
+ SDL.SDLModel.changeRegistrationTTSVR(request.params.language, request.params.appID);
+
+ if (request.params.vrSynonyms) {
+ SDL.VRPopUp.DeleteCommand(0, request.params.appID);
+ SDL.VRPopUp.AddCommand(0, request.params.vrSynonyms, request.params.appID, "Application");
+ }
+
+ this.sendVRResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ break;
+ }
+ case "VR.IsReady": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "available": this.get('isReady'),
+ "code": 0,
+ "method": "VR.IsReady"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+ case "VR.PerformInteraction":
+ {
+
+ // Werify if there is an ansupported data in request
+ if (this.errorResponsePull[request.id] != null) {
+
+ //Check if there is any available data to process the request
+ if ("helpPrompt" in request.params
+ || "initialPrompt" in request.params
+ || "timeoutPrompt" in request.params
+ || "grammarID" in request.params) {
+
+ this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
+ } else {
+ //If no available data sent error response and stop process current request
+
+ this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
+ "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
+ this.errorResponsePull[request.id] = null;
+
+ return;
+ }
+ }
+
+ SDL.SDLModel.vrPerformInteraction(request);
+
+ break;
+ }
+ case "VR.GetCapabilities": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "VR.GetCapabilities",
+ "vrCapabilities": ["TEXT"]
+ }
+ };
+ this.client.send(JSONMessage);
+
+ break;
+ }
+
+ default: {
+ // statements_def
+ break;
+ }
+ }
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * send notification when command was triggered
+ *
+ * @param {Number} requestID
+ * @param {Number} resultCode
+ * @param {Number} commandID
+ */
+ interactionResponse: function (requestID, resultCode, commandID) {
+
+ Em.Logger.log("FFW.VR.PerformInteractionResponse");
+
+ if (this.errorResponsePull[requestID]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "error": {
+ "code": this.errorResponsePull[requestID].code,
+ "message": "Unsupported " + this.errorResponsePull[requestID].type + " type. Available data in request was processed.",
+ "data": {
+ "method": "VR.PerformInteraction"
+ }
+ }
+ };
+
+ if (commandID) {
+ JSONMessage.error.data.choiceID = commandID;
+ }
+
+ this.client.send(JSONMessage);
+ this.errorResponsePull[requestID] = null;
+ return;
+ }
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "result": {
+ "code": resultCode,
+ "method": "VR.PerformInteraction"
+ }
+ };
+
+ if (commandID) {
+ JSONMessage.result.choiceID = commandID;
+ }
+ } else {
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": requestID,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": "Perform Interaction error response.",
+ "data": {
+ "method": "VR.PerformInteraction"
+ }
+ }
+ };
+ }
+
+ SDL.SDLModel.set('performInteractionSession', []);
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendVRResult: function(resultCode, id, method) {
+
+ if (this.errorResponsePull[id]) {
+
+ this.sendError(this.errorResponsePull[id].code, id, method,
+ "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed.");
+ this.errorResponsePull[id] = null;
+ return;
+ }
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /*
+ * send notification when command was triggered from VR
+ */
+ onChoise: function(commandID) {
+
+ Em.Logger.log("FFW.VR.PerformInteraction");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.OnChoise",
+ "params": {
+ "choiceID": commandID
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Initiated by VR module to let SDL know that VR session has started.
+ */
+ Started: function() {
+
+ Em.Logger.log("FFW.VR.Started");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.Started"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Initiated by VR module to let SDL know that VR session has stopped.
+ */
+ Stopped: function() {
+
+ Em.Logger.log("FFW.VR.Stopped");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.Stopped"
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * send notification when command was triggered
+ */
+ onCommand: function(commandID, appID) {
+
+ Em.Logger.log("FFW.VR.onCommand");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.OnCommand",
+ "params": {
+ "cmdID": commandID,
+ "appID": appID
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if sdl VR components language was changed
+ */
+ OnLanguageChange: function(lang) {
+
+ Em.Logger.log("FFW.VR.OnLanguageChange");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VR.OnLanguageChange",
+ "params": {
+ "language": lang
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/ffw/VehicleInfoRPC.js b/src/components/HMI/ffw/VehicleInfoRPC.js
new file mode 100644
index 0000000000..8ba6c7e2c7
--- /dev/null
+++ b/src/components/HMI/ffw/VehicleInfoRPC.js
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Reference implementation of VehicleInfo component.
+ *
+ * Interface to get or set some essential information sent from SDLCore.
+ * VehicleInfo is responsible for sending a data about the condition of the
+ * vehicle between SDLCore and CAN network. Instead CAN network used
+ * VehicleInfoModel.
+ *
+ */
+
+FFW.VehicleInfo = FFW.RPCObserver.create( {
+
+ /**
+ * If true then VehicleInfo is present and ready to communicate with SDL.
+ *
+ * @type {Boolean}
+ */
+ isReady: true,
+
+ /**
+ * Contains response codes for request that should be processed but there were some kind of errors
+ * Error codes will be injected into response.
+ */
+ errorResponsePull: {},
+
+ /**
+ * access to basic RPC functionality
+ */
+ client: FFW.RPCClient.create( {
+ componentName: "VehicleInfo"
+ }),
+
+ /**
+ * connect to RPC bus
+ */
+ connect: function() {
+
+ this.client.connect(this, 700); // Magic number is unique identifier for
+ // component
+ },
+
+ /**
+ * disconnect from RPC bus
+ */
+ disconnect: function() {
+
+ this.onRPCUnregistered();
+ this.client.disconnect();
+ },
+
+ /**
+ * Client is registered - we can send request starting from this point of
+ * time
+ */
+ onRPCRegistered: function() {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCRegistered");
+ this._super();
+ },
+
+ /**
+ * Client is unregistered - no more requests
+ */
+ onRPCUnregistered: function() {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCUnregistered");
+ this._super();
+ },
+
+ /**
+ * Client disconnected.
+ */
+ onRPCDisconnected: function() {
+
+ },
+
+ /**
+ * when result is received from RPC component this function is called It is
+ * the propriate place to check results of reuqest execution Please use
+ * previously store reuqestID to determine to which request repsonse belongs
+ * to
+ */
+ onRPCResult: function(response) {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCResult");
+ this._super();
+ },
+
+ /**
+ * handle RPC erros here
+ */
+ onRPCError: function(error) {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCError");
+ this._super();
+ },
+
+ /**
+ * handle RPC notifications here
+ */
+ onRPCNotification: function(notification) {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCNotification");
+ this._super();
+ },
+
+ /**
+ * handle RPC requests here
+ *
+ * @type {Object} request
+ */
+ onRPCRequest: function(request) {
+
+ Em.Logger.log("FFW.VehicleInfo.onRPCRequest");
+ if (this.validationCheck(request)) {
+
+ switch (request.method) {
+ case "VehicleInfo.GetVehicleData": {
+
+ SDL.SDLVehicleInfoModel.getVehicleData(request);
+
+ break;
+ }
+
+ case "VehicleInfo.ReadDID": {
+
+ SDL.SDLVehicleInfoModel.vehicleInfoReadDID(request.params,
+ request.id);
+
+ break;
+ }
+
+ case "VehicleInfo.GetDTCs": {
+
+ SDL.SDLVehicleInfoModel.vehicleInfoGetDTCs(request.params,
+ request.id);
+
+ break;
+ }
+
+ case "VehicleInfo.DiagnosticMessage": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "messageDataResult": [200],
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "VehicleInfo.DiagnosticMessage"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+
+ break;
+ }
+
+ case "VehicleInfo.SubscribeVehicleData": {
+
+ SDL.SDLVehicleInfoModel.SubscribeVehicleData(request);
+
+ break;
+ }
+
+ case "VehicleInfo.UnsubscribeVehicleData": {
+
+ SDL.SDLVehicleInfoModel.UnsubscribeVehicleData(request);
+
+ break;
+ }
+
+ case "VehicleInfo.GetVehicleType": {
+
+ SDL.SDLVehicleInfoModel.getVehicleType(request.id);
+
+ break;
+ }
+
+ case "VehicleInfo.IsReady": {
+
+ Em.Logger.log("FFW." + request.method + "Response");
+
+ // send response
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": request.id,
+ "result": {
+ "available": this.get('isReady'),
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "VehicleInfo.IsReady"
+ }
+ };
+
+ this.client.send(JSONMessage);
+
+ break;
+ }
+
+ default: {
+ // statements_def
+ break;
+ }
+ }
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendError: function(resultCode, id, method, message) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": {
+ "method": method
+ }
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Send response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendVIResult: function(resultCode, id, method) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": resultCode,
+ "method": method
+ }
+ };
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Send response from onRPCRequest
+ *
+ * @param {Number} resultCode
+ * @param {Number} id
+ * @param {String} method
+ * @param {Object} data
+ */
+ sendVISubscribeVehicleDataResult: function(resultCode, id, method, data) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": data
+ };
+
+ JSONMessage.result.code = resultCode;
+ JSONMessage.result.method = method;
+
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendGetVehicleDataError: function(resultCode, id, method, message, data) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ if (resultCode != SDL.SDLModel.resultCode["SUCCESS"]) {
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "error": {
+ "code": resultCode, // type (enum) from SDL protocol
+ "message": message,
+ "data": data
+ }
+ };
+
+ JSONMessage.error.data.method = method;
+ this.client.send(JSONMessage);
+ }
+ },
+
+ /**
+ * Send error response from onRPCRequest
+ *
+ * @param {Number}
+ * resultCode
+ * @param {Number}
+ * id
+ * @param {String}
+ * method
+ */
+ sendGetVehicleDataResut: function(resultCode, id, method, data) {
+
+ Em.Logger.log("FFW." + method + "Response");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": data
+ };
+ JSONMessage.result.code = resultCode;
+ JSONMessage.result.method = method;
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * Notifies if data was changed
+ *
+ * @type {Object} params
+ */
+ OnVehicleData: function(params) {
+
+ Em.Logger.log("FFW.VehicleInfo.OnVehicleData");
+
+ // send repsonse
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "method": "VehicleInfo.OnVehicleData",
+ "params": params
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * GetVehicleType Response
+ *
+ * @type {string} vehicleType
+ * @type {int} id
+ */
+ GetVehicleTypeResponse: function(vehicleType, id) {
+
+ Em.Logger.log("FFW.VehicleInfo.GetVehicleTypeResponse");
+
+ var JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": SDL.SDLModel.resultCode["SUCCESS"],
+ "method": "VehicleInfo.GetVehicleType",
+ "vehicleType": vehicleType
+ }
+ };
+
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * ReadDID Response
+ *
+ * @type {array} dataResult
+ * @type {array} data
+ * @type {string} info
+ * @type {string} result
+ * @type {int} id
+ */
+ vehicleInfoReadDIDResponse: function(didResult, resultCode, id) {
+
+ Em.Logger.log("FFW.VehicleInfo.ReadDIDResponse");
+
+ var JSONMessage;
+ // send repsonse
+ JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": SDL.SDLModel.resultCode[resultCode], // type (enum)
+ // from SDL
+ // protocol
+ "method": "VehicleInfo.ReadDID",
+ "didResult": didResult
+ }
+ };
+ this.client.send(JSONMessage);
+ },
+
+ /**
+ * GetDTCs Response
+ *
+ * @type {Number} ecuHeader
+ * @type {Array} dtc
+ * @type {String} result
+ * @type {Number} id
+ */
+ vehicleInfoGetDTCsResponse: function(ecuHeader, dtc, result, id) {
+
+ Em.Logger.log("FFW.VehicleInfo.GetDTCsResponse");
+
+ var JSONMessage;
+ // send repsonse
+ JSONMessage = {
+ "jsonrpc": "2.0",
+ "id": id,
+ "result": {
+ "code": SDL.SDLModel.resultCode[result], // type (enum) from
+ // SDL protocol
+ "method": "VehicleInfo.GetDTCs",
+ "ecuHeader": ecuHeader,
+ "dtc": dtc
+ }
+ };
+
+ this.client.send(JSONMessage);
+ }
+}) \ No newline at end of file
diff --git a/src/components/HMI/ffw/WebSocket.js b/src/components/HMI/ffw/WebSocket.js
new file mode 100644
index 0000000000..7b508b406a
--- /dev/null
+++ b/src/components/HMI/ffw/WebSocket.js
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * WebSocket interface mockup
+ *
+ * Android WebView and browser don't support WebSocket This class provides
+ * interface mockup to have seamless code for different platforms
+ * JavaScriptFacade is used instead of real WebSocket connection
+ *
+ */
+
+FFW.WebSocket = Em.Object.extend( {
+
+ readyState: 1,
+
+ /*
+ * add observer of messages from Android
+ */
+ init: function() {
+
+ FFW.WebSocketSimulator.addClient(this);
+ },
+
+ /*
+ * remove observer of Android messages on connection close
+ */
+ close: function() {
+
+ FFW.WebSocketSimulator.removeClient(this);
+ // simulate connection is closed
+ this.onclose(null);
+ },
+
+ /*
+ * send message to Android native code Java Script facade is used instead of
+ * real WebSocket connection
+ */
+ send: function(jsonMessage) {
+
+ FFW.WebSocketSimulator.send(this.clientName, jsonMessage);
+ },
+
+ // handlers for web socket events
+ onclose: null,
+ onerror: null,
+ onmessage: null,
+ onopen: null,
+
+ /*
+ * used for identification of sender and receiver of particular message
+ * from/to Android
+ */
+ clientName: ''
+});
diff --git a/src/components/HMI/images/common/arr-r-disable.png b/src/components/HMI/images/common/arr-r-disable.png
new file mode 100644
index 0000000000..acdfb56f92
--- /dev/null
+++ b/src/components/HMI/images/common/arr-r-disable.png
Binary files differ
diff --git a/src/components/HMI/images/common/arr-r.png b/src/components/HMI/images/common/arr-r.png
new file mode 100644
index 0000000000..05d8e97972
--- /dev/null
+++ b/src/components/HMI/images/common/arr-r.png
Binary files differ
diff --git a/src/components/HMI/images/common/arrow_ico.png b/src/components/HMI/images/common/arrow_ico.png
new file mode 100644
index 0000000000..97126966d7
--- /dev/null
+++ b/src/components/HMI/images/common/arrow_ico.png
Binary files differ
diff --git a/src/components/HMI/images/common/bt_bg.png b/src/components/HMI/images/common/bt_bg.png
new file mode 100644
index 0000000000..b69267e44b
--- /dev/null
+++ b/src/components/HMI/images/common/bt_bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/bt_bg_pressed.png b/src/components/HMI/images/common/bt_bg_pressed.png
new file mode 100644
index 0000000000..acd4acbac5
--- /dev/null
+++ b/src/components/HMI/images/common/bt_bg_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-28h-gray-active.png b/src/components/HMI/images/common/btn-28h-gray-active.png
new file mode 100644
index 0000000000..2b4b2ee0af
--- /dev/null
+++ b/src/components/HMI/images/common/btn-28h-gray-active.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-28h.png b/src/components/HMI/images/common/btn-28h.png
new file mode 100644
index 0000000000..034c061bec
--- /dev/null
+++ b/src/components/HMI/images/common/btn-28h.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-48h-active-gray.png b/src/components/HMI/images/common/btn-48h-active-gray.png
new file mode 100644
index 0000000000..3faeff3d7a
--- /dev/null
+++ b/src/components/HMI/images/common/btn-48h-active-gray.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-48h-active.png b/src/components/HMI/images/common/btn-48h-active.png
new file mode 100644
index 0000000000..9515a2172d
--- /dev/null
+++ b/src/components/HMI/images/common/btn-48h-active.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-48h-pressed.png b/src/components/HMI/images/common/btn-48h-pressed.png
new file mode 100644
index 0000000000..8f62dd0871
--- /dev/null
+++ b/src/components/HMI/images/common/btn-48h-pressed.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-48h.png b/src/components/HMI/images/common/btn-48h.png
new file mode 100644
index 0000000000..89fe73bf38
--- /dev/null
+++ b/src/components/HMI/images/common/btn-48h.png
Binary files differ
diff --git a/src/components/HMI/images/common/btn-98h.png b/src/components/HMI/images/common/btn-98h.png
new file mode 100644
index 0000000000..be25c0c45b
--- /dev/null
+++ b/src/components/HMI/images/common/btn-98h.png
Binary files differ
diff --git a/src/components/HMI/images/common/button.png b/src/components/HMI/images/common/button.png
new file mode 100644
index 0000000000..04144a6d6e
--- /dev/null
+++ b/src/components/HMI/images/common/button.png
Binary files differ
diff --git a/src/components/HMI/images/common/button_active_blue.png b/src/components/HMI/images/common/button_active_blue.png
new file mode 100644
index 0000000000..e8f6619039
--- /dev/null
+++ b/src/components/HMI/images/common/button_active_blue.png
Binary files differ
diff --git a/src/components/HMI/images/common/button_large.png b/src/components/HMI/images/common/button_large.png
new file mode 100644
index 0000000000..737f962622
--- /dev/null
+++ b/src/components/HMI/images/common/button_large.png
Binary files differ
diff --git a/src/components/HMI/images/common/button_small.png b/src/components/HMI/images/common/button_small.png
new file mode 100644
index 0000000000..3f8ec34483
--- /dev/null
+++ b/src/components/HMI/images/common/button_small.png
Binary files differ
diff --git a/src/components/HMI/images/common/center-button-150.png b/src/components/HMI/images/common/center-button-150.png
new file mode 100644
index 0000000000..a696c3ca65
--- /dev/null
+++ b/src/components/HMI/images/common/center-button-150.png
Binary files differ
diff --git a/src/components/HMI/images/common/center-button.png b/src/components/HMI/images/common/center-button.png
new file mode 100644
index 0000000000..fd407b735e
--- /dev/null
+++ b/src/components/HMI/images/common/center-button.png
Binary files differ
diff --git a/src/components/HMI/images/common/climate-status-bg.png b/src/components/HMI/images/common/climate-status-bg.png
new file mode 100644
index 0000000000..dbdddddd5e
--- /dev/null
+++ b/src/components/HMI/images/common/climate-status-bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/defaultButtonImage.png b/src/components/HMI/images/common/defaultButtonImage.png
new file mode 100644
index 0000000000..9474142fe0
--- /dev/null
+++ b/src/components/HMI/images/common/defaultButtonImage.png
Binary files differ
diff --git a/src/components/HMI/images/common/delim.png b/src/components/HMI/images/common/delim.png
new file mode 100644
index 0000000000..98e6516663
--- /dev/null
+++ b/src/components/HMI/images/common/delim.png
Binary files differ
diff --git a/src/components/HMI/images/common/divider.png b/src/components/HMI/images/common/divider.png
new file mode 100644
index 0000000000..c567e5ef21
--- /dev/null
+++ b/src/components/HMI/images/common/divider.png
Binary files differ
diff --git a/src/components/HMI/images/common/header_bg.png b/src/components/HMI/images/common/header_bg.png
new file mode 100644
index 0000000000..f2752149f0
--- /dev/null
+++ b/src/components/HMI/images/common/header_bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/ico_back.png b/src/components/HMI/images/common/ico_back.png
new file mode 100644
index 0000000000..f2cdf410e7
--- /dev/null
+++ b/src/components/HMI/images/common/ico_back.png
Binary files differ
diff --git a/src/components/HMI/images/common/ind_vert_active.png b/src/components/HMI/images/common/ind_vert_active.png
new file mode 100644
index 0000000000..526fc27467
--- /dev/null
+++ b/src/components/HMI/images/common/ind_vert_active.png
Binary files differ
diff --git a/src/components/HMI/images/common/ind_vert_def.png b/src/components/HMI/images/common/ind_vert_def.png
new file mode 100644
index 0000000000..594852cd13
--- /dev/null
+++ b/src/components/HMI/images/common/ind_vert_def.png
Binary files differ
diff --git a/src/components/HMI/images/common/ls_border.png b/src/components/HMI/images/common/ls_border.png
new file mode 100644
index 0000000000..d59d3afbb7
--- /dev/null
+++ b/src/components/HMI/images/common/ls_border.png
Binary files differ
diff --git a/src/components/HMI/images/common/media-status-bg.png b/src/components/HMI/images/common/media-status-bg.png
new file mode 100644
index 0000000000..b48786c048
--- /dev/null
+++ b/src/components/HMI/images/common/media-status-bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/minus-ico.png b/src/components/HMI/images/common/minus-ico.png
new file mode 100644
index 0000000000..a5fd7585a7
--- /dev/null
+++ b/src/components/HMI/images/common/minus-ico.png
Binary files differ
diff --git a/src/components/HMI/images/common/nav-status-bg.png b/src/components/HMI/images/common/nav-status-bg.png
new file mode 100644
index 0000000000..afe2168ca9
--- /dev/null
+++ b/src/components/HMI/images/common/nav-status-bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/okbut.png b/src/components/HMI/images/common/okbut.png
new file mode 100644
index 0000000000..7762204aa4
--- /dev/null
+++ b/src/components/HMI/images/common/okbut.png
Binary files differ
diff --git a/src/components/HMI/images/common/okbut_pressed.png b/src/components/HMI/images/common/okbut_pressed.png
new file mode 100644
index 0000000000..7f3262f2d9
--- /dev/null
+++ b/src/components/HMI/images/common/okbut_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/common/page-back-button.png b/src/components/HMI/images/common/page-back-button.png
new file mode 100644
index 0000000000..8cc6ad971b
--- /dev/null
+++ b/src/components/HMI/images/common/page-back-button.png
Binary files differ
diff --git a/src/components/HMI/images/common/phone-statusbar-bg.png b/src/components/HMI/images/common/phone-statusbar-bg.png
new file mode 100644
index 0000000000..1d63f4898f
--- /dev/null
+++ b/src/components/HMI/images/common/phone-statusbar-bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/plus-ico.png b/src/components/HMI/images/common/plus-ico.png
new file mode 100644
index 0000000000..3a3aa21815
--- /dev/null
+++ b/src/components/HMI/images/common/plus-ico.png
Binary files differ
diff --git a/src/components/HMI/images/common/scroll_down.png b/src/components/HMI/images/common/scroll_down.png
new file mode 100644
index 0000000000..d160605315
--- /dev/null
+++ b/src/components/HMI/images/common/scroll_down.png
Binary files differ
diff --git a/src/components/HMI/images/common/scroll_down_active.png b/src/components/HMI/images/common/scroll_down_active.png
new file mode 100644
index 0000000000..f609ecae65
--- /dev/null
+++ b/src/components/HMI/images/common/scroll_down_active.png
Binary files differ
diff --git a/src/components/HMI/images/common/scroll_down_inactive.png b/src/components/HMI/images/common/scroll_down_inactive.png
new file mode 100644
index 0000000000..418379f0b2
--- /dev/null
+++ b/src/components/HMI/images/common/scroll_down_inactive.png
Binary files differ
diff --git a/src/components/HMI/images/common/scroll_up.png b/src/components/HMI/images/common/scroll_up.png
new file mode 100644
index 0000000000..6ae4d68368
--- /dev/null
+++ b/src/components/HMI/images/common/scroll_up.png
Binary files differ
diff --git a/src/components/HMI/images/common/scroll_up_inactive.png b/src/components/HMI/images/common/scroll_up_inactive.png
new file mode 100644
index 0000000000..328ed7a3a0
--- /dev/null
+++ b/src/components/HMI/images/common/scroll_up_inactive.png
Binary files differ
diff --git a/src/components/HMI/images/common/seat-act-led.png b/src/components/HMI/images/common/seat-act-led.png
new file mode 100644
index 0000000000..7acb61359f
--- /dev/null
+++ b/src/components/HMI/images/common/seat-act-led.png
Binary files differ
diff --git a/src/components/HMI/images/common/seat-inact-led.png b/src/components/HMI/images/common/seat-inact-led.png
new file mode 100644
index 0000000000..40a57e2cc3
--- /dev/null
+++ b/src/components/HMI/images/common/seat-inact-led.png
Binary files differ
diff --git a/src/components/HMI/images/common/skipbuttonbg.png b/src/components/HMI/images/common/skipbuttonbg.png
new file mode 100644
index 0000000000..9e3b4e97a4
--- /dev/null
+++ b/src/components/HMI/images/common/skipbuttonbg.png
Binary files differ
diff --git a/src/components/HMI/images/common/skippbuttonbg_pressed.png b/src/components/HMI/images/common/skippbuttonbg_pressed.png
new file mode 100644
index 0000000000..27c2a52ced
--- /dev/null
+++ b/src/components/HMI/images/common/skippbuttonbg_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/common/system_settings_btn_bg.png b/src/components/HMI/images/common/system_settings_btn_bg.png
new file mode 100644
index 0000000000..ca8a268dda
--- /dev/null
+++ b/src/components/HMI/images/common/system_settings_btn_bg.png
Binary files differ
diff --git a/src/components/HMI/images/common/system_settings_btn_bg_active.png b/src/components/HMI/images/common/system_settings_btn_bg_active.png
new file mode 100644
index 0000000000..b53bd11e84
--- /dev/null
+++ b/src/components/HMI/images/common/system_settings_btn_bg_active.png
Binary files differ
diff --git a/src/components/HMI/images/common/system_settings_btn_h54.png b/src/components/HMI/images/common/system_settings_btn_h54.png
new file mode 100644
index 0000000000..1da6324507
--- /dev/null
+++ b/src/components/HMI/images/common/system_settings_btn_h54.png
Binary files differ
diff --git a/src/components/HMI/images/common/toggle.png b/src/components/HMI/images/common/toggle.png
new file mode 100644
index 0000000000..7162ad36bb
--- /dev/null
+++ b/src/components/HMI/images/common/toggle.png
Binary files differ
diff --git a/src/components/HMI/images/home/bottom_controlls_full.png b/src/components/HMI/images/home/bottom_controlls_full.png
new file mode 100644
index 0000000000..3fc22b56f1
--- /dev/null
+++ b/src/components/HMI/images/home/bottom_controlls_full.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/DownButton.png b/src/components/HMI/images/home/controlButtons/DownButton.png
new file mode 100644
index 0000000000..66e3cc5a7a
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/DownButton.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/DownButton_pressed.png b/src/components/HMI/images/home/controlButtons/DownButton_pressed.png
new file mode 100644
index 0000000000..b23b077802
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/DownButton_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/LeftButton.png b/src/components/HMI/images/home/controlButtons/LeftButton.png
new file mode 100644
index 0000000000..a33a09f942
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/LeftButton.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/LeftButton_pressed.png b/src/components/HMI/images/home/controlButtons/LeftButton_pressed.png
new file mode 100644
index 0000000000..fbc15a5847
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/LeftButton_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/OkButton.png b/src/components/HMI/images/home/controlButtons/OkButton.png
new file mode 100644
index 0000000000..809f719de6
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/OkButton.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/OkButton_pressed.png b/src/components/HMI/images/home/controlButtons/OkButton_pressed.png
new file mode 100644
index 0000000000..2902de6a34
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/OkButton_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/RightButton.png b/src/components/HMI/images/home/controlButtons/RightButton.png
new file mode 100644
index 0000000000..35da46f266
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/RightButton.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/RightButton_pressed.png b/src/components/HMI/images/home/controlButtons/RightButton_pressed.png
new file mode 100644
index 0000000000..3a3d247ffa
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/RightButton_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/UpButton.png b/src/components/HMI/images/home/controlButtons/UpButton.png
new file mode 100644
index 0000000000..58407ce9ed
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/UpButton.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/UpButton_pressed.png b/src/components/HMI/images/home/controlButtons/UpButton_pressed.png
new file mode 100644
index 0000000000..7b853cb2a5
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/UpButton_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/backGroundControllButtons.png b/src/components/HMI/images/home/controlButtons/backGroundControllButtons.png
new file mode 100644
index 0000000000..041d49e7e9
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/backGroundControllButtons.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/vr.png b/src/components/HMI/images/home/controlButtons/vr.png
new file mode 100644
index 0000000000..af09282dff
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/vr.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/vrImage.png b/src/components/HMI/images/home/controlButtons/vrImage.png
new file mode 100644
index 0000000000..2f6bac2d9f
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/vrImage.png
Binary files differ
diff --git a/src/components/HMI/images/home/controlButtons/vr_pressed.png b/src/components/HMI/images/home/controlButtons/vr_pressed.png
new file mode 100644
index 0000000000..9206e42a95
--- /dev/null
+++ b/src/components/HMI/images/home/controlButtons/vr_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/home/home_main_image.png b/src/components/HMI/images/home/home_main_image.png
new file mode 100644
index 0000000000..e1b830fbea
--- /dev/null
+++ b/src/components/HMI/images/home/home_main_image.png
Binary files differ
diff --git a/src/components/HMI/images/home/home_phone.png b/src/components/HMI/images/home/home_phone.png
new file mode 100644
index 0000000000..dfdd0a577c
--- /dev/null
+++ b/src/components/HMI/images/home/home_phone.png
Binary files differ
diff --git a/src/components/HMI/images/info/callendar-btn.png b/src/components/HMI/images/info/callendar-btn.png
new file mode 100644
index 0000000000..c193f0f21c
--- /dev/null
+++ b/src/components/HMI/images/info/callendar-btn.png
Binary files differ
diff --git a/src/components/HMI/images/info/ico_assist.png b/src/components/HMI/images/info/ico_assist.png
new file mode 100644
index 0000000000..1abb26dc1c
--- /dev/null
+++ b/src/components/HMI/images/info/ico_assist.png
Binary files differ
diff --git a/src/components/HMI/images/info/ico_info_install.png b/src/components/HMI/images/info/ico_info_install.png
new file mode 100644
index 0000000000..5c9d93ad28
--- /dev/null
+++ b/src/components/HMI/images/info/ico_info_install.png
Binary files differ
diff --git a/src/components/HMI/images/info/ico_vehicle.png b/src/components/HMI/images/info/ico_vehicle.png
new file mode 100644
index 0000000000..c4ca30f96c
--- /dev/null
+++ b/src/components/HMI/images/info/ico_vehicle.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_leftMenu_apps_ico.png b/src/components/HMI/images/info/info_leftMenu_apps_ico.png
new file mode 100644
index 0000000000..7f648c9a01
--- /dev/null
+++ b/src/components/HMI/images/info/info_leftMenu_apps_ico.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_leftMenu_calendar_ico.png b/src/components/HMI/images/info/info_leftMenu_calendar_ico.png
new file mode 100644
index 0000000000..6fb5aec3e0
--- /dev/null
+++ b/src/components/HMI/images/info/info_leftMenu_calendar_ico.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_leftMenu_services_ico.png b/src/components/HMI/images/info/info_leftMenu_services_ico.png
new file mode 100644
index 0000000000..de36255aa8
--- /dev/null
+++ b/src/components/HMI/images/info/info_leftMenu_services_ico.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_leftMenu_travelLink_ico.png b/src/components/HMI/images/info/info_leftMenu_travelLink_ico.png
new file mode 100644
index 0000000000..4235c92d07
--- /dev/null
+++ b/src/components/HMI/images/info/info_leftMenu_travelLink_ico.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_services_bg.png b/src/components/HMI/images/info/info_services_bg.png
new file mode 100644
index 0000000000..ef082c739e
--- /dev/null
+++ b/src/components/HMI/images/info/info_services_bg.png
Binary files differ
diff --git a/src/components/HMI/images/info/info_travelLink_sirius_logo.png b/src/components/HMI/images/info/info_travelLink_sirius_logo.png
new file mode 100644
index 0000000000..0eb328c9c7
--- /dev/null
+++ b/src/components/HMI/images/info/info_travelLink_sirius_logo.png
Binary files differ
diff --git a/src/components/HMI/images/info/menu_active.png b/src/components/HMI/images/info/menu_active.png
new file mode 100644
index 0000000000..b4cf7277a4
--- /dev/null
+++ b/src/components/HMI/images/info/menu_active.png
Binary files differ
diff --git a/src/components/HMI/images/info/view_info_calendar.png b/src/components/HMI/images/info/view_info_calendar.png
new file mode 100644
index 0000000000..9e09ae9d62
--- /dev/null
+++ b/src/components/HMI/images/info/view_info_calendar.png
Binary files differ
diff --git a/src/components/HMI/images/list/list_item_bg.png b/src/components/HMI/images/list/list_item_bg.png
new file mode 100644
index 0000000000..f5cdcbe343
--- /dev/null
+++ b/src/components/HMI/images/list/list_item_bg.png
Binary files differ
diff --git a/src/components/HMI/images/list/list_item_pressed.png b/src/components/HMI/images/list/list_item_pressed.png
new file mode 100644
index 0000000000..593d697a0e
--- /dev/null
+++ b/src/components/HMI/images/list/list_item_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/list/scrollbar/button-down-active.png b/src/components/HMI/images/list/scrollbar/button-down-active.png
new file mode 100644
index 0000000000..bcd52150b6
--- /dev/null
+++ b/src/components/HMI/images/list/scrollbar/button-down-active.png
Binary files differ
diff --git a/src/components/HMI/images/list/scrollbar/button-up-active.png b/src/components/HMI/images/list/scrollbar/button-up-active.png
new file mode 100644
index 0000000000..5d1bb3f079
--- /dev/null
+++ b/src/components/HMI/images/list/scrollbar/button-up-active.png
Binary files differ
diff --git a/src/components/HMI/images/media/bcs-item_bgL.png b/src/components/HMI/images/media/bcs-item_bgL.png
new file mode 100644
index 0000000000..cbb8dc44b6
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgL.png
Binary files differ
diff --git a/src/components/HMI/images/media/bcs-item_bgL_pressed.png b/src/components/HMI/images/media/bcs-item_bgL_pressed.png
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgL_pressed.png
diff --git a/src/components/HMI/images/media/bcs-item_bgR.png b/src/components/HMI/images/media/bcs-item_bgR.png
new file mode 100644
index 0000000000..e9aef90896
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgR.png
Binary files differ
diff --git a/src/components/HMI/images/media/bcs-item_bgR_pressed.png b/src/components/HMI/images/media/bcs-item_bgR_pressed.png
new file mode 100644
index 0000000000..d7c3f961cb
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgR_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/media/bcs-item_bgS.png b/src/components/HMI/images/media/bcs-item_bgS.png
new file mode 100644
index 0000000000..54d70b7f08
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgS.png
Binary files differ
diff --git a/src/components/HMI/images/media/bcs-item_bgS_pressed.png b/src/components/HMI/images/media/bcs-item_bgS_pressed.png
new file mode 100644
index 0000000000..8c1563af9b
--- /dev/null
+++ b/src/components/HMI/images/media/bcs-item_bgS_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/media/bg.png b/src/components/HMI/images/media/bg.png
new file mode 100644
index 0000000000..b0c24355f6
--- /dev/null
+++ b/src/components/HMI/images/media/bg.png
Binary files differ
diff --git a/src/components/HMI/images/media/btn_bg.png b/src/components/HMI/images/media/btn_bg.png
new file mode 100644
index 0000000000..9713aab1e9
--- /dev/null
+++ b/src/components/HMI/images/media/btn_bg.png
Binary files differ
diff --git a/src/components/HMI/images/media/cd-next-btn.png b/src/components/HMI/images/media/cd-next-btn.png
new file mode 100644
index 0000000000..1973292d42
--- /dev/null
+++ b/src/components/HMI/images/media/cd-next-btn.png
Binary files differ
diff --git a/src/components/HMI/images/media/cd-next-btn_pressed.png b/src/components/HMI/images/media/cd-next-btn_pressed.png
new file mode 100644
index 0000000000..8cb1391b8a
--- /dev/null
+++ b/src/components/HMI/images/media/cd-next-btn_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/media/cd-prev-btn.png b/src/components/HMI/images/media/cd-prev-btn.png
new file mode 100644
index 0000000000..8bdd67d8f5
--- /dev/null
+++ b/src/components/HMI/images/media/cd-prev-btn.png
Binary files differ
diff --git a/src/components/HMI/images/media/cd-prev-btn_pressed.png b/src/components/HMI/images/media/cd-prev-btn_pressed.png
new file mode 100644
index 0000000000..3dbdbb9c8e
--- /dev/null
+++ b/src/components/HMI/images/media/cd-prev-btn_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/media/cd_play_btn.png b/src/components/HMI/images/media/cd_play_btn.png
new file mode 100644
index 0000000000..d183119f29
--- /dev/null
+++ b/src/components/HMI/images/media/cd_play_btn.png
Binary files differ
diff --git a/src/components/HMI/images/media/divider_o.png b/src/components/HMI/images/media/divider_o.png
new file mode 100644
index 0000000000..38cb6bc8e3
--- /dev/null
+++ b/src/components/HMI/images/media/divider_o.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico-play.png b/src/components/HMI/images/media/ico-play.png
new file mode 100644
index 0000000000..5e746174c7
--- /dev/null
+++ b/src/components/HMI/images/media/ico-play.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_arrow_down.png b/src/components/HMI/images/media/ico_arrow_down.png
new file mode 100644
index 0000000000..609e4a16c5
--- /dev/null
+++ b/src/components/HMI/images/media/ico_arrow_down.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_arrow_up.png b/src/components/HMI/images/media/ico_arrow_up.png
new file mode 100644
index 0000000000..09b9610f2f
--- /dev/null
+++ b/src/components/HMI/images/media/ico_arrow_up.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_back.png b/src/components/HMI/images/media/ico_back.png
new file mode 100644
index 0000000000..f2cdf410e7
--- /dev/null
+++ b/src/components/HMI/images/media/ico_back.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_cd.png b/src/components/HMI/images/media/ico_cd.png
new file mode 100644
index 0000000000..b482408f2d
--- /dev/null
+++ b/src/components/HMI/images/media/ico_cd.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_next.png b/src/components/HMI/images/media/ico_next.png
new file mode 100644
index 0000000000..24c19d2bfe
--- /dev/null
+++ b/src/components/HMI/images/media/ico_next.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_pause.png b/src/components/HMI/images/media/ico_pause.png
new file mode 100644
index 0000000000..d885c12039
--- /dev/null
+++ b/src/components/HMI/images/media/ico_pause.png
Binary files differ
diff --git a/src/components/HMI/images/media/ico_prew.png b/src/components/HMI/images/media/ico_prew.png
new file mode 100644
index 0000000000..a079f6705b
--- /dev/null
+++ b/src/components/HMI/images/media/ico_prew.png
Binary files differ
diff --git a/src/components/HMI/images/media/ls-item_bg.png b/src/components/HMI/images/media/ls-item_bg.png
new file mode 100644
index 0000000000..3863e15c76
--- /dev/null
+++ b/src/components/HMI/images/media/ls-item_bg.png
Binary files differ
diff --git a/src/components/HMI/images/media/ls-item_bg_act.png b/src/components/HMI/images/media/ls-item_bg_act.png
new file mode 100644
index 0000000000..7b52318a4c
--- /dev/null
+++ b/src/components/HMI/images/media/ls-item_bg_act.png
Binary files differ
diff --git a/src/components/HMI/images/media/player_view.png b/src/components/HMI/images/media/player_view.png
new file mode 100644
index 0000000000..fec0f31939
--- /dev/null
+++ b/src/components/HMI/images/media/player_view.png
Binary files differ
diff --git a/src/components/HMI/images/phone/bg.png b/src/components/HMI/images/phone/bg.png
new file mode 100644
index 0000000000..ffcf3e6675
--- /dev/null
+++ b/src/components/HMI/images/phone/bg.png
Binary files differ
diff --git a/src/components/HMI/images/phone/del.png b/src/components/HMI/images/phone/del.png
new file mode 100644
index 0000000000..714b1edb62
--- /dev/null
+++ b/src/components/HMI/images/phone/del.png
Binary files differ
diff --git a/src/components/HMI/images/phone/dial.png b/src/components/HMI/images/phone/dial.png
new file mode 100644
index 0000000000..56b95bfdbf
--- /dev/null
+++ b/src/components/HMI/images/phone/dial.png
Binary files differ
diff --git a/src/components/HMI/images/phone/end.png b/src/components/HMI/images/phone/end.png
new file mode 100644
index 0000000000..2d622bcc70
--- /dev/null
+++ b/src/components/HMI/images/phone/end.png
Binary files differ
diff --git a/src/components/HMI/images/phone/ico_phone.png b/src/components/HMI/images/phone/ico_phone.png
new file mode 100644
index 0000000000..68bcf408db
--- /dev/null
+++ b/src/components/HMI/images/phone/ico_phone.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/center_btn.png b/src/components/HMI/images/phone/keypad/center_btn.png
new file mode 100644
index 0000000000..9661ecd18d
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/center_btn.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/center_btn_pressed.png b/src/components/HMI/images/phone/keypad/center_btn_pressed.png
new file mode 100644
index 0000000000..42ac69bb29
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/center_btn_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/left_btn.png b/src/components/HMI/images/phone/keypad/left_btn.png
new file mode 100644
index 0000000000..d043b42555
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/left_btn.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/left_btn_pressed.png b/src/components/HMI/images/phone/keypad/left_btn_pressed.png
new file mode 100644
index 0000000000..287c1eabad
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/left_btn_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/right_btn.png b/src/components/HMI/images/phone/keypad/right_btn.png
new file mode 100644
index 0000000000..30f7ec9a95
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/right_btn.png
Binary files differ
diff --git a/src/components/HMI/images/phone/keypad/right_btn_pressed.png b/src/components/HMI/images/phone/keypad/right_btn_pressed.png
new file mode 100644
index 0000000000..9f67dd0012
--- /dev/null
+++ b/src/components/HMI/images/phone/keypad/right_btn_pressed.png
Binary files differ
diff --git a/src/components/HMI/images/phone/menu_active.png b/src/components/HMI/images/phone/menu_active.png
new file mode 100644
index 0000000000..776e857b50
--- /dev/null
+++ b/src/components/HMI/images/phone/menu_active.png
Binary files differ
diff --git a/src/components/HMI/images/phone/menu_bg.png b/src/components/HMI/images/phone/menu_bg.png
new file mode 100644
index 0000000000..7de8abeb7f
--- /dev/null
+++ b/src/components/HMI/images/phone/menu_bg.png
Binary files differ
diff --git a/src/components/HMI/images/sdl/Warning.png b/src/components/HMI/images/sdl/Warning.png
new file mode 100644
index 0000000000..c91cd31d34
--- /dev/null
+++ b/src/components/HMI/images/sdl/Warning.png
Binary files differ
diff --git a/src/components/HMI/images/sdl/audio_icon.jpg b/src/components/HMI/images/sdl/audio_icon.jpg
new file mode 100644
index 0000000000..22efcfa9df
--- /dev/null
+++ b/src/components/HMI/images/sdl/audio_icon.jpg
Binary files differ
diff --git a/src/components/HMI/images/sdl/devices.png b/src/components/HMI/images/sdl/devices.png
new file mode 100644
index 0000000000..91979c58ed
--- /dev/null
+++ b/src/components/HMI/images/sdl/devices.png
Binary files differ
diff --git a/src/components/HMI/images/sdl/new_apps.png b/src/components/HMI/images/sdl/new_apps.png
new file mode 100644
index 0000000000..85a75c2639
--- /dev/null
+++ b/src/components/HMI/images/sdl/new_apps.png
Binary files differ
diff --git a/src/components/HMI/images/sdl/progress.gif b/src/components/HMI/images/sdl/progress.gif
new file mode 100644
index 0000000000..37690fa5b7
--- /dev/null
+++ b/src/components/HMI/images/sdl/progress.gif
Binary files differ
diff --git a/src/components/HMI/images/sdl/progressindicator.gif b/src/components/HMI/images/sdl/progressindicator.gif
new file mode 100644
index 0000000000..77d358cae6
--- /dev/null
+++ b/src/components/HMI/images/sdl/progressindicator.gif
Binary files differ
diff --git a/src/components/HMI/images/settings/ico_settings.png b/src/components/HMI/images/settings/ico_settings.png
new file mode 100644
index 0000000000..d65777ee01
--- /dev/null
+++ b/src/components/HMI/images/settings/ico_settings.png
Binary files differ
diff --git a/src/components/HMI/index.html b/src/components/HMI/index.html
new file mode 100644
index 0000000000..d73412d439
--- /dev/null
+++ b/src/components/HMI/index.html
@@ -0,0 +1,189 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" ontouchmove="event.preventDefault();"><html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Ford Smart Device HMI</title>
+ <!--Styles-->
+ <link rel="stylesheet" type="text/css" href="css/buttonControls.css" />
+ <link rel="stylesheet" type="text/css" href="css/general.css" />
+ <link rel="stylesheet" type="text/css" href="css/navigation.css" />
+ <link rel="stylesheet" type="text/css" href="css/phone.css" />
+ <link rel="stylesheet" type="text/css" href="css/info.css" />
+ <link rel="stylesheet" type="text/css" href="css/settings.css" />
+ <link rel="stylesheet" type="text/css" href="css/media.css" />
+ <link rel="stylesheet" type="text/css" href="css/sdl.css" />
+
+ <!--Libs-->
+
+ <script type="text/javascript" src="lib/handlebars-1.0.0.beta.6.js"></script>
+
+ <!-- RELEASE's min versions -->
+
+ <script type="text/javascript" src="lib/jquery-1.7.2.min.js"></script>
+ <script type="text/javascript" src="lib/ember-1.0.pre.min.js"></script>
+ <script type="text/javascript" src="lib/iscroll-lite.js"></script>
+
+
+ </head>
+ <body ontouchmove="event.preventDefault();">
+
+
+ <script type="text/javascript" src="app/Flags.js"></script>
+
+ <!-- Framework -->
+ <script type="text/javascript" src="ffw/Framework.js"></script>
+ <script type="text/javascript" src="ffw/WebSocket.js"></script>
+ <script type="text/javascript" src="ffw/RPCObserver.js"></script>
+ <script type="text/javascript" src="ffw/RPCClient.js"></script>
+ <script type="text/javascript" src="ffw/ButtonsRPC.js"></script>
+ <script type="text/javascript" src="ffw/UIRPC.js"></script>
+ <script type="text/javascript" src="ffw/NavigationRPC.js"></script>
+ <script type="text/javascript" src="ffw/TTSRPC.js"></script>
+ <script type="text/javascript" src="ffw/VRRPC.js"></script>
+ <script type="text/javascript" src="ffw/VehicleInfoRPC.js"></script>
+ <script type="text/javascript" src="ffw/BasicCommunicationRPC.js"></script>
+
+ <!-- APP -->
+ <script type="text/javascript" src="app/SDLApp.js"></script>
+ <!-- locales -->
+ <script type="text/javascript" src="locale/eng.js"></script>
+ <script type="text/javascript" src="locale/locale.js"></script>
+ <script type="text/javascript" src="app/view/WarningView.js"></script>
+
+ <script type="text/x-handlebars">
+ {{view SDL.warningView}}
+ </script>
+
+ <!-- UI controlls -->
+ <script type="text/javascript" src="app/controlls/Button.js"></script>
+ <script type="text/javascript" src="app/controlls/Label.js"></script>
+ <script type="text/javascript" src="app/controlls/ScrollBar.js"></script>
+ <script type="text/javascript" src="app/controlls/List.js"></script>
+ <script type="text/javascript" src="app/controlls/Indicator.js"></script>
+ <script type="text/javascript" src="app/controlls/QWERTYLayout.js"></script>
+ <script type="text/javascript" src="app/controlls/QWERTZLayout.js"></script>
+ <script type="text/javascript" src="app/controlls/AZERTYLayout.js"></script>
+ <script type="text/javascript" src="app/controlls/MenuList.js"></script>
+ <script type="text/javascript" src="app/controlls/ScrollableText.js"></script>
+
+ <!-- utils -->
+ <script type="text/javascript" src="app/util/Audio.js"></script>
+ <script type="text/javascript" src="app/util/StreamAudio.js"></script>
+
+ <!-- Models -->
+
+ <script type="text/javascript" src="app/model/media/CDModel.js"></script>
+
+ <script type="text/javascript" src="app/model/PhoneModel.js"></script>
+
+ <!-- SDL models -->
+ <script type="text/javascript" src="app/model/sdl/VehicleInfoModel.js"></script>
+ <script type="text/javascript" src="app/model/sdl/AppModel.js"></script>
+ <script type="text/javascript" src="app/model/sdl/NonMediaModel.js"></script>
+ <script type="text/javascript" src="app/model/sdl/MediaModel.js"></script>
+ <script type="text/javascript" src="app/model/sdl/Model.js"></script>
+ <!-- SDL models END -->
+
+ <!-- Controllers -->
+ <!--script type="text/javascript" src="app/controller/AppController.js"></script-->
+ <script type="text/javascript" src="app/controller/MediaController.js"></script>
+ <script type="text/javascript" src="app/controller/PhoneController.js"></script>
+ <script type="text/javascript" src="app/controller/InfoController.js"></script>
+ <script type="text/javascript" src="app/controller/SettingsController.js"></script>
+
+ <script type="text/javascript" src="app/controller/sdl/Controller.js"></script>
+ <script type="text/javascript" src="app/controller/sdl/RPCController.js"></script>
+ <script type="text/javascript" src="app/controller/sdl/AppController.js"></script>
+ <script type="text/javascript" src="app/controller/sdl/NonMediaController.js"></script>
+ <script type="text/javascript" src="app/controller/sdl/MediaController.js"></script>
+
+ <!-- Mixins -->
+ <script type="text/javascript" src="app/mixins/PresetEvents.js"></script>
+ <script type="text/javascript" src="app/mixins/PresetEventCustom.js"></script>
+
+ <!-- Views -->
+
+ <!-- phone views -->
+ <script type="text/javascript" src="app/view/phone/dialpadView.js"></script>
+
+ <!-- media views -->
+ <script type="text/javascript" src="app/view/media/sdl/controllsView.js"></script>
+ <script type="text/javascript" src="app/view/media/common/LeftMenuView.js"></script>
+ <script type="text/javascript" src="app/view/media/playerView.js"></script>
+ <script type="text/javascript" src="app/view/media/sdlmediaView.js"></script>
+
+ <!-- info views -->
+ <script type="text/javascript" src="app/view/info/servicesView.js"></script>
+ <script type="text/javascript" src="app/view/info/travelLinkView.js"></script>
+ <script type="text/javascript" src="app/view/info/calendarView.js"></script>
+ <script type="text/javascript" src="app/view/info/appsView.js"></script>
+ <script type="text/javascript" src="app/view/info/devicelistView.js"></script>
+ <script type="text/javascript" src="app/view/info/nonMediaView.js"></script>
+
+ <!-- settings views -->
+
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsListView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/appPermissionsView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/deviceConfigView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/deviceStateChangeView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/statisticsInfoView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policies/systemErrorView.js"></script>
+ <script type="text/javascript" src="app/view/settings/policiesView.js"></script>
+
+ <script type="text/javascript" src="app/view/homeView.js"></script>
+ <script type="text/javascript" src="app/view/mediaView.js"></script>
+ <script type="text/javascript" src="app/view/infoView.js"></script>
+ <script type="text/javascript" src="app/view/climateView.js"></script>
+ <script type="text/javascript" src="app/view/phoneView.js"></script>
+ <script type="text/javascript" src="app/view/navigationView.js"></script>
+ <script type="text/javascript" src="app/view/settingsView.js"></script>
+ <script type="text/javascript" src="app/view/navigationApp/baseNavigationView.js"></script>
+ <script type="text/javascript" src="app/view/navigationAppView.js"></script>
+
+ <!-- home views -->
+ <script type="text/javascript" src="app/view/home/controlButtons.js"></script>
+
+ <script type="text/javascript" src="app/view/home/topControls.js"></script>
+ <script type="text/javascript" src="app/view/home/bottomControls.js"></script>
+ <script type="text/javascript" src="app/view/home/statusMediaView.js"></script>
+ <script type="text/javascript" src="app/view/home/statusPhoneView.js"></script>
+ <script type="text/javascript" src="app/view/home/statusInfoView.js"></script>
+ <script type="text/javascript" src="app/view/home/statusNavigationView.js"></script>
+ <script type="text/javascript" src="app/view/home/statusClimateView.js"></script>
+ <!-- SDL views -->
+ <script type="text/javascript" src="app/view/sdl/shared/AbstractView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/interactionChoicesView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/sliderView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/optionsView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/scrollableMessage.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/turnByTurnView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/tbtTurnList.js"></script>
+ <script type="text/javascript" src="app/view/sdl/shared/keyboard.js"></script>
+ <script type="text/javascript" src="app/view/sdl/TTSPopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/AlertPopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/PopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/AlertManeuverPopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/AudioPassThruPopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/VRPopUp.js"></script>
+ <script type="text/javascript" src="app/view/sdl/VehicleInfoView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/VRHelpListView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/tbtClientStateView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/driverDistraction.js"></script>
+ <script type="text/javascript" src="app/view/sdl/ExitAppView.js"></script>
+ <script type="text/javascript" src="app/view/sdl/SystemRequestView.js"></script>
+
+
+
+ <script type="text/javascript" src="app/StateManager.js"></script>
+
+ <!-- STATE MACHINE -->
+ <script type="text/javascript" src="app/AppViews.js"></script>
+
+
+ <!-- Big Images Preloader block -->
+ <div id="preloader">
+ </div>
+
+
+ </body>
+</html> \ No newline at end of file
diff --git a/src/components/HMI/lib/ember-1.0.pre.js b/src/components/HMI/lib/ember-1.0.pre.js
new file mode 100644
index 0000000000..dc2cb84479
--- /dev/null
+++ b/src/components/HMI/lib/ember-1.0.pre.js
@@ -0,0 +1,20709 @@
+// Version: v1.0.pre
+// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
+
+
+(function() {
+/*global __fail__*/
+
+if ('undefined' === typeof Ember) {
+ Ember = {};
+
+ if ('undefined' !== typeof window) {
+ window.Em = window.Ember = Em = Ember;
+ }
+}
+
+Ember.ENV = 'undefined' === typeof ENV ? {} : ENV;
+
+if (!('MANDATORY_SETTER' in Ember.ENV)) {
+ Ember.ENV.MANDATORY_SETTER = true; // default to true for debug dist
+}
+
+/**
+ Define an assertion that will throw an exception if the condition is not
+ met. Ember build tools will remove any calls to Ember.assert() when
+ doing a production build. Example:
+
+ // Test for truthiness
+ Ember.assert('Must pass a valid object', obj);
+ // Fail unconditionally
+ Ember.assert('This code path should never be run')
+
+ @static
+ @function
+ @param {String} desc
+ A description of the assertion. This will become the text of the Error
+ thrown if the assertion fails.
+
+ @param {Boolean} test
+ Must be truthy for the assertion to pass. If falsy, an exception will be
+ thrown.
+*/
+Ember.assert = function(desc, test) {
+ if (!test) throw new Error("assertion failed: "+desc);
+};
+
+
+/**
+ Display a warning with the provided message. Ember build tools will
+ remove any calls to Ember.warn() when doing a production build.
+
+ @static
+ @function
+ @param {String} message
+ A warning to display.
+
+ @param {Boolean} test
+ An optional boolean. If falsy, the warning will be displayed.
+*/
+Ember.warn = function(message, test) {
+ if (!test) {
+ Ember.Logger.warn("WARNING: "+message);
+ if ('trace' in Ember.Logger) Ember.Logger.trace();
+ }
+};
+
+/**
+ Display a deprecation warning with the provided message and a stack trace
+ (Chrome and Firefox only). Ember build tools will remove any calls to
+ Ember.deprecate() when doing a production build.
+
+ @static
+ @function
+ @param {String} message
+ A description of the deprecation.
+
+ @param {Boolean} test
+ An optional boolean. If falsy, the deprecation will be displayed.
+*/
+Ember.deprecate = function(message, test) {
+ if (Ember && Ember.TESTING_DEPRECATION) { return; }
+
+ if (arguments.length === 1) { test = false; }
+ if (test) { return; }
+
+ if (Ember && Ember.ENV.RAISE_ON_DEPRECATION) { throw new Error(message); }
+
+ var error;
+
+ // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
+ try { __fail__.fail(); } catch (e) { error = e; }
+
+ if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
+ var stack, stackStr = '';
+ if (error['arguments']) {
+ // Chrome
+ stack = error.stack.replace(/^\s+at\s+/gm, '').
+ replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').
+ replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
+ stack.shift();
+ } else {
+ // Firefox
+ stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').
+ replace(/^\(/gm, '{anonymous}(').split('\n');
+ }
+
+ stackStr = "\n " + stack.slice(2).join("\n ");
+ message = message + stackStr;
+ }
+
+ Ember.Logger.warn("DEPRECATION: "+message);
+};
+
+
+
+/**
+ Display a deprecation warning with the provided message and a stack trace
+ (Chrome and Firefox only) when the wrapped method is called.
+
+ Ember build tools will not remove calls to Ember.deprecateFunc(), though
+ no warnings will be shown in production.
+
+ @static
+ @function
+ @param {String} message
+ A description of the deprecation.
+
+ @param {Function} func
+ The function to be deprecated.
+*/
+Ember.deprecateFunc = function(message, func) {
+ return function() {
+ Ember.deprecate(message);
+ return func.apply(this, arguments);
+ };
+};
+
+
+window.ember_assert = Ember.deprecateFunc("ember_assert is deprecated. Please use Ember.assert instead.", Ember.assert);
+window.ember_warn = Ember.deprecateFunc("ember_warn is deprecated. Please use Ember.warn instead.", Ember.warn);
+window.ember_deprecate = Ember.deprecateFunc("ember_deprecate is deprecated. Please use Ember.deprecate instead.", Ember.deprecate);
+window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprecated. Please use Ember.deprecateFunc instead.", Ember.deprecateFunc);
+
+})();
+
+// Version: v1.0.pre
+// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Em:true ENV */
+
+if ('undefined' === typeof Ember) {
+ // Create core object. Make it act like an instance of Ember.Namespace so that
+ // objects assigned to it are given a sane string representation.
+ Ember = {};
+}
+
+/**
+ @namespace
+ @name Ember
+ @version 1.0.pre
+
+ All Ember methods and functions are defined inside of this namespace.
+ You generally should not add new properties to this namespace as it may be
+ overwritten by future versions of Ember.
+
+ You can also use the shorthand "Em" instead of "Ember".
+
+ Ember-Runtime is a framework that provides core functions for
+ Ember including cross-platform functions, support for property
+ observing and objects. Its focus is on small size and performance. You can
+ use this in place of or along-side other cross-platform libraries such as
+ jQuery.
+
+ The core Runtime framework is based on the jQuery API with a number of
+ performance optimizations.
+*/
+
+// aliases needed to keep minifiers from removing the global context
+if ('undefined' !== typeof window) {
+ window.Em = window.Ember = Em = Ember;
+}
+
+// Make sure these are set whether Ember was already defined or not
+
+Ember.isNamespace = true;
+
+Ember.toString = function() { return "Ember"; };
+
+
+/**
+ @static
+ @type String
+ @default '1.0.pre'
+ @constant
+*/
+Ember.VERSION = '1.0.pre';
+
+/**
+ @static
+ @type Hash
+ @constant
+
+ Standard environmental variables. You can define these in a global `ENV`
+ variable before loading Ember to control various configuration
+ settings.
+*/
+Ember.ENV = Ember.ENV || ('undefined' === typeof ENV ? {} : ENV);
+
+Ember.config = Ember.config || {};
+
+// ..........................................................
+// BOOTSTRAP
+//
+
+/**
+ @static
+ @type Boolean
+ @default true
+ @constant
+
+ Determines whether Ember should enhances some built-in object
+ prototypes to provide a more friendly API. If enabled, a few methods
+ will be added to Function, String, and Array. Object.prototype will not be
+ enhanced, which is the one that causes most troubles for people.
+
+ In general we recommend leaving this option set to true since it rarely
+ conflicts with other code. If you need to turn it off however, you can
+ define an ENV.EXTEND_PROTOTYPES config to disable it.
+*/
+Ember.EXTEND_PROTOTYPES = (Ember.ENV.EXTEND_PROTOTYPES !== false);
+
+/**
+ @static
+ @type Boolean
+ @default true
+ @constant
+
+ Determines whether Ember logs a full stack trace during deprecation warnings
+*/
+Ember.LOG_STACKTRACE_ON_DEPRECATION = (Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION !== false);
+
+/**
+ @static
+ @type Boolean
+ @default Ember.EXTEND_PROTOTYPES
+ @constant
+
+ Determines whether Ember should add ECMAScript 5 shims to older browsers.
+*/
+Ember.SHIM_ES5 = (Ember.ENV.SHIM_ES5 === false) ? false : Ember.EXTEND_PROTOTYPES;
+
+
+/**
+ @static
+ @type Boolean
+ @default true
+ @constant
+
+ Determines whether computed properties are cacheable by default.
+ This option will be removed for the 1.1 release.
+
+ When caching is enabled by default, you can use `volatile()` to disable
+ caching on individual computed properties.
+*/
+Ember.CP_DEFAULT_CACHEABLE = (Ember.ENV.CP_DEFAULT_CACHEABLE !== false);
+
+/**
+ @static
+ @type Boolean
+ @default true
+ @constant
+
+ Determines whether views render their templates using themselves
+ as the context, or whether it is inherited from the parent. This option
+ will be removed in the 1.1 release.
+
+ If you need to update your application to use the new context rules, simply
+ prefix property access with `view.`:
+
+ // Before:
+ {{#each App.photosController}}
+ Photo Title: {{title}}
+ {{#view App.InfoView contentBinding="this"}}
+ {{content.date}}
+ {{content.cameraType}}
+ {{otherViewProperty}}
+ {{/view}}
+ {{/each}}
+
+ // After:
+ {{#each App.photosController}}
+ Photo Title: {{title}}
+ {{#view App.InfoView}}
+ {{date}}
+ {{cameraType}}
+ {{view.otherViewProperty}}
+ {{/view}}
+ {{/each}}
+*/
+Ember.VIEW_PRESERVES_CONTEXT = (Ember.ENV.VIEW_PRESERVES_CONTEXT !== false);
+
+/**
+ Empty function. Useful for some operations.
+
+ @returns {Object}
+ @private
+*/
+Ember.K = function() { return this; };
+
+/**
+ @namespace
+ @name window
+ @description The global window object
+*/
+
+
+// Stub out the methods defined by the ember-debug package in case it's not loaded
+
+if ('undefined' === typeof Ember.assert) { Ember.assert = Ember.K; }
+if ('undefined' === typeof Ember.warn) { Ember.warn = Ember.K; }
+if ('undefined' === typeof Ember.deprecate) { Ember.deprecate = Ember.K; }
+if ('undefined' === typeof Ember.deprecateFunc) {
+ Ember.deprecateFunc = function(_, func) { return func; };
+}
+
+// These are deprecated but still supported
+
+if ('undefined' === typeof ember_assert) { window.ember_assert = Ember.K; }
+if ('undefined' === typeof ember_warn) { window.ember_warn = Ember.K; }
+if ('undefined' === typeof ember_deprecate) { window.ember_deprecate = Ember.K; }
+if ('undefined' === typeof ember_deprecateFunc) {
+ /** @private */
+ window.ember_deprecateFunc = function(_, func) { return func; };
+}
+
+
+// ..........................................................
+// LOGGER
+//
+
+/**
+ @class
+
+ Inside Ember-Metal, simply uses the window.console object.
+ Override this to provide more robust logging functionality.
+*/
+Ember.Logger = window.console || { log: Ember.K, warn: Ember.K, error: Ember.K, info: Ember.K, debug: Ember.K };
+
+})();
+
+
+
+(function() {
+/*jshint newcap:false*/
+
+// NOTE: There is a bug in jshint that doesn't recognize `Object()` without `new`
+// as being ok unless both `newcap:false` and not `use strict`.
+// https://github.com/jshint/jshint/issues/392
+
+// Testing this is not ideal, but we want to use native functions
+// if available, but not to use versions created by libraries like Prototype
+/** @private */
+var isNativeFunc = function(func) {
+ // This should probably work in all browsers likely to have ES5 array methods
+ return func && Function.prototype.toString.call(func).indexOf('[native code]') > -1;
+};
+
+// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/map
+/** @private */
+var arrayMap = isNativeFunc(Array.prototype.map) ? Array.prototype.map : function(fun /*, thisp */) {
+ //"use strict";
+
+ if (this === void 0 || this === null) {
+ throw new TypeError();
+ }
+
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun !== "function") {
+ throw new TypeError();
+ }
+
+ var res = new Array(len);
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in t) {
+ res[i] = fun.call(thisp, t[i], i, t);
+ }
+ }
+
+ return res;
+};
+
+// From: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
+/** @private */
+var arrayForEach = isNativeFunc(Array.prototype.forEach) ? Array.prototype.forEach : function(fun /*, thisp */) {
+ //"use strict";
+
+ if (this === void 0 || this === null) {
+ throw new TypeError();
+ }
+
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun !== "function") {
+ throw new TypeError();
+ }
+
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in t) {
+ fun.call(thisp, t[i], i, t);
+ }
+ }
+};
+
+/** @private */
+var arrayIndexOf = isNativeFunc(Array.prototype.indexOf) ? Array.prototype.indexOf : function (obj, fromIndex) {
+ if (fromIndex === null || fromIndex === undefined) { fromIndex = 0; }
+ else if (fromIndex < 0) { fromIndex = Math.max(0, this.length + fromIndex); }
+ for (var i = fromIndex, j = this.length; i < j; i++) {
+ if (this[i] === obj) { return i; }
+ }
+ return -1;
+};
+
+Ember.ArrayPolyfills = {
+ map: arrayMap,
+ forEach: arrayForEach,
+ indexOf: arrayIndexOf
+};
+
+var utils = Ember.EnumerableUtils = {
+ map: function(obj, callback, thisArg) {
+ return obj.map ? obj.map.call(obj, callback, thisArg) : arrayMap.call(obj, callback, thisArg);
+ },
+
+ forEach: function(obj, callback, thisArg) {
+ return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : arrayForEach.call(obj, callback, thisArg);
+ },
+
+ indexOf: function(obj, element, index) {
+ return obj.indexOf ? obj.indexOf.call(obj, element, index) : arrayIndexOf.call(obj, element, index);
+ },
+
+ indexesOf: function(obj, elements) {
+ return elements === undefined ? [] : utils.map(elements, function(item) {
+ return utils.indexOf(obj, item);
+ });
+ },
+
+ removeObject: function(array, item) {
+ var index = utils.indexOf(array, item);
+ if (index !== -1) { array.splice(index, 1); }
+ }
+};
+
+
+if (Ember.SHIM_ES5) {
+ if (!Array.prototype.map) {
+ /** @private */
+ Array.prototype.map = arrayMap;
+ }
+
+ if (!Array.prototype.forEach) {
+ /** @private */
+ Array.prototype.forEach = arrayForEach;
+ }
+
+ if (!Array.prototype.indexOf) {
+ /** @private */
+ Array.prototype.indexOf = arrayIndexOf;
+ }
+}
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Node */
+/**
+ @class
+
+ Platform specific methods and feature detectors needed by the framework.
+
+ @name Ember.platform
+*/
+var platform = Ember.platform = {};
+
+/**
+ Identical to Object.create(). Implements if not available natively.
+ @memberOf Ember.platform
+ @name create
+*/
+Ember.create = Object.create;
+
+if (!Ember.create) {
+ /** @private */
+ var K = function() {};
+
+ Ember.create = function(obj, props) {
+ K.prototype = obj;
+ obj = new K();
+ if (props) {
+ K.prototype = obj;
+ for (var prop in props) {
+ K.prototype[prop] = props[prop].value;
+ }
+ obj = new K();
+ }
+ K.prototype = null;
+
+ return obj;
+ };
+
+ Ember.create.isSimulated = true;
+}
+
+/** @private */
+var defineProperty = Object.defineProperty;
+var canRedefineProperties, canDefinePropertyOnDOM;
+
+// Catch IE8 where Object.defineProperty exists but only works on DOM elements
+if (defineProperty) {
+ try {
+ defineProperty({}, 'a',{get:function(){}});
+ } catch (e) {
+ /** @private */
+ defineProperty = null;
+ }
+}
+
+if (defineProperty) {
+ // Detects a bug in Android <3.2 where you cannot redefine a property using
+ // Object.defineProperty once accessors have already been set.
+ /** @private */
+ canRedefineProperties = (function() {
+ var obj = {};
+
+ defineProperty(obj, 'a', {
+ configurable: true,
+ enumerable: true,
+ get: function() { },
+ set: function() { }
+ });
+
+ defineProperty(obj, 'a', {
+ configurable: true,
+ enumerable: true,
+ writable: true,
+ value: true
+ });
+
+ return obj.a === true;
+ })();
+
+ // This is for Safari 5.0, which supports Object.defineProperty, but not
+ // on DOM nodes.
+ /** @private */
+ canDefinePropertyOnDOM = (function(){
+ try {
+ defineProperty(document.createElement('div'), 'definePropertyOnDOM', {});
+ return true;
+ } catch(e) { }
+
+ return false;
+ })();
+
+ if (!canRedefineProperties) {
+ /** @private */
+ defineProperty = null;
+ } else if (!canDefinePropertyOnDOM) {
+ /** @private */
+ defineProperty = function(obj, keyName, desc){
+ var isNode;
+
+ if (typeof Node === "object") {
+ isNode = obj instanceof Node;
+ } else {
+ isNode = typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string";
+ }
+
+ if (isNode) {
+ // TODO: Should we have a warning here?
+ return (obj[keyName] = desc.value);
+ } else {
+ return Object.defineProperty(obj, keyName, desc);
+ }
+ };
+ }
+}
+
+/**
+ Identical to Object.defineProperty(). Implements as much functionality
+ as possible if not available natively.
+
+ @memberOf Ember.platform
+ @name defineProperty
+ @param {Object} obj The object to modify
+ @param {String} keyName property name to modify
+ @param {Object} desc descriptor hash
+ @returns {void}
+*/
+platform.defineProperty = defineProperty;
+
+/**
+ Set to true if the platform supports native getters and setters.
+
+ @memberOf Ember.platform
+ @name hasPropertyAccessors
+*/
+platform.hasPropertyAccessors = true;
+
+if (!platform.defineProperty) {
+ platform.hasPropertyAccessors = false;
+
+ platform.defineProperty = function(obj, keyName, desc) {
+ if (!desc.get) { obj[keyName] = desc.value; }
+ };
+
+ platform.defineProperty.isSimulated = true;
+}
+
+if (Ember.ENV.MANDATORY_SETTER && !platform.hasPropertyAccessors) {
+ Ember.ENV.MANDATORY_SETTER = false;
+}
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var o_defineProperty = Ember.platform.defineProperty,
+ o_create = Ember.create,
+ // Used for guid generation...
+ GUID_KEY = '__ember'+ (+ new Date()),
+ uuid = 0,
+ numberCache = [],
+ stringCache = {};
+
+var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
+
+/**
+ @private
+ @static
+ @type String
+ @constant
+
+ A unique key used to assign guids and other private metadata to objects.
+ If you inspect an object in your browser debugger you will often see these.
+ They can be safely ignored.
+
+ On browsers that support it, these properties are added with enumeration
+ disabled so they won't show up when you iterate over your properties.
+*/
+Ember.GUID_KEY = GUID_KEY;
+
+var GUID_DESC = {
+ writable: false,
+ configurable: false,
+ enumerable: false,
+ value: null
+};
+
+/**
+ @private
+
+ Generates a new guid, optionally saving the guid to the object that you
+ pass in. You will rarely need to use this method. Instead you should
+ call Ember.guidFor(obj), which return an existing guid if available.
+
+ @param {Object} obj
+ Optional object the guid will be used for. If passed in, the guid will
+ be saved on the object and reused whenever you pass the same object
+ again.
+
+ If no object is passed, just generate a new guid.
+
+ @param {String} prefix
+ Optional prefix to place in front of the guid. Useful when you want to
+ separate the guid into separate namespaces.
+
+ @returns {String} the guid
+*/
+Ember.generateGuid = function generateGuid(obj, prefix) {
+ if (!prefix) prefix = 'ember';
+ var ret = (prefix + (uuid++));
+ if (obj) {
+ GUID_DESC.value = ret;
+ o_defineProperty(obj, GUID_KEY, GUID_DESC);
+ }
+ return ret ;
+};
+
+/**
+ @private
+
+ Returns a unique id for the object. If the object does not yet have
+ a guid, one will be assigned to it. You can call this on any object,
+ Ember.Object-based or not, but be aware that it will add a _guid property.
+
+ You can also use this method on DOM Element objects.
+
+ @method
+ @param obj {Object} any object, string, number, Element, or primitive
+ @returns {String} the unique guid for this instance.
+*/
+Ember.guidFor = function guidFor(obj) {
+
+ // special cases where we don't want to add a key to object
+ if (obj === undefined) return "(undefined)";
+ if (obj === null) return "(null)";
+
+ var cache, ret;
+ var type = typeof obj;
+
+ // Don't allow prototype changes to String etc. to change the guidFor
+ switch(type) {
+ case 'number':
+ ret = numberCache[obj];
+ if (!ret) ret = numberCache[obj] = 'nu'+obj;
+ return ret;
+
+ case 'string':
+ ret = stringCache[obj];
+ if (!ret) ret = stringCache[obj] = 'st'+(uuid++);
+ return ret;
+
+ case 'boolean':
+ return obj ? '(true)' : '(false)';
+
+ default:
+ if (obj[GUID_KEY]) return obj[GUID_KEY];
+ if (obj === Object) return '(Object)';
+ if (obj === Array) return '(Array)';
+ ret = 'ember'+(uuid++);
+ GUID_DESC.value = ret;
+ o_defineProperty(obj, GUID_KEY, GUID_DESC);
+ return ret;
+ }
+};
+
+// ..........................................................
+// META
+//
+
+var META_DESC = {
+ writable: true,
+ configurable: false,
+ enumerable: false,
+ value: null
+};
+
+var META_KEY = Ember.GUID_KEY+'_meta';
+
+/**
+ The key used to store meta information on object for property observing.
+
+ @static
+ @type String
+*/
+Ember.META_KEY = META_KEY;
+
+// Placeholder for non-writable metas.
+var EMPTY_META = {
+ descs: {},
+ watching: {}
+};
+
+if (MANDATORY_SETTER) { EMPTY_META.values = {}; }
+
+Ember.EMPTY_META = EMPTY_META;
+
+if (Object.freeze) Object.freeze(EMPTY_META);
+
+var isDefinePropertySimulated = Ember.platform.defineProperty.isSimulated;
+
+function Meta(obj) {
+ this.descs = {};
+ this.watching = {};
+ this.cache = {};
+ this.source = obj;
+}
+
+if (isDefinePropertySimulated) {
+ // on platforms that don't support enumerable false
+ // make meta fail jQuery.isPlainObject() to hide from
+ // jQuery.extend() by having a property that fails
+ // hasOwnProperty check.
+ Meta.prototype.__preventPlainObject__ = true;
+}
+
+/**
+ @private
+ @function
+
+ Retrieves the meta hash for an object. If 'writable' is true ensures the
+ hash is writable for this object as well.
+
+ The meta object contains information about computed property descriptors as
+ well as any watched properties and other information. You generally will
+ not access this information directly but instead work with higher level
+ methods that manipulate this hash indirectly.
+
+ @param {Object} obj
+ The object to retrieve meta for
+
+ @param {Boolean} writable
+ Pass false if you do not intend to modify the meta hash, allowing the
+ method to avoid making an unnecessary copy.
+
+ @returns {Hash}
+*/
+Ember.meta = function meta(obj, writable) {
+
+ var ret = obj[META_KEY];
+ if (writable===false) return ret || EMPTY_META;
+
+ if (!ret) {
+ if (!isDefinePropertySimulated) o_defineProperty(obj, META_KEY, META_DESC);
+
+ ret = new Meta(obj);
+
+ if (MANDATORY_SETTER) { ret.values = {}; }
+
+ obj[META_KEY] = ret;
+
+ // make sure we don't accidentally try to create constructor like desc
+ ret.descs.constructor = null;
+
+ } else if (ret.source !== obj) {
+ if (!isDefinePropertySimulated) o_defineProperty(obj, META_KEY, META_DESC);
+
+ ret = o_create(ret);
+ ret.descs = o_create(ret.descs);
+ ret.watching = o_create(ret.watching);
+ ret.cache = {};
+ ret.source = obj;
+
+ if (MANDATORY_SETTER) { ret.values = o_create(ret.values); }
+
+ obj[META_KEY] = ret;
+ }
+ return ret;
+};
+
+Ember.getMeta = function getMeta(obj, property) {
+ var meta = Ember.meta(obj, false);
+ return meta[property];
+};
+
+Ember.setMeta = function setMeta(obj, property, value) {
+ var meta = Ember.meta(obj, true);
+ meta[property] = value;
+ return value;
+};
+
+/**
+ @private
+
+ In order to store defaults for a class, a prototype may need to create
+ a default meta object, which will be inherited by any objects instantiated
+ from the class's constructor.
+
+ However, the properties of that meta object are only shallow-cloned,
+ so if a property is a hash (like the event system's `listeners` hash),
+ it will by default be shared across all instances of that class.
+
+ This method allows extensions to deeply clone a series of nested hashes or
+ other complex objects. For instance, the event system might pass
+ ['listeners', 'foo:change', 'ember157'] to `prepareMetaPath`, which will
+ walk down the keys provided.
+
+ For each key, if the key does not exist, it is created. If it already
+ exists and it was inherited from its constructor, the constructor's
+ key is cloned.
+
+ You can also pass false for `writable`, which will simply return
+ undefined if `prepareMetaPath` discovers any part of the path that
+ shared or undefined.
+
+ @param {Object} obj The object whose meta we are examining
+ @param {Array} path An array of keys to walk down
+ @param {Boolean} writable whether or not to create a new meta
+ (or meta property) if one does not already exist or if it's
+ shared with its constructor
+*/
+Ember.metaPath = function metaPath(obj, path, writable) {
+ var meta = Ember.meta(obj, writable), keyName, value;
+
+ for (var i=0, l=path.length; i<l; i++) {
+ keyName = path[i];
+ value = meta[keyName];
+
+ if (!value) {
+ if (!writable) { return undefined; }
+ value = meta[keyName] = { __ember_source__: obj };
+ } else if (value.__ember_source__ !== obj) {
+ if (!writable) { return undefined; }
+ value = meta[keyName] = o_create(value);
+ value.__ember_source__ = obj;
+ }
+
+ meta = value;
+ }
+
+ return value;
+};
+
+/**
+ @private
+
+ Wraps the passed function so that `this._super` will point to the superFunc
+ when the function is invoked. This is the primitive we use to implement
+ calls to super.
+
+ @param {Function} func
+ The function to call
+
+ @param {Function} superFunc
+ The super function.
+
+ @returns {Function} wrapped function.
+*/
+Ember.wrap = function(func, superFunc) {
+
+ function K() {}
+
+ var newFunc = function() {
+ var ret, sup = this._super;
+ this._super = superFunc || K;
+ ret = func.apply(this, arguments);
+ this._super = sup;
+ return ret;
+ };
+
+ newFunc.base = func;
+ return newFunc;
+};
+
+/**
+ Returns true if the passed object is an array or Array-like.
+
+ Ember Array Protocol:
+
+ - the object has an objectAt property
+ - the object is a native Array
+ - the object is an Object, and has a length property
+
+ Unlike Ember.typeOf this method returns true even if the passed object is
+ not formally array but appears to be array-like (i.e. implements Ember.Array)
+
+ Ember.isArray(); // false
+ Ember.isArray([]); // true
+ Ember.isArray( Ember.ArrayProxy.create({ content: [] }) ); // true
+
+ @param {Object} obj The object to test
+ @returns {Boolean}
+*/
+Ember.isArray = function(obj) {
+ if (!obj || obj.setInterval) { return false; }
+ if (Array.isArray && Array.isArray(obj)) { return true; }
+ if (Ember.Array && Ember.Array.detect(obj)) { return true; }
+ if ((obj.length !== undefined) && 'object'===typeof obj) { return true; }
+ return false;
+};
+
+/**
+ Forces the passed object to be part of an array. If the object is already
+ an array or array-like, returns the object. Otherwise adds the object to
+ an array. If obj is null or undefined, returns an empty array.
+
+ Ember.makeArray(); => []
+ Ember.makeArray(null); => []
+ Ember.makeArray(undefined); => []
+ Ember.makeArray('lindsay'); => ['lindsay']
+ Ember.makeArray([1,2,42]); => [1,2,42]
+
+ var controller = Ember.ArrayProxy.create({ content: [] });
+ Ember.makeArray(controller) === controller; => true
+
+ @param {Object} obj the object
+ @returns {Array}
+*/
+Ember.makeArray = function(obj) {
+ if (obj === null || obj === undefined) { return []; }
+ return Ember.isArray(obj) ? obj : [obj];
+};
+
+function canInvoke(obj, methodName) {
+ return !!(obj && typeof obj[methodName] === 'function');
+}
+
+/**
+ Checks to see if the `methodName` exists on the `obj`.
+
+ @function
+
+ @param {Object} obj The object to check for the method
+ @param {String} methodName The method name to check for
+*/
+Ember.canInvoke = canInvoke;
+
+/**
+ Checks to see if the `methodName` exists on the `obj`,
+ and if it does, invokes it with the arguments passed.
+
+ @function
+
+ @param {Object} obj The object to check for the method
+ @param {String} methodName The method name to check for
+ @param {Array} args The arguments to pass to the method
+
+ @returns {Boolean} true if the method does not return false
+ @returns {Boolean} false otherwise
+*/
+Ember.tryInvoke = function(obj, methodName, args) {
+ if (canInvoke(obj, methodName)) {
+ return obj[methodName].apply(obj, args);
+ }
+};
+
+})();
+
+
+
+(function() {
+/**
+ JavaScript (before ES6) does not have a Map implementation. Objects,
+ which are often used as dictionaries, may only have Strings as keys.
+
+ Because Ember has a way to get a unique identifier for every object
+ via `Ember.guidFor`, we can implement a performant Map with arbitrary
+ keys. Because it is commonly used in low-level bookkeeping, Map is
+ implemented as a pure JavaScript object for performance.
+
+ This implementation follows the current iteration of the ES6 proposal
+ for maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),
+ with two exceptions. First, because we need our implementation to be
+ pleasant on older browsers, we do not use the `delete` name (using
+ `remove` instead). Second, as we do not have the luxury of in-VM
+ iteration, we implement a forEach method for iteration.
+
+ Map is mocked out to look like an Ember object, so you can do
+ `Ember.Map.create()` for symmetry with other Ember classes.
+*/
+/** @private */
+var guidFor = Ember.guidFor,
+ indexOf = Ember.ArrayPolyfills.indexOf;
+
+var copy = function(obj) {
+ var output = {};
+
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) { output[prop] = obj[prop]; }
+ }
+
+ return output;
+};
+
+var copyMap = function(original, newObject) {
+ var keys = original.keys.copy(),
+ values = copy(original.values);
+
+ newObject.keys = keys;
+ newObject.values = values;
+
+ return newObject;
+};
+
+// This class is used internally by Ember.js and Ember Data.
+// Please do not use it at this time. We plan to clean it up
+// and add many tests soon.
+var OrderedSet = Ember.OrderedSet = function() {
+ this.clear();
+};
+
+OrderedSet.create = function() {
+ return new OrderedSet();
+};
+
+OrderedSet.prototype = {
+ clear: function() {
+ this.presenceSet = {};
+ this.list = [];
+ },
+
+ add: function(obj) {
+ var guid = guidFor(obj),
+ presenceSet = this.presenceSet,
+ list = this.list;
+
+ if (guid in presenceSet) { return; }
+
+ presenceSet[guid] = true;
+ list.push(obj);
+ },
+
+ remove: function(obj) {
+ var guid = guidFor(obj),
+ presenceSet = this.presenceSet,
+ list = this.list;
+
+ delete presenceSet[guid];
+
+ var index = indexOf.call(list, obj);
+ if (index > -1) {
+ list.splice(index, 1);
+ }
+ },
+
+ isEmpty: function() {
+ return this.list.length === 0;
+ },
+
+ forEach: function(fn, self) {
+ // allow mutation during iteration
+ var list = this.list.slice();
+
+ for (var i = 0, j = list.length; i < j; i++) {
+ fn.call(self, list[i]);
+ }
+ },
+
+ toArray: function() {
+ return this.list.slice();
+ },
+
+ copy: function() {
+ var set = new OrderedSet();
+
+ set.presenceSet = copy(this.presenceSet);
+ set.list = this.list.slice();
+
+ return set;
+ }
+};
+
+/**
+ A Map stores values indexed by keys. Unlike JavaScript's
+ default Objects, the keys of a Map can be any JavaScript
+ object.
+
+ Internally, a Map has two data structures:
+
+ `keys`: an OrderedSet of all of the existing keys
+ `values`: a JavaScript Object indexed by the
+ Ember.guidFor(key)
+
+ When a key/value pair is added for the first time, we
+ add the key to the `keys` OrderedSet, and create or
+ replace an entry in `values`. When an entry is deleted,
+ we delete its entry in `keys` and `values`.
+*/
+
+/** @private */
+var Map = Ember.Map = function() {
+ this.keys = Ember.OrderedSet.create();
+ this.values = {};
+};
+
+Map.create = function() {
+ return new Map();
+};
+
+Map.prototype = {
+ /**
+ Retrieve the value associated with a given key.
+
+ @param {anything} key
+ @return {anything} the value associated with the key, or undefined
+ */
+ get: function(key) {
+ var values = this.values,
+ guid = guidFor(key);
+
+ return values[guid];
+ },
+
+ /**
+ Adds a value to the map. If a value for the given key has already been
+ provided, the new value will replace the old value.
+
+ @param {anything} key
+ @param {anything} value
+ */
+ set: function(key, value) {
+ var keys = this.keys,
+ values = this.values,
+ guid = guidFor(key);
+
+ keys.add(key);
+ values[guid] = value;
+ },
+
+ /**
+ Removes a value from the map for an associated key.
+
+ @param {anything} key
+ @returns {Boolean} true if an item was removed, false otherwise
+ */
+ remove: function(key) {
+ // don't use ES6 "delete" because it will be annoying
+ // to use in browsers that are not ES6 friendly;
+ var keys = this.keys,
+ values = this.values,
+ guid = guidFor(key),
+ value;
+
+ if (values.hasOwnProperty(guid)) {
+ keys.remove(key);
+ value = values[guid];
+ delete values[guid];
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ /**
+ Check whether a key is present.
+
+ @param {anything} key
+ @returns {Boolean} true if the item was present, false otherwise
+ */
+ has: function(key) {
+ var values = this.values,
+ guid = guidFor(key);
+
+ return values.hasOwnProperty(guid);
+ },
+
+ /**
+ Iterate over all the keys and values. Calls the function once
+ for each key, passing in the key and value, in that order.
+
+ The keys are guaranteed to be iterated over in insertion order.
+
+ @param {Function} callback
+ @param {anything} self if passed, the `this` value inside the
+ callback. By default, `this` is the map.
+ */
+ forEach: function(callback, self) {
+ var keys = this.keys,
+ values = this.values;
+
+ keys.forEach(function(key) {
+ var guid = guidFor(key);
+ callback.call(self, key, values[guid]);
+ });
+ },
+
+ copy: function() {
+ return copyMap(this, new Map());
+ }
+};
+
+var MapWithDefault = Ember.MapWithDefault = function(options) {
+ Map.call(this);
+ this.defaultValue = options.defaultValue;
+};
+
+MapWithDefault.create = function(options) {
+ if (options) {
+ return new MapWithDefault(options);
+ } else {
+ return new Map();
+ }
+};
+
+MapWithDefault.prototype = Ember.create(Map.prototype);
+
+MapWithDefault.prototype.get = function(key) {
+ var hasValue = this.has(key);
+
+ if (hasValue) {
+ return Map.prototype.get.call(this, key);
+ } else {
+ var defaultValue = this.defaultValue(key);
+ this.set(key, defaultValue);
+ return defaultValue;
+ }
+};
+
+MapWithDefault.prototype.copy = function() {
+ return copyMap(this, new MapWithDefault({
+ defaultValue: this.defaultValue
+ }));
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var META_KEY = Ember.META_KEY, get, set;
+
+var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
+
+/** @private */
+var IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/;
+var IS_GLOBAL_PATH = /^([A-Z$]|([0-9][A-Z$])).*[\.\*]/;
+var HAS_THIS = /^this[\.\*]/;
+var FIRST_KEY = /^([^\.\*]+)/;
+
+// ..........................................................
+// GET AND SET
+//
+// If we are on a platform that supports accessors we can get use those.
+// Otherwise simulate accessors by looking up the property directly on the
+// object.
+
+/** @private */
+get = function get(obj, keyName) {
+ // Helpers that operate with 'this' within an #each
+ if (keyName === '') {
+ return obj;
+ }
+
+ if (!keyName && 'string'===typeof obj) {
+ keyName = obj;
+ obj = null;
+ }
+
+ if (!obj || keyName.indexOf('.') !== -1) {
+ return getPath(obj, keyName);
+ }
+
+ Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
+
+ var meta = obj[META_KEY], desc = meta && meta.descs[keyName], ret;
+ if (desc) {
+ return desc.get(obj, keyName);
+ } else {
+ if (MANDATORY_SETTER && meta && meta.watching[keyName] > 0) {
+ ret = meta.values[keyName];
+ } else {
+ ret = obj[keyName];
+ }
+
+ if (ret === undefined &&
+ 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
+ return obj.unknownProperty(keyName);
+ }
+
+ return ret;
+ }
+};
+
+/** @private */
+set = function set(obj, keyName, value, tolerant) {
+ if (typeof obj === 'string') {
+ Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj));
+ value = keyName;
+ keyName = obj;
+ obj = null;
+ }
+
+ if (!obj || keyName.indexOf('.') !== -1) {
+ return setPath(obj, keyName, value, tolerant);
+ }
+
+ Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
+ Ember.assert('calling set on destroyed object', !obj.isDestroyed);
+
+ var meta = obj[META_KEY], desc = meta && meta.descs[keyName],
+ isUnknown, currentValue;
+ if (desc) {
+ desc.set(obj, keyName, value);
+ }
+ else {
+ isUnknown = 'object' === typeof obj && !(keyName in obj);
+
+ // setUnknownProperty is called if `obj` is an object,
+ // the property does not already exist, and the
+ // `setUnknownProperty` method exists on the object
+ if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
+ obj.setUnknownProperty(keyName, value);
+ } else if (meta && meta.watching[keyName] > 0) {
+ if (MANDATORY_SETTER) {
+ currentValue = meta.values[keyName];
+ } else {
+ currentValue = obj[keyName];
+ }
+ // only trigger a change if the value has changed
+ if (value !== currentValue) {
+ Ember.propertyWillChange(obj, keyName);
+ if (MANDATORY_SETTER) {
+ if (currentValue === undefined && !(keyName in obj)) {
+ Ember.defineProperty(obj, keyName, null, value); // setup mandatory setter
+ } else {
+ meta.values[keyName] = value;
+ }
+ } else {
+ obj[keyName] = value;
+ }
+ Ember.propertyDidChange(obj, keyName);
+ }
+ } else {
+ obj[keyName] = value;
+ }
+ }
+ return value;
+};
+
+/** @private */
+function firstKey(path) {
+ return path.match(FIRST_KEY)[0];
+}
+
+// assumes path is already normalized
+/** @private */
+function normalizeTuple(target, path) {
+ var hasThis = HAS_THIS.test(path),
+ isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),
+ key;
+
+ if (!target || isGlobal) target = window;
+ if (hasThis) path = path.slice(5);
+
+ if (target === window) {
+ key = firstKey(path);
+ target = get(target, key);
+ path = path.slice(key.length+1);
+ }
+
+ // must return some kind of path to be valid else other things will break.
+ if (!path || path.length===0) throw new Error('Invalid Path');
+
+ return [ target, path ];
+}
+
+/** @private */
+function getPath(root, path) {
+ var hasThis, parts, tuple, idx, len;
+
+ // If there is no root and path is a key name, return that
+ // property from the global object.
+ // E.g. get('Ember') -> Ember
+ if (root === null && path.indexOf('.') === -1) { return get(window, path); }
+
+ // detect complicated paths and normalize them
+ hasThis = HAS_THIS.test(path);
+
+ if (!root || hasThis) {
+ tuple = normalizeTuple(root, path);
+ root = tuple[0];
+ path = tuple[1];
+ tuple.length = 0;
+ }
+
+ parts = path.split(".");
+ len = parts.length;
+ for (idx=0; root && idx<len; idx++) {
+ root = get(root, parts[idx], true);
+ if (root && root.isDestroyed) { return undefined; }
+ }
+ return root;
+}
+
+/** @private */
+function setPath(root, path, value, tolerant) {
+ var keyName;
+
+ // get the last part of the path
+ keyName = path.slice(path.lastIndexOf('.') + 1);
+
+ // get the first part of the part
+ path = path.slice(0, path.length-(keyName.length+1));
+
+ // unless the path is this, look up the first part to
+ // get the root
+ if (path !== 'this') {
+ root = getPath(root, path);
+ }
+
+ if (!keyName || keyName.length === 0) {
+ throw new Error('You passed an empty path');
+ }
+
+ if (!root) {
+ if (tolerant) { return; }
+ else { throw new Error('Object in path '+path+' could not be found or was destroyed.'); }
+ }
+
+ return set(root, keyName, value);
+}
+
+/**
+ @private
+
+ Normalizes a target/path pair to reflect that actual target/path that should
+ be observed, etc. This takes into account passing in global property
+ paths (i.e. a path beginning with a captial letter not defined on the
+ target) and * separators.
+
+ @param {Object} target
+ The current target. May be null.
+
+ @param {String} path
+ A path on the target or a global property path.
+
+ @returns {Array} a temporary array with the normalized target/path pair.
+*/
+Ember.normalizeTuple = function(target, path) {
+ return normalizeTuple(target, path);
+};
+
+Ember.getWithDefault = function(root, key, defaultValue) {
+ var value = get(root, key);
+
+ if (value === undefined) { return defaultValue; }
+ return value;
+};
+
+
+/**
+ @function
+
+ Gets the value of a property on an object. If the property is computed,
+ the function will be invoked. If the property is not defined but the
+ object implements the unknownProperty() method then that will be invoked.
+
+ If you plan to run on IE8 and older browsers then you should use this
+ method anytime you want to retrieve a property on an object that you don't
+ know for sure is private. (My convention only properties beginning with
+ an underscore '_' are considered private.)
+
+ On all newer browsers, you only need to use this method to retrieve
+ properties if the property might not be defined on the object and you want
+ to respect the unknownProperty() handler. Otherwise you can ignore this
+ method.
+
+ Note that if the obj itself is null, this method will simply return
+ undefined.
+
+ @param {Object} obj
+ The object to retrieve from.
+
+ @param {String} keyName
+ The property key to retrieve
+
+ @returns {Object} the property value or null.
+*/
+Ember.get = get;
+Ember.getPath = Ember.deprecateFunc('getPath is deprecated since get now supports paths', Ember.get);
+
+/**
+ @function
+
+ Sets the value of a property on an object, respecting computed properties
+ and notifying observers and other listeners of the change. If the
+ property is not defined but the object implements the unknownProperty()
+ method then that will be invoked as well.
+
+ If you plan to run on IE8 and older browsers then you should use this
+ method anytime you want to set a property on an object that you don't
+ know for sure is private. (My convention only properties beginning with
+ an underscore '_' are considered private.)
+
+ On all newer browsers, you only need to use this method to set
+ properties if the property might not be defined on the object and you want
+ to respect the unknownProperty() handler. Otherwise you can ignore this
+ method.
+
+ @param {Object} obj
+ The object to modify.
+
+ @param {String} keyName
+ The property key to set
+
+ @param {Object} value
+ The value to set
+
+ @returns {Object} the passed value.
+*/
+Ember.set = set;
+Ember.setPath = Ember.deprecateFunc('setPath is deprecated since set now supports paths', Ember.set);
+
+/**
+ Error-tolerant form of Ember.set. Will not blow up if any part of the
+ chain is undefined, null, or destroyed.
+
+ This is primarily used when syncing bindings, which may try to update after
+ an object has been destroyed.
+*/
+Ember.trySet = function(root, path, value) {
+ return set(root, path, value, true);
+};
+Ember.trySetPath = Ember.deprecateFunc('trySetPath has been renamed to trySet', Ember.trySet);
+
+/**
+ Returns true if the provided path is global (e.g., "MyApp.fooController.bar")
+ instead of local ("foo.bar.baz").
+
+ @param {String} path
+ @returns Boolean
+*/
+Ember.isGlobalPath = function(path) {
+ return IS_GLOBAL.test(path);
+};
+
+
+
+if (Ember.config.overrideAccessors) {
+ Ember.config.overrideAccessors();
+ get = Ember.get;
+ set = Ember.set;
+}
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var GUID_KEY = Ember.GUID_KEY,
+ META_KEY = Ember.META_KEY,
+ EMPTY_META = Ember.EMPTY_META,
+ metaFor = Ember.meta,
+ o_create = Ember.create,
+ objectDefineProperty = Ember.platform.defineProperty;
+
+var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
+
+// ..........................................................
+// DESCRIPTOR
+//
+
+/**
+ @private
+ @constructor
+
+ Objects of this type can implement an interface to responds requests to
+ get and set. The default implementation handles simple properties.
+
+ You generally won't need to create or subclass this directly.
+*/
+var Descriptor = Ember.Descriptor = function() {};
+
+// ..........................................................
+// DEFINING PROPERTIES API
+//
+
+/**
+ @private
+
+ NOTE: This is a low-level method used by other parts of the API. You almost
+ never want to call this method directly. Instead you should use Ember.mixin()
+ to define new properties.
+
+ Defines a property on an object. This method works much like the ES5
+ Object.defineProperty() method except that it can also accept computed
+ properties and other special descriptors.
+
+ Normally this method takes only three parameters. However if you pass an
+ instance of Ember.Descriptor as the third param then you can pass an optional
+ value as the fourth parameter. This is often more efficient than creating
+ new descriptor hashes for each property.
+
+ ## Examples
+
+ // ES5 compatible mode
+ Ember.defineProperty(contact, 'firstName', {
+ writable: true,
+ configurable: false,
+ enumerable: true,
+ value: 'Charles'
+ });
+
+ // define a simple property
+ Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
+
+ // define a computed property
+ Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
+ return this.firstName+' '+this.lastName;
+ }).property('firstName', 'lastName').cacheable());
+*/
+Ember.defineProperty = function(obj, keyName, desc, data, meta) {
+ // The first two parameters to defineProperty are mandatory:
+ //
+ // * obj: the object to define this property on. This may be
+ // a prototype.
+ // * keyName: the name of the property
+ //
+ // One and only one of the following two parameters must be
+ // provided:
+ //
+ // * desc: an instance of Ember.Descriptor (typically a
+ // computed property) or an ES5 descriptor.
+ // * data: something other than a descriptor, that will
+ // become the explicit value of this property.
+
+ var descs, existingDesc, watching, value;
+
+ if (!meta) meta = metaFor(obj);
+ descs = meta.descs;
+ existingDesc = meta.descs[keyName];
+ watching = meta.watching[keyName] > 0;
+
+ if (existingDesc instanceof Ember.Descriptor) {
+ existingDesc.teardown(obj, keyName);
+ }
+
+ if (desc instanceof Ember.Descriptor) {
+ value = desc;
+
+ descs[keyName] = desc;
+ if (MANDATORY_SETTER && watching) {
+ objectDefineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ writable: true,
+ value: undefined // make enumerable
+ });
+ } else {
+ obj[keyName] = undefined; // make enumerable
+ }
+ desc.setup(obj, keyName);
+ } else {
+ descs[keyName] = undefined; // shadow descriptor in proto
+ if (desc == null) {
+ value = data;
+
+ if (MANDATORY_SETTER && watching) {
+ meta.values[keyName] = data;
+ objectDefineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ set: function() {
+ Ember.assert('Must use Ember.set() to access this property', false);
+ },
+ get: function() {
+ var meta = this[META_KEY];
+ return meta && meta.values[keyName];
+ }
+ });
+ } else {
+ obj[keyName] = data;
+ }
+ } else {
+ value = desc;
+
+ // compatibility with ES5
+ objectDefineProperty(obj, keyName, desc);
+ }
+ }
+
+ // if key is being watched, override chains that
+ // were initialized with the prototype
+ if (watching) { Ember.overrideChains(obj, keyName, meta); }
+
+ // The `value` passed to the `didDefineProperty` hook is
+ // either the descriptor or data, whichever was passed.
+ if (obj.didDefineProperty) { obj.didDefineProperty(obj, keyName, value); }
+
+ return this;
+};
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var AFTER_OBSERVERS = ':change';
+var BEFORE_OBSERVERS = ':before';
+var guidFor = Ember.guidFor;
+
+var deferred = 0;
+var array_Slice = [].slice;
+
+/** @private */
+var ObserverSet = function () {
+ this.targetSet = {};
+};
+ObserverSet.prototype.add = function (target, path) {
+ var targetSet = this.targetSet,
+ targetGuid = Ember.guidFor(target),
+ pathSet = targetSet[targetGuid];
+ if (!pathSet) {
+ targetSet[targetGuid] = pathSet = {};
+ }
+ if (pathSet[path]) {
+ return false;
+ } else {
+ return pathSet[path] = true;
+ }
+};
+ObserverSet.prototype.clear = function () {
+ this.targetSet = {};
+};
+
+/** @private */
+var DeferredEventQueue = function() {
+ this.targetSet = {};
+ this.queue = [];
+};
+
+DeferredEventQueue.prototype.push = function(target, eventName, keyName) {
+ var targetSet = this.targetSet,
+ queue = this.queue,
+ targetGuid = Ember.guidFor(target),
+ eventNameSet = targetSet[targetGuid],
+ index;
+
+ if (!eventNameSet) {
+ targetSet[targetGuid] = eventNameSet = {};
+ }
+ index = eventNameSet[eventName];
+ if (index === undefined) {
+ eventNameSet[eventName] = queue.push(Ember.deferEvent(target, eventName, [target, keyName])) - 1;
+ } else {
+ queue[index] = Ember.deferEvent(target, eventName, [target, keyName]);
+ }
+};
+
+DeferredEventQueue.prototype.flush = function() {
+ var queue = this.queue;
+ this.queue = [];
+ this.targetSet = {};
+ for (var i=0, len=queue.length; i < len; ++i) {
+ queue[i]();
+ }
+};
+
+var queue = new DeferredEventQueue(), beforeObserverSet = new ObserverSet();
+
+/** @private */
+function notifyObservers(obj, eventName, keyName, forceNotification) {
+ if (deferred && !forceNotification) {
+ queue.push(obj, eventName, keyName);
+ } else {
+ Ember.sendEvent(obj, eventName, [obj, keyName]);
+ }
+}
+
+/** @private */
+function flushObserverQueue() {
+ beforeObserverSet.clear();
+
+ queue.flush();
+}
+
+Ember.beginPropertyChanges = function() {
+ deferred++;
+ return this;
+};
+
+Ember.endPropertyChanges = function() {
+ deferred--;
+ if (deferred<=0) flushObserverQueue();
+};
+
+/**
+ Make a series of property changes together in an
+ exception-safe way.
+
+ Ember.changeProperties(function() {
+ obj1.set('foo', mayBlowUpWhenSet);
+ obj2.set('bar', baz);
+ });
+*/
+Ember.changeProperties = function(cb, binding){
+ Ember.beginPropertyChanges();
+ try {
+ cb.call(binding);
+ } finally {
+ Ember.endPropertyChanges();
+ }
+};
+
+/**
+ Set a list of properties on an object. These properties are set inside
+ a single `beginPropertyChanges` and `endPropertyChanges` batch, so
+ observers will be buffered.
+*/
+Ember.setProperties = function(self, hash) {
+ Ember.changeProperties(function(){
+ for(var prop in hash) {
+ if (hash.hasOwnProperty(prop)) Ember.set(self, prop, hash[prop]);
+ }
+ });
+ return self;
+};
+
+
+/** @private */
+function changeEvent(keyName) {
+ return keyName+AFTER_OBSERVERS;
+}
+
+/** @private */
+function beforeEvent(keyName) {
+ return keyName+BEFORE_OBSERVERS;
+}
+
+Ember.addObserver = function(obj, path, target, method) {
+ Ember.addListener(obj, changeEvent(path), target, method);
+ Ember.watch(obj, path);
+ return this;
+};
+
+/** @private */
+Ember.observersFor = function(obj, path) {
+ return Ember.listenersFor(obj, changeEvent(path));
+};
+
+Ember.removeObserver = function(obj, path, target, method) {
+ Ember.unwatch(obj, path);
+ Ember.removeListener(obj, changeEvent(path), target, method);
+ return this;
+};
+
+Ember.addBeforeObserver = function(obj, path, target, method) {
+ Ember.addListener(obj, beforeEvent(path), target, method);
+ Ember.watch(obj, path);
+ return this;
+};
+
+// Suspend observer during callback.
+//
+// This should only be used by the target of the observer
+// while it is setting the observed path.
+/** @private */
+Ember._suspendBeforeObserver = function(obj, path, target, method, callback) {
+ return Ember._suspendListener(obj, beforeEvent(path), target, method, callback);
+};
+
+Ember._suspendObserver = function(obj, path, target, method, callback) {
+ return Ember._suspendListener(obj, changeEvent(path), target, method, callback);
+};
+
+/** @private */
+Ember.beforeObserversFor = function(obj, path) {
+ return Ember.listenersFor(obj, beforeEvent(path));
+};
+
+Ember.removeBeforeObserver = function(obj, path, target, method) {
+ Ember.unwatch(obj, path);
+ Ember.removeListener(obj, beforeEvent(path), target, method);
+ return this;
+};
+
+/** @private */
+Ember.notifyObservers = function(obj, keyName) {
+ if (obj.isDestroying) { return; }
+
+ notifyObservers(obj, changeEvent(keyName), keyName);
+};
+
+/** @private */
+Ember.notifyBeforeObservers = function(obj, keyName) {
+ if (obj.isDestroying) { return; }
+
+ var guid, set, forceNotification = false;
+
+ if (deferred) {
+ if (beforeObserverSet.add(obj, keyName)) {
+ forceNotification = true;
+ } else {
+ return;
+ }
+ }
+
+ notifyObservers(obj, beforeEvent(keyName), keyName, forceNotification);
+};
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var guidFor = Ember.guidFor, // utils.js
+ metaFor = Ember.meta, // utils.js
+ get = Ember.get, // accessors.js
+ set = Ember.set, // accessors.js
+ normalizeTuple = Ember.normalizeTuple, // accessors.js
+ GUID_KEY = Ember.GUID_KEY, // utils.js
+ META_KEY = Ember.META_KEY, // utils.js
+ // circular reference observer depends on Ember.watch
+ // we should move change events to this file or its own property_events.js
+ notifyObservers = Ember.notifyObservers, // observer.js
+ forEach = Ember.ArrayPolyfills.forEach, // array.js
+ FIRST_KEY = /^([^\.\*]+)/,
+ IS_PATH = /[\.\*]/;
+
+var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
+o_defineProperty = Ember.platform.defineProperty;
+
+/** @private */
+function firstKey(path) {
+ return path.match(FIRST_KEY)[0];
+}
+
+// returns true if the passed path is just a keyName
+/** @private */
+function isKeyName(path) {
+ return path==='*' || !IS_PATH.test(path);
+}
+
+// ..........................................................
+// DEPENDENT KEYS
+//
+
+var DEP_SKIP = { __emberproto__: true }; // skip some keys and toString
+
+/** @private */
+function iterDeps(method, obj, depKey, seen, meta) {
+
+ var guid = guidFor(obj);
+ if (!seen[guid]) seen[guid] = {};
+ if (seen[guid][depKey]) return;
+ seen[guid][depKey] = true;
+
+ var deps = meta.deps;
+ deps = deps && deps[depKey];
+ if (deps) {
+ for(var key in deps) {
+ if (DEP_SKIP[key]) continue;
+ method(obj, key);
+ }
+ }
+}
+
+
+var WILL_SEEN, DID_SEEN;
+
+// called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)
+/** @private */
+function dependentKeysWillChange(obj, depKey, meta) {
+ if (obj.isDestroying) { return; }
+
+ var seen = WILL_SEEN, top = !seen;
+ if (top) { seen = WILL_SEEN = {}; }
+ iterDeps(propertyWillChange, obj, depKey, seen, meta);
+ if (top) { WILL_SEEN = null; }
+}
+
+// called whenever a property has just changed to update dependent keys
+/** @private */
+function dependentKeysDidChange(obj, depKey, meta) {
+ if (obj.isDestroying) { return; }
+
+ var seen = DID_SEEN, top = !seen;
+ if (top) { seen = DID_SEEN = {}; }
+ iterDeps(propertyDidChange, obj, depKey, seen, meta);
+ if (top) { DID_SEEN = null; }
+}
+
+// ..........................................................
+// CHAIN
+//
+
+/** @private */
+function addChainWatcher(obj, keyName, node) {
+ if (!obj || ('object' !== typeof obj)) return; // nothing to do
+ var m = metaFor(obj);
+ var nodes = m.chainWatchers;
+ if (!nodes || nodes.__emberproto__ !== obj) {
+ nodes = m.chainWatchers = { __emberproto__: obj };
+ }
+
+ if (!nodes[keyName]) { nodes[keyName] = {}; }
+ nodes[keyName][guidFor(node)] = node;
+ Ember.watch(obj, keyName);
+}
+
+/** @private */
+function removeChainWatcher(obj, keyName, node) {
+ if (!obj || 'object' !== typeof obj) { return; } // nothing to do
+ var m = metaFor(obj, false),
+ nodes = m.chainWatchers;
+ if (!nodes || nodes.__emberproto__ !== obj) { return; } //nothing to do
+ if (nodes[keyName]) { delete nodes[keyName][guidFor(node)]; }
+ Ember.unwatch(obj, keyName);
+}
+
+var pendingQueue = [];
+
+// attempts to add the pendingQueue chains again. If some of them end up
+// back in the queue and reschedule is true, schedules a timeout to try
+// again.
+/** @private */
+function flushPendingChains() {
+ if (pendingQueue.length === 0) { return; } // nothing to do
+
+ var queue = pendingQueue;
+ pendingQueue = [];
+
+ forEach.call(queue, function(q) { q[0].add(q[1]); });
+
+ Ember.warn('Watching an undefined global, Ember expects watched globals to be setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0);
+}
+
+/** @private */
+function isProto(pvalue) {
+ return metaFor(pvalue, false).proto === pvalue;
+}
+
+// A ChainNode watches a single key on an object. If you provide a starting
+// value for the key then the node won't actually watch it. For a root node
+// pass null for parent and key and object for value.
+/** @private */
+var ChainNode = function(parent, key, value, separator) {
+ var obj;
+ this._parent = parent;
+ this._key = key;
+
+ // _watching is true when calling get(this._parent, this._key) will
+ // return the value of this node.
+ //
+ // It is false for the root of a chain (because we have no parent)
+ // and for global paths (because the parent node is the object with
+ // the observer on it)
+ this._watching = value===undefined;
+
+ this._value = value;
+ this._separator = separator || '.';
+ this._paths = {};
+ if (this._watching) {
+ this._object = parent.value();
+ if (this._object) { addChainWatcher(this._object, this._key, this); }
+ }
+
+ // Special-case: the EachProxy relies on immediate evaluation to
+ // establish its observers.
+ //
+ // TODO: Replace this with an efficient callback that the EachProxy
+ // can implement.
+ if (this._parent && this._parent._key === '@each') {
+ this.value();
+ }
+};
+
+var ChainNodePrototype = ChainNode.prototype;
+
+ChainNodePrototype.value = function() {
+ if (this._value === undefined && this._watching) {
+ var obj = this._parent.value();
+ this._value = (obj && !isProto(obj)) ? get(obj, this._key) : undefined;
+ }
+ return this._value;
+};
+
+ChainNodePrototype.destroy = function() {
+ if (this._watching) {
+ var obj = this._object;
+ if (obj) { removeChainWatcher(obj, this._key, this); }
+ this._watching = false; // so future calls do nothing
+ }
+};
+
+// copies a top level object only
+ChainNodePrototype.copy = function(obj) {
+ var ret = new ChainNode(null, null, obj, this._separator),
+ paths = this._paths, path;
+ for (path in paths) {
+ if (paths[path] <= 0) { continue; } // this check will also catch non-number vals.
+ ret.add(path);
+ }
+ return ret;
+};
+
+// called on the root node of a chain to setup watchers on the specified
+// path.
+ChainNodePrototype.add = function(path) {
+ var obj, tuple, key, src, separator, paths;
+
+ paths = this._paths;
+ paths[path] = (paths[path] || 0) + 1;
+
+ obj = this.value();
+ tuple = normalizeTuple(obj, path);
+
+ // the path was a local path
+ if (tuple[0] && tuple[0] === obj) {
+ path = tuple[1];
+ key = firstKey(path);
+ path = path.slice(key.length+1);
+
+ // global path, but object does not exist yet.
+ // put into a queue and try to connect later.
+ } else if (!tuple[0]) {
+ pendingQueue.push([this, path]);
+ tuple.length = 0;
+ return;
+
+ // global path, and object already exists
+ } else {
+ src = tuple[0];
+ key = path.slice(0, 0-(tuple[1].length+1));
+ separator = path.slice(key.length, key.length+1);
+ path = tuple[1];
+ }
+
+ tuple.length = 0;
+ this.chain(key, path, src, separator);
+};
+
+// called on the root node of a chain to teardown watcher on the specified
+// path
+ChainNodePrototype.remove = function(path) {
+ var obj, tuple, key, src, paths;
+
+ paths = this._paths;
+ if (paths[path] > 0) { paths[path]--; }
+
+ obj = this.value();
+ tuple = normalizeTuple(obj, path);
+ if (tuple[0] === obj) {
+ path = tuple[1];
+ key = firstKey(path);
+ path = path.slice(key.length+1);
+ } else {
+ src = tuple[0];
+ key = path.slice(0, 0-(tuple[1].length+1));
+ path = tuple[1];
+ }
+
+ tuple.length = 0;
+ this.unchain(key, path);
+};
+
+ChainNodePrototype.count = 0;
+
+ChainNodePrototype.chain = function(key, path, src, separator) {
+ var chains = this._chains, node;
+ if (!chains) { chains = this._chains = {}; }
+
+ node = chains[key];
+ if (!node) { node = chains[key] = new ChainNode(this, key, src, separator); }
+ node.count++; // count chains...
+
+ // chain rest of path if there is one
+ if (path && path.length>0) {
+ key = firstKey(path);
+ path = path.slice(key.length+1);
+ node.chain(key, path); // NOTE: no src means it will observe changes...
+ }
+};
+
+ChainNodePrototype.unchain = function(key, path) {
+ var chains = this._chains, node = chains[key];
+
+ // unchain rest of path first...
+ if (path && path.length>1) {
+ key = firstKey(path);
+ path = path.slice(key.length+1);
+ node.unchain(key, path);
+ }
+
+ // delete node if needed.
+ node.count--;
+ if (node.count<=0) {
+ delete chains[node._key];
+ node.destroy();
+ }
+
+};
+
+ChainNodePrototype.willChange = function() {
+ var chains = this._chains;
+ if (chains) {
+ for(var key in chains) {
+ if (!chains.hasOwnProperty(key)) { continue; }
+ chains[key].willChange();
+ }
+ }
+
+ if (this._parent) { this._parent.chainWillChange(this, this._key, 1); }
+};
+
+ChainNodePrototype.chainWillChange = function(chain, path, depth) {
+ if (this._key) { path = this._key + this._separator + path; }
+
+ if (this._parent) {
+ this._parent.chainWillChange(this, path, depth+1);
+ } else {
+ if (depth > 1) { Ember.propertyWillChange(this.value(), path); }
+ path = 'this.' + path;
+ if (this._paths[path] > 0) { Ember.propertyWillChange(this.value(), path); }
+ }
+};
+
+ChainNodePrototype.chainDidChange = function(chain, path, depth) {
+ if (this._key) { path = this._key + this._separator + path; }
+ if (this._parent) {
+ this._parent.chainDidChange(this, path, depth+1);
+ } else {
+ if (depth > 1) { Ember.propertyDidChange(this.value(), path); }
+ path = 'this.' + path;
+ if (this._paths[path] > 0) { Ember.propertyDidChange(this.value(), path); }
+ }
+};
+
+ChainNodePrototype.didChange = function(suppressEvent) {
+ // invalidate my own value first.
+ if (this._watching) {
+ var obj = this._parent.value();
+ if (obj !== this._object) {
+ removeChainWatcher(this._object, this._key, this);
+ this._object = obj;
+ addChainWatcher(obj, this._key, this);
+ }
+ this._value = undefined;
+
+ // Special-case: the EachProxy relies on immediate evaluation to
+ // establish its observers.
+ if (this._parent && this._parent._key === '@each')
+ this.value();
+ }
+
+ // then notify chains...
+ var chains = this._chains;
+ if (chains) {
+ for(var key in chains) {
+ if (!chains.hasOwnProperty(key)) { continue; }
+ chains[key].didChange(suppressEvent);
+ }
+ }
+
+ if (suppressEvent) { return; }
+
+ // and finally tell parent about my path changing...
+ if (this._parent) { this._parent.chainDidChange(this, this._key, 1); }
+};
+
+// get the chains for the current object. If the current object has
+// chains inherited from the proto they will be cloned and reconfigured for
+// the current object.
+/** @private */
+function chainsFor(obj) {
+ var m = metaFor(obj), ret = m.chains;
+ if (!ret) {
+ ret = m.chains = new ChainNode(null, null, obj);
+ } else if (ret.value() !== obj) {
+ ret = m.chains = ret.copy(obj);
+ }
+ return ret;
+}
+
+/** @private */
+function notifyChains(obj, m, keyName, methodName, arg) {
+ var nodes = m.chainWatchers;
+
+ if (!nodes || nodes.__emberproto__ !== obj) { return; } // nothing to do
+
+ nodes = nodes[keyName];
+ if (!nodes) { return; }
+
+ for(var key in nodes) {
+ if (!nodes.hasOwnProperty(key)) { continue; }
+ nodes[key][methodName](arg);
+ }
+}
+
+Ember.overrideChains = function(obj, keyName, m) {
+ notifyChains(obj, m, keyName, 'didChange', true);
+};
+
+/** @private */
+function chainsWillChange(obj, keyName, m) {
+ notifyChains(obj, m, keyName, 'willChange');
+}
+
+/** @private */
+function chainsDidChange(obj, keyName, m) {
+ notifyChains(obj, m, keyName, 'didChange');
+}
+
+// ..........................................................
+// WATCH
+//
+
+/**
+ @private
+
+ Starts watching a property on an object. Whenever the property changes,
+ invokes Ember.propertyWillChange and Ember.propertyDidChange. This is the
+ primitive used by observers and dependent keys; usually you will never call
+ this method directly but instead use higher level methods like
+ Ember.addObserver().
+*/
+Ember.watch = function(obj, keyName) {
+ // can't watch length on Array - it is special...
+ if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }
+
+ var m = metaFor(obj), watching = m.watching, desc;
+
+ // activate watching first time
+ if (!watching[keyName]) {
+ watching[keyName] = 1;
+ if (isKeyName(keyName)) {
+ desc = m.descs[keyName];
+ if (desc && desc.willWatch) { desc.willWatch(obj, keyName); }
+
+ if ('function' === typeof obj.willWatchProperty) {
+ obj.willWatchProperty(keyName);
+ }
+
+ if (MANDATORY_SETTER && keyName in obj) {
+ m.values[keyName] = obj[keyName];
+ o_defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ set: function() {
+ Ember.assert('Must use Ember.set() to access this property', false);
+ },
+ get: function() {
+ var meta = this[META_KEY];
+ return meta && meta.values[keyName];
+ }
+ });
+ }
+ } else {
+ chainsFor(obj).add(keyName);
+ }
+
+ } else {
+ watching[keyName] = (watching[keyName] || 0) + 1;
+ }
+ return this;
+};
+
+Ember.isWatching = function isWatching(obj, key) {
+ var meta = obj[META_KEY];
+ return (meta && meta.watching[key]) > 0;
+};
+
+Ember.watch.flushPending = flushPendingChains;
+
+/** @private */
+Ember.unwatch = function(obj, keyName) {
+ // can't watch length on Array - it is special...
+ if (keyName === 'length' && Ember.typeOf(obj) === 'array') { return this; }
+
+ var m = metaFor(obj), watching = m.watching, desc;
+
+ if (watching[keyName] === 1) {
+ watching[keyName] = 0;
+
+ if (isKeyName(keyName)) {
+ desc = m.descs[keyName];
+ if (desc && desc.didUnwatch) { desc.didUnwatch(obj, keyName); }
+
+ if ('function' === typeof obj.didUnwatchProperty) {
+ obj.didUnwatchProperty(keyName);
+ }
+
+ if (MANDATORY_SETTER && keyName in obj) {
+ o_defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ writable: true,
+ value: m.values[keyName]
+ });
+ delete m.values[keyName];
+ }
+ } else {
+ chainsFor(obj).remove(keyName);
+ }
+
+ } else if (watching[keyName]>1) {
+ watching[keyName]--;
+ }
+
+ return this;
+};
+
+/**
+ @private
+
+ Call on an object when you first beget it from another object. This will
+ setup any chained watchers on the object instance as needed. This method is
+ safe to call multiple times.
+*/
+Ember.rewatch = function(obj) {
+ var m = metaFor(obj, false), chains = m.chains;
+
+ // make sure the object has its own guid.
+ if (GUID_KEY in obj && !obj.hasOwnProperty(GUID_KEY)) {
+ Ember.generateGuid(obj, 'ember');
+ }
+
+ // make sure any chained watchers update.
+ if (chains && chains.value() !== obj) {
+ m.chains = chains.copy(obj);
+ }
+
+ return this;
+};
+
+Ember.finishChains = function(obj) {
+ var m = metaFor(obj, false), chains = m.chains;
+ if (chains) {
+ if (chains.value() !== obj) {
+ m.chains = chains = chains.copy(obj);
+ }
+ chains.didChange(true);
+ }
+};
+
+// ..........................................................
+// PROPERTY CHANGES
+//
+
+/**
+ This function is called just before an object property is about to change.
+ It will notify any before observers and prepare caches among other things.
+
+ Normally you will not need to call this method directly but if for some
+ reason you can't directly watch a property you can invoke this method
+ manually along with `Ember.propertyDidChange()` which you should call just
+ after the property value changes.
+
+ @memberOf Ember
+
+ @param {Object} obj
+ The object with the property that will change
+
+ @param {String} keyName
+ The property key (or path) that will change.
+
+ @returns {void}
+*/
+function propertyWillChange(obj, keyName, value) {
+ var m = metaFor(obj, false),
+ watching = m.watching[keyName] > 0 || keyName === 'length',
+ proto = m.proto,
+ desc = m.descs[keyName];
+
+ if (!watching) { return; }
+ if (proto === obj) { return; }
+ if (desc && desc.willChange) { desc.willChange(obj, keyName); }
+ dependentKeysWillChange(obj, keyName, m);
+ chainsWillChange(obj, keyName, m);
+ Ember.notifyBeforeObservers(obj, keyName);
+}
+
+Ember.propertyWillChange = propertyWillChange;
+
+/**
+ This function is called just after an object property has changed.
+ It will notify any observers and clear caches among other things.
+
+ Normally you will not need to call this method directly but if for some
+ reason you can't directly watch a property you can invoke this method
+ manually along with `Ember.propertyWilLChange()` which you should call just
+ before the property value changes.
+
+ @memberOf Ember
+
+ @param {Object} obj
+ The object with the property that will change
+
+ @param {String} keyName
+ The property key (or path) that will change.
+
+ @returns {void}
+*/
+function propertyDidChange(obj, keyName) {
+ var m = metaFor(obj, false),
+ watching = m.watching[keyName] > 0 || keyName === 'length',
+ proto = m.proto,
+ desc = m.descs[keyName];
+
+ if (proto === obj) { return; }
+
+ // shouldn't this mean that we're watching this key?
+ if (desc && desc.didChange) { desc.didChange(obj, keyName); }
+ if (!watching && keyName !== 'length') { return; }
+
+ dependentKeysDidChange(obj, keyName, m);
+ chainsDidChange(obj, keyName, m);
+ Ember.notifyObservers(obj, keyName);
+}
+
+Ember.propertyDidChange = propertyDidChange;
+
+var NODE_STACK = [];
+
+/**
+ Tears down the meta on an object so that it can be garbage collected.
+ Multiple calls will have no effect.
+
+ @param {Object} obj the object to destroy
+ @returns {void}
+*/
+Ember.destroy = function (obj) {
+ var meta = obj[META_KEY], node, nodes, key, nodeObject;
+ if (meta) {
+ obj[META_KEY] = null;
+ // remove chainWatchers to remove circular references that would prevent GC
+ node = meta.chains;
+ if (node) {
+ NODE_STACK.push(node);
+ // process tree
+ while (NODE_STACK.length > 0) {
+ node = NODE_STACK.pop();
+ // push children
+ nodes = node._chains;
+ if (nodes) {
+ for (key in nodes) {
+ if (nodes.hasOwnProperty(key)) {
+ NODE_STACK.push(nodes[key]);
+ }
+ }
+ }
+ // remove chainWatcher in node object
+ if (node._watching) {
+ nodeObject = node._object;
+ if (nodeObject) {
+ removeChainWatcher(nodeObject, node._key, node);
+ }
+ }
+ }
+ }
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+Ember.warn("Computed properties will soon be cacheable by default. To enable this in your app, set `ENV.CP_DEFAULT_CACHEABLE = true`.", Ember.CP_DEFAULT_CACHEABLE);
+
+
+var get = Ember.get,
+ metaFor = Ember.meta,
+ guidFor = Ember.guidFor,
+ a_slice = [].slice,
+ o_create = Ember.create,
+ META_KEY = Ember.META_KEY,
+ watch = Ember.watch,
+ unwatch = Ember.unwatch;
+
+// ..........................................................
+// DEPENDENT KEYS
+//
+
+// data structure:
+// meta.deps = {
+// 'depKey': {
+// 'keyName': count,
+// __emberproto__: SRC_OBJ [to detect clones]
+// },
+// __emberproto__: SRC_OBJ
+// }
+
+/**
+ @private
+
+ This function returns a map of unique dependencies for a
+ given object and key.
+*/
+function keysForDep(obj, depsMeta, depKey) {
+ var keys = depsMeta[depKey];
+ if (!keys) {
+ // if there are no dependencies yet for a the given key
+ // create a new empty list of dependencies for the key
+ keys = depsMeta[depKey] = { __emberproto__: obj };
+ } else if (keys.__emberproto__ !== obj) {
+ // otherwise if the dependency list is inherited from
+ // a superclass, clone the hash
+ keys = depsMeta[depKey] = o_create(keys);
+ keys.__emberproto__ = obj;
+ }
+ return keys;
+}
+
+/**
+ @private
+
+ return obj[META_KEY].deps
+ */
+function metaForDeps(obj, meta) {
+ var deps = meta.deps;
+ // If the current object has no dependencies...
+ if (!deps) {
+ // initialize the dependencies with a pointer back to
+ // the current object
+ deps = meta.deps = { __emberproto__: obj };
+ } else if (deps.__emberproto__ !== obj) {
+ // otherwise if the dependencies are inherited from the
+ // object's superclass, clone the deps
+ deps = meta.deps = o_create(deps);
+ deps.__emberproto__ = obj;
+ }
+ return deps;
+}
+
+/** @private */
+function addDependentKeys(desc, obj, keyName, meta) {
+ // the descriptor has a list of dependent keys, so
+ // add all of its dependent keys.
+ var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
+ if (!depKeys) return;
+
+ depsMeta = metaForDeps(obj, meta);
+
+ for(idx = 0, len = depKeys.length; idx < len; idx++) {
+ depKey = depKeys[idx];
+ // Lookup keys meta for depKey
+ keys = keysForDep(obj, depsMeta, depKey);
+ // Increment the number of times depKey depends on keyName.
+ keys[keyName] = (keys[keyName] || 0) + 1;
+ // Watch the depKey
+ watch(obj, depKey);
+ }
+}
+
+/** @private */
+function removeDependentKeys(desc, obj, keyName, meta) {
+ // the descriptor has a list of dependent keys, so
+ // add all of its dependent keys.
+ var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
+ if (!depKeys) return;
+
+ depsMeta = metaForDeps(obj, meta);
+
+ for(idx = 0, len = depKeys.length; idx < len; idx++) {
+ depKey = depKeys[idx];
+ // Lookup keys meta for depKey
+ keys = keysForDep(obj, depsMeta, depKey);
+ // Increment the number of times depKey depends on keyName.
+ keys[keyName] = (keys[keyName] || 0) - 1;
+ // Watch the depKey
+ unwatch(obj, depKey);
+ }
+}
+
+// ..........................................................
+// COMPUTED PROPERTY
+//
+
+/** @private */
+function ComputedProperty(func, opts) {
+ this.func = func;
+ this._cacheable = (opts && opts.cacheable !== undefined) ? opts.cacheable : Ember.CP_DEFAULT_CACHEABLE;
+ this._dependentKeys = opts && opts.dependentKeys;
+}
+
+/**
+ @constructor
+*/
+Ember.ComputedProperty = ComputedProperty;
+ComputedProperty.prototype = new Ember.Descriptor();
+
+/**
+ @extends Ember.ComputedProperty
+ @private
+*/
+var ComputedPropertyPrototype = ComputedProperty.prototype;
+
+/**
+ Call on a computed property to set it into cacheable mode. When in this
+ mode the computed property will automatically cache the return value of
+ your function until one of the dependent keys changes.
+
+ MyApp.president = Ember.Object.create({
+ fullName: function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // After calculating the value of this function, Ember.js will
+ // return that value without re-executing this function until
+ // one of the dependent properties change.
+ }.property('firstName', 'lastName').cacheable()
+ });
+
+ Properties are cacheable by default.
+
+ @memberOf Ember.ComputedProperty.prototype
+ @name cacheable
+ @function
+ @param {Boolean} aFlag optional set to false to disable caching
+ @returns {Ember.ComputedProperty} receiver
+*/
+ComputedPropertyPrototype.cacheable = function(aFlag) {
+ this._cacheable = aFlag !== false;
+ return this;
+};
+
+/**
+ Call on a computed property to set it into non-cached mode. When in this
+ mode the computed property will not automatically cache the return value.
+
+ MyApp.outsideService = Ember.Object.create({
+ value: function() {
+ return OutsideService.getValue();
+ }.property().volatile()
+ });
+
+ @memberOf Ember.ComputedProperty.prototype
+ @name volatile
+ @function
+ @returns {Ember.ComputedProperty} receiver
+*/
+ComputedPropertyPrototype.volatile = function() {
+ return this.cacheable(false);
+};
+
+/**
+ Sets the dependent keys on this computed property. Pass any number of
+ arguments containing key paths that this computed property depends on.
+
+ MyApp.president = Ember.Object.create({
+ fullName: Ember.computed(function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // Tell Ember.js that this computed property depends on firstName
+ // and lastName
+ }).property('firstName', 'lastName')
+ });
+
+ @memberOf Ember.ComputedProperty.prototype
+ @name property
+ @function
+ @param {String} path... zero or more property paths
+ @returns {Ember.ComputedProperty} receiver
+*/
+ComputedPropertyPrototype.property = function() {
+ var args = [];
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ args.push(arguments[i]);
+ }
+ this._dependentKeys = args;
+ return this;
+};
+
+/**
+ In some cases, you may want to annotate computed properties with additional
+ metadata about how they function or what values they operate on. For example,
+ computed property functions may close over variables that are then no longer
+ available for introspection.
+
+ You can pass a hash of these values to a computed property like this:
+
+ person: function() {
+ var personId = this.get('personId');
+ return App.Person.create({ id: personId });
+ }.property().meta({ type: App.Person })
+
+ The hash that you pass to the `meta()` function will be saved on the
+ computed property descriptor under the `_meta` key. Ember runtime
+ exposes a public API for retrieving these values from classes,
+ via the `metaForProperty()` function.
+
+ @memberOf Ember.ComputedProperty.prototype
+ @name meta
+ @function
+ @param {Hash} meta
+ @returns {Ember.ComputedProperty} property descriptor instance
+*/
+
+ComputedPropertyPrototype.meta = function(meta) {
+ if (arguments.length === 0) {
+ return this._meta || {};
+ } else {
+ this._meta = meta;
+ return this;
+ }
+};
+
+/** @private - impl descriptor API */
+ComputedPropertyPrototype.willWatch = function(obj, keyName) {
+ // watch already creates meta for this instance
+ var meta = obj[META_KEY];
+ Ember.assert('watch should have setup meta to be writable', meta.source === obj);
+ if (!(keyName in meta.cache)) {
+ addDependentKeys(this, obj, keyName, meta);
+ }
+};
+
+ComputedPropertyPrototype.didUnwatch = function(obj, keyName) {
+ var meta = obj[META_KEY];
+ Ember.assert('unwatch should have setup meta to be writable', meta.source === obj);
+ if (!(keyName in meta.cache)) {
+ // unwatch already creates meta for this instance
+ removeDependentKeys(this, obj, keyName, meta);
+ }
+};
+
+/** @private - impl descriptor API */
+ComputedPropertyPrototype.didChange = function(obj, keyName) {
+ // _suspended is set via a CP.set to ensure we don't clear
+ // the cached value set by the setter
+ if (this._cacheable && this._suspended !== obj) {
+ var meta = metaFor(obj);
+ if (keyName in meta.cache) {
+ delete meta.cache[keyName];
+ if (!meta.watching[keyName]) {
+ removeDependentKeys(this, obj, keyName, meta);
+ }
+ }
+ }
+};
+
+/** @private - impl descriptor API */
+ComputedPropertyPrototype.get = function(obj, keyName) {
+ var ret, cache, meta;
+ if (this._cacheable) {
+ meta = metaFor(obj);
+ cache = meta.cache;
+ if (keyName in cache) { return cache[keyName]; }
+ ret = cache[keyName] = this.func.call(obj, keyName);
+ if (!meta.watching[keyName]) {
+ addDependentKeys(this, obj, keyName, meta);
+ }
+ } else {
+ ret = this.func.call(obj, keyName);
+ }
+ return ret;
+};
+
+/** @private - impl descriptor API */
+ComputedPropertyPrototype.set = function(obj, keyName, value) {
+ var cacheable = this._cacheable,
+ meta = metaFor(obj, cacheable),
+ watched = meta.watching[keyName],
+ oldSuspended = this._suspended,
+ hadCachedValue,
+ ret;
+
+ this._suspended = obj;
+
+ if (watched) { Ember.propertyWillChange(obj, keyName); }
+ if (cacheable) {
+ if (keyName in meta.cache) {
+ delete meta.cache[keyName];
+ hadCachedValue = true;
+ }
+ }
+ ret = this.func.call(obj, keyName, value);
+ if (cacheable) {
+ if (!watched && !hadCachedValue) {
+ addDependentKeys(this, obj, keyName, meta);
+ }
+ meta.cache[keyName] = ret;
+ }
+ if (watched) { Ember.propertyDidChange(obj, keyName); }
+ this._suspended = oldSuspended;
+ return ret;
+};
+
+/** @private - called when property is defined */
+ComputedPropertyPrototype.setup = function(obj, keyName) {
+ var meta = obj[META_KEY];
+ if (meta && meta.watching[keyName]) {
+ addDependentKeys(this, obj, keyName, metaFor(obj));
+ }
+};
+
+/** @private - called before property is overridden */
+ComputedPropertyPrototype.teardown = function(obj, keyName) {
+ var meta = metaFor(obj);
+
+ if (meta.watching[keyName] || keyName in meta.cache) {
+ removeDependentKeys(this, obj, keyName, meta);
+ }
+
+ if (this._cacheable) { delete meta.cache[keyName]; }
+
+ return null; // no value to restore
+};
+
+/**
+ This helper returns a new property descriptor that wraps the passed
+ computed property function. You can use this helper to define properties
+ with mixins or via Ember.defineProperty().
+
+ The function you pass will be used to both get and set property values.
+ The function should accept two parameters, key and value. If value is not
+ undefined you should set the value first. In either case return the
+ current value of the property.
+
+ @param {Function} func
+ The computed property function.
+
+ @returns {Ember.ComputedProperty} property descriptor instance
+*/
+Ember.computed = function(func) {
+ var args;
+
+ if (arguments.length > 1) {
+ args = a_slice.call(arguments, 0, -1);
+ func = a_slice.call(arguments, -1)[0];
+ }
+
+ var cp = new ComputedProperty(func);
+
+ if (args) {
+ cp.property.apply(cp, args);
+ }
+
+ return cp;
+};
+
+/**
+ Returns the cached value for a property, if one exists.
+ This can be useful for peeking at the value of a computed
+ property that is generated lazily, without accidentally causing
+ it to be created.
+
+ @param {Object} obj the object whose property you want to check
+ @param {String} key the name of the property whose cached value you want
+ to return
+
+*/
+Ember.cacheFor = function cacheFor(obj, key) {
+ var cache = metaFor(obj, false).cache;
+
+ if (cache && key in cache) {
+ return cache[key];
+ }
+};
+
+Ember.computed.not = function(dependentKey) {
+ return Ember.computed(dependentKey, function(key) {
+ return !get(this, dependentKey);
+ }).cacheable();
+};
+
+Ember.computed.empty = function(dependentKey) {
+ return Ember.computed(dependentKey, function(key) {
+ var val = get(this, dependentKey);
+ return val === undefined || val === null || val === '' || (Ember.isArray(val) && get(val, 'length') === 0);
+ }).cacheable();
+};
+
+Ember.computed.bool = function(dependentKey) {
+ return Ember.computed(dependentKey, function(key) {
+ return !!get(this, dependentKey);
+ }).cacheable();
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var o_create = Ember.create,
+ meta = Ember.meta,
+ metaPath = Ember.metaPath,
+ guidFor = Ember.guidFor,
+ a_slice = [].slice;
+
+/**
+ The event system uses a series of nested hashes to store listeners on an
+ object. When a listener is registered, or when an event arrives, these
+ hashes are consulted to determine which target and action pair to invoke.
+
+ The hashes are stored in the object's meta hash, and look like this:
+
+ // Object's meta hash
+ {
+ listeners: { // variable name: `listenerSet`
+ "foo:changed": { // variable name: `targetSet`
+ [targetGuid]: { // variable name: `actionSet`
+ [methodGuid]: { // variable name: `action`
+ target: [Object object],
+ method: [Function function]
+ }
+ }
+ }
+ }
+ }
+
+*/
+
+// Gets the set of all actions, keyed on the guid of each action's
+// method property.
+/** @private */
+function actionSetFor(obj, eventName, target, writable) {
+ return metaPath(obj, ['listeners', eventName, guidFor(target)], writable);
+}
+
+// Gets the set of all targets, keyed on the guid of each action's
+// target property.
+/** @private */
+function targetSetFor(obj, eventName) {
+ var listenerSet = meta(obj, false).listeners;
+ if (!listenerSet) { return false; }
+
+ return listenerSet[eventName] || false;
+}
+
+// TODO: This knowledge should really be a part of the
+// meta system.
+var SKIP_PROPERTIES = { __ember_source__: true };
+
+/** @private */
+function iterateSet(obj, eventName, callback, params) {
+ var targetSet = targetSetFor(obj, eventName);
+ if (!targetSet) { return false; }
+ // Iterate through all elements of the target set
+ for(var targetGuid in targetSet) {
+ if (SKIP_PROPERTIES[targetGuid]) { continue; }
+
+ var actionSet = targetSet[targetGuid];
+ if (actionSet) {
+ // Iterate through the elements of the action set
+ for(var methodGuid in actionSet) {
+ if (SKIP_PROPERTIES[methodGuid]) { continue; }
+
+ var action = actionSet[methodGuid];
+ if (action) {
+ if (callback(action, params, obj) === true) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+}
+
+/** @private */
+function invokeAction(action, params, sender) {
+ var method = action.method, target = action.target;
+ // If there is no target, the target is the object
+ // on which the event was fired.
+ if (!target) { target = sender; }
+ if ('string' === typeof method) { method = target[method]; }
+ if (params) {
+ method.apply(target, params);
+ } else {
+ method.apply(target);
+ }
+}
+
+/**
+ The sendEvent arguments > 2 are passed to an event listener.
+
+ @memberOf Ember
+*/
+function addListener(obj, eventName, target, method) {
+ Ember.assert("You must pass at least an object and event name to Ember.addListener", !!obj && !!eventName);
+
+ if (!method && 'function' === typeof target) {
+ method = target;
+ target = null;
+ }
+
+ var actionSet = actionSetFor(obj, eventName, target, true),
+ methodGuid = guidFor(method);
+
+ if (!actionSet[methodGuid]) {
+ actionSet[methodGuid] = { target: target, method: method };
+ }
+
+ if ('function' === typeof obj.didAddListener) {
+ obj.didAddListener(eventName, target, method);
+ }
+}
+
+/** @memberOf Ember */
+function removeListener(obj, eventName, target, method) {
+ Ember.assert("You must pass at least an object and event name to Ember.removeListener", !!obj && !!eventName);
+
+ if (!method && 'function' === typeof target) {
+ method = target;
+ target = null;
+ }
+
+ var actionSet = actionSetFor(obj, eventName, target, true),
+ methodGuid = guidFor(method);
+
+ // we can't simply delete this parameter, because if we do, we might
+ // re-expose the property from the prototype chain.
+ if (actionSet && actionSet[methodGuid]) { actionSet[methodGuid] = null; }
+
+ if ('function' === typeof obj.didRemoveListener) {
+ obj.didRemoveListener(eventName, target, method);
+ }
+}
+
+// Suspend listener during callback.
+//
+// This should only be used by the target of the event listener
+// when it is taking an action that would cause the event, e.g.
+// an object might suspend its property change listener while it is
+// setting that property.
+/** @private */
+function suspendListener(obj, eventName, target, method, callback) {
+ if (!method && 'function' === typeof target) {
+ method = target;
+ target = null;
+ }
+
+ var actionSet = actionSetFor(obj, eventName, target, true),
+ methodGuid = guidFor(method),
+ action = actionSet && actionSet[methodGuid];
+
+ actionSet[methodGuid] = null;
+ try {
+ return callback.call(target);
+ } finally {
+ actionSet[methodGuid] = action;
+ }
+}
+
+// returns a list of currently watched events
+/** @memberOf Ember */
+function watchedEvents(obj) {
+ var listeners = meta(obj, false).listeners, ret = [];
+
+ if (listeners) {
+ for(var eventName in listeners) {
+ if (!SKIP_PROPERTIES[eventName] && listeners[eventName]) {
+ ret.push(eventName);
+ }
+ }
+ }
+ return ret;
+}
+
+/** @memberOf Ember */
+function sendEvent(obj, eventName, params) {
+ // first give object a chance to handle it
+ if (obj !== Ember && 'function' === typeof obj.sendEvent) {
+ obj.sendEvent(eventName, params);
+ }
+
+ iterateSet(obj, eventName, invokeAction, params);
+ return true;
+}
+
+/** @memberOf Ember */
+function deferEvent(obj, eventName, params) {
+ var actions = [];
+ iterateSet(obj, eventName, function (action) {
+ actions.push(action);
+ });
+
+ return function() {
+ if (obj.isDestroyed) { return; }
+
+ if (obj !== Ember && 'function' === typeof obj.sendEvent) {
+ obj.sendEvent(eventName, params);
+ }
+
+ for (var i=0, len=actions.length; i < len; ++i) {
+ invokeAction(actions[i], params, obj);
+ }
+ };
+}
+
+/** @memberOf Ember */
+function hasListeners(obj, eventName) {
+ if (iterateSet(obj, eventName, function() { return true; })) {
+ return true;
+ }
+
+ // no listeners! might as well clean this up so it is faster later.
+ var set = metaPath(obj, ['listeners'], true);
+ set[eventName] = null;
+
+ return false;
+}
+
+/** @memberOf Ember */
+function listenersFor(obj, eventName) {
+ var ret = [];
+ iterateSet(obj, eventName, function (action) {
+ ret.push([action.target, action.method]);
+ });
+ return ret;
+}
+
+Ember.addListener = addListener;
+Ember.removeListener = removeListener;
+Ember._suspendListener = suspendListener;
+Ember.sendEvent = sendEvent;
+Ember.hasListeners = hasListeners;
+Ember.watchedEvents = watchedEvents;
+Ember.listenersFor = listenersFor;
+Ember.deferEvent = deferEvent;
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2010 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+// Ember.Logger
+// Ember.watch.flushPending
+// Ember.beginPropertyChanges, Ember.endPropertyChanges
+// Ember.guidFor
+
+// ..........................................................
+// HELPERS
+//
+
+var slice = [].slice,
+ forEach = Ember.ArrayPolyfills.forEach;
+
+// invokes passed params - normalizing so you can pass target/func,
+// target/string or just func
+/** @private */
+function invoke(target, method, args, ignore) {
+
+ if (method === undefined) {
+ method = target;
+ target = undefined;
+ }
+
+ if ('string' === typeof method) { method = target[method]; }
+ if (args && ignore > 0) {
+ args = args.length > ignore ? slice.call(args, ignore) : null;
+ }
+
+ // Unfortunately in some browsers we lose the backtrace if we rethrow the existing error,
+ // so in the event that we don't have an `onerror` handler we don't wrap in a try/catch
+ if ('function' === typeof Ember.onerror) {
+ try {
+ // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
+ return method.apply(target || this, args || []);
+ } catch (error) {
+ Ember.onerror(error);
+ }
+ } else {
+ // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
+ return method.apply(target || this, args || []);
+ }
+}
+
+
+// ..........................................................
+// RUNLOOP
+//
+
+var timerMark; // used by timers...
+
+/** @private */
+var RunLoop = function(prev) {
+ this._prev = prev || null;
+ this.onceTimers = {};
+};
+
+RunLoop.prototype = {
+ end: function() {
+ this.flush();
+ },
+
+ prev: function() {
+ return this._prev;
+ },
+
+ // ..........................................................
+ // Delayed Actions
+ //
+
+ schedule: function(queueName, target, method) {
+ var queues = this._queues, queue;
+ if (!queues) { queues = this._queues = {}; }
+ queue = queues[queueName];
+ if (!queue) { queue = queues[queueName] = []; }
+
+ var args = arguments.length > 3 ? slice.call(arguments, 3) : null;
+ queue.push({ target: target, method: method, args: args });
+ return this;
+ },
+
+ flush: function(queueName) {
+ var queueNames, idx, len, queue, log;
+
+ if (!this._queues) { return this; } // nothing to do
+
+ function iter(item) {
+ invoke(item.target, item.method, item.args);
+ }
+
+ Ember.watch.flushPending(); // make sure all chained watchers are setup
+
+ if (queueName) {
+ while (this._queues && (queue = this._queues[queueName])) {
+ this._queues[queueName] = null;
+
+ // the sync phase is to allow property changes to propagate. don't
+ // invoke observers until that is finished.
+ if (queueName === 'sync') {
+ log = Ember.LOG_BINDINGS;
+ if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }
+
+ Ember.beginPropertyChanges();
+ try {
+ forEach.call(queue, iter);
+ } finally {
+ Ember.endPropertyChanges();
+ }
+
+ if (log) { Ember.Logger.log('End: Flush Sync Queue'); }
+
+ } else {
+ forEach.call(queue, iter);
+ }
+ }
+
+ } else {
+ queueNames = Ember.run.queues;
+ len = queueNames.length;
+ idx = 0;
+
+ outerloop:
+ while (idx < len) {
+ queueName = queueNames[idx];
+ queue = this._queues && this._queues[queueName];
+ delete this._queues[queueName];
+
+ if (queue) {
+ // the sync phase is to allow property changes to propagate. don't
+ // invoke observers until that is finished.
+ if (queueName === 'sync') {
+ log = Ember.LOG_BINDINGS;
+ if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }
+
+ Ember.beginPropertyChanges();
+ try {
+ forEach.call(queue, iter);
+ } finally {
+ Ember.endPropertyChanges();
+ }
+
+ if (log) { Ember.Logger.log('End: Flush Sync Queue'); }
+ } else {
+ forEach.call(queue, iter);
+ }
+ }
+
+ // Loop through prior queues
+ for (var i = 0; i <= idx; i++) {
+ if (this._queues && this._queues[queueNames[i]]) {
+ // Start over at the first queue with contents
+ idx = i;
+ continue outerloop;
+ }
+ }
+
+ idx++;
+ }
+ }
+
+ timerMark = null;
+
+ return this;
+ }
+
+};
+
+Ember.RunLoop = RunLoop;
+
+// ..........................................................
+// Ember.run - this is ideally the only public API the dev sees
+//
+/**
+* @namespace Ember.run is both a function and a namespace for
+* RunLoop-related functions.
+* @name Ember.run
+*/
+
+/**
+ Runs the passed target and method inside of a RunLoop, ensuring any
+ deferred actions including bindings and views updates are flushed at the
+ end.
+
+ Normally you should not need to invoke this method yourself. However if
+ you are implementing raw event handlers when interfacing with other
+ libraries or plugins, you should probably wrap all of your code inside this
+ call.
+
+ Ember.run(function(){
+ // code to be execute within a RunLoop
+ });
+
+ @name run
+ @methodOf Ember.run
+ @param {Object} target
+ (Optional) target of method to call
+
+ @param {Function|String} method
+ Method to invoke. May be a function or a string. If you pass a string
+ then it will be looked up on the passed target.
+
+ @param {Object...} args
+ Any additional arguments you wish to pass to the method.
+
+ @returns {Object} return value from invoking the passed function.
+*/
+Ember.run = function(target, method) {
+ var ret, loop;
+ run.begin();
+ try {
+ if (target || method) { ret = invoke(target, method, arguments, 2); }
+ } finally {
+ run.end();
+ }
+ return ret;
+};
+
+/** @private */
+var run = Ember.run;
+
+
+/**
+ Begins a new RunLoop. Any deferred actions invoked after the begin will
+ be buffered until you invoke a matching call to Ember.run.end(). This is
+ an lower-level way to use a RunLoop instead of using Ember.run().
+
+ Ember.run.begin();
+ // code to be execute within a RunLoop
+ Ember.run.end();
+
+
+ @returns {void}
+*/
+Ember.run.begin = function() {
+ run.currentRunLoop = new RunLoop(run.currentRunLoop);
+};
+
+/**
+ Ends a RunLoop. This must be called sometime after you call Ember.run.begin()
+ to flush any deferred actions. This is a lower-level way to use a RunLoop
+ instead of using Ember.run().
+
+ Ember.run.begin();
+ // code to be execute within a RunLoop
+ Ember.run.end();
+
+ @returns {void}
+*/
+Ember.run.end = function() {
+ Ember.assert('must have a current run loop', run.currentRunLoop);
+ try {
+ run.currentRunLoop.end();
+ }
+ finally {
+ run.currentRunLoop = run.currentRunLoop.prev();
+ }
+};
+
+/**
+ Array of named queues. This array determines the order in which queues
+ are flushed at the end of the RunLoop. You can define your own queues by
+ simply adding the queue name to this array. Normally you should not need
+ to inspect or modify this property.
+
+ @type Array
+ @default ['sync', 'actions', 'destroy', 'timers']
+*/
+Ember.run.queues = ['sync', 'actions', 'destroy', 'timers'];
+
+/**
+ Adds the passed target/method and any optional arguments to the named
+ queue to be executed at the end of the RunLoop. If you have not already
+ started a RunLoop when calling this method one will be started for you
+ automatically.
+
+ At the end of a RunLoop, any methods scheduled in this way will be invoked.
+ Methods will be invoked in an order matching the named queues defined in
+ the run.queues property.
+
+ Ember.run.schedule('timers', this, function(){
+ // this will be executed at the end of the RunLoop, when timers are run
+ console.log("scheduled on timers queue");
+ });
+ Ember.run.schedule('sync', this, function(){
+ // this will be executed at the end of the RunLoop, when bindings are synced
+ console.log("scheduled on sync queue");
+ });
+ // Note the functions will be run in order based on the run queues order. Output would be:
+ // scheduled on sync queue
+ // scheduled on timers queue
+
+ @param {String} queue
+ The name of the queue to schedule against. Default queues are 'sync' and
+ 'actions'
+
+ @param {Object} target
+ (Optional) target object to use as the context when invoking a method.
+
+ @param {String|Function} method
+ The method to invoke. If you pass a string it will be resolved on the
+ target object at the time the scheduled item is invoked allowing you to
+ change the target function.
+
+ @param {Object} arguments...
+ Optional arguments to be passed to the queued method.
+
+ @returns {void}
+*/
+Ember.run.schedule = function(queue, target, method) {
+ var loop = run.autorun();
+ loop.schedule.apply(loop, arguments);
+};
+
+var scheduledAutorun;
+/** @private */
+function autorun() {
+ scheduledAutorun = null;
+ if (run.currentRunLoop) { run.end(); }
+}
+
+// Used by global test teardown
+/** @private */
+Ember.run.hasScheduledTimers = function() {
+ return !!(scheduledAutorun || scheduledLater || scheduledNext);
+};
+
+// Used by global test teardown
+/** @private */
+Ember.run.cancelTimers = function () {
+ if (scheduledAutorun) {
+ clearTimeout(scheduledAutorun);
+ scheduledAutorun = null;
+ }
+ if (scheduledLater) {
+ clearTimeout(scheduledLater);
+ scheduledLater = null;
+ }
+ if (scheduledNext) {
+ clearTimeout(scheduledNext);
+ scheduledNext = null;
+ }
+ timers = {};
+};
+
+/**
+ Begins a new RunLoop if necessary and schedules a timer to flush the
+ RunLoop at a later time. This method is used by parts of Ember to
+ ensure the RunLoop always finishes. You normally do not need to call this
+ method directly. Instead use Ember.run().
+
+ Ember.run.autorun();
+
+ @returns {Ember.RunLoop} the new current RunLoop
+*/
+Ember.run.autorun = function() {
+ if (!run.currentRunLoop) {
+ Ember.assert("You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run", !Ember.testing);
+
+ run.begin();
+
+ if (!scheduledAutorun) {
+ scheduledAutorun = setTimeout(autorun, 1);
+ }
+ }
+
+ return run.currentRunLoop;
+};
+
+/**
+ Immediately flushes any events scheduled in the 'sync' queue. Bindings
+ use this queue so this method is a useful way to immediately force all
+ bindings in the application to sync.
+
+ You should call this method anytime you need any changed state to propagate
+ throughout the app immediately without repainting the UI.
+
+ Ember.run.sync();
+
+ @returns {void}
+*/
+Ember.run.sync = function() {
+ run.autorun();
+ run.currentRunLoop.flush('sync');
+};
+
+// ..........................................................
+// TIMERS
+//
+
+var timers = {}; // active timers...
+
+var scheduledLater;
+/** @private */
+function invokeLaterTimers() {
+ scheduledLater = null;
+ var now = (+ new Date()), earliest = -1;
+ for (var key in timers) {
+ if (!timers.hasOwnProperty(key)) { continue; }
+ var timer = timers[key];
+ if (timer && timer.expires) {
+ if (now >= timer.expires) {
+ delete timers[key];
+ invoke(timer.target, timer.method, timer.args, 2);
+ } else {
+ if (earliest<0 || (timer.expires < earliest)) earliest=timer.expires;
+ }
+ }
+ }
+
+ // schedule next timeout to fire...
+ if (earliest > 0) { scheduledLater = setTimeout(invokeLaterTimers, earliest-(+ new Date())); }
+}
+
+/**
+ Invokes the passed target/method and optional arguments after a specified
+ period if time. The last parameter of this method must always be a number
+ of milliseconds.
+
+ You should use this method whenever you need to run some action after a
+ period of time instead of using setTimeout(). This method will ensure that
+ items that expire during the same script execution cycle all execute
+ together, which is often more efficient than using a real setTimeout.
+
+ Ember.run.later(myContext, function(){
+ // code here will execute within a RunLoop in about 500ms with this == myContext
+ }, 500);
+
+ @param {Object} target
+ (optional) target of method to invoke
+
+ @param {Function|String} method
+ The method to invoke. If you pass a string it will be resolved on the
+ target at the time the method is invoked.
+
+ @param {Object...} args
+ Optional arguments to pass to the timeout.
+
+ @param {Number} wait
+ Number of milliseconds to wait.
+
+ @returns {String} a string you can use to cancel the timer in Ember.run.cancel() later.
+*/
+Ember.run.later = function(target, method) {
+ var args, expires, timer, guid, wait;
+
+ // setTimeout compatibility...
+ if (arguments.length===2 && 'function' === typeof target) {
+ wait = method;
+ method = target;
+ target = undefined;
+ args = [target, method];
+ } else {
+ args = slice.call(arguments);
+ wait = args.pop();
+ }
+
+ expires = (+ new Date()) + wait;
+ timer = { target: target, method: method, expires: expires, args: args };
+ guid = Ember.guidFor(timer);
+ timers[guid] = timer;
+ run.once(timers, invokeLaterTimers);
+ return guid;
+};
+
+/** @private */
+function invokeOnceTimer(guid, onceTimers) {
+ if (onceTimers[this.tguid]) { delete onceTimers[this.tguid][this.mguid]; }
+ if (timers[guid]) { invoke(this.target, this.method, this.args, 2); }
+ delete timers[guid];
+}
+
+/**
+ Schedules an item to run one time during the current RunLoop. Calling
+ this method with the same target/method combination will have no effect.
+
+ Note that although you can pass optional arguments these will not be
+ considered when looking for duplicates. New arguments will replace previous
+ calls.
+
+ Ember.run(function(){
+ var doFoo = function() { foo(); }
+ Ember.run.once(myContext, doFoo);
+ Ember.run.once(myContext, doFoo);
+ // doFoo will only be executed once at the end of the RunLoop
+ });
+
+ @param {Object} target
+ (optional) target of method to invoke
+
+ @param {Function|String} method
+ The method to invoke. If you pass a string it will be resolved on the
+ target at the time the method is invoked.
+
+ @param {Object...} args
+ Optional arguments to pass to the timeout.
+
+
+ @returns {Object} timer
+*/
+Ember.run.once = function(target, method) {
+ var tguid = Ember.guidFor(target),
+ mguid = Ember.guidFor(method),
+ onceTimers = run.autorun().onceTimers,
+ guid = onceTimers[tguid] && onceTimers[tguid][mguid],
+ timer;
+
+ if (guid && timers[guid]) {
+ timers[guid].args = slice.call(arguments); // replace args
+ } else {
+ timer = {
+ target: target,
+ method: method,
+ args: slice.call(arguments),
+ tguid: tguid,
+ mguid: mguid
+ };
+
+ guid = Ember.guidFor(timer);
+ timers[guid] = timer;
+ if (!onceTimers[tguid]) { onceTimers[tguid] = {}; }
+ onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once
+
+ run.schedule('actions', timer, invokeOnceTimer, guid, onceTimers);
+ }
+
+ return guid;
+};
+
+var scheduledNext;
+/** @private */
+function invokeNextTimers() {
+ scheduledNext = null;
+ for(var key in timers) {
+ if (!timers.hasOwnProperty(key)) { continue; }
+ var timer = timers[key];
+ if (timer.next) {
+ delete timers[key];
+ invoke(timer.target, timer.method, timer.args, 2);
+ }
+ }
+}
+
+/**
+ Schedules an item to run after control has been returned to the system.
+ This is often equivalent to calling setTimeout(function...,1).
+
+ Ember.run.next(myContext, function(){
+ // code to be executed in the next RunLoop, which will be scheduled after the current one
+ });
+
+ @param {Object} target
+ (optional) target of method to invoke
+
+ @param {Function|String} method
+ The method to invoke. If you pass a string it will be resolved on the
+ target at the time the method is invoked.
+
+ @param {Object...} args
+ Optional arguments to pass to the timeout.
+
+ @returns {Object} timer
+*/
+Ember.run.next = function(target, method) {
+ var guid,
+ timer = {
+ target: target,
+ method: method,
+ args: slice.call(arguments),
+ next: true
+ };
+
+ guid = Ember.guidFor(timer);
+ timers[guid] = timer;
+
+ if (!scheduledNext) { scheduledNext = setTimeout(invokeNextTimers, 1); }
+ return guid;
+};
+
+/**
+ Cancels a scheduled item. Must be a value returned by `Ember.run.later()`,
+ `Ember.run.once()`, or `Ember.run.next()`.
+
+ var runNext = Ember.run.next(myContext, function(){
+ // will not be executed
+ });
+ Ember.run.cancel(runNext);
+
+ var runLater = Ember.run.later(myContext, function(){
+ // will not be executed
+ }, 500);
+ Ember.run.cancel(runLater);
+
+ var runOnce = Ember.run.once(myContext, function(){
+ // will not be executed
+ });
+ Ember.run.cancel(runOnce);
+
+ @param {Object} timer
+ Timer object to cancel
+
+ @returns {void}
+*/
+Ember.run.cancel = function(timer) {
+ delete timers[timer];
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+// Ember.Logger
+// get, set, trySet
+// guidFor, isArray, meta
+// addObserver, removeObserver
+// Ember.run.schedule
+// ..........................................................
+// CONSTANTS
+//
+
+/**
+ @static
+
+ Debug parameter you can turn on. This will log all bindings that fire to
+ the console. This should be disabled in production code. Note that you
+ can also enable this from the console or temporarily.
+
+ @type Boolean
+ @default false
+*/
+Ember.LOG_BINDINGS = false || !!Ember.ENV.LOG_BINDINGS;
+
+var get = Ember.get,
+ set = Ember.set,
+ guidFor = Ember.guidFor,
+ isGlobalPath = Ember.isGlobalPath;
+
+
+/** @private */
+function getWithGlobals(obj, path) {
+ return get(isGlobalPath(path) ? window : obj, path);
+}
+
+// ..........................................................
+// BINDING
+//
+
+/** @private */
+var Binding = function(toPath, fromPath) {
+ this._direction = 'fwd';
+ this._from = fromPath;
+ this._to = toPath;
+ this._directionMap = Ember.Map.create();
+};
+
+Binding.prototype = /** @scope Ember.Binding.prototype */ {
+ /**
+ This copies the Binding so it can be connected to another object.
+ @returns {Ember.Binding}
+ */
+ copy: function () {
+ var copy = new Binding(this._to, this._from);
+ if (this._oneWay) { copy._oneWay = true; }
+ return copy;
+ },
+
+ // ..........................................................
+ // CONFIG
+ //
+
+ /**
+ This will set "from" property path to the specified value. It will not
+ attempt to resolve this property path to an actual object until you
+ connect the binding.
+
+ The binding will search for the property path starting at the root object
+ you pass when you connect() the binding. It follows the same rules as
+ `get()` - see that method for more information.
+
+ @param {String} propertyPath the property path to connect to
+ @returns {Ember.Binding} receiver
+ */
+ from: function(path) {
+ this._from = path;
+ return this;
+ },
+
+ /**
+ This will set the "to" property path to the specified value. It will not
+ attempt to resolve this property path to an actual object until you
+ connect the binding.
+
+ The binding will search for the property path starting at the root object
+ you pass when you connect() the binding. It follows the same rules as
+ `get()` - see that method for more information.
+
+ @param {String|Tuple} propertyPath A property path or tuple
+ @returns {Ember.Binding} this
+ */
+ to: function(path) {
+ this._to = path;
+ return this;
+ },
+
+ /**
+ Configures the binding as one way. A one-way binding will relay changes
+ on the "from" side to the "to" side, but not the other way around. This
+ means that if you change the "to" side directly, the "from" side may have
+ a different value.
+
+ @returns {Ember.Binding} receiver
+ */
+ oneWay: function() {
+ this._oneWay = true;
+ return this;
+ },
+
+ /** @private */
+ toString: function() {
+ var oneWay = this._oneWay ? '[oneWay]' : '';
+ return "Ember.Binding<" + guidFor(this) + ">(" + this._from + " -> " + this._to + ")" + oneWay;
+ },
+
+ // ..........................................................
+ // CONNECT AND SYNC
+ //
+
+ /**
+ Attempts to connect this binding instance so that it can receive and relay
+ changes. This method will raise an exception if you have not set the
+ from/to properties yet.
+
+ @param {Object} obj The root object for this binding.
+ @returns {Ember.Binding} this
+ */
+ connect: function(obj) {
+ Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
+
+ var fromPath = this._from, toPath = this._to;
+ Ember.trySet(obj, toPath, getWithGlobals(obj, fromPath));
+
+ // add an observer on the object to be notified when the binding should be updated
+ Ember.addObserver(obj, fromPath, this, this.fromDidChange);
+
+ // if the binding is a two-way binding, also set up an observer on the target
+ if (!this._oneWay) { Ember.addObserver(obj, toPath, this, this.toDidChange); }
+
+ this._readyToSync = true;
+
+ return this;
+ },
+
+ /**
+ Disconnects the binding instance. Changes will no longer be relayed. You
+ will not usually need to call this method.
+
+ @param {Object} obj
+ The root object you passed when connecting the binding.
+
+ @returns {Ember.Binding} this
+ */
+ disconnect: function(obj) {
+ Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);
+
+ var twoWay = !this._oneWay;
+
+ // remove an observer on the object so we're no longer notified of
+ // changes that should update bindings.
+ Ember.removeObserver(obj, this._from, this, this.fromDidChange);
+
+ // if the binding is two-way, remove the observer from the target as well
+ if (twoWay) { Ember.removeObserver(obj, this._to, this, this.toDidChange); }
+
+ this._readyToSync = false; // disable scheduled syncs...
+ return this;
+ },
+
+ // ..........................................................
+ // PRIVATE
+ //
+
+ /** @private - called when the from side changes */
+ fromDidChange: function(target) {
+ this._scheduleSync(target, 'fwd');
+ },
+
+ /** @private - called when the to side changes */
+ toDidChange: function(target) {
+ this._scheduleSync(target, 'back');
+ },
+
+ /** @private */
+ _scheduleSync: function(obj, dir) {
+ var directionMap = this._directionMap;
+ var existingDir = directionMap.get(obj);
+
+ // if we haven't scheduled the binding yet, schedule it
+ if (!existingDir) {
+ Ember.run.schedule('sync', this, this._sync, obj);
+ directionMap.set(obj, dir);
+ }
+
+ // If both a 'back' and 'fwd' sync have been scheduled on the same object,
+ // default to a 'fwd' sync so that it remains deterministic.
+ if (existingDir === 'back' && dir === 'fwd') {
+ directionMap.set(obj, 'fwd');
+ }
+ },
+
+ /** @private */
+ _sync: function(obj) {
+ var log = Ember.LOG_BINDINGS;
+
+ // don't synchronize destroyed objects or disconnected bindings
+ if (obj.isDestroyed || !this._readyToSync) { return; }
+
+ // get the direction of the binding for the object we are
+ // synchronizing from
+ var directionMap = this._directionMap;
+ var direction = directionMap.get(obj);
+
+ var fromPath = this._from, toPath = this._to;
+
+ directionMap.remove(obj);
+
+ // if we're synchronizing from the remote object...
+ if (direction === 'fwd') {
+ var fromValue = getWithGlobals(obj, this._from);
+ if (log) {
+ Ember.Logger.log(' ', this.toString(), '->', fromValue, obj);
+ }
+ if (this._oneWay) {
+ Ember.trySet(obj, toPath, fromValue);
+ } else {
+ Ember._suspendObserver(obj, toPath, this, this.toDidChange, function () {
+ Ember.trySet(obj, toPath, fromValue);
+ });
+ }
+ // if we're synchronizing *to* the remote object
+ } else if (direction === 'back') {
+ var toValue = get(obj, this._to);
+ if (log) {
+ Ember.Logger.log(' ', this.toString(), '<-', toValue, obj);
+ }
+ Ember._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {
+ Ember.trySet(Ember.isGlobalPath(fromPath) ? window : obj, fromPath, toValue);
+ });
+ }
+ }
+
+};
+
+/** @private */
+function mixinProperties(to, from) {
+ for (var key in from) {
+ if (from.hasOwnProperty(key)) {
+ to[key] = from[key];
+ }
+ }
+}
+
+mixinProperties(Binding,
+/** @scope Ember.Binding */ {
+
+ /**
+ @see Ember.Binding.prototype.from
+ */
+ from: function() {
+ var C = this, binding = new C();
+ return binding.from.apply(binding, arguments);
+ },
+
+ /**
+ @see Ember.Binding.prototype.to
+ */
+ to: function() {
+ var C = this, binding = new C();
+ return binding.to.apply(binding, arguments);
+ },
+
+ /**
+ Creates a new Binding instance and makes it apply in a single direction.
+ A one-way binding will relay changes on the "from" side object (supplies
+ as the `from` argument) the "to" side, but not the other way around.
+ This means that if you change the "to" side directly, the "from" side may have
+ a different value.
+
+ @param {String} from from path.
+ @param {Boolean} [flag] (Optional) passing nothing here will make the binding oneWay. You can
+ instead pass false to disable oneWay, making the binding two way again.
+
+ @see Ember.Binding.prototype.oneWay
+ */
+ oneWay: function(from, flag) {
+ var C = this, binding = new C(null, from);
+ return binding.oneWay(flag);
+ }
+
+});
+
+/**
+ @class
+
+ An Ember.Binding connects the properties of two objects so that whenever the
+ value of one property changes, the other property will be changed also.
+
+ ## Automatic Creation of Bindings with `/^*Binding/`-named Properties
+ You do not usually create Binding objects directly but instead describe
+ bindings in your class or object definition using automatic binding detection.
+
+ Properties ending in a `Binding` suffix will be converted to Ember.Binding instances.
+ The value of this property should be a string representing a path to another object or
+ a custom binding instanced created using Binding helpers (see "Customizing Your Bindings"):
+
+ valueBinding: "MyApp.someController.title"
+
+ This will create a binding from `MyApp.someController.title` to the `value`
+ property of your object instance automatically. Now the two values will be
+ kept in sync.
+
+ ## One Way Bindings
+
+ One especially useful binding customization you can use is the `oneWay()`
+ helper. This helper tells Ember that you are only interested in
+ receiving changes on the object you are binding from. For example, if you
+ are binding to a preference and you want to be notified if the preference
+ has changed, but your object will not be changing the preference itself, you
+ could do:
+
+ bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
+
+ This way if the value of MyApp.preferencesController.bigTitles changes the
+ "bigTitles" property of your object will change also. However, if you
+ change the value of your "bigTitles" property, it will not update the
+ preferencesController.
+
+ One way bindings are almost twice as fast to setup and twice as fast to
+ execute because the binding only has to worry about changes to one side.
+
+ You should consider using one way bindings anytime you have an object that
+ may be created frequently and you do not intend to change a property; only
+ to monitor it for changes. (such as in the example above).
+
+ ## Adding Bindings Manually
+
+ All of the examples above show you how to configure a custom binding, but
+ the result of these customizations will be a binding template, not a fully
+ active Binding instance. The binding will actually become active only when you
+ instantiate the object the binding belongs to. It is useful however, to
+ understand what actually happens when the binding is activated.
+
+ For a binding to function it must have at least a "from" property and a "to"
+ property. The from property path points to the object/key that you want to
+ bind from while the to path points to the object/key you want to bind to.
+
+ When you define a custom binding, you are usually describing the property
+ you want to bind from (such as "MyApp.someController.value" in the examples
+ above). When your object is created, it will automatically assign the value
+ you want to bind "to" based on the name of your binding key. In the
+ examples above, during init, Ember objects will effectively call
+ something like this on your binding:
+
+ binding = Ember.Binding.from(this.valueBinding).to("value");
+
+ This creates a new binding instance based on the template you provide, and
+ sets the to path to the "value" property of the new object. Now that the
+ binding is fully configured with a "from" and a "to", it simply needs to be
+ connected to become active. This is done through the connect() method:
+
+ binding.connect(this);
+
+ Note that when you connect a binding you pass the object you want it to be
+ connected to. This object will be used as the root for both the from and
+ to side of the binding when inspecting relative paths. This allows the
+ binding to be automatically inherited by subclassed objects as well.
+
+ Now that the binding is connected, it will observe both the from and to side
+ and relay changes.
+
+ If you ever needed to do so (you almost never will, but it is useful to
+ understand this anyway), you could manually create an active binding by
+ using the Ember.bind() helper method. (This is the same method used by
+ to setup your bindings on objects):
+
+ Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
+
+ Both of these code fragments have the same effect as doing the most friendly
+ form of binding creation like so:
+
+ MyApp.anotherObject = Ember.Object.create({
+ valueBinding: "MyApp.someController.value",
+
+ // OTHER CODE FOR THIS OBJECT...
+
+ });
+
+ Ember's built in binding creation method makes it easy to automatically
+ create bindings for you. You should always use the highest-level APIs
+ available, even if you understand how it works underneath.
+
+ @since Ember 0.9
+*/
+Ember.Binding = Binding;
+
+/**
+ Global helper method to create a new binding. Just pass the root object
+ along with a to and from path to create and connect the binding.
+
+ @param {Object} obj
+ The root object of the transform.
+
+ @param {String} to
+ The path to the 'to' side of the binding. Must be relative to obj.
+
+ @param {String} from
+ The path to the 'from' side of the binding. Must be relative to obj or
+ a global path.
+
+ @returns {Ember.Binding} binding instance
+*/
+Ember.bind = function(obj, to, from) {
+ return new Ember.Binding(to, from).connect(obj);
+};
+
+Ember.oneWay = function(obj, to, from) {
+ return new Ember.Binding(to, from).oneWay().connect(obj);
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var Mixin, REQUIRED, Alias,
+ classToString, superClassString,
+ a_map = Ember.ArrayPolyfills.map,
+ a_indexOf = Ember.ArrayPolyfills.indexOf,
+ a_forEach = Ember.ArrayPolyfills.forEach,
+ a_slice = [].slice,
+ EMPTY_META = {}, // dummy for non-writable meta
+ META_SKIP = { __emberproto__: true, __ember_count__: true },
+ o_create = Ember.create,
+ defineProperty = Ember.defineProperty,
+ guidFor = Ember.guidFor;
+
+/** @private */
+function mixinsMeta(obj) {
+ var m = Ember.meta(obj, true), ret = m.mixins;
+ if (!ret) {
+ ret = m.mixins = { __emberproto__: obj };
+ } else if (ret.__emberproto__ !== obj) {
+ ret = m.mixins = o_create(ret);
+ ret.__emberproto__ = obj;
+ }
+ return ret;
+}
+
+/** @private */
+function initMixin(mixin, args) {
+ if (args && args.length > 0) {
+ mixin.mixins = a_map.call(args, function(x) {
+ if (x instanceof Mixin) { return x; }
+
+ // Note: Manually setup a primitive mixin here. This is the only
+ // way to actually get a primitive mixin. This way normal creation
+ // of mixins will give you combined mixins...
+ var mixin = new Mixin();
+ mixin.properties = x;
+ return mixin;
+ });
+ }
+ return mixin;
+}
+
+/** @private */
+function isMethod(obj) {
+ return 'function' === typeof obj &&
+ obj.isMethod !== false &&
+ obj !== Boolean && obj !== Object && obj !== Number && obj !== Array && obj !== Date && obj !== String;
+}
+
+/** @private */
+function mergeMixins(mixins, m, descs, values, base) {
+ var len = mixins.length, idx, mixin, guid, props, value, key, ovalue, concats;
+
+ /** @private */
+ function removeKeys(keyName) {
+ delete descs[keyName];
+ delete values[keyName];
+ }
+
+ for(idx=0; idx < len; idx++) {
+ mixin = mixins[idx];
+ Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
+
+ if (mixin instanceof Mixin) {
+ guid = guidFor(mixin);
+ if (m[guid]) { continue; }
+ m[guid] = mixin;
+ props = mixin.properties;
+ } else {
+ props = mixin; // apply anonymous mixin properties
+ }
+
+ if (props) {
+ // reset before adding each new mixin to pickup concats from previous
+ concats = values.concatenatedProperties || base.concatenatedProperties;
+ if (props.concatenatedProperties) {
+ concats = concats ? concats.concat(props.concatenatedProperties) : props.concatenatedProperties;
+ }
+
+ for (key in props) {
+ if (!props.hasOwnProperty(key)) { continue; }
+ value = props[key];
+ if (value instanceof Ember.Descriptor) {
+ if (value === REQUIRED && descs[key]) { continue; }
+
+ descs[key] = value;
+ values[key] = undefined;
+ } else {
+ // impl super if needed...
+ if (isMethod(value)) {
+ ovalue = descs[key] === undefined && values[key];
+ if (!ovalue) { ovalue = base[key]; }
+ if ('function' !== typeof ovalue) { ovalue = null; }
+ if (ovalue) {
+ var o = value.__ember_observes__, ob = value.__ember_observesBefore__;
+ value = Ember.wrap(value, ovalue);
+ value.__ember_observes__ = o;
+ value.__ember_observesBefore__ = ob;
+ }
+ } else if ((concats && a_indexOf.call(concats, key) >= 0) || key === 'concatenatedProperties') {
+ var baseValue = values[key] || base[key];
+ value = baseValue ? baseValue.concat(value) : Ember.makeArray(value);
+ }
+
+ descs[key] = undefined;
+ values[key] = value;
+ }
+ }
+
+ // manually copy toString() because some JS engines do not enumerate it
+ if (props.hasOwnProperty('toString')) {
+ base.toString = props.toString;
+ }
+
+ } else if (mixin.mixins) {
+ mergeMixins(mixin.mixins, m, descs, values, base);
+ if (mixin._without) { a_forEach.call(mixin._without, removeKeys); }
+ }
+ }
+}
+
+/** @private */
+function writableReq(obj) {
+ var m = Ember.meta(obj), req = m.required;
+ if (!req || req.__emberproto__ !== obj) {
+ req = m.required = req ? o_create(req) : { __ember_count__: 0 };
+ req.__emberproto__ = obj;
+ }
+ return req;
+}
+
+var IS_BINDING = Ember.IS_BINDING = /^.+Binding$/;
+
+/** @private */
+function detectBinding(obj, key, value, m) {
+ if (IS_BINDING.test(key)) {
+ var bindings = m.bindings;
+ if (!bindings) {
+ bindings = m.bindings = { __emberproto__: obj };
+ } else if (bindings.__emberproto__ !== obj) {
+ bindings = m.bindings = o_create(m.bindings);
+ bindings.__emberproto__ = obj;
+ }
+ bindings[key] = value;
+ }
+}
+
+/** @private */
+function connectBindings(obj, m) {
+ // TODO Mixin.apply(instance) should disconnect binding if exists
+ var bindings = m.bindings, key, binding, to;
+ if (bindings) {
+ for (key in bindings) {
+ binding = key !== '__emberproto__' && bindings[key];
+ if (binding) {
+ to = key.slice(0, -7); // strip Binding off end
+ if (binding instanceof Ember.Binding) {
+ binding = binding.copy(); // copy prototypes' instance
+ binding.to(to);
+ } else { // binding is string path
+ binding = new Ember.Binding(to, binding);
+ }
+ binding.connect(obj);
+ obj[key] = binding;
+ }
+ }
+ // mark as applied
+ m.bindings = { __emberproto__: obj };
+ }
+}
+
+function finishPartial(obj, m) {
+ connectBindings(obj, m || Ember.meta(obj));
+ return obj;
+}
+
+/** @private */
+function applyMixin(obj, mixins, partial) {
+ var descs = {}, values = {}, m = Ember.meta(obj), req = m.required,
+ key, value, desc, prevValue, paths, len, idx;
+
+ // Go through all mixins and hashes passed in, and:
+ //
+ // * Handle concatenated properties
+ // * Set up _super wrapping if necessary
+ // * Set up computed property descriptors
+ // * Copying `toString` in broken browsers
+ mergeMixins(mixins, mixinsMeta(obj), descs, values, obj);
+
+ for(key in values) {
+ if (key === 'contructor') { continue; }
+ if (!values.hasOwnProperty(key)) { continue; }
+
+ desc = descs[key];
+ value = values[key];
+
+ if (desc === REQUIRED) {
+ if (!(key in obj)) {
+ Ember.assert('Required property not defined: '+key, !!partial);
+
+ // for partial applies add to hash of required keys
+ req = writableReq(obj);
+ req.__ember_count__++;
+ req[key] = true;
+ }
+ } else {
+ while (desc && desc instanceof Alias) {
+ var altKey = desc.methodName;
+ if (descs[altKey] || values[altKey]) {
+ value = values[altKey];
+ desc = descs[altKey];
+ } else if (m.descs[altKey]) {
+ desc = m.descs[altKey];
+ value = undefined;
+ } else {
+ desc = undefined;
+ value = obj[altKey];
+ }
+ }
+
+ if (desc === undefined && value === undefined) { continue; }
+
+ prevValue = obj[key];
+
+ if ('function' === typeof prevValue) {
+ if ((paths = prevValue.__ember_observesBefore__)) {
+ len = paths.length;
+ for (idx=0; idx < len; idx++) {
+ Ember.removeBeforeObserver(obj, paths[idx], null, key);
+ }
+ } else if ((paths = prevValue.__ember_observes__)) {
+ len = paths.length;
+ for (idx=0; idx < len; idx++) {
+ Ember.removeObserver(obj, paths[idx], null, key);
+ }
+ }
+ }
+
+ detectBinding(obj, key, value, m);
+
+ defineProperty(obj, key, desc, value, m);
+
+ if ('function' === typeof value) {
+ if (paths = value.__ember_observesBefore__) {
+ len = paths.length;
+ for (idx=0; idx < len; idx++) {
+ Ember.addBeforeObserver(obj, paths[idx], null, key);
+ }
+ } else if (paths = value.__ember_observes__) {
+ len = paths.length;
+ for (idx=0; idx < len; idx++) {
+ Ember.addObserver(obj, paths[idx], null, key);
+ }
+ }
+ }
+
+ if (req && req[key]) {
+ req = writableReq(obj);
+ req.__ember_count__--;
+ req[key] = false;
+ }
+ }
+ }
+
+ if (!partial) { // don't apply to prototype
+ finishPartial(obj, m);
+ }
+
+ // Make sure no required attrs remain
+ if (!partial && req && req.__ember_count__>0) {
+ var keys = [];
+ for (key in req) {
+ if (META_SKIP[key]) { continue; }
+ keys.push(key);
+ }
+ // TODO: Remove surrounding if clause from production build
+ Ember.assert('Required properties not defined: '+keys.join(','));
+ }
+ return obj;
+}
+
+Ember.mixin = function(obj) {
+ var args = a_slice.call(arguments, 1);
+ applyMixin(obj, args, false);
+ return obj;
+};
+
+/**
+ @class
+
+ The `Ember.Mixin` class allows you to create mixins, whose properties can be
+ added to other classes. For instance,
+
+ App.Editable = Ember.Mixin.create({
+ edit: function() {
+ console.log('starting to edit');
+ this.set('isEditing', true);
+ },
+ isEditing: false
+ });
+
+ // Mix mixins into classes by passing them as the first arguments to
+ // .extend or .create.
+ App.CommentView = Ember.View.extend(App.Editable, {
+ template: Ember.Handlebars.compile('{{#if isEditing}}...{{else}}...{{/if}}')
+ });
+
+ commentView = App.CommentView.create();
+ commentView.edit(); // => outputs 'starting to edit'
+
+ Note that Mixins are created with `Ember.Mixin.create`, not
+ `Ember.Mixin.extend`.
+*/
+Ember.Mixin = function() { return initMixin(this, arguments); };
+
+/** @private */
+Mixin = Ember.Mixin;
+
+/** @private */
+Mixin._apply = applyMixin;
+
+Mixin.applyPartial = function(obj) {
+ var args = a_slice.call(arguments, 1);
+ return applyMixin(obj, args, true);
+};
+
+Mixin.finishPartial = finishPartial;
+
+Mixin.create = function() {
+ classToString.processed = false;
+ var M = this;
+ return initMixin(new M(), arguments);
+};
+
+var MixinPrototype = Mixin.prototype;
+
+MixinPrototype.reopen = function() {
+ var mixin, tmp;
+
+ if (this.properties) {
+ mixin = Mixin.create();
+ mixin.properties = this.properties;
+ delete this.properties;
+ this.mixins = [mixin];
+ } else if (!this.mixins) {
+ this.mixins = [];
+ }
+
+ var len = arguments.length, mixins = this.mixins, idx;
+
+ for(idx=0; idx < len; idx++) {
+ mixin = arguments[idx];
+ Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
+
+ if (mixin instanceof Mixin) {
+ mixins.push(mixin);
+ } else {
+ tmp = Mixin.create();
+ tmp.properties = mixin;
+ mixins.push(tmp);
+ }
+ }
+
+ return this;
+};
+
+MixinPrototype.apply = function(obj) {
+ return applyMixin(obj, [this], false);
+};
+
+MixinPrototype.applyPartial = function(obj) {
+ return applyMixin(obj, [this], true);
+};
+
+/** @private */
+function _detect(curMixin, targetMixin, seen) {
+ var guid = guidFor(curMixin);
+
+ if (seen[guid]) { return false; }
+ seen[guid] = true;
+
+ if (curMixin === targetMixin) { return true; }
+ var mixins = curMixin.mixins, loc = mixins ? mixins.length : 0;
+ while (--loc >= 0) {
+ if (_detect(mixins[loc], targetMixin, seen)) { return true; }
+ }
+ return false;
+}
+
+MixinPrototype.detect = function(obj) {
+ if (!obj) { return false; }
+ if (obj instanceof Mixin) { return _detect(obj, this, {}); }
+ var mixins = Ember.meta(obj, false).mixins;
+ if (mixins) {
+ return !!mixins[guidFor(this)];
+ }
+ return false;
+};
+
+MixinPrototype.without = function() {
+ var ret = new Mixin(this);
+ ret._without = a_slice.call(arguments);
+ return ret;
+};
+
+/** @private */
+function _keys(ret, mixin, seen) {
+ if (seen[guidFor(mixin)]) { return; }
+ seen[guidFor(mixin)] = true;
+
+ if (mixin.properties) {
+ var props = mixin.properties;
+ for (var key in props) {
+ if (props.hasOwnProperty(key)) { ret[key] = true; }
+ }
+ } else if (mixin.mixins) {
+ a_forEach.call(mixin.mixins, function(x) { _keys(ret, x, seen); });
+ }
+}
+
+MixinPrototype.keys = function() {
+ var keys = {}, seen = {}, ret = [];
+ _keys(keys, this, seen);
+ for(var key in keys) {
+ if (keys.hasOwnProperty(key)) { ret.push(key); }
+ }
+ return ret;
+};
+
+/** @private - make Mixin's have nice displayNames */
+
+var NAME_KEY = Ember.GUID_KEY+'_name';
+var get = Ember.get;
+
+/** @private */
+function processNames(paths, root, seen) {
+ var idx = paths.length;
+ for(var key in root) {
+ if (!root.hasOwnProperty || !root.hasOwnProperty(key)) { continue; }
+ var obj = root[key];
+ paths[idx] = key;
+
+ if (obj && obj.toString === classToString) {
+ obj[NAME_KEY] = paths.join('.');
+ } else if (obj && get(obj, 'isNamespace')) {
+ if (seen[guidFor(obj)]) { continue; }
+ seen[guidFor(obj)] = true;
+ processNames(paths, obj, seen);
+ }
+ }
+ paths.length = idx; // cut out last item
+}
+
+/** @private */
+function findNamespaces() {
+ var Namespace = Ember.Namespace, obj, isNamespace;
+
+ if (Namespace.PROCESSED) { return; }
+
+ for (var prop in window) {
+ // get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox.
+ // globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage
+ if (prop === "globalStorage" && window.StorageList && window.globalStorage instanceof window.StorageList) { continue; }
+ // Unfortunately, some versions of IE don't support window.hasOwnProperty
+ if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; }
+
+ // At times we are not allowed to access certain properties for security reasons.
+ // There are also times where even if we can access them, we are not allowed to access their properties.
+ try {
+ obj = window[prop];
+ isNamespace = obj && get(obj, 'isNamespace');
+ } catch (e) {
+ continue;
+ }
+
+ if (isNamespace) {
+ Ember.deprecate("Namespaces should not begin with lowercase.", /^[A-Z]/.test(prop));
+ obj[NAME_KEY] = prop;
+ }
+ }
+}
+
+Ember.identifyNamespaces = findNamespaces;
+
+/** @private */
+superClassString = function(mixin) {
+ var superclass = mixin.superclass;
+ if (superclass) {
+ if (superclass[NAME_KEY]) { return superclass[NAME_KEY]; }
+ else { return superClassString(superclass); }
+ } else {
+ return;
+ }
+};
+
+/** @private */
+classToString = function() {
+ var Namespace = Ember.Namespace, namespace;
+
+ // TODO: Namespace should really be in Metal
+ if (Namespace) {
+ if (!this[NAME_KEY] && !classToString.processed) {
+ if (!Namespace.PROCESSED) {
+ findNamespaces();
+ Namespace.PROCESSED = true;
+ }
+
+ classToString.processed = true;
+
+ var namespaces = Namespace.NAMESPACES;
+ for (var i=0, l=namespaces.length; i<l; i++) {
+ namespace = namespaces[i];
+ processNames([namespace.toString()], namespace, {});
+ }
+ }
+ }
+
+ if (this[NAME_KEY]) {
+ return this[NAME_KEY];
+ } else {
+ var str = superClassString(this);
+ if (str) {
+ return "(subclass of " + str + ")";
+ } else {
+ return "(unknown mixin)";
+ }
+ }
+};
+
+MixinPrototype.toString = classToString;
+
+// returns the mixins currently applied to the specified object
+// TODO: Make Ember.mixin
+Mixin.mixins = function(obj) {
+ var ret = [], mixins = Ember.meta(obj, false).mixins, key, mixin;
+ if (mixins) {
+ for(key in mixins) {
+ if (META_SKIP[key]) { continue; }
+ mixin = mixins[key];
+
+ // skip primitive mixins since these are always anonymous
+ if (!mixin.properties) { ret.push(mixins[key]); }
+ }
+ }
+ return ret;
+};
+
+REQUIRED = new Ember.Descriptor();
+REQUIRED.toString = function() { return '(Required Property)'; };
+
+Ember.required = function() {
+ return REQUIRED;
+};
+
+/** @private */
+Alias = function(methodName) {
+ this.methodName = methodName;
+};
+Alias.prototype = new Ember.Descriptor();
+
+Ember.alias = function(methodName) {
+ return new Alias(methodName);
+};
+
+// ..........................................................
+// OBSERVER HELPER
+//
+
+Ember.observer = function(func) {
+ var paths = a_slice.call(arguments, 1);
+ func.__ember_observes__ = paths;
+ return func;
+};
+
+// If observers ever become asynchronous, Ember.immediateObserver
+// must remain synchronous.
+Ember.immediateObserver = function() {
+ for (var i=0, l=arguments.length; i<l; i++) {
+ var arg = arguments[i];
+ Ember.assert("Immediate observers must observe internal properties only, not properties on other objects.", typeof arg !== "string" || arg.indexOf('.') === -1);
+ }
+
+ return Ember.observer.apply(this, arguments);
+};
+
+Ember.beforeObserver = function(func) {
+ var paths = a_slice.call(arguments, 1);
+ func.__ember_observesBefore__ = paths;
+ return func;
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Metal
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+(function() {
+/**
+ * @license
+ * ==========================================================================
+ * Ember
+ * Copyright ©2006-2011, Strobe Inc. and contributors.
+ * Portions copyright ©2008-2011 Apple Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * For more information about Ember, visit http://www.emberjs.com
+ *
+ * ==========================================================================
+ */
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals ENV */
+var indexOf = Ember.EnumerableUtils.indexOf;
+
+// ........................................
+// TYPING & ARRAY MESSAGING
+//
+
+var TYPE_MAP = {};
+var t = "Boolean Number String Function Array Date RegExp Object".split(" ");
+Ember.ArrayPolyfills.forEach.call(t, function(name) {
+ TYPE_MAP[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+var toString = Object.prototype.toString;
+
+/**
+ Returns a consistent type for the passed item.
+
+ Use this instead of the built-in Ember.typeOf() to get the type of an item.
+ It will return the same result across all browsers and includes a bit
+ more detail. Here is what will be returned:
+
+ | Return Value | Meaning |
+ |---------------|------------------------------------------------------|
+ | 'string' | String primitive |
+ | 'number' | Number primitive |
+ | 'boolean' | Boolean primitive |
+ | 'null' | Null value |
+ | 'undefined' | Undefined value |
+ | 'function' | A function |
+ | 'array' | An instance of Array |
+ | 'class' | A Ember class (created using Ember.Object.extend()) |
+ | 'instance' | A Ember object instance |
+ | 'error' | An instance of the Error object |
+ | 'object' | A JavaScript object not inheriting from Ember.Object |
+
+ Examples:
+
+ Ember.typeOf(); => 'undefined'
+ Ember.typeOf(null); => 'null'
+ Ember.typeOf(undefined); => 'undefined'
+ Ember.typeOf('michael'); => 'string'
+ Ember.typeOf(101); => 'number'
+ Ember.typeOf(true); => 'boolean'
+ Ember.typeOf(Ember.makeArray); => 'function'
+ Ember.typeOf([1,2,90]); => 'array'
+ Ember.typeOf(Ember.Object.extend()); => 'class'
+ Ember.typeOf(Ember.Object.create()); => 'instance'
+ Ember.typeOf(new Error('teamocil')); => 'error'
+
+ // "normal" JavaScript object
+ Ember.typeOf({a: 'b'}); => 'object'
+
+ @param item {Object} the item to check
+ @returns {String} the type
+*/
+Ember.typeOf = function(item) {
+ var ret;
+
+ ret = (item === null || item === undefined) ? String(item) : TYPE_MAP[toString.call(item)] || 'object';
+
+ if (ret === 'function') {
+ if (Ember.Object && Ember.Object.detect(item)) ret = 'class';
+ } else if (ret === 'object') {
+ if (item instanceof Error) ret = 'error';
+ else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
+ else ret = 'object';
+ }
+
+ return ret;
+};
+
+/**
+ Returns true if the passed value is null or undefined. This avoids errors
+ from JSLint complaining about use of ==, which can be technically
+ confusing.
+
+ Ember.none(); => true
+ Ember.none(null); => true
+ Ember.none(undefined); => true
+ Ember.none(''); => false
+ Ember.none([]); => false
+ Ember.none(function(){}); => false
+
+ @param {Object} obj Value to test
+ @returns {Boolean}
+*/
+Ember.none = function(obj) {
+ return obj === null || obj === undefined;
+};
+
+/**
+ Verifies that a value is null or an empty string | array | function.
+
+ Constrains the rules on `Ember.none` by returning false for empty
+ string and empty arrays.
+
+ Ember.empty(); => true
+ Ember.empty(null); => true
+ Ember.empty(undefined); => true
+ Ember.empty(''); => true
+ Ember.empty([]); => true
+ Ember.empty('tobias fünke'); => false
+ Ember.empty([0,1,2]); => false
+
+ @param {Object} obj Value to test
+ @returns {Boolean}
+*/
+Ember.empty = function(obj) {
+ return obj === null || obj === undefined || (obj.length === 0 && typeof obj !== 'function');
+};
+
+/**
+ This will compare two javascript values of possibly different types.
+ It will tell you which one is greater than the other by returning:
+
+ - -1 if the first is smaller than the second,
+ - 0 if both are equal,
+ - 1 if the first is greater than the second.
+
+ The order is calculated based on Ember.ORDER_DEFINITION, if types are different.
+ In case they have the same type an appropriate comparison for this type is made.
+
+ Ember.compare('hello', 'hello'); => 0
+ Ember.compare('abc', 'dfg'); => -1
+ Ember.compare(2, 1); => 1
+
+ @param {Object} v First value to compare
+ @param {Object} w Second value to compare
+ @returns {Number} -1 if v < w, 0 if v = w and 1 if v > w.
+*/
+Ember.compare = function compare(v, w) {
+ if (v === w) { return 0; }
+
+ var type1 = Ember.typeOf(v);
+ var type2 = Ember.typeOf(w);
+
+ var Comparable = Ember.Comparable;
+ if (Comparable) {
+ if (type1==='instance' && Comparable.detect(v.constructor)) {
+ return v.constructor.compare(v, w);
+ }
+
+ if (type2 === 'instance' && Comparable.detect(w.constructor)) {
+ return 1-w.constructor.compare(w, v);
+ }
+ }
+
+ // If we haven't yet generated a reverse-mapping of Ember.ORDER_DEFINITION,
+ // do so now.
+ var mapping = Ember.ORDER_DEFINITION_MAPPING;
+ if (!mapping) {
+ var order = Ember.ORDER_DEFINITION;
+ mapping = Ember.ORDER_DEFINITION_MAPPING = {};
+ var idx, len;
+ for (idx = 0, len = order.length; idx < len; ++idx) {
+ mapping[order[idx]] = idx;
+ }
+
+ // We no longer need Ember.ORDER_DEFINITION.
+ delete Ember.ORDER_DEFINITION;
+ }
+
+ var type1Index = mapping[type1];
+ var type2Index = mapping[type2];
+
+ if (type1Index < type2Index) { return -1; }
+ if (type1Index > type2Index) { return 1; }
+
+ // types are equal - so we have to check values now
+ switch (type1) {
+ case 'boolean':
+ case 'number':
+ if (v < w) { return -1; }
+ if (v > w) { return 1; }
+ return 0;
+
+ case 'string':
+ var comp = v.localeCompare(w);
+ if (comp < 0) { return -1; }
+ if (comp > 0) { return 1; }
+ return 0;
+
+ case 'array':
+ var vLen = v.length;
+ var wLen = w.length;
+ var l = Math.min(vLen, wLen);
+ var r = 0;
+ var i = 0;
+ while (r === 0 && i < l) {
+ r = compare(v[i],w[i]);
+ i++;
+ }
+ if (r !== 0) { return r; }
+
+ // all elements are equal now
+ // shorter array should be ordered first
+ if (vLen < wLen) { return -1; }
+ if (vLen > wLen) { return 1; }
+ // arrays are equal now
+ return 0;
+
+ case 'instance':
+ if (Ember.Comparable && Ember.Comparable.detect(v)) {
+ return v.compare(v, w);
+ }
+ return 0;
+
+ case 'date':
+ var vNum = v.getTime();
+ var wNum = w.getTime();
+ if (vNum < wNum) { return -1; }
+ if (vNum > wNum) { return 1; }
+ return 0;
+
+ default:
+ return 0;
+ }
+};
+
+/** @private */
+function _copy(obj, deep, seen, copies) {
+ var ret, loc, key;
+
+ // primitive data types are immutable, just return them.
+ if ('object' !== typeof obj || obj===null) return obj;
+
+ // avoid cyclical loops
+ if (deep && (loc=indexOf(seen, obj))>=0) return copies[loc];
+
+ Ember.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof Ember.Object) || (Ember.Copyable && Ember.Copyable.detect(obj)));
+
+ // IMPORTANT: this specific test will detect a native array only. Any other
+ // object will need to implement Copyable.
+ if (Ember.typeOf(obj) === 'array') {
+ ret = obj.slice();
+ if (deep) {
+ loc = ret.length;
+ while(--loc>=0) ret[loc] = _copy(ret[loc], deep, seen, copies);
+ }
+ } else if (Ember.Copyable && Ember.Copyable.detect(obj)) {
+ ret = obj.copy(deep, seen, copies);
+ } else {
+ ret = {};
+ for(key in obj) {
+ if (!obj.hasOwnProperty(key)) continue;
+ ret[key] = deep ? _copy(obj[key], deep, seen, copies) : obj[key];
+ }
+ }
+
+ if (deep) {
+ seen.push(obj);
+ copies.push(ret);
+ }
+
+ return ret;
+}
+
+/**
+ Creates a clone of the passed object. This function can take just about
+ any type of object and create a clone of it, including primitive values
+ (which are not actually cloned because they are immutable).
+
+ If the passed object implements the clone() method, then this function
+ will simply call that method and return the result.
+
+ @param {Object} object The object to clone
+ @param {Boolean} deep If true, a deep copy of the object is made
+ @returns {Object} The cloned object
+*/
+Ember.copy = function(obj, deep) {
+ // fast paths
+ if ('object' !== typeof obj || obj===null) return obj; // can't copy primitives
+ if (Ember.Copyable && Ember.Copyable.detect(obj)) return obj.copy(deep);
+ return _copy(obj, deep, deep ? [] : null, deep ? [] : null);
+};
+
+/**
+ Convenience method to inspect an object. This method will attempt to
+ convert the object into a useful string description.
+
+ @param {Object} obj The object you want to inspect.
+ @returns {String} A description of the object
+*/
+Ember.inspect = function(obj) {
+ var v, ret = [];
+ for(var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ v = obj[key];
+ if (v === 'toString') { continue; } // ignore useless items
+ if (Ember.typeOf(v) === 'function') { v = "function() { ... }"; }
+ ret.push(key + ": " + v);
+ }
+ }
+ return "{" + ret.join(" , ") + "}";
+};
+
+/**
+ Compares two objects, returning true if they are logically equal. This is
+ a deeper comparison than a simple triple equal. For sets it will compare the
+ internal objects. For any other object that implements `isEqual()` it will
+ respect that method.
+
+ Ember.isEqual('hello', 'hello'); => true
+ Ember.isEqual(1, 2); => false
+ Ember.isEqual([4,2], [4,2]); => false
+
+ @param {Object} a first object to compare
+ @param {Object} b second object to compare
+ @returns {Boolean}
+*/
+Ember.isEqual = function(a, b) {
+ if (a && 'function'===typeof a.isEqual) return a.isEqual(b);
+ return a === b;
+};
+
+/**
+ @private
+ Used by Ember.compare
+*/
+Ember.ORDER_DEFINITION = Ember.ENV.ORDER_DEFINITION || [
+ 'undefined',
+ 'null',
+ 'boolean',
+ 'number',
+ 'string',
+ 'array',
+ 'object',
+ 'instance',
+ 'function',
+ 'class',
+ 'date'
+];
+
+/**
+ Returns all of the keys defined on an object or hash. This is useful
+ when inspecting objects for debugging. On browsers that support it, this
+ uses the native Object.keys implementation.
+
+ @function
+ @param {Object} obj
+ @returns {Array} Array containing keys of obj
+*/
+Ember.keys = Object.keys;
+
+if (!Ember.keys) {
+ Ember.keys = function(obj) {
+ var ret = [];
+ for(var key in obj) {
+ if (obj.hasOwnProperty(key)) { ret.push(key); }
+ }
+ return ret;
+ };
+}
+
+// ..........................................................
+// ERROR
+//
+
+/**
+ @class
+
+ A subclass of the JavaScript Error object for use in Ember.
+*/
+Ember.Error = function() {
+ var tmp = Error.prototype.constructor.apply(this, arguments);
+
+ for (var p in tmp) {
+ if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }
+ }
+ this.message = tmp.message;
+};
+
+Ember.Error.prototype = Ember.create(Error.prototype);
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+/** @private **/
+var STRING_DASHERIZE_REGEXP = (/[ _]/g);
+var STRING_DASHERIZE_CACHE = {};
+var STRING_DECAMELIZE_REGEXP = (/([a-z])([A-Z])/g);
+var STRING_CAMELIZE_REGEXP = (/(\-|_|\s)+(.)?/g);
+var STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
+var STRING_UNDERSCORE_REGEXP_2 = (/\-|\s+/g);
+
+/**
+ Defines the hash of localized strings for the current language. Used by
+ the `Ember.String.loc()` helper. To localize, add string values to this
+ hash.
+
+ @type Hash
+*/
+Ember.STRINGS = {};
+
+/**
+ Defines string helper methods including string formatting and localization.
+ Unless Ember.EXTEND_PROTOTYPES = false these methods will also be added to the
+ String.prototype as well.
+
+ @namespace
+*/
+Ember.String = {
+
+ /**
+ Apply formatting options to the string. This will look for occurrences
+ of %@ in your string and substitute them with the arguments you pass into
+ this method. If you want to control the specific order of replacement,
+ you can add a number after the key as well to indicate which argument
+ you want to insert.
+
+ Ordered insertions are most useful when building loc strings where values
+ you need to insert may appear in different orders.
+
+ "Hello %@ %@".fmt('John', 'Doe') => "Hello John Doe"
+ "Hello %@2, %@1".fmt('John', 'Doe') => "Hello Doe, John"
+
+ @param {Object...} [args]
+ @returns {String} formatted string
+ */
+ fmt: function(str, formats) {
+ // first, replace any ORDERED replacements.
+ var idx = 0; // the current index for non-numerical replacements
+ return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {
+ argIndex = (argIndex) ? parseInt(argIndex,0) - 1 : idx++ ;
+ s = formats[argIndex];
+ return ((s === null) ? '(null)' : (s === undefined) ? '' : s).toString();
+ }) ;
+ },
+
+ /**
+ Formats the passed string, but first looks up the string in the localized
+ strings hash. This is a convenient way to localize text. See
+ `Ember.String.fmt()` for more information on formatting.
+
+ Note that it is traditional but not required to prefix localized string
+ keys with an underscore or other character so you can easily identify
+ localized strings.
+
+ Ember.STRINGS = {
+ '_Hello World': 'Bonjour le monde',
+ '_Hello %@ %@': 'Bonjour %@ %@'
+ };
+
+ Ember.String.loc("_Hello World");
+ => 'Bonjour le monde';
+
+ Ember.String.loc("_Hello %@ %@", ["John", "Smith"]);
+ => "Bonjour John Smith";
+
+ @param {String} str
+ The string to format
+
+ @param {Array} formats
+ Optional array of parameters to interpolate into string.
+
+ @returns {String} formatted string
+ */
+ loc: function(str, formats) {
+ str = Ember.STRINGS[str] || str;
+ return Ember.String.fmt(str, formats) ;
+ },
+
+ /**
+ Splits a string into separate units separated by spaces, eliminating any
+ empty strings in the process. This is a convenience method for split that
+ is mostly useful when applied to the String.prototype.
+
+ Ember.String.w("alpha beta gamma").forEach(function(key) {
+ console.log(key);
+ });
+ > alpha
+ > beta
+ > gamma
+
+ @param {String} str
+ The string to split
+
+ @returns {String} split string
+ */
+ w: function(str) { return str.split(/\s+/); },
+
+ /**
+ Converts a camelized string into all lower case separated by underscores.
+
+ 'innerHTML'.decamelize() => 'inner_html'
+ 'action_name'.decamelize() => 'action_name'
+ 'css-class-name'.decamelize() => 'css-class-name'
+ 'my favorite items'.decamelize() => 'my favorite items'
+
+ @param {String} str
+ The string to decamelize.
+
+ @returns {String} the decamelized string.
+ */
+ decamelize: function(str) {
+ return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
+ },
+
+ /**
+ Replaces underscores or spaces with dashes.
+
+ 'innerHTML'.dasherize() => 'inner-html'
+ 'action_name'.dasherize() => 'action-name'
+ 'css-class-name'.dasherize() => 'css-class-name'
+ 'my favorite items'.dasherize() => 'my-favorite-items'
+
+ @param {String} str
+ The string to dasherize.
+
+ @returns {String} the dasherized string.
+ */
+ dasherize: function(str) {
+ var cache = STRING_DASHERIZE_CACHE,
+ ret = cache[str];
+
+ if (ret) {
+ return ret;
+ } else {
+ ret = Ember.String.decamelize(str).replace(STRING_DASHERIZE_REGEXP,'-');
+ cache[str] = ret;
+ }
+
+ return ret;
+ },
+
+ /**
+ Returns the lowerCaseCamel form of a string.
+
+ 'innerHTML'.camelize() => 'innerHTML'
+ 'action_name'.camelize() => 'actionName'
+ 'css-class-name'.camelize() => 'cssClassName'
+ 'my favorite items'.camelize() => 'myFavoriteItems'
+
+ @param {String} str
+ The string to camelize.
+
+ @returns {String} the camelized string.
+ */
+ camelize: function(str) {
+ return str.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) {
+ return chr ? chr.toUpperCase() : '';
+ });
+ },
+
+ /**
+ Returns the UpperCamelCase form of a string.
+
+ 'innerHTML'.classify() => 'InnerHTML'
+ 'action_name'.classify() => 'ActionName'
+ 'css-class-name'.classify() => 'CssClassName'
+ 'my favorite items'.classift() => 'MyFavoriteItems'
+ */
+ classify: function(str) {
+ var camelized = Ember.String.camelize(str);
+ return camelized.charAt(0).toUpperCase() + camelized.substr(1);
+ },
+
+ /**
+ More general than decamelize. Returns the lower_case_and_underscored
+ form of a string.
+
+ 'innerHTML'.underscore() => 'inner_html'
+ 'action_name'.underscore() => 'action_name'
+ 'css-class-name'.underscore() => 'css_class_name'
+ 'my favorite items'.underscore() => 'my_favorite_items'
+
+ @param {String} str
+ The string to underscore.
+
+ @returns {String} the underscored string.
+ */
+ underscore: function(str) {
+ return str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').
+ replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var fmt = Ember.String.fmt,
+ w = Ember.String.w,
+ loc = Ember.String.loc,
+ camelize = Ember.String.camelize,
+ decamelize = Ember.String.decamelize,
+ dasherize = Ember.String.dasherize,
+ underscore = Ember.String.underscore;
+
+if (Ember.EXTEND_PROTOTYPES) {
+
+ /**
+ @see Ember.String.fmt
+ */
+ String.prototype.fmt = function() {
+ return fmt(this, arguments);
+ };
+
+ /**
+ @see Ember.String.w
+ */
+ String.prototype.w = function() {
+ return w(this);
+ };
+
+ /**
+ @see Ember.String.loc
+ */
+ String.prototype.loc = function() {
+ return loc(this, arguments);
+ };
+
+ /**
+ @see Ember.String.camelize
+ */
+ String.prototype.camelize = function() {
+ return camelize(this);
+ };
+
+ /**
+ @see Ember.String.decamelize
+ */
+ String.prototype.decamelize = function() {
+ return decamelize(this);
+ };
+
+ /**
+ @see Ember.String.dasherize
+ */
+ String.prototype.dasherize = function() {
+ return dasherize(this);
+ };
+
+ /**
+ @see Ember.String.underscore
+ */
+ String.prototype.underscore = function() {
+ return underscore(this);
+ };
+
+}
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var a_slice = Array.prototype.slice;
+
+if (Ember.EXTEND_PROTOTYPES) {
+
+ /**
+ The `property` extension of Javascript's Function prototype is available
+ when Ember.EXTEND_PROTOTYPES is true, which is the default.
+
+ Computed properties allow you to treat a function like a property:
+
+ MyApp.president = Ember.Object.create({
+ firstName: "Barack",
+ lastName: "Obama",
+
+ fullName: function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // Call this flag to mark the function as a property
+ }.property()
+ });
+
+ MyApp.president.get('fullName'); => "Barack Obama"
+
+ Treating a function like a property is useful because they can work with
+ bindings, just like any other property.
+
+ Many computed properties have dependencies on other properties. For
+ example, in the above example, the `fullName` property depends on
+ `firstName` and `lastName` to determine its value. You can tell Ember.js
+ about these dependencies like this:
+
+ MyApp.president = Ember.Object.create({
+ firstName: "Barack",
+ lastName: "Obama",
+
+ fullName: function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // Tell Ember.js that this computed property depends on firstName
+ // and lastName
+ }.property('firstName', 'lastName')
+ });
+
+ Make sure you list these dependencies so Ember.js knows when to update
+ bindings that connect to a computed property. Changing a dependency
+ will not immediately trigger an update of the computed property, but
+ will instead clear the cache so that it is updated when the next `get`
+ is called on the property.
+
+ Note: you will usually want to use `property(...)` with `cacheable()`.
+
+ @see Ember.ComputedProperty
+ @see Ember.computed
+ */
+ Function.prototype.property = function() {
+ var ret = Ember.computed(this);
+ return ret.property.apply(ret, arguments);
+ };
+
+ /**
+ The `observes` extension of Javascript's Function prototype is available
+ when Ember.EXTEND_PROTOTYPES is true, which is the default.
+
+ You can observe property changes simply by adding the `observes`
+ call to the end of your method declarations in classes that you write.
+ For example:
+
+ Ember.Object.create({
+ valueObserver: function() {
+ // Executes whenever the "value" property changes
+ }.observes('value')
+ });
+
+ @see Ember.Observable
+ */
+ Function.prototype.observes = function() {
+ this.__ember_observes__ = a_slice.call(arguments);
+ return this;
+ };
+
+ /**
+ The `observesBefore` extension of Javascript's Function prototype is
+ available when Ember.EXTEND_PROTOTYPES is true, which is the default.
+
+ You can get notified when a property changes is about to happen by
+ by adding the `observesBefore` call to the end of your method
+ declarations in classes that you write. For example:
+
+ Ember.Object.create({
+ valueObserver: function() {
+ // Executes whenever the "value" property is about to change
+ }.observesBefore('value')
+ });
+
+ @see Ember.Observable
+ */
+ Function.prototype.observesBefore = function() {
+ this.__ember_observesBefore__ = a_slice.call(arguments);
+ return this;
+ };
+
+}
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+
+
+
+
+// ..........................................................
+// HELPERS
+//
+
+var get = Ember.get, set = Ember.set;
+var a_slice = Array.prototype.slice;
+var a_indexOf = Ember.EnumerableUtils.indexOf;
+
+var contexts = [];
+/** @private */
+function popCtx() {
+ return contexts.length===0 ? {} : contexts.pop();
+}
+
+/** @private */
+function pushCtx(ctx) {
+ contexts.push(ctx);
+ return null;
+}
+
+/** @private */
+function iter(key, value) {
+ var valueProvided = arguments.length === 2;
+
+ function i(item) {
+ var cur = get(item, key);
+ return valueProvided ? value===cur : !!cur;
+ }
+ return i ;
+}
+
+/**
+ @class
+
+ This mixin defines the common interface implemented by enumerable objects
+ in Ember. Most of these methods follow the standard Array iteration
+ API defined up to JavaScript 1.8 (excluding language-specific features that
+ cannot be emulated in older versions of JavaScript).
+
+ This mixin is applied automatically to the Array class on page load, so you
+ can use any of these methods on simple arrays. If Array already implements
+ one of these methods, the mixin will not override them.
+
+ h3. Writing Your Own Enumerable
+
+ To make your own custom class enumerable, you need two items:
+
+ 1. You must have a length property. This property should change whenever
+ the number of items in your enumerable object changes. If you using this
+ with an Ember.Object subclass, you should be sure to change the length
+ property using set().
+
+ 2. If you must implement nextObject(). See documentation.
+
+ Once you have these two methods implement, apply the Ember.Enumerable mixin
+ to your class and you will be able to enumerate the contents of your object
+ like any other collection.
+
+ h3. Using Ember Enumeration with Other Libraries
+
+ Many other libraries provide some kind of iterator or enumeration like
+ facility. This is often where the most common API conflicts occur.
+ Ember's API is designed to be as friendly as possible with other
+ libraries by implementing only methods that mostly correspond to the
+ JavaScript 1.8 API.
+
+ @extends Ember.Mixin
+ @since Ember 0.9
+*/
+Ember.Enumerable = Ember.Mixin.create(
+ /** @scope Ember.Enumerable.prototype */ {
+
+ /** @private - compatibility */
+ isEnumerable: true,
+
+ /**
+ Implement this method to make your class enumerable.
+
+ This method will be call repeatedly during enumeration. The index value
+ will always begin with 0 and increment monotonically. You don't have to
+ rely on the index value to determine what object to return, but you should
+ always check the value and start from the beginning when you see the
+ requested index is 0.
+
+ The previousObject is the object that was returned from the last call
+ to nextObject for the current iteration. This is a useful way to
+ manage iteration if you are tracing a linked list, for example.
+
+ Finally the context parameter will always contain a hash you can use as
+ a "scratchpad" to maintain any other state you need in order to iterate
+ properly. The context object is reused and is not reset between
+ iterations so make sure you setup the context with a fresh state whenever
+ the index parameter is 0.
+
+ Generally iterators will continue to call nextObject until the index
+ reaches the your current length-1. If you run out of data before this
+ time for some reason, you should simply return undefined.
+
+ The default implementation of this method simply looks up the index.
+ This works great on any Array-like objects.
+
+ @param {Number} index the current index of the iteration
+ @param {Object} previousObject the value returned by the last call to nextObject.
+ @param {Object} context a context object you can use to maintain state.
+ @returns {Object} the next object in the iteration or undefined
+ */
+ nextObject: Ember.required(Function),
+
+ /**
+ Helper method returns the first object from a collection. This is usually
+ used by bindings and other parts of the framework to extract a single
+ object if the enumerable contains only one item.
+
+ If you override this method, you should implement it so that it will
+ always return the same value each time it is called. If your enumerable
+ contains only one object, this method should always return that object.
+ If your enumerable is empty, this method should return undefined.
+
+ var arr = ["a", "b", "c"];
+ arr.firstObject(); => "a"
+
+ var arr = [];
+ arr.firstObject(); => undefined
+
+ @returns {Object} the object or undefined
+ */
+ firstObject: Ember.computed(function() {
+ if (get(this, 'length')===0) return undefined ;
+
+ // handle generic enumerables
+ var context = popCtx(), ret;
+ ret = this.nextObject(0, null, context);
+ pushCtx(context);
+ return ret ;
+ }).property('[]').cacheable(),
+
+ /**
+ Helper method returns the last object from a collection. If your enumerable
+ contains only one object, this method should always return that object.
+ If your enumerable is empty, this method should return undefined.
+
+ var arr = ["a", "b", "c"];
+ arr.lastObject(); => "c"
+
+ var arr = [];
+ arr.lastObject(); => undefined
+
+ @returns {Object} the last object or undefined
+ */
+ lastObject: Ember.computed(function() {
+ var len = get(this, 'length');
+ if (len===0) return undefined ;
+ var context = popCtx(), idx=0, cur, last = null;
+ do {
+ last = cur;
+ cur = this.nextObject(idx++, last, context);
+ } while (cur !== undefined);
+ pushCtx(context);
+ return last;
+ }).property('[]').cacheable(),
+
+ /**
+ Returns true if the passed object can be found in the receiver. The
+ default version will iterate through the enumerable until the object
+ is found. You may want to override this with a more efficient version.
+
+ var arr = ["a", "b", "c"];
+ arr.contains("a"); => true
+ arr.contains("z"); => false
+
+ @param {Object} obj
+ The object to search for.
+
+ @returns {Boolean} true if object is found in enumerable.
+ */
+ contains: function(obj) {
+ return this.find(function(item) { return item===obj; }) !== undefined;
+ },
+
+ /**
+ Iterates through the enumerable, calling the passed function on each
+ item. This method corresponds to the forEach() method defined in
+ JavaScript 1.6.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Object} receiver
+ */
+ forEach: function(callback, target) {
+ if (typeof callback !== "function") throw new TypeError() ;
+ var len = get(this, 'length'), last = null, context = popCtx();
+
+ if (target === undefined) target = null;
+
+ for(var idx=0;idx<len;idx++) {
+ var next = this.nextObject(idx, last, context) ;
+ callback.call(target, next, idx, this);
+ last = next ;
+ }
+ last = null ;
+ context = pushCtx(context);
+ return this ;
+ },
+
+ /**
+ Alias for mapProperty
+
+ @param {String} key name of the property
+ @returns {Array} The mapped array.
+ */
+ getEach: function(key) {
+ return this.mapProperty(key);
+ },
+
+ /**
+ Sets the value on the named property for each member. This is more
+ efficient than using other methods defined on this helper. If the object
+ implements Ember.Observable, the value will be changed to set(), otherwise
+ it will be set directly. null objects are skipped.
+
+ @param {String} key The key to set
+ @param {Object} value The object to set
+ @returns {Object} receiver
+ */
+ setEach: function(key, value) {
+ return this.forEach(function(item) {
+ set(item, key, value);
+ });
+ },
+
+ /**
+ Maps all of the items in the enumeration to another value, returning
+ a new array. This method corresponds to map() defined in JavaScript 1.6.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ It should return the mapped value.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Array} The mapped array.
+ */
+ map: function(callback, target) {
+ var ret = [];
+ this.forEach(function(x, idx, i) {
+ ret[idx] = callback.call(target, x, idx,i);
+ });
+ return ret ;
+ },
+
+ /**
+ Similar to map, this specialized function returns the value of the named
+ property on all items in the enumeration.
+
+ @param {String} key name of the property
+ @returns {Array} The mapped array.
+ */
+ mapProperty: function(key) {
+ return this.map(function(next) {
+ return get(next, key);
+ });
+ },
+
+ /**
+ Returns an array with all of the items in the enumeration that the passed
+ function returns true for. This method corresponds to filter() defined in
+ JavaScript 1.6.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ It should return the true to include the item in the results, false otherwise.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Array} A filtered array.
+ */
+ filter: function(callback, target) {
+ var ret = [];
+ this.forEach(function(x, idx, i) {
+ if (callback.call(target, x, idx, i)) ret.push(x);
+ });
+ return ret ;
+ },
+
+ /**
+ Returns an array with just the items with the matched property. You
+ can pass an optional second argument with the target value. Otherwise
+ this will match any property that evaluates to true.
+
+ @param {String} key the property to test
+ @param {String} [value] optional value to test against.
+ @returns {Array} filtered array
+ */
+ filterProperty: function(key, value) {
+ return this.filter(iter.apply(this, arguments));
+ },
+
+ /**
+ Returns the first item in the array for which the callback returns true.
+ This method works similar to the filter() method defined in JavaScript 1.6
+ except that it will stop working on the array once a match is found.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ It should return the true to include the item in the results, false otherwise.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Object} Found item or null.
+ */
+ find: function(callback, target) {
+ var len = get(this, 'length') ;
+ if (target === undefined) target = null;
+
+ var last = null, next, found = false, ret ;
+ var context = popCtx();
+ for(var idx=0;idx<len && !found;idx++) {
+ next = this.nextObject(idx, last, context) ;
+ if (found = callback.call(target, next, idx, this)) ret = next ;
+ last = next ;
+ }
+ next = last = null ;
+ context = pushCtx(context);
+ return ret ;
+ },
+
+ /**
+ Returns the first item with a property matching the passed value. You
+ can pass an optional second argument with the target value. Otherwise
+ this will match any property that evaluates to true.
+
+ This method works much like the more generic find() method.
+
+ @param {String} key the property to test
+ @param {String} [value] optional value to test against.
+ @returns {Object} found item or null
+ */
+ findProperty: function(key, value) {
+ return this.find(iter.apply(this, arguments));
+ },
+
+ /**
+ Returns true if the passed function returns true for every item in the
+ enumeration. This corresponds with the every() method in JavaScript 1.6.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ It should return the true or false.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ Example Usage:
+
+ if (people.every(isEngineer)) { Paychecks.addBigBonus(); }
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Boolean}
+ */
+ every: function(callback, target) {
+ return !this.find(function(x, idx, i) {
+ return !callback.call(target, x, idx, i);
+ });
+ },
+
+ /**
+ Returns true if the passed property resolves to true for all items in the
+ enumerable. This method is often simpler/faster than using a callback.
+
+ @param {String} key the property to test
+ @param {String} [value] optional value to test against.
+ @returns {Array} filtered array
+ */
+ everyProperty: function(key, value) {
+ return this.every(iter.apply(this, arguments));
+ },
+
+
+ /**
+ Returns true if the passed function returns true for any item in the
+ enumeration. This corresponds with the every() method in JavaScript 1.6.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(item, index, enumerable);
+
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ It should return the true to include the item in the results, false otherwise.
+
+ Note that in addition to a callback, you can also pass an optional target
+ object that will be set as "this" on the context. This is a good way
+ to give your iterator function access to the current object.
+
+ Usage Example:
+
+ if (people.some(isManager)) { Paychecks.addBiggerBonus(); }
+
+ @param {Function} callback The callback to execute
+ @param {Object} [target] The target object to use
+ @returns {Array} A filtered array.
+ */
+ some: function(callback, target) {
+ return !!this.find(function(x, idx, i) {
+ return !!callback.call(target, x, idx, i);
+ });
+ },
+
+ /**
+ Returns true if the passed property resolves to true for any item in the
+ enumerable. This method is often simpler/faster than using a callback.
+
+ @param {String} key the property to test
+ @param {String} [value] optional value to test against.
+ @returns {Boolean} true
+ */
+ someProperty: function(key, value) {
+ return this.some(iter.apply(this, arguments));
+ },
+
+ /**
+ This will combine the values of the enumerator into a single value. It
+ is a useful way to collect a summary value from an enumeration. This
+ corresponds to the reduce() method defined in JavaScript 1.8.
+
+ The callback method you provide should have the following signature (all
+ parameters are optional):
+
+ function(previousValue, item, index, enumerable);
+
+ - *previousValue* is the value returned by the last call to the iterator.
+ - *item* is the current item in the iteration.
+ - *index* is the current index in the iteration
+ - *enumerable* is the enumerable object itself.
+
+ Return the new cumulative value.
+
+ In addition to the callback you can also pass an initialValue. An error
+ will be raised if you do not pass an initial value and the enumerator is
+ empty.
+
+ Note that unlike the other methods, this method does not allow you to
+ pass a target object to set as this for the callback. It's part of the
+ spec. Sorry.
+
+ @param {Function} callback The callback to execute
+ @param {Object} initialValue Initial value for the reduce
+ @param {String} reducerProperty internal use only.
+ @returns {Object} The reduced value.
+ */
+ reduce: function(callback, initialValue, reducerProperty) {
+ if (typeof callback !== "function") { throw new TypeError(); }
+
+ var ret = initialValue;
+
+ this.forEach(function(item, i) {
+ ret = callback.call(null, ret, item, i, this, reducerProperty);
+ }, this);
+
+ return ret;
+ },
+
+ /**
+ Invokes the named method on every object in the receiver that
+ implements it. This method corresponds to the implementation in
+ Prototype 1.6.
+
+ @param {String} methodName the name of the method
+ @param {Object...} args optional arguments to pass as well.
+ @returns {Array} return values from calling invoke.
+ */
+ invoke: function(methodName) {
+ var args, ret = [];
+ if (arguments.length>1) args = a_slice.call(arguments, 1);
+
+ this.forEach(function(x, idx) {
+ var method = x && x[methodName];
+ if ('function' === typeof method) {
+ ret[idx] = args ? method.apply(x, args) : method.call(x);
+ }
+ }, this);
+
+ return ret;
+ },
+
+ /**
+ Simply converts the enumerable into a genuine array. The order is not
+ guaranteed. Corresponds to the method implemented by Prototype.
+
+ @returns {Array} the enumerable as an array.
+ */
+ toArray: function() {
+ var ret = [];
+ this.forEach(function(o, idx) { ret[idx] = o; });
+ return ret ;
+ },
+
+ /**
+ Returns a copy of the array with all null elements removed.
+
+ var arr = ["a", null, "c", null];
+ arr.compact(); => ["a", "c"]
+
+ @returns {Array} the array without null elements.
+ */
+ compact: function() { return this.without(null); },
+
+ /**
+ Returns a new enumerable that excludes the passed value. The default
+ implementation returns an array regardless of the receiver type unless
+ the receiver does not contain the value.
+
+ var arr = ["a", "b", "a", "c"];
+ arr.without("a"); => ["b", "c"]
+
+ @param {Object} value
+ @returns {Ember.Enumerable}
+ */
+ without: function(value) {
+ if (!this.contains(value)) return this; // nothing to do
+ var ret = [] ;
+ this.forEach(function(k) {
+ if (k !== value) ret[ret.length] = k;
+ }) ;
+ return ret ;
+ },
+
+ /**
+ Returns a new enumerable that contains only unique values. The default
+ implementation returns an array regardless of the receiver type.
+
+ var arr = ["a", "a", "b", "b"];
+ arr.uniq(); => ["a", "b"]
+
+ @returns {Ember.Enumerable}
+ */
+ uniq: function() {
+ var ret = [];
+ this.forEach(function(k){
+ if (a_indexOf(ret, k)<0) ret.push(k);
+ });
+ return ret;
+ },
+
+ /**
+ This property will trigger anytime the enumerable's content changes.
+ You can observe this property to be notified of changes to the enumerables
+ content.
+
+ For plain enumerables, this property is read only. Ember.Array overrides
+ this method.
+
+ @type Ember.Array
+ */
+ '[]': Ember.computed(function(key, value) {
+ return this;
+ }).property().cacheable(),
+
+ // ..........................................................
+ // ENUMERABLE OBSERVERS
+ //
+
+ /**
+ Registers an enumerable observer. Must implement Ember.EnumerableObserver
+ mixin.
+ */
+ addEnumerableObserver: function(target, opts) {
+ var willChange = (opts && opts.willChange) || 'enumerableWillChange',
+ didChange = (opts && opts.didChange) || 'enumerableDidChange';
+
+ var hasObservers = get(this, 'hasEnumerableObservers');
+ if (!hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');
+ Ember.addListener(this, '@enumerable:before', target, willChange);
+ Ember.addListener(this, '@enumerable:change', target, didChange);
+ if (!hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');
+ return this;
+ },
+
+ /**
+ Removes a registered enumerable observer.
+ */
+ removeEnumerableObserver: function(target, opts) {
+ var willChange = (opts && opts.willChange) || 'enumerableWillChange',
+ didChange = (opts && opts.didChange) || 'enumerableDidChange';
+
+ var hasObservers = get(this, 'hasEnumerableObservers');
+ if (hasObservers) Ember.propertyWillChange(this, 'hasEnumerableObservers');
+ Ember.removeListener(this, '@enumerable:before', target, willChange);
+ Ember.removeListener(this, '@enumerable:change', target, didChange);
+ if (hasObservers) Ember.propertyDidChange(this, 'hasEnumerableObservers');
+ return this;
+ },
+
+ /**
+ Becomes true whenever the array currently has observers watching changes
+ on the array.
+
+ @type Boolean
+ */
+ hasEnumerableObservers: Ember.computed(function() {
+ return Ember.hasListeners(this, '@enumerable:change') || Ember.hasListeners(this, '@enumerable:before');
+ }).property().cacheable(),
+
+
+ /**
+ Invoke this method just before the contents of your enumerable will
+ change. You can either omit the parameters completely or pass the objects
+ to be removed or added if available or just a count.
+
+ @param {Ember.Enumerable|Number} removing
+ An enumerable of the objects to be removed or the number of items to
+ be removed.
+
+ @param {Ember.Enumerable|Number} adding
+ An enumerable of the objects to be added or the number of items to be
+ added.
+
+ @returns {Ember.Enumerable} receiver
+ */
+ enumerableContentWillChange: function(removing, adding) {
+
+ var removeCnt, addCnt, hasDelta;
+
+ if ('number' === typeof removing) removeCnt = removing;
+ else if (removing) removeCnt = get(removing, 'length');
+ else removeCnt = removing = -1;
+
+ if ('number' === typeof adding) addCnt = adding;
+ else if (adding) addCnt = get(adding,'length');
+ else addCnt = adding = -1;
+
+ hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;
+
+ if (removing === -1) removing = null;
+ if (adding === -1) adding = null;
+
+ Ember.propertyWillChange(this, '[]');
+ if (hasDelta) Ember.propertyWillChange(this, 'length');
+ Ember.sendEvent(this, '@enumerable:before', [this, removing, adding]);
+
+ return this;
+ },
+
+ /**
+ Invoke this method when the contents of your enumerable has changed.
+ This will notify any observers watching for content changes. If your are
+ implementing an ordered enumerable (such as an array), also pass the
+ start and end values where the content changed so that it can be used to
+ notify range observers.
+
+ @param {Number} start
+ optional start offset for the content change. For unordered
+ enumerables, you should always pass -1.
+
+ @param {Ember.Enumerable|Number} removing
+ An enumerable of the objects to be removed or the number of items to
+ be removed.
+
+ @param {Ember.Enumerable|Number} adding
+ An enumerable of the objects to be added or the number of items to be
+ added.
+
+ @returns {Object} receiver
+ */
+ enumerableContentDidChange: function(removing, adding) {
+ var notify = this.propertyDidChange, removeCnt, addCnt, hasDelta;
+
+ if ('number' === typeof removing) removeCnt = removing;
+ else if (removing) removeCnt = get(removing, 'length');
+ else removeCnt = removing = -1;
+
+ if ('number' === typeof adding) addCnt = adding;
+ else if (adding) addCnt = get(adding, 'length');
+ else addCnt = adding = -1;
+
+ hasDelta = addCnt<0 || removeCnt<0 || addCnt-removeCnt!==0;
+
+ if (removing === -1) removing = null;
+ if (adding === -1) adding = null;
+
+ Ember.sendEvent(this, '@enumerable:change', [this, removing, adding]);
+ if (hasDelta) Ember.propertyDidChange(this, 'length');
+ Ember.propertyDidChange(this, '[]');
+
+ return this ;
+ }
+
+}) ;
+
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+// ..........................................................
+// HELPERS
+//
+
+var get = Ember.get, set = Ember.set, meta = Ember.meta, map = Ember.EnumerableUtils.map, cacheFor = Ember.cacheFor;
+
+/** @private */
+function none(obj) { return obj===null || obj===undefined; }
+
+// ..........................................................
+// ARRAY
+//
+/**
+ @namespace
+
+ This module implements Observer-friendly Array-like behavior. This mixin is
+ picked up by the Array class as well as other controllers, etc. that want to
+ appear to be arrays.
+
+ Unlike Ember.Enumerable, this mixin defines methods specifically for
+ collections that provide index-ordered access to their contents. When you
+ are designing code that needs to accept any kind of Array-like object, you
+ should use these methods instead of Array primitives because these will
+ properly notify observers of changes to the array.
+
+ Although these methods are efficient, they do add a layer of indirection to
+ your application so it is a good idea to use them only when you need the
+ flexibility of using both true JavaScript arrays and "virtual" arrays such
+ as controllers and collections.
+
+ You can use the methods defined in this module to access and modify array
+ contents in a KVO-friendly way. You can also be notified whenever the
+ membership if an array changes by changing the syntax of the property to
+ .observes('*myProperty.[]') .
+
+ To support Ember.Array in your own class, you must override two
+ primitives to use it: replace() and objectAt().
+
+ Note that the Ember.Array mixin also incorporates the Ember.Enumerable mixin. All
+ Ember.Array-like objects are also enumerable.
+
+ @extends Ember.Enumerable
+ @since Ember 0.9.0
+*/
+Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {
+
+ /** @private - compatibility */
+ isSCArray: true,
+
+ /**
+ @field {Number} length
+
+ Your array must support the length property. Your replace methods should
+ set this property whenever it changes.
+ */
+ length: Ember.required(),
+
+ /**
+ Returns the object at the given index. If the given index is negative or
+ is greater or equal than the array length, returns `undefined`.
+
+ This is one of the primitives you must implement to support `Ember.Array`.
+ If your object supports retrieving the value of an array item using `get()`
+ (i.e. `myArray.get(0)`), then you do not need to implement this method
+ yourself.
+
+ var arr = ['a', 'b', 'c', 'd'];
+ arr.objectAt(0); => "a"
+ arr.objectAt(3); => "d"
+ arr.objectAt(-1); => undefined
+ arr.objectAt(4); => undefined
+ arr.objectAt(5); => undefined
+
+ @param {Number} idx
+ The index of the item to return.
+ */
+ objectAt: function(idx) {
+ if ((idx < 0) || (idx>=get(this, 'length'))) return undefined ;
+ return get(this, idx);
+ },
+
+ /**
+ This returns the objects at the specified indexes, using `objectAt`.
+
+ var arr = ['a', 'b', 'c', 'd'];
+ arr.objectsAt([0, 1, 2]) => ["a", "b", "c"]
+ arr.objectsAt([2, 3, 4]) => ["c", "d", undefined]
+
+ @param {Array} indexes
+ An array of indexes of items to return.
+ */
+ objectsAt: function(indexes) {
+ var self = this;
+ return map(indexes, function(idx){ return self.objectAt(idx); });
+ },
+
+ /** @private (nodoc) - overrides Ember.Enumerable version */
+ nextObject: function(idx) {
+ return this.objectAt(idx);
+ },
+
+ /**
+ @field []
+
+ This is the handler for the special array content property. If you get
+ this property, it will return this. If you set this property it a new
+ array, it will replace the current content.
+
+ This property overrides the default property defined in Ember.Enumerable.
+ */
+ '[]': Ember.computed(function(key, value) {
+ if (value !== undefined) this.replace(0, get(this, 'length'), value) ;
+ return this ;
+ }).property().cacheable(),
+
+ firstObject: Ember.computed(function() {
+ return this.objectAt(0);
+ }).property().cacheable(),
+
+ lastObject: Ember.computed(function() {
+ return this.objectAt(get(this, 'length')-1);
+ }).property().cacheable(),
+
+ /** @private (nodoc) - optimized version from Enumerable */
+ contains: function(obj){
+ return this.indexOf(obj) >= 0;
+ },
+
+ // Add any extra methods to Ember.Array that are native to the built-in Array.
+ /**
+ Returns a new array that is a slice of the receiver. This implementation
+ uses the observable array methods to retrieve the objects for the new
+ slice.
+
+ var arr = ['red', 'green', 'blue'];
+ arr.slice(0); => ['red', 'green', 'blue']
+ arr.slice(0, 2); => ['red', 'green']
+ arr.slice(1, 100); => ['green', 'blue']
+
+ @param beginIndex {Integer} (Optional) index to begin slicing from.
+ @param endIndex {Integer} (Optional) index to end the slice at.
+ @returns {Array} New array with specified slice
+ */
+ slice: function(beginIndex, endIndex) {
+ var ret = [];
+ var length = get(this, 'length') ;
+ if (none(beginIndex)) beginIndex = 0 ;
+ if (none(endIndex) || (endIndex > length)) endIndex = length ;
+ while(beginIndex < endIndex) {
+ ret[ret.length] = this.objectAt(beginIndex++) ;
+ }
+ return ret ;
+ },
+
+ /**
+ Returns the index of the given object's first occurrence.
+ If no startAt argument is given, the starting location to
+ search is 0. If it's negative, will count backward from
+ the end of the array. Returns -1 if no match is found.
+
+ var arr = ["a", "b", "c", "d", "a"];
+ arr.indexOf("a"); => 0
+ arr.indexOf("z"); => -1
+ arr.indexOf("a", 2); => 4
+ arr.indexOf("a", -1); => 4
+ arr.indexOf("b", 3); => -1
+ arr.indexOf("a", 100); => -1
+
+ @param {Object} object the item to search for
+ @param {Number} startAt optional starting location to search, default 0
+ @returns {Number} index or -1 if not found
+ */
+ indexOf: function(object, startAt) {
+ var idx, len = get(this, 'length');
+
+ if (startAt === undefined) startAt = 0;
+ if (startAt < 0) startAt += len;
+
+ for(idx=startAt;idx<len;idx++) {
+ if (this.objectAt(idx, true) === object) return idx ;
+ }
+ return -1;
+ },
+
+ /**
+ Returns the index of the given object's last occurrence.
+ If no startAt argument is given, the search starts from
+ the last position. If it's negative, will count backward
+ from the end of the array. Returns -1 if no match is found.
+
+ var arr = ["a", "b", "c", "d", "a"];
+ arr.lastIndexOf("a"); => 4
+ arr.lastIndexOf("z"); => -1
+ arr.lastIndexOf("a", 2); => 0
+ arr.lastIndexOf("a", -1); => 4
+ arr.lastIndexOf("b", 3); => 1
+ arr.lastIndexOf("a", 100); => 4
+
+ @param {Object} object the item to search for
+ @param {Number} startAt optional starting location to search, default 0
+ @returns {Number} index or -1 if not found
+ */
+ lastIndexOf: function(object, startAt) {
+ var idx, len = get(this, 'length');
+
+ if (startAt === undefined || startAt >= len) startAt = len-1;
+ if (startAt < 0) startAt += len;
+
+ for(idx=startAt;idx>=0;idx--) {
+ if (this.objectAt(idx) === object) return idx ;
+ }
+ return -1;
+ },
+
+ // ..........................................................
+ // ARRAY OBSERVERS
+ //
+
+ /**
+ Adds an array observer to the receiving array. The array observer object
+ normally must implement two methods:
+
+ * `arrayWillChange(start, removeCount, addCount)` - This method will be
+ called just before the array is modified.
+ * `arrayDidChange(start, removeCount, addCount)` - This method will be
+ called just after the array is modified.
+
+ Both callbacks will be passed the starting index of the change as well a
+ a count of the items to be removed and added. You can use these callbacks
+ to optionally inspect the array during the change, clear caches, or do
+ any other bookkeeping necessary.
+
+ In addition to passing a target, you can also include an options hash
+ which you can use to override the method names that will be invoked on the
+ target.
+
+ @param {Object} target
+ The observer object.
+
+ @param {Hash} opts
+ Optional hash of configuration options including willChange, didChange,
+ and a context option.
+
+ @returns {Ember.Array} receiver
+ */
+ addArrayObserver: function(target, opts) {
+ var willChange = (opts && opts.willChange) || 'arrayWillChange',
+ didChange = (opts && opts.didChange) || 'arrayDidChange';
+
+ var hasObservers = get(this, 'hasArrayObservers');
+ if (!hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');
+ Ember.addListener(this, '@array:before', target, willChange);
+ Ember.addListener(this, '@array:change', target, didChange);
+ if (!hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');
+ return this;
+ },
+
+ /**
+ Removes an array observer from the object if the observer is current
+ registered. Calling this method multiple times with the same object will
+ have no effect.
+
+ @param {Object} target
+ The object observing the array.
+
+ @returns {Ember.Array} receiver
+ */
+ removeArrayObserver: function(target, opts) {
+ var willChange = (opts && opts.willChange) || 'arrayWillChange',
+ didChange = (opts && opts.didChange) || 'arrayDidChange';
+
+ var hasObservers = get(this, 'hasArrayObservers');
+ if (hasObservers) Ember.propertyWillChange(this, 'hasArrayObservers');
+ Ember.removeListener(this, '@array:before', target, willChange);
+ Ember.removeListener(this, '@array:change', target, didChange);
+ if (hasObservers) Ember.propertyDidChange(this, 'hasArrayObservers');
+ return this;
+ },
+
+ /**
+ Becomes true whenever the array currently has observers watching changes
+ on the array.
+
+ @type Boolean
+ */
+ hasArrayObservers: Ember.computed(function() {
+ return Ember.hasListeners(this, '@array:change') || Ember.hasListeners(this, '@array:before');
+ }).property().cacheable(),
+
+ /**
+ If you are implementing an object that supports Ember.Array, call this
+ method just before the array content changes to notify any observers and
+ invalidate any related properties. Pass the starting index of the change
+ as well as a delta of the amounts to change.
+
+ @param {Number} startIdx
+ The starting index in the array that will change.
+
+ @param {Number} removeAmt
+ The number of items that will be removed. If you pass null assumes 0
+
+ @param {Number} addAmt
+ The number of items that will be added. If you pass null assumes 0.
+
+ @returns {Ember.Array} receiver
+ */
+ arrayContentWillChange: function(startIdx, removeAmt, addAmt) {
+
+ // if no args are passed assume everything changes
+ if (startIdx===undefined) {
+ startIdx = 0;
+ removeAmt = addAmt = -1;
+ } else {
+ if (removeAmt === undefined) removeAmt=-1;
+ if (addAmt === undefined) addAmt=-1;
+ }
+
+ // Make sure the @each proxy is set up if anyone is observing @each
+ if (Ember.isWatching(this, '@each')) { get(this, '@each'); }
+
+ Ember.sendEvent(this, '@array:before', [this, startIdx, removeAmt, addAmt]);
+
+ var removing, lim;
+ if (startIdx>=0 && removeAmt>=0 && get(this, 'hasEnumerableObservers')) {
+ removing = [];
+ lim = startIdx+removeAmt;
+ for(var idx=startIdx;idx<lim;idx++) removing.push(this.objectAt(idx));
+ } else {
+ removing = removeAmt;
+ }
+
+ this.enumerableContentWillChange(removing, addAmt);
+
+ return this;
+ },
+
+ arrayContentDidChange: function(startIdx, removeAmt, addAmt) {
+
+ // if no args are passed assume everything changes
+ if (startIdx===undefined) {
+ startIdx = 0;
+ removeAmt = addAmt = -1;
+ } else {
+ if (removeAmt === undefined) removeAmt=-1;
+ if (addAmt === undefined) addAmt=-1;
+ }
+
+ var adding, lim;
+ if (startIdx>=0 && addAmt>=0 && get(this, 'hasEnumerableObservers')) {
+ adding = [];
+ lim = startIdx+addAmt;
+ for(var idx=startIdx;idx<lim;idx++) adding.push(this.objectAt(idx));
+ } else {
+ adding = addAmt;
+ }
+
+ this.enumerableContentDidChange(removeAmt, adding);
+ Ember.sendEvent(this, '@array:change', [this, startIdx, removeAmt, addAmt]);
+
+ var length = get(this, 'length'),
+ cachedFirst = cacheFor(this, 'firstObject'),
+ cachedLast = cacheFor(this, 'lastObject');
+ if (this.objectAt(0) !== cachedFirst) {
+ Ember.propertyWillChange(this, 'firstObject');
+ Ember.propertyDidChange(this, 'firstObject');
+ }
+ if (this.objectAt(length-1) !== cachedLast) {
+ Ember.propertyWillChange(this, 'lastObject');
+ Ember.propertyDidChange(this, 'lastObject');
+ }
+
+ return this;
+ },
+
+ // ..........................................................
+ // ENUMERATED PROPERTIES
+ //
+
+ /**
+ Returns a special object that can be used to observe individual properties
+ on the array. Just get an equivalent property on this object and it will
+ return an enumerable that maps automatically to the named key on the
+ member objects.
+ */
+ '@each': Ember.computed(function() {
+ if (!this.__each) this.__each = new Ember.EachProxy(this);
+ return this.__each;
+ }).property().cacheable()
+
+}) ;
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/**
+ @namespace
+
+ Implements some standard methods for comparing objects. Add this mixin to
+ any class you create that can compare its instances.
+
+ You should implement the compare() method.
+
+ @extends Ember.Mixin
+ @since Ember 0.9
+*/
+Ember.Comparable = Ember.Mixin.create( /** @scope Ember.Comparable.prototype */{
+
+ /**
+ walk like a duck. Indicates that the object can be compared.
+
+ @type Boolean
+ @default true
+ @constant
+ */
+ isComparable: true,
+
+ /**
+ Override to return the result of the comparison of the two parameters. The
+ compare method should return:
+
+ - `-1` if `a < b`
+ - `0` if `a == b`
+ - `1` if `a > b`
+
+ Default implementation raises an exception.
+
+ @param a {Object} the first object to compare
+ @param b {Object} the second object to compare
+ @returns {Integer} the result of the comparison
+ */
+ compare: Ember.required(Function)
+
+});
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2010 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/**
+ @namespace
+
+ Implements some standard methods for copying an object. Add this mixin to
+ any object you create that can create a copy of itself. This mixin is
+ added automatically to the built-in array.
+
+ You should generally implement the copy() method to return a copy of the
+ receiver.
+
+ Note that frozenCopy() will only work if you also implement Ember.Freezable.
+
+ @extends Ember.Mixin
+ @since Ember 0.9
+*/
+Ember.Copyable = Ember.Mixin.create(
+/** @scope Ember.Copyable.prototype */ {
+
+ /**
+ Override to return a copy of the receiver. Default implementation raises
+ an exception.
+
+ @function
+ @param deep {Boolean} if true, a deep copy of the object should be made
+ @returns {Object} copy of receiver
+ */
+ copy: Ember.required(Function),
+
+ /**
+ If the object implements Ember.Freezable, then this will return a new copy
+ if the object is not frozen and the receiver if the object is frozen.
+
+ Raises an exception if you try to call this method on a object that does
+ not support freezing.
+
+ You should use this method whenever you want a copy of a freezable object
+ since a freezable object can simply return itself without actually
+ consuming more memory.
+
+ @returns {Object} copy of receiver or receiver
+ */
+ frozenCopy: function() {
+ if (Ember.Freezable && Ember.Freezable.detect(this)) {
+ return get(this, 'isFrozen') ? this : this.copy().freeze();
+ } else {
+ throw new Error(Ember.String.fmt("%@ does not support freezing", [this]));
+ }
+ }
+});
+
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2010 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+
+
+
+
+var get = Ember.get, set = Ember.set;
+
+/**
+ @namespace
+
+ The Ember.Freezable mixin implements some basic methods for marking an object
+ as frozen. Once an object is frozen it should be read only. No changes
+ may be made the internal state of the object.
+
+ ## Enforcement
+
+ To fully support freezing in your subclass, you must include this mixin and
+ override any method that might alter any property on the object to instead
+ raise an exception. You can check the state of an object by checking the
+ isFrozen property.
+
+ Although future versions of JavaScript may support language-level freezing
+ object objects, that is not the case today. Even if an object is freezable,
+ it is still technically possible to modify the object, even though it could
+ break other parts of your application that do not expect a frozen object to
+ change. It is, therefore, very important that you always respect the
+ isFrozen property on all freezable objects.
+
+ ## Example Usage
+
+ The example below shows a simple object that implement the Ember.Freezable
+ protocol.
+
+ Contact = Ember.Object.extend(Ember.Freezable, {
+
+ firstName: null,
+
+ lastName: null,
+
+ // swaps the names
+ swapNames: function() {
+ if (this.get('isFrozen')) throw Ember.FROZEN_ERROR;
+ var tmp = this.get('firstName');
+ this.set('firstName', this.get('lastName'));
+ this.set('lastName', tmp);
+ return this;
+ }
+
+ });
+
+ c = Context.create({ firstName: "John", lastName: "Doe" });
+ c.swapNames(); => returns c
+ c.freeze();
+ c.swapNames(); => EXCEPTION
+
+ ## Copying
+
+ Usually the Ember.Freezable protocol is implemented in cooperation with the
+ Ember.Copyable protocol, which defines a frozenCopy() method that will return
+ a frozen object, if the object implements this method as well.
+
+ @extends Ember.Mixin
+ @since Ember 0.9
+*/
+Ember.Freezable = Ember.Mixin.create(
+/** @scope Ember.Freezable.prototype */ {
+
+ /**
+ Set to true when the object is frozen. Use this property to detect whether
+ your object is frozen or not.
+
+ @type Boolean
+ */
+ isFrozen: false,
+
+ /**
+ Freezes the object. Once this method has been called the object should
+ no longer allow any properties to be edited.
+
+ @returns {Object} receiver
+ */
+ freeze: function() {
+ if (get(this, 'isFrozen')) return this;
+ set(this, 'isFrozen', true);
+ return this;
+ }
+
+});
+
+Ember.FROZEN_ERROR = "Frozen object cannot be modified.";
+
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var forEach = Ember.EnumerableUtils.forEach;
+
+/**
+ @class
+
+ This mixin defines the API for modifying generic enumerables. These methods
+ can be applied to an object regardless of whether it is ordered or
+ unordered.
+
+ Note that an Enumerable can change even if it does not implement this mixin.
+ For example, a MappedEnumerable cannot be directly modified but if its
+ underlying enumerable changes, it will change also.
+
+ ## Adding Objects
+
+ To add an object to an enumerable, use the addObject() method. This
+ method will only add the object to the enumerable if the object is not
+ already present and the object if of a type supported by the enumerable.
+
+ set.addObject(contact);
+
+ ## Removing Objects
+
+ To remove an object form an enumerable, use the removeObject() method. This
+ will only remove the object if it is already in the enumerable, otherwise
+ this method has no effect.
+
+ set.removeObject(contact);
+
+ ## Implementing In Your Own Code
+
+ If you are implementing an object and want to support this API, just include
+ this mixin in your class and implement the required methods. In your unit
+ tests, be sure to apply the Ember.MutableEnumerableTests to your object.
+
+ @extends Ember.Mixin
+ @extends Ember.Enumerable
+*/
+Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
+ /** @scope Ember.MutableEnumerable.prototype */ {
+
+ /**
+ __Required.__ You must implement this method to apply this mixin.
+
+ Attempts to add the passed object to the receiver if the object is not
+ already present in the collection. If the object is present, this method
+ has no effect.
+
+ If the passed object is of a type not supported by the receiver
+ then this method should raise an exception.
+
+ @function
+
+ @param {Object} object
+ The object to add to the enumerable.
+
+ @returns {Object} the passed object
+ */
+ addObject: Ember.required(Function),
+
+ /**
+ Adds each object in the passed enumerable to the receiver.
+
+ @param {Ember.Enumerable} objects the objects to add.
+ @returns {Object} receiver
+ */
+ addObjects: function(objects) {
+ Ember.beginPropertyChanges(this);
+ forEach(objects, function(obj) { this.addObject(obj); }, this);
+ Ember.endPropertyChanges(this);
+ return this;
+ },
+
+ /**
+ __Required.__ You must implement this method to apply this mixin.
+
+ Attempts to remove the passed object from the receiver collection if the
+ object is in present in the collection. If the object is not present,
+ this method has no effect.
+
+ If the passed object is of a type not supported by the receiver
+ then this method should raise an exception.
+
+ @function
+
+ @param {Object} object
+ The object to remove from the enumerable.
+
+ @returns {Object} the passed object
+ */
+ removeObject: Ember.required(Function),
+
+
+ /**
+ Removes each objects in the passed enumerable from the receiver.
+
+ @param {Ember.Enumerable} objects the objects to remove
+ @returns {Object} receiver
+ */
+ removeObjects: function(objects) {
+ Ember.beginPropertyChanges(this);
+ forEach(objects, function(obj) { this.removeObject(obj); }, this);
+ Ember.endPropertyChanges(this);
+ return this;
+ }
+
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+// ..........................................................
+// CONSTANTS
+//
+
+var OUT_OF_RANGE_EXCEPTION = "Index out of range" ;
+var EMPTY = [];
+
+// ..........................................................
+// HELPERS
+//
+
+var get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach;
+
+/**
+ @class
+
+ This mixin defines the API for modifying array-like objects. These methods
+ can be applied only to a collection that keeps its items in an ordered set.
+
+ Note that an Array can change even if it does not implement this mixin.
+ For example, one might implement a SparseArray that cannot be directly
+ modified, but if its underlying enumerable changes, it will change also.
+
+ @extends Ember.Mixin
+ @extends Ember.Array
+ @extends Ember.MutableEnumerable
+*/
+Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
+ /** @scope Ember.MutableArray.prototype */ {
+
+ /**
+ __Required.__ You must implement this method to apply this mixin.
+
+ This is one of the primitives you must implement to support Ember.Array. You
+ should replace amt objects started at idx with the objects in the passed
+ array. You should also call this.enumerableContentDidChange() ;
+
+ @function
+
+ @param {Number} idx
+ Starting index in the array to replace. If idx >= length, then append
+ to the end of the array.
+
+ @param {Number} amt
+ Number of elements that should be removed from the array, starting at
+ *idx*.
+
+ @param {Array} objects
+ An array of zero or more objects that should be inserted into the array
+ at *idx*
+ */
+ replace: Ember.required(),
+
+ /**
+ Remove all elements from self. This is useful if you
+ want to reuse an existing array without having to recreate it.
+
+ var colors = ["red", "green", "blue"];
+ color.length(); => 3
+ colors.clear(); => []
+ colors.length(); => 0
+
+ @returns {Ember.Array} An empty Array.
+ */
+ clear: function () {
+ var len = get(this, 'length');
+ if (len === 0) return this;
+ this.replace(0, len, EMPTY);
+ return this;
+ },
+
+ /**
+ This will use the primitive replace() method to insert an object at the
+ specified index.
+
+ var colors = ["red", "green", "blue"];
+ colors.insertAt(2, "yellow"); => ["red", "green", "yellow", "blue"]
+ colors.insertAt(5, "orange"); => Error: Index out of range
+
+ @param {Number} idx index of insert the object at.
+ @param {Object} object object to insert
+ */
+ insertAt: function(idx, object) {
+ if (idx > get(this, 'length')) throw new Error(OUT_OF_RANGE_EXCEPTION) ;
+ this.replace(idx, 0, [object]) ;
+ return this ;
+ },
+
+ /**
+ Remove an object at the specified index using the replace() primitive
+ method. You can pass either a single index, or a start and a length.
+
+ If you pass a start and length that is beyond the
+ length this method will throw an Ember.OUT_OF_RANGE_EXCEPTION
+
+ var colors = ["red", "green", "blue", "yellow", "orange"];
+ colors.removeAt(0); => ["green", "blue", "yellow", "orange"]
+ colors.removeAt(2, 2); => ["green", "blue"]
+ colors.removeAt(4, 2); => Error: Index out of range
+
+ @param {Number} start index, start of range
+ @param {Number} len length of passing range
+ @returns {Object} receiver
+ */
+ removeAt: function(start, len) {
+
+ var delta = 0;
+
+ if ('number' === typeof start) {
+
+ if ((start < 0) || (start >= get(this, 'length'))) {
+ throw new Error(OUT_OF_RANGE_EXCEPTION);
+ }
+
+ // fast case
+ if (len === undefined) len = 1;
+ this.replace(start, len, EMPTY);
+ }
+
+ return this ;
+ },
+
+ /**
+ Push the object onto the end of the array. Works just like push() but it
+ is KVO-compliant.
+
+ var colors = ["red", "green", "blue"];
+ colors.pushObject("black"); => ["red", "green", "blue", "black"]
+ colors.pushObject(["yellow", "orange"]); => ["red", "green", "blue", "black", ["yellow", "orange"]]
+
+ */
+ pushObject: function(obj) {
+ this.insertAt(get(this, 'length'), obj) ;
+ return obj ;
+ },
+
+ /**
+ Add the objects in the passed numerable to the end of the array. Defers
+ notifying observers of the change until all objects are added.
+
+ var colors = ["red", "green", "blue"];
+ colors.pushObjects("black"); => ["red", "green", "blue", "black"]
+ colors.pushObjects(["yellow", "orange"]); => ["red", "green", "blue", "black", "yellow", "orange"]
+
+ @param {Ember.Enumerable} objects the objects to add
+ @returns {Ember.Array} receiver
+ */
+ pushObjects: function(objects) {
+ this.replace(get(this, 'length'), 0, objects);
+ return this;
+ },
+
+ /**
+ Pop object from array or nil if none are left. Works just like pop() but
+ it is KVO-compliant.
+
+ var colors = ["red", "green", "blue"];
+ colors.popObject(); => "blue"
+ console.log(colors); => ["red", "green"]
+
+ */
+ popObject: function() {
+ var len = get(this, 'length') ;
+ if (len === 0) return null ;
+
+ var ret = this.objectAt(len-1) ;
+ this.removeAt(len-1, 1) ;
+ return ret ;
+ },
+
+ /**
+ Shift an object from start of array or nil if none are left. Works just
+ like shift() but it is KVO-compliant.
+
+ var colors = ["red", "green", "blue"];
+ colors.shiftObject(); => "red"
+ console.log(colors); => ["green", "blue"]
+
+ */
+ shiftObject: function() {
+ if (get(this, 'length') === 0) return null ;
+ var ret = this.objectAt(0) ;
+ this.removeAt(0) ;
+ return ret ;
+ },
+
+ /**
+ Unshift an object to start of array. Works just like unshift() but it is
+ KVO-compliant.
+
+ var colors = ["red", "green", "blue"];
+ colors.unshiftObject("yellow"); => ["yellow", "red", "green", "blue"]
+ colors.unshiftObject(["black", "white"]); => [["black", "white"], "yellow", "red", "green", "blue"]
+
+ */
+ unshiftObject: function(obj) {
+ this.insertAt(0, obj) ;
+ return obj ;
+ },
+
+ /**
+ Adds the named objects to the beginning of the array. Defers notifying
+ observers until all objects have been added.
+
+ var colors = ["red", "green", "blue"];
+ colors.unshiftObjects(["black", "white"]); => ["black", "white", "red", "green", "blue"]
+ colors.unshiftObjects("yellow"); => Type Error: 'undefined' is not a function
+
+ @param {Ember.Enumerable} objects the objects to add
+ @returns {Ember.Array} receiver
+ */
+ unshiftObjects: function(objects) {
+ this.replace(0, 0, objects);
+ return this;
+ },
+
+ /**
+ Reverse objects in the array. Works just like reverse() but it is
+ KVO-compliant.
+
+ @return {Ember.Array} receiver
+ */
+ reverseObjects: function() {
+ var len = get(this, 'length');
+ if (len === 0) return this;
+ var objects = this.toArray().reverse();
+ this.replace(0, len, objects);
+ return this;
+ },
+
+ // ..........................................................
+ // IMPLEMENT Ember.MutableEnumerable
+ //
+
+ /** @private (nodoc) */
+ removeObject: function(obj) {
+ var loc = get(this, 'length') || 0;
+ while(--loc >= 0) {
+ var curObject = this.objectAt(loc) ;
+ if (curObject === obj) this.removeAt(loc) ;
+ }
+ return this ;
+ },
+
+ /** @private (nodoc) */
+ addObject: function(obj) {
+ if (!this.contains(obj)) this.pushObject(obj);
+ return this ;
+ }
+
+});
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+var get = Ember.get, set = Ember.set, defineProperty = Ember.defineProperty;
+
+/**
+ @class
+
+ ## Overview
+
+ This mixin provides properties and property observing functionality, core
+ features of the Ember object model.
+
+ Properties and observers allow one object to observe changes to a
+ property on another object. This is one of the fundamental ways that
+ models, controllers and views communicate with each other in an Ember
+ application.
+
+ Any object that has this mixin applied can be used in observer
+ operations. That includes Ember.Object and most objects you will
+ interact with as you write your Ember application.
+
+ Note that you will not generally apply this mixin to classes yourself,
+ but you will use the features provided by this module frequently, so it
+ is important to understand how to use it.
+
+ ## Using get() and set()
+
+ Because of Ember's support for bindings and observers, you will always
+ access properties using the get method, and set properties using the
+ set method. This allows the observing objects to be notified and
+ computed properties to be handled properly.
+
+ More documentation about `get` and `set` are below.
+
+ ## Observing Property Changes
+
+ You typically observe property changes simply by adding the `observes`
+ call to the end of your method declarations in classes that you write.
+ For example:
+
+ Ember.Object.create({
+ valueObserver: function() {
+ // Executes whenever the "value" property changes
+ }.observes('value')
+ });
+
+ Although this is the most common way to add an observer, this capability
+ is actually built into the Ember.Object class on top of two methods
+ defined in this mixin: `addObserver` and `removeObserver`. You can use
+ these two methods to add and remove observers yourself if you need to
+ do so at runtime.
+
+ To add an observer for a property, call:
+
+ object.addObserver('propertyKey', targetObject, targetAction)
+
+ This will call the `targetAction` method on the `targetObject` to be called
+ whenever the value of the `propertyKey` changes.
+
+ Note that if `propertyKey` is a computed property, the observer will be
+ called when any of the property dependencies are changed, even if the
+ resulting value of the computed property is unchanged. This is necessary
+ because computed properties are not computed until `get` is called.
+
+ @extends Ember.Mixin
+*/
+Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
+
+ /** @private - compatibility */
+ isObserverable: true,
+
+ /**
+ Retrieves the value of a property from the object.
+
+ This method is usually similar to using object[keyName] or object.keyName,
+ however it supports both computed properties and the unknownProperty
+ handler.
+
+ Because `get` unifies the syntax for accessing all these kinds
+ of properties, it can make many refactorings easier, such as replacing a
+ simple property with a computed property, or vice versa.
+
+ ### Computed Properties
+
+ Computed properties are methods defined with the `property` modifier
+ declared at the end, such as:
+
+ fullName: function() {
+ return this.getEach('firstName', 'lastName').compact().join(' ');
+ }.property('firstName', 'lastName')
+
+ When you call `get` on a computed property, the function will be
+ called and the return value will be returned instead of the function
+ itself.
+
+ ### Unknown Properties
+
+ Likewise, if you try to call `get` on a property whose value is
+ undefined, the unknownProperty() method will be called on the object.
+ If this method returns any value other than undefined, it will be returned
+ instead. This allows you to implement "virtual" properties that are
+ not defined upfront.
+
+ @param {String} key The property to retrieve
+ @returns {Object} The property value or undefined.
+ */
+ get: function(keyName) {
+ return get(this, keyName);
+ },
+
+ /**
+ To get multiple properties at once, call getProperties
+ with a list of strings or an array:
+
+ record.getProperties('firstName', 'lastName', 'zipCode'); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
+
+ is equivalent to:
+
+ record.getProperties(['firstName', 'lastName', 'zipCode']); // => { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
+
+ @param {String...|Array} list of keys to get
+ @returns {Hash}
+ */
+ getProperties: function() {
+ var ret = {};
+ var propertyNames = arguments;
+ if (arguments.length === 1 && Ember.typeOf(arguments[0]) === 'array') {
+ propertyNames = arguments[0];
+ }
+ for(var i = 0; i < propertyNames.length; i++) {
+ ret[propertyNames[i]] = get(this, propertyNames[i]);
+ }
+ return ret;
+ },
+
+ /**
+ Sets the provided key or path to the value.
+
+ This method is generally very similar to calling object[key] = value or
+ object.key = value, except that it provides support for computed
+ properties, the unknownProperty() method and property observers.
+
+ ### Computed Properties
+
+ If you try to set a value on a key that has a computed property handler
+ defined (see the get() method for an example), then set() will call
+ that method, passing both the value and key instead of simply changing
+ the value itself. This is useful for those times when you need to
+ implement a property that is composed of one or more member
+ properties.
+
+ ### Unknown Properties
+
+ If you try to set a value on a key that is undefined in the target
+ object, then the unknownProperty() handler will be called instead. This
+ gives you an opportunity to implement complex "virtual" properties that
+ are not predefined on the object. If unknownProperty() returns
+ undefined, then set() will simply set the value on the object.
+
+ ### Property Observers
+
+ In addition to changing the property, set() will also register a
+ property change with the object. Unless you have placed this call
+ inside of a beginPropertyChanges() and endPropertyChanges(), any "local"
+ observers (i.e. observer methods declared on the same object), will be
+ called immediately. Any "remote" observers (i.e. observer methods
+ declared on another object) will be placed in a queue and called at a
+ later time in a coalesced manner.
+
+ ### Chaining
+
+ In addition to property changes, set() returns the value of the object
+ itself so you can do chaining like this:
+
+ record.set('firstName', 'Charles').set('lastName', 'Jolley');
+
+ @param {String} key The property to set
+ @param {Object} value The value to set or null.
+ @returns {Ember.Observable}
+ */
+ set: function(keyName, value) {
+ set(this, keyName, value);
+ return this;
+ },
+
+ /**
+ To set multiple properties at once, call setProperties
+ with a Hash:
+
+ record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });
+
+ @param {Hash} hash the hash of keys and values to set
+ @returns {Ember.Observable}
+ */
+ setProperties: function(hash) {
+ return Ember.setProperties(this, hash);
+ },
+
+ /**
+ Begins a grouping of property changes.
+
+ You can use this method to group property changes so that notifications
+ will not be sent until the changes are finished. If you plan to make a
+ large number of changes to an object at one time, you should call this
+ method at the beginning of the changes to begin deferring change
+ notifications. When you are done making changes, call endPropertyChanges()
+ to deliver the deferred change notifications and end deferring.
+
+ @returns {Ember.Observable}
+ */
+ beginPropertyChanges: function() {
+ Ember.beginPropertyChanges();
+ return this;
+ },
+
+ /**
+ Ends a grouping of property changes.
+
+ You can use this method to group property changes so that notifications
+ will not be sent until the changes are finished. If you plan to make a
+ large number of changes to an object at one time, you should call
+ beginPropertyChanges() at the beginning of the changes to defer change
+ notifications. When you are done making changes, call this method to
+ deliver the deferred change notifications and end deferring.
+
+ @returns {Ember.Observable}
+ */
+ endPropertyChanges: function() {
+ Ember.endPropertyChanges();
+ return this;
+ },
+
+ /**
+ Notify the observer system that a property is about to change.
+
+ Sometimes you need to change a value directly or indirectly without
+ actually calling get() or set() on it. In this case, you can use this
+ method and propertyDidChange() instead. Calling these two methods
+ together will notify all observers that the property has potentially
+ changed value.
+
+ Note that you must always call propertyWillChange and propertyDidChange as
+ a pair. If you do not, it may get the property change groups out of order
+ and cause notifications to be delivered more often than you would like.
+
+ @param {String} key The property key that is about to change.
+ @returns {Ember.Observable}
+ */
+ propertyWillChange: function(keyName){
+ Ember.propertyWillChange(this, keyName);
+ return this;
+ },
+
+ /**
+ Notify the observer system that a property has just changed.
+
+ Sometimes you need to change a value directly or indirectly without
+ actually calling get() or set() on it. In this case, you can use this
+ method and propertyWillChange() instead. Calling these two methods
+ together will notify all observers that the property has potentially
+ changed value.
+
+ Note that you must always call propertyWillChange and propertyDidChange as
+ a pair. If you do not, it may get the property change groups out of order
+ and cause notifications to be delivered more often than you would like.
+
+ @param {String} keyName The property key that has just changed.
+ @returns {Ember.Observable}
+ */
+ propertyDidChange: function(keyName) {
+ Ember.propertyDidChange(this, keyName);
+ return this;
+ },
+
+ /**
+ Convenience method to call `propertyWillChange` and `propertyDidChange` in
+ succession.
+
+ @param {String} keyName The property key to be notified about.
+ @returns {Ember.Observable}
+ */
+ notifyPropertyChange: function(keyName) {
+ this.propertyWillChange(keyName);
+ this.propertyDidChange(keyName);
+ return this;
+ },
+
+ addBeforeObserver: function(key, target, method) {
+ Ember.addBeforeObserver(this, key, target, method);
+ },
+
+ /**
+ Adds an observer on a property.
+
+ This is the core method used to register an observer for a property.
+
+ Once you call this method, anytime the key's value is set, your observer
+ will be notified. Note that the observers are triggered anytime the
+ value is set, regardless of whether it has actually changed. Your
+ observer should be prepared to handle that.
+
+ You can also pass an optional context parameter to this method. The
+ context will be passed to your observer method whenever it is triggered.
+ Note that if you add the same target/method pair on a key multiple times
+ with different context parameters, your observer will only be called once
+ with the last context you passed.
+
+ ### Observer Methods
+
+ Observer methods you pass should generally have the following signature if
+ you do not pass a "context" parameter:
+
+ fooDidChange: function(sender, key, value, rev);
+
+ The sender is the object that changed. The key is the property that
+ changes. The value property is currently reserved and unused. The rev
+ is the last property revision of the object when it changed, which you can
+ use to detect if the key value has really changed or not.
+
+ If you pass a "context" parameter, the context will be passed before the
+ revision like so:
+
+ fooDidChange: function(sender, key, value, context, rev);
+
+ Usually you will not need the value, context or revision parameters at
+ the end. In this case, it is common to write observer methods that take
+ only a sender and key value as parameters or, if you aren't interested in
+ any of these values, to write an observer that has no parameters at all.
+
+ @param {String} key The key to observer
+ @param {Object} target The target object to invoke
+ @param {String|Function} method The method to invoke.
+ @returns {Ember.Object} self
+ */
+ addObserver: function(key, target, method) {
+ Ember.addObserver(this, key, target, method);
+ },
+
+ /**
+ Remove an observer you have previously registered on this object. Pass
+ the same key, target, and method you passed to addObserver() and your
+ target will no longer receive notifications.
+
+ @param {String} key The key to observer
+ @param {Object} target The target object to invoke
+ @param {String|Function} method The method to invoke.
+ @returns {Ember.Observable} receiver
+ */
+ removeObserver: function(key, target, method) {
+ Ember.removeObserver(this, key, target, method);
+ },
+
+ /**
+ Returns true if the object currently has observers registered for a
+ particular key. You can use this method to potentially defer performing
+ an expensive action until someone begins observing a particular property
+ on the object.
+
+ @param {String} key Key to check
+ @returns {Boolean}
+ */
+ hasObserverFor: function(key) {
+ return Ember.hasListeners(this, key+':change');
+ },
+
+ /**
+ This method will be called when a client attempts to get the value of a
+ property that has not been defined in one of the typical ways. Override
+ this method to create "virtual" properties.
+
+ @param {String} key The name of the unknown property that was requested.
+ @returns {Object} The property value or undefined. Default is undefined.
+ */
+ unknownProperty: function(key) {
+ return undefined;
+ },
+
+ /**
+ This method will be called when a client attempts to set the value of a
+ property that has not been defined in one of the typical ways. Override
+ this method to create "virtual" properties.
+
+ @param {String} key The name of the unknown property to be set.
+ @param {Object} value The value the unknown property is to be set to.
+ */
+ setUnknownProperty: function(key, value) {
+ defineProperty(this, key);
+ set(this, key, value);
+ },
+
+ /**
+ @deprecated
+ @param {String} path The property path to retrieve
+ @returns {Object} The property value or undefined.
+ */
+ getPath: function(path) {
+ Ember.deprecate("getPath is deprecated since get now supports paths");
+ return this.get(path);
+ },
+
+ /**
+ @deprecated
+ @param {String} path The path to the property that will be set
+ @param {Object} value The value to set or null.
+ @returns {Ember.Observable}
+ */
+ setPath: function(path, value) {
+ Ember.deprecate("setPath is deprecated since set now supports paths");
+ return this.set(path, value);
+ },
+
+ /**
+ Retrieves the value of a property, or a default value in the case that the property
+ returns undefined.
+
+ person.getWithDefault('lastName', 'Doe');
+
+ @param {String} keyName The name of the property to retrieve
+ @param {Object} defaultValue The value to return if the property value is undefined
+ @returns {Object} The property value or the defaultValue.
+ */
+ getWithDefault: function(keyName, defaultValue) {
+ return Ember.getWithDefault(this, keyName, defaultValue);
+ },
+
+ /**
+ Set the value of a property to the current value plus some amount.
+
+ person.incrementProperty('age');
+ team.incrementProperty('score', 2);
+
+ @param {String} keyName The name of the property to increment
+ @param {Object} increment The amount to increment by. Defaults to 1
+ @returns {Object} The new property value
+ */
+ incrementProperty: function(keyName, increment) {
+ if (!increment) { increment = 1; }
+ set(this, keyName, (get(this, keyName) || 0)+increment);
+ return get(this, keyName);
+ },
+
+ /**
+ Set the value of a property to the current value minus some amount.
+
+ player.decrementProperty('lives');
+ orc.decrementProperty('health', 5);
+
+ @param {String} keyName The name of the property to decrement
+ @param {Object} increment The amount to decrement by. Defaults to 1
+ @returns {Object} The new property value
+ */
+ decrementProperty: function(keyName, increment) {
+ if (!increment) { increment = 1; }
+ set(this, keyName, (get(this, keyName) || 0)-increment);
+ return get(this, keyName);
+ },
+
+ /**
+ Set the value of a boolean property to the opposite of it's
+ current value.
+
+ starship.toggleProperty('warpDriveEnaged');
+
+ @param {String} keyName The name of the property to toggle
+ @returns {Object} The new property value
+ */
+ toggleProperty: function(keyName) {
+ set(this, keyName, !get(this, keyName));
+ return get(this, keyName);
+ },
+
+ /**
+ Returns the cached value of a computed property, if it exists.
+ This allows you to inspect the value of a computed property
+ without accidentally invoking it if it is intended to be
+ generated lazily.
+
+ @param {String} keyName
+ @returns {Object} The cached value of the computed property, if any
+ */
+ cacheFor: function(keyName) {
+ return Ember.cacheFor(this, keyName);
+ },
+
+ /** @private - intended for debugging purposes */
+ observersForKey: function(keyName) {
+ return Ember.observersFor(this, keyName);
+ }
+});
+
+
+
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+Ember.TargetActionSupport = Ember.Mixin.create({
+ target: null,
+ action: null,
+
+ targetObject: Ember.computed(function() {
+ var target = get(this, 'target');
+
+ if (Ember.typeOf(target) === "string") {
+ var value = get(this, target);
+ if (value === undefined) { value = get(window, target); }
+ return value;
+ } else {
+ return target;
+ }
+ }).property('target').cacheable(),
+
+ triggerAction: function() {
+ var action = get(this, 'action'),
+ target = get(this, 'targetObject');
+
+ if (target && action) {
+ var ret;
+
+ if (typeof target.send === 'function') {
+ ret = target.send(action, this);
+ } else {
+ if (typeof action === 'string') {
+ action = target[action];
+ }
+ ret = action.call(target, this);
+ }
+ if (ret !== false) ret = true;
+
+ return ret;
+ } else {
+ return false;
+ }
+ }
+});
+
+})();
+
+
+
+(function() {
+/**
+ @class
+
+ @extends Ember.Mixin
+ */
+Ember.Evented = Ember.Mixin.create(
+ /** @scope Ember.Evented.prototype */ {
+ on: function(name, target, method) {
+ Ember.addListener(this, name, target, method);
+ },
+
+ one: function(name, target, method) {
+ if (!method) {
+ method = target;
+ target = null;
+ }
+
+ var self = this;
+ var wrapped = function() {
+ Ember.removeListener(self, name, target, wrapped);
+
+ if ('string' === typeof method) { method = this[method]; }
+
+ // Internally, a `null` target means that the target is
+ // the first parameter to addListener. That means that
+ // the `this` passed into this function is the target
+ // determined by the event system.
+ method.apply(this, arguments);
+ };
+
+ this.on(name, target, wrapped);
+ },
+
+ trigger: function(name) {
+ var args = [], i, l;
+ for (i = 1, l = arguments.length; i < l; i++) {
+ args.push(arguments[i]);
+ }
+ Ember.sendEvent(this, name, args);
+ },
+
+ fire: function(name) {
+ Ember.deprecate("Ember.Evented#fire() has been deprecated in favor of trigger() for compatibility with jQuery. It will be removed in 1.0. Please update your code to call trigger() instead.");
+ this.trigger.apply(this, arguments);
+ },
+
+ off: function(name, target, method) {
+ Ember.removeListener(this, name, target, method);
+ },
+
+ has: function(name) {
+ return Ember.hasListeners(this, name);
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+
+
+// NOTE: this object should never be included directly. Instead use Ember.
+// Ember.Object. We only define this separately so that Ember.Set can depend on it
+
+
+
+var classToString = Ember.Mixin.prototype.toString;
+var set = Ember.set, get = Ember.get;
+var o_create = Ember.create,
+ o_defineProperty = Ember.platform.defineProperty,
+ a_slice = Array.prototype.slice,
+ meta = Ember.meta,
+ rewatch = Ember.rewatch,
+ finishChains = Ember.finishChains,
+ finishPartial = Ember.Mixin.finishPartial,
+ reopen = Ember.Mixin.prototype.reopen;
+
+var undefinedDescriptor = {
+ configurable: true,
+ writable: true,
+ enumerable: false,
+ value: undefined
+};
+
+/** @private */
+function makeCtor() {
+
+ // Note: avoid accessing any properties on the object since it makes the
+ // method a lot faster. This is glue code so we want it to be as fast as
+ // possible.
+
+ var wasApplied = false, initMixins;
+
+ var Class = function() {
+ if (!wasApplied) {
+ Class.proto(); // prepare prototype...
+ }
+ var m = Ember.meta(this);
+ m.proto = this;
+ if (initMixins) {
+ this.reopen.apply(this, initMixins);
+ initMixins = null;
+ }
+ o_defineProperty(this, Ember.GUID_KEY, undefinedDescriptor);
+ o_defineProperty(this, '_super', undefinedDescriptor);
+ finishPartial(this, m);
+ delete m.proto;
+ finishChains(this);
+ this.init.apply(this, arguments);
+ };
+
+ Class.toString = classToString;
+ Class.willReopen = function() {
+ if (wasApplied) {
+ Class.PrototypeMixin = Ember.Mixin.create(Class.PrototypeMixin);
+ }
+
+ wasApplied = false;
+ };
+ Class._initMixins = function(args) { initMixins = args; };
+
+ Class.proto = function() {
+ var superclass = Class.superclass;
+ if (superclass) { superclass.proto(); }
+
+ if (!wasApplied) {
+ wasApplied = true;
+ Class.PrototypeMixin.applyPartial(Class.prototype);
+ rewatch(Class.prototype);
+ }
+
+ return this.prototype;
+ };
+
+ return Class;
+
+}
+
+var CoreObject = makeCtor();
+
+CoreObject.PrototypeMixin = Ember.Mixin.create(
+/** @scope Ember.CoreObject.prototype */ {
+
+ reopen: function() {
+ Ember.Mixin._apply(this, arguments, true);
+ return this;
+ },
+
+ isInstance: true,
+
+ /** @private */
+ init: function() {},
+
+ /** @field */
+ isDestroyed: false,
+
+ /** @field */
+ isDestroying: false,
+
+ /**
+ Destroys an object by setting the isDestroyed flag and removing its
+ metadata, which effectively destroys observers and bindings.
+
+ If you try to set a property on a destroyed object, an exception will be
+ raised.
+
+ Note that destruction is scheduled for the end of the run loop and does not
+ happen immediately.
+
+ @returns {Ember.Object} receiver
+ */
+ destroy: function() {
+ if (this.isDestroying) { return; }
+
+ this.isDestroying = true;
+
+ if (this.willDestroy) { this.willDestroy(); }
+
+ set(this, 'isDestroyed', true);
+ Ember.run.schedule('destroy', this, this._scheduledDestroy);
+ return this;
+ },
+
+ /**
+ Invoked by the run loop to actually destroy the object. This is
+ scheduled for execution by the `destroy` method.
+
+ @private
+ */
+ _scheduledDestroy: function() {
+ Ember.destroy(this);
+ if (this.didDestroy) { this.didDestroy(); }
+ },
+
+ bind: function(to, from) {
+ if (!(from instanceof Ember.Binding)) { from = Ember.Binding.from(from); }
+ from.to(to).connect(this);
+ return from;
+ },
+
+ toString: function() {
+ return '<'+this.constructor.toString()+':'+Ember.guidFor(this)+'>';
+ }
+});
+
+if (Ember.config.overridePrototypeMixin) {
+ Ember.config.overridePrototypeMixin(CoreObject.PrototypeMixin);
+}
+
+CoreObject.__super__ = null;
+
+var ClassMixin = Ember.Mixin.create(
+/** @scope Ember.ClassMixin.prototype */ {
+
+ ClassMixin: Ember.required(),
+
+ PrototypeMixin: Ember.required(),
+
+ isClass: true,
+
+ isMethod: false,
+
+ extend: function() {
+ var Class = makeCtor(), proto;
+ Class.ClassMixin = Ember.Mixin.create(this.ClassMixin);
+ Class.PrototypeMixin = Ember.Mixin.create(this.PrototypeMixin);
+
+ Class.ClassMixin.ownerConstructor = Class;
+ Class.PrototypeMixin.ownerConstructor = Class;
+
+ reopen.apply(Class.PrototypeMixin, arguments);
+
+ Class.superclass = this;
+ Class.__super__ = this.prototype;
+
+ proto = Class.prototype = o_create(this.prototype);
+ proto.constructor = Class;
+ Ember.generateGuid(proto, 'ember');
+ meta(proto).proto = proto; // this will disable observers on prototype
+
+ Class.ClassMixin.apply(Class);
+ return Class;
+ },
+
+ create: function() {
+ var C = this;
+ if (arguments.length>0) { this._initMixins(arguments); }
+ return new C();
+ },
+
+ reopen: function() {
+ this.willReopen();
+ reopen.apply(this.PrototypeMixin, arguments);
+ return this;
+ },
+
+ reopenClass: function() {
+ reopen.apply(this.ClassMixin, arguments);
+ Ember.Mixin._apply(this, arguments, false);
+ return this;
+ },
+
+ detect: function(obj) {
+ if ('function' !== typeof obj) { return false; }
+ while(obj) {
+ if (obj===this) { return true; }
+ obj = obj.superclass;
+ }
+ return false;
+ },
+
+ detectInstance: function(obj) {
+ return obj instanceof this;
+ },
+
+ /**
+ In some cases, you may want to annotate computed properties with additional
+ metadata about how they function or what values they operate on. For example,
+ computed property functions may close over variables that are then no longer
+ available for introspection.
+
+ You can pass a hash of these values to a computed property like this:
+
+ person: function() {
+ var personId = this.get('personId');
+ return App.Person.create({ id: personId });
+ }.property().meta({ type: App.Person })
+
+ Once you've done this, you can retrieve the values saved to the computed
+ property from your class like this:
+
+ MyClass.metaForProperty('person');
+
+ This will return the original hash that was passed to `meta()`.
+ */
+ metaForProperty: function(key) {
+ var desc = meta(this.proto(), false).descs[key];
+
+ Ember.assert("metaForProperty() could not find a computed property with key '"+key+"'.", !!desc && desc instanceof Ember.ComputedProperty);
+ return desc._meta || {};
+ },
+
+ /**
+ Iterate over each computed property for the class, passing its name
+ and any associated metadata (see `metaForProperty`) to the callback.
+ */
+ eachComputedProperty: function(callback, binding) {
+ var proto = this.proto(),
+ descs = meta(proto).descs,
+ empty = {},
+ property;
+
+ for (var name in descs) {
+ property = descs[name];
+
+ if (property instanceof Ember.ComputedProperty) {
+ callback.call(binding || this, name, property._meta || empty);
+ }
+ }
+ }
+
+});
+
+if (Ember.config.overrideClassMixin) {
+ Ember.config.overrideClassMixin(ClassMixin);
+}
+
+CoreObject.ClassMixin = ClassMixin;
+ClassMixin.apply(CoreObject);
+
+/**
+ @class
+*/
+Ember.CoreObject = CoreObject;
+
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, none = Ember.none;
+
+/**
+ @class
+
+ An unordered collection of objects.
+
+ A Set works a bit like an array except that its items are not ordered.
+ You can create a set to efficiently test for membership for an object. You
+ can also iterate through a set just like an array, even accessing objects
+ by index, however there is no guarantee as to their order.
+
+ All Sets are observable via the Enumerable Observer API - which works
+ on any enumerable object including both Sets and Arrays.
+
+ ## Creating a Set
+
+ You can create a set like you would most objects using
+ `new Ember.Set()`. Most new sets you create will be empty, but you can
+ also initialize the set with some content by passing an array or other
+ enumerable of objects to the constructor.
+
+ Finally, you can pass in an existing set and the set will be copied. You
+ can also create a copy of a set by calling `Ember.Set#copy()`.
+
+ #js
+ // creates a new empty set
+ var foundNames = new Ember.Set();
+
+ // creates a set with four names in it.
+ var names = new Ember.Set(["Charles", "Tom", "Juan", "Alex"]); // :P
+
+ // creates a copy of the names set.
+ var namesCopy = new Ember.Set(names);
+
+ // same as above.
+ var anotherNamesCopy = names.copy();
+
+ ## Adding/Removing Objects
+
+ You generally add or remove objects from a set using `add()` or
+ `remove()`. You can add any type of object including primitives such as
+ numbers, strings, and booleans.
+
+ Unlike arrays, objects can only exist one time in a set. If you call `add()`
+ on a set with the same object multiple times, the object will only be added
+ once. Likewise, calling `remove()` with the same object multiple times will
+ remove the object the first time and have no effect on future calls until
+ you add the object to the set again.
+
+ NOTE: You cannot add/remove null or undefined to a set. Any attempt to do so
+ will be ignored.
+
+ In addition to add/remove you can also call `push()`/`pop()`. Push behaves
+ just like `add()` but `pop()`, unlike `remove()` will pick an arbitrary
+ object, remove it and return it. This is a good way to use a set as a job
+ queue when you don't care which order the jobs are executed in.
+
+ ## Testing for an Object
+
+ To test for an object's presence in a set you simply call
+ `Ember.Set#contains()`.
+
+ ## Observing changes
+
+ When using `Ember.Set`, you can observe the `"[]"` property to be
+ alerted whenever the content changes. You can also add an enumerable
+ observer to the set to be notified of specific objects that are added and
+ removed from the set. See `Ember.Enumerable` for more information on
+ enumerables.
+
+ This is often unhelpful. If you are filtering sets of objects, for instance,
+ it is very inefficient to re-filter all of the items each time the set
+ changes. It would be better if you could just adjust the filtered set based
+ on what was changed on the original set. The same issue applies to merging
+ sets, as well.
+
+ ## Other Methods
+
+ `Ember.Set` primary implements other mixin APIs. For a complete reference
+ on the methods you will use with `Ember.Set`, please consult these mixins.
+ The most useful ones will be `Ember.Enumerable` and
+ `Ember.MutableEnumerable` which implement most of the common iterator
+ methods you are used to on Array.
+
+ Note that you can also use the `Ember.Copyable` and `Ember.Freezable`
+ APIs on `Ember.Set` as well. Once a set is frozen it can no longer be
+ modified. The benefit of this is that when you call frozenCopy() on it,
+ Ember will avoid making copies of the set. This allows you to write
+ code that can know with certainty when the underlying set data will or
+ will not be modified.
+
+ @extends Ember.Enumerable
+ @extends Ember.MutableEnumerable
+ @extends Ember.Copyable
+ @extends Ember.Freezable
+
+ @since Ember 0.9
+*/
+Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Ember.Freezable,
+ /** @scope Ember.Set.prototype */ {
+
+ // ..........................................................
+ // IMPLEMENT ENUMERABLE APIS
+ //
+
+ /**
+ This property will change as the number of objects in the set changes.
+
+ @type number
+ @default 0
+ */
+ length: 0,
+
+ /**
+ Clears the set. This is useful if you want to reuse an existing set
+ without having to recreate it.
+
+ var colors = new Ember.Set(["red", "green", "blue"]);
+ colors.length; => 3
+ colors.clear();
+ colors.length; => 0
+
+ @returns {Ember.Set} An empty Set
+ */
+ clear: function() {
+ if (this.isFrozen) { throw new Error(Ember.FROZEN_ERROR); }
+
+ var len = get(this, 'length');
+ if (len === 0) { return this; }
+
+ var guid;
+
+ this.enumerableContentWillChange(len, 0);
+ Ember.propertyWillChange(this, 'firstObject');
+ Ember.propertyWillChange(this, 'lastObject');
+
+ for (var i=0; i < len; i++){
+ guid = guidFor(this[i]);
+ delete this[guid];
+ delete this[i];
+ }
+
+ set(this, 'length', 0);
+
+ Ember.propertyDidChange(this, 'firstObject');
+ Ember.propertyDidChange(this, 'lastObject');
+ this.enumerableContentDidChange(len, 0);
+
+ return this;
+ },
+
+ /**
+ Returns true if the passed object is also an enumerable that contains the
+ same objects as the receiver.
+
+ var colors = ["red", "green", "blue"],
+ same_colors = new Ember.Set(colors);
+ same_colors.isEqual(colors); => true
+ same_colors.isEqual(["purple", "brown"]); => false
+
+ @param {Ember.Set} obj the other object.
+ @returns {Boolean}
+ */
+ isEqual: function(obj) {
+ // fail fast
+ if (!Ember.Enumerable.detect(obj)) return false;
+
+ var loc = get(this, 'length');
+ if (get(obj, 'length') !== loc) return false;
+
+ while(--loc >= 0) {
+ if (!obj.contains(this[loc])) return false;
+ }
+
+ return true;
+ },
+
+ /**
+ Adds an object to the set. Only non-null objects can be added to a set
+ and those can only be added once. If the object is already in the set or
+ the passed value is null this method will have no effect.
+
+ This is an alias for `Ember.MutableEnumerable.addObject()`.
+
+ var colors = new Ember.Set();
+ colors.add("blue"); => ["blue"]
+ colors.add("blue"); => ["blue"]
+ colors.add("red"); => ["blue", "red"]
+ colors.add(null); => ["blue", "red"]
+ colors.add(undefined); => ["blue", "red"]
+
+ @function
+ @param {Object} obj The object to add.
+ @returns {Ember.Set} The set itself.
+ */
+ add: Ember.alias('addObject'),
+
+ /**
+ Removes the object from the set if it is found. If you pass a null value
+ or an object that is already not in the set, this method will have no
+ effect. This is an alias for `Ember.MutableEnumerable.removeObject()`.
+
+ var colors = new Ember.Set(["red", "green", "blue"]);
+ colors.remove("red"); => ["blue", "green"]
+ colors.remove("purple"); => ["blue", "green"]
+ colors.remove(null); => ["blue", "green"]
+
+ @function
+ @param {Object} obj The object to remove
+ @returns {Ember.Set} The set itself.
+ */
+ remove: Ember.alias('removeObject'),
+
+ /**
+ Removes the last element from the set and returns it, or null if it's empty.
+
+ var colors = new Ember.Set(["green", "blue"]);
+ colors.pop(); => "blue"
+ colors.pop(); => "green"
+ colors.pop(); => null
+
+ @returns {Object} The removed object from the set or null.
+ */
+ pop: function() {
+ if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ var obj = this.length > 0 ? this[this.length-1] : null;
+ this.remove(obj);
+ return obj;
+ },
+
+ /**
+ Inserts the given object on to the end of the set. It returns
+ the set itself.
+
+ This is an alias for `Ember.MutableEnumerable.addObject()`.
+
+ var colors = new Ember.Set();
+ colors.push("red"); => ["red"]
+ colors.push("green"); => ["red", "green"]
+ colors.push("blue"); => ["red", "green", "blue"]
+
+ @function
+ @returns {Ember.Set} The set itself.
+ */
+ push: Ember.alias('addObject'),
+
+ /**
+ Removes the last element from the set and returns it, or null if it's empty.
+
+ This is an alias for `Ember.Set.pop()`.
+
+ var colors = new Ember.Set(["green", "blue"]);
+ colors.shift(); => "blue"
+ colors.shift(); => "green"
+ colors.shift(); => null
+
+ @function
+ @returns {Object} The removed object from the set or null.
+ */
+ shift: Ember.alias('pop'),
+
+ /**
+ Inserts the given object on to the end of the set. It returns
+ the set itself.
+
+ This is an alias of `Ember.Set.push()`
+
+ var colors = new Ember.Set();
+ colors.unshift("red"); => ["red"]
+ colors.unshift("green"); => ["red", "green"]
+ colors.unshift("blue"); => ["red", "green", "blue"]
+
+ @function
+ @returns {Ember.Set} The set itself.
+ */
+ unshift: Ember.alias('push'),
+
+ /**
+ Adds each object in the passed enumerable to the set.
+
+ This is an alias of `Ember.MutableEnumerable.addObjects()`
+
+ var colors = new Ember.Set();
+ colors.addEach(["red", "green", "blue"]); => ["red", "green", "blue"]
+
+ @function
+ @param {Ember.Enumerable} objects the objects to add.
+ @returns {Ember.Set} The set itself.
+ */
+ addEach: Ember.alias('addObjects'),
+
+ /**
+ Removes each object in the passed enumerable to the set.
+
+ This is an alias of `Ember.MutableEnumerable.removeObjects()`
+
+ var colors = new Ember.Set(["red", "green", "blue"]);
+ colors.removeEach(["red", "blue"]); => ["green"]
+
+ @function
+ @param {Ember.Enumerable} objects the objects to remove.
+ @returns {Ember.Set} The set itself.
+ */
+ removeEach: Ember.alias('removeObjects'),
+
+ // ..........................................................
+ // PRIVATE ENUMERABLE SUPPORT
+ //
+
+ /** @private */
+ init: function(items) {
+ this._super();
+ if (items) this.addObjects(items);
+ },
+
+ /** @private (nodoc) - implement Ember.Enumerable */
+ nextObject: function(idx) {
+ return this[idx];
+ },
+
+ /** @private - more optimized version */
+ firstObject: Ember.computed(function() {
+ return this.length > 0 ? this[0] : undefined;
+ }).property().cacheable(),
+
+ /** @private - more optimized version */
+ lastObject: Ember.computed(function() {
+ return this.length > 0 ? this[this.length-1] : undefined;
+ }).property().cacheable(),
+
+ /** @private (nodoc) - implements Ember.MutableEnumerable */
+ addObject: function(obj) {
+ if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ if (none(obj)) return this; // nothing to do
+
+ var guid = guidFor(obj),
+ idx = this[guid],
+ len = get(this, 'length'),
+ added ;
+
+ if (idx>=0 && idx<len && (this[idx] === obj)) return this; // added
+
+ added = [obj];
+
+ this.enumerableContentWillChange(null, added);
+ Ember.propertyWillChange(this, 'lastObject');
+
+ len = get(this, 'length');
+ this[guid] = len;
+ this[len] = obj;
+ set(this, 'length', len+1);
+
+ Ember.propertyDidChange(this, 'lastObject');
+ this.enumerableContentDidChange(null, added);
+
+ return this;
+ },
+
+ /** @private (nodoc) - implements Ember.MutableEnumerable */
+ removeObject: function(obj) {
+ if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
+ if (none(obj)) return this; // nothing to do
+
+ var guid = guidFor(obj),
+ idx = this[guid],
+ len = get(this, 'length'),
+ isFirst = idx === 0,
+ isLast = idx === len-1,
+ last, removed;
+
+
+ if (idx>=0 && idx<len && (this[idx] === obj)) {
+ removed = [obj];
+
+ this.enumerableContentWillChange(removed, null);
+ if (isFirst) { Ember.propertyWillChange(this, 'firstObject'); }
+ if (isLast) { Ember.propertyWillChange(this, 'lastObject'); }
+
+ // swap items - basically move the item to the end so it can be removed
+ if (idx < len-1) {
+ last = this[len-1];
+ this[idx] = last;
+ this[guidFor(last)] = idx;
+ }
+
+ delete this[guid];
+ delete this[len-1];
+ set(this, 'length', len-1);
+
+ if (isFirst) { Ember.propertyDidChange(this, 'firstObject'); }
+ if (isLast) { Ember.propertyDidChange(this, 'lastObject'); }
+ this.enumerableContentDidChange(removed, null);
+ }
+
+ return this;
+ },
+
+ /** @private (nodoc) - optimized version */
+ contains: function(obj) {
+ return this[guidFor(obj)]>=0;
+ },
+
+ /** @private (nodoc) */
+ copy: function() {
+ var C = this.constructor, ret = new C(), loc = get(this, 'length');
+ set(ret, 'length', loc);
+ while(--loc>=0) {
+ ret[loc] = this[loc];
+ ret[guidFor(this[loc])] = loc;
+ }
+ return ret;
+ },
+
+ /** @private */
+ toString: function() {
+ var len = this.length, idx, array = [];
+ for(idx = 0; idx < len; idx++) {
+ array[idx] = this[idx];
+ }
+ return "Ember.Set<%@>".fmt(array.join(','));
+ }
+
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/**
+ @class
+
+ `Ember.Object` is the main base class for all Ember objects. It is a subclass
+ of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
+ see the documentation for each of these.
+
+ @extends Ember.CoreObject
+ @extends Ember.Observable
+*/
+Ember.Object = Ember.CoreObject.extend(Ember.Observable);
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var indexOf = Ember.ArrayPolyfills.indexOf;
+
+/**
+ @private
+ A Namespace is an object usually used to contain other objects or methods
+ such as an application or framework. Create a namespace anytime you want
+ to define one of these new containers.
+
+ # Example Usage
+
+ MyFramework = Ember.Namespace.create({
+ VERSION: '1.0.0'
+ });
+
+*/
+Ember.Namespace = Ember.Object.extend({
+ isNamespace: true,
+
+ init: function() {
+ Ember.Namespace.NAMESPACES.push(this);
+ Ember.Namespace.PROCESSED = false;
+ },
+
+ toString: function() {
+ Ember.identifyNamespaces();
+ return this[Ember.GUID_KEY+'_name'];
+ },
+
+ destroy: function() {
+ var namespaces = Ember.Namespace.NAMESPACES;
+ window[this.toString()] = undefined;
+ namespaces.splice(indexOf.call(namespaces, this), 1);
+ this._super();
+ }
+});
+
+Ember.Namespace.NAMESPACES = [Ember];
+Ember.Namespace.PROCESSED = false;
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/**
+ @private
+
+ Defines a namespace that will contain an executable application. This is
+ very similar to a normal namespace except that it is expected to include at
+ least a 'ready' function which can be run to initialize the application.
+
+ Currently Ember.Application is very similar to Ember.Namespace. However, this
+ class may be augmented by additional frameworks so it is important to use
+ this instance when building new applications.
+
+ # Example Usage
+
+ MyApp = Ember.Application.create({
+ VERSION: '1.0.0',
+ store: Ember.Store.create().from(Ember.fixtures)
+ });
+
+ MyApp.ready = function() {
+ //..init code goes here...
+ }
+
+*/
+Ember.Application = Ember.Namespace.extend();
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ An ArrayProxy wraps any other object that implements Ember.Array and/or
+ Ember.MutableArray, forwarding all requests. This makes it very useful for
+ a number of binding use cases or other cases where being able to swap
+ out the underlying array is useful.
+
+ A simple example of usage:
+
+ var pets = ['dog', 'cat', 'fish'];
+ var ap = Ember.ArrayProxy.create({ content: Ember.A(pets) });
+ ap.get('firstObject'); // => 'dog'
+ ap.set('content', ['amoeba', 'paramecium']);
+ ap.get('firstObject'); // => 'amoeba'
+
+ This class can also be useful as a layer to transform the contents of
+ an array, as they are accessed. This can be done by overriding
+ `objectAtContent`:
+
+ var pets = ['dog', 'cat', 'fish'];
+ var ap = Ember.ArrayProxy.create({
+ content: Ember.A(pets),
+ objectAtContent: function(idx) {
+ return this.get('content').objectAt(idx).toUpperCase();
+ }
+ });
+ ap.get('firstObject'); // => 'DOG'
+
+
+ @extends Ember.Object
+ @extends Ember.Array
+ @extends Ember.MutableArray
+*/
+Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
+/** @scope Ember.ArrayProxy.prototype */ {
+
+ /**
+ The content array. Must be an object that implements Ember.Array and/or
+ Ember.MutableArray.
+
+ @type Ember.Array
+ */
+ content: null,
+
+ /**
+ The array that the proxy pretends to be. In the default `ArrayProxy`
+ implementation, this and `content` are the same. Subclasses of `ArrayProxy`
+ can override this property to provide things like sorting and filtering.
+ */
+ arrangedContent: Ember.computed('content', function() {
+ return get(this, 'content');
+ }).cacheable(),
+
+ /**
+ Should actually retrieve the object at the specified index from the
+ content. You can override this method in subclasses to transform the
+ content item to something new.
+
+ This method will only be called if content is non-null.
+
+ @param {Number} idx
+ The index to retrieve.
+
+ @returns {Object} the value or undefined if none found
+ */
+ objectAtContent: function(idx) {
+ return get(this, 'arrangedContent').objectAt(idx);
+ },
+
+ /**
+ Should actually replace the specified objects on the content array.
+ You can override this method in subclasses to transform the content item
+ into something new.
+
+ This method will only be called if content is non-null.
+
+ @param {Number} idx
+ The starting index
+
+ @param {Number} amt
+ The number of items to remove from the content.
+
+ @param {Array} objects
+ Optional array of objects to insert or null if no objects.
+
+ @returns {void}
+ */
+ replaceContent: function(idx, amt, objects) {
+ get(this, 'arrangedContent').replace(idx, amt, objects);
+ },
+
+ /**
+ Invoked when the content property is about to change. Notifies observers that the
+ entire array content will change.
+ */
+ _contentWillChange: Ember.beforeObserver(function() {
+ var content = get(this, 'content');
+
+ if (content) {
+ content.removeArrayObserver(this, {
+ willChange: 'contentArrayWillChange',
+ didChange: 'contentArrayDidChange'
+ });
+ }
+ }, 'content'),
+
+
+ contentArrayWillChange: Ember.K,
+ contentArrayDidChange: Ember.K,
+
+ /**
+ Invoked when the content property changes. Notifies observers that the
+ entire array content has changed.
+ */
+ _contentDidChange: Ember.observer(function() {
+ var content = get(this, 'content'),
+ len = content ? get(content, 'length') : 0;
+
+ Ember.assert("Can't set ArrayProxy's content to itself", content !== this);
+
+ if (content) {
+ content.addArrayObserver(this, {
+ willChange: 'contentArrayWillChange',
+ didChange: 'contentArrayDidChange'
+ });
+ }
+ }, 'content'),
+
+ _arrangedContentWillChange: Ember.beforeObserver(function() {
+ var arrangedContent = get(this, 'arrangedContent'),
+ len = arrangedContent ? get(arrangedContent, 'length') : 0;
+
+ this.arrangedContentArrayWillChange(this, 0, len, undefined);
+
+ if (arrangedContent) {
+ arrangedContent.removeArrayObserver(this, {
+ willChange: 'arrangedContentArrayWillChange',
+ didChange: 'arrangedContentArrayDidChange'
+ });
+ }
+ }, 'arrangedContent'),
+
+ _arrangedContentDidChange: Ember.observer(function() {
+ var arrangedContent = get(this, 'arrangedContent'),
+ len = arrangedContent ? get(arrangedContent, 'length') : 0;
+
+ Ember.assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
+
+ if (arrangedContent) {
+ arrangedContent.addArrayObserver(this, {
+ willChange: 'arrangedContentArrayWillChange',
+ didChange: 'arrangedContentArrayDidChange'
+ });
+ }
+
+ this.arrangedContentArrayDidChange(this, 0, undefined, len);
+ }, 'arrangedContent'),
+
+ /** @private (nodoc) */
+ objectAt: function(idx) {
+ return get(this, 'content') && this.objectAtContent(idx);
+ },
+
+ /** @private (nodoc) */
+ length: Ember.computed(function() {
+ var arrangedContent = get(this, 'arrangedContent');
+ return arrangedContent ? get(arrangedContent, 'length') : 0;
+ // No dependencies since Enumerable notifies length of change
+ }).property().cacheable(),
+
+ /** @private (nodoc) */
+ replace: function(idx, amt, objects) {
+ if (get(this, 'content')) this.replaceContent(idx, amt, objects);
+ return this;
+ },
+
+ /** @private (nodoc) */
+ arrangedContentArrayWillChange: function(item, idx, removedCnt, addedCnt) {
+ this.arrayContentWillChange(idx, removedCnt, addedCnt);
+ },
+
+ /** @private (nodoc) */
+ arrangedContentArrayDidChange: function(item, idx, removedCnt, addedCnt) {
+ this.arrayContentDidChange(idx, removedCnt, addedCnt);
+ },
+
+ /** @private (nodoc) */
+ init: function() {
+ this._super();
+ this._contentWillChange();
+ this._contentDidChange();
+ this._arrangedContentWillChange();
+ this._arrangedContentDidChange();
+ }
+
+});
+
+
+
+
+})();
+
+
+
+(function() {
+var get = Ember.get,
+ set = Ember.set,
+ fmt = Ember.String.fmt,
+ addBeforeObserver = Ember.addBeforeObserver,
+ addObserver = Ember.addObserver,
+ removeBeforeObserver = Ember.removeBeforeObserver,
+ removeObserver = Ember.removeObserver,
+ propertyWillChange = Ember.propertyWillChange,
+ propertyDidChange = Ember.propertyDidChange;
+
+function contentPropertyWillChange(content, contentKey) {
+ var key = contentKey.slice(8); // remove "content."
+ if (key in this) { return; } // if shadowed in proxy
+ propertyWillChange(this, key);
+}
+
+function contentPropertyDidChange(content, contentKey) {
+ var key = contentKey.slice(8); // remove "content."
+ if (key in this) { return; } // if shadowed in proxy
+ propertyDidChange(this, key);
+}
+
+/**
+ @class
+
+ `Ember.ObjectProxy` forwards all properties not defined by the proxy itself
+ to a proxied `content` object.
+
+ object = Ember.Object.create({
+ name: 'Foo'
+ });
+ proxy = Ember.ObjectProxy.create({
+ content: object
+ });
+
+ // Access and change existing properties
+ proxy.get('name') // => 'Foo'
+ proxy.set('name', 'Bar');
+ object.get('name') // => 'Bar'
+
+ // Create new 'description' property on `object`
+ proxy.set('description', 'Foo is a whizboo baz');
+ object.get('description') // => 'Foo is a whizboo baz'
+
+ While `content` is unset, setting a property to be delegated will throw an Error.
+
+ proxy = Ember.ObjectProxy.create({
+ content: null,
+ flag: null
+ });
+ proxy.set('flag', true);
+ proxy.get('flag'); // => true
+ proxy.get('foo'); // => undefined
+ proxy.set('foo', 'data'); // throws Error
+
+ Delegated properties can be bound to and will change when content is updated.
+
+ Computed properties on the proxy itself can depend on delegated properties.
+
+ ProxyWithComputedProperty = Ember.ObjectProxy.extend({
+ fullName: function () {
+ var firstName = this.get('firstName'),
+ lastName = this.get('lastName');
+ if (firstName && lastName) {
+ return firstName + ' ' + lastName;
+ }
+ return firstName || lastName;
+ }.property('firstName', 'lastName')
+ });
+ proxy = ProxyWithComputedProperty.create();
+ proxy.get('fullName'); => undefined
+ proxy.set('content', {
+ firstName: 'Tom', lastName: 'Dale'
+ }); // triggers property change for fullName on proxy
+ proxy.get('fullName'); => 'Tom Dale'
+*/
+Ember.ObjectProxy = Ember.Object.extend(
+/** @scope Ember.ObjectProxy.prototype */ {
+ /**
+ The object whose properties will be forwarded.
+
+ @type Ember.Object
+ @default null
+ */
+ content: null,
+ _contentDidChange: Ember.observer(function() {
+ Ember.assert("Can't set ObjectProxy's content to itself", this.get('content') !== this);
+ }, 'content'),
+ /** @private */
+ willWatchProperty: function (key) {
+ var contentKey = 'content.' + key;
+ addBeforeObserver(this, contentKey, null, contentPropertyWillChange);
+ addObserver(this, contentKey, null, contentPropertyDidChange);
+ },
+ /** @private */
+ didUnwatchProperty: function (key) {
+ var contentKey = 'content.' + key;
+ removeBeforeObserver(this, contentKey, null, contentPropertyWillChange);
+ removeObserver(this, contentKey, null, contentPropertyDidChange);
+ },
+ /** @private */
+ unknownProperty: function (key) {
+ var content = get(this, 'content');
+ if (content) {
+ return get(content, key);
+ }
+ },
+ /** @private */
+ setUnknownProperty: function (key, value) {
+ var content = get(this, 'content');
+ Ember.assert(fmt("Cannot delegate set('%@', %@) to the 'content' property of object proxy %@: its 'content' is undefined.", [key, value, this]), content);
+ return set(content, key, value);
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var set = Ember.set, get = Ember.get, guidFor = Ember.guidFor;
+var forEach = Ember.EnumerableUtils.forEach;
+
+var EachArray = Ember.Object.extend(Ember.Array, {
+
+ init: function(content, keyName, owner) {
+ this._super();
+ this._keyName = keyName;
+ this._owner = owner;
+ this._content = content;
+ },
+
+ objectAt: function(idx) {
+ var item = this._content.objectAt(idx);
+ return item && get(item, this._keyName);
+ },
+
+ length: Ember.computed(function() {
+ var content = this._content;
+ return content ? get(content, 'length') : 0;
+ }).property().cacheable()
+
+});
+
+var IS_OBSERVER = /^.+:(before|change)$/;
+
+/** @private */
+function addObserverForContentKey(content, keyName, proxy, idx, loc) {
+ var objects = proxy._objects, guid;
+ if (!objects) objects = proxy._objects = {};
+
+ while(--loc>=idx) {
+ var item = content.objectAt(loc);
+ if (item) {
+ Ember.addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');
+ Ember.addObserver(item, keyName, proxy, 'contentKeyDidChange');
+
+ // keep track of the indicies each item was found at so we can map
+ // it back when the obj changes.
+ guid = guidFor(item);
+ if (!objects[guid]) objects[guid] = [];
+ objects[guid].push(loc);
+ }
+ }
+}
+
+/** @private */
+function removeObserverForContentKey(content, keyName, proxy, idx, loc) {
+ var objects = proxy._objects;
+ if (!objects) objects = proxy._objects = {};
+ var indicies, guid;
+
+ while(--loc>=idx) {
+ var item = content.objectAt(loc);
+ if (item) {
+ Ember.removeBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');
+ Ember.removeObserver(item, keyName, proxy, 'contentKeyDidChange');
+
+ guid = guidFor(item);
+ indicies = objects[guid];
+ indicies[indicies.indexOf(loc)] = null;
+ }
+ }
+}
+
+/**
+ @private
+ @class
+
+ This is the object instance returned when you get the @each property on an
+ array. It uses the unknownProperty handler to automatically create
+ EachArray instances for property names.
+
+ @extends Ember.Object
+*/
+Ember.EachProxy = Ember.Object.extend({
+
+ init: function(content) {
+ this._super();
+ this._content = content;
+ content.addArrayObserver(this);
+
+ // in case someone is already observing some keys make sure they are
+ // added
+ forEach(Ember.watchedEvents(this), function(eventName) {
+ this.didAddListener(eventName);
+ }, this);
+ },
+
+ /**
+ You can directly access mapped properties by simply requesting them.
+ The unknownProperty handler will generate an EachArray of each item.
+ */
+ unknownProperty: function(keyName, value) {
+ var ret;
+ ret = new EachArray(this._content, keyName, this);
+ Ember.defineProperty(this, keyName, null, ret);
+ this.beginObservingContentKey(keyName);
+ return ret;
+ },
+
+ // ..........................................................
+ // ARRAY CHANGES
+ // Invokes whenever the content array itself changes.
+
+ arrayWillChange: function(content, idx, removedCnt, addedCnt) {
+ var keys = this._keys, key, array, lim;
+
+ lim = removedCnt>0 ? idx+removedCnt : -1;
+ Ember.beginPropertyChanges(this);
+
+ for(key in keys) {
+ if (!keys.hasOwnProperty(key)) { continue; }
+
+ if (lim>0) removeObserverForContentKey(content, key, this, idx, lim);
+
+ Ember.propertyWillChange(this, key);
+ }
+
+ Ember.propertyWillChange(this._content, '@each');
+ Ember.endPropertyChanges(this);
+ },
+
+ arrayDidChange: function(content, idx, removedCnt, addedCnt) {
+ var keys = this._keys, key, array, lim;
+
+ lim = addedCnt>0 ? idx+addedCnt : -1;
+ Ember.beginPropertyChanges(this);
+
+ for(key in keys) {
+ if (!keys.hasOwnProperty(key)) { continue; }
+
+ if (lim>0) addObserverForContentKey(content, key, this, idx, lim);
+
+ Ember.propertyDidChange(this, key);
+ }
+
+ Ember.propertyDidChange(this._content, '@each');
+ Ember.endPropertyChanges(this);
+ },
+
+ // ..........................................................
+ // LISTEN FOR NEW OBSERVERS AND OTHER EVENT LISTENERS
+ // Start monitoring keys based on who is listening...
+
+ didAddListener: function(eventName) {
+ if (IS_OBSERVER.test(eventName)) {
+ this.beginObservingContentKey(eventName.slice(0, -7));
+ }
+ },
+
+ didRemoveListener: function(eventName) {
+ if (IS_OBSERVER.test(eventName)) {
+ this.stopObservingContentKey(eventName.slice(0, -7));
+ }
+ },
+
+ // ..........................................................
+ // CONTENT KEY OBSERVING
+ // Actual watch keys on the source content.
+
+ beginObservingContentKey: function(keyName) {
+ var keys = this._keys;
+ if (!keys) keys = this._keys = {};
+ if (!keys[keyName]) {
+ keys[keyName] = 1;
+ var content = this._content,
+ len = get(content, 'length');
+ addObserverForContentKey(content, keyName, this, 0, len);
+ } else {
+ keys[keyName]++;
+ }
+ },
+
+ stopObservingContentKey: function(keyName) {
+ var keys = this._keys;
+ if (keys && (keys[keyName]>0) && (--keys[keyName]<=0)) {
+ var content = this._content,
+ len = get(content, 'length');
+ removeObserverForContentKey(content, keyName, this, 0, len);
+ }
+ },
+
+ contentKeyWillChange: function(obj, keyName) {
+ Ember.propertyWillChange(this, keyName);
+ },
+
+ contentKeyDidChange: function(obj, keyName) {
+ Ember.propertyDidChange(this, keyName);
+ }
+
+});
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+// Add Ember.Array to Array.prototype. Remove methods with native
+// implementations and supply some more optimized versions of generic methods
+// because they are so common.
+var NativeArray = Ember.Mixin.create(Ember.MutableArray, Ember.Observable, Ember.Copyable, {
+
+ // because length is a built-in property we need to know to just get the
+ // original property.
+ get: function(key) {
+ if (key==='length') return this.length;
+ else if ('number' === typeof key) return this[key];
+ else return this._super(key);
+ },
+
+ objectAt: function(idx) {
+ return this[idx];
+ },
+
+ // primitive for array support.
+ replace: function(idx, amt, objects) {
+
+ if (this.isFrozen) throw Ember.FROZEN_ERROR ;
+
+ // if we replaced exactly the same number of items, then pass only the
+ // replaced range. Otherwise, pass the full remaining array length
+ // since everything has shifted
+ var len = objects ? get(objects, 'length') : 0;
+ this.arrayContentWillChange(idx, amt, len);
+
+ if (!objects || objects.length === 0) {
+ this.splice(idx, amt) ;
+ } else {
+ var args = [idx, amt].concat(objects) ;
+ this.splice.apply(this,args) ;
+ }
+
+ this.arrayContentDidChange(idx, amt, len);
+ return this ;
+ },
+
+ // If you ask for an unknown property, then try to collect the value
+ // from member items.
+ unknownProperty: function(key, value) {
+ var ret;// = this.reducedProperty(key, value) ;
+ if ((value !== undefined) && ret === undefined) {
+ ret = this[key] = value;
+ }
+ return ret ;
+ },
+
+ // If browser did not implement indexOf natively, then override with
+ // specialized version
+ indexOf: function(object, startAt) {
+ var idx, len = this.length;
+
+ if (startAt === undefined) startAt = 0;
+ else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);
+ if (startAt < 0) startAt += len;
+
+ for(idx=startAt;idx<len;idx++) {
+ if (this[idx] === object) return idx ;
+ }
+ return -1;
+ },
+
+ lastIndexOf: function(object, startAt) {
+ var idx, len = this.length;
+
+ if (startAt === undefined) startAt = len-1;
+ else startAt = (startAt < 0) ? Math.ceil(startAt) : Math.floor(startAt);
+ if (startAt < 0) startAt += len;
+
+ for(idx=startAt;idx>=0;idx--) {
+ if (this[idx] === object) return idx ;
+ }
+ return -1;
+ },
+
+ copy: function() {
+ return this.slice();
+ }
+});
+
+// Remove any methods implemented natively so we don't override them
+var ignore = ['length'];
+Ember.EnumerableUtils.forEach(NativeArray.keys(), function(methodName) {
+ if (Array.prototype[methodName]) ignore.push(methodName);
+});
+
+if (ignore.length>0) {
+ NativeArray = NativeArray.without.apply(NativeArray, ignore);
+}
+
+/**
+ The NativeArray mixin contains the properties needed to to make the native
+ Array support Ember.MutableArray and all of its dependent APIs. Unless you
+ have Ember.EXTEND_PROTOTYPES set to false, this will be applied automatically.
+ Otherwise you can apply the mixin at anytime by calling
+ `Ember.NativeArray.activate`.
+
+ @namespace
+ @extends Ember.MutableArray
+ @extends Ember.Array
+ @extends Ember.Enumerable
+ @extends Ember.MutableEnumerable
+ @extends Ember.Copyable
+ @extends Ember.Freezable
+*/
+Ember.NativeArray = NativeArray;
+
+/**
+ Creates an Ember.NativeArray from an Array like object.
+ Does not modify the original object.
+
+ @returns {Ember.NativeArray}
+*/
+Ember.A = function(arr){
+ if (arr === undefined) { arr = []; }
+ return Ember.NativeArray.apply(arr);
+};
+
+/**
+ Activates the mixin on the Array.prototype if not already applied. Calling
+ this method more than once is safe.
+
+ @returns {void}
+*/
+Ember.NativeArray.activate = function() {
+ NativeArray.apply(Array.prototype);
+
+ Ember.A = function(arr) { return arr || []; };
+};
+
+if (Ember.EXTEND_PROTOTYPES) Ember.NativeArray.activate();
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+Ember._PromiseChain = Ember.Object.extend({
+ promises: null,
+ failureCallback: Ember.K,
+ successCallback: Ember.K,
+ abortCallback: Ember.K,
+ promiseSuccessCallback: Ember.K,
+
+ /**
+ @private
+ */
+ runNextPromise: function() {
+ if (get(this, 'isDestroyed')) { return; }
+
+ var item = get(this, 'promises').shiftObject();
+ if (item) {
+ var promise = get(item, 'promise') || item;
+ Ember.assert("Cannot find promise to invoke", Ember.canInvoke(promise, 'then'));
+
+ var self = this;
+
+ var successCallback = function() {
+ self.promiseSuccessCallback.call(this, item, arguments);
+ self.runNextPromise();
+ };
+
+ var failureCallback = get(self, 'failureCallback');
+
+ promise.then(successCallback, failureCallback);
+ } else {
+ this.successCallback();
+ }
+ },
+
+ start: function() {
+ this.runNextPromise();
+ return this;
+ },
+
+ abort: function() {
+ this.abortCallback();
+ this.destroy();
+ },
+
+ init: function() {
+ set(this, 'promises', Ember.A(get(this, 'promises')));
+ this._super();
+ }
+});
+
+
+})();
+
+
+
+(function() {
+var loadHooks = {};
+var loaded = {};
+
+Ember.onLoad = function(name, callback) {
+ var object;
+
+ loadHooks[name] = loadHooks[name] || Ember.A();
+ loadHooks[name].pushObject(callback);
+
+ if (object = loaded[name]) {
+ callback(object);
+ }
+};
+
+Ember.runLoadHooks = function(name, object) {
+ var hooks;
+
+ loaded[name] = object;
+
+ if (hooks = loadHooks[name]) {
+ loadHooks[name].forEach(function(callback) {
+ callback(object);
+ });
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+Ember.ControllerMixin = Ember.Mixin.create({
+ /**
+ The object to which events from the view should be sent.
+
+ For example, when a Handlebars template uses the `{{action}}` helper,
+ it will attempt to send the event to the view's controller's `target`.
+
+ By default, a controller's `target` is set to the router after it is
+ instantiated by `Ember.Application#initialize`.
+ */
+ target: null,
+ store: null
+});
+
+Ember.Controller = Ember.Object.extend(Ember.ControllerMixin);
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set, forEach = Ember.EnumerableUtils.forEach;
+
+/**
+ @class
+
+ @extends Ember.Mixin
+ @extends Ember.MutableEnumerable
+*/
+Ember.SortableMixin = Ember.Mixin.create(Ember.MutableEnumerable,
+ /** @scope Ember.Observable.prototype */ {
+ sortProperties: null,
+ sortAscending: true,
+
+ addObject: function(obj) {
+ var content = get(this, 'content');
+ content.pushObject(obj);
+ },
+
+ removeObject: function(obj) {
+ var content = get(this, 'content');
+ content.removeObject(obj);
+ },
+
+ orderBy: function(item1, item2) {
+ var result = 0,
+ sortProperties = get(this, 'sortProperties'),
+ sortAscending = get(this, 'sortAscending');
+
+ Ember.assert("you need to define `sortProperties`", !!sortProperties);
+
+ forEach(sortProperties, function(propertyName) {
+ if (result === 0) {
+ result = Ember.compare(get(item1, propertyName), get(item2, propertyName));
+ if ((result !== 0) && !sortAscending) {
+ result = (-1) * result;
+ }
+ }
+ });
+
+ return result;
+ },
+
+ destroy: function() {
+ var content = get(this, 'content'),
+ sortProperties = get(this, 'sortProperties');
+
+ if (content && sortProperties) {
+ forEach(content, function(item) {
+ forEach(sortProperties, function(sortProperty) {
+ Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');
+ }, this);
+ }, this);
+ }
+
+ return this._super();
+ },
+
+ isSorted: Ember.computed('sortProperties', function() {
+ return !!get(this, 'sortProperties');
+ }),
+
+ arrangedContent: Ember.computed('content', 'sortProperties.@each', function(key, value) {
+ var content = get(this, 'content'),
+ isSorted = get(this, 'isSorted'),
+ sortProperties = get(this, 'sortProperties'),
+ self = this;
+
+ if (content && isSorted) {
+ content = content.slice();
+ content.sort(function(item1, item2) {
+ return self.orderBy(item1, item2);
+ });
+ forEach(content, function(item) {
+ forEach(sortProperties, function(sortProperty) {
+ Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');
+ }, this);
+ }, this);
+ return Ember.A(content);
+ }
+
+ return content;
+ }).cacheable(),
+
+ _contentWillChange: Ember.beforeObserver(function() {
+ var content = get(this, 'content'),
+ sortProperties = get(this, 'sortProperties');
+
+ if (content && sortProperties) {
+ forEach(content, function(item) {
+ forEach(sortProperties, function(sortProperty) {
+ Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');
+ }, this);
+ }, this);
+ }
+
+ this._super();
+ }, 'content'),
+
+ sortAscendingWillChange: Ember.beforeObserver(function() {
+ this._lastSortAscending = get(this, 'sortAscending');
+ }, 'sortAscending'),
+
+ sortAscendingDidChange: Ember.observer(function() {
+ if (get(this, 'sortAscending') !== this._lastSortAscending) {
+ var arrangedContent = get(this, 'arrangedContent');
+ arrangedContent.reverseObjects();
+ }
+ }, 'sortAscending'),
+
+ contentArrayWillChange: function(array, idx, removedCount, addedCount) {
+ var isSorted = get(this, 'isSorted');
+
+ if (isSorted) {
+ var arrangedContent = get(this, 'arrangedContent');
+ var removedObjects = array.slice(idx, idx+removedCount);
+ var sortProperties = get(this, 'sortProperties');
+
+ forEach(removedObjects, function(item) {
+ arrangedContent.removeObject(item);
+
+ forEach(sortProperties, function(sortProperty) {
+ Ember.removeObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');
+ }, this);
+ });
+ }
+
+ return this._super(array, idx, removedCount, addedCount);
+ },
+
+ contentArrayDidChange: function(array, idx, removedCount, addedCount) {
+ var isSorted = get(this, 'isSorted'),
+ sortProperties = get(this, 'sortProperties');
+
+ if (isSorted) {
+ var addedObjects = array.slice(idx, idx+addedCount);
+ var arrangedContent = get(this, 'arrangedContent');
+
+ forEach(addedObjects, function(item) {
+ this.insertItemSorted(item);
+
+ forEach(sortProperties, function(sortProperty) {
+ Ember.addObserver(item, sortProperty, this, 'contentItemSortPropertyDidChange');
+ }, this);
+ }, this);
+ }
+
+ return this._super(array, idx, removedCount, addedCount);
+ },
+
+ insertItemSorted: function(item) {
+ var arrangedContent = get(this, 'arrangedContent');
+ var length = get(arrangedContent, 'length');
+
+ var idx = this._binarySearch(item, 0, length);
+ arrangedContent.insertAt(idx, item);
+ },
+
+ contentItemSortPropertyDidChange: function(item) {
+ var arrangedContent = get(this, 'arrangedContent'),
+ index = arrangedContent.indexOf(item);
+
+ arrangedContent.removeObject(item);
+ this.insertItemSorted(item);
+ },
+
+ _binarySearch: function(item, low, high) {
+ var mid, midItem, res, arrangedContent;
+
+ if (low === high) {
+ return low;
+ }
+
+ arrangedContent = get(this, 'arrangedContent');
+
+ mid = low + Math.floor((high - low) / 2);
+ midItem = arrangedContent.objectAt(mid);
+
+ res = this.orderBy(midItem, item);
+
+ if (res < 0) {
+ return this._binarySearch(item, mid+1, high);
+ } else if (res > 0) {
+ return this._binarySearch(item, low, mid);
+ }
+
+ return mid;
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ Ember.ArrayController provides a way for you to publish a collection of objects
+ so that you can easily bind to the collection from a Handlebars #each helper,
+ an Ember.CollectionView, or other controllers.
+
+ The advantage of using an ArrayController is that you only have to set up
+ your view bindings once; to change what's displayed, simply swap out the
+ `content` property on the controller.
+
+ For example, imagine you wanted to display a list of items fetched via an XHR
+ request. Create an Ember.ArrayController and set its `content` property:
+
+ MyApp.listController = Ember.ArrayController.create();
+
+ $.get('people.json', function(data) {
+ MyApp.listController.set('content', data);
+ });
+
+ Then, create a view that binds to your new controller:
+
+ {{#each MyApp.listController}}
+ {{firstName}} {{lastName}}
+ {{/each}}
+
+ Although you are binding to the controller, the behavior of this controller
+ is to pass through any methods or properties to the underlying array. This
+ capability comes from `Ember.ArrayProxy`, which this class inherits from.
+
+ Note: As of this writing, `ArrayController` does not add any functionality
+ to its superclass, `ArrayProxy`. The Ember team plans to add additional
+ controller-specific functionality in the future, e.g. single or multiple
+ selection support. If you are creating something that is conceptually a
+ controller, use this class.
+
+ @extends Ember.ArrayProxy
+*/
+
+Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
+ Ember.SortableMixin);
+
+})();
+
+
+
+(function() {
+Ember.ObjectController = Ember.ObjectProxy.extend(Ember.ControllerMixin);
+
+})();
+
+
+
+(function() {
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Runtime
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ An Ember.Application instance serves as the namespace in which you define your
+ application's classes. You can also override the configuration of your
+ application.
+
+ By default, Ember.Application will begin listening for events on the document.
+ If your application is embedded inside a page, instead of controlling the
+ entire document, you can specify which DOM element to attach to by setting
+ the `rootElement` property:
+
+ MyApp = Ember.Application.create({
+ rootElement: $('#my-app')
+ });
+
+ The root of an Ember.Application must not be removed during the course of the
+ page's lifetime. If you have only a single conceptual application for the
+ entire page, and are not embedding any third-party Ember applications
+ in your page, use the default document root for your application.
+
+ You only need to specify the root if your page contains multiple instances
+ of Ember.Application.
+
+ @extends Ember.Object
+*/
+Ember.Application = Ember.Namespace.extend(
+/** @scope Ember.Application.prototype */{
+
+ /**
+ The root DOM element of the Application.
+
+ Can be specified as DOMElement or a selector string.
+
+ @type DOMElement
+ @default 'body'
+ */
+ rootElement: 'body',
+
+ /**
+ @type Ember.EventDispatcher
+ @default null
+ */
+ eventDispatcher: null,
+
+ /**
+ @type Object
+ @default null
+ */
+ customEvents: null,
+
+ /** @private */
+ init: function() {
+ var eventDispatcher,
+ rootElement = get(this, 'rootElement');
+ this._super();
+
+ eventDispatcher = Ember.EventDispatcher.create({
+ rootElement: rootElement
+ });
+
+ set(this, 'eventDispatcher', eventDispatcher);
+
+ // jQuery 1.7 doesn't call the ready callback if already ready
+ if (Ember.$.isReady) {
+ Ember.run.once(this, this.didBecomeReady);
+ } else {
+ var self = this;
+ Ember.$(document).ready(function() {
+ Ember.run.once(self, self.didBecomeReady);
+ });
+ }
+ },
+
+ /**
+ Instantiate all controllers currently available on the namespace
+ and inject them onto a router.
+
+ Example:
+
+ App.PostsController = Ember.ArrayController.extend();
+ App.CommentsController = Ember.ArrayController.extend();
+
+ var router = Ember.Router.create({
+ ...
+ });
+
+ App.initialize(router);
+
+ router.get('postsController') // <App.PostsController:ember1234>
+ router.get('commentsController') // <App.CommentsController:ember1235>
+
+ router.get('postsController.router') // router
+ */
+ initialize: function(router) {
+ var properties = Ember.A(Ember.keys(this)),
+ injections = get(this.constructor, 'injections'),
+ namespace = this, controller, name;
+
+ if (!router && Ember.Router.detect(namespace['Router'])) {
+ router = namespace['Router'].create();
+ this._createdRouter = router;
+ }
+
+ if (router) {
+ set(this, 'router', router);
+
+ // By default, the router's namespace is the current application.
+ //
+ // This allows it to find model classes when a state has a
+ // route like `/posts/:post_id`. In that case, it would first
+ // convert `post_id` into `Post`, and then look it up on its
+ // namespace.
+ set(router, 'namespace', this);
+ }
+
+ Ember.runLoadHooks('application', this);
+
+ injections.forEach(function(injection) {
+ properties.forEach(function(property) {
+ injection[1](namespace, router, property);
+ });
+ });
+
+ if (router && router instanceof Ember.Router) {
+ this.startRouting(router);
+ }
+ },
+
+ /** @private */
+ didBecomeReady: function() {
+ var eventDispatcher = get(this, 'eventDispatcher'),
+ customEvents = get(this, 'customEvents');
+
+ eventDispatcher.setup(customEvents);
+
+ this.ready();
+ },
+
+ /**
+ @private
+
+ If the application has a router, use it to route to the current URL, and
+ trigger a new call to `route` whenever the URL changes.
+ */
+ startRouting: function(router) {
+ var location = get(router, 'location'),
+ rootElement = get(this, 'rootElement'),
+ applicationController = get(router, 'applicationController');
+
+ Ember.assert("ApplicationView and ApplicationController must be defined on your application", (this.ApplicationView && applicationController) );
+
+ var applicationView = this.ApplicationView.create({
+ controller: applicationController
+ });
+ this._createdApplicationView = applicationView;
+
+ applicationView.appendTo(rootElement);
+
+ router.route(location.getURL());
+ location.onUpdateURL(function(url) {
+ router.route(url);
+ });
+ },
+
+ /**
+ Called when the Application has become ready.
+ The call will be delayed until the DOM has become ready.
+ */
+ ready: Ember.K,
+
+ /** @private */
+ willDestroy: function() {
+ get(this, 'eventDispatcher').destroy();
+ if (this._createdRouter) { this._createdRouter.destroy(); }
+ if (this._createdApplicationView) { this._createdApplicationView.destroy(); }
+ },
+
+ registerInjection: function(options) {
+ this.constructor.registerInjection(options);
+ }
+});
+
+Ember.Application.reopenClass({
+ concatenatedProperties: ['injections'],
+ injections: Ember.A(),
+ registerInjection: function(options) {
+ var injections = get(this, 'injections'),
+ before = options.before,
+ name = options.name,
+ injection = options.injection,
+ location;
+
+ if (before) {
+ location = injections.find(function(item) {
+ if (item[0] === before) { return true; }
+ });
+ location = injections.indexOf(location);
+ } else {
+ location = get(injections, 'length');
+ }
+
+ injections.splice(location, 0, [name, injection]);
+ }
+});
+
+Ember.Application.registerInjection({
+ name: 'controllers',
+ injection: function(app, router, property) {
+ if (!/^[A-Z].*Controller$/.test(property)) { return; }
+
+ var name = property.charAt(0).toLowerCase() + property.substr(1),
+ controller = app[property].create();
+
+ router.set(name, controller);
+
+ controller.setProperties({
+ target: router,
+ controllers: router,
+ namespace: app
+ });
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+ This file implements the `location` API used by Ember's router.
+
+ That API is:
+
+ getURL: returns the current URL
+ setURL(path): sets the current URL
+ onUpdateURL(callback): triggers the callback when the URL changes
+ formatURL(url): formats `url` to be placed into `href` attribute
+
+ Calling setURL will not trigger onUpdateURL callbacks.
+
+ TODO: This, as well as the Ember.Location documentation below, should
+ perhaps be moved so that it's visible in the JsDoc output.
+*/
+/**
+ @class
+
+ Ember.Location returns an instance of the correct implementation of
+ the `location` API.
+
+ You can pass it a `implementation` ('hash', 'history', 'none') to force a
+ particular implementation.
+*/
+Ember.Location = {
+ create: function(options) {
+ var implementation = options && options.implementation;
+ Ember.assert("Ember.Location.create: you must specify a 'implementation' option", !!implementation);
+
+ var implementationClass = this.implementations[implementation];
+ Ember.assert("Ember.Location.create: " + implementation + " is not a valid implementation", !!implementationClass);
+
+ return implementationClass.create.apply(implementationClass, arguments);
+ },
+
+ registerImplementation: function(name, implementation) {
+ this.implementations[name] = implementation;
+ },
+
+ implementations: {}
+};
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ Ember.HashLocation implements the location API using the browser's
+ hash. At present, it relies on a hashchange event existing in the
+ browser.
+
+ @extends Ember.Object
+*/
+Ember.HashLocation = Ember.Object.extend(
+/** @scope Ember.HashLocation.prototype */ {
+
+ /** @private */
+ init: function() {
+ set(this, 'location', get(this, 'location') || window.location);
+ },
+
+ /**
+ @private
+
+ Returns the current `location.hash`, minus the '#' at the front.
+ */
+ getURL: function() {
+ return get(this, 'location').hash.substr(1);
+ },
+
+ /**
+ @private
+
+ Set the `location.hash` and remembers what was set. This prevents
+ `onUpdateURL` callbacks from triggering when the hash was set by
+ `HashLocation`.
+ */
+ setURL: function(path) {
+ get(this, 'location').hash = path;
+ set(this, 'lastSetURL', path);
+ },
+
+ /**
+ @private
+
+ Register a callback to be invoked when the hash changes. These
+ callbacks will execute when the user presses the back or forward
+ button, but not after `setURL` is invoked.
+ */
+ onUpdateURL: function(callback) {
+ var self = this;
+ var guid = Ember.guidFor(this);
+
+ Ember.$(window).bind('hashchange.ember-location-'+guid, function() {
+ var path = location.hash.substr(1);
+ if (get(self, 'lastSetURL') === path) { return; }
+
+ set(self, 'lastSetURL', null);
+
+ callback(location.hash.substr(1));
+ });
+ },
+
+ /**
+ @private
+
+ Given a URL, formats it to be placed into the page as part
+ of an element's `href` attribute.
+
+ This is used, for example, when using the {{action}} helper
+ to generate a URL based on an event.
+ */
+ formatURL: function(url) {
+ return '#'+url;
+ },
+
+ /** @private */
+ willDestroy: function() {
+ var guid = Ember.guidFor(this);
+
+ Ember.$(window).unbind('hashchange.ember-location-'+guid);
+ }
+});
+
+Ember.Location.registerImplementation('hash', Ember.HashLocation);
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ Ember.HistoryLocation implements the location API using the browser's
+ history.pushState API.
+
+ @extends Ember.Object
+*/
+Ember.HistoryLocation = Ember.Object.extend(
+/** @scope Ember.HistoryLocation.prototype */ {
+
+ /** @private */
+ init: function() {
+ set(this, 'location', get(this, 'location') || window.location);
+ set(this, '_initialURL', get(this, 'location').pathname);
+ },
+
+ /**
+ Will be pre-pended to path upon state change
+ */
+ rootURL: '/',
+
+ /**
+ @private
+
+ Used to give history a starting reference
+ */
+ _initialURL: null,
+
+ /**
+ @private
+
+ Returns the current `location.pathname`.
+ */
+ getURL: function() {
+ return get(this, 'location').pathname;
+ },
+
+ /**
+ @private
+
+ Uses `history.pushState` to update the url without a page reload.
+ */
+ setURL: function(path) {
+ var state = window.history.state,
+ initialURL = get(this, '_initialURL');
+
+ path = this.formatPath(path);
+
+ if ((initialURL !== path && !state) || (state && state.path !== path)) {
+ window.history.pushState({ path: path }, null, path);
+ }
+ },
+
+ /**
+ @private
+
+ Register a callback to be invoked whenever the browser
+ history changes, including using forward and back buttons.
+ */
+ onUpdateURL: function(callback) {
+ var guid = Ember.guidFor(this);
+
+ Ember.$(window).bind('popstate.ember-location-'+guid, function(e) {
+ callback(location.pathname);
+ });
+ },
+
+ /**
+ @private
+
+ returns the given path appended to rootURL
+ */
+ formatPath: function(path) {
+ var rootURL = get(this, 'rootURL');
+
+ if (path !== '') {
+ rootURL = rootURL.replace(/\/$/, '');
+ }
+
+ return rootURL + path;
+ },
+
+ /**
+ @private
+
+ Used when using {{action}} helper. Since no formatting
+ is required we just return the url given.
+ */
+ formatURL: function(url) {
+ return url;
+ },
+
+ /** @private */
+ willDestroy: function() {
+ var guid = Ember.guidFor(this);
+
+ Ember.$(window).unbind('popstate.ember-location-'+guid);
+ }
+});
+
+Ember.Location.registerImplementation('history', Ember.HistoryLocation);
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ Ember.NoneLocation does not interact with the browser. It is useful for
+ testing, or when you need to manage state with your Router, but temporarily
+ don't want it to muck with the URL (for example when you embed your
+ application in a larger page).
+
+ @extends Ember.Object
+*/
+Ember.NoneLocation = Ember.Object.extend(
+/** @scope Ember.NoneLocation.prototype */ {
+ path: '',
+
+ getURL: function() {
+ return get(this, 'path');
+ },
+
+ setURL: function(path) {
+ set(this, 'path', path);
+ },
+
+ onUpdateURL: function(callback) {
+ // We are not wired up to the browser, so we'll never trigger the callback.
+ },
+
+ formatURL: function(url) {
+ // The return value is not overly meaningful, but we do not want to throw
+ // errors when test code renders templates containing {{action href=true}}
+ // helpers.
+ return url;
+ }
+});
+
+Ember.Location.registerImplementation('none', Ember.NoneLocation);
+
+})();
+
+
+
+(function() {
+
+})();
+
+
+
+(function() {
+
+})();
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+Ember.assert("Ember Views require jQuery 1.7", window.jQuery && (window.jQuery().jquery.match(/^1\.7(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY));
+Ember.$ = window.jQuery;
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents
+var dragEvents = Ember.String.w('dragstart drag dragenter dragleave dragover drop dragend');
+
+// Copies the `dataTransfer` property from a browser event object onto the
+// jQuery event object for the specified events
+Ember.EnumerableUtils.forEach(dragEvents, function(eventName) {
+ Ember.$.event.fixHooks[eventName] = { props: ['dataTransfer'] };
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+var get = Ember.get, set = Ember.set;
+var indexOf = Ember.ArrayPolyfills.indexOf;
+
+/** @private */
+var ClassSet = function() {
+ this.seen = {};
+ this.list = [];
+};
+
+ClassSet.prototype = {
+ add: function(string) {
+ if (string in this.seen) { return; }
+ this.seen[string] = true;
+
+ this.list.push(string);
+ },
+
+ toDOM: function() {
+ return this.list.join(" ");
+ }
+};
+
+/**
+ @class
+
+ Ember.RenderBuffer gathers information regarding the a view and generates the
+ final representation. Ember.RenderBuffer will generate HTML which can be pushed
+ to the DOM.
+
+ @extends Ember.Object
+*/
+Ember.RenderBuffer = function(tagName) {
+ return new Ember._RenderBuffer(tagName);
+};
+
+Ember._RenderBuffer = function(tagName) {
+ this.elementTag = tagName;
+ this.childBuffers = [];
+};
+
+Ember._RenderBuffer.prototype =
+/** @scope Ember.RenderBuffer.prototype */ {
+
+ /**
+ Array of class-names which will be applied in the class="" attribute
+
+ You should not maintain this array yourself, rather, you should use
+ the addClass() method of Ember.RenderBuffer.
+
+ @type Array
+ @default []
+ */
+ elementClasses: null,
+
+ /**
+ The id in of the element, to be applied in the id="" attribute
+
+ You should not set this property yourself, rather, you should use
+ the id() method of Ember.RenderBuffer.
+
+ @type String
+ @default null
+ */
+ elementId: null,
+
+ /**
+ A hash keyed on the name of the attribute and whose value will be
+ applied to that attribute. For example, if you wanted to apply a
+ data-view="Foo.bar" property to an element, you would set the
+ elementAttributes hash to {'data-view':'Foo.bar'}
+
+ You should not maintain this hash yourself, rather, you should use
+ the attr() method of Ember.RenderBuffer.
+
+ @type Hash
+ @default {}
+ */
+ elementAttributes: null,
+
+ /**
+ The tagname of the element an instance of Ember.RenderBuffer represents.
+
+ Usually, this gets set as the first parameter to Ember.RenderBuffer. For
+ example, if you wanted to create a `p` tag, then you would call
+
+ Ember.RenderBuffer('p')
+
+ @type String
+ @default null
+ */
+ elementTag: null,
+
+ /**
+ A hash keyed on the name of the style attribute and whose value will
+ be applied to that attribute. For example, if you wanted to apply a
+ background-color:black;" style to an element, you would set the
+ elementStyle hash to {'background-color':'black'}
+
+ You should not maintain this hash yourself, rather, you should use
+ the style() method of Ember.RenderBuffer.
+
+ @type Hash
+ @default {}
+ */
+ elementStyle: null,
+
+ /**
+ Nested RenderBuffers will set this to their parent RenderBuffer
+ instance.
+
+ @type Ember._RenderBuffer
+ */
+ parentBuffer: null,
+
+ /**
+ Adds a string of HTML to the RenderBuffer.
+
+ @param {String} string HTML to push into the buffer
+ @returns {Ember.RenderBuffer} this
+ */
+ push: function(string) {
+ this.childBuffers.push(String(string));
+ return this;
+ },
+
+ /**
+ Adds a class to the buffer, which will be rendered to the class attribute.
+
+ @param {String} className Class name to add to the buffer
+ @returns {Ember.RenderBuffer} this
+ */
+ addClass: function(className) {
+ // lazily create elementClasses
+ var elementClasses = this.elementClasses = (this.elementClasses || new ClassSet());
+ this.elementClasses.add(className);
+
+ return this;
+ },
+
+ /**
+ Sets the elementID to be used for the element.
+
+ @param {String} id
+ @returns {Ember.RenderBuffer} this
+ */
+ id: function(id) {
+ this.elementId = id;
+ return this;
+ },
+
+ // duck type attribute functionality like jQuery so a render buffer
+ // can be used like a jQuery object in attribute binding scenarios.
+
+ /**
+ Adds an attribute which will be rendered to the element.
+
+ @param {String} name The name of the attribute
+ @param {String} value The value to add to the attribute
+ @returns {Ember.RenderBuffer|String} this or the current attribute value
+ */
+ attr: function(name, value) {
+ var attributes = this.elementAttributes = (this.elementAttributes || {});
+
+ if (arguments.length === 1) {
+ return attributes[name];
+ } else {
+ attributes[name] = value;
+ }
+
+ return this;
+ },
+
+ /**
+ Remove an attribute from the list of attributes to render.
+
+ @param {String} name The name of the attribute
+ @returns {Ember.RenderBuffer} this
+ */
+ removeAttr: function(name) {
+ var attributes = this.elementAttributes;
+ if (attributes) { delete attributes[name]; }
+
+ return this;
+ },
+
+ /**
+ Adds a style to the style attribute which will be rendered to the element.
+
+ @param {String} name Name of the style
+ @param {String} value
+ @returns {Ember.RenderBuffer} this
+ */
+ style: function(name, value) {
+ var style = this.elementStyle = (this.elementStyle || {});
+
+ this.elementStyle[name] = value;
+ return this;
+ },
+
+ /**
+ Create a new child render buffer from a parent buffer. Optionally set
+ additional properties on the buffer. Optionally invoke a callback
+ with the newly created buffer.
+
+ This is a primitive method used by other public methods: `begin`,
+ `prepend`, `replaceWith`, `insertAfter`.
+
+ @private
+ @param {String} tagName Tag name to use for the child buffer's element
+ @param {Ember._RenderBuffer} parent The parent render buffer that this
+ buffer should be appended to.
+ @param {Function} fn A callback to invoke with the newly created buffer.
+ @param {Object} other Additional properties to add to the newly created
+ buffer.
+ */
+ newBuffer: function(tagName, parent, fn, other) {
+ var buffer = new Ember._RenderBuffer(tagName);
+ buffer.parentBuffer = parent;
+
+ if (other) { Ember.$.extend(buffer, other); }
+ if (fn) { fn.call(this, buffer); }
+
+ return buffer;
+ },
+
+ /**
+ Replace the current buffer with a new buffer. This is a primitive
+ used by `remove`, which passes `null` for `newBuffer`, and `replaceWith`,
+ which passes the new buffer it created.
+
+ @private
+ @param {Ember._RenderBuffer} buffer The buffer to insert in place of
+ the existing buffer.
+ */
+ replaceWithBuffer: function(newBuffer) {
+ var parent = this.parentBuffer;
+ if (!parent) { return; }
+
+ var childBuffers = parent.childBuffers;
+
+ var index = indexOf.call(childBuffers, this);
+
+ if (newBuffer) {
+ childBuffers.splice(index, 1, newBuffer);
+ } else {
+ childBuffers.splice(index, 1);
+ }
+ },
+
+ /**
+ Creates a new Ember.RenderBuffer object with the provided tagName as
+ the element tag and with its parentBuffer property set to the current
+ Ember.RenderBuffer.
+
+ @param {String} tagName Tag name to use for the child buffer's element
+ @returns {Ember.RenderBuffer} A new RenderBuffer object
+ */
+ begin: function(tagName) {
+ return this.newBuffer(tagName, this, function(buffer) {
+ this.childBuffers.push(buffer);
+ });
+ },
+
+ /**
+ Prepend a new child buffer to the current render buffer.
+
+ @param {String} tagName Tag name to use for the child buffer's element
+ */
+ prepend: function(tagName) {
+ return this.newBuffer(tagName, this, function(buffer) {
+ this.childBuffers.splice(0, 0, buffer);
+ });
+ },
+
+ /**
+ Replace the current buffer with a new render buffer.
+
+ @param {String} tagName Tag name to use for the new buffer's element
+ */
+ replaceWith: function(tagName) {
+ var parentBuffer = this.parentBuffer;
+
+ return this.newBuffer(tagName, parentBuffer, function(buffer) {
+ this.replaceWithBuffer(buffer);
+ });
+ },
+
+ /**
+ Insert a new render buffer after the current render buffer.
+
+ @param {String} tagName Tag name to use for the new buffer's element
+ */
+ insertAfter: function(tagName) {
+ var parentBuffer = get(this, 'parentBuffer');
+
+ return this.newBuffer(tagName, parentBuffer, function(buffer) {
+ var siblings = parentBuffer.childBuffers;
+ var index = indexOf.call(siblings, this);
+ siblings.splice(index + 1, 0, buffer);
+ });
+ },
+
+ /**
+ Closes the current buffer and adds its content to the parentBuffer.
+
+ @returns {Ember.RenderBuffer} The parentBuffer, if one exists. Otherwise, this
+ */
+ end: function() {
+ var parent = this.parentBuffer;
+ return parent || this;
+ },
+
+ remove: function() {
+ this.replaceWithBuffer(null);
+ },
+
+ /**
+ @returns {DOMElement} The element corresponding to the generated HTML
+ of this buffer
+ */
+ element: function() {
+ return Ember.$(this.string())[0];
+ },
+
+ /**
+ Generates the HTML content for this buffer.
+
+ @returns {String} The generated HTMl
+ */
+ string: function() {
+ var content = '', tag = this.elementTag, openTag;
+
+ if (tag) {
+ var id = this.elementId,
+ classes = this.elementClasses,
+ attrs = this.elementAttributes,
+ style = this.elementStyle,
+ styleBuffer = '', prop;
+
+ openTag = ["<" + tag];
+
+ if (id) { openTag.push('id="' + this._escapeAttribute(id) + '"'); }
+ if (classes) { openTag.push('class="' + this._escapeAttribute(classes.toDOM()) + '"'); }
+
+ if (style) {
+ for (prop in style) {
+ if (style.hasOwnProperty(prop)) {
+ styleBuffer += (prop + ':' + this._escapeAttribute(style[prop]) + ';');
+ }
+ }
+
+ openTag.push('style="' + styleBuffer + '"');
+ }
+
+ if (attrs) {
+ for (prop in attrs) {
+ if (attrs.hasOwnProperty(prop)) {
+ openTag.push(prop + '="' + this._escapeAttribute(attrs[prop]) + '"');
+ }
+ }
+ }
+
+ openTag = openTag.join(" ") + '>';
+ }
+
+ var childBuffers = this.childBuffers;
+
+ Ember.ArrayPolyfills.forEach.call(childBuffers, function(buffer) {
+ var stringy = typeof buffer === 'string';
+ content += (stringy ? buffer : buffer.string());
+ });
+
+ if (tag) {
+ return openTag + content + "</" + tag + ">";
+ } else {
+ return content;
+ }
+ },
+
+ _escapeAttribute: function(value) {
+ // Stolen shamelessly from Handlebars
+
+ var escape = {
+ "<": "&lt;",
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&#x27;",
+ "`": "&#x60;"
+ };
+
+ var badChars = /&(?!\w+;)|[<>"'`]/g;
+ var possible = /[&<>"'`]/;
+
+ var escapeChar = function(chr) {
+ return escape[chr] || "&amp;";
+ };
+
+ var string = value.toString();
+
+ if(!possible.test(string)) { return string; }
+ return string.replace(badChars, escapeChar);
+ }
+
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
+
+/**
+ @ignore
+
+ Ember.EventDispatcher handles delegating browser events to their corresponding
+ Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures
+ that that view's `mouseDown` method gets called.
+*/
+Ember.EventDispatcher = Ember.Object.extend(
+/** @scope Ember.EventDispatcher.prototype */{
+
+ /**
+ @private
+
+ The root DOM element to which event listeners should be attached. Event
+ listeners will be attached to the document unless this is overridden.
+
+ Can be specified as a DOMElement or a selector string.
+
+ The default body is a string since this may be evaluated before document.body
+ exists in the DOM.
+
+ @type DOMElement
+ @default 'body'
+ */
+ rootElement: 'body',
+
+ /**
+ @private
+
+ Sets up event listeners for standard browser events.
+
+ This will be called after the browser sends a DOMContentReady event. By
+ default, it will set up all of the listeners on the document body. If you
+ would like to register the listeners on a different element, set the event
+ dispatcher's `root` property.
+ */
+ setup: function(addedEvents) {
+ var event, events = {
+ touchstart : 'touchStart',
+ touchmove : 'touchMove',
+ touchend : 'touchEnd',
+ touchcancel : 'touchCancel',
+ keydown : 'keyDown',
+ keyup : 'keyUp',
+ keypress : 'keyPress',
+ mousedown : 'mouseDown',
+ mouseup : 'mouseUp',
+ contextmenu : 'contextMenu',
+ click : 'click',
+ dblclick : 'doubleClick',
+ mousemove : 'mouseMove',
+ focusin : 'focusIn',
+ focusout : 'focusOut',
+ mouseenter : 'mouseEnter',
+ mouseleave : 'mouseLeave',
+ submit : 'submit',
+ input : 'input',
+ change : 'change',
+ dragstart : 'dragStart',
+ drag : 'drag',
+ dragenter : 'dragEnter',
+ dragleave : 'dragLeave',
+ dragover : 'dragOver',
+ drop : 'drop',
+ dragend : 'dragEnd'
+ };
+
+ Ember.$.extend(events, addedEvents || {});
+
+ var rootElement = Ember.$(get(this, 'rootElement'));
+
+ Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));
+ Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);
+ Ember.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find('.ember-application').length);
+
+ rootElement.addClass('ember-application');
+
+ Ember.assert('Unable to add "ember-application" class to rootElement. Make sure you set rootElement to the body or an element in the body.', rootElement.is('.ember-application'));
+
+ for (event in events) {
+ if (events.hasOwnProperty(event)) {
+ this.setupHandler(rootElement, event, events[event]);
+ }
+ }
+ },
+
+ /**
+ @private
+
+ Registers an event listener on the document. If the given event is
+ triggered, the provided event handler will be triggered on the target
+ view.
+
+ If the target view does not implement the event handler, or if the handler
+ returns false, the parent view will be called. The event will continue to
+ bubble to each successive parent view until it reaches the top.
+
+ For example, to have the `mouseDown` method called on the target view when
+ a `mousedown` event is received from the browser, do the following:
+
+ setupHandler('mousedown', 'mouseDown');
+
+ @param {String} event the browser-originated event to listen to
+ @param {String} eventName the name of the method to call on the view
+ */
+ setupHandler: function(rootElement, event, eventName) {
+ var self = this;
+
+ rootElement.delegate('.ember-view', event + '.ember', function(evt, triggeringManager) {
+
+ var view = Ember.View.views[this.id],
+ result = true, manager = null;
+
+ manager = self._findNearestEventManager(view,eventName);
+
+ if (manager && manager !== triggeringManager) {
+ result = self._dispatchEvent(manager, evt, eventName, view);
+ } else if (view) {
+ result = self._bubbleEvent(view,evt,eventName);
+ } else {
+ evt.stopPropagation();
+ }
+
+ return result;
+ });
+
+ rootElement.delegate('[data-ember-action]', event + '.ember', function(evt) {
+ var actionId = Ember.$(evt.currentTarget).attr('data-ember-action'),
+ action = Ember.Handlebars.ActionHelper.registeredActions[actionId],
+ handler = action.handler;
+
+ if (action.eventName === eventName) {
+ return handler(evt);
+ }
+ });
+ },
+
+ /** @private */
+ _findNearestEventManager: function(view, eventName) {
+ var manager = null;
+
+ while (view) {
+ manager = get(view, 'eventManager');
+ if (manager && manager[eventName]) { break; }
+
+ view = get(view, 'parentView');
+ }
+
+ return manager;
+ },
+
+ /** @private */
+ _dispatchEvent: function(object, evt, eventName, view) {
+ var result = true;
+
+ var handler = object[eventName];
+ if (Ember.typeOf(handler) === 'function') {
+ result = handler.call(object, evt, view);
+ // Do not preventDefault in eventManagers.
+ evt.stopPropagation();
+ }
+ else {
+ result = this._bubbleEvent(view, evt, eventName);
+ }
+
+ return result;
+ },
+
+ /** @private */
+ _bubbleEvent: function(view, evt, eventName) {
+ return Ember.run(function() {
+ return view.handleEvent(eventName, evt);
+ });
+ },
+
+ /** @private */
+ destroy: function() {
+ var rootElement = get(this, 'rootElement');
+ Ember.$(rootElement).undelegate('.ember').removeClass('ember-application');
+ return this._super();
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+// Add a new named queue for rendering views that happens
+// after bindings have synced.
+var queues = Ember.run.queues;
+queues.splice(Ember.$.inArray('actions', queues)+1, 0, 'render');
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+Ember.ControllerMixin.reopen({
+
+ target: null,
+ controllers: null,
+ namespace: null,
+ view: null,
+
+ /**
+ `connectOutlet` creates a new instance of a provided view
+ class, wires it up to its associated controller, and
+ assigns the new view to a property on the current controller.
+
+ The purpose of this method is to enable views that use
+ outlets to quickly assign new views for a given outlet.
+
+ For example, an application view's template may look like
+ this:
+
+ <h1>My Blog</h1>
+ {{outlet}}
+
+ The view for this outlet is specified by assigning a
+ `view` property to the application's controller. The
+ following code will assign a new `App.PostsView` to
+ that outlet:
+
+ applicationController.connectOutlet('posts');
+
+ In general, you will also want to assign a controller
+ to the newly created view. By convention, a controller
+ named `postsController` will be assigned as the view's
+ controller.
+
+ In an application initialized using `app.initialize(router)`,
+ `connectOutlet` will look for `postsController` on the
+ router. The initialization process will automatically
+ create an instance of `App.PostsController` called
+ `postsController`, so you don't need to do anything
+ beyond `connectOutlet` to assign your view and wire it
+ up to its associated controller.
+
+ You can supply a `content` for the controller by supplying
+ a final argument after the view class:
+
+ applicationController.connectOutlet('posts', App.Post.find());
+
+ You can specify a particular outlet to use. For example, if your main
+ template looks like:
+
+ <h1>My Blog</h1>
+ {{outlet master}}
+ {{outlet detail}}
+
+ You can assign an `App.PostsView` to the master outlet:
+
+ applicationController.connectOutlet({
+ name: 'posts',
+ outletName: 'master',
+ context: App.Post.find()
+ });
+
+ You can write this as:
+
+ applicationController.connectOutlet('master', 'posts', App.Post.find());
+
+ @param {String} outletName a name for the outlet to set
+ @param {String} name a view/controller pair name
+ @param {Object} context a context object to assign to the
+ controller's `content` property, if a controller can be
+ found (optional)
+ */
+ connectOutlet: function(name, context) {
+ // Normalize arguments. Supported arguments:
+ //
+ // name
+ // name, context
+ // outletName, name
+ // outletName, name, context
+ // options
+ //
+ // The options hash has the following keys:
+ //
+ // name: the name of the controller and view
+ // to use. If this is passed, the name
+ // determines the view and controller.
+ // outletName: the name of the outlet to
+ // fill in. default: 'view'
+ // viewClass: the class of the view to instantiate
+ // controller: the controller instance to pass
+ // to the view
+ // context: an object that should become the
+ // controller's `content` and thus the
+ // template's context.
+
+ var outletName, viewClass, view, controller, options;
+
+ if (Ember.typeOf(context) === 'string') {
+ outletName = name;
+ name = context;
+ context = arguments[2];
+ }
+
+ if (arguments.length === 1) {
+ if (Ember.typeOf(name) === 'object') {
+ options = name;
+ outletName = options.outletName;
+ name = options.name;
+ viewClass = options.viewClass;
+ controller = options.controller;
+ context = options.context;
+ }
+ } else {
+ options = {};
+ }
+
+ outletName = outletName || 'view';
+
+ Ember.assert("You must supply a name or a view class to connectOutlets, but not both", (!!name && !viewClass && !controller) || (!name && !!viewClass));
+
+ if (name) {
+ var namespace = get(this, 'namespace'),
+ controllers = get(this, 'controllers');
+
+ var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
+ viewClass = get(namespace, viewClassName);
+ controller = get(controllers, name + 'Controller');
+
+ Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass);
+ Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context);
+ }
+
+ if (controller && context) { controller.set('content', context); }
+ view = viewClass.create();
+ if (controller) { set(view, 'controller', controller); }
+ set(this, outletName, view);
+
+ return view;
+ },
+
+ /**
+ Convenience method to connect controllers. This method makes other controllers
+ available on the controller the method was invoked on.
+
+ For example, to make the `personController` and the `postController` available
+ on the `overviewController`, you would call:
+
+ overviewController.connectControllers('person', 'post');
+
+ @param {String...} controllerNames the controllers to make available
+ */
+ connectControllers: function() {
+ var controllers = get(this, 'controllers'),
+ controllerNames = Array.prototype.slice.apply(arguments),
+ controllerName;
+
+ for (var i=0, l=controllerNames.length; i<l; i++) {
+ controllerName = controllerNames[i] + 'Controller';
+ set(this, controllerName, get(controllers, controllerName));
+ }
+ }
+});
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, addObserver = Ember.addObserver;
+var meta = Ember.meta, fmt = Ember.String.fmt;
+var a_slice = [].slice;
+var a_forEach = Ember.EnumerableUtils.forEach;
+
+var childViewsProperty = Ember.computed(function() {
+ var childViews = this._childViews;
+
+ var ret = Ember.A();
+
+ a_forEach(childViews, function(view) {
+ if (view.isVirtual) {
+ ret.pushObjects(get(view, 'childViews'));
+ } else {
+ ret.push(view);
+ }
+ });
+
+ return ret;
+}).property().cacheable();
+
+var VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;
+Ember.warn("The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.", VIEW_PRESERVES_CONTEXT);
+
+/**
+ @static
+
+ Global hash of shared templates. This will automatically be populated
+ by the build tools so that you can store your Handlebars templates in
+ separate files that get loaded into JavaScript at buildtime.
+
+ @type Hash
+*/
+Ember.TEMPLATES = {};
+
+var invokeForState = {
+ preRender: {},
+ inBuffer: {},
+ hasElement: {},
+ inDOM: {},
+ destroyed: {}
+};
+
+/**
+ @class
+
+ `Ember.View` is the class in Ember responsible for encapsulating templates of HTML
+ content, combining templates with data to render as sections of a page's DOM, and
+ registering and responding to user-initiated events.
+
+ ## HTML Tag
+ The default HTML tag name used for a view's DOM representation is `div`. This can be
+ customized by setting the `tagName` property. The following view class:
+
+ ParagraphView = Ember.View.extend({
+ tagName: 'em'
+ })
+
+ Would result in instances with the following HTML:
+
+ <em id="ember1" class="ember-view"></em>
+
+ ## HTML `class` Attribute
+ The HTML `class` attribute of a view's tag can be set by providing a `classNames` property
+ that is set to an array of strings:
+
+ MyView = Ember.View.extend({
+ classNames: ['my-class', 'my-other-class']
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view my-class my-other-class"></div>
+
+ `class` attribute values can also be set by providing a `classNameBindings` property
+ set to an array of properties names for the view. The return value of these properties
+ will be added as part of the value for the view's `class` attribute. These properties
+ can be computed properties:
+
+ MyView = Ember.View.extend({
+ classNameBindings: ['propertyA', 'propertyB'],
+ propertyA: 'from-a',
+ propertyB: function(){
+ if(someLogic){ return 'from-b'; }
+ }.property()
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view from-a from-b"></div>
+
+ If the value of a class name binding returns a boolean the property name itself
+ will be used as the class name if the property is true. The class name will
+ not be added if the value is `false` or `undefined`.
+
+ MyView = Ember.View.extend({
+ classNameBindings: ['hovered'],
+ hovered: true
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view hovered"></div>
+
+ When using boolean class name bindings you can supply a string value other than the
+ property name for use as the `class` HTML attribute by appending the preferred value after
+ a ":" character when defining the binding:
+
+ MyView = Ember.View.extend({
+ classNameBindings: ['awesome:so-very-cool'],
+ awesome: true
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view so-very-cool"></div>
+
+
+ Boolean value class name bindings whose property names are in a camelCase-style
+ format will be converted to a dasherized format:
+
+ MyView = Ember.View.extend({
+ classNameBindings: ['isUrgent'],
+ isUrgent: true
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view is-urgent"></div>
+
+
+ Class name bindings can also refer to object values that are found by
+ traversing a path relative to the view itself:
+
+ MyView = Ember.View.extend({
+ classNameBindings: ['messages.empty']
+ messages: Ember.Object.create({
+ empty: true
+ })
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view empty"></div>
+
+
+ If you want to add a class name for a property which evaluates to true and
+ and a different class name if it evaluates to false, you can pass a binding
+ like this:
+
+ // Applies 'enabled' class when isEnabled is true and 'disabled' when isEnabled is false
+ Ember.View.create({
+ classNameBindings: ['isEnabled:enabled:disabled']
+ isEnabled: true
+ });
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view enabled"></div>
+
+ When isEnabled is `false`, the resulting HTML reprensentation looks like this:
+
+ <div id="ember1" class="ember-view disabled"></div>
+
+ This syntax offers the convenience to add a class if a property is `false`:
+
+ // Applies no class when isEnabled is true and class 'disabled' when isEnabled is false
+ Ember.View.create({
+ classNameBindings: ['isEnabled::disabled']
+ isEnabled: true
+ });
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view"></div>
+
+ When the `isEnabled` property on the view is set to `false`, it will result
+ in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view disabled"></div>
+
+
+ Updates to the the value of a class name binding will result in automatic update
+ of the HTML `class` attribute in the view's rendered HTML representation.
+ If the value becomes `false` or `undefined` the class name will be removed.
+
+ Both `classNames` and `classNameBindings` are concatenated properties.
+ See `Ember.Object` documentation for more information about concatenated properties.
+
+ ## HTML Attributes
+ The HTML attribute section of a view's tag can be set by providing an `attributeBindings`
+ property set to an array of property names on the view. The return value of these properties
+ will be used as the value of the view's HTML associated attribute:
+
+ AnchorView = Ember.View.extend({
+ tagName: 'a',
+ attributeBindings: ['href'],
+ href: 'http://google.com'
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <a id="ember1" class="ember-view" href="http://google.com"></a>
+
+ If the return value of an `attributeBindings` monitored property is a boolean
+ the property will follow HTML's pattern of repeating the attribute's name as
+ its value:
+
+ MyTextInput = Ember.View.extend({
+ tagName: 'input',
+ attributeBindings: ['disabled'],
+ disabled: true
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <input id="ember1" class="ember-view" disabled="disabled" />
+
+ `attributeBindings` can refer to computed properties:
+
+ MyTextInput = Ember.View.extend({
+ tagName: 'input',
+ attributeBindings: ['disabled'],
+ disabled: function(){
+ if (someLogic) {
+ return true;
+ } else {
+ return false;
+ }
+ }.property()
+ })
+
+ Updates to the the property of an attribute binding will result in automatic update
+ of the HTML attribute in the view's rendered HTML representation.
+
+ `attributeBindings` is a concatenated property. See `Ember.Object` documentation
+ for more information about concatenated properties.
+
+ ## Templates
+ The HTML contents of a view's rendered representation are determined by its template.
+ Templates can be any function that accepts an optional context parameter and returns
+ a string of HTML that will be inserted within the view's tag. Most
+ typically in Ember this function will be a compiled Ember.Handlebars template.
+
+ AView = Ember.View.extend({
+ template: Ember.Handlebars.compile('I am the template')
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view">I am the template</div>
+
+ The default context of the compiled template will be the view instance itself:
+
+ AView = Ember.View.extend({
+ template: Ember.Handlebars.compile('Hello {{excitedGreeting}}')
+ })
+
+ aView = AView.create({
+ content: Ember.Object.create({
+ firstName: 'Barry'
+ })
+ excitedGreeting: function(){
+ return this.get("content.firstName") + "!!!"
+ }
+ })
+
+ Will result in an HTML representation of:
+
+ <div id="ember1" class="ember-view">Hello Barry!!!</div>
+
+ Within an Ember application is more common to define a Handlebars templates as
+ part of a page:
+
+ <script type='text/x-handlebars' data-template-name='some-template'>
+ Hello
+ </script>
+
+ And associate it by name using a view's `templateName` property:
+
+ AView = Ember.View.extend({
+ templateName: 'some-template'
+ })
+
+ Using a value for `templateName` that does not have a Handlebars template with a
+ matching `data-template-name` attribute will throw an error.
+
+ Assigning a value to both `template` and `templateName` properties will throw an error.
+
+ For views classes that may have a template later defined (e.g. as the block portion of a `{{view}}`
+ Handlebars helper call in another template or in a subclass), you can provide a `defaultTemplate`
+ property set to compiled template function. If a template is not later provided for the view
+ instance the `defaultTemplate` value will be used:
+
+ AView = Ember.View.extend({
+ defaultTemplate: Ember.Handlebars.compile('I was the default'),
+ template: null,
+ templateName: null
+ })
+
+ Will result in instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view">I was the default</div>
+
+ If a `template` or `templateName` is provided it will take precedence over `defaultTemplate`:
+
+ AView = Ember.View.extend({
+ defaultTemplate: Ember.Handlebars.compile('I was the default')
+ })
+
+ aView = AView.create({
+ template: Ember.Handlebars.compile('I was the template, not default')
+ })
+
+ Will result in the following HTML representation when rendered:
+
+ <div id="ember1" class="ember-view">I was the template, not default</div>
+
+ ## Layouts
+ Views can have a secondary template that wraps their main template. Like
+ primary templates, layouts can be any function that accepts an optional context
+ parameter and returns a string of HTML that will be inserted inside view's tag. Views whose HTML
+ element is self closing (e.g. `<input />`) cannot have a layout and this property will be ignored.
+
+ Most typically in Ember a layout will be a compiled Ember.Handlebars template.
+
+ A view's layout can be set directly with the `layout` property or reference an
+ existing Handlebars template by name with the `layoutName` property.
+
+ A template used as a layout must contain a single use of the Handlebars `{{yield}}`
+ helper. The HTML contents of a view's rendered `template` will be inserted at this location:
+
+ AViewWithLayout = Ember.View.extend({
+ layout: Ember.Handlebars.compile("<div class='my-decorative-class'>{{yield}}</div>")
+ template: Ember.Handlebars.compile("I got wrapped"),
+ })
+
+ Will result in view instances with an HTML representation of:
+
+ <div id="ember1" class="ember-view">
+ <div class="my-decorative-class">
+ I got wrapped
+ </div>
+ </div>
+
+ See `Handlebars.helpers.yield` for more information.
+
+ ## Responding to Browser Events
+ Views can respond to user-initiated events in one of three ways: method implementation,
+ through an event manager, and through `{{action}}` helper use in their template or layout.
+
+ ### Method Implementation
+ Views can respond to user-initiated events by implementing a method that matches the
+ event name. A `jQuery.Event` object will be passed as the argument to this method.
+
+ AView = Ember.View.extend({
+ click: function(event){
+ // will be called when when an instance's
+ // rendered element is clicked
+ }
+ })
+
+ ### Event Managers
+ Views can define an object as their `eventManager` property. This object can then
+ implement methods that match the desired event names. Matching events that occur
+ on the view's rendered HTML or the rendered HTML of any of its DOM descendants
+ will trigger this method. A `jQuery.Event` object will be passed as the first
+ argument to the method and an `Ember.View` object as the second. The `Ember.View`
+ will be the view whose rendered HTML was interacted with. This may be the view with
+ the `eventManager` property or one of its descendent views.
+
+ AView = Ember.View.extend({
+ eventManager: Ember.Object.create({
+ doubleClick: function(event, view){
+ // will be called when when an instance's
+ // rendered element or any rendering
+ // of this views's descendent
+ // elements is clicked
+ }
+ })
+ })
+
+
+ An event defined for an event manager takes precedence over events of the same
+ name handled through methods on the view.
+
+
+ AView = Ember.View.extend({
+ mouseEnter: function(event){
+ // will never trigger.
+ },
+ eventManager: Ember.Object.create({
+ mouseEnter: function(event, view){
+ // takes presedence over AView#mouseEnter
+ }
+ })
+ })
+
+ Similarly a view's event manager will take precedence for events of any views
+ rendered as a descendent. A method name that matches an event name will not be called
+ if the view instance was rendered inside the HTML representation of a view that has
+ an `eventManager` property defined that handles events of the name. Events not handled
+ by the event manager will still trigger method calls on the descendent.
+
+ OuterView = Ember.View.extend({
+ template: Ember.Handlebars.compile("outer {{#view InnerView}}inner{{/view}} outer"),
+ eventManager: Ember.Object.create({
+ mouseEnter: function(event, view){
+ // view might be instance of either
+ // OutsideView or InnerView depending on
+ // where on the page the user interaction occured
+ }
+ })
+ })
+
+ InnerView = Ember.View.extend({
+ click: function(event){
+ // will be called if rendered inside
+ // an OuterView because OuterView's
+ // eventManager doesn't handle click events
+ },
+ mouseEnter: function(event){
+ // will never be called if rendered inside
+ // an OuterView.
+ }
+ })
+
+ ### Handlebars `{{action}}` Helper
+ See `Handlebars.helpers.action`.
+
+ ### Event Names
+ Possible events names for any of the responding approaches described above are:
+
+ Touch events: 'touchStart', 'touchMove', 'touchEnd', 'touchCancel'
+
+ Keyboard events: 'keyDown', 'keyUp', 'keyPress'
+
+ Mouse events: 'mouseDown', 'mouseUp', 'contextMenu', 'click', 'doubleClick', 'mouseMove',
+ 'focusIn', 'focusOut', 'mouseEnter', 'mouseLeave'
+
+ Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'
+
+ HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'
+
+ ## Handlebars `{{view}}` Helper
+ Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`
+ Handlebars helper. See `Handlebars.helpers.view` for additional information.
+
+ @extends Ember.Object
+ @extends Ember.Evented
+*/
+Ember.View = Ember.Object.extend(Ember.Evented,
+/** @scope Ember.View.prototype */ {
+
+ /** @private */
+ concatenatedProperties: ['classNames', 'classNameBindings', 'attributeBindings'],
+
+ /**
+ @type Boolean
+ @default true
+ @constant
+ */
+ isView: true,
+
+ // ..........................................................
+ // TEMPLATE SUPPORT
+ //
+
+ /**
+ The name of the template to lookup if no template is provided.
+
+ Ember.View will look for a template with this name in this view's
+ `templates` object. By default, this will be a global object
+ shared in `Ember.TEMPLATES`.
+
+ @type String
+ @default null
+ */
+ templateName: null,
+
+ /**
+ The name of the layout to lookup if no layout is provided.
+
+ Ember.View will look for a template with this name in this view's
+ `templates` object. By default, this will be a global object
+ shared in `Ember.TEMPLATES`.
+
+ @type String
+ @default null
+ */
+ layoutName: null,
+
+ /**
+ The hash in which to look for `templateName`.
+
+ @type Ember.Object
+ @default Ember.TEMPLATES
+ */
+ templates: Ember.TEMPLATES,
+
+ /**
+ The template used to render the view. This should be a function that
+ accepts an optional context parameter and returns a string of HTML that
+ will be inserted into the DOM relative to its parent view.
+
+ In general, you should set the `templateName` property instead of setting
+ the template yourself.
+
+ @field
+ @type Function
+ */
+ template: Ember.computed(function(key, value) {
+ if (value !== undefined) { return value; }
+
+ var templateName = get(this, 'templateName'),
+ template = this.templateForName(templateName, 'template');
+
+ return template || get(this, 'defaultTemplate');
+ }).property('templateName').cacheable(),
+
+ /**
+ The controller managing this view. If this property is set, it will be
+ made available for use by the template.
+
+ @type Object
+ */
+ controller: Ember.computed(function(key, value) {
+ var parentView;
+
+ if (arguments.length === 2) {
+ return value;
+ } else {
+ parentView = get(this, 'parentView');
+ return parentView ? get(parentView, 'controller') : null;
+ }
+ }).property().cacheable(),
+
+ /**
+ A view may contain a layout. A layout is a regular template but
+ supersedes the `template` property during rendering. It is the
+ responsibility of the layout template to retrieve the `template`
+ property from the view (or alternatively, call `Handlebars.helpers.yield`,
+ `{{yield}}`) to render it in the correct location.
+
+ This is useful for a view that has a shared wrapper, but which delegates
+ the rendering of the contents of the wrapper to the `template` property
+ on a subclass.
+
+ @field
+ @type Function
+ */
+ layout: Ember.computed(function(key, value) {
+ if (arguments.length === 2) { return value; }
+
+ var layoutName = get(this, 'layoutName'),
+ layout = this.templateForName(layoutName, 'layout');
+
+ return layout || get(this, 'defaultLayout');
+ }).property('layoutName').cacheable(),
+
+ templateForName: function(name, type) {
+ if (!name) { return; }
+
+ var templates = get(this, 'templates'),
+ template = get(templates, name);
+
+ if (!template) {
+ throw new Ember.Error(fmt('%@ - Unable to find %@ "%@".', [this, type, name]));
+ }
+
+ return template;
+ },
+
+ /**
+ The object from which templates should access properties.
+
+ This object will be passed to the template function each time the render
+ method is called, but it is up to the individual function to decide what
+ to do with it.
+
+ By default, this will be the view itself.
+
+ @type Object
+ */
+ context: Ember.computed(function(key, value) {
+ if (arguments.length === 2) {
+ set(this, '_context', value);
+ return value;
+ } else {
+ return get(this, '_context');
+ }
+ }).cacheable(),
+
+ /**
+ @private
+
+ Private copy of the view's template context. This can be set directly
+ by Handlebars without triggering the observer that causes the view
+ to be re-rendered.
+
+ The context of a view is looked up as follows:
+
+ 1. Specified controller
+ 2. Supplied context (usually by Handlebars)
+ 3. `parentView`'s context (for a child of a ContainerView)
+
+ The code in Handlebars that overrides the `_context` property first
+ checks to see whether the view has a specified controller. This is
+ something of a hack and should be revisited.
+ */
+ _context: Ember.computed(function(key, value) {
+ var parentView, controller, context;
+
+ if (arguments.length === 2) {
+ return value;
+ }
+
+ if (VIEW_PRESERVES_CONTEXT) {
+ if (controller = get(this, 'controller')) {
+ return controller;
+ }
+
+ parentView = get(this, '_parentView');
+ if (parentView) {
+ return get(parentView, '_context');
+ }
+ }
+
+ return this;
+ }).cacheable(),
+
+ /**
+ If a value that affects template rendering changes, the view should be
+ re-rendered to reflect the new value.
+
+ @private
+ */
+ _displayPropertyDidChange: Ember.observer(function() {
+ this.rerender();
+ }, 'context', 'controller'),
+
+ /**
+ If the view is currently inserted into the DOM of a parent view, this
+ property will point to the parent of the view.
+
+ @type Ember.View
+ @default null
+ */
+ parentView: Ember.computed(function() {
+ var parent = get(this, '_parentView');
+
+ if (parent && parent.isVirtual) {
+ return get(parent, 'parentView');
+ } else {
+ return parent;
+ }
+ }).property('_parentView').volatile(),
+
+ _parentView: null,
+
+ // return the current view, not including virtual views
+ concreteView: Ember.computed(function() {
+ if (!this.isVirtual) { return this; }
+ else { return get(this, 'parentView'); }
+ }).property('_parentView').volatile(),
+
+ /**
+ If false, the view will appear hidden in DOM.
+
+ @type Boolean
+ @default null
+ */
+ isVisible: true,
+
+ /**
+ Array of child views. You should never edit this array directly.
+ Instead, use appendChild and removeFromParent.
+
+ @private
+ @type Array
+ @default []
+ */
+ childViews: childViewsProperty,
+
+ _childViews: [],
+
+ /**
+ When it's a virtual view, we need to notify the parent that their
+ childViews will change.
+ */
+ _childViewsWillChange: Ember.beforeObserver(function() {
+ if (this.isVirtual) {
+ var parentView = get(this, 'parentView');
+ if (parentView) { Ember.propertyWillChange(parentView, 'childViews'); }
+ }
+ }, 'childViews'),
+
+ /**
+ When it's a virtual view, we need to notify the parent that their
+ childViews did change.
+ */
+ _childViewsDidChange: Ember.observer(function() {
+ if (this.isVirtual) {
+ var parentView = get(this, 'parentView');
+ if (parentView) { Ember.propertyDidChange(parentView, 'childViews'); }
+ }
+ }, 'childViews'),
+
+ /**
+ Return the nearest ancestor that is an instance of the provided
+ class.
+
+ @param {Class} klass Subclass of Ember.View (or Ember.View itself)
+ @returns Ember.View
+ */
+ nearestInstanceOf: function(klass) {
+ var view = get(this, 'parentView');
+
+ while (view) {
+ if(view instanceof klass) { return view; }
+ view = get(view, 'parentView');
+ }
+ },
+
+ /**
+ Return the nearest ancestor that has a given property.
+
+ @param {String} property A property name
+ @returns Ember.View
+ */
+ nearestWithProperty: function(property) {
+ var view = get(this, 'parentView');
+
+ while (view) {
+ if (property in view) { return view; }
+ view = get(view, 'parentView');
+ }
+ },
+
+ /**
+ Return the nearest ancestor whose parent is an instance of
+ `klass`.
+
+ @param {Class} klass Subclass of Ember.View (or Ember.View itself)
+ @returns Ember.View
+ */
+ nearestChildOf: function(klass) {
+ var view = get(this, 'parentView');
+
+ while (view) {
+ if(get(view, 'parentView') instanceof klass) { return view; }
+ view = get(view, 'parentView');
+ }
+ },
+
+ /**
+ Return the nearest ancestor that is an Ember.CollectionView
+
+ @returns Ember.CollectionView
+ */
+ collectionView: Ember.computed(function() {
+ return this.nearestInstanceOf(Ember.CollectionView);
+ }).cacheable(),
+
+ /**
+ Return the nearest ancestor that is a direct child of
+ an Ember.CollectionView
+
+ @returns Ember.View
+ */
+ itemView: Ember.computed(function() {
+ return this.nearestChildOf(Ember.CollectionView);
+ }).cacheable(),
+
+ /**
+ Return the nearest ancestor that has the property
+ `content`.
+
+ @returns Ember.View
+ */
+ contentView: Ember.computed(function() {
+ return this.nearestWithProperty('content');
+ }).cacheable(),
+
+ /**
+ @private
+
+ When the parent view changes, recursively invalidate
+ collectionView, itemView, and contentView
+ */
+ _parentViewDidChange: Ember.observer(function() {
+ if (this.isDestroying) { return; }
+
+ this.invokeRecursively(function(view) {
+ view.propertyDidChange('collectionView');
+ view.propertyDidChange('itemView');
+ view.propertyDidChange('contentView');
+ });
+
+ if (get(this, 'parentView.controller') && !get(this, 'controller')) {
+ this.notifyPropertyChange('controller');
+ }
+ }, '_parentView'),
+
+ _controllerDidChange: Ember.observer(function() {
+ if (this.isDestroying) { return; }
+
+ this.forEachChildView(function(view) {
+ view.propertyDidChange('controller');
+ });
+ }, 'controller'),
+
+ cloneKeywords: function() {
+ var templateData = get(this, 'templateData');
+
+ var keywords = templateData ? Ember.copy(templateData.keywords) : {};
+ set(keywords, 'view', get(this, 'concreteView'));
+ set(keywords, 'controller', get(this, 'controller'));
+
+ return keywords;
+ },
+
+ /**
+ Called on your view when it should push strings of HTML into a
+ Ember.RenderBuffer. Most users will want to override the `template`
+ or `templateName` properties instead of this method.
+
+ By default, Ember.View will look for a function in the `template`
+ property and invoke it with the value of `context`. The value of
+ `context` will be the view's controller unless you override it.
+
+ @param {Ember.RenderBuffer} buffer The render buffer
+ */
+ render: function(buffer) {
+ // If this view has a layout, it is the responsibility of the
+ // the layout to render the view's template. Otherwise, render the template
+ // directly.
+ var template = get(this, 'layout') || get(this, 'template');
+
+ if (template) {
+ var context = get(this, '_context');
+ var keywords = this.cloneKeywords();
+
+ var data = {
+ view: this,
+ buffer: buffer,
+ isRenderData: true,
+ keywords: keywords
+ };
+
+ // Invoke the template with the provided template context, which
+ // is the view by default. A hash of data is also passed that provides
+ // the template with access to the view and render buffer.
+
+ Ember.assert('template must be a function. Did you mean to call Ember.Handlebars.compile("...") or specify templateName instead?', typeof template === 'function');
+ // The template should write directly to the render buffer instead
+ // of returning a string.
+ var output = template(context, { data: data });
+
+ // If the template returned a string instead of writing to the buffer,
+ // push the string onto the buffer.
+ if (output !== undefined) { buffer.push(output); }
+ }
+ },
+
+ invokeForState: function(name) {
+ var stateName = this.state, args, fn;
+
+ // try to find the function for the state in the cache
+ if (fn = invokeForState[stateName][name]) {
+ args = a_slice.call(arguments);
+ args[0] = this;
+
+ return fn.apply(this, args);
+ }
+
+ // otherwise, find and cache the function for this state
+ var parent = this, states = parent.states, state;
+
+ while (states) {
+ state = states[stateName];
+
+ while (state) {
+ fn = state[name];
+
+ if (fn) {
+ invokeForState[stateName][name] = fn;
+
+ args = a_slice.call(arguments, 1);
+ args.unshift(this);
+
+ return fn.apply(this, args);
+ }
+
+ state = state.parentState;
+ }
+
+ states = states.parent;
+ }
+ },
+
+ /**
+ Renders the view again. This will work regardless of whether the
+ view is already in the DOM or not. If the view is in the DOM, the
+ rendering process will be deferred to give bindings a chance
+ to synchronize.
+
+ If children were added during the rendering process using `appendChild`,
+ `rerender` will remove them, because they will be added again
+ if needed by the next `render`.
+
+ In general, if the display of your view changes, you should modify
+ the DOM element directly instead of manually calling `rerender`, which can
+ be slow.
+ */
+ rerender: function() {
+ return this.invokeForState('rerender');
+ },
+
+ clearRenderedChildren: function() {
+ var lengthBefore = this.lengthBeforeRender,
+ lengthAfter = this.lengthAfterRender;
+
+ // If there were child views created during the last call to render(),
+ // remove them under the assumption that they will be re-created when
+ // we re-render.
+
+ // VIEW-TODO: Unit test this path.
+ var childViews = this._childViews;
+ for (var i=lengthAfter-1; i>=lengthBefore; i--) {
+ if (childViews[i]) { childViews[i].destroy(); }
+ }
+ },
+
+ /**
+ @private
+
+ Iterates over the view's `classNameBindings` array, inserts the value
+ of the specified property into the `classNames` array, then creates an
+ observer to update the view's element if the bound property ever changes
+ in the future.
+ */
+ _applyClassNameBindings: function() {
+ var classBindings = get(this, 'classNameBindings'),
+ classNames = get(this, 'classNames'),
+ elem, newClass, dasherizedClass;
+
+ if (!classBindings) { return; }
+
+ // Loop through all of the configured bindings. These will be either
+ // property names ('isUrgent') or property paths relative to the view
+ // ('content.isUrgent')
+ a_forEach(classBindings, function(binding) {
+
+ // Variable in which the old class value is saved. The observer function
+ // closes over this variable, so it knows which string to remove when
+ // the property changes.
+ var oldClass;
+
+ // Set up an observer on the context. If the property changes, toggle the
+ // class name.
+ var observer = function() {
+ // Get the current value of the property
+ newClass = this._classStringForProperty(binding);
+ elem = this.$();
+
+ // If we had previously added a class to the element, remove it.
+ if (oldClass) {
+ elem.removeClass(oldClass);
+ // Also remove from classNames so that if the view gets rerendered,
+ // the class doesn't get added back to the DOM.
+ classNames.removeObject(oldClass);
+ }
+
+ // If necessary, add a new class. Make sure we keep track of it so
+ // it can be removed in the future.
+ if (newClass) {
+ elem.addClass(newClass);
+ oldClass = newClass;
+ } else {
+ oldClass = null;
+ }
+ };
+
+ // Get the class name for the property at its current value
+ dasherizedClass = this._classStringForProperty(binding);
+
+ if (dasherizedClass) {
+ // Ensure that it gets into the classNames array
+ // so it is displayed when we render.
+ classNames.push(dasherizedClass);
+
+ // Save a reference to the class name so we can remove it
+ // if the observer fires. Remember that this variable has
+ // been closed over by the observer.
+ oldClass = dasherizedClass;
+ }
+
+ // Extract just the property name from bindings like 'foo:bar'
+ var parsedPath = Ember.View._parsePropertyPath(binding);
+ addObserver(this, parsedPath.path, observer);
+ }, this);
+ },
+
+ /**
+ Iterates through the view's attribute bindings, sets up observers for each,
+ then applies the current value of the attributes to the passed render buffer.
+
+ @param {Ember.RenderBuffer} buffer
+ */
+ _applyAttributeBindings: function(buffer) {
+ var attributeBindings = get(this, 'attributeBindings'),
+ attributeValue, elem, type;
+
+ if (!attributeBindings) { return; }
+
+ a_forEach(attributeBindings, function(binding) {
+ var split = binding.split(':'),
+ property = split[0],
+ attributeName = split[1] || property;
+
+ // Create an observer to add/remove/change the attribute if the
+ // JavaScript property changes.
+ var observer = function() {
+ elem = this.$();
+ if (!elem) { return; }
+
+ attributeValue = get(this, property);
+
+ Ember.View.applyAttributeBindings(elem, attributeName, attributeValue);
+ };
+
+ addObserver(this, property, observer);
+
+ // Determine the current value and add it to the render buffer
+ // if necessary.
+ attributeValue = get(this, property);
+ Ember.View.applyAttributeBindings(buffer, attributeName, attributeValue);
+ }, this);
+ },
+
+ /**
+ @private
+
+ Given a property name, returns a dasherized version of that
+ property name if the property evaluates to a non-falsy value.
+
+ For example, if the view has property `isUrgent` that evaluates to true,
+ passing `isUrgent` to this method will return `"is-urgent"`.
+ */
+ _classStringForProperty: function(property) {
+ var parsedPath = Ember.View._parsePropertyPath(property);
+ var path = parsedPath.path;
+
+ var val = get(this, path);
+ if (val === undefined && Ember.isGlobalPath(path)) {
+ val = get(window, path);
+ }
+
+ return Ember.View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);
+ },
+
+ // ..........................................................
+ // ELEMENT SUPPORT
+ //
+
+ /**
+ Returns the current DOM element for the view.
+
+ @field
+ @type DOMElement
+ */
+ element: Ember.computed(function(key, value) {
+ if (value !== undefined) {
+ return this.invokeForState('setElement', value);
+ } else {
+ return this.invokeForState('getElement');
+ }
+ }).property('_parentView').cacheable(),
+
+ /**
+ Returns a jQuery object for this view's element. If you pass in a selector
+ string, this method will return a jQuery object, using the current element
+ as its buffer.
+
+ For example, calling `view.$('li')` will return a jQuery object containing
+ all of the `li` elements inside the DOM element of this view.
+
+ @param {String} [selector] a jQuery-compatible selector string
+ @returns {Ember.CoreQuery} the CoreQuery object for the DOM node
+ */
+ $: function(sel) {
+ return this.invokeForState('$', sel);
+ },
+
+ /** @private */
+ mutateChildViews: function(callback) {
+ var childViews = this._childViews,
+ idx = childViews.length,
+ view;
+
+ while(--idx >= 0) {
+ view = childViews[idx];
+ callback.call(this, view, idx);
+ }
+
+ return this;
+ },
+
+ /** @private */
+ forEachChildView: function(callback) {
+ var childViews = this._childViews;
+
+ if (!childViews) { return this; }
+
+ var len = childViews.length,
+ view, idx;
+
+ for(idx = 0; idx < len; idx++) {
+ view = childViews[idx];
+ callback.call(this, view);
+ }
+
+ return this;
+ },
+
+ /**
+ Appends the view's element to the specified parent element.
+
+ If the view does not have an HTML representation yet, `createElement()`
+ will be called automatically.
+
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the given element until all bindings have
+ finished synchronizing.
+
+ This is not typically a function that you will need to call directly
+ when building your application. You might consider using Ember.ContainerView
+ instead. If you do need to use appendTo, be sure that the target element you
+ are providing is associated with an Ember.Application and does not have an
+ ancestor element that is associated with an Ember view.
+
+ @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
+ @returns {Ember.View} receiver
+ */
+ appendTo: function(target) {
+ // Schedule the DOM element to be created and appended to the given
+ // element after bindings have synchronized.
+ this._insertElementLater(function() {
+ Ember.assert("You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));
+ this.$().appendTo(target);
+ });
+
+ return this;
+ },
+
+ /**
+ Replaces the content of the specified parent element with this view's element.
+ If the view does not have an HTML representation yet, `createElement()`
+ will be called automatically.
+
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the given element until all bindings have
+ finished synchronizing
+
+ @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
+ @returns {Ember.View} received
+ */
+ replaceIn: function(target) {
+ Ember.assert("You cannot replace an existing Ember.View. Consider using Ember.ContainerView instead.", !Ember.$(target).is('.ember-view') && !Ember.$(target).parents().is('.ember-view'));
+
+ this._insertElementLater(function() {
+ Ember.$(target).empty();
+ this.$().appendTo(target);
+ });
+
+ return this;
+ },
+
+ /**
+ @private
+
+ Schedules a DOM operation to occur during the next render phase. This
+ ensures that all bindings have finished synchronizing before the view is
+ rendered.
+
+ To use, pass a function that performs a DOM operation..
+
+ Before your function is called, this view and all child views will receive
+ the `willInsertElement` event. After your function is invoked, this view
+ and all of its child views will receive the `didInsertElement` event.
+
+ view._insertElementLater(function() {
+ this.createElement();
+ this.$().appendTo('body');
+ });
+
+ @param {Function} fn the function that inserts the element into the DOM
+ */
+ _insertElementLater: function(fn) {
+ this._lastInsert = Ember.guidFor(fn);
+ Ember.run.schedule('render', this, this.invokeForState, 'insertElement', fn);
+ },
+
+ /**
+ Appends the view's element to the document body. If the view does
+ not have an HTML representation yet, `createElement()` will be called
+ automatically.
+
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the document body until all bindings have
+ finished synchronizing.
+
+ @returns {Ember.View} receiver
+ */
+ append: function() {
+ return this.appendTo(document.body);
+ },
+
+ /**
+ Removes the view's element from the element to which it is attached.
+
+ @returns {Ember.View} receiver
+ */
+ remove: function() {
+ // What we should really do here is wait until the end of the run loop
+ // to determine if the element has been re-appended to a different
+ // element.
+ // In the interim, we will just re-render if that happens. It is more
+ // important than elements get garbage collected.
+ this.destroyElement();
+ this.invokeRecursively(function(view) {
+ view.clearRenderedChildren();
+ });
+ },
+
+ /**
+ The ID to use when trying to locate the element in the DOM. If you do not
+ set the elementId explicitly, then the view's GUID will be used instead.
+ This ID must be set at the time the view is created.
+
+ @type String
+ @readOnly
+ */
+ elementId: Ember.computed(function(key, value) {
+ return value !== undefined ? value : Ember.guidFor(this);
+ }).cacheable(),
+
+ /**
+ @private
+
+ TODO: Perhaps this should be removed from the production build somehow.
+ */
+ _elementIdDidChange: Ember.beforeObserver(function() {
+ throw "Changing a view's elementId after creation is not allowed.";
+ }, 'elementId'),
+
+ /**
+ Attempts to discover the element in the parent element. The default
+ implementation looks for an element with an ID of elementId (or the view's
+ guid if elementId is null). You can override this method to provide your
+ own form of lookup. For example, if you want to discover your element
+ using a CSS class name instead of an ID.
+
+ @param {DOMElement} parentElement The parent's DOM element
+ @returns {DOMElement} The discovered element
+ */
+ findElementInParentElement: function(parentElem) {
+ var id = "#" + get(this, 'elementId');
+ return Ember.$(id)[0] || Ember.$(id, parentElem)[0];
+ },
+
+ /**
+ Creates a new renderBuffer with the passed tagName. You can override this
+ method to provide further customization to the buffer if needed. Normally
+ you will not need to call or override this method.
+
+ @returns {Ember.RenderBuffer}
+ */
+ renderBuffer: function(tagName) {
+ tagName = tagName || get(this, 'tagName');
+
+ // Explicitly check for null or undefined, as tagName
+ // may be an empty string, which would evaluate to false.
+ if (tagName === null || tagName === undefined) {
+ tagName = 'div';
+ }
+
+ return Ember.RenderBuffer(tagName);
+ },
+
+ /**
+ Creates a DOM representation of the view and all of its
+ child views by recursively calling the `render()` method.
+
+ After the element has been created, `didInsertElement` will
+ be called on this view and all of its child views.
+
+ @returns {Ember.View} receiver
+ */
+ createElement: function() {
+ if (get(this, 'element')) { return this; }
+
+ var buffer = this.renderToBuffer();
+ set(this, 'element', buffer.element());
+
+ return this;
+ },
+
+ /**
+ Called when a view is going to insert an element into the DOM.
+ */
+ willInsertElement: Ember.K,
+
+ /**
+ Called when the element of the view has been inserted into the DOM.
+ Override this function to do any set up that requires an element in the
+ document body.
+ */
+ didInsertElement: Ember.K,
+
+ /**
+ Called when the view is about to rerender, but before anything has
+ been torn down. This is a good opportunity to tear down any manual
+ observers you have installed based on the DOM state
+ */
+ willRerender: Ember.K,
+
+ /**
+ Run this callback on the current view and recursively on child views.
+
+ @private
+ */
+ invokeRecursively: function(fn) {
+ fn.call(this, this);
+
+ this.forEachChildView(function(view) {
+ view.invokeRecursively(fn);
+ });
+ },
+
+ /**
+ Invalidates the cache for a property on all child views.
+ */
+ invalidateRecursively: function(key) {
+ this.forEachChildView(function(view) {
+ view.propertyDidChange(key);
+ });
+ },
+
+ /**
+ @private
+
+ Invokes the receiver's willInsertElement() method if it exists and then
+ invokes the same on all child views.
+
+ NOTE: In some cases this was called when the element existed. This no longer
+ works so we let people know. We can remove this warning code later.
+ */
+ _notifyWillInsertElement: function() {
+ this.invokeRecursively(function(view) {
+ view.trigger('willInsertElement');
+ });
+ },
+
+ /**
+ @private
+
+ Invokes the receiver's didInsertElement() method if it exists and then
+ invokes the same on all child views.
+ */
+ _notifyDidInsertElement: function() {
+ this.invokeRecursively(function(view) {
+ view.trigger('didInsertElement');
+ });
+ },
+
+ /**
+ @private
+
+ Invokes the receiver's willRerender() method if it exists and then
+ invokes the same on all child views.
+ */
+ _notifyWillRerender: function() {
+ this.invokeRecursively(function(view) {
+ view.trigger('willRerender');
+ });
+ },
+
+ /**
+ Destroys any existing element along with the element for any child views
+ as well. If the view does not currently have a element, then this method
+ will do nothing.
+
+ If you implement willDestroyElement() on your view, then this method will
+ be invoked on your view before your element is destroyed to give you a
+ chance to clean up any event handlers, etc.
+
+ If you write a willDestroyElement() handler, you can assume that your
+ didInsertElement() handler was called earlier for the same element.
+
+ Normally you will not call or override this method yourself, but you may
+ want to implement the above callbacks when it is run.
+
+ @returns {Ember.View} receiver
+ */
+ destroyElement: function() {
+ return this.invokeForState('destroyElement');
+ },
+
+ /**
+ Called when the element of the view is going to be destroyed. Override
+ this function to do any teardown that requires an element, like removing
+ event listeners.
+ */
+ willDestroyElement: function() {},
+
+ /**
+ @private
+
+ Invokes the `willDestroyElement` callback on the view and child views.
+ */
+ _notifyWillDestroyElement: function() {
+ this.invokeRecursively(function(view) {
+ view.trigger('willDestroyElement');
+ });
+ },
+
+ /** @private (nodoc) */
+ _elementWillChange: Ember.beforeObserver(function() {
+ this.forEachChildView(function(view) {
+ Ember.propertyWillChange(view, 'element');
+ });
+ }, 'element'),
+
+ /**
+ @private
+
+ If this view's element changes, we need to invalidate the caches of our
+ child views so that we do not retain references to DOM elements that are
+ no longer needed.
+
+ @observes element
+ */
+ _elementDidChange: Ember.observer(function() {
+ this.forEachChildView(function(view) {
+ Ember.propertyDidChange(view, 'element');
+ });
+ }, 'element'),
+
+ /**
+ Called when the parentView property has changed.
+
+ @function
+ */
+ parentViewDidChange: Ember.K,
+
+ /**
+ @private
+
+ Invoked by the view system when this view needs to produce an HTML
+ representation. This method will create a new render buffer, if needed,
+ then apply any default attributes, such as class names and visibility.
+ Finally, the `render()` method is invoked, which is responsible for
+ doing the bulk of the rendering.
+
+ You should not need to override this method; instead, implement the
+ `template` property, or if you need more control, override the `render`
+ method.
+
+ @param {Ember.RenderBuffer} buffer the render buffer. If no buffer is
+ passed, a default buffer, using the current view's `tagName`, will
+ be used.
+ */
+ renderToBuffer: function(parentBuffer, bufferOperation) {
+ var buffer;
+
+ Ember.run.sync();
+
+ // Determine where in the parent buffer to start the new buffer.
+ // By default, a new buffer will be appended to the parent buffer.
+ // The buffer operation may be changed if the child views array is
+ // mutated by Ember.ContainerView.
+ bufferOperation = bufferOperation || 'begin';
+
+ // If this is the top-most view, start a new buffer. Otherwise,
+ // create a new buffer relative to the original using the
+ // provided buffer operation (for example, `insertAfter` will
+ // insert a new buffer after the "parent buffer").
+ if (parentBuffer) {
+ var tagName = get(this, 'tagName');
+ if (tagName === null || tagName === undefined) {
+ tagName = 'div';
+ }
+
+ buffer = parentBuffer[bufferOperation](tagName);
+ } else {
+ buffer = this.renderBuffer();
+ }
+
+ this.buffer = buffer;
+ this.transitionTo('inBuffer', false);
+
+ this.lengthBeforeRender = this._childViews.length;
+
+ this.beforeRender(buffer);
+ this.render(buffer);
+ this.afterRender(buffer);
+
+ this.lengthAfterRender = this._childViews.length;
+
+ return buffer;
+ },
+
+ beforeRender: function(buffer) {
+ this.applyAttributesToBuffer(buffer);
+ },
+
+ afterRender: Ember.K,
+
+ /**
+ @private
+ */
+ applyAttributesToBuffer: function(buffer) {
+ // Creates observers for all registered class name and attribute bindings,
+ // then adds them to the element.
+ this._applyClassNameBindings();
+
+ // Pass the render buffer so the method can apply attributes directly.
+ // This isn't needed for class name bindings because they use the
+ // existing classNames infrastructure.
+ this._applyAttributeBindings(buffer);
+
+
+ a_forEach(get(this, 'classNames'), function(name){ buffer.addClass(name); });
+ buffer.id(get(this, 'elementId'));
+
+ var role = get(this, 'ariaRole');
+ if (role) {
+ buffer.attr('role', role);
+ }
+
+ if (get(this, 'isVisible') === false) {
+ buffer.style('display', 'none');
+ }
+ },
+
+ // ..........................................................
+ // STANDARD RENDER PROPERTIES
+ //
+
+ /**
+ Tag name for the view's outer element. The tag name is only used when
+ an element is first created. If you change the tagName for an element, you
+ must destroy and recreate the view element.
+
+ By default, the render buffer will use a `<div>` tag for views.
+
+ @type String
+ @default null
+ */
+
+ // We leave this null by default so we can tell the difference between
+ // the default case and a user-specified tag.
+ tagName: null,
+
+ /**
+ The WAI-ARIA role of the control represented by this view. For example, a
+ button may have a role of type 'button', or a pane may have a role of
+ type 'alertdialog'. This property is used by assistive software to help
+ visually challenged users navigate rich web applications.
+
+ The full list of valid WAI-ARIA roles is available at:
+ http://www.w3.org/TR/wai-aria/roles#roles_categorization
+
+ @type String
+ @default null
+ */
+ ariaRole: null,
+
+ /**
+ Standard CSS class names to apply to the view's outer element. This
+ property automatically inherits any class names defined by the view's
+ superclasses as well.
+
+ @type Array
+ @default ['ember-view']
+ */
+ classNames: ['ember-view'],
+
+ /**
+ A list of properties of the view to apply as class names. If the property
+ is a string value, the value of that string will be applied as a class
+ name.
+
+ // Applies the 'high' class to the view element
+ Ember.View.create({
+ classNameBindings: ['priority']
+ priority: 'high'
+ });
+
+ If the value of the property is a Boolean, the name of that property is
+ added as a dasherized class name.
+
+ // Applies the 'is-urgent' class to the view element
+ Ember.View.create({
+ classNameBindings: ['isUrgent']
+ isUrgent: true
+ });
+
+ If you would prefer to use a custom value instead of the dasherized
+ property name, you can pass a binding like this:
+
+ // Applies the 'urgent' class to the view element
+ Ember.View.create({
+ classNameBindings: ['isUrgent:urgent']
+ isUrgent: true
+ });
+
+ This list of properties is inherited from the view's superclasses as well.
+
+ @type Array
+ @default []
+ */
+ classNameBindings: [],
+
+ /**
+ A list of properties of the view to apply as attributes. If the property is
+ a string value, the value of that string will be applied as the attribute.
+
+ // Applies the type attribute to the element
+ // with the value "button", like <div type="button">
+ Ember.View.create({
+ attributeBindings: ['type'],
+ type: 'button'
+ });
+
+ If the value of the property is a Boolean, the name of that property is
+ added as an attribute.
+
+ // Renders something like <div enabled="enabled">
+ Ember.View.create({
+ attributeBindings: ['enabled'],
+ enabled: true
+ });
+ */
+ attributeBindings: [],
+
+ state: 'preRender',
+
+ // .......................................................
+ // CORE DISPLAY METHODS
+ //
+
+ /**
+ @private
+
+ Setup a view, but do not finish waking it up.
+ - configure childViews
+ - register the view with the global views hash, which is used for event
+ dispatch
+ */
+ init: function() {
+ this._super();
+
+ // Register the view for event handling. This hash is used by
+ // Ember.EventDispatcher to dispatch incoming events.
+ if (!this.isVirtual) Ember.View.views[get(this, 'elementId')] = this;
+
+ // setup child views. be sure to clone the child views array first
+ this._childViews = this._childViews.slice();
+
+ Ember.assert("Only arrays are allowed for 'classNameBindings'", Ember.typeOf(this.classNameBindings) === 'array');
+ this.classNameBindings = Ember.A(this.classNameBindings.slice());
+
+ Ember.assert("Only arrays are allowed for 'classNames'", Ember.typeOf(this.classNames) === 'array');
+ this.classNames = Ember.A(this.classNames.slice());
+
+ var viewController = get(this, 'viewController');
+ if (viewController) {
+ viewController = get(viewController);
+ if (viewController) {
+ set(viewController, 'view', this);
+ }
+ }
+ },
+
+ appendChild: function(view, options) {
+ return this.invokeForState('appendChild', view, options);
+ },
+
+ /**
+ Removes the child view from the parent view.
+
+ @param {Ember.View} view
+ @returns {Ember.View} receiver
+ */
+ removeChild: function(view) {
+ // If we're destroying, the entire subtree will be
+ // freed, and the DOM will be handled separately,
+ // so no need to mess with childViews.
+ if (this.isDestroying) { return; }
+
+ // update parent node
+ set(view, '_parentView', null);
+
+ // remove view from childViews array.
+ var childViews = this._childViews;
+
+ Ember.EnumerableUtils.removeObject(childViews, view);
+
+ this.propertyDidChange('childViews'); // HUH?! what happened to will change?
+
+ return this;
+ },
+
+ /**
+ Removes all children from the parentView.
+
+ @returns {Ember.View} receiver
+ */
+ removeAllChildren: function() {
+ return this.mutateChildViews(function(view) {
+ this.removeChild(view);
+ });
+ },
+
+ destroyAllChildren: function() {
+ return this.mutateChildViews(function(view) {
+ view.destroy();
+ });
+ },
+
+ /**
+ Removes the view from its parentView, if one is found. Otherwise
+ does nothing.
+
+ @returns {Ember.View} receiver
+ */
+ removeFromParent: function() {
+ var parent = get(this, '_parentView');
+
+ // Remove DOM element from parent
+ this.remove();
+
+ if (parent) { parent.removeChild(this); }
+ return this;
+ },
+
+ /**
+ You must call `destroy` on a view to destroy the view (and all of its
+ child views). This will remove the view from any parent node, then make
+ sure that the DOM element managed by the view can be released by the
+ memory manager.
+ */
+ willDestroy: function() {
+ // calling this._super() will nuke computed properties and observers,
+ // so collect any information we need before calling super.
+ var childViews = this._childViews,
+ parent = get(this, '_parentView'),
+ childLen;
+
+ // destroy the element -- this will avoid each child view destroying
+ // the element over and over again...
+ if (!this.removedFromDOM) { this.destroyElement(); }
+
+ // remove from non-virtual parent view if viewName was specified
+ if (this.viewName) {
+ var nonVirtualParentView = get(this, 'parentView');
+ if (nonVirtualParentView) {
+ set(nonVirtualParentView, this.viewName, null);
+ }
+ }
+
+ // remove from parent if found. Don't call removeFromParent,
+ // as removeFromParent will try to remove the element from
+ // the DOM again.
+ if (parent) { parent.removeChild(this); }
+
+ this.state = 'destroyed';
+
+ childLen = childViews.length;
+ for (var i=childLen-1; i>=0; i--) {
+ childViews[i].removedFromDOM = true;
+ childViews[i].destroy();
+ }
+
+ // next remove view from global hash
+ if (!this.isVirtual) delete Ember.View.views[get(this, 'elementId')];
+ },
+
+ /**
+ Instantiates a view to be added to the childViews array during view
+ initialization. You generally will not call this method directly unless
+ you are overriding createChildViews(). Note that this method will
+ automatically configure the correct settings on the new view instance to
+ act as a child of the parent.
+
+ @param {Class} viewClass
+ @param {Hash} [attrs] Attributes to add
+ @returns {Ember.View} new instance
+ @test in createChildViews
+ */
+ createChildView: function(view, attrs) {
+ if (Ember.View.detect(view)) {
+ attrs = attrs || {};
+ attrs._parentView = this;
+ attrs.templateData = attrs.templateData || get(this, 'templateData');
+
+ view = view.create(attrs);
+
+ // don't set the property on a virtual view, as they are invisible to
+ // consumers of the view API
+ if (view.viewName) { set(get(this, 'concreteView'), view.viewName, view); }
+ } else {
+ Ember.assert('You must pass instance or subclass of View', view instanceof Ember.View);
+ Ember.assert("You can only pass attributes when a class is provided", !attrs);
+
+ if (!get(view, 'templateData')) {
+ set(view, 'templateData', get(this, 'templateData'));
+ }
+
+ set(view, '_parentView', this);
+ }
+
+ return view;
+ },
+
+ becameVisible: Ember.K,
+ becameHidden: Ember.K,
+
+ /**
+ @private
+
+ When the view's `isVisible` property changes, toggle the visibility
+ element of the actual DOM element.
+ */
+ _isVisibleDidChange: Ember.observer(function() {
+ var $el = this.$();
+ if (!$el) { return; }
+
+ var isVisible = get(this, 'isVisible');
+
+ $el.toggle(isVisible);
+
+ if (this._isAncestorHidden()) { return; }
+
+ if (isVisible) {
+ this._notifyBecameVisible();
+ } else {
+ this._notifyBecameHidden();
+ }
+ }, 'isVisible'),
+
+ _notifyBecameVisible: function() {
+ this.trigger('becameVisible');
+
+ this.forEachChildView(function(view) {
+ var isVisible = get(view, 'isVisible');
+
+ if (isVisible || isVisible === null) {
+ view._notifyBecameVisible();
+ }
+ });
+ },
+
+ _notifyBecameHidden: function() {
+ this.trigger('becameHidden');
+ this.forEachChildView(function(view) {
+ var isVisible = get(view, 'isVisible');
+
+ if (isVisible || isVisible === null) {
+ view._notifyBecameHidden();
+ }
+ });
+ },
+
+ _isAncestorHidden: function() {
+ var parent = get(this, 'parentView');
+
+ while (parent) {
+ if (get(parent, 'isVisible') === false) { return true; }
+
+ parent = get(parent, 'parentView');
+ }
+
+ return false;
+ },
+
+ clearBuffer: function() {
+ this.invokeRecursively(function(view) {
+ this.buffer = null;
+ });
+ },
+
+ transitionTo: function(state, children) {
+ this.state = state;
+
+ if (children !== false) {
+ this.forEachChildView(function(view) {
+ view.transitionTo(state);
+ });
+ }
+ },
+
+ /**
+ @private
+
+ Override the default event firing from Ember.Evented to
+ also call methods with the given name.
+ */
+ trigger: function(name) {
+ this._super.apply(this, arguments);
+ var method = this[name];
+ if (method) {
+ var args = [], i, l;
+ for (i = 1, l = arguments.length; i < l; i++) {
+ args.push(arguments[i]);
+ }
+ return method.apply(this, args);
+ }
+ },
+
+ has: function(name) {
+ return Ember.typeOf(this[name]) === 'function' || this._super(name);
+ },
+
+ // .......................................................
+ // EVENT HANDLING
+ //
+
+ /**
+ @private
+
+ Handle events from `Ember.EventDispatcher`
+ */
+ handleEvent: function(eventName, evt) {
+ return this.invokeForState('handleEvent', eventName, evt);
+ }
+
+});
+
+/**
+ Describe how the specified actions should behave in the various
+ states that a view can exist in. Possible states:
+
+ * preRender: when a view is first instantiated, and after its
+ element was destroyed, it is in the preRender state
+ * inBuffer: once a view has been rendered, but before it has
+ been inserted into the DOM, it is in the inBuffer state
+ * inDOM: once a view has been inserted into the DOM it is in
+ the inDOM state. A view spends the vast majority of its
+ existence in this state.
+ * destroyed: once a view has been destroyed (using the destroy
+ method), it is in this state. No further actions can be invoked
+ on a destroyed view.
+*/
+
+ // in the destroyed state, everything is illegal
+
+ // before rendering has begun, all legal manipulations are noops.
+
+ // inside the buffer, legal manipulations are done on the buffer
+
+ // once the view has been inserted into the DOM, legal manipulations
+ // are done on the DOM element.
+
+/** @private */
+var DOMManager = {
+ prepend: function(view, childView) {
+ childView._insertElementLater(function() {
+ var element = view.$();
+ element.prepend(childView.$());
+ });
+ },
+
+ after: function(view, nextView) {
+ nextView._insertElementLater(function() {
+ var element = view.$();
+ element.after(nextView.$());
+ });
+ },
+
+ replace: function(view) {
+ var element = get(view, 'element');
+
+ set(view, 'element', null);
+
+ view._insertElementLater(function() {
+ Ember.$(element).replaceWith(get(view, 'element'));
+ });
+ },
+
+ remove: function(view) {
+ var elem = get(view, 'element');
+
+ set(view, 'element', null);
+ view._lastInsert = null;
+
+ Ember.$(elem).remove();
+ },
+
+ empty: function(view) {
+ view.$().empty();
+ }
+};
+
+Ember.View.reopen({
+ states: Ember.View.states,
+ domManager: DOMManager
+});
+
+Ember.View.reopenClass({
+
+ /**
+ @private
+
+ Parse a path and return an object which holds the parsed properties.
+
+ For example a path like "content.isEnabled:enabled:disabled" wil return the
+ following object:
+
+ {
+ path: "content.isEnabled",
+ className: "enabled",
+ falsyClassName: "disabled",
+ classNames: ":enabled:disabled"
+ }
+
+ */
+ _parsePropertyPath: function(path) {
+ var split = path.split(/:/),
+ propertyPath = split[0],
+ classNames = "",
+ className,
+ falsyClassName;
+
+ // check if the property is defined as prop:class or prop:trueClass:falseClass
+ if (split.length > 1) {
+ className = split[1];
+ if (split.length === 3) { falsyClassName = split[2]; }
+
+ classNames = ':' + className;
+ if (falsyClassName) { classNames += ":" + falsyClassName; }
+ }
+
+ return {
+ path: propertyPath,
+ classNames: classNames,
+ className: (className === '') ? undefined : className,
+ falsyClassName: falsyClassName
+ };
+ },
+
+ /**
+ @private
+
+ Get the class name for a given value, based on the path, optional className
+ and optional falsyClassName.
+
+ - if the value is truthy and a className is defined, the className is returned
+ - if the value is true, the dasherized last part of the supplied path is returned
+ - if the value is false and a falsyClassName is supplied, the falsyClassName is returned
+ - if the value is truthy, the value is returned
+ - if none of the above rules apply, null is returned
+
+ */
+ _classStringForValue: function(path, val, className, falsyClassName) {
+ // If the value is truthy and we're using the colon syntax,
+ // we should return the className directly
+ if (!!val && className) {
+ return className;
+
+ // If value is a Boolean and true, return the dasherized property
+ // name.
+ } else if (val === true) {
+ // catch syntax like isEnabled::not-enabled
+ if (val === true && !className && falsyClassName) { return null; }
+
+ // Normalize property path to be suitable for use
+ // as a class name. For exaple, content.foo.barBaz
+ // becomes bar-baz.
+ var parts = path.split('.');
+ return Ember.String.dasherize(parts[parts.length-1]);
+
+ // If the value is false and a falsyClassName is specified, return it
+ } else if (val === false && falsyClassName) {
+ return falsyClassName;
+
+ // If the value is not false, undefined, or null, return the current
+ // value of the property.
+ } else if (val !== false && val !== undefined && val !== null) {
+ return val;
+
+ // Nothing to display. Return null so that the old class is removed
+ // but no new class is added.
+ } else {
+ return null;
+ }
+ }
+});
+
+// Create a global view hash.
+Ember.View.views = {};
+
+// If someone overrides the child views computed property when
+// defining their class, we want to be able to process the user's
+// supplied childViews and then restore the original computed property
+// at view initialization time. This happens in Ember.ContainerView's init
+// method.
+Ember.View.childViewsProperty = childViewsProperty;
+
+Ember.View.applyAttributeBindings = function(elem, name, value) {
+ var type = Ember.typeOf(value);
+ var currentValue = elem.attr(name);
+
+ // if this changes, also change the logic in ember-handlebars/lib/helpers/binding.js
+ if ((type === 'string' || (type === 'number' && !isNaN(value))) && value !== currentValue) {
+ elem.attr(name, value);
+ } else if (value && type === 'boolean') {
+ elem.attr(name, name);
+ } else if (!value) {
+ elem.removeAttr(name);
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+Ember.View.states = {
+ _default: {
+ // appendChild is only legal while rendering the buffer.
+ appendChild: function() {
+ throw "You can't use appendChild outside of the rendering process";
+ },
+
+ $: function() {
+ return undefined;
+ },
+
+ getElement: function() {
+ return null;
+ },
+
+ // Handle events from `Ember.EventDispatcher`
+ handleEvent: function() {
+ return true; // continue event propagation
+ },
+
+ destroyElement: function(view) {
+ set(view, 'element', null);
+ view._lastInsert = null;
+ return view;
+ }
+ }
+};
+
+Ember.View.reopen({
+ states: Ember.View.states
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+Ember.View.states.preRender = {
+ parentState: Ember.View.states._default,
+
+ // a view leaves the preRender state once its element has been
+ // created (createElement).
+ insertElement: function(view, fn) {
+ if (view._lastInsert !== Ember.guidFor(fn)){
+ return;
+ }
+ view.createElement();
+ view._notifyWillInsertElement();
+ // after createElement, the view will be in the hasElement state.
+ fn.call(view);
+ view.transitionTo('inDOM');
+ view._notifyDidInsertElement();
+ },
+
+ empty: Ember.K,
+
+ setElement: function(view, value) {
+ if (value !== null) {
+ view.transitionTo('hasElement');
+ }
+ return value;
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, meta = Ember.meta;
+
+Ember.View.states.inBuffer = {
+ parentState: Ember.View.states._default,
+
+ $: function(view, sel) {
+ // if we don't have an element yet, someone calling this.$() is
+ // trying to update an element that isn't in the DOM. Instead,
+ // rerender the view to allow the render method to reflect the
+ // changes.
+ view.rerender();
+ return Ember.$();
+ },
+
+ // when a view is rendered in a buffer, rerendering it simply
+ // replaces the existing buffer with a new one
+ rerender: function(view) {
+ Ember.deprecate("Something you did caused a view to re-render after it rendered but before it was inserted into the DOM. Because this is avoidable and the cause of significant performance issues in applications, this behavior is deprecated. If you want to use the debugger to find out what caused this, you can set ENV.RAISE_ON_DEPRECATION to true.");
+
+ view._notifyWillRerender();
+
+ view.clearRenderedChildren();
+ view.renderToBuffer(view.buffer, 'replaceWith');
+ },
+
+ // when a view is rendered in a buffer, appending a child
+ // view will render that view and append the resulting
+ // buffer into its buffer.
+ appendChild: function(view, childView, options) {
+ var buffer = view.buffer;
+
+ childView = this.createChildView(childView, options);
+ view._childViews.push(childView);
+
+ childView.renderToBuffer(buffer);
+
+ view.propertyDidChange('childViews');
+
+ return childView;
+ },
+
+ // when a view is rendered in a buffer, destroying the
+ // element will simply destroy the buffer and put the
+ // state back into the preRender state.
+ destroyElement: function(view) {
+ view.clearBuffer();
+ view._notifyWillDestroyElement();
+ view.transitionTo('preRender');
+
+ return view;
+ },
+
+ empty: function() {
+ Ember.assert("Emptying a view in the inBuffer state is not allowed and should not happen under normal circumstances. Most likely there is a bug in your application. This may be due to excessive property change notifications.");
+ },
+
+ // It should be impossible for a rendered view to be scheduled for
+ // insertion.
+ insertElement: function() {
+ throw "You can't insert an element that has already been rendered";
+ },
+
+ setElement: function(view, value) {
+ if (value === null) {
+ view.transitionTo('preRender');
+ } else {
+ view.clearBuffer();
+ view.transitionTo('hasElement');
+ }
+
+ return value;
+ }
+};
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, meta = Ember.meta;
+
+Ember.View.states.hasElement = {
+ parentState: Ember.View.states._default,
+
+ $: function(view, sel) {
+ var elem = get(view, 'element');
+ return sel ? Ember.$(sel, elem) : Ember.$(elem);
+ },
+
+ getElement: function(view) {
+ var parent = get(view, 'parentView');
+ if (parent) { parent = get(parent, 'element'); }
+ if (parent) { return view.findElementInParentElement(parent); }
+ return Ember.$("#" + get(view, 'elementId'))[0];
+ },
+
+ setElement: function(view, value) {
+ if (value === null) {
+ view.transitionTo('preRender');
+ } else {
+ throw "You cannot set an element to a non-null value when the element is already in the DOM.";
+ }
+
+ return value;
+ },
+
+ // once the view has been inserted into the DOM, rerendering is
+ // deferred to allow bindings to synchronize.
+ rerender: function(view) {
+ view._notifyWillRerender();
+
+ view.clearRenderedChildren();
+
+ view.domManager.replace(view);
+ return view;
+ },
+
+ // once the view is already in the DOM, destroying it removes it
+ // from the DOM, nukes its element, and puts it back into the
+ // preRender state if inDOM.
+
+ destroyElement: function(view) {
+ view._notifyWillDestroyElement();
+ view.domManager.remove(view);
+ return view;
+ },
+
+ empty: function(view) {
+ var _childViews = view._childViews, len, idx;
+ if (_childViews) {
+ len = _childViews.length;
+ for (idx = 0; idx < len; idx++) {
+ _childViews[idx]._notifyWillDestroyElement();
+ }
+ }
+ view.domManager.empty(view);
+ },
+
+ // Handle events from `Ember.EventDispatcher`
+ handleEvent: function(view, eventName, evt) {
+ if (view.has(eventName)) {
+ // Handler should be able to re-dispatch events, so we don't
+ // preventDefault or stopPropagation.
+ return view.trigger(eventName, evt);
+ } else {
+ return true; // continue event propagation
+ }
+ }
+};
+
+Ember.View.states.inDOM = {
+ parentState: Ember.View.states.hasElement,
+
+ insertElement: function(view, fn) {
+ if (view._lastInsert !== Ember.guidFor(fn)){
+ return;
+ }
+ throw "You can't insert an element into the DOM that has already been inserted";
+ }
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var destroyedError = "You can't call %@ on a destroyed view", fmt = Ember.String.fmt;
+
+Ember.View.states.destroyed = {
+ parentState: Ember.View.states._default,
+
+ appendChild: function() {
+ throw fmt(destroyedError, ['appendChild']);
+ },
+ rerender: function() {
+ throw fmt(destroyedError, ['rerender']);
+ },
+ destroyElement: function() {
+ throw fmt(destroyedError, ['destroyElement']);
+ },
+ empty: function() {
+ throw fmt(destroyedError, ['empty']);
+ },
+
+ setElement: function() {
+ throw fmt(destroyedError, ["set('element', ...)"]);
+ },
+
+ // Since element insertion is scheduled, don't do anything if
+ // the view has been destroyed between scheduling and execution
+ insertElement: Ember.K
+};
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, meta = Ember.meta;
+var forEach = Ember.EnumerableUtils.forEach;
+
+var childViewsProperty = Ember.computed(function() {
+ return get(this, '_childViews');
+}).property('_childViews').cacheable();
+
+/**
+ @class
+
+ A `ContainerView` is an `Ember.View` subclass that allows for manual or programatic
+ management of a view's `childViews` array that will correctly update the `ContainerView`
+ instance's rendered DOM representation.
+
+ ## Setting Initial Child Views
+ The initial array of child views can be set in one of two ways. You can provide
+ a `childViews` property at creation time that contains instance of `Ember.View`:
+
+
+ aContainer = Ember.ContainerView.create({
+ childViews: [Ember.View.create(), Ember.View.create()]
+ })
+
+ You can also provide a list of property names whose values are instances of `Ember.View`:
+
+ aContainer = Ember.ContainerView.create({
+ childViews: ['aView', 'bView', 'cView'],
+ aView: Ember.View.create(),
+ bView: Ember.View.create()
+ cView: Ember.View.create()
+ })
+
+ The two strategies can be combined:
+
+ aContainer = Ember.ContainerView.create({
+ childViews: ['aView', Ember.View.create()],
+ aView: Ember.View.create()
+ })
+
+ Each child view's rendering will be inserted into the container's rendered HTML in the same
+ order as its position in the `childViews` property.
+
+ ## Adding and Removing Child Views
+ The views in a container's `childViews` array should be added and removed by manipulating
+ the `childViews` property directly.
+
+ To remove a view pass that view into a `removeObject` call on the container's `childViews` property.
+
+ Given an empty `<body>` the following code
+
+ aContainer = Ember.ContainerView.create({
+ classNames: ['the-container'],
+ childViews: ['aView', 'bView'],
+ aView: Ember.View.create({
+ template: Ember.Handlebars.compile("A")
+ }),
+ bView: Ember.View.create({
+ template: Ember.Handlebars.compile("B")
+ })
+ })
+
+ aContainer.appendTo('body')
+
+ Results in the HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">A</div>
+ <div class="ember-view">B</div>
+ </div>
+
+ Removing a view
+
+ aContainer.get('childViews') // [aContainer.aView, aContainer.bView]
+ aContainer.get('childViews').removeObject(aContainer.get('bView'))
+ aContainer.get('childViews') // [aContainer.aView]
+
+ Will result in the following HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">A</div>
+ </div>
+
+
+ Similarly, adding a child view is accomplished by adding `Ember.View` instances to the
+ container's `childViews` property.
+
+ Given an empty `<body>` the following code
+
+ aContainer = Ember.ContainerView.create({
+ classNames: ['the-container'],
+ childViews: ['aView', 'bView'],
+ aView: Ember.View.create({
+ template: Ember.Handlebars.compile("A")
+ }),
+ bView: Ember.View.create({
+ template: Ember.Handlebars.compile("B")
+ })
+ })
+
+ aContainer.appendTo('body')
+
+ Results in the HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">A</div>
+ <div class="ember-view">B</div>
+ </div>
+
+ Adding a view
+
+ AnotherViewClass = Ember.View.extend({
+ template: Ember.Handlebars.compile("Another view")
+ })
+
+ aContainer.get('childViews') // [aContainer.aView, aContainer.bView]
+ aContainer.get('childViews').pushObject(AnotherViewClass.create())
+ aContainer.get('childViews') // [aContainer.aView, aContainer.bView, <AnotherViewClass instance>]
+
+ Will result in the following HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">A</div>
+ <div class="ember-view">B</div>
+ <div class="ember-view">Another view</div>
+ </div>
+
+
+ Direct manipulation of childViews presence or absence in the DOM via calls to
+ `remove` or `removeFromParent` or calls to a container's `removeChild` may not behave
+ correctly.
+
+ Calling `remove()` on a child view will remove the view's HTML, but it will remain as part of its
+ container's `childView`s property.
+
+ Calling `removeChild()` on the container will remove the passed view instance from the container's
+ `childView`s but keep its HTML within the container's rendered view.
+
+ Calling `removeFromParent()` behaves as expected but should be avoided in favor of direct
+ manipulation of a container's `childViews` property.
+
+ aContainer = Ember.ContainerView.create({
+ classNames: ['the-container'],
+ childViews: ['aView', 'bView'],
+ aView: Ember.View.create({
+ template: Ember.Handlebars.compile("A")
+ }),
+ bView: Ember.View.create({
+ template: Ember.Handlebars.compile("B")
+ })
+ })
+
+ aContainer.appendTo('body')
+
+ Results in the HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">A</div>
+ <div class="ember-view">B</div>
+ </div>
+
+ Calling `aContainer.get('aView').removeFromParent()` will result in the following HTML
+
+ <div class="ember-view the-container">
+ <div class="ember-view">B</div>
+ </div>
+
+ And the `Ember.View` instance stored in `aContainer.aView` will be removed from `aContainer`'s
+ `childViews` array.
+
+ ## Templates and Layout
+ A `template`, `templateName`, `defaultTemplate`, `layout`, `layoutName` or `defaultLayout`
+ property on a container view will not result in the template or layout being rendered.
+ The HTML contents of a `Ember.ContainerView`'s DOM representation will only be the rendered HTML
+ of its child views.
+
+ ## Binding a View to Display
+
+ If you would like to display a single view in your ContainerView, you can set its `currentView`
+ property. When the `currentView` property is set to a view instance, it will be added to the
+ ContainerView's `childViews` array. If the `currentView` property is later changed to a
+ different view, the new view will replace the old view. If `currentView` is set to `null`, the
+ last `currentView` will be removed.
+
+ This functionality is useful for cases where you want to bind the display of a ContainerView to
+ a controller or state manager. For example, you can bind the `currentView` of a container to
+ a controller like this:
+
+ // Controller
+ App.appController = Ember.Object.create({
+ view: Ember.View.create({
+ templateName: 'person_template'
+ })
+ });
+
+ // Handlebars template
+ {{view Ember.ContainerView currentViewBinding="App.appController.view"}}
+
+ @extends Ember.View
+*/
+
+Ember.ContainerView = Ember.View.extend({
+
+ init: function() {
+ this._super();
+
+ var childViews = get(this, 'childViews');
+ Ember.defineProperty(this, 'childViews', childViewsProperty);
+
+ var _childViews = this._childViews;
+
+ forEach(childViews, function(viewName, idx) {
+ var view;
+
+ if ('string' === typeof viewName) {
+ view = get(this, viewName);
+ view = this.createChildView(view);
+ set(this, viewName, view);
+ } else {
+ view = this.createChildView(viewName);
+ }
+
+ _childViews[idx] = view;
+ }, this);
+
+ var currentView = get(this, 'currentView');
+ if (currentView) _childViews.push(this.createChildView(currentView));
+
+ // Make the _childViews array observable
+ Ember.A(_childViews);
+
+ // Sets up an array observer on the child views array. This
+ // observer will detect when child views are added or removed
+ // and update the DOM to reflect the mutation.
+ get(this, 'childViews').addArrayObserver(this, {
+ willChange: 'childViewsWillChange',
+ didChange: 'childViewsDidChange'
+ });
+ },
+
+ /**
+ Instructs each child view to render to the passed render buffer.
+
+ @param {Ember.RenderBuffer} buffer the buffer to render to
+ @private
+ */
+ render: function(buffer) {
+ this.forEachChildView(function(view) {
+ view.renderToBuffer(buffer);
+ });
+ },
+
+ /**
+ When the container view is destroyed, tear down the child views
+ array observer.
+
+ @private
+ */
+ willDestroy: function() {
+ get(this, 'childViews').removeArrayObserver(this, {
+ willChange: 'childViewsWillChange',
+ didChange: 'childViewsDidChange'
+ });
+
+ this._super();
+ },
+
+ /**
+ When a child view is removed, destroy its element so that
+ it is removed from the DOM.
+
+ The array observer that triggers this action is set up in the
+ `renderToBuffer` method.
+
+ @private
+ @param {Ember.Array} views the child views array before mutation
+ @param {Number} start the start position of the mutation
+ @param {Number} removed the number of child views removed
+ **/
+ childViewsWillChange: function(views, start, removed) {
+ if (removed === 0) { return; }
+
+ var changedViews = views.slice(start, start+removed);
+ this.initializeViews(changedViews, null, null);
+
+ this.invokeForState('childViewsWillChange', views, start, removed);
+ },
+
+ /**
+ When a child view is added, make sure the DOM gets updated appropriately.
+
+ If the view has already rendered an element, we tell the child view to
+ create an element and insert it into the DOM. If the enclosing container view
+ has already written to a buffer, but not yet converted that buffer into an
+ element, we insert the string representation of the child into the appropriate
+ place in the buffer.
+
+ @private
+ @param {Ember.Array} views the array of child views afte the mutation has occurred
+ @param {Number} start the start position of the mutation
+ @param {Number} removed the number of child views removed
+ @param {Number} the number of child views added
+ */
+ childViewsDidChange: function(views, start, removed, added) {
+ var len = get(views, 'length');
+
+ // No new child views were added; bail out.
+ if (added === 0) return;
+
+ var changedViews = views.slice(start, start+added);
+ this.initializeViews(changedViews, this, get(this, 'templateData'));
+
+ // Let the current state handle the changes
+ this.invokeForState('childViewsDidChange', views, start, added);
+ },
+
+ initializeViews: function(views, parentView, templateData) {
+ forEach(views, function(view) {
+ set(view, '_parentView', parentView);
+
+ if (!get(view, 'templateData')) {
+ set(view, 'templateData', templateData);
+ }
+ });
+ },
+
+ /**
+ Schedules a child view to be inserted into the DOM after bindings have
+ finished syncing for this run loop.
+
+ @param {Ember.View} view the child view to insert
+ @param {Ember.View} prev the child view after which the specified view should
+ be inserted
+ @private
+ */
+ _scheduleInsertion: function(view, prev) {
+ if (prev) {
+ prev.domManager.after(prev, view);
+ } else {
+ this.domManager.prepend(this, view);
+ }
+ },
+
+ currentView: null,
+
+ _currentViewWillChange: Ember.beforeObserver(function() {
+ var childViews = get(this, 'childViews'),
+ currentView = get(this, 'currentView');
+
+ if (currentView) {
+ childViews.removeObject(currentView);
+ currentView.destroy();
+ }
+ }, 'currentView'),
+
+ _currentViewDidChange: Ember.observer(function() {
+ var childViews = get(this, 'childViews'),
+ currentView = get(this, 'currentView');
+
+ if (currentView) {
+ childViews.pushObject(currentView);
+ }
+ }, 'currentView')
+});
+
+// Ember.ContainerView extends the default view states to provide different
+// behavior for childViewsWillChange and childViewsDidChange.
+Ember.ContainerView.states = {
+ parent: Ember.View.states,
+
+ inBuffer: {
+ childViewsDidChange: function(parentView, views, start, added) {
+ var buffer = parentView.buffer,
+ startWith, prev, prevBuffer, view;
+
+ // Determine where to begin inserting the child view(s) in the
+ // render buffer.
+ if (start === 0) {
+ // If views were inserted at the beginning, prepend the first
+ // view to the render buffer, then begin inserting any
+ // additional views at the beginning.
+ view = views[start];
+ startWith = start + 1;
+ view.renderToBuffer(buffer, 'prepend');
+ } else {
+ // Otherwise, just insert them at the same place as the child
+ // views mutation.
+ view = views[start - 1];
+ startWith = start;
+ }
+
+ for (var i=startWith; i<start+added; i++) {
+ prev = view;
+ view = views[i];
+ prevBuffer = prev.buffer;
+ view.renderToBuffer(prevBuffer, 'insertAfter');
+ }
+ }
+ },
+
+ hasElement: {
+ childViewsWillChange: function(view, views, start, removed) {
+ for (var i=start; i<start+removed; i++) {
+ views[i].remove();
+ }
+ },
+
+ childViewsDidChange: function(view, views, start, added) {
+ // If the DOM element for this container view already exists,
+ // schedule each child view to insert its DOM representation after
+ // bindings have finished syncing.
+ var prev = start === 0 ? null : views[start-1];
+
+ for (var i=start; i<start+added; i++) {
+ view = views[i];
+ this._scheduleInsertion(view, prev);
+ prev = view;
+ }
+ }
+ }
+};
+
+Ember.ContainerView.states.inDOM = {
+ parentState: Ember.ContainerView.states.hasElement
+};
+
+Ember.ContainerView.reopen({
+ states: Ember.ContainerView.states
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
+
+/**
+ @class
+
+ `Ember.CollectionView` is an `Ember.View` descendent responsible for managing a
+ collection (an array or array-like object) by maintaing a child view object and
+ associated DOM representation for each item in the array and ensuring that child
+ views and their associated rendered HTML are updated when items in the array
+ are added, removed, or replaced.
+
+ ## Setting content
+ The managed collection of objects is referenced as the `Ember.CollectionView` instance's
+ `content` property.
+
+ someItemsView = Ember.CollectionView.create({
+ content: ['A', 'B','C']
+ })
+
+ The view for each item in the collection will have its `content` property set
+ to the item.
+
+ ## Specifying itemViewClass
+ By default the view class for each item in the managed collection will be an instance
+ of `Ember.View`. You can supply a different class by setting the `CollectionView`'s
+ `itemViewClass` property.
+
+ Given an empty `<body>` and the following code:
+
+
+ someItemsView = Ember.CollectionView.create({
+ classNames: ['a-collection'],
+ content: ['A','B','C'],
+ itemViewClass: Ember.View.extend({
+ template: Ember.Handlebars.compile("the letter: {{view.content}}")
+ })
+ })
+
+ someItemsView.appendTo('body')
+
+ Will result in the following HTML structure
+
+ <div class="ember-view a-collection">
+ <div class="ember-view">the letter: A</div>
+ <div class="ember-view">the letter: B</div>
+ <div class="ember-view">the letter: C</div>
+ </div>
+
+ ## Automatic matching of parent/child tagNames
+
+ Setting the `tagName` property of a `CollectionView` to any of
+ "ul", "ol", "table", "thead", "tbody", "tfoot", "tr", or "select" will result
+ in the item views receiving an appropriately matched `tagName` property.
+
+
+ Given an empty `<body>` and the following code:
+
+ anUndorderedListView = Ember.CollectionView.create({
+ tagName: 'ul',
+ content: ['A','B','C'],
+ itemViewClass: Ember.View.extend({
+ template: Ember.Handlebars.compile("the letter: {{view.content}}")
+ })
+ })
+
+ anUndorderedListView.appendTo('body')
+
+ Will result in the following HTML structure
+
+ <ul class="ember-view a-collection">
+ <li class="ember-view">the letter: A</li>
+ <li class="ember-view">the letter: B</li>
+ <li class="ember-view">the letter: C</li>
+ </ul>
+
+ Additional tagName pairs can be provided by adding to `Ember.CollectionView.CONTAINER_MAP `
+
+ Ember.CollectionView.CONTAINER_MAP['article'] = 'section'
+
+
+ ## Empty View
+ You can provide an `Ember.View` subclass to the `Ember.CollectionView` instance as its
+ `emptyView` property. If the `content` property of a `CollectionView` is set to `null`
+ or an empty array, an instance of this view will be the `CollectionView`s only child.
+
+ aListWithNothing = Ember.CollectionView.create({
+ classNames: ['nothing']
+ content: null,
+ emptyView: Ember.View.extend({
+ template: Ember.Handlebars.compile("The collection is empty")
+ })
+ })
+
+ aListWithNothing.appendTo('body')
+
+ Will result in the following HTML structure
+
+ <div class="ember-view nothing">
+ <div class="ember-view">
+ The collection is empty
+ </div>
+ </div>
+
+ ## Adding and Removing items
+ The `childViews` property of a `CollectionView` should not be directly manipulated. Instead,
+ add, remove, replace items from its `content` property. This will trigger
+ appropriate changes to its rendered HTML.
+
+ ## Use in templates via the `{{collection}}` Ember.Handlebars helper
+ Ember.Handlebars provides a helper specifically for adding `CollectionView`s to templates.
+ See `Ember.Handlebars.collection` for more details
+
+ @since Ember 0.9
+ @extends Ember.ContainerView
+*/
+Ember.CollectionView = Ember.ContainerView.extend(
+/** @scope Ember.CollectionView.prototype */ {
+
+ /**
+ A list of items to be displayed by the Ember.CollectionView.
+
+ @type Ember.Array
+ @default null
+ */
+ content: null,
+
+ /**
+ @private
+
+ This provides metadata about what kind of empty view class this
+ collection would like if it is being instantiated from another
+ system (like Handlebars)
+ */
+ emptyViewClass: Ember.View,
+
+ /**
+ An optional view to display if content is set to an empty array.
+
+ @type Ember.View
+ @default null
+ */
+ emptyView: null,
+
+ /**
+ @type Ember.View
+ @default Ember.View
+ */
+ itemViewClass: Ember.View,
+
+ /** @private */
+ init: function() {
+ var ret = this._super();
+ this._contentDidChange();
+ return ret;
+ },
+
+ _contentWillChange: Ember.beforeObserver(function() {
+ var content = this.get('content');
+
+ if (content) { content.removeArrayObserver(this); }
+ var len = content ? get(content, 'length') : 0;
+ this.arrayWillChange(content, 0, len);
+ }, 'content'),
+
+ /**
+ @private
+
+ Check to make sure that the content has changed, and if so,
+ update the children directly. This is always scheduled
+ asynchronously, to allow the element to be created before
+ bindings have synchronized and vice versa.
+ */
+ _contentDidChange: Ember.observer(function() {
+ var content = get(this, 'content');
+
+ if (content) {
+ Ember.assert(fmt("an Ember.CollectionView's content must implement Ember.Array. You passed %@", [content]), Ember.Array.detect(content));
+ content.addArrayObserver(this);
+ }
+
+ var len = content ? get(content, 'length') : 0;
+ this.arrayDidChange(content, 0, null, len);
+ }, 'content'),
+
+ willDestroy: function() {
+ var content = get(this, 'content');
+ if (content) { content.removeArrayObserver(this); }
+
+ this._super();
+ },
+
+ arrayWillChange: function(content, start, removedCount) {
+ // If the contents were empty before and this template collection has an
+ // empty view remove it now.
+ var emptyView = get(this, 'emptyView');
+ if (emptyView && emptyView instanceof Ember.View) {
+ emptyView.removeFromParent();
+ }
+
+ // Loop through child views that correspond with the removed items.
+ // Note that we loop from the end of the array to the beginning because
+ // we are mutating it as we go.
+ var childViews = get(this, 'childViews'), childView, idx, len;
+
+ len = get(childViews, 'length');
+
+ var removingAll = removedCount === len;
+
+ if (removingAll) {
+ this.invokeForState('empty');
+ }
+
+ for (idx = start + removedCount - 1; idx >= start; idx--) {
+ childView = childViews[idx];
+ if (removingAll) { childView.removedFromDOM = true; }
+ childView.destroy();
+ }
+ },
+
+ /**
+ Called when a mutation to the underlying content array occurs.
+
+ This method will replay that mutation against the views that compose the
+ Ember.CollectionView, ensuring that the view reflects the model.
+
+ This array observer is added in contentDidChange.
+
+ @param {Array} addedObjects
+ the objects that were added to the content
+
+ @param {Array} removedObjects
+ the objects that were removed from the content
+
+ @param {Number} changeIndex
+ the index at which the changes occurred
+ */
+ arrayDidChange: function(content, start, removed, added) {
+ var itemViewClass = get(this, 'itemViewClass'),
+ childViews = get(this, 'childViews'),
+ addedViews = [], view, item, idx, len, itemTagName;
+
+ if ('string' === typeof itemViewClass) {
+ itemViewClass = get(itemViewClass);
+ }
+
+ Ember.assert(fmt("itemViewClass must be a subclass of Ember.View, not %@", [itemViewClass]), Ember.View.detect(itemViewClass));
+
+ len = content ? get(content, 'length') : 0;
+ if (len) {
+ for (idx = start; idx < start+added; idx++) {
+ item = content.objectAt(idx);
+
+ view = this.createChildView(itemViewClass, {
+ content: item,
+ contentIndex: idx
+ });
+
+ addedViews.push(view);
+ }
+ } else {
+ var emptyView = get(this, 'emptyView');
+ if (!emptyView) { return; }
+
+ emptyView = this.createChildView(emptyView);
+ addedViews.push(emptyView);
+ set(this, 'emptyView', emptyView);
+ }
+ childViews.replace(start, 0, addedViews);
+ },
+
+ createChildView: function(view, attrs) {
+ view = this._super(view, attrs);
+
+ var itemTagName = get(view, 'tagName');
+ var tagName = (itemTagName === null || itemTagName === undefined) ? Ember.CollectionView.CONTAINER_MAP[get(this, 'tagName')] : itemTagName;
+
+ set(view, 'tagName', tagName);
+
+ return view;
+ }
+});
+
+/**
+ @static
+
+ A map of parent tags to their default child tags. You can add
+ additional parent tags if you want collection views that use
+ a particular parent tag to default to a child tag.
+
+ @type Hash
+ @constant
+*/
+Ember.CollectionView.CONTAINER_MAP = {
+ ul: 'li',
+ ol: 'li',
+ table: 'tr',
+ thead: 'tr',
+ tbody: 'tr',
+ tfoot: 'tr',
+ tr: 'td',
+ select: 'option'
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2006-2011 Strobe Inc. and contributors.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+/*globals jQuery*/
+
+})();
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ @extends Ember.Object
+*/
+Ember.State = Ember.Object.extend(Ember.Evented,
+/** @scope Ember.State.prototype */{
+ isState: true,
+
+ /**
+ A reference to the parent state.
+
+ @type Ember.State
+ */
+ parentState: null,
+ start: null,
+
+ /**
+ The name of this state.
+
+ @type String
+ */
+ name: null,
+
+ /**
+ The full path to this state.
+
+ @type String
+ @readOnly
+ */
+ path: Ember.computed(function() {
+ var parentPath = get(this, 'parentState.path'),
+ path = get(this, 'name');
+
+ if (parentPath) {
+ path = parentPath + '.' + path;
+ }
+
+ return path;
+ }).property().cacheable(),
+
+ /**
+ @private
+
+ Override the default event firing from Ember.Evented to
+ also call methods with the given name.
+ */
+ trigger: function(name) {
+ if (this[name]) {
+ this[name].apply(this, [].slice.call(arguments, 1));
+ }
+ this._super.apply(this, arguments);
+ },
+
+ /** @private */
+ init: function() {
+ var states = get(this, 'states'), foundStates;
+ set(this, 'childStates', Ember.A());
+ set(this, 'eventTransitions', get(this, 'eventTransitions') || {});
+
+ var name, value, transitionTarget;
+
+ // As a convenience, loop over the properties
+ // of this state and look for any that are other
+ // Ember.State instances or classes, and move them
+ // to the `states` hash. This avoids having to
+ // create an explicit separate hash.
+
+ if (!states) {
+ states = {};
+
+ for (name in this) {
+ if (name === "constructor") { continue; }
+
+ if (value = this[name]) {
+ if (transitionTarget = value.transitionTarget) {
+ this.eventTransitions[name] = transitionTarget;
+ }
+
+ this.setupChild(states, name, value);
+ }
+ }
+
+ set(this, 'states', states);
+ } else {
+ for (name in states) {
+ this.setupChild(states, name, states[name]);
+ }
+ }
+
+ set(this, 'pathsCache', {});
+ set(this, 'pathsCacheNoContext', {});
+ },
+
+ /** @private */
+ setupChild: function(states, name, value) {
+ if (!value) { return false; }
+
+ if (value.isState) {
+ set(value, 'name', name);
+ } else if (Ember.State.detect(value)) {
+ value = value.create({
+ name: name
+ });
+ }
+
+ if (value.isState) {
+ set(value, 'parentState', this);
+ get(this, 'childStates').pushObject(value);
+ states[name] = value;
+ }
+ },
+
+ lookupEventTransition: function(name) {
+ var path, state = this;
+
+ while(state && !path) {
+ path = state.eventTransitions[name];
+ state = state.get('parentState');
+ }
+
+ return path;
+ },
+
+ /**
+ A Boolean value indicating whether the state is a leaf state
+ in the state hierarchy. This is false if the state has child
+ states; otherwise it is true.
+
+ @type Boolean
+ */
+ isLeaf: Ember.computed(function() {
+ return !get(this, 'childStates').length;
+ }).cacheable(),
+
+ /**
+ A boolean value indicating whether the state takes a context.
+ By default we assume all states take contexts.
+ */
+ hasContext: true,
+
+ /**
+ This is the default transition event.
+
+ @event
+ @param {Ember.StateManager} manager
+ @param context
+ @see Ember.StateManager#transitionEvent
+ */
+ setup: Ember.K,
+
+ /**
+ This event fires when the state is entered.
+
+ @event
+ @param {Ember.StateManager} manager
+ */
+ enter: Ember.K,
+
+ /**
+ This event fires when the state is exited.
+
+ @event
+ @param {Ember.StateManager} manager
+ */
+ exit: Ember.K
+});
+
+var Event = Ember.$ && Ember.$.Event;
+
+Ember.State.reopenClass(
+/** @scope Ember.State */{
+
+ /**
+ @static
+
+ Creates an action function for transitioning to the named state while preserving context.
+
+ The following example StateManagers are equivalent:
+
+ aManager = Ember.StateManager.create({
+ stateOne: Ember.State.create({
+ changeToStateTwo: Ember.State.transitionTo('stateTwo')
+ }),
+ stateTwo: Ember.State.create({})
+ })
+
+ bManager = Ember.StateManager.create({
+ stateOne: Ember.State.create({
+ changeToStateTwo: function(manager, context){
+ manager.transitionTo('stateTwo', context)
+ }
+ }),
+ stateTwo: Ember.State.create({})
+ })
+
+ @param {String} target
+ */
+ transitionTo: function(target) {
+ var event = function(stateManager, context) {
+ if (Event && context instanceof Event) {
+ if (context.hasOwnProperty('context')) {
+ context = context.context;
+ } else {
+ // If we received an event and it doesn't contain
+ // a context, don't pass along a superfluous
+ // context to the target of the event.
+ return stateManager.transitionTo(target);
+ }
+ }
+
+ stateManager.transitionTo(target, context);
+ };
+
+ event.transitionTarget = target;
+
+ return event;
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
+var arrayForEach = Ember.ArrayPolyfills.forEach;
+/**
+ @private
+
+ A Transition takes the enter, exit and resolve states and normalizes
+ them:
+
+ * takes any passed in contexts into consideration
+ * adds in `initialState`s
+*/
+var Transition = function(raw) {
+ this.enterStates = raw.enterStates.slice();
+ this.exitStates = raw.exitStates.slice();
+ this.resolveState = raw.resolveState;
+
+ this.finalState = raw.enterStates[raw.enterStates.length - 1] || raw.resolveState;
+};
+
+Transition.prototype = {
+ /**
+ @private
+
+ Normalize the passed in enter, exit and resolve states.
+
+ This process also adds `finalState` and `contexts` to the Transition object.
+
+ @param {Ember.StateManager} manager the state manager running the transition
+ @param {Array} contexts a list of contexts passed into `transitionTo`
+ */
+ normalize: function(manager, contexts) {
+ this.matchContextsToStates(contexts);
+ this.addInitialStates();
+ this.removeUnchangedContexts(manager);
+ return this;
+ },
+
+ /**
+ @private
+
+ Match each of the contexts passed to `transitionTo` to a state.
+ This process may also require adding additional enter and exit
+ states if there are more contexts than enter states.
+
+ @param {Array} contexts a list of contexts passed into `transitionTo`
+ */
+ matchContextsToStates: function(contexts) {
+ var stateIdx = this.enterStates.length - 1,
+ matchedContexts = [],
+ state,
+ context;
+
+ // Next, we will match the passed in contexts to the states they
+ // represent.
+ //
+ // First, assign a context to each enter state in reverse order. If
+ // any contexts are left, add a parent state to the list of states
+ // to enter and exit, and assign a context to the parent state.
+ //
+ // If there are still contexts left when the state manager is
+ // reached, raise an exception.
+ //
+ // This allows the following:
+ //
+ // |- root
+ // | |- post
+ // | | |- comments
+ // | |- about (* current state)
+ //
+ // For `transitionTo('post.comments', post, post.get('comments')`,
+ // the first context (`post`) will be assigned to `root.post`, and
+ // the second context (`post.get('comments')`) will be assigned
+ // to `root.post.comments`.
+ //
+ // For the following:
+ //
+ // |- root
+ // | |- post
+ // | | |- index (* current state)
+ // | | |- comments
+ //
+ // For `transitionTo('post.comments', otherPost, otherPost.get('comments')`,
+ // the `<root.post>` state will be added to the list of enter and exit
+ // states because its context has changed.
+
+ while (contexts.length > 0) {
+ if (stateIdx >= 0) {
+ state = this.enterStates[stateIdx--];
+ } else {
+ if (this.enterStates.length) {
+ state = get(this.enterStates[0], 'parentState');
+ if (!state) { throw "Cannot match all contexts to states"; }
+ } else {
+ // If re-entering the current state with a context, the resolve
+ // state will be the current state.
+ state = this.resolveState;
+ }
+
+ this.enterStates.unshift(state);
+ this.exitStates.unshift(state);
+ }
+
+ // in routers, only states with dynamic segments have a context
+ if (get(state, 'hasContext')) {
+ context = contexts.pop();
+ } else {
+ context = null;
+ }
+
+ matchedContexts.unshift(context);
+ }
+
+ this.contexts = matchedContexts;
+ },
+
+ /**
+ @private
+
+ Add any `initialState`s to the list of enter states.
+ */
+ addInitialStates: function() {
+ var finalState = this.finalState, initialState;
+
+ while(true) {
+ initialState = get(finalState, 'initialState') || 'start';
+ finalState = get(finalState, 'states.' + initialState);
+
+ if (!finalState) { break; }
+
+ this.finalState = finalState;
+ this.enterStates.push(finalState);
+ this.contexts.push(undefined);
+ }
+ },
+
+ /**
+ @private
+
+ Remove any states that were added because the number of contexts
+ exceeded the number of explicit enter states, but the context has
+ not changed since the last time the state was entered.
+
+ @param {Ember.StateManager} manager passed in to look up the last
+ context for a states
+ */
+ removeUnchangedContexts: function(manager) {
+ // Start from the beginning of the enter states. If the state was added
+ // to the list during the context matching phase, make sure the context
+ // has actually changed since the last time the state was entered.
+ while (this.enterStates.length > 0) {
+ if (this.enterStates[0] !== this.exitStates[0]) { break; }
+
+ if (this.enterStates.length === this.contexts.length) {
+ if (manager.getStateMeta(this.enterStates[0], 'context') !== this.contexts[0]) { break; }
+ this.contexts.shift();
+ }
+
+ this.resolveState = this.enterStates.shift();
+ this.exitStates.shift();
+ }
+ }
+};
+
+/**
+ @class
+
+ StateManager is part of Ember's implementation of a finite state machine. A StateManager
+ instance manages a number of properties that are instances of `Ember.State`,
+ tracks the current active state, and triggers callbacks when states have changed.
+
+ ## Defining States
+
+ The states of StateManager can be declared in one of two ways. First, you can define
+ a `states` property that contains all the states:
+
+ managerA = Ember.StateManager.create({
+ states: {
+ stateOne: Ember.State.create(),
+ stateTwo: Ember.State.create()
+ }
+ })
+
+ managerA.get('states')
+ // {
+ // stateOne: Ember.State.create(),
+ // stateTwo: Ember.State.create()
+ // }
+
+ You can also add instances of `Ember.State` (or an `Ember.State` subclass) directly as properties
+ of a StateManager. These states will be collected into the `states` property for you.
+
+ managerA = Ember.StateManager.create({
+ stateOne: Ember.State.create(),
+ stateTwo: Ember.State.create()
+ })
+
+ managerA.get('states')
+ // {
+ // stateOne: Ember.State.create(),
+ // stateTwo: Ember.State.create()
+ // }
+
+ ## The Initial State
+ When created a StateManager instance will immediately enter into the state
+ defined as its `start` property or the state referenced by name in its
+ `initialState` property:
+
+ managerA = Ember.StateManager.create({
+ start: Ember.State.create({})
+ })
+
+ managerA.get('currentState.name') // 'start'
+
+ managerB = Ember.StateManager.create({
+ initialState: 'beginHere',
+ beginHere: Ember.State.create({})
+ })
+
+ managerB.get('currentState.name') // 'beginHere'
+
+ Because it is a property you may also provide a computed function if you wish to derive
+ an `initialState` programmatically:
+
+ managerC = Ember.StateManager.create({
+ initialState: function(){
+ if (someLogic) {
+ return 'active';
+ } else {
+ return 'passive';
+ }
+ }.property(),
+ active: Ember.State.create({}),
+ passive: Ember.State.create({})
+ })
+
+ ## Moving Between States
+ A StateManager can have any number of Ember.State objects as properties
+ and can have a single one of these states as its current state.
+
+ Calling `transitionTo` transitions between states:
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown',
+ poweredDown: Ember.State.create({}),
+ poweredUp: Ember.State.create({})
+ })
+
+ robotManager.get('currentState.name') // 'poweredDown'
+ robotManager.transitionTo('poweredUp')
+ robotManager.get('currentState.name') // 'poweredUp'
+
+ Before transitioning into a new state the existing `currentState` will have its
+ `exit` method called with the StateManager instance as its first argument and
+ an object representing the transition as its second argument.
+
+ After transitioning into a new state the new `currentState` will have its
+ `enter` method called with the StateManager instance as its first argument and
+ an object representing the transition as its second argument.
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown',
+ poweredDown: Ember.State.create({
+ exit: function(stateManager){
+ console.log("exiting the poweredDown state")
+ }
+ }),
+ poweredUp: Ember.State.create({
+ enter: function(stateManager){
+ console.log("entering the poweredUp state. Destroy all humans.")
+ }
+ })
+ })
+
+ robotManager.get('currentState.name') // 'poweredDown'
+ robotManager.transitionTo('poweredUp')
+ // will log
+ // 'exiting the poweredDown state'
+ // 'entering the poweredUp state. Destroy all humans.'
+
+
+ Once a StateManager is already in a state, subsequent attempts to enter that state will
+ not trigger enter or exit method calls. Attempts to transition into a state that the
+ manager does not have will result in no changes in the StateManager's current state:
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown',
+ poweredDown: Ember.State.create({
+ exit: function(stateManager){
+ console.log("exiting the poweredDown state")
+ }
+ }),
+ poweredUp: Ember.State.create({
+ enter: function(stateManager){
+ console.log("entering the poweredUp state. Destroy all humans.")
+ }
+ })
+ })
+
+ robotManager.get('currentState.name') // 'poweredDown'
+ robotManager.transitionTo('poweredUp')
+ // will log
+ // 'exiting the poweredDown state'
+ // 'entering the poweredUp state. Destroy all humans.'
+ robotManager.transitionTo('poweredUp') // no logging, no state change
+
+ robotManager.transitionTo('someUnknownState') // silently fails
+ robotManager.get('currentState.name') // 'poweredUp'
+
+
+ Each state property may itself contain properties that are instances of Ember.State.
+ The StateManager can transition to specific sub-states in a series of transitionTo method calls or
+ via a single transitionTo with the full path to the specific state. The StateManager will also
+ keep track of the full path to its currentState
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown',
+ poweredDown: Ember.State.create({
+ charging: Ember.State.create(),
+ charged: Ember.State.create()
+ }),
+ poweredUp: Ember.State.create({
+ mobile: Ember.State.create(),
+ stationary: Ember.State.create()
+ })
+ })
+
+ robotManager.get('currentState.name') // 'poweredDown'
+
+ robotManager.transitionTo('poweredUp')
+ robotManager.get('currentState.name') // 'poweredUp'
+
+ robotManager.transitionTo('mobile')
+ robotManager.get('currentState.name') // 'mobile'
+
+ // transition via a state path
+ robotManager.transitionTo('poweredDown.charging')
+ robotManager.get('currentState.name') // 'charging'
+
+ robotManager.get('currentState.path') // 'poweredDown.charging'
+
+ Enter transition methods will be called for each state and nested child state in their
+ hierarchical order. Exit methods will be called for each state and its nested states in
+ reverse hierarchical order.
+
+ Exit transitions for a parent state are not called when entering into one of its child states,
+ only when transitioning to a new section of possible states in the hierarchy.
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown',
+ poweredDown: Ember.State.create({
+ enter: function(){},
+ exit: function(){
+ console.log("exited poweredDown state")
+ },
+ charging: Ember.State.create({
+ enter: function(){},
+ exit: function(){}
+ }),
+ charged: Ember.State.create({
+ enter: function(){
+ console.log("entered charged state")
+ },
+ exit: function(){
+ console.log("exited charged state")
+ }
+ })
+ }),
+ poweredUp: Ember.State.create({
+ enter: function(){
+ console.log("entered poweredUp state")
+ },
+ exit: function(){},
+ mobile: Ember.State.create({
+ enter: function(){
+ console.log("entered mobile state")
+ },
+ exit: function(){}
+ }),
+ stationary: Ember.State.create({
+ enter: function(){},
+ exit: function(){}
+ })
+ })
+ })
+
+
+ robotManager.get('currentState.path') // 'poweredDown'
+ robotManager.transitionTo('charged')
+ // logs 'entered charged state'
+ // but does *not* log 'exited poweredDown state'
+ robotManager.get('currentState.name') // 'charged
+
+ robotManager.transitionTo('poweredUp.mobile')
+ // logs
+ // 'exited charged state'
+ // 'exited poweredDown state'
+ // 'entered poweredUp state'
+ // 'entered mobile state'
+
+ During development you can set a StateManager's `enableLogging` property to `true` to
+ receive console messages of state transitions.
+
+ robotManager = Ember.StateManager.create({
+ enableLogging: true
+ })
+
+ ## Managing currentState with Actions
+ To control which transitions between states are possible for a given state, StateManager
+ can receive and route action messages to its states via the `send` method. Calling to `send` with
+ an action name will begin searching for a method with the same name starting at the current state
+ and moving up through the parent states in a state hierarchy until an appropriate method is found
+ or the StateManager instance itself is reached.
+
+ If an appropriately named method is found it will be called with the state manager as the first
+ argument and an optional `context` object as the second argument.
+
+ managerA = Ember.StateManager.create({
+ initialState: 'stateOne.substateOne.subsubstateOne',
+ stateOne: Ember.State.create({
+ substateOne: Ember.State.create({
+ anAction: function(manager, context){
+ console.log("an action was called")
+ },
+ subsubstateOne: Ember.State.create({})
+ })
+ })
+ })
+
+ managerA.get('currentState.name') // 'subsubstateOne'
+ managerA.send('anAction')
+ // 'stateOne.substateOne.subsubstateOne' has no anAction method
+ // so the 'anAction' method of 'stateOne.substateOne' is called
+ // and logs "an action was called"
+ // with managerA as the first argument
+ // and no second argument
+
+ someObject = {}
+ managerA.send('anAction', someObject)
+ // the 'anAction' method of 'stateOne.substateOne' is called again
+ // with managerA as the first argument and
+ // someObject as the second argument.
+
+
+ If the StateManager attempts to send an action but does not find an appropriately named
+ method in the current state or while moving upwards through the state hierarchy
+ it will throw a new Ember.Error. Action detection only moves upwards through the state hierarchy
+ from the current state. It does not search in other portions of the hierarchy.
+
+ managerB = Ember.StateManager.create({
+ initialState: 'stateOne.substateOne.subsubstateOne',
+ stateOne: Ember.State.create({
+ substateOne: Ember.State.create({
+ subsubstateOne: Ember.State.create({})
+ })
+ }),
+ stateTwo: Ember.State.create({
+ anAction: function(manager, context){
+ // will not be called below because it is
+ // not a parent of the current state
+ }
+ })
+ })
+
+ managerB.get('currentState.name') // 'subsubstateOne'
+ managerB.send('anAction')
+ // Error: <Ember.StateManager:ember132> could not
+ // respond to event anAction in state stateOne.substateOne.subsubstateOne.
+
+ Inside of an action method the given state should delegate `transitionTo` calls on its
+ StateManager.
+
+ robotManager = Ember.StateManager.create({
+ initialState: 'poweredDown.charging',
+ poweredDown: Ember.State.create({
+ charging: Ember.State.create({
+ chargeComplete: function(manager, context){
+ manager.transitionTo('charged')
+ }
+ }),
+ charged: Ember.State.create({
+ boot: function(manager, context){
+ manager.transitionTo('poweredUp')
+ }
+ })
+ }),
+ poweredUp: Ember.State.create({
+ beginExtermination: function(manager, context){
+ manager.transitionTo('rampaging')
+ },
+ rampaging: Ember.State.create()
+ })
+ })
+
+ robotManager.get('currentState.name') // 'charging'
+ robotManager.send('boot') // throws error, no boot action
+ // in current hierarchy
+ robotManager.get('currentState.name') // remains 'charging'
+
+ robotManager.send('beginExtermination') // throws error, no beginExtermination
+ // action in current hierarchy
+ robotManager.get('currentState.name') // remains 'charging'
+
+ robotManager.send('chargeComplete')
+ robotManager.get('currentState.name') // 'charged'
+
+ robotManager.send('boot')
+ robotManager.get('currentState.name') // 'poweredUp'
+
+ robotManager.send('beginExtermination', allHumans)
+ robotManager.get('currentState.name') // 'rampaging'
+
+ Transition actions can also be created using the `transitionTo` method of the Ember.State class. The
+ following example StateManagers are equivalent:
+
+ aManager = Ember.StateManager.create({
+ stateOne: Ember.State.create({
+ changeToStateTwo: Ember.State.transitionTo('stateTwo')
+ }),
+ stateTwo: Ember.State.create({})
+ })
+
+ bManager = Ember.StateManager.create({
+ stateOne: Ember.State.create({
+ changeToStateTwo: function(manager, context){
+ manager.transitionTo('stateTwo', context)
+ }
+ }),
+ stateTwo: Ember.State.create({})
+ })
+**/
+Ember.StateManager = Ember.State.extend(
+/** @scope Ember.StateManager.prototype */ {
+
+ /**
+ When creating a new statemanager, look for a default state to transition
+ into. This state can either be named `start`, or can be specified using the
+ `initialState` property.
+ */
+ init: function() {
+ this._super();
+
+ set(this, 'stateMeta', Ember.Map.create());
+
+ var initialState = get(this, 'initialState');
+
+ if (!initialState && get(this, 'states.start')) {
+ initialState = 'start';
+ }
+
+ if (initialState) {
+ this.transitionTo(initialState);
+ Ember.assert('Failed to transition to initial state "' + initialState + '"', !!get(this, 'currentState'));
+ }
+ },
+
+ stateMetaFor: function(state) {
+ var meta = get(this, 'stateMeta'),
+ stateMeta = meta.get(state);
+
+ if (!stateMeta) {
+ stateMeta = {};
+ meta.set(state, stateMeta);
+ }
+
+ return stateMeta;
+ },
+
+ setStateMeta: function(state, key, value) {
+ return set(this.stateMetaFor(state), key, value);
+ },
+
+ getStateMeta: function(state, key) {
+ return get(this.stateMetaFor(state), key);
+ },
+
+ /**
+ The current state from among the manager's possible states. This property should
+ not be set directly. Use `transitionTo` to move between states by name.
+
+ @type Ember.State
+ @readOnly
+ */
+ currentState: null,
+
+ /**
+ The name of transitionEvent that this stateManager will dispatch
+
+ @property {String}
+ @default 'setup'
+ */
+ transitionEvent: 'setup',
+
+ /**
+ If set to true, `errorOnUnhandledEvents` will cause an exception to be
+ raised if you attempt to send an event to a state manager that is not
+ handled by the current state or any of its parent states.
+
+ @type Boolean
+ @default true
+ */
+ errorOnUnhandledEvent: true,
+
+ send: function(event, context) {
+ Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
+ return this.sendRecursively(event, get(this, 'currentState'), context);
+ },
+
+ sendRecursively: function(event, currentState, context) {
+ var log = this.enableLogging,
+ action = currentState[event];
+
+ // Test to see if the action is a method that
+ // can be invoked. Don't blindly check just for
+ // existence, because it is possible the state
+ // manager has a child state of the given name,
+ // and we should still raise an exception in that
+ // case.
+ if (typeof action === 'function') {
+ if (log) { Ember.Logger.log(fmt("STATEMANAGER: Sending event '%@' to state %@.", [event, get(currentState, 'path')])); }
+ return action.call(currentState, this, context);
+ } else {
+ var parentState = get(currentState, 'parentState');
+ if (parentState) {
+ return this.sendRecursively(event, parentState, context);
+ } else if (get(this, 'errorOnUnhandledEvent')) {
+ throw new Ember.Error(this.toString() + " could not respond to event " + event + " in state " + get(this, 'currentState.path') + ".");
+ }
+ }
+ },
+
+ /**
+ Finds a state by its state path.
+
+ Example:
+
+ manager = Ember.StateManager.create({
+ root: Ember.State.create({
+ dashboard: Ember.State.create()
+ })
+ });
+
+ manager.getStateByPath(manager, "root.dashboard")
+
+ // returns the dashboard state
+
+ @param {Ember.State} root the state to start searching from
+ @param {String} path the state path to follow
+ @returns {Ember.State} the state at the end of the path
+ */
+ getStateByPath: function(root, path) {
+ var parts = path.split('.'),
+ state = root;
+
+ for (var i=0, l=parts.length; i<l; i++) {
+ state = get(get(state, 'states'), parts[i]);
+ if (!state) { break; }
+ }
+
+ return state;
+ },
+
+ findStateByPath: function(state, path) {
+ var possible;
+
+ while (!possible && state) {
+ possible = this.getStateByPath(state, path);
+ state = get(state, 'parentState');
+ }
+
+ return possible;
+ },
+
+ /**
+ @private
+
+ A state stores its child states in its `states` hash.
+ This code takes a path like `posts.show` and looks
+ up `origin.states.posts.states.show`.
+
+ It returns a list of all of the states from the
+ origin, which is the list of states to call `enter`
+ on.
+ */
+ findStatesByPath: function(origin, path) {
+ if (!path || path === "") { return undefined; }
+ var r = path.split('.'),
+ ret = [];
+
+ for (var i=0, len = r.length; i < len; i++) {
+ var states = get(origin, 'states');
+
+ if (!states) { return undefined; }
+
+ var s = get(states, r[i]);
+ if (s) { origin = s; ret.push(s); }
+ else { return undefined; }
+ }
+
+ return ret;
+ },
+
+ goToState: function() {
+ // not deprecating this yet so people don't constantly need to
+ // make trivial changes for little reason.
+ return this.transitionTo.apply(this, arguments);
+ },
+
+ transitionTo: function(path, context) {
+ // XXX When is transitionTo called with no path
+ if (Ember.empty(path)) { return; }
+
+ // The ES6 signature of this function is `path, ...contexts`
+ var contexts = context ? Array.prototype.slice.call(arguments, 1) : [],
+ currentState = get(this, 'currentState') || this;
+
+ // First, get the enter, exit and resolve states for the current state
+ // and specified path. If possible, use an existing cache.
+ var hash = this.contextFreeTransition(currentState, path);
+
+ // Next, process the raw state information for the contexts passed in.
+ var transition = new Transition(hash).normalize(this, contexts);
+
+ this.enterState(transition);
+ this.triggerSetupContext(transition);
+ },
+
+ contextFreeTransition: function(currentState, path) {
+ var cache = currentState.pathsCache[path];
+ if (cache) { return cache; }
+
+ var enterStates = this.findStatesByPath(currentState, path),
+ exitStates = [],
+ resolveState = currentState;
+
+ // Walk up the states. For each state, check whether a state matching
+ // the `path` is nested underneath. This will find the closest
+ // parent state containing `path`.
+ //
+ // This allows the user to pass in a relative path. For example, for
+ // the following state hierarchy:
+ //
+ // | |root
+ // | |- posts
+ // | | |- show (* current)
+ // | |- comments
+ // | | |- show
+ //
+ // If the current state is `<root.posts.show>`, an attempt to
+ // transition to `comments.show` will match `<root.comments.show>`.
+ //
+ // First, this code will look for root.posts.show.comments.show.
+ // Next, it will look for root.posts.comments.show. Finally,
+ // it will look for `root.comments.show`, and find the state.
+ //
+ // After this process, the following variables will exist:
+ //
+ // * resolveState: a common parent state between the current
+ // and target state. In the above example, `<root>` is the
+ // `resolveState`.
+ // * enterStates: a list of all of the states represented
+ // by the path from the `resolveState`. For example, for
+ // the path `root.comments.show`, `enterStates` would have
+ // `[<root.comments>, <root.comments.show>]`
+ // * exitStates: a list of all of the states from the
+ // `resolveState` to the `currentState`. In the above
+ // example, `exitStates` would have
+ // `[<root.posts>`, `<root.posts.show>]`.
+ while (resolveState && !enterStates) {
+ exitStates.unshift(resolveState);
+
+ resolveState = get(resolveState, 'parentState');
+ if (!resolveState) {
+ enterStates = this.findStatesByPath(this, path);
+ if (!enterStates) {
+ Ember.assert('Could not find state for path: "'+path+'"');
+ return;
+ }
+ }
+ enterStates = this.findStatesByPath(resolveState, path);
+ }
+
+ // If the path contains some states that are parents of both the
+ // current state and the target state, remove them.
+ //
+ // For example, in the following hierarchy:
+ //
+ // |- root
+ // | |- post
+ // | | |- index (* current)
+ // | | |- show
+ //
+ // If the `path` is `root.post.show`, the three variables will
+ // be:
+ //
+ // * resolveState: `<state manager>`
+ // * enterStates: `[<root>, <root.post>, <root.post.show>]`
+ // * exitStates: `[<root>, <root.post>, <root.post.index>]`
+ //
+ // The goal of this code is to remove the common states, so we
+ // have:
+ //
+ // * resolveState: `<root.post>`
+ // * enterStates: `[<root.post.show>]`
+ // * exitStates: `[<root.post.index>]`
+ //
+ // This avoid unnecessary calls to the enter and exit transitions.
+ while (enterStates.length > 0 && enterStates[0] === exitStates[0]) {
+ resolveState = enterStates.shift();
+ exitStates.shift();
+ }
+
+ // Cache the enterStates, exitStates, and resolveState for the
+ // current state and the `path`.
+ var transitions = currentState.pathsCache[path] = {
+ exitStates: exitStates,
+ enterStates: enterStates,
+ resolveState: resolveState
+ };
+
+ return transitions;
+ },
+
+ triggerSetupContext: function(transitions) {
+ var contexts = transitions.contexts,
+ offset = transitions.enterStates.length - contexts.length,
+ enterStates = transitions.enterStates,
+ transitionEvent = get(this, 'transitionEvent');
+
+ Ember.assert("More contexts provided than states", offset >= 0);
+
+ arrayForEach.call(enterStates, function(state, idx) {
+ state.trigger(transitionEvent, this, contexts[idx-offset]);
+ }, this);
+ },
+
+ getState: function(name) {
+ var state = get(this, name),
+ parentState = get(this, 'parentState');
+
+ if (state) {
+ return state;
+ } else if (parentState) {
+ return parentState.getState(name);
+ }
+ },
+
+ enterState: function(transition) {
+ var log = this.enableLogging;
+
+ var exitStates = transition.exitStates.slice(0).reverse();
+ arrayForEach.call(exitStates, function(state) {
+ state.trigger('exit', this);
+ }, this);
+
+ arrayForEach.call(transition.enterStates, function(state) {
+ if (log) { Ember.Logger.log("STATEMANAGER: Entering " + get(state, 'path')); }
+ state.trigger('enter', this);
+ }, this);
+
+ set(this, 'currentState', transition.finalState);
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Statecharts
+// Copyright: ©2011 Living Social Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+(function() {
+var get = Ember.get;
+
+Ember._ResolvedState = Ember.Object.extend({
+ manager: null,
+ state: null,
+ match: null,
+
+ object: Ember.computed(function(key, value) {
+ if (arguments.length === 2) {
+ this._object = value;
+ return value;
+ } else {
+ if (this._object) {
+ return this._object;
+ } else {
+ var state = get(this, 'state'),
+ match = get(this, 'match'),
+ manager = get(this, 'manager');
+ return state.deserialize(manager, match.hash);
+ }
+ }
+ }).property(),
+
+ hasPromise: Ember.computed(function() {
+ return Ember.canInvoke(get(this, 'object'), 'then');
+ }).property('object'),
+
+ promise: Ember.computed(function() {
+ var object = get(this, 'object');
+ if (Ember.canInvoke(object, 'then')) {
+ return object;
+ } else {
+ return {
+ then: function(success) { success(object); }
+ };
+ }
+ }).property('object'),
+
+ transition: function() {
+ var manager = get(this, 'manager'),
+ path = get(this, 'state.path'),
+ object = get(this, 'object');
+ manager.transitionTo(path, object);
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get;
+
+// The Ember Routable mixin assumes the existance of a simple
+// routing shim that supports the following three behaviors:
+//
+// * .getURL() - this is called when the page loads
+// * .setURL(newURL) - this is called from within the state
+// manager when the state changes to a routable state
+// * .onURLChange(callback) - this happens when the user presses
+// the back or forward button
+
+var paramForClass = function(classObject) {
+ var className = classObject.toString(),
+ parts = className.split("."),
+ last = parts[parts.length - 1];
+
+ return Ember.String.underscore(last) + "_id";
+};
+
+var merge = function(original, hash) {
+ for (var prop in hash) {
+ if (!hash.hasOwnProperty(prop)) { continue; }
+ if (original.hasOwnProperty(prop)) { continue; }
+
+ original[prop] = hash[prop];
+ }
+};
+
+/**
+ @class
+ @extends Ember.Mixin
+*/
+Ember.Routable = Ember.Mixin.create({
+ init: function() {
+ var redirection;
+ this.on('connectOutlets', this, this.stashContext);
+
+ if (redirection = get(this, 'redirectsTo')) {
+ Ember.assert("You cannot use `redirectsTo` if you already have a `connectOutlets` method", this.connectOutlets === Ember.K);
+
+ this.connectOutlets = function(router) {
+ router.transitionTo(redirection);
+ };
+ }
+
+ // normalize empty route to '/'
+ var route = get(this, 'route');
+ if (route === '') {
+ route = '/';
+ }
+
+ this._super();
+
+ Ember.assert("You cannot use `redirectsTo` on a state that has child states", !redirection || (!!redirection && !!get(this, 'isLeaf')));
+ },
+
+ /**
+ @private
+
+ Whenever a routable state is entered, the context it was entered with
+ is stashed so that we can regenerate the state's `absoluteURL` on
+ demand.
+ */
+ stashContext: function(manager, context) {
+ var serialized = this.serialize(manager, context);
+ Ember.assert('serialize must return a hash', !serialized || typeof serialized === 'object');
+
+ manager.setStateMeta(this, 'context', context);
+ manager.setStateMeta(this, 'serialized', serialized);
+
+ if (get(this, 'isRoutable') && !get(manager, 'isRouting')) {
+ this.updateRoute(manager, get(manager, 'location'));
+ }
+ },
+
+ /**
+ @private
+
+ Whenever a routable state is entered, the router's location object
+ is notified to set the URL to the current absolute path.
+
+ In general, this will update the browser's URL.
+ */
+ updateRoute: function(manager, location) {
+ if (get(this, 'isLeafRoute')) {
+ var path = this.absoluteRoute(manager);
+ location.setURL(path);
+ }
+ },
+
+ /**
+ @private
+
+ Get the absolute route for the current state and a given
+ hash.
+
+ This method is private, as it expects a serialized hash,
+ not the original context object.
+ */
+ absoluteRoute: function(manager, hash) {
+ var parentState = get(this, 'parentState');
+ var path = '', generated;
+
+ // If the parent state is routable, use its current path
+ // as this route's prefix.
+ if (get(parentState, 'isRoutable')) {
+ path = parentState.absoluteRoute(manager, hash);
+ }
+
+ var matcher = get(this, 'routeMatcher'),
+ serialized = manager.getStateMeta(this, 'serialized');
+
+ // merge the existing serialized object in with the passed
+ // in hash.
+ hash = hash || {};
+ merge(hash, serialized);
+
+ generated = matcher && matcher.generate(hash);
+
+ if (generated) {
+ path = path + '/' + generated;
+ }
+
+ return path;
+ },
+
+ /**
+ @private
+
+ At the moment, a state is routable if it has a string `route`
+ property. This heuristic may change.
+ */
+ isRoutable: Ember.computed(function() {
+ return typeof get(this, 'route') === 'string';
+ }).cacheable(),
+
+ /**
+ @private
+
+ Determine if this is the last routeable state
+ */
+ isLeafRoute: Ember.computed(function() {
+ if (get(this, 'isLeaf')) { return true; }
+ return !get(this, 'childStates').findProperty('isRoutable');
+ }).cacheable(),
+
+ /**
+ @private
+
+ A _RouteMatcher object generated from the current route's `route`
+ string property.
+ */
+ routeMatcher: Ember.computed(function() {
+ var route = get(this, 'route');
+ if (route) {
+ return Ember._RouteMatcher.create({ route: route });
+ }
+ }).cacheable(),
+
+ /**
+ @private
+
+ Check whether the route has dynamic segments and therefore takes
+ a context.
+ */
+ hasContext: Ember.computed(function() {
+ var routeMatcher = get(this, 'routeMatcher');
+ if (routeMatcher) {
+ return routeMatcher.identifiers.length > 0;
+ }
+ }).cacheable(),
+
+ /**
+ @private
+
+ The model class associated with the current state. This property
+ uses the `modelType` property, in order to allow it to be
+ specified as a String.
+ */
+ modelClass: Ember.computed(function() {
+ var modelType = get(this, 'modelType');
+
+ if (typeof modelType === 'string') {
+ return Ember.get(window, modelType);
+ } else {
+ return modelType;
+ }
+ }).cacheable(),
+
+ /**
+ @private
+
+ Get the model class for the state. The heuristic is:
+
+ * The state must have a single dynamic segment
+ * The dynamic segment must end in `_id`
+ * A dynamic segment like `blog_post_id` is converted into `BlogPost`
+ * The name is then looked up on the passed in namespace
+
+ The process of initializing an application with a router will
+ pass the application's namespace into the router, which will be
+ used here.
+ */
+ modelClassFor: function(namespace) {
+ var modelClass, routeMatcher, identifiers, match, className;
+
+ // if an explicit modelType was specified, use that
+ if (modelClass = get(this, 'modelClass')) { return modelClass; }
+
+ // if the router has no lookup namespace, we won't be able to guess
+ // the modelType
+ if (!namespace) { return; }
+
+ // make sure this state is actually a routable state
+ routeMatcher = get(this, 'routeMatcher');
+ if (!routeMatcher) { return; }
+
+ // only guess modelType for states with a single dynamic segment
+ // (no more, no fewer)
+ identifiers = routeMatcher.identifiers;
+ if (identifiers.length !== 2) { return; }
+
+ // extract the `_id` from the end of the dynamic segment; if the
+ // dynamic segment does not end in `_id`, we can't guess the
+ // modelType
+ match = identifiers[1].match(/^(.*)_id$/);
+ if (!match) { return; }
+
+ // convert the underscored type into a class form and look it up
+ // on the router's namespace
+ className = Ember.String.classify(match[1]);
+ return get(namespace, className);
+ },
+
+ /**
+ The default method that takes a `params` object and converts
+ it into an object.
+
+ By default, a params hash that looks like `{ post_id: 1 }`
+ will be looked up as `namespace.Post.find(1)`. This is
+ designed to work seamlessly with Ember Data, but will work
+ fine with any class that has a `find` method.
+ */
+ deserialize: function(manager, params) {
+ var modelClass, routeMatcher, param;
+
+ if (modelClass = this.modelClassFor(get(manager, 'namespace'))) {
+ Ember.assert("Expected "+modelClass.toString()+" to implement `find` for use in '"+this.get('path')+"' `deserialize`. Please implement the `find` method or overwrite `deserialize`.", modelClass.find);
+ return modelClass.find(params[paramForClass(modelClass)]);
+ }
+
+ return params;
+ },
+
+ /**
+ The default method that takes an object and converts it into
+ a params hash.
+
+ By default, if there is a single dynamic segment named
+ `blog_post_id` and the object is a `BlogPost` with an
+ `id` of `12`, the serialize method will produce:
+
+ { blog_post_id: 12 }
+ */
+ serialize: function(manager, context) {
+ var modelClass, routeMatcher, namespace, param, id;
+
+ if (Ember.empty(context)) { return ''; }
+
+ if (modelClass = this.modelClassFor(get(manager, 'namespace'))) {
+ param = paramForClass(modelClass);
+ id = get(context, 'id');
+ context = {};
+ context[param] = id;
+ }
+
+ return context;
+ },
+
+ /**
+ @private
+ */
+ resolvePath: function(manager, path) {
+ if (get(this, 'isLeafRoute')) { return Ember.A(); }
+
+ var childStates = get(this, 'childStates'), match;
+
+ childStates = Ember.A(childStates.filterProperty('isRoutable'));
+
+ childStates = childStates.sort(function(a, b) {
+ var aDynamicSegments = get(a, 'routeMatcher.identifiers.length'),
+ bDynamicSegments = get(b, 'routeMatcher.identifiers.length'),
+ aRoute = get(a, 'route'),
+ bRoute = get(b, 'route');
+
+ if (aRoute.indexOf(bRoute) === 0) {
+ return -1;
+ } else if (bRoute.indexOf(aRoute) === 0) {
+ return 1;
+ }
+
+ if (aDynamicSegments !== bDynamicSegments) {
+ return aDynamicSegments - bDynamicSegments;
+ }
+
+ return get(b, 'route.length') - get(a, 'route.length');
+ });
+
+ var state = childStates.find(function(state) {
+ var matcher = get(state, 'routeMatcher');
+ if (match = matcher.match(path)) { return true; }
+ });
+
+ Ember.assert("Could not find state for path " + path, !!state);
+
+ var resolvedState = Ember._ResolvedState.create({
+ manager: manager,
+ state: state,
+ match: match
+ });
+
+ var states = state.resolvePath(manager, match.remaining);
+
+ return Ember.A([resolvedState]).pushObjects(states);
+ },
+
+ /**
+ @private
+
+ Once `unroute` has finished unwinding, `routePath` will be called
+ with the remainder of the route.
+
+ For example, if you were in the /posts/1/comments state, and you
+ moved into the /posts/2/comments state, `routePath` will be called
+ on the state whose path is `/posts` with the path `/2/comments`.
+ */
+ routePath: function(manager, path) {
+ if (get(this, 'isLeafRoute')) { return; }
+
+ var resolvedStates = this.resolvePath(manager, path),
+ hasPromises = resolvedStates.some(function(s) { return get(s, 'hasPromise'); });
+
+ function runTransition() {
+ resolvedStates.forEach(function(rs) { rs.transition(); });
+ }
+
+ if (hasPromises) {
+ manager.transitionTo('loading');
+
+ Ember.assert('Loading state should be the child of a route', Ember.Routable.detect(get(manager, 'currentState.parentState')));
+ Ember.assert('Loading state should not be a route', !Ember.Routable.detect(get(manager, 'currentState')));
+
+ manager.handleStatePromises(resolvedStates, runTransition);
+ } else {
+ runTransition();
+ }
+ },
+
+ /**
+ @private
+
+ When you move to a new route by pressing the back
+ or forward button, this method is called first.
+
+ Its job is to move the state manager into a parent
+ state of the state it will eventually move into.
+ */
+ unroutePath: function(router, path) {
+ var parentState = get(this, 'parentState');
+
+ // If we're at the root state, we're done
+ if (parentState === router) {
+ return;
+ }
+
+ path = path.replace(/^(?=[^\/])/, "/");
+ var absolutePath = this.absoluteRoute(router);
+
+ var route = get(this, 'route');
+
+ // If the current path is empty, move up one state,
+ // because the index ('/') state must be a leaf node.
+ if (route !== '/') {
+ // If the current path is a prefix of the path we're trying
+ // to go to, we're done.
+ var index = path.indexOf(absolutePath),
+ next = path.charAt(absolutePath.length);
+
+ if (index === 0 && (next === "/" || next === "")) {
+ return;
+ }
+ }
+
+ // Transition to the parent and call unroute again.
+ router.enterState({
+ exitStates: [this],
+ enterStates: [],
+ finalState: parentState
+ });
+
+ router.send('unroutePath', path);
+ },
+
+ /**
+ The `connectOutlets` event will be triggered once a
+ state has been entered. It will be called with the
+ route's context.
+ */
+ connectOutlets: Ember.K,
+
+ /**
+ The `navigateAway` event will be triggered when the
+ URL changes due to the back/forward button
+ */
+ navigateAway: Ember.K
+});
+
+})();
+
+
+
+(function() {
+/**
+ @class
+ @extends Ember.Routable
+*/
+Ember.Route = Ember.State.extend(Ember.Routable);
+
+})();
+
+
+
+(function() {
+var escapeForRegex = function(text) {
+ return text.replace(/[\-\[\]{}()*+?.,\\\^\$|#\s]/g, "\\$&");
+};
+
+Ember._RouteMatcher = Ember.Object.extend({
+ state: null,
+
+ init: function() {
+ var route = this.route,
+ identifiers = [],
+ count = 1,
+ escaped;
+
+ // Strip off leading slash if present
+ if (route.charAt(0) === '/') {
+ route = this.route = route.substr(1);
+ }
+
+ escaped = escapeForRegex(route);
+
+ var regex = escaped.replace(/:([a-z_]+)(?=$|\/)/gi, function(match, id) {
+ identifiers[count++] = id;
+ return "([^/]+)";
+ });
+
+ this.identifiers = identifiers;
+ this.regex = new RegExp("^/?" + regex);
+ },
+
+ match: function(path) {
+ var match = path.match(this.regex);
+
+ if (match) {
+ var identifiers = this.identifiers,
+ hash = {};
+
+ for (var i=1, l=identifiers.length; i<l; i++) {
+ hash[identifiers[i]] = match[i];
+ }
+
+ return {
+ remaining: path.substr(match[0].length),
+ hash: identifiers.length > 0 ? hash : null
+ };
+ }
+ },
+
+ generate: function(hash) {
+ var identifiers = this.identifiers, route = this.route, id;
+ for (var i=1, l=identifiers.length; i<l; i++) {
+ id = identifiers[i];
+ route = route.replace(new RegExp(":" + id), hash[id]);
+ }
+ return route;
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+var merge = function(original, hash) {
+ for (var prop in hash) {
+ if (!hash.hasOwnProperty(prop)) { continue; }
+ if (original.hasOwnProperty(prop)) { continue; }
+
+ original[prop] = hash[prop];
+ }
+};
+
+/**
+ @class
+
+ `Ember.Router` is the subclass of `Ember.StateManager` responsible for providing URL-based
+ application state detection. The `Ember.Router` instance of an application detects the browser URL
+ at application load time and attempts to match it to a specific application state. Additionally
+ the router will update the URL to reflect an application's state changes over time.
+
+ ## Adding a Router Instance to Your Application
+ An instance of Ember.Router can be associated with an instance of Ember.Application in one of two ways:
+
+ You can provide a subclass of Ember.Router as the `Router` property of your application. An instance
+ of this Router class will be instantiated and route detection will be enabled when the application's
+ `initialize` method is called. The Router instance will be available as the `router` property
+ of the application:
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({ ... })
+ });
+
+ App.initialize();
+ App.get('router') // an instance of App.Router
+
+ If you want to define a Router instance elsewhere, you can pass the instance to the application's
+ `initialize` method:
+
+ App = Ember.Application.create();
+ aRouter = Ember.Router.create({ ... });
+
+ App.initialize(aRouter);
+ App.get('router') // aRouter
+
+ ## Adding Routes to a Router
+ The `initialState` property of Ember.Router instances is named `root`. The state stored in this
+ property must be a subclass of Ember.Route. The `root` route acts as the container for the
+ set of routable states but is not routable itself. It should have states that are also subclasses
+ of Ember.Route which each have a `route` property describing the URL pattern you would like to detect.
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ index: Ember.Route.extend({
+ route: '/'
+ }),
+ ... additional Ember.Routes ...
+ })
+ })
+ });
+ App.initialize();
+
+
+ When an application loads, Ember will parse the URL and attempt to find an Ember.Route within
+ the application's states that matches. (The example URL-matching below will use the default
+ 'hash syntax' provided by `Ember.HashLocation`.)
+
+ In the following route structure:
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/'
+ }),
+ bRoute: Ember.Route.extend({
+ route: '/alphabeta'
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ Loading the page at the URL '#/' will detect the route property of 'root.aRoute' ('/') and
+ transition the router first to the state named 'root' and then to the substate 'aRoute'.
+
+ Respectively, loading the page at the URL '#/alphabeta' would detect the route property of
+ 'root.bRoute' ('/alphabeta') and transition the router first to the state named 'root' and
+ then to the substate 'bRoute'.
+
+ ## Adding Nested Routes to a Router
+ Routes can contain nested subroutes each with their own `route` property describing the nested
+ portion of the URL they would like to detect and handle. Router, like all instances of StateManager,
+ cannot call `transitonTo` with an intermediary state. To avoid transitioning the Router into an
+ intermediary state when detecting URLs, a Route with nested routes must define both a base `route`
+ property for itself and a child Route with a `route` property of `'/'` which will be transitioned
+ to when the base route is detected in the URL:
+
+ Given the following application code:
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/theBaseRouteForThisSet',
+
+ indexSubRoute: Ember.Route.extend({
+ route: '/',
+ }),
+
+ subRouteOne: Ember.Route.extend({
+ route: '/subroute1
+ }),
+
+ subRouteTwo: Ember.Route.extend({
+ route: '/subRoute2'
+ })
+
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ When the application is loaded at '/theBaseRouteForThisSet' the Router will transition to the route
+ at path 'root.aRoute' and then transition to state 'indexSubRoute'.
+
+ When the application is loaded at '/theBaseRouteForThisSet/subRoute1' the Router will transition to
+ the route at path 'root.aRoute' and then transition to state 'subRouteOne'.
+
+ ## Route Transition Events
+ Transitioning between Ember.Route instances (including the transition into the detected
+ route when loading the application) triggers the same transition events as state transitions for
+ base `Ember.State`s. However, the default `setup` transition event is named `connectOutlets` on
+ Ember.Router instances (see 'Changing View Hierarchy in Response To State Change').
+
+ The following route structure when loaded with the URL "#/"
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/',
+ enter: function(router) {
+ console.log("entering root.aRoute from", router.get('currentState.name'));
+ },
+ connectOutlets: function(router) {
+ console.log("entered root.aRoute, fully transitioned to", router.get('currentState.path'));
+ }
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ Will result in console output of:
+
+ 'entering root.aRoute from root'
+ 'entered root.aRoute, fully transitioned to root.aRoute '
+
+ Ember.Route has two additional callbacks for handling URL serialization and deserialization. See
+ 'Serializing/Deserializing URLs'
+
+ ## Routes With Dynamic Segments
+ An Ember.Route's `route` property can reference dynamic sections of the URL by prefacing a URL segment
+ with the ':' character. The values of these dynamic segments will be passed as a hash to the
+ `deserialize` method of the matching Route (see 'Serializing/Deserializing URLs').
+
+ ## Serializing/Deserializing URLs
+ Ember.Route has two callbacks for associating a particular object context with a URL: `serialize`
+ for converting an object into a parameters hash to fill dynamic segments of a URL and `deserialize`
+ for converting a hash of dynamic segments from the URL into the appropriate object.
+
+ ### Deserializing A URL's Dynamic Segments
+ When an application is first loaded or the URL is changed manually (e.g. through the browser's
+ back button) the `deserialize` method of the URL's matching Ember.Route will be called with
+ the application's router as its first argument and a hash of the URLs dynamic segments and values
+ as its second argument.
+
+ The following route structure when loaded with the URL "#/fixed/thefirstvalue/anotherFixed/thesecondvalue":
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/fixed/:dynamicSectionA/anotherFixed/:dynamicSectionB',
+ deserialize: function(router, params) {}
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ Will call the 'deserialize' method of the Route instance at the path 'root.aRoute' with the
+ following hash as its second argument:
+
+ {
+ dynamicSectionA: 'thefirstvalue',
+ dynamicSectionB: 'thesecondvalue'
+ }
+
+ Within `deserialize` you should use this information to retrieve or create an appropriate context
+ object for the given URL (e.g. by loading from a remote API or accessing the browser's
+ `localStorage`). This object must be the `return` value of `deserialize` and will be
+ passed to the Route's `connectOutlets` and `serialize` methods.
+
+ When an application's state is changed from within the application itself, the context provided for
+ the transition will be passed and `deserialize` is not called (see 'Transitions Between States').
+
+ ### Serializing An Object For URLs with Dynamic Segments
+ When transitioning into a Route whose `route` property contains dynamic segments the Route's
+ `serialize` method is called with the Route's router as the first argument and the Route's
+ context as the second argument. The return value of `serialize` will be use to populate the
+ dynamic segments and should be a object with keys that match the names of the dynamic sections.
+
+ Given the following route structure:
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/'
+ }),
+ bRoute: Ember.Route.extend({
+ route: '/staticSection/:someDynamicSegment',
+ serialize: function(router, context) {
+ return {
+ someDynamicSegment: context.get('name')
+ }
+ }
+ })
+ })
+ })
+ });
+ App.initialize();
+
+
+ Transitioning to "root.bRoute" with a context of `Object.create({name: 'Yehuda'})` will call
+ the Route's `serialize` method with the context as its second argument and update the URL to
+ '#/staticSection/Yehuda'.
+
+ ## Transitions Between States
+ Once a routed application has initialized its state based on the entry URL, subsequent transitions to other
+ states will update the URL if the entered Route has a `route` property. Given the following route structure
+ loaded at the URL '#/':
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/',
+ moveElsewhere: Ember.Route.transitionTo('bRoute')
+ }),
+ bRoute: Ember.Route.extend({
+ route: '/someOtherLocation'
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ And application code:
+
+ App.get('router').send('moveElsewhere');
+
+ Will transition the application's state to 'root.bRoute' and trigger an update of the URL to
+ '#/someOtherLocation'.
+
+ For URL patterns with dynamic segments a context can be supplied as the second argument to `send`.
+ The router will match dynamic segments names to keys on this object and fill in the URL with the
+ supplied values. Given the following state structure loaded at the URL '#/':
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/',
+ moveElsewhere: Ember.Route.transitionTo('bRoute')
+ }),
+ bRoute: Ember.Route.extend({
+ route: '/a/route/:dynamicSection/:anotherDynamicSection',
+ connectOutlets: function(router, context) {},
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ And application code:
+
+ App.get('router').send('moveElsewhere', {
+ dynamicSection: '42',
+ anotherDynamicSection: 'Life'
+ });
+
+ Will transition the application's state to 'root.bRoute' and trigger an update of the URL to
+ '#/a/route/42/Life'.
+
+ The context argument will also be passed as the second argument to the `serialize` method call.
+
+ ## Injection of Controller Singletons
+ During application initialization Ember will detect properties of the application ending in 'Controller',
+ create singleton instances of each class, and assign them as a properties on the router. The property name
+ will be the UpperCamel name converted to lowerCamel format. These controller classes should be subclasses
+ of Ember.ObjectController, Ember.ArrayController, Ember.Controller, or a custom Ember.Object that includes the
+ Ember.ControllerMixin mixin.
+
+ App = Ember.Application.create({
+ FooController: Ember.Object.create(Ember.ControllerMixin),
+ Router: Ember.Router.extend({ ... })
+ });
+
+ App.get('router.fooController'); // instance of App.FooController
+
+ The controller singletons will have their `namespace` property set to the application and their `target`
+ property set to the application's router singleton for easy integration with Ember's user event system.
+ See 'Changing View Hierarchy in Response To State Change' and 'Responding to User-initiated Events'
+
+ ## Responding to User-initiated Events
+ Controller instances injected into the router at application initialization have their `target` property
+ set to the application's router instance. These controllers will also be the default `context` for their
+ associated views. Uses of the `{{action}}` helper will automatically target the application's router.
+
+ Given the following application entered at the URL '#/':
+
+ App = Ember.Application.create({
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/',
+ anActionOnTheRouter: function(router, context) {
+ router.transitionTo('anotherState', context);
+ }
+ })
+ anotherState: Ember.Route.extend({
+ route: '/differentUrl',
+ connectOutlets: function(router, context) {
+
+ }
+ })
+ })
+ })
+ });
+ App.initialize();
+
+ The following template:
+
+ <script type="text/x-handlebars" data-template-name="aView">
+ <h1><a {{action anActionOnTheRouter}}>{{title}}</a></h1>
+ </script>
+
+ Will delegate `click` events on the rendered `h1` to the application's router instance. In this case the
+ `anActionOnTheRouter` method of the state at 'root.aRoute' will be called with the view's controller
+ as the context argument. This context will be passed to the `connectOutlets` as its second argument.
+
+ Different `context` can be supplied from within the `{{action}}` helper, allowing specific context passing
+ between application states:
+
+ <script type="text/x-handlebars" data-template-name="photos">
+ {{#each photo in controller}}
+ <h1><a {{action showPhoto photo}}>{{title}}</a></h1>
+ {{/each}}
+ </script>
+
+ See Handlebars.helpers.action for additional usage examples.
+
+
+ ## Changing View Hierarchy in Response To State Change
+ Changes in application state that change the URL should be accompanied by associated changes in view
+ hierarchy. This can be accomplished by calling 'connectOutlet' on the injected controller singletons from
+ within the 'connectOutlets' event of an Ember.Route:
+
+ App = Ember.Application.create({
+ OneController: Ember.ObjectController.extend(),
+ OneView: Ember.View.extend(),
+
+ AnotherController: Ember.ObjectController.extend(),
+ AnotherView: Ember.View.extend(),
+
+ Router: Ember.Router.extend({
+ root: Ember.Route.extend({
+ aRoute: Ember.Route.extend({
+ route: '/',
+ connectOutlets: function(router, context) {
+ router.get('oneController').connectOutlet('another');
+ },
+ })
+ })
+ })
+ });
+ App.initialize();
+
+
+ This will detect the '{{outlet}}' portion of `oneController`'s view (an instance of `App.OneView`) and
+ fill it with a rendered instance of `App.AnotherView` whose `context` will be the single instance of
+ `App.AnotherController` stored on the router in the `anotherController` property.
+
+ For more information about Outlets, see `Ember.Handlebars.helpers.outlet`. For additional information on
+ the `connectOutlet` method, see `Ember.Controller.connectOutlet`. For more information on
+ controller injections, see `Ember.Application#initialize()`. For additional information about view context,
+ see `Ember.View`.
+
+ @extends Ember.StateManager
+*/
+Ember.Router = Ember.StateManager.extend(
+/** @scope Ember.Router.prototype */ {
+
+ /**
+ @property {String}
+ @default 'root'
+ */
+ initialState: 'root',
+
+ /**
+ The `Ember.Location` implementation to be used to manage the application
+ URL state. The following values are supported:
+
+ * 'hash': Uses URL fragment identifiers (like #/blog/1) for routing.
+ * 'none': Does not read or set the browser URL, but still allows for
+ routing to happen. Useful for testing.
+
+ @type String
+ @default 'hash'
+ */
+ location: 'hash',
+
+ /**
+ This is only used when a history location is used so that applications that
+ don't live at the root of the domain can append paths to their root.
+
+ @type String
+ @default '/'
+ */
+
+ rootURL: '/',
+
+ /**
+ On router, transitionEvent should be called connectOutlets
+
+ @property {String}
+ @default 'connectOutlets'
+ */
+ transitionEvent: 'connectOutlets',
+
+ transitionTo: function() {
+ this.abortRoutingPromises();
+ this._super.apply(this, arguments);
+ },
+
+ route: function(path) {
+ this.abortRoutingPromises();
+
+ set(this, 'isRouting', true);
+
+ var routableState;
+
+ try {
+ path = path.replace(/^(?=[^\/])/, "/");
+
+ this.send('navigateAway');
+ this.send('unroutePath', path);
+
+ routableState = get(this, 'currentState');
+ while (routableState && !routableState.get('isRoutable')) {
+ routableState = get(routableState, 'parentState');
+ }
+ var currentURL = routableState ? routableState.absoluteRoute(this) : '';
+ var rest = path.substr(currentURL.length);
+
+ this.send('routePath', rest);
+ } finally {
+ set(this, 'isRouting', false);
+ }
+
+ routableState = get(this, 'currentState');
+ while (routableState && !routableState.get('isRoutable')) {
+ routableState = get(routableState, 'parentState');
+ }
+
+ if (routableState) {
+ routableState.updateRoute(this, get(this, 'location'));
+ }
+ },
+
+ urlFor: function(path, hash) {
+ var currentState = get(this, 'currentState') || this,
+ state = this.findStateByPath(currentState, path);
+
+ Ember.assert(Ember.String.fmt("Could not find route with path '%@'", [path]), !!state);
+ Ember.assert("To get a URL for a state, it must have a `route` property.", !!get(state, 'routeMatcher'));
+
+ var location = get(this, 'location'),
+ absoluteRoute = state.absoluteRoute(this, hash);
+
+ return location.formatURL(absoluteRoute);
+ },
+
+ urlForEvent: function(eventName) {
+ var contexts = Array.prototype.slice.call(arguments, 1);
+ var currentState = get(this, 'currentState');
+ var targetStateName = currentState.lookupEventTransition(eventName);
+
+ Ember.assert(Ember.String.fmt("You must specify a target state for event '%@' in order to link to it in the current state '%@'.", [eventName, get(currentState, 'path')]), !!targetStateName);
+
+ var targetState = this.findStateByPath(currentState, targetStateName);
+
+ Ember.assert("Your target state name " + targetStateName + " for event " + eventName + " did not resolve to a state", !!targetState);
+
+ var hash = this.serializeRecursively(targetState, contexts, {});
+
+ return this.urlFor(targetStateName, hash);
+ },
+
+ /** @private */
+ serializeRecursively: function(state, contexts, hash) {
+ var parentState,
+ context = get(state, 'hasContext') ? contexts.pop() : null;
+ merge(hash, state.serialize(this, context));
+ parentState = state.get("parentState");
+ if (parentState && parentState instanceof Ember.Route) {
+ return this.serializeRecursively(parentState, contexts, hash);
+ } else {
+ return hash;
+ }
+ },
+
+ abortRoutingPromises: function() {
+ if (this._routingPromises) {
+ this._routingPromises.abort();
+ this._routingPromises = null;
+ }
+ },
+
+ /**
+ @private
+ */
+ handleStatePromises: function(states, complete) {
+ this.abortRoutingPromises();
+
+ this.set('isLocked', true);
+
+ var manager = this;
+
+ this._routingPromises = Ember._PromiseChain.create({
+ promises: states.slice(),
+
+ successCallback: function() {
+ manager.set('isLocked', false);
+ complete();
+ },
+
+ failureCallback: function() {
+ throw "Unable to load object";
+ },
+
+ promiseSuccessCallback: function(item, args) {
+ set(item, 'object', args[0]);
+ },
+
+ abortCallback: function() {
+ manager.set('isLocked', false);
+ }
+ }).start();
+ },
+
+ /** @private */
+ init: function() {
+ this._super();
+
+ var location = get(this, 'location'),
+ rootURL = get(this, 'rootURL');
+
+ if ('string' === typeof location) {
+ set(this, 'location', Ember.Location.create({
+ implementation: location,
+ rootURL: rootURL
+ }));
+ }
+ },
+
+ /** @private */
+ willDestroy: function() {
+ get(this, 'location').destroy();
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Routing
+// Copyright: ©2012 Tilde Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+(function() {
+var get = Ember.get;
+
+Ember.StateManager.reopen(
+/** @scope Ember.StateManager.prototype */ {
+
+ /**
+ If the current state is a view state or the descendent of a view state,
+ this property will be the view associated with it. If there is no
+ view state active in this state manager, this value will be null.
+
+ @type Ember.View
+ */
+ currentView: Ember.computed(function() {
+ var currentState = get(this, 'currentState'),
+ view;
+
+ while (currentState) {
+ // TODO: Remove this when view state is removed
+ if (get(currentState, 'isViewState')) {
+ view = get(currentState, 'view');
+ if (view) { return view; }
+ }
+
+ currentState = get(currentState, 'parentState');
+ }
+
+ return null;
+ }).property('currentState').cacheable()
+
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+/**
+ @class
+ @deprecated
+
+ Ember.ViewState extends Ember.State to control the presence of a childView within a
+ container based on the current state of the ViewState's StateManager.
+
+ ## Interactions with Ember's View System.
+ When combined with instances of `Ember.StateManager`, ViewState is designed to
+ interact with Ember's view system to control which views are added to
+ and removed from the DOM based on the manager's current state.
+
+ By default, a StateManager will manage views inside the 'body' element. This can be
+ customized by setting the `rootElement` property to a CSS selector of an existing
+ HTML element you would prefer to receive view rendering.
+
+
+ viewStates = Ember.StateManager.create({
+ rootElement: '#some-other-element'
+ })
+
+ You can also specify a particular instance of `Ember.ContainerView` you would like to receive
+ view rendering by setting the `rootView` property. You will be responsible for placing
+ this element into the DOM yourself.
+
+ aLayoutView = Ember.ContainerView.create()
+
+ // make sure this view instance is added to the browser
+ aLayoutView.appendTo('body')
+
+ App.viewStates = Ember.StateManager.create({
+ rootView: aLayoutView
+ })
+
+
+ Once you have an instance of StateManager controlling a view, you can provide states
+ that are instances of `Ember.ViewState`. When the StateManager enters a state
+ that is an instance of `Ember.ViewState` that `ViewState`'s `view` property will be
+ instantiated and inserted into the StateManager's `rootView` or `rootElement`.
+ When a state is exited, the `ViewState`'s view will be removed from the StateManager's
+ view.
+
+ ContactListView = Ember.View.extend({
+ classNames: ['my-contacts-css-class'],
+ template: Ember.Handlebars.compile('<h2>People</h2>')
+ })
+
+ PhotoListView = Ember.View.extend({
+ classNames: ['my-photos-css-class'],
+ template: Ember.Handlebars.compile('<h2>Photos</h2>')
+ })
+
+ viewStates = Ember.StateManager.create({
+ showingPeople: Ember.ViewState.create({
+ view: ContactListView
+ }),
+ showingPhotos: Ember.ViewState.create({
+ view: PhotoListView
+ })
+ })
+
+ viewStates.transitionTo('showingPeople')
+
+ The above code will change the rendered HTML from
+
+ <body></body>
+
+ to
+
+ <body>
+ <div id="ember1" class="ember-view my-contacts-css-class">
+ <h2>People</h2>
+ </div>
+ </body>
+
+ Changing the current state via `transitionTo` from `showingPeople` to
+ `showingPhotos` will remove the `showingPeople` view and add the `showingPhotos` view:
+
+ viewStates.transitionTo('showingPhotos')
+
+ will change the rendered HTML to
+
+ <body>
+ <div id="ember2" class="ember-view my-photos-css-class">
+ <h2>Photos</h2>
+ </div>
+ </body>
+
+
+ When entering nested `ViewState`s, each state's view will be draw into the the StateManager's
+ `rootView` or `rootElement` as siblings.
+
+
+ ContactListView = Ember.View.extend({
+ classNames: ['my-contacts-css-class'],
+ template: Ember.Handlebars.compile('<h2>People</h2>')
+ })
+
+ EditAContactView = Ember.View.extend({
+ classNames: ['editing-a-contact-css-class'],
+ template: Ember.Handlebars.compile('Editing...')
+ })
+
+ viewStates = Ember.StateManager.create({
+ showingPeople: Ember.ViewState.create({
+ view: ContactListView,
+
+ withEditingPanel: Ember.ViewState.create({
+ view: EditAContactView
+ })
+ })
+ })
+
+
+ viewStates.transitionTo('showingPeople.withEditingPanel')
+
+
+ Will result in the following rendered HTML:
+
+ <body>
+ <div id="ember2" class="ember-view my-contacts-css-class">
+ <h2>People</h2>
+ </div>
+
+ <div id="ember2" class="ember-view editing-a-contact-css-class">
+ Editing...
+ </div>
+ </body>
+
+
+ ViewState views are added and removed from their StateManager's view via their
+ `enter` and `exit` methods. If you need to override these methods, be sure to call
+ `_super` to maintain the adding and removing behavior:
+
+ viewStates = Ember.StateManager.create({
+ aState: Ember.ViewState.create({
+ view: Ember.View.extend({}),
+ enter: function(manager){
+ // calling _super ensures this view will be
+ // properly inserted
+ this._super(manager);
+
+ // now you can do other things
+ }
+ })
+ })
+
+ ## Managing Multiple Sections of A Page With States
+ Multiple StateManagers can be combined to control multiple areas of an application's rendered views.
+ Given the following HTML body:
+
+ <body>
+ <div id='sidebar-nav'>
+ </div>
+ <div id='content-area'>
+ </div>
+ </body>
+
+ You could separately manage view state for each section with two StateManagers
+
+ navigationStates = Ember.StateManager.create({
+ rootElement: '#sidebar-nav',
+ userAuthenticated: Em.ViewState.create({
+ view: Ember.View.extend({})
+ }),
+ userNotAuthenticated: Em.ViewState.create({
+ view: Ember.View.extend({})
+ })
+ })
+
+ contentStates = Ember.StateManager.create({
+ rootElement: '#content-area',
+ books: Em.ViewState.create({
+ view: Ember.View.extend({})
+ }),
+ music: Em.ViewState.create({
+ view: Ember.View.extend({})
+ })
+ })
+
+
+ If you prefer to start with an empty body and manage state programmatically you
+ can also take advantage of StateManager's `rootView` property and the ability of
+ `Ember.ContainerView`s to manually manage their child views.
+
+
+ dashboard = Ember.ContainerView.create({
+ childViews: ['navigationAreaView', 'contentAreaView'],
+ navigationAreaView: Ember.ContainerView.create({}),
+ contentAreaView: Ember.ContainerView.create({})
+ })
+
+ navigationStates = Ember.StateManager.create({
+ rootView: dashboard.get('navigationAreaView'),
+ userAuthenticated: Em.ViewState.create({
+ view: Ember.View.extend({})
+ }),
+ userNotAuthenticated: Em.ViewState.create({
+ view: Ember.View.extend({})
+ })
+ })
+
+ contentStates = Ember.StateManager.create({
+ rootView: dashboard.get('contentAreaView'),
+ books: Em.ViewState.create({
+ view: Ember.View.extend({})
+ }),
+ music: Em.ViewState.create({
+ view: Ember.View.extend({})
+ })
+ })
+
+ dashboard.appendTo('body')
+
+ ## User Manipulation of State via `{{action}}` Helpers
+ The Handlebars `{{action}}` helper is StateManager-aware and will use StateManager action sending
+ to connect user interaction to action-based state transitions.
+
+ Given the following body and handlebars template
+
+ <body>
+ <script type='text/x-handlebars'>
+ <a href="#" {{action "anAction" target="App.appStates"}}> Go </a>
+ </script>
+ </body>
+
+ And application code
+
+ App = Ember.Application.create()
+ App.appStates = Ember.StateManager.create({
+ initialState: 'aState',
+ aState: Ember.State.create({
+ anAction: function(manager, context){}
+ }),
+ bState: Ember.State.create({})
+ })
+
+ A user initiated click or touch event on "Go" will trigger the 'anAction' method of
+ `App.appStates.aState` with `App.appStates` as the first argument and a
+ `jQuery.Event` object as the second object. The `jQuery.Event` will include a property
+ `view` that references the `Ember.View` object that was interacted with.
+
+**/
+Ember.ViewState = Ember.State.extend(
+/** @scope Ember.ViewState.prototype */ {
+ isViewState: true,
+
+ init: function() {
+ Ember.deprecate("Ember.ViewState is deprecated and will be removed from future releases. Consider using the outlet pattern to display nested views instead. For more information, see http://emberjs.com/guides/outlets/.");
+ return this._super();
+ },
+
+ enter: function(stateManager) {
+ var view = get(this, 'view'), root, childViews;
+
+ if (view) {
+ if (Ember.View.detect(view)) {
+ view = view.create();
+ set(this, 'view', view);
+ }
+
+ Ember.assert('view must be an Ember.View', view instanceof Ember.View);
+
+ root = stateManager.get('rootView');
+
+ if (root) {
+ childViews = get(root, 'childViews');
+ childViews.pushObject(view);
+ } else {
+ root = stateManager.get('rootElement') || 'body';
+ view.appendTo(root);
+ }
+ }
+ },
+
+ exit: function(stateManager) {
+ var view = get(this, 'view');
+
+ if (view) {
+ // If the view has a parent view, then it is
+ // part of a view hierarchy and should be removed
+ // from its parent.
+ if (get(view, 'parentView')) {
+ view.removeFromParent();
+ } else {
+
+ // Otherwise, the view is a "root view" and
+ // was appended directly to the DOM.
+ view.remove();
+ }
+ }
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Statecharts
+// Copyright: ©2011 Living Social Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+(function() {
+// ==========================================================================
+// Project: metamorph
+// Copyright: ©2011 My Company Inc. All rights reserved.
+// ==========================================================================
+
+(function(window) {
+
+ var K = function(){},
+ guid = 0,
+ document = window.document,
+
+ // Feature-detect the W3C range API, the extended check is for IE9 which only partially supports ranges
+ supportsRange = ('createRange' in document) && (typeof Range !== 'undefined') && Range.prototype.createContextualFragment,
+
+ // Internet Explorer prior to 9 does not allow setting innerHTML if the first element
+ // is a "zero-scope" element. This problem can be worked around by making
+ // the first node an invisible text node. We, like Modernizr, use &shy;
+ needsShy = (function(){
+ var testEl = document.createElement('div');
+ testEl.innerHTML = "<div></div>";
+ testEl.firstChild.innerHTML = "<script></script>";
+ return testEl.firstChild.innerHTML === '';
+ })();
+
+ // Constructor that supports either Metamorph('foo') or new
+ // Metamorph('foo');
+ //
+ // Takes a string of HTML as the argument.
+
+ var Metamorph = function(html) {
+ var self;
+
+ if (this instanceof Metamorph) {
+ self = this;
+ } else {
+ self = new K();
+ }
+
+ self.innerHTML = html;
+ var myGuid = 'metamorph-'+(guid++);
+ self.start = myGuid + '-start';
+ self.end = myGuid + '-end';
+
+ return self;
+ };
+
+ K.prototype = Metamorph.prototype;
+
+ var rangeFor, htmlFunc, removeFunc, outerHTMLFunc, appendToFunc, afterFunc, prependFunc, startTagFunc, endTagFunc;
+
+ outerHTMLFunc = function() {
+ return this.startTag() + this.innerHTML + this.endTag();
+ };
+
+ startTagFunc = function() {
+ return "<script id='" + this.start + "' type='text/x-placeholder'></script>";
+ };
+
+ endTagFunc = function() {
+ return "<script id='" + this.end + "' type='text/x-placeholder'></script>";
+ };
+
+ // If we have the W3C range API, this process is relatively straight forward.
+ if (supportsRange) {
+
+ // Get a range for the current morph. Optionally include the starting and
+ // ending placeholders.
+ rangeFor = function(morph, outerToo) {
+ var range = document.createRange();
+ var before = document.getElementById(morph.start);
+ var after = document.getElementById(morph.end);
+
+ if (outerToo) {
+ range.setStartBefore(before);
+ range.setEndAfter(after);
+ } else {
+ range.setStartAfter(before);
+ range.setEndBefore(after);
+ }
+
+ return range;
+ };
+
+ htmlFunc = function(html, outerToo) {
+ // get a range for the current metamorph object
+ var range = rangeFor(this, outerToo);
+
+ // delete the contents of the range, which will be the
+ // nodes between the starting and ending placeholder.
+ range.deleteContents();
+
+ // create a new document fragment for the HTML
+ var fragment = range.createContextualFragment(html);
+
+ // insert the fragment into the range
+ range.insertNode(fragment);
+ };
+
+ removeFunc = function() {
+ // get a range for the current metamorph object including
+ // the starting and ending placeholders.
+ var range = rangeFor(this, true);
+
+ // delete the entire range.
+ range.deleteContents();
+ };
+
+ appendToFunc = function(node) {
+ var range = document.createRange();
+ range.setStart(node);
+ range.collapse(false);
+ var frag = range.createContextualFragment(this.outerHTML());
+ node.appendChild(frag);
+ };
+
+ afterFunc = function(html) {
+ var range = document.createRange();
+ var after = document.getElementById(this.end);
+
+ range.setStartAfter(after);
+ range.setEndAfter(after);
+
+ var fragment = range.createContextualFragment(html);
+ range.insertNode(fragment);
+ };
+
+ prependFunc = function(html) {
+ var range = document.createRange();
+ var start = document.getElementById(this.start);
+
+ range.setStartAfter(start);
+ range.setEndAfter(start);
+
+ var fragment = range.createContextualFragment(html);
+ range.insertNode(fragment);
+ };
+
+ } else {
+ /**
+ * This code is mostly taken from jQuery, with one exception. In jQuery's case, we
+ * have some HTML and we need to figure out how to convert it into some nodes.
+ *
+ * In this case, jQuery needs to scan the HTML looking for an opening tag and use
+ * that as the key for the wrap map. In our case, we know the parent node, and
+ * can use its type as the key for the wrap map.
+ **/
+ var wrapMap = {
+ select: [ 1, "<select multiple='multiple'>", "</select>" ],
+ fieldset: [ 1, "<fieldset>", "</fieldset>" ],
+ table: [ 1, "<table>", "</table>" ],
+ tbody: [ 2, "<table><tbody>", "</tbody></table>" ],
+ tr: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ colgroup: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ map: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ };
+
+ /**
+ * Given a parent node and some HTML, generate a set of nodes. Return the first
+ * node, which will allow us to traverse the rest using nextSibling.
+ *
+ * We need to do this because innerHTML in IE does not really parse the nodes.
+ **/
+ var firstNodeFor = function(parentNode, html) {
+ var arr = wrapMap[parentNode.tagName.toLowerCase()] || wrapMap._default;
+ var depth = arr[0], start = arr[1], end = arr[2];
+
+ if (needsShy) { html = '&shy;'+html; }
+
+ var element = document.createElement('div');
+ element.innerHTML = start + html + end;
+
+ for (var i=0; i<=depth; i++) {
+ element = element.firstChild;
+ }
+
+ // Look for &shy; to remove it.
+ if (needsShy) {
+ var shyElement = element;
+
+ // Sometimes we get nameless elements with the shy inside
+ while (shyElement.nodeType === 1 && !shyElement.nodeName) {
+ shyElement = shyElement.firstChild;
+ }
+
+ // At this point it's the actual unicode character.
+ if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
+ shyElement.nodeValue = shyElement.nodeValue.slice(1);
+ }
+ }
+
+ return element;
+ };
+
+ /**
+ * In some cases, Internet Explorer can create an anonymous node in
+ * the hierarchy with no tagName. You can create this scenario via:
+ *
+ * div = document.createElement("div");
+ * div.innerHTML = "<table>&shy<script></script><tr><td>hi</td></tr></table>";
+ * div.firstChild.firstChild.tagName //=> ""
+ *
+ * If our script markers are inside such a node, we need to find that
+ * node and use *it* as the marker.
+ **/
+ var realNode = function(start) {
+ while (start.parentNode.tagName === "") {
+ start = start.parentNode;
+ }
+
+ return start;
+ };
+
+ /**
+ * When automatically adding a tbody, Internet Explorer inserts the
+ * tbody immediately before the first <tr>. Other browsers create it
+ * before the first node, no matter what.
+ *
+ * This means the the following code:
+ *
+ * div = document.createElement("div");
+ * div.innerHTML = "<table><script id='first'></script><tr><td>hi</td></tr><script id='last'></script></table>
+ *
+ * Generates the following DOM in IE:
+ *
+ * + div
+ * + table
+ * - script id='first'
+ * + tbody
+ * + tr
+ * + td
+ * - "hi"
+ * - script id='last'
+ *
+ * Which means that the two script tags, even though they were
+ * inserted at the same point in the hierarchy in the original
+ * HTML, now have different parents.
+ *
+ * This code reparents the first script tag by making it the tbody's
+ * first child.
+ **/
+ var fixParentage = function(start, end) {
+ if (start.parentNode !== end.parentNode) {
+ end.parentNode.insertBefore(start, end.parentNode.firstChild);
+ }
+ };
+
+ htmlFunc = function(html, outerToo) {
+ // get the real starting node. see realNode for details.
+ var start = realNode(document.getElementById(this.start));
+ var end = document.getElementById(this.end);
+ var parentNode = end.parentNode;
+ var node, nextSibling, last;
+
+ // make sure that the start and end nodes share the same
+ // parent. If not, fix it.
+ fixParentage(start, end);
+
+ // remove all of the nodes after the starting placeholder and
+ // before the ending placeholder.
+ node = start.nextSibling;
+ while (node) {
+ nextSibling = node.nextSibling;
+ last = node === end;
+
+ // if this is the last node, and we want to remove it as well,
+ // set the `end` node to the next sibling. This is because
+ // for the rest of the function, we insert the new nodes
+ // before the end (note that insertBefore(node, null) is
+ // the same as appendChild(node)).
+ //
+ // if we do not want to remove it, just break.
+ if (last) {
+ if (outerToo) { end = node.nextSibling; } else { break; }
+ }
+
+ node.parentNode.removeChild(node);
+
+ // if this is the last node and we didn't break before
+ // (because we wanted to remove the outer nodes), break
+ // now.
+ if (last) { break; }
+
+ node = nextSibling;
+ }
+
+ // get the first node for the HTML string, even in cases like
+ // tables and lists where a simple innerHTML on a div would
+ // swallow some of the content.
+ node = firstNodeFor(start.parentNode, html);
+
+ // copy the nodes for the HTML between the starting and ending
+ // placeholder.
+ while (node) {
+ nextSibling = node.nextSibling;
+ parentNode.insertBefore(node, end);
+ node = nextSibling;
+ }
+ };
+
+ // remove the nodes in the DOM representing this metamorph.
+ //
+ // this includes the starting and ending placeholders.
+ removeFunc = function() {
+ var start = realNode(document.getElementById(this.start));
+ var end = document.getElementById(this.end);
+
+ this.html('');
+ start.parentNode.removeChild(start);
+ end.parentNode.removeChild(end);
+ };
+
+ appendToFunc = function(parentNode) {
+ var node = firstNodeFor(parentNode, this.outerHTML());
+
+ while (node) {
+ nextSibling = node.nextSibling;
+ parentNode.appendChild(node);
+ node = nextSibling;
+ }
+ };
+
+ afterFunc = function(html) {
+ // get the real starting node. see realNode for details.
+ var end = document.getElementById(this.end);
+ var insertBefore = end.nextSibling;
+ var parentNode = end.parentNode;
+ var nextSibling;
+ var node;
+
+ // get the first node for the HTML string, even in cases like
+ // tables and lists where a simple innerHTML on a div would
+ // swallow some of the content.
+ node = firstNodeFor(parentNode, html);
+
+ // copy the nodes for the HTML between the starting and ending
+ // placeholder.
+ while (node) {
+ nextSibling = node.nextSibling;
+ parentNode.insertBefore(node, insertBefore);
+ node = nextSibling;
+ }
+ };
+
+ prependFunc = function(html) {
+ var start = document.getElementById(this.start);
+ var parentNode = start.parentNode;
+ var nextSibling;
+ var node;
+
+ node = firstNodeFor(parentNode, html);
+ var insertBefore = start.nextSibling;
+
+ while (node) {
+ nextSibling = node.nextSibling;
+ parentNode.insertBefore(node, insertBefore);
+ node = nextSibling;
+ }
+ }
+ }
+
+ Metamorph.prototype.html = function(html) {
+ this.checkRemoved();
+ if (html === undefined) { return this.innerHTML; }
+
+ htmlFunc.call(this, html);
+
+ this.innerHTML = html;
+ };
+
+ Metamorph.prototype.replaceWith = function(html) {
+ this.checkRemoved();
+ htmlFunc.call(this, html, true);
+ };
+
+ Metamorph.prototype.remove = removeFunc;
+ Metamorph.prototype.outerHTML = outerHTMLFunc;
+ Metamorph.prototype.appendTo = appendToFunc;
+ Metamorph.prototype.after = afterFunc;
+ Metamorph.prototype.prepend = prependFunc;
+ Metamorph.prototype.startTag = startTagFunc;
+ Metamorph.prototype.endTag = endTagFunc;
+
+ Metamorph.prototype.isRemoved = function() {
+ var before = document.getElementById(this.start);
+ var after = document.getElementById(this.end);
+
+ return !before || !after;
+ };
+
+ Metamorph.prototype.checkRemoved = function() {
+ if (this.isRemoved()) {
+ throw new Error("Cannot perform operations on a Metamorph that is not in the DOM.");
+ }
+ };
+
+ window.Metamorph = Metamorph;
+})(this);
+
+
+})();
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+var objectCreate = Ember.create;
+
+/**
+ @namespace
+ @name Handlebars
+ @private
+*/
+
+/**
+ @namespace
+ @name Handlebars.helpers
+ @description Helpers for Handlebars templates
+*/
+
+Ember.assert("Ember Handlebars requires Handlebars 1.0.beta.5 or greater", window.Handlebars && window.Handlebars.VERSION.match(/^1\.0\.beta\.[56789]$|^1\.0\.rc\.[123456789]+/));
+
+/**
+ @class
+
+ Prepares the Handlebars templating library for use inside Ember's view
+ system.
+
+ The Ember.Handlebars object is the standard Handlebars library, extended to use
+ Ember's get() method instead of direct property access, which allows
+ computed properties to be used inside templates.
+
+ To create an Ember.Handlebars template, call Ember.Handlebars.compile(). This will
+ return a function that can be used by Ember.View for rendering.
+*/
+Ember.Handlebars = objectCreate(Handlebars);
+
+Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
+
+/**
+ Override the the opcode compiler and JavaScript compiler for Handlebars.
+ @private
+*/
+Ember.Handlebars.Compiler = function() {};
+Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
+Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
+
+/** @private */
+Ember.Handlebars.JavaScriptCompiler = function() {};
+Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
+Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
+Ember.Handlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars";
+
+
+Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {
+ return "''";
+};
+
+/**
+ Override the default buffer for Ember Handlebars. By default, Handlebars creates
+ an empty String at the beginning of each invocation and appends to it. Ember's
+ Handlebars overrides this to append to a single shared buffer.
+
+ @private
+*/
+Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {
+ return "data.buffer.push("+string+");";
+};
+
+/**
+ Rewrite simple mustaches from {{foo}} to {{bind "foo"}}. This means that all simple
+ mustaches in Ember's Handlebars will also set up an observer to keep the DOM
+ up to date when the underlying property changes.
+
+ @private
+*/
+Ember.Handlebars.Compiler.prototype.mustache = function(mustache) {
+ if (mustache.params.length || mustache.hash) {
+ return Handlebars.Compiler.prototype.mustache.call(this, mustache);
+ } else {
+ var id = new Handlebars.AST.IdNode(['_triageMustache']);
+
+ // Update the mustache node to include a hash value indicating whether the original node
+ // was escaped. This will allow us to properly escape values when the underlying value
+ // changes and we need to re-render the value.
+ if(!mustache.escaped) {
+ mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
+ mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]);
+ }
+ mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);
+ return Handlebars.Compiler.prototype.mustache.call(this, mustache);
+ }
+};
+
+/**
+ Used for precompilation of Ember Handlebars templates. This will not be used during normal
+ app execution.
+
+ @param {String} string The template to precompile
+*/
+Ember.Handlebars.precompile = function(string) {
+ var ast = Handlebars.parse(string);
+
+ var options = {
+ knownHelpers: {
+ action: true,
+ unbound: true,
+ bindAttr: true,
+ template: true,
+ view: true,
+ _triageMustache: true
+ },
+ data: true,
+ stringParams: true
+ };
+
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
+ return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
+};
+
+/**
+ The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on
+ template-local data and String parameters.
+
+ @param {String} string The template to compile
+*/
+Ember.Handlebars.compile = function(string) {
+ var ast = Handlebars.parse(string);
+ var options = { data: true, stringParams: true };
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
+ var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
+
+ return Handlebars.template(templateSpec);
+};
+
+/**
+ If a path starts with a reserved keyword, returns the root
+ that should be used.
+
+ @private
+*/
+var normalizePath = Ember.Handlebars.normalizePath = function(root, path, data) {
+ var keywords = (data && data.keywords) || {},
+ keyword, isKeyword;
+
+ // Get the first segment of the path. For example, if the
+ // path is "foo.bar.baz", returns "foo".
+ keyword = path.split('.', 1)[0];
+
+ // Test to see if the first path is a keyword that has been
+ // passed along in the view's data hash. If so, we will treat
+ // that object as the new root.
+ if (keywords.hasOwnProperty(keyword)) {
+ // Look up the value in the template's data hash.
+ root = keywords[keyword];
+ isKeyword = true;
+
+ // Handle cases where the entire path is the reserved
+ // word. In that case, return the object itself.
+ if (path === keyword) {
+ path = '';
+ } else {
+ // Strip the keyword from the path and look up
+ // the remainder from the newly found root.
+ path = path.substr(keyword.length+1);
+ }
+ }
+
+ return { root: root, path: path, isKeyword: isKeyword };
+};
+/**
+ Lookup both on root and on window. If the path starts with
+ a keyword, the corresponding object will be looked up in the
+ template's data hash and used to resolve the path.
+
+ @param {Object} root The object to look up the property on
+ @param {String} path The path to be lookedup
+ @param {Object} options The template's option hash
+*/
+
+Ember.Handlebars.getPath = function(root, path, options) {
+ var data = options && options.data,
+ normalizedPath = normalizePath(root, path, data),
+ value;
+
+ // In cases where the path begins with a keyword, change the
+ // root to the value represented by that keyword, and ensure
+ // the path is relative to it.
+ root = normalizedPath.root;
+ path = normalizedPath.path;
+
+ value = Ember.get(root, path);
+
+ if (value === undefined && root !== window && Ember.isGlobalPath(path)) {
+ value = Ember.get(window, path);
+ }
+ return value;
+};
+
+/**
+ Registers a helper in Handlebars that will be called if no property with the
+ given name can be found on the current context object, and no helper with
+ that name is registered.
+
+ This throws an exception with a more helpful error message so the user can
+ track down where the problem is happening.
+
+ @name Handlebars.helpers.helperMissing
+ @param {String} path
+ @param {Hash} options
+*/
+Ember.Handlebars.registerHelper('helperMissing', function(path, options) {
+ var error, view = "";
+
+ error = "%@ Handlebars error: Could not find property '%@' on object %@.";
+ if (options.data){
+ view = options.data.view;
+ }
+ throw new Ember.Error(Ember.String.fmt(error, [view, path, this]));
+});
+
+
+})();
+
+
+
+(function() {
+
+Ember.String.htmlSafe = function(str) {
+ return new Handlebars.SafeString(str);
+};
+
+var htmlSafe = Ember.String.htmlSafe;
+
+if (Ember.EXTEND_PROTOTYPES) {
+
+ /**
+ @see Ember.String.htmlSafe
+ */
+ String.prototype.htmlSafe = function() {
+ return htmlSafe(this);
+ };
+
+}
+
+})();
+
+
+
+(function() {
+/*jshint newcap:false*/
+var set = Ember.set, get = Ember.get;
+
+var DOMManager = {
+ remove: function(view) {
+ var morph = view.morph;
+ if (morph.isRemoved()) { return; }
+ set(view, 'element', null);
+ view._lastInsert = null;
+ morph.remove();
+ },
+
+ prepend: function(view, childView) {
+ childView._insertElementLater(function() {
+ var morph = view.morph;
+ morph.prepend(childView.outerHTML);
+ childView.outerHTML = null;
+ });
+ },
+
+ after: function(view, nextView) {
+ nextView._insertElementLater(function() {
+ var morph = view.morph;
+ morph.after(nextView.outerHTML);
+ nextView.outerHTML = null;
+ });
+ },
+
+ replace: function(view) {
+ var morph = view.morph;
+
+ view.transitionTo('preRender');
+ view.clearRenderedChildren();
+ var buffer = view.renderToBuffer();
+
+ Ember.run.schedule('render', this, function() {
+ if (get(view, 'isDestroyed')) { return; }
+ view.invalidateRecursively('element');
+ view._notifyWillInsertElement();
+ morph.replaceWith(buffer.string());
+ view.transitionTo('inDOM');
+ view._notifyDidInsertElement();
+ });
+ },
+
+ empty: function(view) {
+ view.morph.html("");
+ }
+};
+
+// The `morph` and `outerHTML` properties are internal only
+// and not observable.
+
+Ember._Metamorph = Ember.Mixin.create({
+ isVirtual: true,
+ tagName: '',
+
+ init: function() {
+ this._super();
+ this.morph = Metamorph();
+ },
+
+ beforeRender: function(buffer) {
+ buffer.push(this.morph.startTag());
+ },
+
+ afterRender: function(buffer) {
+ buffer.push(this.morph.endTag());
+ },
+
+ createElement: function() {
+ var buffer = this.renderToBuffer();
+ this.outerHTML = buffer.string();
+ this.clearBuffer();
+ },
+
+ domManager: DOMManager
+});
+
+Ember._MetamorphView = Ember.View.extend(Ember._Metamorph);
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+
+var get = Ember.get, set = Ember.set, getPath = Ember.Handlebars.getPath;
+/**
+ @ignore
+ @private
+ @class
+
+ Ember._HandlebarsBoundView is a private view created by the Handlebars `{{bind}}`
+ helpers that is used to keep track of bound properties.
+
+ Every time a property is bound using a `{{mustache}}`, an anonymous subclass
+ of Ember._HandlebarsBoundView is created with the appropriate sub-template and
+ context set up. When the associated property changes, just the template for
+ this view will re-render.
+*/
+Ember._HandlebarsBoundView = Ember._MetamorphView.extend({
+/** @scope Ember._HandlebarsBoundView.prototype */
+
+ /**
+ The function used to determine if the `displayTemplate` or
+ `inverseTemplate` should be rendered. This should be a function that takes
+ a value and returns a Boolean.
+
+ @type Function
+ @default null
+ */
+ shouldDisplayFunc: null,
+
+ /**
+ Whether the template rendered by this view gets passed the context object
+ of its parent template, or gets passed the value of retrieving `path`
+ from the `pathRoot`.
+
+ For example, this is true when using the `{{#if}}` helper, because the
+ template inside the helper should look up properties relative to the same
+ object as outside the block. This would be false when used with `{{#with
+ foo}}` because the template should receive the object found by evaluating
+ `foo`.
+
+ @type Boolean
+ @default false
+ */
+ preserveContext: false,
+
+ /**
+ If `preserveContext` is true, this is the object that will be used
+ to render the template.
+
+ @type Object
+ */
+ previousContext: null,
+
+ /**
+ The template to render when `shouldDisplayFunc` evaluates to true.
+
+ @type Function
+ @default null
+ */
+ displayTemplate: null,
+
+ /**
+ The template to render when `shouldDisplayFunc` evaluates to false.
+
+ @type Function
+ @default null
+ */
+ inverseTemplate: null,
+
+
+ /**
+ The path to look up on `pathRoot` that is passed to
+ `shouldDisplayFunc` to determine which template to render.
+
+ In addition, if `preserveContext` is false, the object at this path will
+ be passed to the template when rendering.
+
+ @type String
+ @default null
+ */
+ path: null,
+
+ /**
+ The object from which the `path` will be looked up. Sometimes this is the
+ same as the `previousContext`, but in cases where this view has been generated
+ for paths that start with a keyword such as `view` or `controller`, the
+ path root will be that resolved object.
+
+ @type Object
+ */
+ pathRoot: null,
+
+ normalizedValue: Ember.computed(function() {
+ var path = get(this, 'path'),
+ pathRoot = get(this, 'pathRoot'),
+ valueNormalizer = get(this, 'valueNormalizerFunc'),
+ result, templateData;
+
+ // Use the pathRoot as the result if no path is provided. This
+ // happens if the path is `this`, which gets normalized into
+ // a `pathRoot` of the current Handlebars context and a path
+ // of `''`.
+ if (path === '') {
+ result = pathRoot;
+ } else {
+ templateData = get(this, 'templateData');
+ result = getPath(pathRoot, path, { data: templateData });
+ }
+
+ return valueNormalizer ? valueNormalizer(result) : result;
+ }).property('path', 'pathRoot', 'valueNormalizerFunc').volatile(),
+
+ rerenderIfNeeded: function() {
+ if (!get(this, 'isDestroyed') && get(this, 'normalizedValue') !== this._lastNormalizedValue) {
+ this.rerender();
+ }
+ },
+
+ /**
+ Determines which template to invoke, sets up the correct state based on
+ that logic, then invokes the default Ember.View `render` implementation.
+
+ This method will first look up the `path` key on `pathRoot`,
+ then pass that value to the `shouldDisplayFunc` function. If that returns
+ true, the `displayTemplate` function will be rendered to DOM. Otherwise,
+ `inverseTemplate`, if specified, will be rendered.
+
+ For example, if this Ember._HandlebarsBoundView represented the {{#with foo}}
+ helper, it would look up the `foo` property of its context, and
+ `shouldDisplayFunc` would always return true. The object found by looking
+ up `foo` would be passed to `displayTemplate`.
+
+ @param {Ember.RenderBuffer} buffer
+ */
+ render: function(buffer) {
+ // If not invoked via a triple-mustache ({{{foo}}}), escape
+ // the content of the template.
+ var escape = get(this, 'isEscaped');
+
+ var shouldDisplay = get(this, 'shouldDisplayFunc'),
+ preserveContext = get(this, 'preserveContext'),
+ context = get(this, 'previousContext');
+
+ var inverseTemplate = get(this, 'inverseTemplate'),
+ displayTemplate = get(this, 'displayTemplate');
+
+ var result = get(this, 'normalizedValue');
+ this._lastNormalizedValue = result;
+
+ // First, test the conditional to see if we should
+ // render the template or not.
+ if (shouldDisplay(result)) {
+ set(this, 'template', displayTemplate);
+
+ // If we are preserving the context (for example, if this
+ // is an #if block, call the template with the same object.
+ if (preserveContext) {
+ set(this, '_context', context);
+ } else {
+ // Otherwise, determine if this is a block bind or not.
+ // If so, pass the specified object to the template
+ if (displayTemplate) {
+ set(this, '_context', result);
+ } else {
+ // This is not a bind block, just push the result of the
+ // expression to the render context and return.
+ if (result === null || result === undefined) {
+ result = "";
+ } else if (!(result instanceof Handlebars.SafeString)) {
+ result = String(result);
+ }
+
+ if (escape) { result = Handlebars.Utils.escapeExpression(result); }
+ buffer.push(result);
+ return;
+ }
+ }
+ } else if (inverseTemplate) {
+ set(this, 'template', inverseTemplate);
+
+ if (preserveContext) {
+ set(this, '_context', context);
+ } else {
+ set(this, '_context', result);
+ }
+ } else {
+ set(this, 'template', function() { return ''; });
+ }
+
+ return this._super(buffer);
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
+var getPath = Ember.Handlebars.getPath, normalizePath = Ember.Handlebars.normalizePath;
+var forEach = Ember.ArrayPolyfills.forEach;
+
+var EmberHandlebars = Ember.Handlebars, helpers = EmberHandlebars.helpers;
+
+// Binds a property into the DOM. This will create a hook in DOM that the
+// KVO system will look for and update if the property changes.
+/** @private */
+function bind(property, options, preserveContext, shouldDisplay, valueNormalizer) {
+ var data = options.data,
+ fn = options.fn,
+ inverse = options.inverse,
+ view = data.view,
+ currentContext = this,
+ pathRoot, path, normalized;
+
+ normalized = normalizePath(currentContext, property, data);
+
+ pathRoot = normalized.root;
+ path = normalized.path;
+
+ // Set up observers for observable objects
+ if ('object' === typeof this) {
+ // Create the view that will wrap the output of this template/property
+ // and add it to the nearest view's childViews array.
+ // See the documentation of Ember._HandlebarsBoundView for more.
+ var bindView = view.createChildView(Ember._HandlebarsBoundView, {
+ preserveContext: preserveContext,
+ shouldDisplayFunc: shouldDisplay,
+ valueNormalizerFunc: valueNormalizer,
+ displayTemplate: fn,
+ inverseTemplate: inverse,
+ path: path,
+ pathRoot: pathRoot,
+ previousContext: currentContext,
+ isEscaped: !options.hash.unescaped,
+ templateData: options.data
+ });
+
+ view.appendChild(bindView);
+
+ /** @private */
+ var observer = function() {
+ Ember.run.once(bindView, 'rerenderIfNeeded');
+ };
+
+ // Observes the given property on the context and
+ // tells the Ember._HandlebarsBoundView to re-render. If property
+ // is an empty string, we are printing the current context
+ // object ({{this}}) so updating it is not our responsibility.
+ if (path !== '') {
+ Ember.addObserver(pathRoot, path, observer);
+ }
+ } else {
+ // The object is not observable, so just render it out and
+ // be done with it.
+ data.buffer.push(getPath(pathRoot, path, options));
+ }
+}
+
+/**
+ '_triageMustache' is used internally select between a binding and helper for
+ the given context. Until this point, it would be hard to determine if the
+ mustache is a property reference or a regular helper reference. This triage
+ helper resolves that.
+
+ This would not be typically invoked by directly.
+
+ @private
+ @name Handlebars.helpers._triageMustache
+ @param {String} property Property/helperID to triage
+ @param {Function} fn Context to provide for rendering
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('_triageMustache', function(property, fn) {
+ Ember.assert("You cannot pass more than one argument to the _triageMustache helper", arguments.length <= 2);
+ if (helpers[property]) {
+ return helpers[property].call(this, fn);
+ }
+ else {
+ return helpers.bind.apply(this, arguments);
+ }
+});
+
+/**
+ `bind` can be used to display a value, then update that value if it
+ changes. For example, if you wanted to print the `title` property of
+ `content`:
+
+ {{bind "content.title"}}
+
+ This will return the `title` property as a string, then create a new
+ observer at the specified path. If it changes, it will update the value in
+ DOM. Note that if you need to support IE7 and IE8 you must modify the
+ model objects properties using Ember.get() and Ember.set() for this to work as
+ it relies on Ember's KVO system. For all other browsers this will be handled
+ for you automatically.
+
+ @private
+ @name Handlebars.helpers.bind
+ @param {String} property Property to bind
+ @param {Function} fn Context to provide for rendering
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('bind', function(property, fn) {
+ Ember.assert("You cannot pass more than one argument to the bind helper", arguments.length <= 2);
+
+ var context = (fn.contexts && fn.contexts[0]) || this;
+
+ return bind.call(context, property, fn, false, function(result) {
+ return !Ember.none(result);
+ });
+});
+
+/**
+ Use the `boundIf` helper to create a conditional that re-evaluates
+ whenever the bound value changes.
+
+ {{#boundIf "content.shouldDisplayTitle"}}
+ {{content.title}}
+ {{/boundIf}}
+
+ @private
+ @name Handlebars.helpers.boundIf
+ @param {String} property Property to bind
+ @param {Function} fn Context to provide for rendering
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('boundIf', function(property, fn) {
+ var context = (fn.contexts && fn.contexts[0]) || this;
+ var func = function(result) {
+ if (Ember.typeOf(result) === 'array') {
+ return get(result, 'length') !== 0;
+ } else {
+ return !!result;
+ }
+ };
+
+ return bind.call(context, property, fn, true, func, func);
+});
+
+/**
+ @name Handlebars.helpers.with
+ @param {Function} context
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('with', function(context, options) {
+ if (arguments.length === 4) {
+ var keywordName, path, rootPath, normalized;
+
+ Ember.assert("If you pass more than one argument to the with helper, it must be in the form #with foo as bar", arguments[1] === "as");
+ options = arguments[3];
+ keywordName = arguments[2];
+ path = arguments[0];
+
+ Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+ if (Ember.isGlobalPath(path)) {
+ Ember.bind(options.data.keywords, keywordName, path);
+ } else {
+ normalized = normalizePath(this, path, options.data);
+ path = normalized.path;
+ rootPath = normalized.root;
+
+ // This is a workaround for the fact that you cannot bind separate objects
+ // together. When we implement that functionality, we should use it here.
+ var contextKey = Ember.$.expando + Ember.guidFor(rootPath);
+ options.data.keywords[contextKey] = rootPath;
+
+ // if the path is '' ("this"), just bind directly to the current context
+ var contextPath = path ? contextKey + '.' + path : contextKey;
+ Ember.bind(options.data.keywords, keywordName, contextPath);
+ }
+
+ return bind.call(this, path, options.fn, true, function(result) {
+ return !Ember.none(result);
+ });
+ } else {
+ Ember.assert("You must pass exactly one argument to the with helper", arguments.length === 2);
+ Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
+ return helpers.bind.call(options.contexts[0], context, options);
+ }
+});
+
+
+/**
+ @name Handlebars.helpers.if
+ @param {Function} context
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('if', function(context, options) {
+ Ember.assert("You must pass exactly one argument to the if helper", arguments.length === 2);
+ Ember.assert("You must pass a block to the if helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+ return helpers.boundIf.call(options.contexts[0], context, options);
+});
+
+/**
+ @name Handlebars.helpers.unless
+ @param {Function} context
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('unless', function(context, options) {
+ Ember.assert("You must pass exactly one argument to the unless helper", arguments.length === 2);
+ Ember.assert("You must pass a block to the unless helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+ var fn = options.fn, inverse = options.inverse;
+
+ options.fn = inverse;
+ options.inverse = fn;
+
+ return helpers.boundIf.call(options.contexts[0], context, options);
+});
+
+/**
+ `bindAttr` allows you to create a binding between DOM element attributes and
+ Ember objects. For example:
+
+ <img {{bindAttr src="imageUrl" alt="imageTitle"}}>
+
+ @name Handlebars.helpers.bindAttr
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('bindAttr', function(options) {
+
+ var attrs = options.hash;
+
+ Ember.assert("You must specify at least one hash argument to bindAttr", !!Ember.keys(attrs).length);
+
+ var view = options.data.view;
+ var ret = [];
+ var ctx = this;
+
+ // Generate a unique id for this element. This will be added as a
+ // data attribute to the element so it can be looked up when
+ // the bound property changes.
+ var dataId = ++Ember.$.uuid;
+
+ // Handle classes differently, as we can bind multiple classes
+ var classBindings = attrs['class'];
+ if (classBindings !== null && classBindings !== undefined) {
+ var classResults = EmberHandlebars.bindClasses(this, classBindings, view, dataId, options);
+ ret.push('class="' + Handlebars.Utils.escapeExpression(classResults.join(' ')) + '"');
+ delete attrs['class'];
+ }
+
+ var attrKeys = Ember.keys(attrs);
+
+ // For each attribute passed, create an observer and emit the
+ // current value of the property as an attribute.
+ forEach.call(attrKeys, function(attr) {
+ var path = attrs[attr],
+ pathRoot, normalized;
+
+ Ember.assert(fmt("You must provide a String for a bound attribute, not %@", [path]), typeof path === 'string');
+
+ normalized = normalizePath(ctx, path, options.data);
+
+ pathRoot = normalized.root;
+ path = normalized.path;
+
+ var value = (path === 'this') ? pathRoot : getPath(pathRoot, path, options),
+ type = Ember.typeOf(value);
+
+ Ember.assert(fmt("Attributes must be numbers, strings or booleans, not %@", [value]), value === null || value === undefined || type === 'number' || type === 'string' || type === 'boolean');
+
+ var observer, invoker;
+
+ /** @private */
+ observer = function observer() {
+ var result = getPath(pathRoot, path, options);
+
+ Ember.assert(fmt("Attributes must be numbers, strings or booleans, not %@", [result]), result === null || result === undefined || typeof result === 'number' || typeof result === 'string' || typeof result === 'boolean');
+
+ var elem = view.$("[data-bindattr-" + dataId + "='" + dataId + "']");
+
+ // If we aren't able to find the element, it means the element
+ // to which we were bound has been removed from the view.
+ // In that case, we can assume the template has been re-rendered
+ // and we need to clean up the observer.
+ if (elem.length === 0) {
+ Ember.removeObserver(pathRoot, path, invoker);
+ return;
+ }
+
+ Ember.View.applyAttributeBindings(elem, attr, result);
+ };
+
+ /** @private */
+ invoker = function() {
+ Ember.run.once(observer);
+ };
+
+ // Add an observer to the view for when the property changes.
+ // When the observer fires, find the element using the
+ // unique data id and update the attribute to the new value.
+ if (path !== 'this') {
+ Ember.addObserver(pathRoot, path, invoker);
+ }
+
+ // if this changes, also change the logic in ember-views/lib/views/view.js
+ if ((type === 'string' || (type === 'number' && !isNaN(value)))) {
+ ret.push(attr + '="' + Handlebars.Utils.escapeExpression(value) + '"');
+ } else if (value && type === 'boolean') {
+ // The developer controls the attr name, so it should always be safe
+ ret.push(attr + '="' + attr + '"');
+ }
+ }, this);
+
+ // Add the unique identifier
+ // NOTE: We use all lower-case since Firefox has problems with mixed case in SVG
+ ret.push('data-bindattr-' + dataId + '="' + dataId + '"');
+ return new EmberHandlebars.SafeString(ret.join(' '));
+});
+
+/**
+ Helper that, given a space-separated string of property paths and a context,
+ returns an array of class names. Calling this method also has the side
+ effect of setting up observers at those property paths, such that if they
+ change, the correct class name will be reapplied to the DOM element.
+
+ For example, if you pass the string "fooBar", it will first look up the
+ "fooBar" value of the context. If that value is true, it will add the
+ "foo-bar" class to the current element (i.e., the dasherized form of
+ "fooBar"). If the value is a string, it will add that string as the class.
+ Otherwise, it will not add any new class name.
+
+ @param {Ember.Object} context
+ The context from which to lookup properties
+
+ @param {String} classBindings
+ A string, space-separated, of class bindings to use
+
+ @param {Ember.View} view
+ The view in which observers should look for the element to update
+
+ @param {Srting} bindAttrId
+ Optional bindAttr id used to lookup elements
+
+ @returns {Array} An array of class names to add
+*/
+EmberHandlebars.bindClasses = function(context, classBindings, view, bindAttrId, options) {
+ var ret = [], newClass, value, elem;
+
+ // Helper method to retrieve the property from the context and
+ // determine which class string to return, based on whether it is
+ // a Boolean or not.
+ var classStringForPath = function(root, parsedPath, options) {
+ var val,
+ path = parsedPath.path;
+
+ if (path === 'this') {
+ val = root;
+ } else if (path === '') {
+ val = true;
+ } else {
+ val = getPath(root, path, options);
+ }
+
+ return Ember.View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);
+ };
+
+ // For each property passed, loop through and setup
+ // an observer.
+ forEach.call(classBindings.split(' '), function(binding) {
+
+ // Variable in which the old class value is saved. The observer function
+ // closes over this variable, so it knows which string to remove when
+ // the property changes.
+ var oldClass;
+
+ var observer, invoker;
+
+ var parsedPath = Ember.View._parsePropertyPath(binding),
+ path = parsedPath.path,
+ pathRoot = context,
+ normalized;
+
+ if (path !== '' && path !== 'this') {
+ normalized = normalizePath(context, path, options.data);
+
+ pathRoot = normalized.root;
+ path = normalized.path;
+ }
+
+ // Set up an observer on the context. If the property changes, toggle the
+ // class name.
+ /** @private */
+ observer = function() {
+ // Get the current value of the property
+ newClass = classStringForPath(pathRoot, parsedPath, options);
+ elem = bindAttrId ? view.$("[data-bindattr-" + bindAttrId + "='" + bindAttrId + "']") : view.$();
+
+ // If we can't find the element anymore, a parent template has been
+ // re-rendered and we've been nuked. Remove the observer.
+ if (elem.length === 0) {
+ Ember.removeObserver(pathRoot, path, invoker);
+ } else {
+ // If we had previously added a class to the element, remove it.
+ if (oldClass) {
+ elem.removeClass(oldClass);
+ }
+
+ // If necessary, add a new class. Make sure we keep track of it so
+ // it can be removed in the future.
+ if (newClass) {
+ elem.addClass(newClass);
+ oldClass = newClass;
+ } else {
+ oldClass = null;
+ }
+ }
+ };
+
+ /** @private */
+ invoker = function() {
+ Ember.run.once(observer);
+ };
+
+ if (path !== '' && path !== 'this') {
+ Ember.addObserver(pathRoot, path, invoker);
+ }
+
+ // We've already setup the observer; now we just need to figure out the
+ // correct behavior right now on the first pass through.
+ value = classStringForPath(pathRoot, parsedPath, options);
+
+ if (value) {
+ ret.push(value);
+
+ // Make sure we save the current value so that it can be removed if the
+ // observer fires.
+ oldClass = value;
+ }
+ });
+
+ return ret;
+};
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+
+// TODO: Don't require the entire module
+var get = Ember.get, set = Ember.set;
+var PARENT_VIEW_PATH = /^parentView\./;
+var EmberHandlebars = Ember.Handlebars;
+var VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;
+
+/** @private */
+EmberHandlebars.ViewHelper = Ember.Object.create({
+
+ propertiesFromHTMLOptions: function(options, thisContext) {
+ var hash = options.hash, data = options.data;
+ var extensions = {},
+ classes = hash['class'],
+ dup = false;
+
+ if (hash.id) {
+ extensions.elementId = hash.id;
+ dup = true;
+ }
+
+ if (classes) {
+ classes = classes.split(' ');
+ extensions.classNames = classes;
+ dup = true;
+ }
+
+ if (hash.classBinding) {
+ extensions.classNameBindings = hash.classBinding.split(' ');
+ dup = true;
+ }
+
+ if (hash.classNameBindings) {
+ if (extensions.classNameBindings === undefined) extensions.classNameBindings = [];
+ extensions.classNameBindings = extensions.classNameBindings.concat(hash.classNameBindings.split(' '));
+ dup = true;
+ }
+
+ if (hash.attributeBindings) {
+ Ember.assert("Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.");
+ extensions.attributeBindings = null;
+ dup = true;
+ }
+
+ if (dup) {
+ hash = Ember.$.extend({}, hash);
+ delete hash.id;
+ delete hash['class'];
+ delete hash.classBinding;
+ }
+
+ // Set the proper context for all bindings passed to the helper. This applies to regular attribute bindings
+ // as well as class name bindings. If the bindings are local, make them relative to the current context
+ // instead of the view.
+ var path;
+
+ // Evaluate the context of regular attribute bindings:
+ for (var prop in hash) {
+ if (!hash.hasOwnProperty(prop)) { continue; }
+
+ // Test if the property ends in "Binding"
+ if (Ember.IS_BINDING.test(prop) && typeof hash[prop] === 'string') {
+ path = this.contextualizeBindingPath(hash[prop], data);
+ if (path) { hash[prop] = path; }
+ }
+ }
+
+ // Evaluate the context of class name bindings:
+ if (extensions.classNameBindings) {
+ for (var b in extensions.classNameBindings) {
+ var full = extensions.classNameBindings[b];
+ if (typeof full === 'string') {
+ // Contextualize the path of classNameBinding so this:
+ //
+ // classNameBinding="isGreen:green"
+ //
+ // is converted to this:
+ //
+ // classNameBinding="bindingContext.isGreen:green"
+ var parsedPath = Ember.View._parsePropertyPath(full);
+ path = this.contextualizeBindingPath(parsedPath.path, data);
+ if (path) { extensions.classNameBindings[b] = path + parsedPath.classNames; }
+ }
+ }
+ }
+
+ // Make the current template context available to the view
+ // for the bindings set up above.
+ extensions.bindingContext = thisContext;
+
+ return Ember.$.extend(hash, extensions);
+ },
+
+ // Transform bindings from the current context to a context that can be evaluated within the view.
+ // Returns null if the path shouldn't be changed.
+ //
+ // TODO: consider the addition of a prefix that would allow this method to return `path`.
+ contextualizeBindingPath: function(path, data) {
+ var normalized = Ember.Handlebars.normalizePath(null, path, data);
+ if (normalized.isKeyword) {
+ return 'templateData.keywords.' + path;
+ } else if (Ember.isGlobalPath(path)) {
+ return null;
+ } else if (path === 'this') {
+ return 'bindingContext';
+ } else {
+ return 'bindingContext.' + path;
+ }
+ },
+
+ helper: function(thisContext, path, options) {
+ var inverse = options.inverse,
+ data = options.data,
+ view = data.view,
+ fn = options.fn,
+ hash = options.hash,
+ newView;
+
+ if ('string' === typeof path) {
+ newView = EmberHandlebars.getPath(thisContext, path, options);
+ Ember.assert("Unable to find view at path '" + path + "'", !!newView);
+ } else {
+ newView = path;
+ }
+
+ Ember.assert(Ember.String.fmt('You must pass a view class to the #view helper, not %@ (%@)', [path, newView]), Ember.View.detect(newView));
+
+ var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
+ var currentView = data.view;
+ viewOptions.templateData = options.data;
+
+ if (fn) {
+ Ember.assert("You cannot provide a template block if you also specified a templateName", !get(viewOptions, 'templateName') && !get(newView.proto(), 'templateName'));
+ viewOptions.template = fn;
+ }
+
+ // We only want to override the `_context` computed property if there is
+ // no specified controller. See View#_context for more information.
+ if (VIEW_PRESERVES_CONTEXT && !newView.proto().controller && !newView.proto().controllerBinding && !viewOptions.controller && !viewOptions.controllerBinding) {
+ viewOptions._context = thisContext;
+ }
+
+ currentView.appendChild(newView, viewOptions);
+ }
+});
+
+/**
+ `{{view}}` inserts a new instance of `Ember.View` into a template passing its options
+ to the `Ember.View`'s `create` method and using the supplied block as the view's own template.
+
+ An empty `<body>` and the following template:
+
+ <script type="text/x-handlebars">
+ A span:
+ {{#view tagName="span"}}
+ hello.
+ {{/view}}
+ </script>
+
+ Will result in HTML structure:
+
+ <body>
+ <!-- Note: the handlebars template script
+ also results in a rendered Ember.View
+ which is the outer <div> here -->
+
+ <div class="ember-view">
+ A span:
+ <span id="ember1" class="ember-view">
+ Hello.
+ </span>
+ </div>
+ </body>
+
+ ### parentView setting
+
+ The `parentView` property of the new `Ember.View` instance created through `{{view}}`
+ will be set to the `Ember.View` instance of the template where `{{view}}` was called.
+
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile("{{#view}} my parent: {{parentView.elementId}} {{/view}}")
+ })
+
+ aView.appendTo('body')
+
+ Will result in HTML structure:
+
+ <div id="ember1" class="ember-view">
+ <div id="ember2" class="ember-view">
+ my parent: ember1
+ </div>
+ </div>
+
+ ### Setting CSS id and class attributes
+
+ The HTML `id` attribute can be set on the `{{view}}`'s resulting element with the `id` option.
+ This option will _not_ be passed to `Ember.View.create`.
+
+ <script type="text/x-handlebars">
+ {{#view tagName="span" id="a-custom-id"}}
+ hello.
+ {{/view}}
+ </script>
+
+ Results in the following HTML structure:
+
+ <div class="ember-view">
+ <span id="a-custom-id" class="ember-view">
+ hello.
+ </span>
+ </div>
+
+ The HTML `class` attribute can be set on the `{{view}}`'s resulting element with
+ the `class` or `classNameBindings` options. The `class` option
+ will directly set the CSS `class` attribute and will not be passed to
+ `Ember.View.create`. `classNameBindings` will be passed to `create` and use
+ `Ember.View`'s class name binding functionality:
+
+ <script type="text/x-handlebars">
+ {{#view tagName="span" class="a-custom-class"}}
+ hello.
+ {{/view}}
+ </script>
+
+ Results in the following HTML structure:
+
+ <div class="ember-view">
+ <span id="ember2" class="ember-view a-custom-class">
+ hello.
+ </span>
+ </div>
+
+ ### Supplying a different view class
+ `{{view}}` can take an optional first argument before its supplied options to specify a
+ path to a custom view class.
+
+ <script type="text/x-handlebars">
+ {{#view "MyApp.CustomView"}}
+ hello.
+ {{/view}}
+ </script>
+
+ The first argument can also be a relative path. Ember will search for the view class
+ starting at the `Ember.View` of the template where `{{view}}` was used as the root object:
+
+ MyApp = Ember.Application.create({})
+ MyApp.OuterView = Ember.View.extend({
+ innerViewClass: Ember.View.extend({
+ classNames: ['a-custom-view-class-as-property']
+ }),
+ template: Ember.Handlebars.compile('{{#view "innerViewClass"}} hi {{/view}}')
+ })
+
+ MyApp.OuterView.create().appendTo('body')
+
+Will result in the following HTML:
+
+ <div id="ember1" class="ember-view">
+ <div id="ember2" class="ember-view a-custom-view-class-as-property">
+ hi
+ </div>
+ </div>
+
+ ### Blockless use
+
+ If you supply a custom `Ember.View` subclass that specifies its own template
+ or provide a `templateName` option to `{{view}}` it can be used without supplying a block.
+ Attempts to use both a `templateName` option and supply a block will throw an error.
+
+ <script type="text/x-handlebars">
+ {{view "MyApp.ViewWithATemplateDefined"}}
+ </script>
+
+ ### viewName property
+
+ You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance will
+ be referenced as a property of its parent view by this name.
+
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile('{{#view viewName="aChildByName"}} hi {{/view}}')
+ })
+
+ aView.appendTo('body')
+ aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper
+
+ @name Handlebars.helpers.view
+ @param {String} path
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+EmberHandlebars.registerHelper('view', function(path, options) {
+ Ember.assert("The view helper only takes a single argument", arguments.length <= 2);
+
+ // If no path is provided, treat path param as options.
+ if (path && path.data && path.data.isRenderData) {
+ options = path;
+ path = "Ember.View";
+ }
+
+ return EmberHandlebars.ViewHelper.helper(this, path, options);
+});
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+
+// TODO: Don't require all of this module
+var get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;
+
+/**
+ `{{collection}}` is a `Ember.Handlebars` helper for adding instances of
+ `Ember.CollectionView` to a template. See `Ember.CollectionView` for additional
+ information on how a `CollectionView` functions.
+
+ `{{collection}}`'s primary use is as a block helper with a `contentBinding` option
+ pointing towards an `Ember.Array`-compatible object. An `Ember.View` instance will
+ be created for each item in its `content` property. Each view will have its own
+ `content` property set to the appropriate item in the collection.
+
+ The provided block will be applied as the template for each item's view.
+
+ Given an empty `<body>` the following template:
+
+ <script type="text/x-handlebars">
+ {{#collection contentBinding="App.items"}}
+ Hi {{content.name}}
+ {{/collection}}
+ </script>
+
+ And the following application code
+
+ App = Ember.Application.create()
+ App.items = [
+ Ember.Object.create({name: 'Dave'}),
+ Ember.Object.create({name: 'Mary'}),
+ Ember.Object.create({name: 'Sara'})
+ ]
+
+ Will result in the HTML structure below
+
+ <div class="ember-view">
+ <div class="ember-view">Hi Dave</div>
+ <div class="ember-view">Hi Mary</div>
+ <div class="ember-view">Hi Sara</div>
+ </div>
+
+ ### Blockless Use
+ If you provide an `itemViewClass` option that has its own `template` you can omit
+ the block.
+
+ The following template:
+
+ <script type="text/x-handlebars">
+ {{collection contentBinding="App.items" itemViewClass="App.AnItemView"}}
+ </script>
+
+ And application code
+
+ App = Ember.Application.create()
+ App.items = [
+ Ember.Object.create({name: 'Dave'}),
+ Ember.Object.create({name: 'Mary'}),
+ Ember.Object.create({name: 'Sara'})
+ ]
+
+ App.AnItemView = Ember.View.extend({
+ template: Ember.Handlebars.compile("Greetings {{content.name}}")
+ })
+
+ Will result in the HTML structure below
+
+ <div class="ember-view">
+ <div class="ember-view">Greetings Dave</div>
+ <div class="ember-view">Greetings Mary</div>
+ <div class="ember-view">Greetings Sara</div>
+ </div>
+
+ ### Specifying a CollectionView subclass
+ By default the `{{collection}}` helper will create an instance of `Ember.CollectionView`.
+ You can supply a `Ember.CollectionView` subclass to the helper by passing it
+ as the first argument:
+
+ <script type="text/x-handlebars">
+ {{#collection App.MyCustomCollectionClass contentBinding="App.items"}}
+ Hi {{content.name}}
+ {{/collection}}
+ </script>
+
+
+ ### Forwarded `item.*`-named Options
+ As with the `{{view}}`, helper options passed to the `{{collection}}` will be set on
+ the resulting `Ember.CollectionView` as properties. Additionally, options prefixed with
+ `item` will be applied to the views rendered for each item (note the camelcasing):
+
+ <script type="text/x-handlebars">
+ {{#collection contentBinding="App.items"
+ itemTagName="p"
+ itemClassNames="greeting"}}
+ Howdy {{content.name}}
+ {{/collection}}
+ </script>
+
+ Will result in the following HTML structure:
+
+ <div class="ember-view">
+ <p class="ember-view greeting">Howdy Dave</p>
+ <p class="ember-view greeting">Howdy Mary</p>
+ <p class="ember-view greeting">Howdy Sara</p>
+ </div>
+
+ @name Handlebars.helpers.collection
+ @param {String} path
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+Ember.Handlebars.registerHelper('collection', function(path, options) {
+ // If no path is provided, treat path param as options.
+ if (path && path.data && path.data.isRenderData) {
+ options = path;
+ path = undefined;
+ Ember.assert("You cannot pass more than one argument to the collection helper", arguments.length === 1);
+ } else {
+ Ember.assert("You cannot pass more than one argument to the collection helper", arguments.length === 2);
+ }
+
+ var fn = options.fn;
+ var data = options.data;
+ var inverse = options.inverse;
+
+ // If passed a path string, convert that into an object.
+ // Otherwise, just default to the standard class.
+ var collectionClass;
+ collectionClass = path ? getPath(this, path, options) : Ember.CollectionView;
+ Ember.assert(fmt("%@ #collection: Could not find collection class %@", [data.view, path]), !!collectionClass);
+
+ var hash = options.hash, itemHash = {}, match;
+
+ // Extract item view class if provided else default to the standard class
+ var itemViewClass, itemViewPath = hash.itemViewClass;
+ var collectionPrototype = collectionClass.proto();
+ delete hash.itemViewClass;
+ itemViewClass = itemViewPath ? getPath(collectionPrototype, itemViewPath, options) : collectionPrototype.itemViewClass;
+ Ember.assert(fmt("%@ #collection: Could not find itemViewClass %@", [data.view, itemViewPath]), !!itemViewClass);
+
+ // Go through options passed to the {{collection}} helper and extract options
+ // that configure item views instead of the collection itself.
+ for (var prop in hash) {
+ if (hash.hasOwnProperty(prop)) {
+ match = prop.match(/^item(.)(.*)$/);
+
+ if(match) {
+ // Convert itemShouldFoo -> shouldFoo
+ itemHash[match[1].toLowerCase() + match[2]] = hash[prop];
+ // Delete from hash as this will end up getting passed to the
+ // {{view}} helper method.
+ delete hash[prop];
+ }
+ }
+ }
+
+ var tagName = hash.tagName || collectionPrototype.tagName;
+
+ if (fn) {
+ itemHash.template = fn;
+ delete options.fn;
+ }
+
+ var emptyViewClass;
+ if (inverse && inverse !== Handlebars.VM.noop) {
+ emptyViewClass = get(collectionPrototype, 'emptyViewClass');
+ emptyViewClass = emptyViewClass.extend({
+ template: inverse,
+ tagName: itemHash.tagName
+ });
+ } else if (hash.emptyViewClass) {
+ emptyViewClass = getPath(this, hash.emptyViewClass, options);
+ }
+ hash.emptyView = emptyViewClass;
+
+ if (hash.eachHelper === 'each') {
+ itemHash._context = Ember.computed(function() {
+ return get(this, 'content');
+ }).property('content');
+ delete hash.eachHelper;
+ }
+
+ var viewOptions = Ember.Handlebars.ViewHelper.propertiesFromHTMLOptions({ data: data, hash: itemHash }, this);
+ hash.itemViewClass = itemViewClass.extend(viewOptions);
+
+ return Ember.Handlebars.helpers.view.call(this, collectionClass, options);
+});
+
+
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+var getPath = Ember.Handlebars.getPath;
+
+/**
+ `unbound` allows you to output a property without binding. *Important:* The
+ output will not be updated if the property changes. Use with caution.
+
+ <div>{{unbound somePropertyThatDoesntChange}}</div>
+
+ @name Handlebars.helpers.unbound
+ @param {String} property
+ @returns {String} HTML string
+*/
+Ember.Handlebars.registerHelper('unbound', function(property, fn) {
+ var context = (fn.contexts && fn.contexts[0]) || this;
+ return getPath(context, property, fn);
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+/*jshint debug:true*/
+var getPath = Ember.Handlebars.getPath, normalizePath = Ember.Handlebars.normalizePath;
+
+/**
+ `log` allows you to output the value of a value in the current rendering
+ context.
+
+ {{log myVariable}}
+
+ @name Handlebars.helpers.log
+ @param {String} property
+*/
+Ember.Handlebars.registerHelper('log', function(property, options) {
+ var context = (options.contexts && options.contexts[0]) || this,
+ normalized = normalizePath(context, property, options.data),
+ pathRoot = normalized.root,
+ path = normalized.path,
+ value = (path === 'this') ? pathRoot : getPath(pathRoot, path, options);
+ Ember.Logger.log(value);
+});
+
+/**
+ The `debugger` helper executes the `debugger` statement in the current
+ context.
+
+ {{debugger}}
+
+ @name Handlebars.helpers.debugger
+ @param {String} property
+*/
+Ember.Handlebars.registerHelper('debugger', function() {
+ debugger;
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+Ember.Handlebars.EachView = Ember.CollectionView.extend(Ember._Metamorph, {
+ itemViewClass: Ember._MetamorphView,
+ emptyViewClass: Ember._MetamorphView,
+
+ createChildView: function(view, attrs) {
+ view = this._super(view, attrs);
+
+ // At the moment, if a container view subclass wants
+ // to insert keywords, it is responsible for cloning
+ // the keywords hash. This will be fixed momentarily.
+ var keyword = get(this, 'keyword');
+
+ if (keyword) {
+ var data = get(view, 'templateData');
+
+ data = Ember.copy(data);
+ data.keywords = view.cloneKeywords();
+ set(view, 'templateData', data);
+
+ var content = get(view, 'content');
+
+ // In this case, we do not bind, because the `content` of
+ // a #each item cannot change.
+ data.keywords[keyword] = content;
+ }
+
+ return view;
+ }
+});
+
+Ember.Handlebars.registerHelper('each', function(path, options) {
+ if (arguments.length === 4) {
+ Ember.assert("If you pass more than one argument to the each helper, it must be in the form #each foo in bar", arguments[1] === "in");
+
+ var keywordName = arguments[0];
+
+ options = arguments[3];
+ path = arguments[2];
+ if (path === '') { path = "this"; }
+
+ options.hash.keyword = keywordName;
+ } else {
+ options.hash.eachHelper = 'each';
+ }
+
+ Ember.assert("You must pass a block to the each helper", options.fn && options.fn !== Handlebars.VM.noop);
+
+ options.hash.contentBinding = path;
+ // Set up emptyView as a metamorph with no tag
+ //options.hash.emptyViewClass = Ember._MetamorphView;
+
+ return Ember.Handlebars.helpers.collection.call(this, 'Ember.Handlebars.EachView', options);
+});
+
+})();
+
+
+
+(function() {
+/**
+ `template` allows you to render a template from inside another template.
+ This allows you to re-use the same template in multiple places. For example:
+
+ <script type="text/x-handlebars">
+ {{#with loggedInUser}}
+ Last Login: {{lastLogin}}
+ User Info: {{template "user_info"}}
+ {{/with}}
+ </script>
+
+ <script type="text/x-handlebars" data-template-name="user_info">
+ Name: <em>{{name}}</em>
+ Karma: <em>{{karma}}</em>
+ </script>
+
+ This helper looks for templates in the global Ember.TEMPLATES hash. If you
+ add &lt;script&gt; tags to your page with the `data-template-name` attribute set,
+ they will be compiled and placed in this hash automatically.
+
+ You can also manually register templates by adding them to the hash:
+
+ Ember.TEMPLATES["my_cool_template"] = Ember.Handlebars.compile('<b>{{user}}</b>');
+
+ @name Handlebars.helpers.template
+ @param {String} templateName the template to render
+*/
+
+Ember.Handlebars.registerHelper('template', function(name, options) {
+ var template = Ember.TEMPLATES[name];
+
+ Ember.assert("Unable to find template with name '"+name+"'.", !!template);
+
+ Ember.TEMPLATES[name](this, { data: options.data });
+});
+
+})();
+
+
+
+(function() {
+var EmberHandlebars = Ember.Handlebars,
+ getPath = EmberHandlebars.getPath,
+ get = Ember.get,
+ a_slice = Array.prototype.slice;
+
+var ActionHelper = EmberHandlebars.ActionHelper = {
+ registeredActions: {}
+};
+
+ActionHelper.registerAction = function(actionName, options) {
+ var actionId = (++Ember.$.uuid).toString();
+
+ ActionHelper.registeredActions[actionId] = {
+ eventName: options.eventName,
+ handler: function(event) {
+ var modifier = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey,
+ secondaryClick = event.which > 1, // IE9 may return undefined
+ nonStandard = modifier || secondaryClick;
+
+ if (options.link && nonStandard) {
+ // Allow the browser to handle special link clicks normally
+ return;
+ }
+
+ event.preventDefault();
+
+ event.view = options.view;
+
+ if (options.hasOwnProperty('context')) {
+ event.context = options.context;
+ }
+
+ if (options.hasOwnProperty('contexts')) {
+ event.contexts = options.contexts;
+ }
+
+ var target = options.target;
+
+ // Check for StateManager (or compatible object)
+ if (target.isState && typeof target.send === 'function') {
+ return target.send(actionName, event);
+ } else {
+ Ember.assert(Ember.String.fmt('Target %@ does not have action %@', [target, actionName]), target[actionName]);
+ return target[actionName].call(target, event);
+ }
+ }
+ };
+
+ options.view.on('willRerender', function() {
+ delete ActionHelper.registeredActions[actionId];
+ });
+
+ return actionId;
+};
+
+/**
+ The `{{action}}` helper registers an HTML element within a template for
+ DOM event handling and forwards that interaction to the Application's router,
+ the template's `Ember.View` instance, or supplied `target` option (see 'Specifiying a Target').
+
+ User interaction with that element will invoke the supplied action name on
+ the appropriate target.
+
+ Given the following Handlebars template on the page
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ <div {{action anActionName}}>
+ click me
+ </div>
+ </script>
+
+ And application code
+
+ AView = Ember.View.extend({
+ templateName; 'a-template',
+ anActionName: function(event){}
+ });
+
+ aView = AView.create();
+ aView.appendTo('body');
+
+ Will results in the following rendered HTML
+
+ <div class="ember-view">
+ <div data-ember-action="1">
+ click me
+ </div>
+ </div>
+
+ Clicking "click me" will trigger the `anActionName` method of the `aView`
+ object with a `jQuery.Event` object as its argument. The `jQuery.Event`
+ object will be extended to include a `view` property that is set to the
+ original view interacted with (in this case the `aView` object).
+
+ ### Event Propagation
+
+ Events triggered through the action helper will automatically have
+ `.preventDefault()` called on them. You do not need to do so in your event
+ handlers. To stop propagation of the event, simply return `false` from your
+ handler.
+
+ If you need the default handler to trigger you should either register your
+ own event handler, or use event methods on your view class. See Ember.View
+ 'Responding to Browser Events' for more information.
+
+ ### Specifying DOM event type
+
+ By default the `{{action}}` helper registers for DOM `click` events. You can
+ supply an `on` option to the helper to specify a different DOM event name:
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ <div {{action anActionName on="doubleClick"}}>
+ click me
+ </div>
+ </script>
+
+ See Ember.View 'Responding to Browser Events' for a list of
+ acceptable DOM event names.
+
+ Because `{{action}}` depends on Ember's event dispatch system it will only
+ function if an `Ember.EventDispatcher` instance is available. An
+ `Ember.EventDispatcher` instance will be created when a new
+ `Ember.Application` is created. Having an instance of `Ember.Application`
+ will satisfy this requirement.
+
+
+ ### Specifying a Target
+ There are several possible target objects for `{{action}}` helpers:
+
+ In a typical `Ember.Router`-backed Application where views are managed
+ through use of the `{{outlet}}` helper, actions will be forwarded to the
+ current state of the Applications's Router. See Ember.Router 'Responding
+ to User-initiated Events' for more information.
+
+ If you manaully set the `target` property on the controller of a template's
+ `Ember.View` instance, the specifed `controller.target` will become the target
+ for any actions. Likely custom values for a controller's `target` are the
+ controller itself or a StateManager other than the Application's Router.
+
+ If the templates's view lacks a controller property the view itself is the target.
+
+ Finally, a `target` option can be provided to the helper to change which object
+ will receive the method call. This option must be a string representing a
+ path to an object:
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ <div {{action anActionName target="MyApplication.someObject"}}>
+ click me
+ </div>
+ </script>
+
+ Clicking "click me" in the rendered HTML of the above template will trigger
+ the `anActionName` method of the object at `MyApplication.someObject`.
+ The first argument to this method will be a `jQuery.Event` extended to
+ include a `view` property that is set to the original view interacted with.
+
+ A path relative to the template's `Ember.View` instance can also be used as
+ a target:
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ <div {{action anActionName target="parentView"}}>
+ click me
+ </div>
+ </script>
+
+ Clicking "click me" in the rendered HTML of the above template will trigger
+ the `anActionName` method of the view's parent view.
+
+ The `{{action}}` helper is `Ember.StateManager` aware. If the target of the
+ action is an `Ember.StateManager` instance `{{action}}` will use the `send`
+ functionality of StateManagers. The documentation for `Ember.StateManager`
+ has additional information about this use.
+
+ If an action's target does not implement a method that matches the supplied
+ action name an error will be thrown.
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ <div {{action aMethodNameThatIsMissing}}>
+ click me
+ </div>
+ </script>
+
+ With the following application code
+
+ AView = Ember.View.extend({
+ templateName; 'a-template',
+ // note: no method 'aMethodNameThatIsMissing'
+ anActionName: function(event){}
+ });
+
+ aView = AView.create();
+ aView.appendTo('body');
+
+ Will throw `Uncaught TypeError: Cannot call method 'call' of undefined` when
+ "click me" is clicked.
+
+ ### Specifying a context
+
+ By default the `{{action}}` helper passes the current Handlebars context
+ along in the `jQuery.Event` object. You may specify an alternate object to
+ pass as the context by providing a property path:
+
+ <script type="text/x-handlebars" data-template-name='a-template'>
+ {{#each person in people}}
+ <div {{action edit person}}>
+ click me
+ </div>
+ {{/each}}
+ </script>
+
+ @name Handlebars.helpers.action
+ @param {String} actionName
+ @param {Object...} contexts
+ @param {Hash} options
+*/
+EmberHandlebars.registerHelper('action', function(actionName) {
+ var options = arguments[arguments.length - 1],
+ contexts = a_slice.call(arguments, 1, -1);
+
+ var hash = options.hash,
+ view = options.data.view,
+ target, controller, link;
+
+ // create a hash to pass along to registerAction
+ var action = {
+ eventName: hash.on || "click"
+ };
+
+ action.view = view = get(view, 'concreteView');
+
+ if (hash.target) {
+ target = getPath(this, hash.target, options);
+ } else if (controller = options.data.keywords.controller) {
+ target = get(controller, 'target');
+ }
+
+ action.target = target = target || view;
+
+ if (contexts.length) {
+ action.contexts = contexts = Ember.EnumerableUtils.map(contexts, function(context) {
+ return getPath(this, context, options);
+ }, this);
+ action.context = contexts[0];
+ }
+
+ var output = [], url;
+
+ if (hash.href && target.urlForEvent) {
+ url = target.urlForEvent.apply(target, [actionName].concat(contexts));
+ output.push('href="' + url + '"');
+ action.link = true;
+ }
+
+ var actionId = ActionHelper.registerAction(actionName, action);
+ output.push('data-ember-action="' + actionId + '"');
+
+ return new EmberHandlebars.SafeString(output.join(" "));
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, set = Ember.set;
+
+/**
+
+ When used in a Handlebars template that is assigned to an `Ember.View` instance's
+ `layout` property Ember will render the layout template first, inserting the view's
+ own rendered output at the `{{ yield }}` location.
+
+ An empty `<body>` and the following application code:
+
+ AView = Ember.View.extend({
+ classNames: ['a-view-with-layout'],
+ layout: Ember.Handlebars.compile('<div class="wrapper">{{ yield }}</div>'),
+ template: Ember.Handlebars.compile('<span>I am wrapped</span>')
+ })
+
+ aView = AView.create()
+ aView.appendTo('body')
+
+ Will result in the following HTML output:
+
+ <body>
+ <div class='ember-view a-view-with-layout'>
+ <div class="wrapper">
+ <span>I am wrapped</span>
+ </div>
+ </div>
+ </body>
+
+ The yield helper cannot be used outside of a template assigned to an `Ember.View`'s `layout` property
+ and will throw an error if attempted.
+
+ BView = Ember.View.extend({
+ classNames: ['a-view-with-layout'],
+ template: Ember.Handlebars.compile('{{yield}}')
+ })
+
+ bView = BView.create()
+ bView.appendTo('body')
+
+ // throws
+ // Uncaught Error: assertion failed: You called yield in a template that was not a layout
+
+ @name Handlebars.helpers.yield
+ @param {Hash} options
+ @returns {String} HTML string
+*/
+Ember.Handlebars.registerHelper('yield', function(options) {
+ var view = options.data.view, template;
+
+ while (view && !get(view, 'layout')) {
+ view = get(view, 'parentView');
+ }
+
+ Ember.assert("You called yield in a template that was not a layout", !!view);
+
+ template = get(view, 'template');
+
+ if (template) { template(this, options); }
+});
+
+})();
+
+
+
+(function() {
+/**
+ The `outlet` helper allows you to specify that the current
+ view's controller will fill in the view for a given area.
+
+ {{outlet}}
+
+ By default, when the the current controller's `view`
+ property changes, the outlet will replace its current
+ view with the new view.
+
+ controller.set('view', someView);
+
+ You can also specify a particular name, other than view:
+
+ {{outlet masterView}}
+ {{outlet detailView}}
+
+ Then, you can control several outlets from a single
+ controller:
+
+ controller.set('masterView', postsView);
+ controller.set('detailView', postView);
+
+ @name Handlebars.helpers.outlet
+ @param {String} property the property on the controller
+ that holds the view for this outlet
+*/
+Ember.Handlebars.registerHelper('outlet', function(property, options) {
+ if (property && property.data && property.data.isRenderData) {
+ options = property;
+ property = 'view';
+ }
+
+ options.hash.currentViewBinding = "controller." + property;
+
+ return Ember.Handlebars.helpers.view.call(this, Ember.ContainerView, options);
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var set = Ember.set, get = Ember.get;
+
+/**
+ @class
+
+ Creates an HTML input of type 'checkbox' with HTML related properties
+ applied directly to the input.
+
+ {{view Ember.Checkbox classNames="applicaton-specific-checkbox"}}
+
+ <input id="ember1" class="ember-view ember-checkbox applicaton-specific-checkbox" type="checkbox">
+
+ You can add a `label` tag yourself in the template where the Ember.Checkbox is being used.
+
+ <label>
+ Some Title
+ {{view Ember.Checkbox classNames="applicaton-specific-checkbox"}}
+ </label>
+
+
+ The `checked` attribute of an Ember.Checkbox object should always be set
+ through the Ember object or by interacting with its rendered element representation
+ via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will
+ result in the checked value of the object and its element losing synchronization.
+
+ ## Layout and LayoutName properties
+ Because HTML `input` elements are self closing `layout` and `layoutName` properties will
+ not be applied. See `Ember.View`'s layout section for more information.
+
+ @extends Ember.View
+*/
+Ember.Checkbox = Ember.View.extend({
+ classNames: ['ember-checkbox'],
+
+ tagName: 'input',
+
+ attributeBindings: ['type', 'checked', 'disabled', 'tabindex'],
+
+ type: "checkbox",
+ checked: false,
+ disabled: false,
+
+ init: function() {
+ this._super();
+ this.on("change", this, this._updateElementValue);
+ },
+
+ /**
+ @private
+ */
+ _updateElementValue: function() {
+ set(this, 'checked', this.$().prop('checked'));
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/** @class */
+Ember.TextSupport = Ember.Mixin.create(
+/** @scope Ember.TextSupport.prototype */ {
+
+ value: "",
+
+ attributeBindings: ['placeholder', 'disabled', 'maxlength', 'tabindex'],
+ placeholder: null,
+ disabled: false,
+ maxlength: null,
+
+ insertNewline: Ember.K,
+ cancel: Ember.K,
+
+ /** @private */
+ init: function() {
+ this._super();
+ this.on("focusOut", this, this._elementValueDidChange);
+ this.on("change", this, this._elementValueDidChange);
+ this.on("keyUp", this, this.interpretKeyEvents);
+ },
+
+ /**
+ @private
+ */
+ interpretKeyEvents: function(event) {
+ var map = Ember.TextSupport.KEY_EVENTS;
+ var method = map[event.keyCode];
+
+ this._elementValueDidChange();
+ if (method) { return this[method](event); }
+ },
+
+ _elementValueDidChange: function() {
+ set(this, 'value', this.$().val());
+ }
+
+});
+
+Ember.TextSupport.KEY_EVENTS = {
+ 13: 'insertNewline',
+ 27: 'cancel'
+};
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ The `Ember.TextField` view class renders a text
+ [input](https://developer.mozilla.org/en/HTML/Element/Input) element. It
+ allows for binding Ember properties to the text field contents (`value`),
+ live-updating as the user inputs text.
+
+ Example:
+
+ {{view Ember.TextField valueBinding="firstName"}}
+
+ ## Layout and LayoutName properties
+ Because HTML `input` elements are self closing `layout` and `layoutName` properties will
+ not be applied. See `Ember.View`'s layout section for more information.
+
+ @extends Ember.View
+ @extends Ember.TextSupport
+*/
+Ember.TextField = Ember.View.extend(Ember.TextSupport,
+ /** @scope Ember.TextField.prototype */ {
+
+ classNames: ['ember-text-field'],
+ tagName: "input",
+ attributeBindings: ['type', 'value', 'size'],
+
+ /**
+ The value attribute of the input element. As the user inputs text, this
+ property is updated live.
+
+ @type String
+ @default ""
+ */
+ value: "",
+
+ /**
+ The type attribute of the input element.
+
+ @type String
+ @default "text"
+ */
+ type: "text",
+
+ /**
+ The size of the text field in characters.
+
+ @type String
+ @default null
+ */
+ size: null
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+Ember.Button = Ember.View.extend(Ember.TargetActionSupport, {
+ classNames: ['ember-button'],
+ classNameBindings: ['isActive'],
+
+ tagName: 'button',
+
+ propagateEvents: false,
+
+ attributeBindings: ['type', 'disabled', 'href', 'tabindex'],
+
+ /** @private
+ Overrides TargetActionSupport's targetObject computed
+ property to use Handlebars-specific path resolution.
+ */
+ targetObject: Ember.computed(function() {
+ var target = get(this, 'target'),
+ root = get(this, 'context'),
+ data = get(this, 'templateData');
+
+ if (typeof target !== 'string') { return target; }
+
+ return Ember.Handlebars.getPath(root, target, { data: data });
+ }).property('target').cacheable(),
+
+ // Defaults to 'button' if tagName is 'input' or 'button'
+ type: Ember.computed(function(key, value) {
+ var tagName = this.get('tagName');
+ if (value !== undefined) { this._type = value; }
+ if (this._type !== undefined) { return this._type; }
+ if (tagName === 'input' || tagName === 'button') { return 'button'; }
+ }).property('tagName').cacheable(),
+
+ disabled: false,
+
+ // Allow 'a' tags to act like buttons
+ href: Ember.computed(function() {
+ return this.get('tagName') === 'a' ? '#' : null;
+ }).property('tagName').cacheable(),
+
+ mouseDown: function() {
+ if (!get(this, 'disabled')) {
+ set(this, 'isActive', true);
+ this._mouseDown = true;
+ this._mouseEntered = true;
+ }
+ return get(this, 'propagateEvents');
+ },
+
+ mouseLeave: function() {
+ if (this._mouseDown) {
+ set(this, 'isActive', false);
+ this._mouseEntered = false;
+ }
+ },
+
+ mouseEnter: function() {
+ if (this._mouseDown) {
+ set(this, 'isActive', true);
+ this._mouseEntered = true;
+ }
+ },
+
+ mouseUp: function(event) {
+ if (get(this, 'isActive')) {
+ // Actually invoke the button's target and action.
+ // This method comes from the Ember.TargetActionSupport mixin.
+ this.triggerAction();
+ set(this, 'isActive', false);
+ }
+
+ this._mouseDown = false;
+ this._mouseEntered = false;
+ return get(this, 'propagateEvents');
+ },
+
+ keyDown: function(event) {
+ // Handle space or enter
+ if (event.keyCode === 13 || event.keyCode === 32) {
+ this.mouseDown();
+ }
+ },
+
+ keyUp: function(event) {
+ // Handle space or enter
+ if (event.keyCode === 13 || event.keyCode === 32) {
+ this.mouseUp();
+ }
+ },
+
+ // TODO: Handle proper touch behavior. Including should make inactive when
+ // finger moves more than 20x outside of the edge of the button (vs mouse
+ // which goes inactive as soon as mouse goes out of edges.)
+
+ touchStart: function(touch) {
+ return this.mouseDown(touch);
+ },
+
+ touchEnd: function(touch) {
+ return this.mouseUp(touch);
+ },
+
+ init: function() {
+ Ember.deprecate("Ember.Button is deprecated and will be removed from future releases. Consider using the `{{action}}` helper.");
+ this._super();
+ }
+});
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+var get = Ember.get, set = Ember.set;
+
+/**
+ @class
+
+ The `Ember.TextArea` view class renders a
+ [textarea](https://developer.mozilla.org/en/HTML/Element/textarea) element.
+ It allows for binding Ember properties to the text area contents (`value`),
+ live-updating as the user inputs text.
+
+ ## Layout and LayoutName properties
+
+ Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
+ properties will not be applied. See `Ember.View`'s layout section for more information.
+
+ @extends Ember.View
+ @extends Ember.TextSupport
+*/
+Ember.TextArea = Ember.View.extend(Ember.TextSupport,
+/** @scope Ember.TextArea.prototype */ {
+
+ classNames: ['ember-text-area'],
+
+ tagName: "textarea",
+ attributeBindings: ['rows', 'cols'],
+ rows: null,
+ cols: null,
+
+ _updateElementValue: Ember.observer(function() {
+ // We do this check so cursor position doesn't get affected in IE
+ var value = get(this, 'value'),
+ $el = this.$();
+ if ($el && value !== $el.val()) {
+ $el.val(value);
+ }
+ }, 'value'),
+
+ /** @private */
+ init: function() {
+ this._super();
+ this.on("didInsertElement", this, this._updateElementValue);
+ }
+
+});
+
+})();
+
+
+
+(function() {
+Ember.TabContainerView = Ember.View.extend({
+ init: function() {
+ Ember.deprecate("Ember.TabContainerView is deprecated and will be removed from future releases.");
+ this._super();
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get;
+
+Ember.TabPaneView = Ember.View.extend({
+ tabsContainer: Ember.computed(function() {
+ return this.nearestInstanceOf(Ember.TabContainerView);
+ }).property().volatile(),
+
+ isVisible: Ember.computed(function() {
+ return get(this, 'viewName') === get(this, 'tabsContainer.currentView');
+ }).property('tabsContainer.currentView').volatile(),
+
+ init: function() {
+ Ember.deprecate("Ember.TabPaneView is deprecated and will be removed from future releases.");
+ this._super();
+ }
+});
+
+})();
+
+
+
+(function() {
+var get = Ember.get, setPath = Ember.setPath;
+
+Ember.TabView = Ember.View.extend({
+ tabsContainer: Ember.computed(function() {
+ return this.nearestInstanceOf(Ember.TabContainerView);
+ }).property().volatile(),
+
+ mouseUp: function() {
+ setPath(this, 'tabsContainer.currentView', get(this, 'value'));
+ },
+
+ init: function() {
+ Ember.deprecate("Ember.TabView is deprecated and will be removed from future releases.");
+ this._super();
+ }
+});
+
+})();
+
+
+
+(function() {
+
+})();
+
+
+
+(function() {
+/*jshint eqeqeq:false */
+
+var set = Ember.set, get = Ember.get;
+var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.indexesOf;
+
+/**
+ @class
+
+ The Ember.Select view class renders a
+ [select](https://developer.mozilla.org/en/HTML/Element/select) HTML element,
+ allowing the user to choose from a list of options. The selected option(s)
+ are updated live in the `selection` property, while the corresponding value
+ is updated in the `value` property.
+
+ ### Using Strings
+ The simplest version of an Ember.Select takes an array of strings for the options
+ of a select box and a valueBinding to set the value.
+
+ Example:
+
+ App.controller = Ember.Object.create({
+ selected: null,
+ content: [
+ "Yehuda",
+ "Tom"
+ ]
+ })
+
+ {{view Ember.Select
+ contentBinding="App.controller.content"
+ valueBinding="App.controller.selected"
+ }}
+
+ Would result in the following HTML:
+
+ <select class="ember-select">
+ <option value="Yehuda">Yehuda</option>
+ <option value="Tom">Tom</option>
+ </select>
+
+ Selecting Yehuda from the select box will set `App.controller.selected` to "Yehuda"
+
+ ### Using Objects
+ An Ember.Select can also take an array of JS or Ember objects.
+
+ When using objects you need to supply optionLabelPath and optionValuePath parameters
+ which will be used to get the label and value for each of the options.
+
+ Usually you will bind to either the selection or the value attribute of the select.
+
+ Use selectionBinding if you would like to set the whole object as a property on the target.
+ Use valueBinding if you would like to set just the value.
+
+ Example using selectionBinding:
+
+ App.controller = Ember.Object.create({
+ selectedPerson: null,
+ selectedPersonId: null,
+ content: [
+ Ember.Object.create({firstName: "Yehuda", id: 1}),
+ Ember.Object.create({firstName: "Tom", id: 2})
+ ]
+ })
+
+ {{view Ember.Select
+ contentBinding="App.controller.content"
+ optionLabelPath="content.firstName"
+ optionValuePath="content.id"
+ selectionBinding="App.controller.selectedPerson"
+ prompt="Please Select"}}
+
+ <select class="ember-select">
+ <option value>Please Select</option>
+ <option value="1">Yehuda</option>
+ <option value="2">Tom</option>
+ </select>
+
+ Selecting Yehuda here will set `App.controller.selectedPerson` to
+ the Yehuda object.
+
+ Example using valueBinding:
+
+ {{view Ember.Select
+ contentBinding="App.controller.content"
+ optionLabelPath="content.firstName"
+ optionValuePath="content.id"
+ valueBinding="App.controller.selectedPersonId"
+ prompt="Please Select"}}
+
+ Selecting Yehuda in this case will set `App.controller.selectedPersonId` to 1.
+
+ @extends Ember.View
+*/
+Ember.Select = Ember.View.extend(
+ /** @scope Ember.Select.prototype */ {
+
+ tagName: 'select',
+ classNames: ['ember-select'],
+ defaultTemplate: Ember.Handlebars.compile('{{#if view.prompt}}<option value>{{view.prompt}}</option>{{/if}}{{#each view.content}}{{view Ember.SelectOption contentBinding="this"}}{{/each}}'),
+ attributeBindings: ['multiple', 'tabindex'],
+
+ /**
+ The `multiple` attribute of the select element. Indicates whether multiple
+ options can be selected.
+
+ @type Boolean
+ @default false
+ */
+ multiple: false,
+
+ /**
+ The list of options.
+
+ If `optionLabelPath` and `optionValuePath` are not overridden, this should
+ be a list of strings, which will serve simultaneously as labels and values.
+
+ Otherwise, this should be a list of objects. For instance:
+
+ content: Ember.A([
+ { id: 1, firstName: 'Yehuda' },
+ { id: 2, firstName: 'Tom' }
+ ]),
+ optionLabelPath: 'content.firstName',
+ optionValuePath: 'content.id'
+
+ @type Array
+ @default null
+ */
+ content: null,
+
+ /**
+ When `multiple` is false, the element of `content` that is currently
+ selected, if any.
+
+ When `multiple` is true, an array of such elements.
+
+ @type Object or Array
+ @default null
+ */
+ selection: null,
+
+ /**
+ In single selection mode (when `multiple` is false), value can be used to get
+ the current selection's value or set the selection by it's value.
+
+ It is not currently supported in multiple selection mode.
+
+ @type String
+ @default null
+ */
+ value: Ember.computed(function(key, value) {
+ if (arguments.length === 2) { return value; }
+
+ var valuePath = get(this, 'optionValuePath').replace(/^content\.?/, '');
+ return valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection');
+ }).property('selection').cacheable(),
+
+ /**
+ If given, a top-most dummy option will be rendered to serve as a user
+ prompt.
+
+ @type String
+ @default null
+ */
+ prompt: null,
+
+ /**
+ The path of the option labels. See `content`.
+
+ @type String
+ @default 'content'
+ */
+ optionLabelPath: 'content',
+
+ /**
+ The path of the option values. See `content`.
+
+ @type String
+ @default 'content'
+ */
+ optionValuePath: 'content',
+
+ _change: function() {
+ if (get(this, 'multiple')) {
+ this._changeMultiple();
+ } else {
+ this._changeSingle();
+ }
+ },
+
+ selectionDidChange: Ember.observer(function() {
+ var selection = get(this, 'selection'),
+ isArray = Ember.isArray(selection);
+ if (get(this, 'multiple')) {
+ if (!isArray) {
+ set(this, 'selection', Ember.A([selection]));
+ return;
+ }
+ this._selectionDidChangeMultiple();
+ } else {
+ this._selectionDidChangeSingle();
+ }
+ }, 'selection'),
+
+ valueDidChange: Ember.observer(function() {
+ var content = get(this, 'content'),
+ value = get(this, 'value'),
+ valuePath = get(this, 'optionValuePath').replace(/^content\.?/, ''),
+ selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection')),
+ selection;
+
+ if (value !== selectedValue) {
+ selection = content.find(function(obj) {
+ return value === (valuePath ? get(obj, valuePath) : obj);
+ });
+
+ this.set('selection', selection);
+ }
+ }, 'value'),
+
+
+ _triggerChange: function() {
+ var selection = get(this, 'selection');
+
+ if (selection) { this.selectionDidChange(); }
+
+ this._change();
+ },
+
+ _changeSingle: function() {
+ var selectedIndex = this.$()[0].selectedIndex,
+ content = get(this, 'content'),
+ prompt = get(this, 'prompt');
+
+ if (!content) { return; }
+ if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; }
+
+ if (prompt) { selectedIndex -= 1; }
+ set(this, 'selection', content.objectAt(selectedIndex));
+ },
+
+ _changeMultiple: function() {
+ var options = this.$('option:selected'),
+ prompt = get(this, 'prompt'),
+ offset = prompt ? 1 : 0,
+ content = get(this, 'content');
+
+ if (!content){ return; }
+ if (options) {
+ var selectedIndexes = options.map(function(){
+ return this.index - offset;
+ }).toArray();
+ set(this, 'selection', content.objectsAt(selectedIndexes));
+ }
+ },
+
+ _selectionDidChangeSingle: function() {
+ var el = this.get('element');
+ if (!el) { return; }
+
+ var content = get(this, 'content'),
+ selection = get(this, 'selection'),
+ selectionIndex = content ? indexOf(content, selection) : -1,
+ prompt = get(this, 'prompt');
+
+ if (prompt) { selectionIndex += 1; }
+ if (el) { el.selectedIndex = selectionIndex; }
+ },
+
+ _selectionDidChangeMultiple: function() {
+ var content = get(this, 'content'),
+ selection = get(this, 'selection'),
+ selectedIndexes = content ? indexesOf(content, selection) : [-1],
+ prompt = get(this, 'prompt'),
+ offset = prompt ? 1 : 0,
+ options = this.$('option'),
+ adjusted;
+
+ if (options) {
+ options.each(function() {
+ adjusted = this.index > -1 ? this.index + offset : -1;
+ this.selected = indexOf(selectedIndexes, adjusted) > -1;
+ });
+ }
+ },
+
+ init: function() {
+ this._super();
+ this.on("didInsertElement", this, this._triggerChange);
+ this.on("change", this, this._change);
+ }
+});
+
+Ember.SelectOption = Ember.View.extend({
+ tagName: 'option',
+ attributeBindings: ['value', 'selected'],
+
+ defaultTemplate: function(context, options) {
+ options = { data: options.data, hash: {} };
+ Ember.Handlebars.helpers.bind.call(context, "view.label", options);
+ },
+
+ init: function() {
+ this.labelPathDidChange();
+ this.valuePathDidChange();
+
+ this._super();
+ },
+
+ selected: Ember.computed(function() {
+ var content = get(this, 'content'),
+ selection = get(this, 'parentView.selection');
+ if (get(this, 'parentView.multiple')) {
+ return selection && indexOf(selection, content) > -1;
+ } else {
+ // Primitives get passed through bindings as objects... since
+ // `new Number(4) !== 4`, we use `==` below
+ return content == selection;
+ }
+ }).property('content', 'parentView.selection').volatile(),
+
+ labelPathDidChange: Ember.observer(function() {
+ var labelPath = get(this, 'parentView.optionLabelPath');
+
+ if (!labelPath) { return; }
+
+ Ember.defineProperty(this, 'label', Ember.computed(function() {
+ return get(this, labelPath);
+ }).property(labelPath).cacheable());
+ }, 'parentView.optionLabelPath'),
+
+ valuePathDidChange: Ember.observer(function() {
+ var valuePath = get(this, 'parentView.optionValuePath');
+
+ if (!valuePath) { return; }
+
+ Ember.defineProperty(this, 'value', Ember.computed(function() {
+ return get(this, valuePath);
+ }).property(valuePath).cacheable());
+ }, 'parentView.optionValuePath')
+});
+
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+/*globals Handlebars */
+// Find templates stored in the head tag as script tags and make them available
+// to Ember.CoreView in the global Ember.TEMPLATES object. This will be run as as
+// jQuery DOM-ready callback.
+//
+// Script tags with "text/x-handlebars" will be compiled
+// with Ember's Handlebars and are suitable for use as a view's template.
+// Those with type="text/x-raw-handlebars" will be compiled with regular
+// Handlebars and are suitable for use in views' computed properties.
+Ember.Handlebars.bootstrap = function(ctx) {
+ var selectors = 'script[type="text/x-handlebars"], script[type="text/x-raw-handlebars"]';
+
+ Ember.$(selectors, ctx)
+ .each(function() {
+ // Get a reference to the script tag
+ var script = Ember.$(this),
+ type = script.attr('type');
+
+ var compile = (script.attr('type') === 'text/x-raw-handlebars') ?
+ Ember.$.proxy(Handlebars.compile, Handlebars) :
+ Ember.$.proxy(Ember.Handlebars.compile, Ember.Handlebars),
+ // Get the name of the script, used by Ember.View's templateName property.
+ // First look for data-template-name attribute, then fall back to its
+ // id if no name is found.
+ templateName = script.attr('data-template-name') || script.attr('id'),
+ template = compile(script.html()),
+ view, viewPath, elementId, options;
+
+ if (templateName) {
+ // For templates which have a name, we save them and then remove them from the DOM
+ Ember.TEMPLATES[templateName] = template;
+
+ // Remove script tag from DOM
+ script.remove();
+ } else {
+ if (script.parents('head').length !== 0) {
+ // don't allow inline templates in the head
+ throw new Ember.Error("Template found in <head> without a name specified. " +
+ "Please provide a data-template-name attribute.\n" +
+ script.html());
+ }
+
+ // For templates which will be evaluated inline in the HTML document, instantiates a new
+ // view, and replaces the script tag holding the template with the new
+ // view's DOM representation.
+ //
+ // Users can optionally specify a custom view subclass to use by setting the
+ // data-view attribute of the script tag.
+ viewPath = script.attr('data-view');
+ view = viewPath ? Ember.get(viewPath) : Ember.View;
+
+ // Get the id of the script, used by Ember.View's elementId property,
+ // Look for data-element-id attribute.
+ elementId = script.attr('data-element-id');
+
+ options = { template: template };
+ if (elementId) { options.elementId = elementId; }
+
+ view = view.create(options);
+
+ view._insertElementLater(function() {
+ script.replaceWith(this.$());
+
+ // Avoid memory leak in IE
+ script = null;
+ });
+ }
+ });
+};
+
+/** @private */
+function bootstrap() {
+ Ember.Handlebars.bootstrap( Ember.$(document) );
+}
+
+/*
+ We tie this to application.load to ensure that we've at least
+ attempted to bootstrap at the point that the application is loaded.
+
+ We also tie this to document ready since we're guaranteed that all
+ the inline templates are present at this point.
+
+ There's no harm to running this twice, since we remove the templates
+ from the DOM after processing.
+*/
+
+Ember.$(document).ready(bootstrap);
+Ember.onLoad('application', bootstrap);
+
+})();
+
+
+
+(function() {
+// ==========================================================================
+// Project: Ember Handlebars Views
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
+// Version: v1.0.pre
+// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
+
+
+(function() {
+// ==========================================================================
+// Project: Ember
+// Copyright: ©2011 Strobe Inc. and contributors.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+})();
+
diff --git a/src/components/HMI/lib/ember-1.0.pre.min.js b/src/components/HMI/lib/ember-1.0.pre.min.js
new file mode 100644
index 0000000000..73375a7d56
--- /dev/null
+++ b/src/components/HMI/lib/ember-1.0.pre.min.js
@@ -0,0 +1,18 @@
+// ==========================================================================
+// Project: Ember - JavaScript Application Framework
+// Copyright: ©2011-2012 Tilde Inc. and contributors
+// Portions ©2006-2011 Strobe Inc.
+// Portions ©2008-2011 Apple Inc. All rights reserved.
+// License: Licensed under MIT license (see license.js)
+// ==========================================================================
+
+
+// Version: v1.0.pre
+// Last commit: 7955b85 (2012-08-03 14:50:17 -0700)
+
+
+(function(){"undefined"==typeof Ember&&(Ember={}),"undefined"!=typeof window&&(window.Em=window.Ember=Em=Ember),Ember.isNamespace=!0,Ember.toString=function(){return"Ember"},Ember.VERSION="1.0.pre",Ember.ENV=Ember.ENV||("undefined"==typeof ENV?{}:ENV),Ember.config=Ember.config||{},Ember.EXTEND_PROTOTYPES=Ember.ENV.EXTEND_PROTOTYPES!==!1,Ember.LOG_STACKTRACE_ON_DEPRECATION=Ember.ENV.LOG_STACKTRACE_ON_DEPRECATION!==!1,Ember.SHIM_ES5=Ember.ENV.SHIM_ES5===!1?!1:Ember.EXTEND_PROTOTYPES,Ember.CP_DEFAULT_CACHEABLE=Ember.ENV.CP_DEFAULT_CACHEABLE!==!1,Ember.VIEW_PRESERVES_CONTEXT=Ember.ENV.VIEW_PRESERVES_CONTEXT!==!1,Ember.K=function(){return this},"undefined"==typeof Ember.assert&&(Ember.assert=Ember.K),"undefined"==typeof Ember.warn&&(Ember.warn=Ember.K),"undefined"==typeof Ember.deprecate&&(Ember.deprecate=Ember.K),"undefined"==typeof Ember.deprecateFunc&&(Ember.deprecateFunc=function(a,b){return b}),"undefined"==typeof ember_assert&&(window.ember_assert=Ember.K),"undefined"==typeof ember_warn&&(window.ember_warn=Ember.K),"undefined"==typeof ember_deprecate&&(window.ember_deprecate=Ember.K),"undefined"==typeof ember_deprecateFunc&&(window.ember_deprecateFunc=function(a,b){return b}),Ember.Logger=window.console||{log:Ember.K,warn:Ember.K,error:Ember.K,info:Ember.K,debug:Ember.K}})(),function(){var a=function(a){return a&&Function.prototype.toString.call(a).indexOf("[native code]")>-1},b=a(Array.prototype.map)?Array.prototype.map:function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;var d=new Array(c),e=arguments[1];for(var f=0;f<c;f++)f in b&&(d[f]=a.call(e,b[f],f,b));return d},c=a(Array.prototype.forEach)?Array.prototype.forEach:function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;var d=arguments[1];for(var e=0;e<c;e++)e in b&&a.call(d,b[e],e,b)},d=a(Array.prototype.indexOf)?Array.prototype.indexOf:function(a,b){b===null||b===undefined?b=0:b<0&&(b=Math.max(0,this.length+b));for(var c=b,d=this.length;c<d;c++)if(this[c]===a)return c;return-1};Ember.ArrayPolyfills={map:b,forEach:c,indexOf:d};var e=Ember.EnumerableUtils={map:function(a,c,d){return a.map?a.map.call(a,c,d):b.call(a,c,d)},forEach:function(a,b,d){return a.forEach?a.forEach.call(a,b,d):c.call(a,b,d)},indexOf:function(a,b,c){return a.indexOf?a.indexOf.call(a,b,c):d.call(a,b,c)},indexesOf:function(a,b){return b===undefined?[]:e.map(b,function(b){return e.indexOf(a,b)})},removeObject:function(a,b){var c=e.indexOf(a,b);c!==-1&&a.splice(c,1)}};Ember.SHIM_ES5&&(Array.prototype.map||(Array.prototype.map=b),Array.prototype.forEach||(Array.prototype.forEach=c),Array.prototype.indexOf||(Array.prototype.indexOf=d))}(),function(){var a=Ember.platform={};Ember.create=Object.create;if(!Ember.create){var b=function(){};Ember.create=function(a,c){b.prototype=a,a=new b;if(c){b.prototype=a;for(var d in c)b.prototype[d]=c[d].value;a=new b}return b.prototype=null,a},Ember.create.isSimulated=!0}var c=Object.defineProperty,d,e;if(c)try{c({},"a",{get:function(){}})}catch(f){c=null}c&&(d=function(){var a={};return c(a,"a",{configurable:!0,enumerable:!0,get:function(){},set:function(){}}),c(a,"a",{configurable:!0,enumerable:!0,writable:!0,value:!0}),a.a===!0}(),e=function(){try{return c(document.createElement("div"),"definePropertyOnDOM",{}),!0}catch(a){}return!1}(),d?e||(c=function(a,b,c){var d;return typeof Node=="object"?d=a instanceof Node:d=typeof a=="object"&&typeof a.nodeType=="number"&&typeof a.nodeName=="string",d?a[b]=c.value:Object.defineProperty(a,b,c)}):c=null),a.defineProperty=c,a.hasPropertyAccessors=!0,a.defineProperty||(a.hasPropertyAccessors=!1,a.defineProperty=function(a,b,c){c.get||(a[b]=c.value)},a.defineProperty.isSimulated=!0),Ember.ENV.MANDATORY_SETTER&&!a.hasPropertyAccessors&&(Ember.ENV.MANDATORY_SETTER=!1)}(),function(){function m(a){this.descs={},this.watching={},this.cache={},this.source=a}function n(a,b){return!!a&&typeof a[b]=="function"}var a=Ember.platform.defineProperty,b=Ember.create,c="__ember"+ +(new Date),d=0,e=[],f={},g=Ember.ENV.MANDATORY_SETTER;Ember.GUID_KEY=c;var h={writable:!1,configurable:!1,enumerable:!1,value:null};Ember.generateGuid=function(e,f){f||(f="ember");var g=f+d++;return e&&(h.value=g,a(e,c,h)),g},Ember.guidFor=function(g){if(g===undefined)return"(undefined)";if(g===null)return"(null)";var i,j,k=typeof g;switch(k){case"number":return j=e[g],j||(j=e[g]="nu"+g),j;case"string":return j=f[g],j||(j=f[g]="st"+d++),j;case"boolean":return g?"(true)":"(false)";default:if(g[c])return g[c];if(g===Object)return"(Object)";if(g===Array)return"(Array)";return j="ember"+d++,h.value=j,a(g,c,h),j}};var i={writable:!0,configurable:!1,enumerable:!1,value:null},j=Ember.GUID_KEY+"_meta";Ember.META_KEY=j;var k={descs:{},watching:{}};g&&(k.values={}),Ember.EMPTY_META=k,Object.freeze&&Object.freeze(k);var l=Ember.platform.defineProperty.isSimulated;l&&(m.prototype.__preventPlainObject__=!0),Ember.meta=function(d,e){var f=d[j];return e===!1?f||k:(f?f.source!==d&&(l||a(d,j,i),f=b(f),f.descs=b(f.descs),f.watching=b(f.watching),f.cache={},f.source=d,g&&(f.values=b(f.values)),d[j]=f):(l||a(d,j,i),f=new m(d),g&&(f.values={}),d[j]=f,f.descs.constructor=null),f)},Ember.getMeta=function(b,c){var d=Ember.meta(b,!1);return d[c]},Ember.setMeta=function(b,c,d){var e=Ember.meta(b,!0);return e[c]=d,d},Ember.metaPath=function(c,d,e){var f=Ember.meta(c,e),g,h;for(var i=0,j=d.length;i<j;i++){g=d[i],h=f[g];if(!h){if(!e)return undefined;h=f[g]={__ember_source__:c}}else if(h.__ember_source__!==c){if(!e)return undefined;h=f[g]=b(h),h.__ember_source__=c}f=h}return h},Ember.wrap=function(a,b){function c(){}var d=function(){var d,e=this._super;return this._super=b||c,d=a.apply(this,arguments),this._super=e,d};return d.base=a,d},Ember.isArray=function(a){return!a||a.setInterval?!1:Array.isArray&&Array.isArray(a)?!0:Ember.Array&&Ember.Array.detect(a)?!0:a.length!==undefined&&"object"==typeof a?!0:!1},Ember.makeArray=function(a){return a===null||a===undefined?[]:Ember.isArray(a)?a:[a]},Ember.canInvoke=n,Ember.tryInvoke=function(a,b,c){if(n(a,b))return a[b].apply(a,c)}}(),function(){var a=Ember.guidFor,b=Ember.ArrayPolyfills.indexOf,c=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},d=function(a,b){var d=a.keys.copy(),e=c(a.values);return b.keys=d,b.values=e,b},e=Ember.OrderedSet=function(){this.clear()};e.create=function(){return new e},e.prototype={clear:function(){this.presenceSet={},this.list=[]},add:function(b){var c=a(b),d=this.presenceSet,e=this.list;if(c in d)return;d[c]=!0,e.push(b)},remove:function(c){var d=a(c),e=this.presenceSet,f=this.list;delete e[d];var g=b.call(f,c);g>-1&&f.splice(g,1)},isEmpty:function(){return this.list.length===0},forEach:function(a,b){var c=this.list.slice();for(var d=0,e=c.length;d<e;d++)a.call(b,c[d])},toArray:function(){return this.list.slice()},copy:function(){var a=new e;return a.presenceSet=c(this.presenceSet),a.list=this.list.slice(),a}};var f=Ember.Map=function(){this.keys=Ember.OrderedSet.create(),this.values={}};f.create=function(){return new f},f.prototype={get:function(b){var c=this.values,d=a(b);return c[d]},set:function(b,c){var d=this.keys,e=this.values,f=a(b);d.add(b),e[f]=c},remove:function(b){var c=this.keys,d=this.values,e=a(b),f;return d.hasOwnProperty(e)?(c.remove(b),f=d[e],delete d[e],!0):!1},has:function(b){var c=this.values,d=a(b);return c.hasOwnProperty(d)},forEach:function(b,c){var d=this.keys,e=this.values;d.forEach(function(d){var f=a(d);b.call(c,d,e[f])})},copy:function(){return d(this,new f)}};var g=Ember.MapWithDefault=function(a){f.call(this),this.defaultValue=a.defaultValue};g.create=function(a){return a?new g(a):new f},g.prototype=Ember.create(f.prototype),g.prototype.get=function(a){var b=this.has(a);if(b)return f.prototype.get.call(this,a);var c=this.defaultValue(a);return this.set(a,c),c},g.prototype.copy=function(){return d(this,new g({defaultValue:this.defaultValue}))}}(),function(){function i(a){return a.match(h)[0]}function j(a,c){var d=g.test(c),e=!d&&f.test(c),h;if(!a||e)a=window;d&&(c=c.slice(5)),a===window&&(h=i(c),a=b(a,h),c=c.slice(h.length+1));if(!c||c.length===0)throw new Error("Invalid Path");return[a,c]}function k(a,c){var d,e,f,h,i;if(a===null&&c.indexOf(".")===-1)return b(window,c);d=g.test(c);if(!a||d)f=j(a,c),a=f[0],c=f[1],f.length=0;e=c.split("."),i=e.length;for(h=0;a&&h<i;h++){a=b(a,e[h],!0);if(a&&a.isDestroyed)return undefined}return a}function l(a,b,d,e){var f;f=b.slice(b.lastIndexOf(".")+1),b=b.slice(0,b.length-(f.length+1)),b!=="this"&&(a=k(a,b));if(!f||f.length===0)throw new Error("You passed an empty path");if(!a){if(e)return;throw new Error("Object in path "+b+" could not be found or was destroyed.")}return c(a,f,d)}var a=Ember.META_KEY,b,c,d=Ember.ENV.MANDATORY_SETTER,e=/^([A-Z$]|([0-9][A-Z$]))/,f=/^([A-Z$]|([0-9][A-Z$])).*[\.\*]/,g=/^this[\.\*]/,h=/^([^\.\*]+)/;b=function(c,e){if(e==="")return c;!e&&"string"==typeof c&&(e=c,c=null);if(!c||e.indexOf(".")!==-1)return k(c,e);var f=c[a],g=f&&f.descs[e],h;return g?g.get(c,e):(d&&f&&f.watching[e]>0?h=f.values[e]:h=c[e],h!==undefined||"object"!=typeof c||e in c||"function"!=typeof c.unknownProperty?h:c.unknownProperty(e))},c=function(c,e,f,g){typeof c=="string"&&(f=e,e=c,c=null);if(!c||e.indexOf(".")!==-1)return l(c,e,f,g);var h=c[a],i=h&&h.descs[e],j,k;return i?i.set(c,e,f):(j="object"==typeof c&&!(e in c),j&&"function"==typeof c.setUnknownProperty?c.setUnknownProperty(e,f):h&&h.watching[e]>0?(d?k=h.values[e]:k=c[e],f!==k&&(Ember.propertyWillChange(c,e),d?k!==undefined||e in c?h.values[e]=f:Ember.defineProperty(c,e,null,f):c[e]=f,Ember.propertyDidChange(c,e))):c[e]=f),f},Ember.normalizeTuple=function(a,b){return j(a,b)},Ember.getWithDefault=function(a,c,d){var e=b(a,c);return e===undefined?d:e},Ember.get=b,Ember.getPath=Ember.deprecateFunc("getPath is deprecated since get now supports paths",Ember.get),Ember.set=c,Ember.setPath=Ember.deprecateFunc("setPath is deprecated since set now supports paths",Ember.set),Ember.trySet=function(a,b,d){return c(a,b,d,!0)},Ember.trySetPath=Ember.deprecateFunc("trySetPath has been renamed to trySet",Ember.trySet),Ember.isGlobalPath=function(a){return e.test(a)},Ember.config.overrideAccessors&&(Ember.config.overrideAccessors(),b=Ember.get,c=Ember.set)}(),function(){var a=Ember.GUID_KEY,b=Ember.META_KEY,c=Ember.EMPTY_META,d=Ember.meta,e=Ember.create,f=Ember.platform.defineProperty,g=Ember.ENV.MANDATORY_SETTER,h=Ember.Descriptor=function(){};Ember.defineProperty=function(a,c,e,h,i){var j,k,l,m;return i||(i=d(a)),j=i.descs,k=i.descs[c],l=i.watching[c]>0,k instanceof Ember.Descriptor&&k.teardown(a,c),e instanceof Ember.Descriptor?(m=e,j[c]=e,g&&l?f(a,c,{configurable:!0,enumerable:!0,writable:!0,value:undefined}):a[c]=undefined,e.setup(a,c)):(j[c]=undefined,e==null?(m=h,g&&l?(i.values[c]=h,f(a,c,{configurable:!0,enumerable:!0,set:function(){},get:function(){var a=this[b];return a&&a.values[c]}})):a[c]=h):(m=e,f(a,c,e))),l&&Ember.overrideChains(a,c,i),a.didDefineProperty&&a.didDefineProperty(a,c,m),this}}(),function(){function j(a,b,c,e){d&&!e?h.push(a,b,c):Ember.sendEvent(a,b,[a,c])}function k(){i.clear(),h.flush()}function l(b){return b+a}function m(a){return a+b}var a=":change",b=":before",c=Ember.guidFor,d=0,e=[].slice,f=function(){this.targetSet={}};f.prototype.add=function(a,b){var c=this.targetSet,d=Ember.guidFor(a),e=c[d];return e||(c[d]=e={}),e[b]?!1:e[b]=!0},f.prototype.clear=function(){this.targetSet={}};var g=function(){this.targetSet={},this.queue=[]};g.prototype.push=function(a,b,c){var d=this.targetSet,e=this.queue,f=Ember.guidFor(a),g=d[f],h;g||(d[f]=g={}),h=g[b],h===undefined?g[b]=e.push(Ember.deferEvent(a,b,[a,c]))-1:e[h]=Ember.deferEvent(a,b,[a,c])},g.prototype.flush=function(){var a=this.queue;this.queue=[],this.targetSet={};for(var b=0,c=a.length;b<c;++b)a[b]()};var h=new g,i=new f;Ember.beginPropertyChanges=function(){return d++,this},Ember.endPropertyChanges=function(){d--,d<=0&&k()},Ember.changeProperties=function(a,b){Ember.beginPropertyChanges();try{a.call(b)}finally{Ember.endPropertyChanges()}},Ember.setProperties=function(a,b){return Ember.changeProperties(function(){for(var c in b)b.hasOwnProperty(c)&&Ember.set(a,c,b[c])}),a},Ember.addObserver=function(a,b,c,d){return Ember.addListener(a,l(b),c,d),Ember.watch(a,b),this},Ember.observersFor=function(a,b){return Ember.listenersFor(a,l(b))},Ember.removeObserver=function(a,b,c,d){return Ember.unwatch(a,b),Ember.removeListener(a,l(b),c,d),this},Ember.addBeforeObserver=function(a,b,c,d){return Ember.addListener(a,m(b),c,d),Ember.watch(a,b),this},Ember._suspendBeforeObserver=function(a,b,c,d,e){return Ember._suspendListener(a,m(b),c,d,e)},Ember._suspendObserver=function(a,b,c,d,e){return Ember._suspendListener(a,l(b),c,d,e)},Ember.beforeObserversFor=function(a,b){return Ember.listenersFor(a,m(b))},Ember.removeBeforeObserver=function(a,b,c,d){return Ember.unwatch(a,b),Ember.removeListener(a,m(b),c,d),this},Ember.notifyObservers=function(a,b){if(a.isDestroying)return;j(a,l(b),b)},Ember.notifyBeforeObservers=function(a,b){if(a.isDestroying)return;var c,e,f=!1;if(d){if(!i.add(a,b))return;f=!0}j(a,m(b),b,f)}}(),function(){function n(a){return a.match(j)[0]}function o(a){return a==="*"||!k.test(a)}function q(b,c,d,e,f){var g=a(c);e[g]||(e[g]={});if(e[g][d])return;e[g][d]=!0;var h=f.deps;h=h&&h[d];if(h)for(var i in h){if(p[i])continue;b(c,i)}}function t(a,b,c){if(a.isDestroying)return;var d=r,e=!d;e&&(d=r={}),q(G,a,b,d,c),e&&(r=null)}function u(a,b,c){if(a.isDestroying)return;var d=s,e=!d;e&&(d=s={}),q(H,a,b,d,c),e&&(s=null)}function v(c,d,e){if(!c||"object"!=typeof c)return;var f=b(c),g=f.chainWatchers;if(!g||g.__emberproto__!==c)g=f.chainWatchers={__emberproto__:c};g[d]||(g[d]={}),g[d][a(e)]=e,Ember.watch(c,d)}function w(c,d,e){if(!c||"object"!=typeof c)return;var f=b(c,!1),g=f.chainWatchers;if(!g||g.__emberproto__!==c)return;g[d]&&delete g[d][a(e)],Ember.unwatch(c,d)}function y(){if(x.length===0)return;var a=x;x=[],i.call(a,function(a){a[0].add(a[1])})}function z(a){return b(a,!1).proto===a}function C(a){var c=b(a),d=c.chains;return d?d.value()!==a&&(d=c.chains=d.copy(a)):d=c.chains=new A(null,null,a),d}function D(a,b,c,d,e){var f=b.chainWatchers;if(!f||f.__emberproto__!==a)return;f=f[c];if(!f)return;for(var g in f){if(!f.hasOwnProperty(g))continue;f[g][d](e)}}function E(a,b,c){D(a,c,b,"willChange")}function F(a,b,c){D(a,c,b,"didChange")}function G(a,c,d){var e=b(a,!1),f=e.watching[c]>0||c==="length",g=e.proto,h=e.descs[c];if(!f)return;if(g===a)return;h&&h.willChange&&h.willChange(a,c),t(a,c,e),E(a,c,e),Ember.notifyBeforeObservers(a,c)}function H(a,c){var d=b(a,!1),e=d.watching[c]>0||c==="length",f=d.proto,g=d.descs[c];if(f===a)return;g&&g.didChange&&g.didChange(a,c);if(!e&&c!=="length")return;u(a,c,d),F(a,c,d),Ember.notifyObservers(a,c)}var a=Ember.guidFor,b=Ember.meta,c=Ember.get,d=Ember.set,e=Ember.normalizeTuple,f=Ember.GUID_KEY,g=Ember.META_KEY,h=Ember.notifyObservers,i=Ember.ArrayPolyfills.forEach,j=/^([^\.\*]+)/,k=/[\.\*]/,l=Ember.ENV.MANDATORY_SETTER,m=Ember.platform.defineProperty,p={__emberproto__:!0},r,s,x=[],A=function(a,b,c,d){var e;this._parent=a,this._key=b,this._watching=c===undefined,this._value=c,this._separator=d||".",this._paths={},this._watching&&(this._object=a.value(),this._object&&v(this._object,this._key,this)),this._parent&&this._parent._key==="@each"&&this.value()},B=A.prototype;B.value=function(){if(this._value===undefined&&this._watching){var a=this._parent.value();this._value=a&&!z(a)?c(a,this._key):undefined}return this._value},B.destroy=function(){if(this._watching){var a=this._object;a&&w(a,this._key,this),this._watching=!1}},B.copy=function(a){var b=new A(null,null,a,this._separator),c=this._paths,d;for(d in c){if(c[d]<=0)continue;b.add(d)}return b},B.add=function(a){var b,c,d,f,g,h;h=this._paths,h[a]=(h[a]||0)+1,b=this.value(),c=e(b,a);if(c[0]&&c[0]===b)a=c[1],d=n(a),a=a.slice(d.length+1);else{if(!c[0]){x.push([this,a]),c.length=0;return}f=c[0],d=a.slice(0,0-(c[1].length+1)),g=a.slice(d.length,d.length+1),a=c[1]}c.length=0,this.chain(d,a,f,g)},B.remove=function(a){var b,c,d,f,g;g=this._paths,g[a]>0&&g[a]--,b=this.value(),c=e(b,a),c[0]===b?(a=c[1],d=n(a),a=a.slice(d.length+1)):(f=c[0],d=a.slice(0,0-(c[1].length+1)),a=c[1]),c.length=0,this.unchain(d,a)},B.count=0,B.chain=function(a,b,c,d){var e=this._chains,f;e||(e=this._chains={}),f=e[a],f||(f=e[a]=new A(this,a,c,d)),f.count++,b&&b.length>0&&(a=n(b),b=b.slice(a.length+1),f.chain(a,b))},B.unchain=function(a,b){var c=this._chains,d=c[a];b&&b.length>1&&(a=n(b),b=b.slice(a.length+1),d.unchain(a,b)),d.count--,d.count<=0&&(delete c[d._key],d.destroy())},B.willChange=function(){var a=this._chains;if(a)for(var b in a){if(!a.hasOwnProperty(b))continue;a[b].willChange()}this._parent&&this._parent.chainWillChange(this,this._key,1)},B.chainWillChange=function(a,b,c){this._key&&(b=this._key+this._separator+b),this._parent?this._parent.chainWillChange(this,b,c+1):(c>1&&Ember.propertyWillChange(this.value(),b),b="this."+b,this._paths[b]>0&&Ember.propertyWillChange(this.value(),b))},B.chainDidChange=function(a,b,c){this._key&&(b=this._key+this._separator+b),this._parent?this._parent.chainDidChange(this,b,c+1):(c>1&&Ember.propertyDidChange(this.value(),b),b="this."+b,this._paths[b]>0&&Ember.propertyDidChange(this.value(),b))},B.didChange=function(a){if(this._watching){var b=this._parent.value();b!==this._object&&(w(this._object,this._key,this),this._object=b,v(b,this._key,this)),this._value=undefined,this._parent&&this._parent._key==="@each"&&this.value()}var c=this._chains;if(c)for(var d in c){if(!c.hasOwnProperty(d))continue;c[d].didChange(a)}if(a)return;this._parent&&this._parent.chainDidChange(this,this._key,1)},Ember.overrideChains=function(a,b,c){D(a,c,b,"didChange",!0)},Ember.watch=function(a,c){if(c==="length"&&Ember.typeOf(a)==="array")return this;var d=b(a),e=d.watching,f;return e[c]?e[c]=(e[c]||0)+1:(e[c]=1,o(c)?(f=d.descs[c],f&&f.willWatch&&f.willWatch(a,c),"function"==typeof a.willWatchProperty&&a.willWatchProperty(c),l&&c in a&&(d.values[c]=a[c],m(a,c,{configurable:!0,enumerable:!0,set:function(){},get:function(){var a=this[g];return a&&a.values[c]}}))):C(a).add(c)),this},Ember.isWatching=function(b,c){var d=b[g];return(d&&d.watching[c])>0},Ember.watch.flushPending=y,Ember.unwatch=function(a,c){if(c==="length"&&Ember.typeOf(a)==="array")return this;var d=b(a),e=d.watching,f;return e[c]===1?(e[c]=0,o(c)?(f=d.descs[c],f&&f.didUnwatch&&f.didUnwatch(a,c),"function"==typeof a.didUnwatchProperty&&a.didUnwatchProperty(c),l&&c in a&&(m(a,c,{configurable:!0,enumerable:!0,writable:!0,value:d.values[c]}),delete d.values[c])):C(a).remove(c)):e[c]>1&&e[c]--,this},Ember.rewatch=function(a){var c=b(a,!1),d=c.chains;return f in a&&!a.hasOwnProperty(f)&&Ember.generateGuid(a,"ember"),d&&d.value()!==a&&(c.chains=d.copy(a)),this},Ember.finishChains=function(a){var c=b(a,!1),d=c.chains;d&&(d.value()!==a&&(c.chains=d=d.copy(a)),d.didChange(!0))},Ember.propertyWillChange=G,Ember.propertyDidChange=H;var I=[];Ember.destroy=function(a){var b=a[g],c,d,e,f;if(b){a[g]=null,c=b.chains;if(c){I.push(c);while(I.length>0){c=I.pop(),d=c._chains;if(d)for(e in d)d.hasOwnProperty(e)&&I.push(d[e]);c._watching&&(f=c._object,f&&w(f,c._key,c))}}}}}(),function(){function i(a,b,c){var d=b[c];return d?d.__emberproto__!==a&&(d=b[c]=e(d),d.__emberproto__=a):d=b[c]={__emberproto__:a},d}function j(a,b){var c=b.deps;return c?c.__emberproto__!==a&&(c=b.deps=e(c),c.__emberproto__=a):c=b.deps={__emberproto__:a},c}function k(a,b,c,d){var e=a._dependentKeys,f,h,k,l,m;if(!e)return;f=j(b,d);for(h=0,k=e.length;h<k;h++)l=e[h],m=i(b,f,l),m[c]=(m[c]||0)+1,g(b,l)}function l(a,b,c,d){var e=a._dependentKeys,f,g,k,l,m;if(!e)return;f=j(b,d);for(g=0,k=e.length;g<k;g++)l=e[g],m=i(b,f,l),m[c]=(m[c]||0)-1,h(b,l)}function m(a,b){this.func=a,this._cacheable=b&&b.cacheable!==undefined?b.cacheable:Ember.CP_DEFAULT_CACHEABLE,this._dependentKeys=b&&b.dependentKeys}var a=Ember.get,b=Ember.meta,c=Ember.guidFor,d=[].slice,e=Ember.create,f=Ember.META_KEY,g=Ember.watch,h=Ember.unwatch;Ember.ComputedProperty=m,m.prototype=new Ember.Descriptor;var n=m.prototype;n.cacheable=function(a){return this._cacheable=a!==!1,this},n.volatile=function(){return this.cacheable(!1)},n.property=function(){var a=[];for(var b=0,c=arguments.length;b<c;b++)a.push(arguments[b]);return this._dependentKeys=a,this},n.meta=function(a){return arguments.length===0?this._meta||{}:(this._meta=a,this)},n.willWatch=function(a,b){var c=a[f];b in c.cache||k(this,a,b,c)},n.didUnwatch=function(a,b){var c=a[f];b in c.cache||l(this,a,b,c)},n.didChange=function(a,c){if(this._cacheable&&this._suspended!==a){var d=b(a);c in d.cache&&(delete d.cache[c],d.watching[c]||l(this,a,c,d))}},n.get=function(a,c){var d,e,f;if(this._cacheable){f=b(a),e=f.cache;if(c in e)return e[c];d=e[c]=this.func.call(a,c),f.watching[c]||k(this,a,c,f)}else d=this.func.call(a,c);return d},n.set=function(a,c,d){var e=this._cacheable,f=b(a,e),g=f.watching[c],h=this._suspended,i,j;return this._suspended=a,g&&Ember.propertyWillChange(a,c),e&&c in f.cache&&(delete f.cache[c],i=!0),j=this.func.call(a,c,d),e&&(!g&&!i&&k(this,a,c,f),f.cache[c]=j),g&&Ember.propertyDidChange(a,c),this._suspended=h,j},n.setup=function(a,c){var d=a[f];d&&d.watching[c]&&k(this,a,c,b(a))},n.teardown=function(a,c){var d=b(a);return(d.watching[c]||c in d.cache)&&l(this,a,c,d),this._cacheable&&delete d.cache[c],null},Ember.computed=function(a){var b;arguments.length>1&&(b=d.call(arguments,0,-1),a=d.call(arguments,-1)[0]);var c=new m(a);return b&&c.property.apply(c,b),c},Ember.cacheFor=function(c,d){var e=b(c,!1).cache;if(e&&d in e)return e[d]},Ember.computed.not=function(b){return Ember.computed(b,function(c){return!a(this,b)}).cacheable()},Ember.computed.empty=function(b){return Ember.computed(b,function(c){var d=a(this,b);return d===undefined||d===null||d===""||Ember.isArray(d)&&a(d,"length")===0}).cacheable()},Ember.computed.bool=function(b){return Ember.computed(b,function(c){return!!a(this,b)}).cacheable()}}(),function(){function f(a,b,e,f){return c(a,["listeners",b,d(e)],f)}function g(a,c){var d=b(a,!1).listeners;return d?d[c]||!1:!1}function i(a,b,c,d){var e=g(a,b);if(!e)return!1;for(var f in e){if(h[f])continue;var i=e[f];if(i)for(var j in i){if(h[j])continue;var k=i[j];if(k&&c(k,d,a)===!0)return!0}}return!1}function j(a,b,c){var d=a.method,e=a.target;e||(e=c),"string"==typeof d&&(d=e[d]),b?d.apply(e,b):d.apply(e)}function k(a,b,c,e){!e&&"function"==typeof c&&(e=c,c=null);var g=f(a,b,c,!0),h=d(e);g[h]||(g[h]={target:c,method:e}),"function"==typeof a.didAddListener&&a.didAddListener(b,c,e)}function l(a,b,c,e){!e&&"function"==typeof c&&(e=c,c=null);var g=f(a,b,c,!0),h=d(e);g&&g[h]&&(g[h]=null),"function"==typeof a.didRemoveListener&&a.didRemoveListener(b,c,e)}function m(a,b,c,e,g){!e&&"function"==typeof c&&(e=c,c=null);var h=f(a,b,c,!0),i=d(e),j=h&&h[i];h[i]=null;try{return g.call(c)}finally{h[i]=j}}function n(a){var c=b(a,!1).listeners,d=[];if(c)for(var e in c)!h[e]&&c[e]&&d.push(e);return d}function o(a,b,c){return a!==Ember&&"function"==typeof a.sendEvent&&a.sendEvent(b,c),i(a,b,j,c),!0}function p(a,b,c){var d=[];return i(a,b,function(a){d.push(a)}),function(){if(a.isDestroyed)return;a!==Ember&&"function"==typeof a.sendEvent&&a.sendEvent(b,c);for(var e=0,f=d.length;e<f;++e)j(d[e],c,a)}}function q(a,b){if(i(a,b,function(){return!0}))return!0;var d=c(a,["listeners"],!0);return d[b]=null,!1}function r(a,b){var c=[];return i(a,b,function(a){c.push([a.target,a.method])}),c}var a=Ember.create,b=Ember.meta,c=Ember.metaPath,d=Ember.guidFor,e=[].slice,h={__ember_source__:!0};Ember.addListener=k,Ember.removeListener=l,Ember._suspendListener=m,Ember.sendEvent=o,Ember.hasListeners=q,Ember.watchedEvents=n,Ember.listenersFor=r,Ember.deferEvent=p}(),function(){function c(b,c,d,e){c===undefined&&(c=b,b=undefined),"string"==typeof c&&(c=b[c]),d&&e>0&&(d=d.length>e?a.call(d,e):null);if("function"!=typeof Ember.onerror)return c.apply(b||this,d||[]);try{return c.apply(b||this,d||[])}catch(f){Ember.onerror(f)}}function h(){g=null,f.currentRunLoop&&f.end()}function k(){j=null;var a=+(new Date),b=-1;for(var d in i){if(!i.hasOwnProperty(d))continue;var e=i[d];if(e&&e.expires)if(a>=e.expires)delete i[d],c(e.target,e.method,e.args,2);else if(b<0||e.expires<b)b=e.expires}b>0&&(j=setTimeout(k,b- +(new Date)))}function l(a,b){b[this.tguid]&&delete b[this.tguid][this.mguid],i[a]&&c(this.target,this.method,this.args,2),delete i[a]}function n(){m=null;for(var a in i){if(!i.hasOwnProperty(a))continue;var b=i[a];b.next&&(delete i[a],c(b.target,b.method,b.args,2))}}var a=[].slice,b=Ember.ArrayPolyfills.forEach,d,e=function(a){this._prev=a||null,this.onceTimers={}};e.prototype={end:function(){this.flush()},prev:function(){return this._prev},schedule:function(b,c,d){var e=this._queues,f;e||(e=this._queues={}),f=e[b],f||(f=e[b]=[]);var g=arguments.length>3?a.call(arguments,3):null;return f.push({target:c,method:d,args:g}),this},flush:function(a){function j(a){c(a.target,a.method,a.args)}var e,f,g,h,i;if(!this._queues)return this;Ember.watch.flushPending();if(a)while(this._queues&&(h=this._queues[a])){this._queues[a]=null;if(a==="sync"){i=Ember.LOG_BINDINGS,i&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges();try{b.call(h,j)}finally{Ember.endPropertyChanges()}i&&Ember.Logger.log("End: Flush Sync Queue")}else b.call(h,j)}else{e=Ember.run.queues,g=e.length,f=0;a:while(f<g){a=e[f],h=this._queues&&this._queues[a],delete this._queues[a];if(h)if(a==="sync"){i=Ember.LOG_BINDINGS,i&&Ember.Logger.log("Begin: Flush Sync Queue"),Ember.beginPropertyChanges();try{b.call(h,j)}finally{Ember.endPropertyChanges()}i&&Ember.Logger.log("End: Flush Sync Queue")}else b.call(h,j);for(var k=0;k<=f;k++)if(this._queues&&this._queues[e[k]]){f=k;continue a}f++}}return d=null,this}},Ember.RunLoop=e,Ember.run=function(a,b){var d,e;f.begin();try{if(a||b)d=c(a,b,arguments,2)}finally{f.end()}return d};var f=Ember.run;Ember.run.begin=function(){f.currentRunLoop=new e(f.currentRunLoop)},Ember.run.end=function(){try{f.currentRunLoop.end()}finally{f.currentRunLoop=f.currentRunLoop.prev()}},Ember.run.queues=["sync","actions","destroy","timers"],Ember.run.schedule=function(a,b,c){var d=f.autorun();d.schedule.apply(d,arguments)};var g;Ember.run.hasScheduledTimers=function(){return!!(g||j||m)},Ember.run.cancelTimers=function(){g&&(clearTimeout(g),g=null),j&&(clearTimeout(j),j=null),m&&(clearTimeout(m),m=null),i={}},Ember.run.autorun=function(){return f.currentRunLoop||(f.begin(),g||(g=setTimeout(h,1))),f.currentRunLoop},Ember.run.sync=function(){f.autorun(),f.currentRunLoop.flush("sync")};var i={},j;Ember.run.later=function(b,c){var d,e,g,h,j;return arguments.length===2&&"function"==typeof b?(j=c,c=b,b=undefined,d=[b,c]):(d=a.call(arguments),j=d.pop()),e=+(new Date)+j,g={target:b,method:c,expires:e,args:d},h=Ember.guidFor(g),i[h]=g,f.once(i,k),h},Ember.run.once=function(b,c){var d=Ember.guidFor(b),e=Ember.guidFor(c),g=f.autorun().onceTimers,h=g[d]&&g[d][e],j;return h&&i[h]?i[h].args=a.call(arguments):(j={target:b,method:c,args:a.call(arguments),tguid:d,mguid:e},h=Ember.guidFor(j),i[h]=j,g[d]||(g[d]={}),g[d][e]=h,f.schedule("actions",j,l,h,g)),h};var m;Ember.run.next=function(b,c){var d,e={target:b,method:c,args:a.call(arguments),next:!0};return d=Ember.guidFor(e),i[d]=e,m||(m=setTimeout(n,1)),d},Ember.run.cancel=function(a){delete i[a]}}(),function(){function e(b,c){return a(d(c)?window:b,c)}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}Ember.LOG_BINDINGS=!!Ember.ENV.LOG_BINDINGS;var a=Ember.get,b=Ember.set,c=Ember.guidFor,d=Ember.isGlobalPath,f=function(a,b){this._direction="fwd",this._from=b,this._to=a,this._directionMap=Ember.Map.create()};f.prototype={copy:function(){var a=new f(this._to,this._from);return this._oneWay&&(a._oneWay=!0),a},from:function(a){return this._from=a,this},to:function(a){return this._to=a,this},oneWay:function(){return this._oneWay=!0,this},toString:function(){var a=this._oneWay?"[oneWay]":"";return"Ember.Binding<"+c(this)+">("+this._from+" -> "+this._to+")"+a},connect:function(a){var b=this._from,c=this._to;return Ember.trySet(a,c,e(a,b)),Ember.addObserver(a,b,this,this.fromDidChange),this._oneWay||Ember.addObserver(a,c,this,this.toDidChange),this._readyToSync=!0,this},disconnect:function(a){var b=!this._oneWay;return Ember.removeObserver(a,this._from,this,this.fromDidChange),b&&Ember.removeObserver(a,this._to,this,this.toDidChange),this._readyToSync=!1,this},fromDidChange:function(a){this._scheduleSync(a,"fwd")},toDidChange:function(a){this._scheduleSync(a,"back")},_scheduleSync:function(a,b){var c=this._directionMap,d=c.get(a);d||(Ember.run.schedule("sync",this,this._sync,a),c.set(a,b)),d==="back"&&b==="fwd"&&c.set(a,"fwd")},_sync:function(b){var c=Ember.LOG_BINDINGS;if(b.isDestroyed||!this._readyToSync)return;var d=this._directionMap,f=d.get(b),g=this._from,h=this._to;d.remove(b);if(f==="fwd"){var i=e(b,this._from);c&&Ember.Logger.log(" ",this.toString(),"->",i,b),this._oneWay?Ember.trySet(b,h,i):Ember._suspendObserver(b,h,this,this.toDidChange,function(){Ember.trySet(b,h,i)})}else if(f==="back"){var j=a(b,this._to);c&&Ember.Logger.log(" ",this.toString(),"<-",j,b),Ember._suspendObserver(b,g,this,this.fromDidChange,function(){Ember.trySet(Ember.isGlobalPath(g)?window:b,g,j)})}}},g(f,{from:function(){var a=this,b=new a;return b.from.apply(b,arguments)},to:function(){var a=this,b=new a;return b.to.apply(b,arguments)},oneWay:function(a,b){var c=this,d=new c(null,a);return d.oneWay(b)}}),Ember.Binding=f,Ember.bind=function(a,b,c){return(new Ember.Binding(b,c)).connect(a)},Ember.oneWay=function(a,b,c){return(new Ember.Binding(b,c)).oneWay().connect(a)}}(),function(){function o(a){var b=Ember.meta(a,!0),c=b.mixins;return c?c.__emberproto__!==a&&(c=b.mixins=l(c),c.__emberproto__=a):c=b.mixins={__emberproto__:a},c}function p(b,c){return c&&c.length>0&&(b.mixins=f.call(c,function(b){if(b instanceof a)return b;var c=new a;return c.properties=b,c})),b}function q(a){return"function"==typeof a&&a.isMethod!==!1&&a!==Boolean&&a!==Object&&a!==Number&&a!==Array&&a!==Date&&a!==String}function r(c,d,e,f,i){function v(a){delete e[a],delete f[a]}var j=c.length,k,l,m,o,p,s,t,u;for(k=0;k<j;k++){l=c[k];if(l instanceof a){m=n(l);if(d[m])continue;d[m]=l,o=l.properties}else o=l;if(o){u=f.concatenatedProperties||i.concatenatedProperties,o.concatenatedProperties&&(u=u?u.concat(o.concatenatedProperties):o.concatenatedProperties);for(s in o){if(!o.hasOwnProperty(s))continue;p=o[s];if(p instanceof Ember.Descriptor){if(p===b&&e[s])continue;e[s]=p,f[s]=undefined}else{if(q(p)){t=e[s]===undefined&&f[s],t||(t=i[s]),"function"!=typeof t&&(t=null);if(t){var w=p.__ember_observes__,x=p.__ember_observesBefore__;p=Ember.wrap(p,t),p.__ember_observes__=w,p.__ember_observesBefore__=x}}else if(u&&g.call(u,s)>=0||s==="concatenatedProperties"){var y=f[s]||i[s];p=y?y.concat(p):Ember.makeArray(p)}e[s]=undefined,f[s]=p}}o.hasOwnProperty("toString")&&(i.toString=o.toString)}else l.mixins&&(r(l.mixins,d,e,f,i),l._without&&h.call(l._without,v))}}function s(a){var b=Ember.meta(a),c=b.required;if(!c||c.__emberproto__!==a)c=b.required=c?l(c):{__ember_count__:0},c.__emberproto__=a;return c}function u(a,b,c,d){if(t.test(b)){var e=d.bindings;e?e.__emberproto__!==a&&(e=d.bindings=l(d.bindings),e.__emberproto__=a):e=d.bindings={__emberproto__:a},e[b]=c}}function v(a,b){var c=b.bindings,d,e,f;if(c){for(d in c)e=d!=="__emberproto__"&&c[d],e&&(f=d.slice(0,-7),e instanceof Ember.Binding?(e=e.copy(),e.to(f)):e=new Ember.Binding(f,e),e.connect(a),a[d]=e);b.bindings={__emberproto__:a}}}function w(a,b){return v(a,b||Ember.meta(a)),a}function x(a,d,e){var f={},g={},h=Ember.meta(a),i=h.required,j,l,n,p,q,t,v;r(d,o(a),f,g,a);for(j in g){if(j==="contructor")continue;if(!g.hasOwnProperty(j))continue;n=f[j],l=g[j];if(n===b)j in a||(i=s(a),i.__ember_count__++,i[j]=!0);else{while(n&&n instanceof c){var x=n.methodName;f[x]||g[x]?(l=g[x],n=f[x]):h.descs[x]?(n=h.descs[x],l=undefined):(n=undefined,l=a[x])}if(n===undefined&&l===undefined)continue;p=a[j];if("function"==typeof p)if(q=p.__ember_observesBefore__){t=q.length;for(v=0;v<t;v++)Ember.removeBeforeObserver(a,q[v],null,j)}else if(q=p.__ember_observes__){t=q.length;for(v=0;v<t;v++)Ember.removeObserver(a,q[v],null,j)}u(a,j,l,h),m(a,j,n,l,h);if("function"==typeof l)if(q=l.__ember_observesBefore__){t=q.length;for(v=0;v<t;v++)Ember.addBeforeObserver(a,q[v],null,j)}else if(q=l.__ember_observes__){t=q.length;for(v=0;v<t;v++)Ember.addObserver(a,q[v],null,j)}i&&i[j]&&(i=s(a),i.__ember_count__--,i[j]=!1)}}e||w(a,h);if(!e&&i&&i.__ember_count__>0){var y=[];for(j in i){if(k[j])continue;y.push(j)}}return a
+}function z(a,b,c){var d=n(a);if(c[d])return!1;c[d]=!0;if(a===b)return!0;var e=a.mixins,f=e?e.length:0;while(--f>=0)if(z(e[f],b,c))return!0;return!1}function A(a,b,c){if(c[n(b)])return;c[n(b)]=!0;if(b.properties){var d=b.properties;for(var e in d)d.hasOwnProperty(e)&&(a[e]=!0)}else b.mixins&&h.call(b.mixins,function(b){A(a,b,c)})}function D(a,b,c){var e=a.length;for(var f in b){if(!b.hasOwnProperty||!b.hasOwnProperty(f))continue;var g=b[f];a[e]=f;if(g&&g.toString===d)g[B]=a.join(".");else if(g&&C(g,"isNamespace")){if(c[n(g)])continue;c[n(g)]=!0,D(a,g,c)}}a.length=e}function E(){var a=Ember.Namespace,b,c;if(a.PROCESSED)return;for(var d in window){if(d==="globalStorage"&&window.StorageList&&window.globalStorage instanceof window.StorageList)continue;if(window.hasOwnProperty&&!window.hasOwnProperty(d))continue;try{b=window[d],c=b&&C(b,"isNamespace")}catch(e){continue}c&&(b[B]=d)}}var a,b,c,d,e,f=Ember.ArrayPolyfills.map,g=Ember.ArrayPolyfills.indexOf,h=Ember.ArrayPolyfills.forEach,i=[].slice,j={},k={__emberproto__:!0,__ember_count__:!0},l=Ember.create,m=Ember.defineProperty,n=Ember.guidFor,t=Ember.IS_BINDING=/^.+Binding$/;Ember.mixin=function(a){var b=i.call(arguments,1);return x(a,b,!1),a},Ember.Mixin=function(){return p(this,arguments)},a=Ember.Mixin,a._apply=x,a.applyPartial=function(a){var b=i.call(arguments,1);return x(a,b,!0)},a.finishPartial=w,a.create=function(){d.processed=!1;var a=this;return p(new a,arguments)};var y=a.prototype;y.reopen=function(){var b,c;this.properties?(b=a.create(),b.properties=this.properties,delete this.properties,this.mixins=[b]):this.mixins||(this.mixins=[]);var d=arguments.length,e=this.mixins,f;for(f=0;f<d;f++)b=arguments[f],b instanceof a?e.push(b):(c=a.create(),c.properties=b,e.push(c));return this},y.apply=function(a){return x(a,[this],!1)},y.applyPartial=function(a){return x(a,[this],!0)},y.detect=function(b){if(!b)return!1;if(b instanceof a)return z(b,this,{});var c=Ember.meta(b,!1).mixins;return c?!!c[n(this)]:!1},y.without=function(){var b=new a(this);return b._without=i.call(arguments),b},y.keys=function(){var a={},b={},c=[];A(a,this,b);for(var d in a)a.hasOwnProperty(d)&&c.push(d);return c};var B=Ember.GUID_KEY+"_name",C=Ember.get;Ember.identifyNamespaces=E,e=function(a){var b=a.superclass;if(b)return b[B]?b[B]:e(b);return},d=function(){var a=Ember.Namespace,b;if(a&&!this[B]&&!d.processed){a.PROCESSED||(E(),a.PROCESSED=!0),d.processed=!0;var c=a.NAMESPACES;for(var f=0,g=c.length;f<g;f++)b=c[f],D([b.toString()],b,{})}if(this[B])return this[B];var h=e(this);return h?"(subclass of "+h+")":"(unknown mixin)"},y.toString=d,a.mixins=function(a){var b=[],c=Ember.meta(a,!1).mixins,d,e;if(c)for(d in c){if(k[d])continue;e=c[d],e.properties||b.push(c[d])}return b},b=new Ember.Descriptor,b.toString=function(){return"(Required Property)"},Ember.required=function(){return b},c=function(a){this.methodName=a},c.prototype=new Ember.Descriptor,Ember.alias=function(a){return new c(a)},Ember.observer=function(a){var b=i.call(arguments,1);return a.__ember_observes__=b,a},Ember.immediateObserver=function(){for(var a=0,b=arguments.length;a<b;a++)var c=arguments[a];return Ember.observer.apply(this,arguments)},Ember.beforeObserver=function(a){var b=i.call(arguments,1);return a.__ember_observesBefore__=b,a}}(),function(){}(),function(){}(),function(){function e(b,c,d,f){var g,h,i;if("object"!=typeof b||b===null)return b;if(c&&(h=a(d,b))>=0)return f[h];if(Ember.typeOf(b)==="array"){g=b.slice();if(c){h=g.length;while(--h>=0)g[h]=e(g[h],c,d,f)}}else if(Ember.Copyable&&Ember.Copyable.detect(b))g=b.copy(c,d,f);else{g={};for(i in b){if(!b.hasOwnProperty(i))continue;g[i]=c?e(b[i],c,d,f):b[i]}}return c&&(d.push(b),f.push(g)),g}var a=Ember.EnumerableUtils.indexOf,b={},c="Boolean Number String Function Array Date RegExp Object".split(" ");Ember.ArrayPolyfills.forEach.call(c,function(a){b["[object "+a+"]"]=a.toLowerCase()});var d=Object.prototype.toString;Ember.typeOf=function(a){var c;return c=a===null||a===undefined?String(a):b[d.call(a)]||"object",c==="function"?Ember.Object&&Ember.Object.detect(a)&&(c="class"):c==="object"&&(a instanceof Error?c="error":Ember.Object&&a instanceof Ember.Object?c="instance":c="object"),c},Ember.none=function(a){return a===null||a===undefined},Ember.empty=function(a){return a===null||a===undefined||a.length===0&&typeof a!="function"},Ember.compare=function f(a,b){if(a===b)return 0;var c=Ember.typeOf(a),d=Ember.typeOf(b),e=Ember.Comparable;if(e){if(c==="instance"&&e.detect(a.constructor))return a.constructor.compare(a,b);if(d==="instance"&&e.detect(b.constructor))return 1-b.constructor.compare(b,a)}var g=Ember.ORDER_DEFINITION_MAPPING;if(!g){var h=Ember.ORDER_DEFINITION;g=Ember.ORDER_DEFINITION_MAPPING={};var i,j;for(i=0,j=h.length;i<j;++i)g[h[i]]=i;delete Ember.ORDER_DEFINITION}var k=g[c],l=g[d];if(k<l)return-1;if(k>l)return 1;switch(c){case"boolean":case"number":if(a<b)return-1;if(a>b)return 1;return 0;case"string":var m=a.localeCompare(b);if(m<0)return-1;if(m>0)return 1;return 0;case"array":var n=a.length,o=b.length,p=Math.min(n,o),q=0,r=0;while(q===0&&r<p)q=f(a[r],b[r]),r++;if(q!==0)return q;if(n<o)return-1;if(n>o)return 1;return 0;case"instance":if(Ember.Comparable&&Ember.Comparable.detect(a))return a.compare(a,b);return 0;case"date":var s=a.getTime(),t=b.getTime();if(s<t)return-1;if(s>t)return 1;return 0;default:return 0}},Ember.copy=function(a,b){return"object"!=typeof a||a===null?a:Ember.Copyable&&Ember.Copyable.detect(a)?a.copy(b):e(a,b,b?[]:null,b?[]:null)},Ember.inspect=function(a){var b,c=[];for(var d in a)if(a.hasOwnProperty(d)){b=a[d];if(b==="toString")continue;Ember.typeOf(b)==="function"&&(b="function() { ... }"),c.push(d+": "+b)}return"{"+c.join(" , ")+"}"},Ember.isEqual=function(a,b){return a&&"function"==typeof a.isEqual?a.isEqual(b):a===b},Ember.ORDER_DEFINITION=Ember.ENV.ORDER_DEFINITION||["undefined","null","boolean","number","string","array","object","instance","function","class","date"],Ember.keys=Object.keys,Ember.keys||(Ember.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),Ember.Error=function(){var a=Error.prototype.constructor.apply(this,arguments);for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);this.message=a.message},Ember.Error.prototype=Ember.create(Error.prototype)}(),function(){var a=/[ _]/g,b={},c=/([a-z])([A-Z])/g,d=/(\-|_|\s)+(.)?/g,e=/([a-z\d])([A-Z]+)/g,f=/\-|\s+/g;Ember.STRINGS={},Ember.String={fmt:function(a,b){var c=0;return a.replace(/%@([0-9]+)?/g,function(a,d){return d=d?parseInt(d,0)-1:c++,a=b[d],(a===null?"(null)":a===undefined?"":a).toString()})},loc:function(a,b){return a=Ember.STRINGS[a]||a,Ember.String.fmt(a,b)},w:function(a){return a.split(/\s+/)},decamelize:function(a){return a.replace(c,"$1_$2").toLowerCase()},dasherize:function(c){var d=b,e=d[c];return e?e:(e=Ember.String.decamelize(c).replace(a,"-"),d[c]=e,e)},camelize:function(a){return a.replace(d,function(a,b,c){return c?c.toUpperCase():""})},classify:function(a){var b=Ember.String.camelize(a);return b.charAt(0).toUpperCase()+b.substr(1)},underscore:function(a){return a.replace(e,"$1_$2").replace(f,"_").toLowerCase()}}}(),function(){var a=Ember.String.fmt,b=Ember.String.w,c=Ember.String.loc,d=Ember.String.camelize,e=Ember.String.decamelize,f=Ember.String.dasherize,g=Ember.String.underscore;Ember.EXTEND_PROTOTYPES&&(String.prototype.fmt=function(){return a(this,arguments)},String.prototype.w=function(){return b(this)},String.prototype.loc=function(){return c(this,arguments)},String.prototype.camelize=function(){return d(this)},String.prototype.decamelize=function(){return e(this)},String.prototype.dasherize=function(){return f(this)},String.prototype.underscore=function(){return g(this)})}(),function(){var a=Array.prototype.slice;Ember.EXTEND_PROTOTYPES&&(Function.prototype.property=function(){var a=Ember.computed(this);return a.property.apply(a,arguments)},Function.prototype.observes=function(){return this.__ember_observes__=a.call(arguments),this},Function.prototype.observesBefore=function(){return this.__ember_observesBefore__=a.call(arguments),this})}(),function(){}(),function(){function f(){return e.length===0?{}:e.pop()}function g(a){return e.push(a),null}function h(b,c){function e(e){var f=a(e,b);return d?c===f:!!f}var d=arguments.length===2;return e}var a=Ember.get,b=Ember.set,c=Array.prototype.slice,d=Ember.EnumerableUtils.indexOf,e=[];Ember.Enumerable=Ember.Mixin.create({isEnumerable:!0,nextObject:Ember.required(Function),firstObject:Ember.computed(function(){if(a(this,"length")===0)return undefined;var b=f(),c;return c=this.nextObject(0,null,b),g(b),c}).property("[]").cacheable(),lastObject:Ember.computed(function(){var b=a(this,"length");if(b===0)return undefined;var c=f(),d=0,e,h=null;do h=e,e=this.nextObject(d++,h,c);while(e!==undefined);return g(c),h}).property("[]").cacheable(),contains:function(a){return this.find(function(b){return b===a})!==undefined},forEach:function(b,c){if(typeof b!="function")throw new TypeError;var d=a(this,"length"),e=null,h=f();c===undefined&&(c=null);for(var i=0;i<d;i++){var j=this.nextObject(i,e,h);b.call(c,j,i,this),e=j}return e=null,h=g(h),this},getEach:function(a){return this.mapProperty(a)},setEach:function(a,c){return this.forEach(function(d){b(d,a,c)})},map:function(a,b){var c=[];return this.forEach(function(d,e,f){c[e]=a.call(b,d,e,f)}),c},mapProperty:function(b){return this.map(function(c){return a(c,b)})},filter:function(a,b){var c=[];return this.forEach(function(d,e,f){a.call(b,d,e,f)&&c.push(d)}),c},filterProperty:function(a,b){return this.filter(h.apply(this,arguments))},find:function(b,c){var d=a(this,"length");c===undefined&&(c=null);var e=null,h,i=!1,j,k=f();for(var l=0;l<d&&!i;l++){h=this.nextObject(l,e,k);if(i=b.call(c,h,l,this))j=h;e=h}return h=e=null,k=g(k),j},findProperty:function(a,b){return this.find(h.apply(this,arguments))},every:function(a,b){return!this.find(function(c,d,e){return!a.call(b,c,d,e)})},everyProperty:function(a,b){return this.every(h.apply(this,arguments))},some:function(a,b){return!!this.find(function(c,d,e){return!!a.call(b,c,d,e)})},someProperty:function(a,b){return this.some(h.apply(this,arguments))},reduce:function(a,b,c){if(typeof a!="function")throw new TypeError;var d=b;return this.forEach(function(b,e){d=a.call(null,d,b,e,this,c)},this),d},invoke:function(a){var b,d=[];return arguments.length>1&&(b=c.call(arguments,1)),this.forEach(function(c,e){var f=c&&c[a];"function"==typeof f&&(d[e]=b?f.apply(c,b):f.call(c))},this),d},toArray:function(){var a=[];return this.forEach(function(b,c){a[c]=b}),a},compact:function(){return this.without(null)},without:function(a){if(!this.contains(a))return this;var b=[];return this.forEach(function(c){c!==a&&(b[b.length]=c)}),b},uniq:function(){var a=[];return this.forEach(function(b){d(a,b)<0&&a.push(b)}),a},"[]":Ember.computed(function(a,b){return this}).property().cacheable(),addEnumerableObserver:function(b,c){var d=c&&c.willChange||"enumerableWillChange",e=c&&c.didChange||"enumerableDidChange",f=a(this,"hasEnumerableObservers");return f||Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.addListener(this,"@enumerable:before",b,d),Ember.addListener(this,"@enumerable:change",b,e),f||Ember.propertyDidChange(this,"hasEnumerableObservers"),this},removeEnumerableObserver:function(b,c){var d=c&&c.willChange||"enumerableWillChange",e=c&&c.didChange||"enumerableDidChange",f=a(this,"hasEnumerableObservers");return f&&Ember.propertyWillChange(this,"hasEnumerableObservers"),Ember.removeListener(this,"@enumerable:before",b,d),Ember.removeListener(this,"@enumerable:change",b,e),f&&Ember.propertyDidChange(this,"hasEnumerableObservers"),this},hasEnumerableObservers:Ember.computed(function(){return Ember.hasListeners(this,"@enumerable:change")||Ember.hasListeners(this,"@enumerable:before")}).property().cacheable(),enumerableContentWillChange:function(b,c){var d,e,f;return"number"==typeof b?d=b:b?d=a(b,"length"):d=b=-1,"number"==typeof c?e=c:c?e=a(c,"length"):e=c=-1,f=e<0||d<0||e-d!==0,b===-1&&(b=null),c===-1&&(c=null),Ember.propertyWillChange(this,"[]"),f&&Ember.propertyWillChange(this,"length"),Ember.sendEvent(this,"@enumerable:before",[this,b,c]),this},enumerableContentDidChange:function(b,c){var d=this.propertyDidChange,e,f,g;return"number"==typeof b?e=b:b?e=a(b,"length"):e=b=-1,"number"==typeof c?f=c:c?f=a(c,"length"):f=c=-1,g=f<0||e<0||f-e!==0,b===-1&&(b=null),c===-1&&(c=null),Ember.sendEvent(this,"@enumerable:change",[this,b,c]),g&&Ember.propertyDidChange(this,"length"),Ember.propertyDidChange(this,"[]"),this}})}(),function(){function f(a){return a===null||a===undefined}var a=Ember.get,b=Ember.set,c=Ember.meta,d=Ember.EnumerableUtils.map,e=Ember.cacheFor;Ember.Array=Ember.Mixin.create(Ember.Enumerable,{isSCArray:!0,length:Ember.required(),objectAt:function(b){return b<0||b>=a(this,"length")?undefined:a(this,b)},objectsAt:function(a){var b=this;return d(a,function(a){return b.objectAt(a)})},nextObject:function(a){return this.objectAt(a)},"[]":Ember.computed(function(b,c){return c!==undefined&&this.replace(0,a(this,"length"),c),this}).property().cacheable(),firstObject:Ember.computed(function(){return this.objectAt(0)}).property().cacheable(),lastObject:Ember.computed(function(){return this.objectAt(a(this,"length")-1)}).property().cacheable(),contains:function(a){return this.indexOf(a)>=0},slice:function(b,c){var d=[],e=a(this,"length");f(b)&&(b=0);if(f(c)||c>e)c=e;while(b<c)d[d.length]=this.objectAt(b++);return d},indexOf:function(b,c){var d,e=a(this,"length");c===undefined&&(c=0),c<0&&(c+=e);for(d=c;d<e;d++)if(this.objectAt(d,!0)===b)return d;return-1},lastIndexOf:function(b,c){var d,e=a(this,"length");if(c===undefined||c>=e)c=e-1;c<0&&(c+=e);for(d=c;d>=0;d--)if(this.objectAt(d)===b)return d;return-1},addArrayObserver:function(b,c){var d=c&&c.willChange||"arrayWillChange",e=c&&c.didChange||"arrayDidChange",f=a(this,"hasArrayObservers");return f||Ember.propertyWillChange(this,"hasArrayObservers"),Ember.addListener(this,"@array:before",b,d),Ember.addListener(this,"@array:change",b,e),f||Ember.propertyDidChange(this,"hasArrayObservers"),this},removeArrayObserver:function(b,c){var d=c&&c.willChange||"arrayWillChange",e=c&&c.didChange||"arrayDidChange",f=a(this,"hasArrayObservers");return f&&Ember.propertyWillChange(this,"hasArrayObservers"),Ember.removeListener(this,"@array:before",b,d),Ember.removeListener(this,"@array:change",b,e),f&&Ember.propertyDidChange(this,"hasArrayObservers"),this},hasArrayObservers:Ember.computed(function(){return Ember.hasListeners(this,"@array:change")||Ember.hasListeners(this,"@array:before")}).property().cacheable(),arrayContentWillChange:function(b,c,d){b===undefined?(b=0,c=d=-1):(c===undefined&&(c=-1),d===undefined&&(d=-1)),Ember.isWatching(this,"@each")&&a(this,"@each"),Ember.sendEvent(this,"@array:before",[this,b,c,d]);var e,f;if(b>=0&&c>=0&&a(this,"hasEnumerableObservers")){e=[],f=b+c;for(var g=b;g<f;g++)e.push(this.objectAt(g))}else e=c;return this.enumerableContentWillChange(e,d),this},arrayContentDidChange:function(b,c,d){b===undefined?(b=0,c=d=-1):(c===undefined&&(c=-1),d===undefined&&(d=-1));var f,g;if(b>=0&&d>=0&&a(this,"hasEnumerableObservers")){f=[],g=b+d;for(var h=b;h<g;h++)f.push(this.objectAt(h))}else f=d;this.enumerableContentDidChange(c,f),Ember.sendEvent(this,"@array:change",[this,b,c,d]);var i=a(this,"length"),j=e(this,"firstObject"),k=e(this,"lastObject");return this.objectAt(0)!==j&&(Ember.propertyWillChange(this,"firstObject"),Ember.propertyDidChange(this,"firstObject")),this.objectAt(i-1)!==k&&(Ember.propertyWillChange(this,"lastObject"),Ember.propertyDidChange(this,"lastObject")),this},"@each":Ember.computed(function(){return this.__each||(this.__each=new Ember.EachProxy(this)),this.__each}).property().cacheable()})}(),function(){Ember.Comparable=Ember.Mixin.create({isComparable:!0,compare:Ember.required(Function)})}(),function(){var a=Ember.get,b=Ember.set;Ember.Copyable=Ember.Mixin.create({copy:Ember.required(Function),frozenCopy:function(){if(Ember.Freezable&&Ember.Freezable.detect(this))return a(this,"isFrozen")?this:this.copy().freeze();throw new Error(Ember.String.fmt("%@ does not support freezing",[this]))}})}(),function(){var a=Ember.get,b=Ember.set;Ember.Freezable=Ember.Mixin.create({isFrozen:!1,freeze:function(){return a(this,"isFrozen")?this:(b(this,"isFrozen",!0),this)}}),Ember.FROZEN_ERROR="Frozen object cannot be modified."}(),function(){var a=Ember.EnumerableUtils.forEach;Ember.MutableEnumerable=Ember.Mixin.create(Ember.Enumerable,{addObject:Ember.required(Function),addObjects:function(b){return Ember.beginPropertyChanges(this),a(b,function(a){this.addObject(a)},this),Ember.endPropertyChanges(this),this},removeObject:Ember.required(Function),removeObjects:function(b){return Ember.beginPropertyChanges(this),a(b,function(a){this.removeObject(a)},this),Ember.endPropertyChanges(this),this}})}(),function(){var a="Index out of range",b=[],c=Ember.get,d=Ember.set,e=Ember.EnumerableUtils.forEach;Ember.MutableArray=Ember.Mixin.create(Ember.Array,Ember.MutableEnumerable,{replace:Ember.required(),clear:function(){var a=c(this,"length");return a===0?this:(this.replace(0,a,b),this)},insertAt:function(b,d){if(b>c(this,"length"))throw new Error(a);return this.replace(b,0,[d]),this},removeAt:function(d,e){var f=0;if("number"==typeof d){if(d<0||d>=c(this,"length"))throw new Error(a);e===undefined&&(e=1),this.replace(d,e,b)}return this},pushObject:function(a){return this.insertAt(c(this,"length"),a),a},pushObjects:function(a){return this.replace(c(this,"length"),0,a),this},popObject:function(){var a=c(this,"length");if(a===0)return null;var b=this.objectAt(a-1);return this.removeAt(a-1,1),b},shiftObject:function(){if(c(this,"length")===0)return null;var a=this.objectAt(0);return this.removeAt(0),a},unshiftObject:function(a){return this.insertAt(0,a),a},unshiftObjects:function(a){return this.replace(0,0,a),this},reverseObjects:function(){var a=c(this,"length");if(a===0)return this;var b=this.toArray().reverse();return this.replace(0,a,b),this},removeObject:function(a){var b=c(this,"length")||0;while(--b>=0){var d=this.objectAt(b);d===a&&this.removeAt(b)}return this},addObject:function(a){return this.contains(a)||this.pushObject(a),this}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.defineProperty;Ember.Observable=Ember.Mixin.create({isObserverable:!0,get:function(b){return a(this,b)},getProperties:function(){var b={},c=arguments;arguments.length===1&&Ember.typeOf(arguments[0])==="array"&&(c=arguments[0]);for(var d=0;d<c.length;d++)b[c[d]]=a(this,c[d]);return b},set:function(a,c){return b(this,a,c),this},setProperties:function(a){return Ember.setProperties(this,a)},beginPropertyChanges:function(){return Ember.beginPropertyChanges(),this},endPropertyChanges:function(){return Ember.endPropertyChanges(),this},propertyWillChange:function(a){return Ember.propertyWillChange(this,a),this},propertyDidChange:function(a){return Ember.propertyDidChange(this,a),this},notifyPropertyChange:function(a){return this.propertyWillChange(a),this.propertyDidChange(a),this},addBeforeObserver:function(a,b,c){Ember.addBeforeObserver(this,a,b,c)},addObserver:function(a,b,c){Ember.addObserver(this,a,b,c)},removeObserver:function(a,b,c){Ember.removeObserver(this,a,b,c)},hasObserverFor:function(a){return Ember.hasListeners(this,a+":change")},unknownProperty:function(a){return undefined},setUnknownProperty:function(a,d){c(this,a),b(this,a,d)},getPath:function(a){return this.get(a)},setPath:function(a,b){return this.set(a,b)},getWithDefault:function(a,b){return Ember.getWithDefault(this,a,b)},incrementProperty:function(c,d){return d||(d=1),b(this,c,(a(this,c)||0)+d),a(this,c)},decrementProperty:function(c,d){return d||(d=1),b(this,c,(a(this,c)||0)-d),a(this,c)},toggleProperty:function(c){return b(this,c,!a(this,c)),a(this,c)},cacheFor:function(a){return Ember.cacheFor(this,a)},observersForKey:function(a){return Ember.observersFor(this,a)}})}(),function(){var a=Ember.get,b=Ember.set;Ember.TargetActionSupport=Ember.Mixin.create({target:null,action:null,targetObject:Ember.computed(function(){var b=a(this,"target");if(Ember.typeOf(b)==="string"){var c=a(this,b);return c===undefined&&(c=a(window,b)),c}return b}).property("target").cacheable(),triggerAction:function(){var b=a(this,"action"),c=a(this,"targetObject");if(c&&b){var d;return typeof c.send=="function"?d=c.send(b,this):(typeof b=="string"&&(b=c[b]),d=b.call(c,this)),d!==!1&&(d=!0),d}return!1}})}(),function(){Ember.Evented=Ember.Mixin.create({on:function(a,b,c){Ember.addListener(this,a,b,c)},one:function(a,b,c){c||(c=b,b=null);var d=this,e=function(){Ember.removeListener(d,a,b,e),"string"==typeof c&&(c=this[c]),c.apply(this,arguments)};this.on(a,b,e)},trigger:function(a){var b=[],c,d;for(c=1,d=arguments.length;c<d;c++)b.push(arguments[c]);Ember.sendEvent(this,a,b)},fire:function(a){this.trigger.apply(this,arguments)},off:function(a,b,c){Ember.removeListener(this,a,b,c)},has:function(a){return Ember.hasListeners(this,a)}})}(),function(){}(),function(){function m(){var b=!1,c,d=function(){b||d.proto();var a=Ember.meta(this);a.proto=this,c&&(this.reopen.apply(this,c),c=null),e(this,Ember.GUID_KEY,l),e(this,"_super",l),j(this,a),delete a.proto,i(this),this.init.apply(this,arguments)};return d.toString=a,d.willReopen=function(){b&&(d.PrototypeMixin=Ember.Mixin.create(d.PrototypeMixin)),b=!1},d._initMixins=function(a){c=a},d.proto=function(){var a=d.superclass;return a&&a.proto(),b||(b=!0,d.PrototypeMixin.applyPartial(d.prototype),h(d.prototype)),this.prototype},d}var a=Ember.Mixin.prototype.toString,b=Ember.set,c=Ember.get,d=Ember.create,e=Ember.platform.defineProperty,f=Array.prototype.slice,g=Ember.meta,h=Ember.rewatch,i=Ember.finishChains,j=Ember.Mixin.finishPartial,k=Ember.Mixin.prototype.reopen,l={configurable:!0,writable:!0,enumerable:!1,value:undefined},n=m();n.PrototypeMixin=Ember.Mixin.create({reopen:function(){return Ember.Mixin._apply(this,arguments,!0),this},isInstance:!0,init:function(){},isDestroyed:!1,isDestroying:!1,destroy:function(){if(this.isDestroying)return;return this.isDestroying=!0,this.willDestroy&&this.willDestroy(),b(this,"isDestroyed",!0),Ember.run.schedule("destroy",this,this._scheduledDestroy),this},_scheduledDestroy:function(){Ember.destroy(this),this.didDestroy&&this.didDestroy()},bind:function(a,b){return b instanceof Ember.Binding||(b=Ember.Binding.from(b)),b.to(a).connect(this),b},toString:function(){return"<"+this.constructor.toString()+":"+Ember.guidFor(this)+">"}}),Ember.config.overridePrototypeMixin&&Ember.config.overridePrototypeMixin(n.PrototypeMixin),n.__super__=null;var o=Ember.Mixin.create({ClassMixin:Ember.required(),PrototypeMixin:Ember.required(),isClass:!0,isMethod:!1,extend:function(){var a=m(),b;return a.ClassMixin=Ember.Mixin.create(this.ClassMixin),a.PrototypeMixin=Ember.Mixin.create(this.PrototypeMixin),a.ClassMixin.ownerConstructor=a,a.PrototypeMixin.ownerConstructor=a,k.apply(a.PrototypeMixin,arguments),a.superclass=this,a.__super__=this.prototype,b=a.prototype=d(this.prototype),b.constructor=a,Ember.generateGuid(b,"ember"),g(b).proto=b,a.ClassMixin.apply(a),a},create:function(){var a=this;return arguments.length>0&&this._initMixins(arguments),new a},reopen:function(){return this.willReopen(),k.apply(this.PrototypeMixin,arguments),this},reopenClass:function(){return k.apply(this.ClassMixin,arguments),Ember.Mixin._apply(this,arguments,!1),this},detect:function(a){if("function"!=typeof a)return!1;while(a){if(a===this)return!0;a=a.superclass}return!1},detectInstance:function(a){return a instanceof this},metaForProperty:function(a){var b=g(this.proto(),!1).descs[a];return b._meta||{}},eachComputedProperty:function(a,b){var c=this.proto(),d=g(c).descs,e={},f;for(var h in d)f=d[h],f instanceof Ember.ComputedProperty&&a.call(b||this,h,f._meta||e)}});Ember.config.overrideClassMixin&&Ember.config.overrideClassMixin(o),n.ClassMixin=o,o.apply(n),Ember.CoreObject=n}(),function(){var a=Ember.get,b=Ember.set,c=Ember.guidFor,d=Ember.none;Ember.Set=Ember.CoreObject.extend(Ember.MutableEnumerable,Ember.Copyable,Ember.Freezable,{length:0,clear:function(){if(this.isFrozen)throw new Error(Ember.FROZEN_ERROR);var d=a(this,"length");if(d===0)return this;var e;this.enumerableContentWillChange(d,0),Ember.propertyWillChange(this,"firstObject"),Ember.propertyWillChange(this,"lastObject");for(var f=0;f<d;f++)e=c(this[f]),delete this[e],delete this[f];return b(this,"length",0),Ember.propertyDidChange(this,"firstObject"),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(d,0),this},isEqual:function(b){if(!Ember.Enumerable.detect(b))return!1;var c=a(this,"length");if(a(b,"length")!==c)return!1;while(--c>=0)if(!b.contains(this[c]))return!1;return!0},add:Ember.alias("addObject"),remove:Ember.alias("removeObject"),pop:function(){if(a(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);var b=this.length>0?this[this.length-1]:null;return this.remove(b),b},push:Ember.alias("addObject"),shift:Ember.alias("pop"),unshift:Ember.alias("push"),addEach:Ember.alias("addObjects"),removeEach:Ember.alias("removeObjects"),init:function(a){this._super(),a&&this.addObjects(a)},nextObject:function(a){return this[a]},firstObject:Ember.computed(function(){return this.length>0?this[0]:undefined}).property().cacheable(),lastObject:Ember.computed(function(){return this.length>0?this[this.length-1]:undefined}).property().cacheable(),addObject:function(e){if(a(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(d(e))return this;var f=c(e),g=this[f],h=a(this,"length"),i;return g>=0&&g<h&&this[g]===e?this:(i=[e],this.enumerableContentWillChange(null,i),Ember.propertyWillChange(this,"lastObject"),h=a(this,"length"),this[f]=h,this[h]=e,b(this,"length",h+1),Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(null,i),this)},removeObject:function(e){if(a(this,"isFrozen"))throw new Error(Ember.FROZEN_ERROR);if(d(e))return this;var f=c(e),g=this[f],h=a(this,"length"),i=g===0,j=g===h-1,k,l;return g>=0&&g<h&&this[g]===e&&(l=[e],this.enumerableContentWillChange(l,null),i&&Ember.propertyWillChange(this,"firstObject"),j&&Ember.propertyWillChange(this,"lastObject"),g<h-1&&(k=this[h-1],this[g]=k,this[c(k)]=g),delete this[f],delete this[h-1],b(this,"length",h-1),i&&Ember.propertyDidChange(this,"firstObject"),j&&Ember.propertyDidChange(this,"lastObject"),this.enumerableContentDidChange(l,null)),this},contains:function(a){return this[c(a)]>=0},copy:function(){var d=this.constructor,e=new d,f=a(this,"length");b(e,"length",f);while(--f>=0)e[f]=this[f],e[c(this[f])]=f;return e},toString:function(){var a=this.length,b,c=[];for(b=0;b<a;b++)c[b]=this[b];return"Ember.Set<%@>".fmt(c.join(","))}})}(),function(){Ember.Object=Ember.CoreObject.extend(Ember.Observable)}(),function(){var a=Ember.ArrayPolyfills.indexOf;Ember.Namespace=Ember.Object.extend({isNamespace:!0,init:function(){Ember.Namespace.NAMESPACES.push(this),Ember.Namespace.PROCESSED=!1},toString:function(){return Ember.identifyNamespaces(),this[Ember.GUID_KEY+"_name"]},destroy:function(){var b=Ember.Namespace.NAMESPACES;window[this.toString()]=undefined,b.splice(a.call(b,this),1),this._super()}}),Ember.Namespace.NAMESPACES=[Ember],Ember.Namespace.PROCESSED=!1}(),function(){Ember.Application=Ember.Namespace.extend()}(),function(){var a=Ember.get,b=Ember.set;Ember.ArrayProxy=Ember.Object.extend(Ember.MutableArray,{content:null,arrangedContent:Ember.computed("content",function(){return a(this,"content")}).cacheable(),objectAtContent:function(b){return a(this,"arrangedContent").objectAt(b)},replaceContent:function(b,c,d){a(this,"arrangedContent").replace(b,c,d)},_contentWillChange:Ember.beforeObserver(function(){var b=a(this,"content");b&&b.removeArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},"content"),contentArrayWillChange:Ember.K,contentArrayDidChange:Ember.K,_contentDidChange:Ember.observer(function(){var b=a(this,"content"),c=b?a(b,"length"):0;b&&b.addArrayObserver(this,{willChange:"contentArrayWillChange",didChange:"contentArrayDidChange"})},"content"),_arrangedContentWillChange:Ember.beforeObserver(function(){var b=a(this,"arrangedContent"),c=b?a(b,"length"):0;this.arrangedContentArrayWillChange(this,0,c,undefined),b&&b.removeArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"})},"arrangedContent"),_arrangedContentDidChange:Ember.observer(function(){var b=a(this,"arrangedContent"),c=b?a(b,"length"):0;b&&b.addArrayObserver(this,{willChange:"arrangedContentArrayWillChange",didChange:"arrangedContentArrayDidChange"}),this.arrangedContentArrayDidChange(this,0,undefined,c)},"arrangedContent"),objectAt:function(b){return a(this,"content")&&this.objectAtContent(b)},length:Ember.computed(function(){var b=a(this,"arrangedContent");return b?a(b,"length"):0}).property().cacheable(),replace:function(b,c,d){return a(this,"content")&&this.replaceContent(b,c,d),this},arrangedContentArrayWillChange:function(a,b,c,d){this.arrayContentWillChange(b,c,d)},arrangedContentArrayDidChange:function(a,b,c,d){this.arrayContentDidChange(b,c,d)},init:function(){this._super(),this._contentWillChange(),this._contentDidChange(),this._arrangedContentWillChange(),this._arrangedContentDidChange()}})}(),function(){function j(a,b){var c=b.slice(8);if(c in this)return;h(this,c)}function k(a,b){var c=b.slice(8);if(c in this)return;i(this,c)}var a=Ember.get,b=Ember.set,c=Ember.String.fmt,d=Ember.addBeforeObserver,e=Ember.addObserver,f=Ember.removeBeforeObserver,g=Ember.removeObserver,h=Ember.propertyWillChange,i=Ember.propertyDidChange;Ember.ObjectProxy=Ember.Object.extend({content:null,_contentDidChange:Ember.observer(function(){},"content"),willWatchProperty:function(a){var b="content."+a;d(this,b,null,j),e(this,b,null,k)},didUnwatchProperty:function(a){var b="content."+a;f(this,b,null,j),g(this,b,null,k)},unknownProperty:function(b){var c=a(this,"content");if(c)return a(c,b)},setUnknownProperty:function(c,d){var e=a(this,"content");return b(e,c,d)}})}(),function(){function g(a,b,d,e,f){var g=d._objects,h;g||(g=d._objects={});while(--f>=e){var i=a.objectAt(f);i&&(Ember.addBeforeObserver(i,b,d,"contentKeyWillChange"),Ember.addObserver(i,b,d,"contentKeyDidChange"),h=c(i),g[h]||(g[h]=[]),g[h].push(f))}}function h(a,b,d,e,f){var g=d._objects;g||(g=d._objects={});var h,i;while(--f>=e){var j=a.objectAt(f);j&&(Ember.removeBeforeObserver(j,b,d,"contentKeyWillChange"),Ember.removeObserver(j,b,d,"contentKeyDidChange"),i=c(j),h=g[i],h[h.indexOf(f)]=null)}}var a=Ember.set,b=Ember.get,c=Ember.guidFor,d=Ember.EnumerableUtils.forEach,e=Ember.Object.extend(Ember.Array,{init:function(a,b,c){this._super(),this._keyName=b,this._owner=c,this._content=a},objectAt:function(a){var c=this._content.objectAt(a);return c&&b(c,this._keyName)},length:Ember.computed(function(){var a=this._content;return a?b(a,"length"):0}).property().cacheable()}),f=/^.+:(before|change)$/;Ember.EachProxy=Ember.Object.extend({init:function(a){this._super(),this._content=a,a.addArrayObserver(this),d(Ember.watchedEvents(this),function(a){this.didAddListener(a)},this)},unknownProperty:function(a,b){var c;return c=new e(this._content,a,this),Ember.defineProperty(this,a,null,c),this.beginObservingContentKey(a),c},arrayWillChange:function(a,b,c,d){var e=this._keys,f,g,i;i=c>0?b+c:-1,Ember.beginPropertyChanges(this);for(f in e){if(!e.hasOwnProperty(f))continue;i>0&&h(a,f,this,b,i),Ember.propertyWillChange(this,f)}Ember.propertyWillChange(this._content,"@each"),Ember.endPropertyChanges(this)},arrayDidChange:function(a,b,c,d){var e=this._keys,f,h,i;i=d>0?b+d:-1,Ember.beginPropertyChanges(this);for(f in e){if(!e.hasOwnProperty(f))continue;i>0&&g(a,f,this,b,i),Ember.propertyDidChange(this,f)}Ember.propertyDidChange(this._content,"@each"),Ember.endPropertyChanges(this)},didAddListener:function(a){f.test(a)&&this.beginObservingContentKey(a.slice(0,-7))},didRemoveListener:function(a){f.test(a)&&this.stopObservingContentKey(a.slice(0,-7))},beginObservingContentKey:function(a){var c=this._keys;c||(c=this._keys={});if(!c[a]){c[a]=1;var d=this._content,e=b(d,"length");g(d,a,this,0,e)}else c[a]++},stopObservingContentKey:function(a){var c=this._keys;if(c&&c[a]>0&&--c[a]<=0){var d=this._content,e=b(d,"length");h(d,a,this,0,e)}},contentKeyWillChange:function(a,b){Ember.propertyWillChange(this,b)},contentKeyDidChange:function(a,b){Ember.propertyDidChange(this,b)}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.Mixin.create(Ember.MutableArray,Ember.Observable,Ember.Copyable,{get:function(a){return a==="length"?this.length:"number"==typeof a?this[a]:this._super(a)},objectAt:function(a){return this[a]},replace:function(b,c,d){if(this.isFrozen)throw Ember.FROZEN_ERROR;var e=
+d?a(d,"length"):0;this.arrayContentWillChange(b,c,e);if(!d||d.length===0)this.splice(b,c);else{var f=[b,c].concat(d);this.splice.apply(this,f)}return this.arrayContentDidChange(b,c,e),this},unknownProperty:function(a,b){var c;return b!==undefined&&c===undefined&&(c=this[a]=b),c},indexOf:function(a,b){var c,d=this.length;b===undefined?b=0:b=b<0?Math.ceil(b):Math.floor(b),b<0&&(b+=d);for(c=b;c<d;c++)if(this[c]===a)return c;return-1},lastIndexOf:function(a,b){var c,d=this.length;b===undefined?b=d-1:b=b<0?Math.ceil(b):Math.floor(b),b<0&&(b+=d);for(c=b;c>=0;c--)if(this[c]===a)return c;return-1},copy:function(){return this.slice()}}),d=["length"];Ember.EnumerableUtils.forEach(c.keys(),function(a){Array.prototype[a]&&d.push(a)}),d.length>0&&(c=c.without.apply(c,d)),Ember.NativeArray=c,Ember.A=function(a){return a===undefined&&(a=[]),Ember.NativeArray.apply(a)},Ember.NativeArray.activate=function(){c.apply(Array.prototype),Ember.A=function(a){return a||[]}},Ember.EXTEND_PROTOTYPES&&Ember.NativeArray.activate()}(),function(){var a=Ember.get,b=Ember.set;Ember._PromiseChain=Ember.Object.extend({promises:null,failureCallback:Ember.K,successCallback:Ember.K,abortCallback:Ember.K,promiseSuccessCallback:Ember.K,runNextPromise:function(){if(a(this,"isDestroyed"))return;var b=a(this,"promises").shiftObject();if(b){var c=a(b,"promise")||b,d=this,e=function(){d.promiseSuccessCallback.call(this,b,arguments),d.runNextPromise()},f=a(d,"failureCallback");c.then(e,f)}else this.successCallback()},start:function(){return this.runNextPromise(),this},abort:function(){this.abortCallback(),this.destroy()},init:function(){b(this,"promises",Ember.A(a(this,"promises"))),this._super()}})}(),function(){var a={},b={};Ember.onLoad=function(c,d){var e;a[c]=a[c]||Ember.A(),a[c].pushObject(d),(e=b[c])&&d(e)},Ember.runLoadHooks=function(c,d){var e;b[c]=d,(e=a[c])&&a[c].forEach(function(a){a(d)})}}(),function(){}(),function(){Ember.ControllerMixin=Ember.Mixin.create({target:null,store:null}),Ember.Controller=Ember.Object.extend(Ember.ControllerMixin)}(),function(){var a=Ember.get,b=Ember.set,c=Ember.EnumerableUtils.forEach;Ember.SortableMixin=Ember.Mixin.create(Ember.MutableEnumerable,{sortProperties:null,sortAscending:!0,addObject:function(b){var c=a(this,"content");c.pushObject(b)},removeObject:function(b){var c=a(this,"content");c.removeObject(b)},orderBy:function(b,d){var e=0,f=a(this,"sortProperties"),g=a(this,"sortAscending");return c(f,function(c){e===0&&(e=Ember.compare(a(b,c),a(d,c)),e!==0&&!g&&(e=-1*e))}),e},destroy:function(){var b=a(this,"content"),d=a(this,"sortProperties");return b&&d&&c(b,function(a){c(d,function(b){Ember.removeObserver(a,b,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},isSorted:Ember.computed("sortProperties",function(){return!!a(this,"sortProperties")}),arrangedContent:Ember.computed("content","sortProperties.@each",function(b,d){var e=a(this,"content"),f=a(this,"isSorted"),g=a(this,"sortProperties"),h=this;return e&&f?(e=e.slice(),e.sort(function(a,b){return h.orderBy(a,b)}),c(e,function(a){c(g,function(b){Ember.addObserver(a,b,this,"contentItemSortPropertyDidChange")},this)},this),Ember.A(e)):e}).cacheable(),_contentWillChange:Ember.beforeObserver(function(){var b=a(this,"content"),d=a(this,"sortProperties");b&&d&&c(b,function(a){c(d,function(b){Ember.removeObserver(a,b,this,"contentItemSortPropertyDidChange")},this)},this),this._super()},"content"),sortAscendingWillChange:Ember.beforeObserver(function(){this._lastSortAscending=a(this,"sortAscending")},"sortAscending"),sortAscendingDidChange:Ember.observer(function(){if(a(this,"sortAscending")!==this._lastSortAscending){var b=a(this,"arrangedContent");b.reverseObjects()}},"sortAscending"),contentArrayWillChange:function(b,d,e,f){var g=a(this,"isSorted");if(g){var h=a(this,"arrangedContent"),i=b.slice(d,d+e),j=a(this,"sortProperties");c(i,function(a){h.removeObject(a),c(j,function(b){Ember.removeObserver(a,b,this,"contentItemSortPropertyDidChange")},this)})}return this._super(b,d,e,f)},contentArrayDidChange:function(b,d,e,f){var g=a(this,"isSorted"),h=a(this,"sortProperties");if(g){var i=b.slice(d,d+f),j=a(this,"arrangedContent");c(i,function(a){this.insertItemSorted(a),c(h,function(b){Ember.addObserver(a,b,this,"contentItemSortPropertyDidChange")},this)},this)}return this._super(b,d,e,f)},insertItemSorted:function(b){var c=a(this,"arrangedContent"),d=a(c,"length"),e=this._binarySearch(b,0,d);c.insertAt(e,b)},contentItemSortPropertyDidChange:function(b){var c=a(this,"arrangedContent"),d=c.indexOf(b);c.removeObject(b),this.insertItemSorted(b)},_binarySearch:function(b,c,d){var e,f,g,h;return c===d?c:(h=a(this,"arrangedContent"),e=c+Math.floor((d-c)/2),f=h.objectAt(e),g=this.orderBy(f,b),g<0?this._binarySearch(b,e+1,d):g>0?this._binarySearch(b,c,e):e)}})}(),function(){var a=Ember.get,b=Ember.set;Ember.ArrayController=Ember.ArrayProxy.extend(Ember.ControllerMixin,Ember.SortableMixin)}(),function(){Ember.ObjectController=Ember.ObjectProxy.extend(Ember.ControllerMixin)}(),function(){}(),function(){}(),function(){var a=Ember.get,b=Ember.set;Ember.Application=Ember.Namespace.extend({rootElement:"body",eventDispatcher:null,customEvents:null,init:function(){var c,d=a(this,"rootElement");this._super(),c=Ember.EventDispatcher.create({rootElement:d}),b(this,"eventDispatcher",c);if(Ember.$.isReady)Ember.run.once(this,this.didBecomeReady);else{var e=this;Ember.$(document).ready(function(){Ember.run.once(e,e.didBecomeReady)})}},initialize:function(c){var d=Ember.A(Ember.keys(this)),e=a(this.constructor,"injections"),f=this,g,h;!c&&Ember.Router.detect(f.Router)&&(c=f.Router.create(),this._createdRouter=c),c&&(b(this,"router",c),b(c,"namespace",this)),Ember.runLoadHooks("application",this),e.forEach(function(a){d.forEach(function(b){a[1](f,c,b)})}),c&&c instanceof Ember.Router&&this.startRouting(c)},didBecomeReady:function(){var b=a(this,"eventDispatcher"),c=a(this,"customEvents");b.setup(c),this.ready()},startRouting:function(b){var c=a(b,"location"),d=a(this,"rootElement"),e=a(b,"applicationController"),f=this.ApplicationView.create({controller:e});this._createdApplicationView=f,f.appendTo(d),b.route(c.getURL()),c.onUpdateURL(function(a){b.route(a)})},ready:Ember.K,willDestroy:function(){a(this,"eventDispatcher").destroy(),this._createdRouter&&this._createdRouter.destroy(),this._createdApplicationView&&this._createdApplicationView.destroy()},registerInjection:function(a){this.constructor.registerInjection(a)}}),Ember.Application.reopenClass({concatenatedProperties:["injections"],injections:Ember.A(),registerInjection:function(b){var c=a(this,"injections"),d=b.before,e=b.name,f=b.injection,g;d?(g=c.find(function(a){if(a[0]===d)return!0}),g=c.indexOf(g)):g=a(c,"length"),c.splice(g,0,[e,f])}}),Ember.Application.registerInjection({name:"controllers",injection:function(a,b,c){if(!/^[A-Z].*Controller$/.test(c))return;var d=c.charAt(0).toLowerCase()+c.substr(1),e=a[c].create();b.set(d,e),e.setProperties({target:b,controllers:b,namespace:a})}})}(),function(){var a=Ember.get,b=Ember.set;Ember.Location={create:function(a){var b=a&&a.implementation,c=this.implementations[b];return c.create.apply(c,arguments)},registerImplementation:function(a,b){this.implementations[a]=b},implementations:{}}}(),function(){var a=Ember.get,b=Ember.set;Ember.HashLocation=Ember.Object.extend({init:function(){b(this,"location",a(this,"location")||window.location)},getURL:function(){return a(this,"location").hash.substr(1)},setURL:function(c){a(this,"location").hash=c,b(this,"lastSetURL",c)},onUpdateURL:function(c){var d=this,e=Ember.guidFor(this);Ember.$(window).bind("hashchange.ember-location-"+e,function(){var e=location.hash.substr(1);if(a(d,"lastSetURL")===e)return;b(d,"lastSetURL",null),c(location.hash.substr(1))})},formatURL:function(a){return"#"+a},willDestroy:function(){var a=Ember.guidFor(this);Ember.$(window).unbind("hashchange.ember-location-"+a)}}),Ember.Location.registerImplementation("hash",Ember.HashLocation)}(),function(){var a=Ember.get,b=Ember.set;Ember.HistoryLocation=Ember.Object.extend({init:function(){b(this,"location",a(this,"location")||window.location),b(this,"_initialURL",a(this,"location").pathname)},rootURL:"/",_initialURL:null,getURL:function(){return a(this,"location").pathname},setURL:function(b){var c=window.history.state,d=a(this,"_initialURL");b=this.formatPath(b),(d!==b&&!c||c&&c.path!==b)&&window.history.pushState({path:b},null,b)},onUpdateURL:function(a){var b=Ember.guidFor(this);Ember.$(window).bind("popstate.ember-location-"+b,function(b){a(location.pathname)})},formatPath:function(b){var c=a(this,"rootURL");return b!==""&&(c=c.replace(/\/$/,"")),c+b},formatURL:function(a){return a},willDestroy:function(){var a=Ember.guidFor(this);Ember.$(window).unbind("popstate.ember-location-"+a)}}),Ember.Location.registerImplementation("history",Ember.HistoryLocation)}(),function(){var a=Ember.get,b=Ember.set;Ember.NoneLocation=Ember.Object.extend({path:"",getURL:function(){return a(this,"path")},setURL:function(a){b(this,"path",a)},onUpdateURL:function(a){},formatURL:function(a){return a}}),Ember.Location.registerImplementation("none",Ember.NoneLocation)}(),function(){}(),function(){}(),function(){Ember.$=window.jQuery}(),function(){var a=Ember.String.w("dragstart drag dragenter dragleave dragover drop dragend");Ember.EnumerableUtils.forEach(a,function(a){Ember.$.event.fixHooks[a]={props:["dataTransfer"]}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.ArrayPolyfills.indexOf,d=function(){this.seen={},this.list=[]};d.prototype={add:function(a){if(a in this.seen)return;this.seen[a]=!0,this.list.push(a)},toDOM:function(){return this.list.join(" ")}},Ember.RenderBuffer=function(a){return new Ember._RenderBuffer(a)},Ember._RenderBuffer=function(a){this.elementTag=a,this.childBuffers=[]},Ember._RenderBuffer.prototype={elementClasses:null,elementId:null,elementAttributes:null,elementTag:null,elementStyle:null,parentBuffer:null,push:function(a){return this.childBuffers.push(String(a)),this},addClass:function(a){var b=this.elementClasses=this.elementClasses||new d;return this.elementClasses.add(a),this},id:function(a){return this.elementId=a,this},attr:function(a,b){var c=this.elementAttributes=this.elementAttributes||{};return arguments.length===1?c[a]:(c[a]=b,this)},removeAttr:function(a){var b=this.elementAttributes;return b&&delete b[a],this},style:function(a,b){var c=this.elementStyle=this.elementStyle||{};return this.elementStyle[a]=b,this},newBuffer:function(a,b,c,d){var e=new Ember._RenderBuffer(a);return e.parentBuffer=b,d&&Ember.$.extend(e,d),c&&c.call(this,e),e},replaceWithBuffer:function(a){var b=this.parentBuffer;if(!b)return;var d=b.childBuffers,e=c.call(d,this);a?d.splice(e,1,a):d.splice(e,1)},begin:function(a){return this.newBuffer(a,this,function(a){this.childBuffers.push(a)})},prepend:function(a){return this.newBuffer(a,this,function(a){this.childBuffers.splice(0,0,a)})},replaceWith:function(a){var b=this.parentBuffer;return this.newBuffer(a,b,function(a){this.replaceWithBuffer(a)})},insertAfter:function(b){var d=a(this,"parentBuffer");return this.newBuffer(b,d,function(a){var b=d.childBuffers,e=c.call(b,this);b.splice(e+1,0,a)})},end:function(){var a=this.parentBuffer;return a||this},remove:function(){this.replaceWithBuffer(null)},element:function(){return Ember.$(this.string())[0]},string:function(){var a="",b=this.elementTag,c;if(b){var d=this.elementId,e=this.elementClasses,f=this.elementAttributes,g=this.elementStyle,h="",i;c=["<"+b],d&&c.push('id="'+this._escapeAttribute(d)+'"'),e&&c.push('class="'+this._escapeAttribute(e.toDOM())+'"');if(g){for(i in g)g.hasOwnProperty(i)&&(h+=i+":"+this._escapeAttribute(g[i])+";");c.push('style="'+h+'"')}if(f)for(i in f)f.hasOwnProperty(i)&&c.push(i+'="'+this._escapeAttribute(f[i])+'"');c=c.join(" ")+">"}var j=this.childBuffers;return Ember.ArrayPolyfills.forEach.call(j,function(b){var c=typeof b=="string";a+=c?b:b.string()}),b?c+a+"</"+b+">":a},_escapeAttribute:function(a){var b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[<>"'`]/g,d=/[&<>"'`]/,e=function(a){return b[a]||"&amp;"},f=a.toString();return d.test(f)?f.replace(c,e):f}}}(),function(){var a=Ember.get,b=Ember.set,c=Ember.String.fmt;Ember.EventDispatcher=Ember.Object.extend({rootElement:"body",setup:function(b){var c,d={touchstart:"touchStart",touchmove:"touchMove",touchend:"touchEnd",touchcancel:"touchCancel",keydown:"keyDown",keyup:"keyUp",keypress:"keyPress",mousedown:"mouseDown",mouseup:"mouseUp",contextmenu:"contextMenu",click:"click",dblclick:"doubleClick",mousemove:"mouseMove",focusin:"focusIn",focusout:"focusOut",mouseenter:"mouseEnter",mouseleave:"mouseLeave",submit:"submit",input:"input",change:"change",dragstart:"dragStart",drag:"drag",dragenter:"dragEnter",dragleave:"dragLeave",dragover:"dragOver",drop:"drop",dragend:"dragEnd"};Ember.$.extend(d,b||{});var e=Ember.$(a(this,"rootElement"));e.addClass("ember-application");for(c in d)d.hasOwnProperty(c)&&this.setupHandler(e,c,d[c])},setupHandler:function(a,b,c){var d=this;a.delegate(".ember-view",b+".ember",function(a,b){var e=Ember.View.views[this.id],f=!0,g=null;return g=d._findNearestEventManager(e,c),g&&g!==b?f=d._dispatchEvent(g,a,c,e):e?f=d._bubbleEvent(e,a,c):a.stopPropagation(),f}),a.delegate("[data-ember-action]",b+".ember",function(a){var b=Ember.$(a.currentTarget).attr("data-ember-action"),d=Ember.Handlebars.ActionHelper.registeredActions[b],e=d.handler;if(d.eventName===c)return e(a)})},_findNearestEventManager:function(b,c){var d=null;while(b){d=a(b,"eventManager");if(d&&d[c])break;b=a(b,"parentView")}return d},_dispatchEvent:function(a,b,c,d){var e=!0,f=a[c];return Ember.typeOf(f)==="function"?(e=f.call(a,b,d),b.stopPropagation()):e=this._bubbleEvent(d,b,c),e},_bubbleEvent:function(a,b,c){return Ember.run(function(){return a.handleEvent(c,b)})},destroy:function(){var b=a(this,"rootElement");return Ember.$(b).undelegate(".ember").removeClass("ember-application"),this._super()}})}(),function(){var a=Ember.run.queues;a.splice(Ember.$.inArray("actions",a)+1,0,"render")}(),function(){var a=Ember.get,b=Ember.set;Ember.ControllerMixin.reopen({target:null,controllers:null,namespace:null,view:null,connectOutlet:function(c,d){var e,f,g,h,i;Ember.typeOf(d)==="string"&&(e=c,c=d,d=arguments[2]),arguments.length===1?Ember.typeOf(c)==="object"&&(i=c,e=i.outletName,c=i.name,f=i.viewClass,h=i.controller,d=i.context):i={},e=e||"view";if(c){var j=a(this,"namespace"),k=a(this,"controllers"),l=c.charAt(0).toUpperCase()+c.substr(1)+"View";f=a(j,l),h=a(k,c+"Controller")}return h&&d&&h.set("content",d),g=f.create(),h&&b(g,"controller",h),b(this,e,g),g},connectControllers:function(){var c=a(this,"controllers"),d=Array.prototype.slice.apply(arguments),e;for(var f=0,g=d.length;f<g;f++)e=d[f]+"Controller",b(this,e,a(c,e))}})}(),function(){}(),function(){var a=Ember.get,b=Ember.set,c=Ember.addObserver,d=Ember.meta,e=Ember.String.fmt,f=[].slice,g=Ember.EnumerableUtils.forEach,h=Ember.computed(function(){var b=this._childViews,c=Ember.A();return g(b,function(b){b.isVirtual?c.pushObjects(a(b,"childViews")):c.push(b)}),c}).property().cacheable(),i=Ember.VIEW_PRESERVES_CONTEXT;Ember.TEMPLATES={};var j={preRender:{},inBuffer:{},hasElement:{},inDOM:{},destroyed:{}};Ember.View=Ember.Object.extend(Ember.Evented,{concatenatedProperties:["classNames","classNameBindings","attributeBindings"],isView:!0,templateName:null,layoutName:null,templates:Ember.TEMPLATES,template:Ember.computed(function(b,c){if(c!==undefined)return c;var d=a(this,"templateName"),e=this.templateForName(d,"template");return e||a(this,"defaultTemplate")}).property("templateName").cacheable(),controller:Ember.computed(function(b,c){var d;return arguments.length===2?c:(d=a(this,"parentView"),d?a(d,"controller"):null)}).property().cacheable(),layout:Ember.computed(function(b,c){if(arguments.length===2)return c;var d=a(this,"layoutName"),e=this.templateForName(d,"layout");return e||a(this,"defaultLayout")}).property("layoutName").cacheable(),templateForName:function(b,c){if(!b)return;var d=a(this,"templates"),f=a(d,b);if(!f)throw new Ember.Error(e('%@ - Unable to find %@ "%@".',[this,c,b]));return f},context:Ember.computed(function(c,d){return arguments.length===2?(b(this,"_context",d),d):a(this,"_context")}).cacheable(),_context:Ember.computed(function(b,c){var d,e,f;if(arguments.length===2)return c;if(i){if(e=a(this,"controller"))return e;d=a(this,"_parentView");if(d)return a(d,"_context")}return this}).cacheable(),_displayPropertyDidChange:Ember.observer(function(){this.rerender()},"context","controller"),parentView:Ember.computed(function(){var b=a(this,"_parentView");return b&&b.isVirtual?a(b,"parentView"):b}).property("_parentView").volatile(),_parentView:null,concreteView:Ember.computed(function(){return this.isVirtual?a(this,"parentView"):this}).property("_parentView").volatile(),isVisible:!0,childViews:h,_childViews:[],_childViewsWillChange:Ember.beforeObserver(function(){if(this.isVirtual){var b=a(this,"parentView");b&&Ember.propertyWillChange(b,"childViews")}},"childViews"),_childViewsDidChange:Ember.observer(function(){if(this.isVirtual){var b=a(this,"parentView");b&&Ember.propertyDidChange(b,"childViews")}},"childViews"),nearestInstanceOf:function(b){var c=a(this,"parentView");while(c){if(c instanceof b)return c;c=a(c,"parentView")}},nearestWithProperty:function(b){var c=a(this,"parentView");while(c){if(b in c)return c;c=a(c,"parentView")}},nearestChildOf:function(b){var c=a(this,"parentView");while(c){if(a(c,"parentView")instanceof b)return c;c=a(c,"parentView")}},collectionView:Ember.computed(function(){return this.nearestInstanceOf(Ember.CollectionView)}).cacheable(),itemView:Ember.computed(function(){return this.nearestChildOf(Ember.CollectionView)}).cacheable(),contentView:Ember.computed(function(){return this.nearestWithProperty("content")}).cacheable(),_parentViewDidChange:Ember.observer(function(){if(this.isDestroying)return;this.invokeRecursively(function(a){a.propertyDidChange("collectionView"),a.propertyDidChange("itemView"),a.propertyDidChange("contentView")}),a(this,"parentView.controller")&&!a(this,"controller")&&this.notifyPropertyChange("controller")},"_parentView"),_controllerDidChange:Ember.observer(function(){if(this.isDestroying)return;this.forEachChildView(function(a){a.propertyDidChange("controller")})},"controller"),cloneKeywords:function(){var c=a(this,"templateData"),d=c?Ember.copy(c.keywords):{};return b(d,"view",a(this,"concreteView")),b(d,"controller",a(this,"controller")),d},render:function(b){var c=a(this,"layout")||a(this,"template");if(c){var d=a(this,"_context"),e=this.cloneKeywords(),f={view:this,buffer:b,isRenderData:!0,keywords:e},g=c(d,{data:f});g!==undefined&&b.push(g)}},invokeForState:function(a){var b=this.state,c,d;if(d=j[b][a])return c=f.call(arguments),c[0]=this,d.apply(this,c);var e=this,g=e.states,h;while(g){h=g[b];while(h){d=h[a];if(d)return j[b][a]=d,c=f.call(arguments,1),c.unshift(this),d.apply(this,c);h=h.parentState}g=g.parent}},rerender:function(){return this.invokeForState("rerender")},clearRenderedChildren:function(){var a=this.lengthBeforeRender,b=this.lengthAfterRender,c=this._childViews;for(var d=b-1;d>=a;d--)c[d]&&c[d].destroy()},_applyClassNameBindings:function(){var b=a(this,"classNameBindings"),d=a(this,"classNames"),e,f,h;if(!b)return;g(b,function(a){var b,g=function(){f=this._classStringForProperty(a),e=this.$(),b&&(e.removeClass(b),d.removeObject(b)),f?(e.addClass(f),b=f):b=null};h=this._classStringForProperty(a),h&&(d.push(h),b=h);var i=Ember.View._parsePropertyPath(a);c(this,i.path,g)},this)},_applyAttributeBindings:function(b){var d=a(this,"attributeBindings"),e,f,h;if(!d)return;g(d,function(d){var g=d.split(":"),h=g[0],i=g[1]||h,j=function(){f=this.$();if(!f)return;e=a(this,h),Ember.View.applyAttributeBindings(f,i,e)};c(this,h,j),e=a(this,h),Ember.View.applyAttributeBindings(b,i,e)},this)},_classStringForProperty:function(b){var c=Ember.View._parsePropertyPath(b),d=c.path,e=a(this,d);return e===undefined&&Ember.isGlobalPath(d)&&(e=a(window,d)),Ember.View._classStringForValue(d,e,c.className,c.falsyClassName)},element:Ember.computed(function(a,b){return b!==undefined?this.invokeForState("setElement",b):this.invokeForState("getElement")}).property("_parentView").cacheable(),$:function(a){return this.invokeForState("$",a)},mutateChildViews:function(a){var b=this._childViews,c=b.length,d;while(--c>=0)d=b[c],a.call(this,d,c);return this},forEachChildView:function(a){var b=this._childViews;if(!b)return this;var c=b.length,d,e;for(e=0;e<c;e++)d=b[e],a.call(this,d);return this},appendTo:function(a){return this._insertElementLater(function(){this.$().appendTo(a)}),this},replaceIn:function(a){return this._insertElementLater(function(){Ember.$(a).empty(),this.$().appendTo(a)}),this},_insertElementLater:function(a){this._lastInsert=Ember.guidFor(a),Ember.run.schedule("render",this,this.invokeForState,"insertElement",a)},append:function(){return this.appendTo(document.body)},remove:function(){this.destroyElement(),this.invokeRecursively(function(a){a.clearRenderedChildren()})},elementId:Ember.computed(function(a,b){return b!==undefined?b:Ember.guidFor(this)}).cacheable(),_elementIdDidChange:Ember.beforeObserver(function(){throw"Changing a view's elementId after creation is not allowed."},"elementId"),findElementInParentElement:function(b){var c="#"+a(this,"elementId");return Ember.$(c)[0]||Ember.$(c,b)[0]},renderBuffer:function(b){b=b||a(this,"tagName");if(b===null||b===undefined)b="div";return Ember.RenderBuffer(b)},createElement:function(){if(a(this,"element"))return this;var c=this.renderToBuffer();return b(this,"element",c.element()),this},willInsertElement:Ember.K,didInsertElement:Ember.K,willRerender:Ember.K,invokeRecursively:function(a){a.call(this,this),this.forEachChildView(function(b){b.invokeRecursively(a)})},invalidateRecursively:function(a){this.forEachChildView(function(b){b.propertyDidChange(a)})},_notifyWillInsertElement:function(){this.invokeRecursively(function(a){a.trigger("willInsertElement")})},_notifyDidInsertElement:function(){this.invokeRecursively(function(a){a.trigger("didInsertElement")})},_notifyWillRerender:function(){this.invokeRecursively(function(a){a.trigger("willRerender")})},destroyElement:function(){return this.invokeForState("destroyElement")},willDestroyElement:function(){},_notifyWillDestroyElement:function(){this.invokeRecursively(function(a){a.trigger("willDestroyElement")})},_elementWillChange:Ember.beforeObserver(function(){this.forEachChildView(function(a){Ember.propertyWillChange(a,"element")})},"element"),_elementDidChange:Ember.observer(function(){this.forEachChildView(function(a){Ember.propertyDidChange(a,"element")})},"element"),parentViewDidChange:Ember.K,renderToBuffer:function(b,c){var d;Ember.run.sync(),c=c||"begin";if(b){var e=a(this,"tagName");if(e===null||e===undefined)e="div";d=b[c](e)}else d=this.renderBuffer();return this.buffer=d,this.transitionTo("inBuffer",!1),this.lengthBeforeRender=this._childViews.length,this.beforeRender(d),this.render(d),this.afterRender(d),this.lengthAfterRender=this._childViews.length,d},beforeRender:function(a){this.applyAttributesToBuffer(a)},afterRender:Ember.K,applyAttributesToBuffer:function(b){this._applyClassNameBindings(),this._applyAttributeBindings(b),g(a(this,"classNames"),function(a){b.addClass(a)}),b.id(a(this,"elementId"));var c=a(this,"ariaRole");c&&b.attr("role",c),a(this,"isVisible")===!1&&b.style("display","none")},tagName:null,ariaRole:null,classNames:["ember-view"],classNameBindings:[],attributeBindings:[],state:"preRender",init:function(){this._super(),this.isVirtual||(Ember.View.views[a(this,"elementId")]=this),this._childViews=this._childViews.slice(),this.classNameBindings=Ember.A(this.classNameBindings.slice()),this.classNames=Ember.A(this.classNames.slice());var c=a(this,"viewController");c&&(c=a(c),c&&b(c,"view",this))},appendChild:function(a,b){return this.invokeForState("appendChild",a,b)},removeChild:function(a){if(this.isDestroying)return;b(a,"_parentView",null);var c=this._childViews;return Ember.EnumerableUtils.removeObject(c,a),this.propertyDidChange("childViews"),this},removeAllChildren:function(){return this.mutateChildViews(function(a){this.removeChild(a)})},destroyAllChildren:function(){return this.mutateChildViews(function(a){a.destroy()})},removeFromParent:function(){var b=a(this,"_parentView");return this.remove(),b&&b.removeChild(this),this},willDestroy:function(){var c=this._childViews,d=a(this,"_parentView"),e;this.removedFromDOM||this.destroyElement();if(this.viewName){var f=a(this,"parentView");f&&b(f,this.viewName,null)}d&&d.removeChild(this),this.state="destroyed",e=c.length;for(var g=e-1;g>=0;g--)c[g].removedFromDOM=!0,c[g].destroy();this.isVirtual||delete Ember.View.views[a(this,"elementId")]},createChildView:function(c,d){return Ember.View.detect(c)?(d=d||{},d._parentView=this,d.templateData=d.templateData||a(this,"templateData"),c=c.create(d),c.viewName&&b(a(this,"concreteView"),c.viewName,c)):(a(c,"templateData")||b(c,"templateData",a(this,"templateData")),b(c,"_parentView",this)),c},becameVisible:Ember.K,becameHidden:Ember.K,_isVisibleDidChange:Ember.observer(function(){var b=this.$();if(!b)return;var c=a(this,"isVisible");b.toggle(c);if(this._isAncestorHidden())return;c?this._notifyBecameVisible():this._notifyBecameHidden()},"isVisible"),_notifyBecameVisible:function(){this.trigger("becameVisible"),this.forEachChildView(function(b){var c=a(b,"isVisible");(c||c===null)&&b._notifyBecameVisible()})},_notifyBecameHidden:function(){this.trigger("becameHidden"),this.forEachChildView(function(b){var c=a(b,"isVisible");(c||c===null)&&b._notifyBecameHidden()})},_isAncestorHidden:function(){var b=a(this,"parentView");while(b){if(a(b,"isVisible")===!1)return!0;b=a(b,"parentView")}return!1},clearBuffer:function(){this.invokeRecursively(function(a){this.buffer=null})},transitionTo:function(a,b){this.state=a,b!==!1&&this.forEachChildView(function(b){b.transitionTo(a)})},trigger:function(a){this._super.apply(this,arguments);var b=this[a];if(b){var c=[],d,e;for(d=1,e=arguments.length;d<e;d++)c.push(arguments[d]);return b.apply(this,c)}},has:function(a){return Ember.typeOf(this[a])==="function"||this._super(a)},handleEvent:function(a,b){return this.invokeForState("handleEvent",a,b)}});var k={prepend:function(a,b){b._insertElementLater(function(){var c=a.$();c.prepend(b.$())})},after:function(a,b){b._insertElementLater(function(){var c=a.$();c.after(b.$())})},replace:function(c){var d=a(c,"element");b(c,"element",null),c._insertElementLater(function(){Ember.$(d).replaceWith(a(c,"element"))})},remove:function(c){var d=a(c,"element");b(c,"element",null),c._lastInsert=null,Ember.$(d).remove()},empty:function(a){a.$().empty()}};Ember.View.reopen({states:Ember.View.states,domManager:k}),Ember.View.reopenClass({_parsePropertyPath:function(a){var b=a.split(/:/),c=b[0],d="",e,f;return b.length>1&&(e=b[1],b.length===3&&(f=b[2]),d=":"+e,f&&(d+=":"+f)),{path:c,classNames:d,className:e===""?undefined:e,falsyClassName:f}},_classStringForValue:function(a,b,c,d){if(!!b&&c)return c;if(b===!0){if(b===!0&&!c&&d)return null;var e=a.split(".");return Ember.String.dasherize(e[e.length-1])}return b===!1&&d?d:b!==!1&&b!==undefined&&b!==null?b:null}}),Ember.View.views={},Ember.View.childViewsProperty=h,Ember.View.applyAttributeBindings=function(a,b,c){var d=Ember.typeOf(c),e=a.attr(b);(d==="string"||d==="number"&&!isNaN(c))&&c!==e?a.attr(b,c):c&&d==="boolean"?a.attr(b,b):c||a.removeAttr(b)}}(),function(){var a=Ember.get,b=Ember.set;Ember.View.states={_default:{appendChild:function(){throw"You can't use appendChild outside of the rendering process"},$:function(){return undefined},getElement:function(){return null},handleEvent:function(){return!0},destroyElement:function(a){return b(a,"element",null),a._lastInsert=null,a}}},Ember.View.reopen({states:Ember.View.states})}(),function(){Ember.View.states.preRender={parentState:Ember.View.states._default,insertElement:function(a,b){if(a._lastInsert!==Ember.guidFor(b))return;a.createElement(),a._notifyWillInsertElement(),b.call(a),a.transitionTo("inDOM"),a._notifyDidInsertElement()},empty:Ember.K,setElement:function(a,b){return b!==null&&a.transitionTo("hasElement"),b}}}(),function(){var a=Ember.get,b=Ember.set,c=Ember.meta;Ember.View.states.inBuffer={parentState:Ember.View.states._default,$:function(a,b){return a.rerender(),Ember.$()},rerender:function(a){a._notifyWillRerender(),a.clearRenderedChildren(),a.renderToBuffer(a.buffer,"replaceWith")},appendChild:function(a,b,c){var d=a.buffer;return b=this.createChildView(b,c),a._childViews.push(b),b.renderToBuffer(d),a.propertyDidChange("childViews"),b},destroyElement:function(a){return a.clearBuffer(),a._notifyWillDestroyElement(),a.transitionTo("preRender"),a},empty:function(){},insertElement:function(){throw"You can't insert an element that has already been rendered"},setElement:function(a,b){return b===null?a.transitionTo("preRender"):(a.clearBuffer(),a.transitionTo("hasElement")),b}}}(),function(){var a=Ember.get,b=Ember.set,c=Ember.meta;Ember.View.states.hasElement={parentState:Ember.View.states._default,$:function(b,c){var d=a(b,"element");return c?Ember.$(c,d):Ember.$(d)},getElement:function(b){var c=a(b,"parentView");return c&&(c=a(c,"element")),c?b.findElementInParentElement(c):Ember.$("#"+a(b,"elementId"))[0]},setElement:function(a,b){if(b!==null)throw"You cannot set an element to a non-null value when the element is already in the DOM.";return a.transitionTo("preRender"),b},rerender:function(a){return a._notifyWillRerender(),a.clearRenderedChildren(),a.domManager.replace(a),a},destroyElement:function(a){return a._notifyWillDestroyElement(),a.domManager.remove(a),a},empty:function(a){var b=a._childViews,c,d;if(b){c=b.length;for(d=0;d<c;d++)b[d]._notifyWillDestroyElement()}a.domManager.empty(a)},handleEvent:function(a,b,c){return a.has(b)?a.trigger(b,c):!0}},Ember.View.states.inDOM={parentState:Ember.View.states.hasElement,insertElement:function(a,b){if(a._lastInsert!==Ember.guidFor(b))return;throw"You can't insert an element into the DOM that has already been inserted"}}}(),function(){var a="You can't call %@ on a destroyed view",b=Ember.String.fmt;Ember.View.states.destroyed={parentState:Ember.View.states._default,appendChild:function(){throw b(a,["appendChild"])},rerender:function(){throw b(a,["rerender"])},destroyElement:function(){throw b(a,["destroyElement"])},empty:function(){throw b(a,["empty"])},setElement:function(){throw b(a,["set('element', ...)"])},insertElement:Ember.K}}(),function(){}(),function(){var a=Ember.get,b=Ember.set,c=Ember.meta,d=Ember.EnumerableUtils.forEach,e=Ember.computed(function(){return a(this,"_childViews")}).property("_childViews").cacheable();Ember.ContainerView=Ember.View.extend({init:function(){this._super();var c=a(this,"childViews");Ember.defineProperty(this,"childViews",e);var f=this._childViews;d(c,function(c,d){var e;"string"==typeof c?(e=a(this,c),e=this.createChildView(e),b(this,c,e)):e=this.createChildView(c),f[d]=e},this);var g=a(this,"currentView");g&&f.push(this.createChildView(g)),Ember.A(f),a(this,"childViews").addArrayObserver(this,{willChange:"childViewsWillChange",didChange:"childViewsDidChange"})},render:function(a){this.forEachChildView(function(b){b.renderToBuffer(a)})},willDestroy:function(){a(this,"childViews").removeArrayObserver(this,{willChange:"childViewsWillChange",didChange:"childViewsDidChange"}),this._super()},childViewsWillChange:function(a,b,c){if(c===0)return;var d=a.slice(b,b+c);this.initializeViews(d,null,null),this.invokeForState("childViewsWillChange",a,b,c)},childViewsDidChange:function(b,c,d,e){var f=a(b,"length");if(e===0)return;var g=b.slice(c,c+e);this.initializeViews(g,this,a(this,"templateData")),this.invokeForState("childViewsDidChange",b,c,e)},initializeViews:function(c,e,f){d(c,function(c){b(c,"_parentView",e),a(c,"templateData")||b(c,"templateData",f)})},_scheduleInsertion:function(a,b){b?b.domManager.after(b,a):this.domManager.prepend(this,a)},currentView:null,_currentViewWillChange:Ember.beforeObserver(function(){var b=a(this,"childViews"),c=a(this,"currentView");c&&(b.removeObject(c),c.destroy())},"currentView"),_currentViewDidChange:Ember.observer(function(){var b=a(this,"childViews"),c=a(this,"currentView");c&&b.pushObject(c)},"currentView")}),Ember.ContainerView.states={parent:Ember.View.states,inBuffer:{childViewsDidChange:function(a,b,c,d){var e=a.buffer,f,g,h,i;c===0?(i=b[c],f=c+1,i.renderToBuffer(e,"prepend")):(i=b[c-1],f=c);for(var j=f;j<c+d;j++)g=i,i=b[j],h=g.buffer,i.renderToBuffer(h,"insertAfter")}},hasElement:{childViewsWillChange:function(a,b,c,d){for(var e=c;e<c+d;e++)b[e].remove()},childViewsDidChange
+:function(a,b,c,d){var e=c===0?null:b[c-1];for(var f=c;f<c+d;f++)a=b[f],this._scheduleInsertion(a,e),e=a}}},Ember.ContainerView.states.inDOM={parentState:Ember.ContainerView.states.hasElement},Ember.ContainerView.reopen({states:Ember.ContainerView.states})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.String.fmt;Ember.CollectionView=Ember.ContainerView.extend({content:null,emptyViewClass:Ember.View,emptyView:null,itemViewClass:Ember.View,init:function(){var a=this._super();return this._contentDidChange(),a},_contentWillChange:Ember.beforeObserver(function(){var b=this.get("content");b&&b.removeArrayObserver(this);var c=b?a(b,"length"):0;this.arrayWillChange(b,0,c)},"content"),_contentDidChange:Ember.observer(function(){var b=a(this,"content");b&&b.addArrayObserver(this);var c=b?a(b,"length"):0;this.arrayDidChange(b,0,null,c)},"content"),willDestroy:function(){var b=a(this,"content");b&&b.removeArrayObserver(this),this._super()},arrayWillChange:function(b,c,d){var e=a(this,"emptyView");e&&e instanceof Ember.View&&e.removeFromParent();var f=a(this,"childViews"),g,h,i;i=a(f,"length");var j=d===i;j&&this.invokeForState("empty");for(h=c+d-1;h>=c;h--)g=f[h],j&&(g.removedFromDOM=!0),g.destroy()},arrayDidChange:function(c,d,e,f){var g=a(this,"itemViewClass"),h=a(this,"childViews"),i=[],j,k,l,m,n;"string"==typeof g&&(g=a(g)),m=c?a(c,"length"):0;if(m)for(l=d;l<d+f;l++)k=c.objectAt(l),j=this.createChildView(g,{content:k,contentIndex:l}),i.push(j);else{var o=a(this,"emptyView");if(!o)return;o=this.createChildView(o),i.push(o),b(this,"emptyView",o)}h.replace(d,0,i)},createChildView:function(c,d){c=this._super(c,d);var e=a(c,"tagName"),f=e===null||e===undefined?Ember.CollectionView.CONTAINER_MAP[a(this,"tagName")]:e;return b(c,"tagName",f),c}}),Ember.CollectionView.CONTAINER_MAP={ul:"li",ol:"li",table:"tr",thead:"tr",tbody:"tr",tfoot:"tr",tr:"td",select:"option"}}(),function(){}(),function(){}(),function(){var a=Ember.get,b=Ember.set;Ember.State=Ember.Object.extend(Ember.Evented,{isState:!0,parentState:null,start:null,name:null,path:Ember.computed(function(){var b=a(this,"parentState.path"),c=a(this,"name");return b&&(c=b+"."+c),c}).property().cacheable(),trigger:function(a){this[a]&&this[a].apply(this,[].slice.call(arguments,1)),this._super.apply(this,arguments)},init:function(){var c=a(this,"states"),d;b(this,"childStates",Ember.A()),b(this,"eventTransitions",a(this,"eventTransitions")||{});var e,f,g;if(!c){c={};for(e in this){if(e==="constructor")continue;if(f=this[e]){if(g=f.transitionTarget)this.eventTransitions[e]=g;this.setupChild(c,e,f)}}b(this,"states",c)}else for(e in c)this.setupChild(c,e,c[e]);b(this,"pathsCache",{}),b(this,"pathsCacheNoContext",{})},setupChild:function(c,d,e){if(!e)return!1;e.isState?b(e,"name",d):Ember.State.detect(e)&&(e=e.create({name:d})),e.isState&&(b(e,"parentState",this),a(this,"childStates").pushObject(e),c[d]=e)},lookupEventTransition:function(a){var b,c=this;while(c&&!b)b=c.eventTransitions[a],c=c.get("parentState");return b},isLeaf:Ember.computed(function(){return!a(this,"childStates").length}).cacheable(),hasContext:!0,setup:Ember.K,enter:Ember.K,exit:Ember.K});var c=Ember.$&&Ember.$.Event;Ember.State.reopenClass({transitionTo:function(a){var b=function(b,d){if(c&&d instanceof c){if(!d.hasOwnProperty("context"))return b.transitionTo(a);d=d.context}b.transitionTo(a,d)};return b.transitionTarget=a,b}})}(),function(){var a=Ember.get,b=Ember.set,c=Ember.String.fmt,d=Ember.ArrayPolyfills.forEach,e=function(a){this.enterStates=a.enterStates.slice(),this.exitStates=a.exitStates.slice(),this.resolveState=a.resolveState,this.finalState=a.enterStates[a.enterStates.length-1]||a.resolveState};e.prototype={normalize:function(a,b){return this.matchContextsToStates(b),this.addInitialStates(),this.removeUnchangedContexts(a),this},matchContextsToStates:function(b){var c=this.enterStates.length-1,d=[],e,f;while(b.length>0){if(c>=0)e=this.enterStates[c--];else{if(this.enterStates.length){e=a(this.enterStates[0],"parentState");if(!e)throw"Cannot match all contexts to states"}else e=this.resolveState;this.enterStates.unshift(e),this.exitStates.unshift(e)}a(e,"hasContext")?f=b.pop():f=null,d.unshift(f)}this.contexts=d},addInitialStates:function(){var b=this.finalState,c;for(;;){c=a(b,"initialState")||"start",b=a(b,"states."+c);if(!b)break;this.finalState=b,this.enterStates.push(b),this.contexts.push(undefined)}},removeUnchangedContexts:function(a){while(this.enterStates.length>0){if(this.enterStates[0]!==this.exitStates[0])break;if(this.enterStates.length===this.contexts.length){if(a.getStateMeta(this.enterStates[0],"context")!==this.contexts[0])break;this.contexts.shift()}this.resolveState=this.enterStates.shift(),this.exitStates.shift()}}},Ember.StateManager=Ember.State.extend({init:function(){this._super(),b(this,"stateMeta",Ember.Map.create());var c=a(this,"initialState");!c&&a(this,"states.start")&&(c="start"),c&&this.transitionTo(c)},stateMetaFor:function(b){var c=a(this,"stateMeta"),d=c.get(b);return d||(d={},c.set(b,d)),d},setStateMeta:function(a,c,d){return b(this.stateMetaFor(a),c,d)},getStateMeta:function(b,c){return a(this.stateMetaFor(b),c)},currentState:null,transitionEvent:"setup",errorOnUnhandledEvent:!0,send:function(b,c){return this.sendRecursively(b,a(this,"currentState"),c)},sendRecursively:function(b,d,e){var f=this.enableLogging,g=d[b];if(typeof g=="function")return f&&Ember.Logger.log(c("STATEMANAGER: Sending event '%@' to state %@.",[b,a(d,"path")])),g.call(d,this,e);var h=a(d,"parentState");if(h)return this.sendRecursively(b,h,e);if(a(this,"errorOnUnhandledEvent"))throw new Ember.Error(this.toString()+" could not respond to event "+b+" in state "+a(this,"currentState.path")+".")},getStateByPath:function(b,c){var d=c.split("."),e=b;for(var f=0,g=d.length;f<g;f++){e=a(a(e,"states"),d[f]);if(!e)break}return e},findStateByPath:function(b,c){var d;while(!d&&b)d=this.getStateByPath(b,c),b=a(b,"parentState");return d},findStatesByPath:function(b,c){if(!c||c==="")return undefined;var d=c.split("."),e=[];for(var f=0,g=d.length;f<g;f++){var h=a(b,"states");if(!h)return undefined;var i=a(h,d[f]);if(!i)return undefined;b=i,e.push(i)}return e},goToState:function(){return this.transitionTo.apply(this,arguments)},transitionTo:function(b,c){if(Ember.empty(b))return;var d=c?Array.prototype.slice.call(arguments,1):[],f=a(this,"currentState")||this,g=this.contextFreeTransition(f,b),h=(new e(g)).normalize(this,d);this.enterState(h),this.triggerSetupContext(h)},contextFreeTransition:function(b,c){var d=b.pathsCache[c];if(d)return d;var e=this.findStatesByPath(b,c),f=[],g=b;while(g&&!e){f.unshift(g),g=a(g,"parentState");if(!g){e=this.findStatesByPath(this,c);if(!e)return}e=this.findStatesByPath(g,c)}while(e.length>0&&e[0]===f[0])g=e.shift(),f.shift();var h=b.pathsCache[c]={exitStates:f,enterStates:e,resolveState:g};return h},triggerSetupContext:function(b){var c=b.contexts,e=b.enterStates.length-c.length,f=b.enterStates,g=a(this,"transitionEvent");d.call(f,function(a,b){a.trigger(g,this,c[b-e])},this)},getState:function(b){var c=a(this,b),d=a(this,"parentState");if(c)return c;if(d)return d.getState(b)},enterState:function(c){var e=this.enableLogging,f=c.exitStates.slice(0).reverse();d.call(f,function(a){a.trigger("exit",this)},this),d.call(c.enterStates,function(b){e&&Ember.Logger.log("STATEMANAGER: Entering "+a(b,"path")),b.trigger("enter",this)},this),b(this,"currentState",c.finalState)}})}(),function(){}(),function(){var a=Ember.get;Ember._ResolvedState=Ember.Object.extend({manager:null,state:null,match:null,object:Ember.computed(function(b,c){if(arguments.length===2)return this._object=c,c;if(this._object)return this._object;var d=a(this,"state"),e=a(this,"match"),f=a(this,"manager");return d.deserialize(f,e.hash)}).property(),hasPromise:Ember.computed(function(){return Ember.canInvoke(a(this,"object"),"then")}).property("object"),promise:Ember.computed(function(){var b=a(this,"object");return Ember.canInvoke(b,"then")?b:{then:function(a){a(b)}}}).property("object"),transition:function(){var b=a(this,"manager"),c=a(this,"state.path"),d=a(this,"object");b.transitionTo(c,d)}})}(),function(){var a=Ember.get,b=function(a){var b=a.toString(),c=b.split("."),d=c[c.length-1];return Ember.String.underscore(d)+"_id"},c=function(a,b){for(var c in b){if(!b.hasOwnProperty(c))continue;if(a.hasOwnProperty(c))continue;a[c]=b[c]}};Ember.Routable=Ember.Mixin.create({init:function(){var b;this.on("connectOutlets",this,this.stashContext);if(b=a(this,"redirectsTo"))this.connectOutlets=function(a){a.transitionTo(b)};var c=a(this,"route");c===""&&(c="/"),this._super()},stashContext:function(b,c){var d=this.serialize(b,c);b.setStateMeta(this,"context",c),b.setStateMeta(this,"serialized",d),a(this,"isRoutable")&&!a(b,"isRouting")&&this.updateRoute(b,a(b,"location"))},updateRoute:function(b,c){if(a(this,"isLeafRoute")){var d=this.absoluteRoute(b);c.setURL(d)}},absoluteRoute:function(b,d){var e=a(this,"parentState"),f="",g;a(e,"isRoutable")&&(f=e.absoluteRoute(b,d));var h=a(this,"routeMatcher"),i=b.getStateMeta(this,"serialized");return d=d||{},c(d,i),g=h&&h.generate(d),g&&(f=f+"/"+g),f},isRoutable:Ember.computed(function(){return typeof a(this,"route")=="string"}).cacheable(),isLeafRoute:Ember.computed(function(){return a(this,"isLeaf")?!0:!a(this,"childStates").findProperty("isRoutable")}).cacheable(),routeMatcher:Ember.computed(function(){var b=a(this,"route");if(b)return Ember._RouteMatcher.create({route:b})}).cacheable(),hasContext:Ember.computed(function(){var b=a(this,"routeMatcher");if(b)return b.identifiers.length>0}).cacheable(),modelClass:Ember.computed(function(){var b=a(this,"modelType");return typeof b=="string"?Ember.get(window,b):b}).cacheable(),modelClassFor:function(b){var c,d,e,f,g;if(c=a(this,"modelClass"))return c;if(!b)return;d=a(this,"routeMatcher");if(!d)return;e=d.identifiers;if(e.length!==2)return;f=e[1].match(/^(.*)_id$/);if(!f)return;return g=Ember.String.classify(f[1]),a(b,g)},deserialize:function(c,d){var e,f,g;return(e=this.modelClassFor(a(c,"namespace")))?e.find(d[b(e)]):d},serialize:function(c,d){var e,f,g,h,i;if(Ember.empty(d))return"";if(e=this.modelClassFor(a(c,"namespace")))h=b(e),i=a(d,"id"),d={},d[h]=i;return d},resolvePath:function(b,c){if(a(this,"isLeafRoute"))return Ember.A();var d=a(this,"childStates"),e;d=Ember.A(d.filterProperty("isRoutable")),d=d.sort(function(b,c){var d=a(b,"routeMatcher.identifiers.length"),e=a(c,"routeMatcher.identifiers.length"),f=a(b,"route"),g=a(c,"route");return f.indexOf(g)===0?-1:g.indexOf(f)===0?1:d!==e?d-e:a(c,"route.length")-a(b,"route.length")});var f=d.find(function(b){var d=a(b,"routeMatcher");if(e=d.match(c))return!0}),g=Ember._ResolvedState.create({manager:b,state:f,match:e}),h=f.resolvePath(b,e.remaining);return Ember.A([g]).pushObjects(h)},routePath:function(b,c){function f(){d.forEach(function(a){a.transition()})}if(a(this,"isLeafRoute"))return;var d=this.resolvePath(b,c),e=d.some(function(b){return a(b,"hasPromise")});e?(b.transitionTo("loading"),b.handleStatePromises(d,f)):f()},unroutePath:function(b,c){var d=a(this,"parentState");if(d===b)return;c=c.replace(/^(?=[^\/])/,"/");var e=this.absoluteRoute(b),f=a(this,"route");if(f!=="/"){var g=c.indexOf(e),h=c.charAt(e.length);if(g===0&&(h==="/"||h===""))return}b.enterState({exitStates:[this],enterStates:[],finalState:d}),b.send("unroutePath",c)},connectOutlets:Ember.K,navigateAway:Ember.K})}(),function(){Ember.Route=Ember.State.extend(Ember.Routable)}(),function(){var a=function(a){return a.replace(/[\-\[\]{}()*+?.,\\\^\$|#\s]/g,"\\$&")};Ember._RouteMatcher=Ember.Object.extend({state:null,init:function(){var b=this.route,c=[],d=1,e;b.charAt(0)==="/"&&(b=this.route=b.substr(1)),e=a(b);var f=e.replace(/:([a-z_]+)(?=$|\/)/gi,function(a,b){return c[d++]=b,"([^/]+)"});this.identifiers=c,this.regex=new RegExp("^/?"+f)},match:function(a){var b=a.match(this.regex);if(b){var c=this.identifiers,d={};for(var e=1,f=c.length;e<f;e++)d[c[e]]=b[e];return{remaining:a.substr(b[0].length),hash:c.length>0?d:null}}},generate:function(a){var b=this.identifiers,c=this.route,d;for(var e=1,f=b.length;e<f;e++)d=b[e],c=c.replace(new RegExp(":"+d),a[d]);return c}})}(),function(){var a=Ember.get,b=Ember.set,c=function(a,b){for(var c in b){if(!b.hasOwnProperty(c))continue;if(a.hasOwnProperty(c))continue;a[c]=b[c]}};Ember.Router=Ember.StateManager.extend({initialState:"root",location:"hash",rootURL:"/",transitionEvent:"connectOutlets",transitionTo:function(){this.abortRoutingPromises(),this._super.apply(this,arguments)},route:function(c){this.abortRoutingPromises(),b(this,"isRouting",!0);var d;try{c=c.replace(/^(?=[^\/])/,"/"),this.send("navigateAway"),this.send("unroutePath",c),d=a(this,"currentState");while(d&&!d.get("isRoutable"))d=a(d,"parentState");var e=d?d.absoluteRoute(this):"",f=c.substr(e.length);this.send("routePath",f)}finally{b(this,"isRouting",!1)}d=a(this,"currentState");while(d&&!d.get("isRoutable"))d=a(d,"parentState");d&&d.updateRoute(this,a(this,"location"))},urlFor:function(b,c){var d=a(this,"currentState")||this,e=this.findStateByPath(d,b),f=a(this,"location"),g=e.absoluteRoute(this,c);return f.formatURL(g)},urlForEvent:function(b){var c=Array.prototype.slice.call(arguments,1),d=a(this,"currentState"),e=d.lookupEventTransition(b),f=this.findStateByPath(d,e),g=this.serializeRecursively(f,c,{});return this.urlFor(e,g)},serializeRecursively:function(b,d,e){var f,g=a(b,"hasContext")?d.pop():null;return c(e,b.serialize(this,g)),f=b.get("parentState"),f&&f instanceof Ember.Route?this.serializeRecursively(f,d,e):e},abortRoutingPromises:function(){this._routingPromises&&(this._routingPromises.abort(),this._routingPromises=null)},handleStatePromises:function(a,c){this.abortRoutingPromises(),this.set("isLocked",!0);var d=this;this._routingPromises=Ember._PromiseChain.create({promises:a.slice(),successCallback:function(){d.set("isLocked",!1),c()},failureCallback:function(){throw"Unable to load object"},promiseSuccessCallback:function(a,c){b(a,"object",c[0])},abortCallback:function(){d.set("isLocked",!1)}}).start()},init:function(){this._super();var c=a(this,"location"),d=a(this,"rootURL");"string"==typeof c&&b(this,"location",Ember.Location.create({implementation:c,rootURL:d}))},willDestroy:function(){a(this,"location").destroy()}})}(),function(){}(),function(){var a=Ember.get;Ember.StateManager.reopen({currentView:Ember.computed(function(){var b=a(this,"currentState"),c;while(b){if(a(b,"isViewState")){c=a(b,"view");if(c)return c}b=a(b,"parentState")}return null}).property("currentState").cacheable()})}(),function(){var a=Ember.get,b=Ember.set;Ember.ViewState=Ember.State.extend({isViewState:!0,init:function(){return this._super()},enter:function(c){var d=a(this,"view"),e,f;d&&(Ember.View.detect(d)&&(d=d.create(),b(this,"view",d)),e=c.get("rootView"),e?(f=a(e,"childViews"),f.pushObject(d)):(e=c.get("rootElement")||"body",d.appendTo(e)))},exit:function(b){var c=a(this,"view");c&&(a(c,"parentView")?c.removeFromParent():c.remove())}})}(),function(){}(),function(){(function(a){var b=function(){},c=0,d=a.document,e="createRange"in d&&typeof Range!="undefined"&&Range.prototype.createContextualFragment,f=function(){var a=d.createElement("div");return a.innerHTML="<div></div>",a.firstChild.innerHTML="<script></script>",a.firstChild.innerHTML===""}(),g=function(a){var d;this instanceof g?d=this:d=new b,d.innerHTML=a;var e="metamorph-"+c++;return d.start=e+"-start",d.end=e+"-end",d};b.prototype=g.prototype;var h,i,j,k,l,m,n,o,p;k=function(){return this.startTag()+this.innerHTML+this.endTag()},o=function(){return"<script id='"+this.start+"' type='text/x-placeholder'></script>"},p=function(){return"<script id='"+this.end+"' type='text/x-placeholder'></script>"};if(e)h=function(a,b){var c=d.createRange(),e=d.getElementById(a.start),f=d.getElementById(a.end);return b?(c.setStartBefore(e),c.setEndAfter(f)):(c.setStartAfter(e),c.setEndBefore(f)),c},i=function(a,b){var c=h(this,b);c.deleteContents();var d=c.createContextualFragment(a);c.insertNode(d)},j=function(){var a=h(this,!0);a.deleteContents()},l=function(a){var b=d.createRange();b.setStart(a),b.collapse(!1);var c=b.createContextualFragment(this.outerHTML());a.appendChild(c)},m=function(a){var b=d.createRange(),c=d.getElementById(this.end);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)},n=function(a){var b=d.createRange(),c=d.getElementById(this.start);b.setStartAfter(c),b.setEndAfter(c);var e=b.createContextualFragment(a);b.insertNode(e)};else{var q={select:[1,"<select multiple='multiple'>","</select>"],fieldset:[1,"<fieldset>","</fieldset>"],table:[1,"<table>","</table>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"],colgroup:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],map:[1,"<map>","</map>"],_default:[0,"",""]},r=function(a,b){var c=q[a.tagName.toLowerCase()]||q._default,e=c[0],g=c[1],h=c[2];f&&(b="&shy;"+b);var i=d.createElement("div");i.innerHTML=g+b+h;for(var j=0;j<=e;j++)i=i.firstChild;if(f){var k=i;while(k.nodeType===1&&!k.nodeName)k=k.firstChild;k.nodeType===3&&k.nodeValue.charAt(0)==="­"&&(k.nodeValue=k.nodeValue.slice(1))}return i},s=function(a){while(a.parentNode.tagName==="")a=a.parentNode;return a},t=function(a,b){a.parentNode!==b.parentNode&&b.parentNode.insertBefore(a,b.parentNode.firstChild)};i=function(a,b){var c=s(d.getElementById(this.start)),e=d.getElementById(this.end),f=e.parentNode,g,h,i;t(c,e),g=c.nextSibling;while(g){h=g.nextSibling,i=g===e;if(i){if(!b)break;e=g.nextSibling}g.parentNode.removeChild(g);if(i)break;g=h}g=r(c.parentNode,a);while(g)h=g.nextSibling,f.insertBefore(g,e),g=h},j=function(){var a=s(d.getElementById(this.start)),b=d.getElementById(this.end);this.html(""),a.parentNode.removeChild(a),b.parentNode.removeChild(b)},l=function(a){var b=r(a,this.outerHTML());while(b)nextSibling=b.nextSibling,a.appendChild(b),b=nextSibling},m=function(a){var b=d.getElementById(this.end),c=b.nextSibling,e=b.parentNode,f,g;g=r(e,a);while(g)f=g.nextSibling,e.insertBefore(g,c),g=f},n=function(a){var b=d.getElementById(this.start),c=b.parentNode,e,f;f=r(c,a);var g=b.nextSibling;while(f)e=f.nextSibling,c.insertBefore(f,g),f=e}}g.prototype.html=function(a){this.checkRemoved();if(a===undefined)return this.innerHTML;i.call(this,a),this.innerHTML=a},g.prototype.replaceWith=function(a){this.checkRemoved(),i.call(this,a,!0)},g.prototype.remove=j,g.prototype.outerHTML=k,g.prototype.appendTo=l,g.prototype.after=m,g.prototype.prepend=n,g.prototype.startTag=o,g.prototype.endTag=p,g.prototype.isRemoved=function(){var a=d.getElementById(this.start),b=d.getElementById(this.end);return!a||!b},g.prototype.checkRemoved=function(){if(this.isRemoved())throw new Error("Cannot perform operations on a Metamorph that is not in the DOM.")},a.Metamorph=g})(this)}(),function(){var a=Ember.create;Ember.Handlebars=a(Handlebars),Ember.Handlebars.helpers=a(Handlebars.helpers),Ember.Handlebars.Compiler=function(){},Ember.Handlebars.Compiler.prototype=a(Handlebars.Compiler.prototype),Ember.Handlebars.Compiler.prototype.compiler=Ember.Handlebars.Compiler,Ember.Handlebars.JavaScriptCompiler=function(){},Ember.Handlebars.JavaScriptCompiler.prototype=a(Handlebars.JavaScriptCompiler.prototype),Ember.Handlebars.JavaScriptCompiler.prototype.compiler=Ember.Handlebars.JavaScriptCompiler,Ember.Handlebars.JavaScriptCompiler.prototype.namespace="Ember.Handlebars",Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer=function(){return"''"},Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer=function(a){return"data.buffer.push("+a+");"},Ember.Handlebars.Compiler.prototype.mustache=function(a){if(a.params.length||a.hash)return Handlebars.Compiler.prototype.mustache.call(this,a);var b=new Handlebars.AST.IdNode(["_triageMustache"]);return a.escaped||(a.hash=a.hash||new Handlebars.AST.HashNode([]),a.hash.pairs.push(["unescaped",new Handlebars.AST.StringNode("true")])),a=new Handlebars.AST.MustacheNode([b].concat([a.id]),a.hash,!a.escaped),Handlebars.Compiler.prototype.mustache.call(this,a)},Ember.Handlebars.precompile=function(a){var b=Handlebars.parse(a),c={knownHelpers:{action:!0,unbound:!0,bindAttr:!0,template:!0,view:!0,_triageMustache:!0},data:!0,stringParams:!0},d=(new Ember.Handlebars.Compiler).compile(b,c);return(new Ember.Handlebars.JavaScriptCompiler).compile(d,c,undefined,!0)},Ember.Handlebars.compile=function(a){var b=Handlebars.parse(a),c={data:!0,stringParams:!0},d=(new Ember.Handlebars.Compiler).compile(b,c),e=(new Ember.Handlebars.JavaScriptCompiler).compile(d,c,undefined,!0);return Handlebars.template(e)};var b=Ember.Handlebars.normalizePath=function(a,b,c){var d=c&&c.keywords||{},e,f;return e=b.split(".",1)[0],d.hasOwnProperty(e)&&(a=d[e],f=!0,b===e?b="":b=b.substr(e.length+1)),{root:a,path:b,isKeyword:f}};Ember.Handlebars.getPath=function(a,c,d){var e=d&&d.data,f=b(a,c,e),g;return a=f.root,c=f.path,g=Ember.get(a,c),g===undefined&&a!==window&&Ember.isGlobalPath(c)&&(g=Ember.get(window,c)),g},Ember.Handlebars.registerHelper("helperMissing",function(a,b){var c,d="";throw c="%@ Handlebars error: Could not find property '%@' on object %@.",b.data&&(d=b.data.view),new Ember.Error(Ember.String.fmt(c,[d,a,this]))})}(),function(){Ember.String.htmlSafe=function(a){return new Handlebars.SafeString(a)};var a=Ember.String.htmlSafe;Ember.EXTEND_PROTOTYPES&&(String.prototype.htmlSafe=function(){return a(this)})}(),function(){var a=Ember.set,b=Ember.get,c={remove:function(b){var c=b.morph;if(c.isRemoved())return;a(b,"element",null),b._lastInsert=null,c.remove()},prepend:function(a,b){b._insertElementLater(function(){var c=a.morph;c.prepend(b.outerHTML),b.outerHTML=null})},after:function(a,b){b._insertElementLater(function(){var c=a.morph;c.after(b.outerHTML),b.outerHTML=null})},replace:function(a){var c=a.morph;a.transitionTo("preRender"),a.clearRenderedChildren();var d=a.renderToBuffer();Ember.run.schedule("render",this,function(){if(b(a,"isDestroyed"))return;a.invalidateRecursively("element"),a._notifyWillInsertElement(),c.replaceWith(d.string()),a.transitionTo("inDOM"),a._notifyDidInsertElement()})},empty:function(a){a.morph.html("")}};Ember._Metamorph=Ember.Mixin.create({isVirtual:!0,tagName:"",init:function(){this._super(),this.morph=Metamorph()},beforeRender:function(a){a.push(this.morph.startTag())},afterRender:function(a){a.push(this.morph.endTag())},createElement:function(){var a=this.renderToBuffer();this.outerHTML=a.string(),this.clearBuffer()},domManager:c}),Ember._MetamorphView=Ember.View.extend(Ember._Metamorph)}(),function(){var a=Ember.get,b=Ember.set,c=Ember.Handlebars.getPath;Ember._HandlebarsBoundView=Ember._MetamorphView.extend({shouldDisplayFunc:null,preserveContext:!1,previousContext:null,displayTemplate:null,inverseTemplate:null,path:null,pathRoot:null,normalizedValue:Ember.computed(function(){var b=a(this,"path"),d=a(this,"pathRoot"),e=a(this,"valueNormalizerFunc"),f,g;return b===""?f=d:(g=a(this,"templateData"),f=c(d,b,{data:g})),e?e(f):f}).property("path","pathRoot","valueNormalizerFunc").volatile(),rerenderIfNeeded:function(){!a(this,"isDestroyed")&&a(this,"normalizedValue")!==this._lastNormalizedValue&&this.rerender()},render:function(c){var d=a(this,"isEscaped"),e=a(this,"shouldDisplayFunc"),f=a(this,"preserveContext"),g=a(this,"previousContext"),h=a(this,"inverseTemplate"),i=a(this,"displayTemplate"),j=a(this,"normalizedValue");this._lastNormalizedValue=j;if(e(j)){b(this,"template",i);if(f)b(this,"_context",g);else{if(!i){j===null||j===undefined?j="":j instanceof Handlebars.SafeString||(j=String(j)),d&&(j=Handlebars.Utils.escapeExpression(j)),c.push(j);return}b(this,"_context",j)}}else h?(b(this,"template",h),f?b(this,"_context",g):b(this,"_context",j)):b(this,"template",function(){return""});return this._super(c)}})}(),function(){function i(a,b,c,f,g){var h=b.data,i=b.fn,j=b.inverse,k=h.view,l=this,m,n,o;o=e(l,a,h),m=o.root,n=o.path;if("object"==typeof this){var p=k.createChildView(Ember._HandlebarsBoundView,{preserveContext:c,shouldDisplayFunc:f,valueNormalizerFunc:g,displayTemplate:i,inverseTemplate:j,path:n,pathRoot:m,previousContext:l,isEscaped:!b.hash.unescaped,templateData:b.data});k.appendChild(p);var q=function(){Ember.run.once(p,"rerenderIfNeeded")};n!==""&&Ember.addObserver(m,n,q)}else h.buffer.push(d(m,n,b))}var a=Ember.get,b=Ember.set,c=Ember.String.fmt,d=Ember.Handlebars.getPath,e=Ember.Handlebars.normalizePath,f=Ember.ArrayPolyfills.forEach,g=Ember.Handlebars,h=g.helpers;g.registerHelper("_triageMustache",function(a,b){return h[a]?h[a].call(this,b):h.bind.apply(this,arguments)}),g.registerHelper("bind",function(a,b){var c=b.contexts&&b.contexts[0]||this;return i.call(c,a,b,!1,function(a){return!Ember.none(a)})}),g.registerHelper("boundIf",function(b,c){var d=c.contexts&&c.contexts[0]||this,e=function(b){return Ember.typeOf(b)==="array"?a(b,"length")!==0:!!b};return i.call(d,b,c,!0,e,e)}),g.registerHelper("with",function(a,b){if(arguments.length===4){var c,d,f,g;b=arguments[3],c=arguments[2],d=arguments[0];if(Ember.isGlobalPath(d))Ember.bind(b.data.keywords,c,d);else{g=e(this,d,b.data),d=g.path,f=g.root;var j=Ember.$.expando+Ember.guidFor(f);b.data.keywords[j]=f;var k=d?j+"."+d:j;Ember.bind(b.data.keywords,c,k)}return i.call(this,d,b.fn,!0,function(a){return!Ember.none(a)})}return h.bind.call(b.contexts[0],a,b)}),g.registerHelper("if",function(a,b){return h.boundIf.call(b.contexts[0],a,b)}),g.registerHelper("unless",function(a,b){var c=b.fn,d=b.inverse;return b.fn=d,b.inverse=c,h.boundIf.call(b.contexts[0],a,b)}),g.registerHelper("bindAttr",function(a){var b=a.hash,c=a.data.view,h=[],i=this,j=++Ember.$.uuid,k=b["class"];if(k!==null&&k!==undefined){var l=g.bindClasses(this,k,c,j,a);h.push('class="'+Handlebars.Utils.escapeExpression(l.join(" "))+'"'),delete b["class"]}var m=Ember.keys(b);return f.call(m,function(f){var g=b[f],k,l;l=e(i,g,a.data),k=l.root,g=l.path;var m=g==="this"?k:d(k,g,a),n=Ember.typeOf(m),o,p;o=function(){var e=d(k,g,a),h=c.$("[data-bindattr-"+j+"='"+j+"']");if(h.length===0){Ember.removeObserver(k,g,p);return}Ember.View.applyAttributeBindings(h,f,e)},p=function(){Ember.run.once(o)},g!=="this"&&Ember.addObserver(k,g,p),n==="string"||n==="number"&&!isNaN(m)?h.push(f+'="'+Handlebars.Utils.escapeExpression(m)+'"'):m&&n==="boolean"&&h.push(f+'="'+f+'"')},this),h.push("data-bindattr-"+j+'="'+j+'"'),new g.SafeString(h.join(" "))}),g.bindClasses=function(a,b,c,g,h){var i=[],j,k,l,m=function(a,b,c){var e,f=b.path;return f==="this"?e=a:f===""?e=!0:e=d(a,f,c),Ember.View._classStringForValue(f,e,b.className,b.falsyClassName)};return f.call(b.split(" "),function(b){var d,f,n,o=Ember.View._parsePropertyPath(b),p=o.path,q=a,r;p!==""&&p!=="this"&&(r=e(a,p,h.data),q=r.root,p=r.path),f=function(){j=m(q,o,h),l=g?c.$("[data-bindattr-"+g+"='"+g+"']"):c.$(),l.length===0?Ember.removeObserver(q,p,n):(d&&l.removeClass(d),j?(l.addClass(j),d=j):d=null)},n=function(){Ember.run.once(f)},p!==""&&p!=="this"&&Ember.addObserver(q,p,n),k=m(q,o,h),k&&(i.push(k),d=k)}),i}}(),function(){var a=Ember.get,b=Ember.set,c=/^parentView\./,d=Ember.Handlebars,e=Ember.VIEW_PRESERVES_CONTEXT;d.ViewHelper=Ember.Object.create({propertiesFromHTMLOptions:function(a,b){var c=a.hash,d=a.data,e={},f=c["class"],g=!1;c.id&&(e.elementId=c.id,g=!0),f&&(f=f.split(" "),e.classNames=f,g=!0),c.classBinding&&(e.classNameBindings=c.classBinding.split(" "),g=!0),c.classNameBindings&&(e.classNameBindings===undefined&&(e.classNameBindings=[]),e.classNameBindings=e.classNameBindings.concat(c.classNameBindings.split(" ")),g=!0),c.attributeBindings&&(e.attributeBindings=null,g=!0),g&&(c=Ember.$.extend({},c),delete c.id,delete c["class"],delete c.classBinding);var h;for(var i in c){if(!c.hasOwnProperty(i))continue;Ember.IS_BINDING.test(i)&&typeof c[i]=="string"&&(h=this.contextualizeBindingPath(c[i],d),h&&(c[i]=h))}if(e.classNameBindings)for(var j in e.classNameBindings){var k=e.classNameBindings[j];if(typeof k=="string"){var l=Ember.View._parsePropertyPath(k);h=this.contextualizeBindingPath(l.path,d),h&&(e.classNameBindings[j]=h+l.classNames)}}return e.bindingContext=b,Ember.$.extend(c,e)},contextualizeBindingPath:function(a,b){var c=Ember.Handlebars.normalizePath(null,a,b);return c.isKeyword?"templateData.keywords."+a:Ember.isGlobalPath(a)?null:a==="this"?"bindingContext":"bindingContext."+a},helper:function(a,b,c){var f=c.inverse,g=c.data,h=g.view,i=c.fn,j=c.hash,k;"string"==typeof b?k=d.getPath(a,b,c):k=b;var l=this.propertiesFromHTMLOptions(c,a),m=g.view;l.templateData=c.data,i&&(l.template=i),e&&!k.proto().controller&&!k.proto().controllerBinding&&!l.controller&&!l.controllerBinding&&(l._context=a),m.appendChild(k,l)}}),d.registerHelper("view",function(a,b){return a&&a.data&&a.data.isRenderData&&(b=a,a="Ember.View"),d.ViewHelper.helper(this,a,b)})}(),function(){var a=Ember.get,b=Ember.Handlebars.getPath,c=Ember.String.fmt;Ember.Handlebars.registerHelper("collection",function(c,d){c&&c.data&&c.data.isRenderData&&(d=c,c=undefined);var e=d.fn,f=d.data,g=d.inverse,h;h=c?b(this,c,d):Ember.CollectionView;var i=d.hash,j={},k,l,m=i.itemViewClass,n=h.proto();delete i.itemViewClass,l=m?b(n,m,d):n.itemViewClass;for(var o in i)i.hasOwnProperty(o)&&(k=o.match(/^item(.)(.*)$/),k&&(j[k[1].toLowerCase()+k[2]]=i[o],delete i[o]));var p=i.tagName||n.tagName;e&&(j.template=e,delete d.fn);var q;g&&g!==Handlebars.VM.noop?(q=a(n,"emptyViewClass"),q=q.extend({template:g,tagName:j.tagName})):i.emptyViewClass&&(q=b(this,i.emptyViewClass,d)),i.emptyView=q,i.eachHelper==="each"&&(j._context=Ember.computed(function(){return a(this,"content")}).property("content"),delete i.eachHelper);var r=Ember.Handlebars.ViewHelper.propertiesFromHTMLOptions({data:f,hash:j},this);return i.itemViewClass=l.extend(r),Ember.Handlebars.helpers.view.call(this,h,d)})}(),function(){var a=Ember.Handlebars.getPath;Ember.Handlebars.registerHelper("unbound",function(b,c){var d=c.contexts&&c.contexts[0]||this;return a(d,b,c)})}(),function(){var a=Ember.Handlebars.getPath,b=Ember.Handlebars.normalizePath;Ember.Handlebars.registerHelper("log",function(c,d){var e=d.contexts&&d.contexts[0]||this,f=b(e,c,d.data),g=f.root,h=f.path,i=h==="this"?g:a(g,h,d);Ember.Logger.log(i)}),Ember.Handlebars.registerHelper("debugger",function(){debugger})}(),function(){var a=Ember.get,b=Ember.set;Ember.Handlebars.EachView=Ember.CollectionView.extend(Ember._Metamorph,{itemViewClass:Ember._MetamorphView,emptyViewClass:Ember._MetamorphView,createChildView:function(c,d){c=this._super(c,d);var e=a(this,"keyword");if(e){var f=a(c,"templateData");f=Ember.copy(f),f.keywords=c.cloneKeywords(),b(c,"templateData",f);var g=a(c,"content");f.keywords[e]=g}return c}}),Ember.Handlebars.registerHelper("each",function(a,b){if(arguments.length===4){var c=arguments[0];b=arguments[3],a=arguments[2],a===""&&(a="this"),b.hash.keyword=c}else b.hash.eachHelper="each";return b.hash.contentBinding=a,Ember.Handlebars.helpers.collection.call(this,"Ember.Handlebars.EachView",b)})}(),function(){Ember.Handlebars.registerHelper("template",function(a,b){var c=Ember.TEMPLATES[a];Ember.TEMPLATES[a](this,{data:b.data})})}(),function(){var a=Ember.Handlebars,b=a.getPath,c=Ember.get,d=Array.prototype.slice,e=a.ActionHelper={registeredActions:{}};e.registerAction=function(a,b){var c=(++Ember.$.uuid).toString();return e.registeredActions[c]={eventName:b.eventName,handler:function(c){var d=c.shiftKey||c.metaKey||c.altKey||c.ctrlKey,e=c.which>1,f=d||e;if(b.link&&f)return;c.preventDefault(),c.view=b.view,b.hasOwnProperty("context")&&(c.context=b.context),b.hasOwnProperty("contexts")&&(c.contexts=b.contexts);var g=b.target;return g.isState&&typeof g.send=="function"?g.send(a,c):g[a].call(g,c)}},b.view.on("willRerender",function(){delete e.registeredActions[c]}),c},a.registerHelper("action",function(f){var g=arguments[arguments.length-1],h=d.call(arguments,1,-1),i=g.hash,j=g.data.view,k,l,m,n={eventName:i.on||"click"};n.view=j=c(j,"concreteView");if(i.target)k=b(this,i.target,g);else if(l=g.data.keywords.controller)k=c(l,"target");n.target=k=k||j,h.length&&(n.contexts=h=Ember.EnumerableUtils.map(h,function(a){return b(this,a,g)},this),n.context=h[0]);var o=[],p;i.href&&k.urlForEvent&&(p=k.urlForEvent.apply(k,[f].concat(h)),o.push('href="'+p+'"'),n.link=!0);var q=e.registerAction(f,n);return o.push('data-ember-action="'+q+'"'),new a.SafeString(o.join(" "))})}(),function(){var a=Ember.get,b=Ember.set;Ember.Handlebars.registerHelper("yield",function(b){var c=b.data.view,d;while(c&&!a(c,"layout"))c=a(c,"parentView");d=a(c,"template"),d&&d(this,b)})}(),function(){Ember.Handlebars.registerHelper("outlet",function(a,b){return a&&a.data&&a.data.isRenderData&&(b=a,a="view"),b.hash.currentViewBinding="controller."+a,Ember.Handlebars
+.helpers.view.call(this,Ember.ContainerView,b)})}(),function(){}(),function(){}(),function(){var a=Ember.set,b=Ember.get;Ember.Checkbox=Ember.View.extend({classNames:["ember-checkbox"],tagName:"input",attributeBindings:["type","checked","disabled","tabindex"],type:"checkbox",checked:!1,disabled:!1,init:function(){this._super(),this.on("change",this,this._updateElementValue)},_updateElementValue:function(){a(this,"checked",this.$().prop("checked"))}})}(),function(){var a=Ember.get,b=Ember.set;Ember.TextSupport=Ember.Mixin.create({value:"",attributeBindings:["placeholder","disabled","maxlength","tabindex"],placeholder:null,disabled:!1,maxlength:null,insertNewline:Ember.K,cancel:Ember.K,init:function(){this._super(),this.on("focusOut",this,this._elementValueDidChange),this.on("change",this,this._elementValueDidChange),this.on("keyUp",this,this.interpretKeyEvents)},interpretKeyEvents:function(a){var b=Ember.TextSupport.KEY_EVENTS,c=b[a.keyCode];this._elementValueDidChange();if(c)return this[c](a)},_elementValueDidChange:function(){b(this,"value",this.$().val())}}),Ember.TextSupport.KEY_EVENTS={13:"insertNewline",27:"cancel"}}(),function(){var a=Ember.get,b=Ember.set;Ember.TextField=Ember.View.extend(Ember.TextSupport,{classNames:["ember-text-field"],tagName:"input",attributeBindings:["type","value","size"],value:"",type:"text",size:null})}(),function(){var a=Ember.get,b=Ember.set;Ember.Button=Ember.View.extend(Ember.TargetActionSupport,{classNames:["ember-button"],classNameBindings:["isActive"],tagName:"button",propagateEvents:!1,attributeBindings:["type","disabled","href","tabindex"],targetObject:Ember.computed(function(){var b=a(this,"target"),c=a(this,"context"),d=a(this,"templateData");return typeof b!="string"?b:Ember.Handlebars.getPath(c,b,{data:d})}).property("target").cacheable(),type:Ember.computed(function(a,b){var c=this.get("tagName");b!==undefined&&(this._type=b);if(this._type!==undefined)return this._type;if(c==="input"||c==="button")return"button"}).property("tagName").cacheable(),disabled:!1,href:Ember.computed(function(){return this.get("tagName")==="a"?"#":null}).property("tagName").cacheable(),mouseDown:function(){return a(this,"disabled")||(b(this,"isActive",!0),this._mouseDown=!0,this._mouseEntered=!0),a(this,"propagateEvents")},mouseLeave:function(){this._mouseDown&&(b(this,"isActive",!1),this._mouseEntered=!1)},mouseEnter:function(){this._mouseDown&&(b(this,"isActive",!0),this._mouseEntered=!0)},mouseUp:function(c){return a(this,"isActive")&&(this.triggerAction(),b(this,"isActive",!1)),this._mouseDown=!1,this._mouseEntered=!1,a(this,"propagateEvents")},keyDown:function(a){(a.keyCode===13||a.keyCode===32)&&this.mouseDown()},keyUp:function(a){(a.keyCode===13||a.keyCode===32)&&this.mouseUp()},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},init:function(){this._super()}})}(),function(){var a=Ember.get,b=Ember.set;Ember.TextArea=Ember.View.extend(Ember.TextSupport,{classNames:["ember-text-area"],tagName:"textarea",attributeBindings:["rows","cols"],rows:null,cols:null,_updateElementValue:Ember.observer(function(){var b=a(this,"value"),c=this.$();c&&b!==c.val()&&c.val(b)},"value"),init:function(){this._super(),this.on("didInsertElement",this,this._updateElementValue)}})}(),function(){Ember.TabContainerView=Ember.View.extend({init:function(){this._super()}})}(),function(){var a=Ember.get;Ember.TabPaneView=Ember.View.extend({tabsContainer:Ember.computed(function(){return this.nearestInstanceOf(Ember.TabContainerView)}).property().volatile(),isVisible:Ember.computed(function(){return a(this,"viewName")===a(this,"tabsContainer.currentView")}).property("tabsContainer.currentView").volatile(),init:function(){this._super()}})}(),function(){var a=Ember.get,b=Ember.setPath;Ember.TabView=Ember.View.extend({tabsContainer:Ember.computed(function(){return this.nearestInstanceOf(Ember.TabContainerView)}).property().volatile(),mouseUp:function(){b(this,"tabsContainer.currentView",a(this,"value"))},init:function(){this._super()}})}(),function(){}(),function(){var a=Ember.set,b=Ember.get,c=Ember.EnumerableUtils.indexOf,d=Ember.EnumerableUtils.indexesOf;Ember.Select=Ember.View.extend({tagName:"select",classNames:["ember-select"],defaultTemplate:Ember.Handlebars.template(function(b,c,d,e,f){function q(a,b){var c="",e,f,g,h;return b.buffer.push("<option value>"),e=a,f="view.prompt",g={},h="true",g.escaped=h,h=d._triageMustache||a._triageMustache,k={},k.hash=g,k.contexts=[],k.contexts.push(e),k.data=b,typeof h===m?e=h.call(a,f,k):h===o?e=n.call(a,"_triageMustache",f,k):e=h,b.buffer.push(p(e)+"</option>"),c}function r(a,b){var c,e,f,g;c=a,e="Ember.SelectOption",f={},g="this",f.contentBinding=g,g=d.view||a.view,k={},k.hash=f,k.contexts=[],k.contexts.push(c),k.data=b,typeof g===m?c=g.call(a,e,k):g===o?c=n.call(a,"view",e,k):c=g,b.buffer.push(p(c))}d=d||Ember.Handlebars.helpers;var g="",h,i,j,k,l=this,m="function",n=d.helperMissing,o=void 0,p=this.escapeExpression;return h=c,i="view.prompt",j=d["if"],k=l.program(1,q,f),k.hash={},k.contexts=[],k.contexts.push(h),k.fn=k,k.inverse=l.noop,k.data=f,h=j.call(c,i,k),(h||h===0)&&f.buffer.push(h),h=c,i="view.content",j=d.each,k=l.program(3,r,f),k.hash={},k.contexts=[],k.contexts.push(h),k.fn=k,k.inverse=l.noop,k.data=f,h=j.call(c,i,k),(h||h===0)&&f.buffer.push(h),g}),attributeBindings:["multiple","tabindex"],multiple:!1,content:null,selection:null,value:Ember.computed(function(a,c){if(arguments.length===2)return c;var d=b(this,"optionValuePath").replace(/^content\.?/,"");return d?b(this,"selection."+d):b(this,"selection")}).property("selection").cacheable(),prompt:null,optionLabelPath:"content",optionValuePath:"content",_change:function(){b(this,"multiple")?this._changeMultiple():this._changeSingle()},selectionDidChange:Ember.observer(function(){var c=b(this,"selection"),d=Ember.isArray(c);if(b(this,"multiple")){if(!d){a(this,"selection",Ember.A([c]));return}this._selectionDidChangeMultiple()}else this._selectionDidChangeSingle()},"selection"),valueDidChange:Ember.observer(function(){var a=b(this,"content"),c=b(this,"value"),d=b(this,"optionValuePath").replace(/^content\.?/,""),e=d?b(this,"selection."+d):b(this,"selection"),f;c!==e&&(f=a.find(function(a){return c===(d?b(a,d):a)}),this.set("selection",f))},"value"),_triggerChange:function(){var a=b(this,"selection");a&&this.selectionDidChange(),this._change()},_changeSingle:function(){var c=this.$()[0].selectedIndex,d=b(this,"content"),e=b(this,"prompt");if(!d)return;if(e&&c===0){a(this,"selection",null);return}e&&(c-=1),a(this,"selection",d.objectAt(c))},_changeMultiple:function(){var c=this.$("option:selected"),d=b(this,"prompt"),e=d?1:0,f=b(this,"content");if(!f)return;if(c){var g=c.map(function(){return this.index-e}).toArray();a(this,"selection",f.objectsAt(g))}},_selectionDidChangeSingle:function(){var a=this.get("element");if(!a)return;var d=b(this,"content"),e=b(this,"selection"),f=d?c(d,e):-1,g=b(this,"prompt");g&&(f+=1),a&&(a.selectedIndex=f)},_selectionDidChangeMultiple:function(){var a=b(this,"content"),e=b(this,"selection"),f=a?d(a,e):[-1],g=b(this,"prompt"),h=g?1:0,i=this.$("option"),j;i&&i.each(function(){j=this.index>-1?this.index+h:-1,this.selected=c(f,j)>-1})},init:function(){this._super(),this.on("didInsertElement",this,this._triggerChange),this.on("change",this,this._change)}}),Ember.SelectOption=Ember.View.extend({tagName:"option",attributeBindings:["value","selected"],defaultTemplate:function(a,b){b={data:b.data,hash:{}},Ember.Handlebars.helpers.bind.call(a,"view.label",b)},init:function(){this.labelPathDidChange(),this.valuePathDidChange(),this._super()},selected:Ember.computed(function(){var a=b(this,"content"),d=b(this,"parentView.selection");return b(this,"parentView.multiple")?d&&c(d,a)>-1:a==d}).property("content","parentView.selection").volatile(),labelPathDidChange:Ember.observer(function(){var a=b(this,"parentView.optionLabelPath");if(!a)return;Ember.defineProperty(this,"label",Ember.computed(function(){return b(this,a)}).property(a).cacheable())},"parentView.optionLabelPath"),valuePathDidChange:Ember.observer(function(){var a=b(this,"parentView.optionValuePath");if(!a)return;Ember.defineProperty(this,"value",Ember.computed(function(){return b(this,a)}).property(a).cacheable())},"parentView.optionValuePath")})}(),function(){}(),function(){function a(){Ember.Handlebars.bootstrap(Ember.$(document))}Ember.Handlebars.bootstrap=function(a){var b='script[type="text/x-handlebars"], script[type="text/x-raw-handlebars"]';Ember.$(b,a).each(function(){var a=Ember.$(this),b=a.attr("type"),c=a.attr("type")==="text/x-raw-handlebars"?Ember.$.proxy(Handlebars.compile,Handlebars):Ember.$.proxy(Ember.Handlebars.compile,Ember.Handlebars),d=a.attr("data-template-name")||a.attr("id"),e=c(a.html()),f,g,h,i;if(d)Ember.TEMPLATES[d]=e,a.remove();else{if(a.parents("head").length!==0)throw new Ember.Error("Template found in <head> without a name specified. Please provide a data-template-name attribute.\n"+a.html());g=a.attr("data-view"),f=g?Ember.get(g):Ember.View,h=a.attr("data-element-id"),i={template:e},h&&(i.elementId=h),f=f.create(i),f._insertElementLater(function(){a.replaceWith(this.$()),a=null})}})},Ember.$(document).ready(a),Ember.onLoad("application",a)}(),function(){}(); \ No newline at end of file
diff --git a/src/components/HMI/lib/handlebars-1.0.0.beta.6.js b/src/components/HMI/lib/handlebars-1.0.0.beta.6.js
new file mode 100644
index 0000000000..70665b1c37
--- /dev/null
+++ b/src/components/HMI/lib/handlebars-1.0.0.beta.6.js
@@ -0,0 +1,1550 @@
+// lib/handlebars/base.js
+var Handlebars = {};
+
+Handlebars.VERSION = "1.0.beta.6";
+
+Handlebars.helpers = {};
+Handlebars.partials = {};
+
+Handlebars.registerHelper = function(name, fn, inverse) {
+ if(inverse) { fn.not = inverse; }
+ this.helpers[name] = fn;
+};
+
+Handlebars.registerPartial = function(name, str) {
+ this.partials[name] = str;
+};
+
+Handlebars.registerHelper('helperMissing', function(arg) {
+ if(arguments.length === 2) {
+ return undefined;
+ } else {
+ throw new Error("Could not find property '" + arg + "'");
+ }
+});
+
+var toString = Object.prototype.toString, functionType = "[object Function]";
+
+Handlebars.registerHelper('blockHelperMissing', function(context, options) {
+ var inverse = options.inverse || function() {}, fn = options.fn;
+
+
+ var ret = "";
+ var type = toString.call(context);
+
+ if(type === functionType) { context = context.call(this); }
+
+ if(context === true) {
+ return fn(this);
+ } else if(context === false || context == null) {
+ return inverse(this);
+ } else if(type === "[object Array]") {
+ if(context.length > 0) {
+ for(var i=0, j=context.length; i<j; i++) {
+ ret = ret + fn(context[i]);
+ }
+ } else {
+ ret = inverse(this);
+ }
+ return ret;
+ } else {
+ return fn(context);
+ }
+});
+
+Handlebars.registerHelper('each', function(context, options) {
+ var fn = options.fn, inverse = options.inverse;
+ var ret = "";
+
+ if(context && context.length > 0) {
+ for(var i=0, j=context.length; i<j; i++) {
+ ret = ret + fn(context[i]);
+ }
+ } else {
+ ret = inverse(this);
+ }
+ return ret;
+});
+
+Handlebars.registerHelper('if', function(context, options) {
+ var type = toString.call(context);
+ if(type === functionType) { context = context.call(this); }
+
+ if(!context || Handlebars.Utils.isEmpty(context)) {
+ return options.inverse(this);
+ } else {
+ return options.fn(this);
+ }
+});
+
+Handlebars.registerHelper('unless', function(context, options) {
+ var fn = options.fn, inverse = options.inverse;
+ options.fn = inverse;
+ options.inverse = fn;
+
+ return Handlebars.helpers['if'].call(this, context, options);
+});
+
+Handlebars.registerHelper('with', function(context, options) {
+ return options.fn(context);
+});
+
+Handlebars.registerHelper('log', function(context) {
+ Handlebars.log(context);
+});
+;
+// lib/handlebars/compiler/parser.js
+/* Jison generated parser */
+var handlebars = (function(){
+
+var parser = {trace: function trace() { },
+yy: {},
+symbols_: {"error":2,"root":3,"program":4,"EOF":5,"statements":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"OPEN_PARTIAL":24,"params":25,"hash":26,"param":27,"STRING":28,"INTEGER":29,"BOOLEAN":30,"hashSegments":31,"hashSegment":32,"ID":33,"EQUALS":34,"pathSegments":35,"SEP":36,"$accept":0,"$end":1},
+terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},
+productions_: [0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],
+performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
+
+var $0 = $$.length - 1;
+switch (yystate) {
+case 1: return $$[$0-1]
+break;
+case 2: this.$ = new yy.ProgramNode($$[$0-2], $$[$0])
+break;
+case 3: this.$ = new yy.ProgramNode($$[$0])
+break;
+case 4: this.$ = new yy.ProgramNode([])
+break;
+case 5: this.$ = [$$[$0]]
+break;
+case 6: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
+break;
+case 7: this.$ = new yy.InverseNode($$[$0-2], $$[$0-1], $$[$0])
+break;
+case 8: this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0])
+break;
+case 9: this.$ = $$[$0]
+break;
+case 10: this.$ = $$[$0]
+break;
+case 11: this.$ = new yy.ContentNode($$[$0])
+break;
+case 12: this.$ = new yy.CommentNode($$[$0])
+break;
+case 13: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
+break;
+case 14: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
+break;
+case 15: this.$ = $$[$0-1]
+break;
+case 16: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1])
+break;
+case 17: this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], true)
+break;
+case 18: this.$ = new yy.PartialNode($$[$0-1])
+break;
+case 19: this.$ = new yy.PartialNode($$[$0-2], $$[$0-1])
+break;
+case 20:
+break;
+case 21: this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]
+break;
+case 22: this.$ = [[$$[$0-1]].concat($$[$0]), null]
+break;
+case 23: this.$ = [[$$[$0-1]], $$[$0]]
+break;
+case 24: this.$ = [[$$[$0]], null]
+break;
+case 25: $$[$0-1].push($$[$0]); this.$ = $$[$0-1];
+break;
+case 26: this.$ = [$$[$0]]
+break;
+case 27: this.$ = $$[$0]
+break;
+case 28: this.$ = new yy.StringNode($$[$0])
+break;
+case 29: this.$ = new yy.IntegerNode($$[$0])
+break;
+case 30: this.$ = new yy.BooleanNode($$[$0])
+break;
+case 31: this.$ = new yy.HashNode($$[$0])
+break;
+case 32: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]
+break;
+case 33: this.$ = [$$[$0]]
+break;
+case 34: this.$ = [$$[$0-2], $$[$0]]
+break;
+case 35: this.$ = [$$[$0-2], new yy.StringNode($$[$0])]
+break;
+case 36: this.$ = [$$[$0-2], new yy.IntegerNode($$[$0])]
+break;
+case 37: this.$ = [$$[$0-2], new yy.BooleanNode($$[$0])]
+break;
+case 38: this.$ = new yy.IdNode($$[$0])
+break;
+case 39: $$[$0-2].push($$[$0]); this.$ = $$[$0-2];
+break;
+case 40: this.$ = [$$[$0]]
+break;
+}
+},
+table: [{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],
+defaultActions: {16:[2,1],37:[2,23],53:[2,21]},
+parseError: function parseError(str, hash) {
+ throw new Error(str);
+},
+parse: function parse(input) {
+ var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
+ this.lexer.setInput(input);
+ this.lexer.yy = this.yy;
+ this.yy.lexer = this.lexer;
+ if (typeof this.lexer.yylloc == "undefined")
+ this.lexer.yylloc = {};
+ var yyloc = this.lexer.yylloc;
+ lstack.push(yyloc);
+ if (typeof this.yy.parseError === "function")
+ this.parseError = this.yy.parseError;
+ function popStack(n) {
+ stack.length = stack.length - 2 * n;
+ vstack.length = vstack.length - n;
+ lstack.length = lstack.length - n;
+ }
+ function lex() {
+ var token;
+ token = self.lexer.lex() || 1;
+ if (typeof token !== "number") {
+ token = self.symbols_[token] || token;
+ }
+ return token;
+ }
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
+ while (true) {
+ state = stack[stack.length - 1];
+ if (this.defaultActions[state]) {
+ action = this.defaultActions[state];
+ } else {
+ if (symbol == null)
+ symbol = lex();
+ action = table[state] && table[state][symbol];
+ }
+ if (typeof action === "undefined" || !action.length || !action[0]) {
+ if (!recovering) {
+ expected = [];
+ for (p in table[state])
+ if (this.terminals_[p] && p > 2) {
+ expected.push("'" + this.terminals_[p] + "'");
+ }
+ var errStr = "";
+ if (this.lexer.showPosition) {
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + this.terminals_[symbol] + "'";
+ } else {
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
+ }
+ this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
+ }
+ }
+ if (action[0] instanceof Array && action.length > 1) {
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
+ }
+ switch (action[0]) {
+ case 1:
+ stack.push(symbol);
+ vstack.push(this.lexer.yytext);
+ lstack.push(this.lexer.yylloc);
+ stack.push(action[1]);
+ symbol = null;
+ if (!preErrorSymbol) {
+ yyleng = this.lexer.yyleng;
+ yytext = this.lexer.yytext;
+ yylineno = this.lexer.yylineno;
+ yyloc = this.lexer.yylloc;
+ if (recovering > 0)
+ recovering--;
+ } else {
+ symbol = preErrorSymbol;
+ preErrorSymbol = null;
+ }
+ break;
+ case 2:
+ len = this.productions_[action[1]][1];
+ yyval.$ = vstack[vstack.length - len];
+ yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
+ r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
+ if (typeof r !== "undefined") {
+ return r;
+ }
+ if (len) {
+ stack = stack.slice(0, -1 * len * 2);
+ vstack = vstack.slice(0, -1 * len);
+ lstack = lstack.slice(0, -1 * len);
+ }
+ stack.push(this.productions_[action[1]][0]);
+ vstack.push(yyval.$);
+ lstack.push(yyval._$);
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
+ stack.push(newState);
+ break;
+ case 3:
+ return true;
+ }
+ }
+ return true;
+}
+};/* Jison generated lexer */
+var lexer = (function(){
+
+var lexer = ({EOF:1,
+parseError:function parseError(str, hash) {
+ if (this.yy.parseError) {
+ this.yy.parseError(str, hash);
+ } else {
+ throw new Error(str);
+ }
+ },
+setInput:function (input) {
+ this._input = input;
+ this._more = this._less = this.done = false;
+ this.yylineno = this.yyleng = 0;
+ this.yytext = this.matched = this.match = '';
+ this.conditionStack = ['INITIAL'];
+ this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
+ return this;
+ },
+input:function () {
+ var ch = this._input[0];
+ this.yytext+=ch;
+ this.yyleng++;
+ this.match+=ch;
+ this.matched+=ch;
+ var lines = ch.match(/\n/);
+ if (lines) this.yylineno++;
+ this._input = this._input.slice(1);
+ return ch;
+ },
+unput:function (ch) {
+ this._input = ch + this._input;
+ return this;
+ },
+more:function () {
+ this._more = true;
+ return this;
+ },
+pastInput:function () {
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
+ return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
+ },
+upcomingInput:function () {
+ var next = this.match;
+ if (next.length < 20) {
+ next += this._input.substr(0, 20-next.length);
+ }
+ return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
+ },
+showPosition:function () {
+ var pre = this.pastInput();
+ var c = new Array(pre.length + 1).join("-");
+ return pre + this.upcomingInput() + "\n" + c+"^";
+ },
+next:function () {
+ if (this.done) {
+ return this.EOF;
+ }
+ if (!this._input) this.done = true;
+
+ var token,
+ match,
+ col,
+ lines;
+ if (!this._more) {
+ this.yytext = '';
+ this.match = '';
+ }
+ var rules = this._currentRules();
+ for (var i=0;i < rules.length; i++) {
+ match = this._input.match(this.rules[rules[i]]);
+ if (match) {
+ lines = match[0].match(/\n.*/g);
+ if (lines) this.yylineno += lines.length;
+ this.yylloc = {first_line: this.yylloc.last_line,
+ last_line: this.yylineno+1,
+ first_column: this.yylloc.last_column,
+ last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
+ this.yytext += match[0];
+ this.match += match[0];
+ this.matches = match;
+ this.yyleng = this.yytext.length;
+ this._more = false;
+ this._input = this._input.slice(match[0].length);
+ this.matched += match[0];
+ token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
+ if (token) return token;
+ else return;
+ }
+ }
+ if (this._input === "") {
+ return this.EOF;
+ } else {
+ this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
+ {text: "", token: null, line: this.yylineno});
+ }
+ },
+lex:function lex() {
+ var r = this.next();
+ if (typeof r !== 'undefined') {
+ return r;
+ } else {
+ return this.lex();
+ }
+ },
+begin:function begin(condition) {
+ this.conditionStack.push(condition);
+ },
+popState:function popState() {
+ return this.conditionStack.pop();
+ },
+_currentRules:function _currentRules() {
+ return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
+ },
+topState:function () {
+ return this.conditionStack[this.conditionStack.length-2];
+ },
+pushState:function begin(condition) {
+ this.begin(condition);
+ }});
+lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
+
+var YYSTATE=YY_START
+switch($avoiding_name_collisions) {
+case 0:
+ if(yy_.yytext.slice(-1) !== "\\") this.begin("mu");
+ if(yy_.yytext.slice(-1) === "\\") yy_.yytext = yy_.yytext.substr(0,yy_.yyleng-1), this.begin("emu");
+ if(yy_.yytext) return 14;
+
+break;
+case 1: return 14;
+break;
+case 2: this.popState(); return 14;
+break;
+case 3: return 24;
+break;
+case 4: return 16;
+break;
+case 5: return 20;
+break;
+case 6: return 19;
+break;
+case 7: return 19;
+break;
+case 8: return 23;
+break;
+case 9: return 23;
+break;
+case 10: yy_.yytext = yy_.yytext.substr(3,yy_.yyleng-5); this.popState(); return 15;
+break;
+case 11: return 22;
+break;
+case 12: return 34;
+break;
+case 13: return 33;
+break;
+case 14: return 33;
+break;
+case 15: return 36;
+break;
+case 16: /*ignore whitespace*/
+break;
+case 17: this.popState(); return 18;
+break;
+case 18: this.popState(); return 18;
+break;
+case 19: yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2).replace(/\\"/g,'"'); return 28;
+break;
+case 20: return 30;
+break;
+case 21: return 30;
+break;
+case 22: return 29;
+break;
+case 23: return 33;
+break;
+case 24: yy_.yytext = yy_.yytext.substr(1, yy_.yyleng-2); return 33;
+break;
+case 25: return 'INVALID';
+break;
+case 26: return 5;
+break;
+}
+};
+lexer.rules = [/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^[^\x00]{2,}?(?=(\{\{))/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/];
+lexer.conditions = {"mu":{"rules":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"INITIAL":{"rules":[0,1,26],"inclusive":true}};return lexer;})()
+parser.lexer = lexer;
+return parser;
+})();
+if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
+exports.parser = handlebars;
+exports.parse = function () { return handlebars.parse.apply(handlebars, arguments); }
+exports.main = function commonjsMain(args) {
+ if (!args[1])
+ throw new Error('Usage: '+args[0]+' FILE');
+ if (typeof process !== 'undefined') {
+ var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
+ } else {
+ var cwd = require("file").path(require("file").cwd());
+ var source = cwd.join(args[1]).read({charset: "utf-8"});
+ }
+ return exports.parser.parse(source);
+}
+if (typeof module !== 'undefined' && require.main === module) {
+ exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
+}
+};
+;
+// lib/handlebars/compiler/base.js
+Handlebars.Parser = handlebars;
+
+Handlebars.parse = function(string) {
+ Handlebars.Parser.yy = Handlebars.AST;
+ return Handlebars.Parser.parse(string);
+};
+
+Handlebars.print = function(ast) {
+ return new Handlebars.PrintVisitor().accept(ast);
+};
+
+Handlebars.logger = {
+ DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3,
+
+ // override in the host environment
+ log: function(level, str) {}
+};
+
+Handlebars.log = function(level, str) { Handlebars.logger.log(level, str); };
+;
+// lib/handlebars/compiler/ast.js
+(function() {
+
+ Handlebars.AST = {};
+
+ Handlebars.AST.ProgramNode = function(statements, inverse) {
+ this.type = "program";
+ this.statements = statements;
+ if(inverse) { this.inverse = new Handlebars.AST.ProgramNode(inverse); }
+ };
+
+ Handlebars.AST.MustacheNode = function(params, hash, unescaped) {
+ this.type = "mustache";
+ this.id = params[0];
+ this.params = params.slice(1);
+ this.hash = hash;
+ this.escaped = !unescaped;
+ };
+
+ Handlebars.AST.PartialNode = function(id, context) {
+ this.type = "partial";
+
+ // TODO: disallow complex IDs
+
+ this.id = id;
+ this.context = context;
+ };
+
+ var verifyMatch = function(open, close) {
+ if(open.original !== close.original) {
+ throw new Handlebars.Exception(open.original + " doesn't match " + close.original);
+ }
+ };
+
+ Handlebars.AST.BlockNode = function(mustache, program, close) {
+ verifyMatch(mustache.id, close);
+ this.type = "block";
+ this.mustache = mustache;
+ this.program = program;
+ };
+
+ Handlebars.AST.InverseNode = function(mustache, program, close) {
+ verifyMatch(mustache.id, close);
+ this.type = "inverse";
+ this.mustache = mustache;
+ this.program = program;
+ };
+
+ Handlebars.AST.ContentNode = function(string) {
+ this.type = "content";
+ this.string = string;
+ };
+
+ Handlebars.AST.HashNode = function(pairs) {
+ this.type = "hash";
+ this.pairs = pairs;
+ };
+
+ Handlebars.AST.IdNode = function(parts) {
+ this.type = "ID";
+ this.original = parts.join(".");
+
+ var dig = [], depth = 0;
+
+ for(var i=0,l=parts.length; i<l; i++) {
+ var part = parts[i];
+
+ if(part === "..") { depth++; }
+ else if(part === "." || part === "this") { this.isScoped = true; }
+ else { dig.push(part); }
+ }
+
+ this.parts = dig;
+ this.string = dig.join('.');
+ this.depth = depth;
+ this.isSimple = (dig.length === 1) && (depth === 0);
+ };
+
+ Handlebars.AST.StringNode = function(string) {
+ this.type = "STRING";
+ this.string = string;
+ };
+
+ Handlebars.AST.IntegerNode = function(integer) {
+ this.type = "INTEGER";
+ this.integer = integer;
+ };
+
+ Handlebars.AST.BooleanNode = function(bool) {
+ this.type = "BOOLEAN";
+ this.bool = bool;
+ };
+
+ Handlebars.AST.CommentNode = function(comment) {
+ this.type = "comment";
+ this.comment = comment;
+ };
+
+})();;
+// lib/handlebars/utils.js
+Handlebars.Exception = function(message) {
+ var tmp = Error.prototype.constructor.apply(this, arguments);
+
+ for (var p in tmp) {
+ if (tmp.hasOwnProperty(p)) { this[p] = tmp[p]; }
+ }
+
+ this.message = tmp.message;
+};
+Handlebars.Exception.prototype = new Error;
+
+// Build out our basic SafeString type
+Handlebars.SafeString = function(string) {
+ this.string = string;
+};
+Handlebars.SafeString.prototype.toString = function() {
+ return this.string.toString();
+};
+
+(function() {
+ var escape = {
+ "<": "&lt;",
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&#x27;",
+ "`": "&#x60;"
+ };
+
+ var badChars = /&(?!\w+;)|[<>"'`]/g;
+ var possible = /[&<>"'`]/;
+
+ var escapeChar = function(chr) {
+ return escape[chr] || "&amp;";
+ };
+
+ Handlebars.Utils = {
+ escapeExpression: function(string) {
+ // don't escape SafeStrings, since they're already safe
+ if (string instanceof Handlebars.SafeString) {
+ return string.toString();
+ } else if (string == null || string === false) {
+ return "";
+ }
+
+ if(!possible.test(string)) { return string; }
+ return string.replace(badChars, escapeChar);
+ },
+
+ isEmpty: function(value) {
+ if (typeof value === "undefined") {
+ return true;
+ } else if (value === null) {
+ return true;
+ } else if (value === false) {
+ return true;
+ } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ };
+})();;
+// lib/handlebars/compiler/compiler.js
+Handlebars.Compiler = function() {};
+Handlebars.JavaScriptCompiler = function() {};
+
+(function(Compiler, JavaScriptCompiler) {
+ Compiler.OPCODE_MAP = {
+ appendContent: 1,
+ getContext: 2,
+ lookupWithHelpers: 3,
+ lookup: 4,
+ append: 5,
+ invokeMustache: 6,
+ appendEscaped: 7,
+ pushString: 8,
+ truthyOrFallback: 9,
+ functionOrFallback: 10,
+ invokeProgram: 11,
+ invokePartial: 12,
+ push: 13,
+ assignToHash: 15,
+ pushStringParam: 16
+ };
+
+ Compiler.MULTI_PARAM_OPCODES = {
+ appendContent: 1,
+ getContext: 1,
+ lookupWithHelpers: 2,
+ lookup: 1,
+ invokeMustache: 3,
+ pushString: 1,
+ truthyOrFallback: 1,
+ functionOrFallback: 1,
+ invokeProgram: 3,
+ invokePartial: 1,
+ push: 1,
+ assignToHash: 1,
+ pushStringParam: 1
+ };
+
+ Compiler.DISASSEMBLE_MAP = {};
+
+ for(var prop in Compiler.OPCODE_MAP) {
+ var value = Compiler.OPCODE_MAP[prop];
+ Compiler.DISASSEMBLE_MAP[value] = prop;
+ }
+
+ Compiler.multiParamSize = function(code) {
+ return Compiler.MULTI_PARAM_OPCODES[Compiler.DISASSEMBLE_MAP[code]];
+ };
+
+ Compiler.prototype = {
+ compiler: Compiler,
+
+ disassemble: function() {
+ var opcodes = this.opcodes, opcode, nextCode;
+ var out = [], str, name, value;
+
+ for(var i=0, l=opcodes.length; i<l; i++) {
+ opcode = opcodes[i];
+
+ if(opcode === 'DECLARE') {
+ name = opcodes[++i];
+ value = opcodes[++i];
+ out.push("DECLARE " + name + " = " + value);
+ } else {
+ str = Compiler.DISASSEMBLE_MAP[opcode];
+
+ var extraParams = Compiler.multiParamSize(opcode);
+ var codes = [];
+
+ for(var j=0; j<extraParams; j++) {
+ nextCode = opcodes[++i];
+
+ if(typeof nextCode === "string") {
+ nextCode = "\"" + nextCode.replace("\n", "\\n") + "\"";
+ }
+
+ codes.push(nextCode);
+ }
+
+ str = str + " " + codes.join(" ");
+
+ out.push(str);
+ }
+ }
+
+ return out.join("\n");
+ },
+
+ guid: 0,
+
+ compile: function(program, options) {
+ this.children = [];
+ this.depths = {list: []};
+ this.options = options;
+
+ // These changes will propagate to the other compiler components
+ var knownHelpers = this.options.knownHelpers;
+ this.options.knownHelpers = {
+ 'helperMissing': true,
+ 'blockHelperMissing': true,
+ 'each': true,
+ 'if': true,
+ 'unless': true,
+ 'with': true,
+ 'log': true
+ };
+ if (knownHelpers) {
+ for (var name in knownHelpers) {
+ this.options.knownHelpers[name] = knownHelpers[name];
+ }
+ }
+
+ return this.program(program);
+ },
+
+ accept: function(node) {
+ return this[node.type](node);
+ },
+
+ program: function(program) {
+ var statements = program.statements, statement;
+ this.opcodes = [];
+
+ for(var i=0, l=statements.length; i<l; i++) {
+ statement = statements[i];
+ this[statement.type](statement);
+ }
+ this.isSimple = l === 1;
+
+ this.depths.list = this.depths.list.sort(function(a, b) {
+ return a - b;
+ });
+
+ return this;
+ },
+
+ compileProgram: function(program) {
+ var result = new this.compiler().compile(program, this.options);
+ var guid = this.guid++;
+
+ this.usePartial = this.usePartial || result.usePartial;
+
+ this.children[guid] = result;
+
+ for(var i=0, l=result.depths.list.length; i<l; i++) {
+ depth = result.depths.list[i];
+
+ if(depth < 2) { continue; }
+ else { this.addDepth(depth - 1); }
+ }
+
+ return guid;
+ },
+
+ block: function(block) {
+ var mustache = block.mustache;
+ var depth, child, inverse, inverseGuid;
+
+ var params = this.setupStackForMustache(mustache);
+
+ var programGuid = this.compileProgram(block.program);
+
+ if(block.program.inverse) {
+ inverseGuid = this.compileProgram(block.program.inverse);
+ this.declare('inverse', inverseGuid);
+ }
+
+ this.opcode('invokeProgram', programGuid, params.length, !!mustache.hash);
+ this.declare('inverse', null);
+ this.opcode('append');
+ },
+
+ inverse: function(block) {
+ var params = this.setupStackForMustache(block.mustache);
+
+ var programGuid = this.compileProgram(block.program);
+
+ this.declare('inverse', programGuid);
+
+ this.opcode('invokeProgram', null, params.length, !!block.mustache.hash);
+ this.declare('inverse', null);
+ this.opcode('append');
+ },
+
+ hash: function(hash) {
+ var pairs = hash.pairs, pair, val;
+
+ this.opcode('push', '{}');
+
+ for(var i=0, l=pairs.length; i<l; i++) {
+ pair = pairs[i];
+ val = pair[1];
+
+ this.accept(val);
+ this.opcode('assignToHash', pair[0]);
+ }
+ },
+
+ partial: function(partial) {
+ var id = partial.id;
+ this.usePartial = true;
+
+ if(partial.context) {
+ this.ID(partial.context);
+ } else {
+ this.opcode('push', 'depth0');
+ }
+
+ this.opcode('invokePartial', id.original);
+ this.opcode('append');
+ },
+
+ content: function(content) {
+ this.opcode('appendContent', content.string);
+ },
+
+ mustache: function(mustache) {
+ var params = this.setupStackForMustache(mustache);
+
+ this.opcode('invokeMustache', params.length, mustache.id.original, !!mustache.hash);
+
+ if(mustache.escaped && !this.options.noEscape) {
+ this.opcode('appendEscaped');
+ } else {
+ this.opcode('append');
+ }
+ },
+
+ ID: function(id) {
+ this.addDepth(id.depth);
+
+ this.opcode('getContext', id.depth);
+
+ this.opcode('lookupWithHelpers', id.parts[0] || null, id.isScoped || false);
+
+ for(var i=1, l=id.parts.length; i<l; i++) {
+ this.opcode('lookup', id.parts[i]);
+ }
+ },
+
+ STRING: function(string) {
+ this.opcode('pushString', string.string);
+ },
+
+ INTEGER: function(integer) {
+ this.opcode('push', integer.integer);
+ },
+
+ BOOLEAN: function(bool) {
+ this.opcode('push', bool.bool);
+ },
+
+ comment: function() {},
+
+ // HELPERS
+ pushParams: function(params) {
+ var i = params.length, param;
+
+ while(i--) {
+ param = params[i];
+
+ if(this.options.stringParams) {
+ if(param.depth) {
+ this.addDepth(param.depth);
+ }
+
+ this.opcode('getContext', param.depth || 0);
+ this.opcode('pushStringParam', param.string);
+ } else {
+ this[param.type](param);
+ }
+ }
+ },
+
+ opcode: function(name, val1, val2, val3) {
+ this.opcodes.push(Compiler.OPCODE_MAP[name]);
+ if(val1 !== undefined) { this.opcodes.push(val1); }
+ if(val2 !== undefined) { this.opcodes.push(val2); }
+ if(val3 !== undefined) { this.opcodes.push(val3); }
+ },
+
+ declare: function(name, value) {
+ this.opcodes.push('DECLARE');
+ this.opcodes.push(name);
+ this.opcodes.push(value);
+ },
+
+ addDepth: function(depth) {
+ if(depth === 0) { return; }
+
+ if(!this.depths[depth]) {
+ this.depths[depth] = true;
+ this.depths.list.push(depth);
+ }
+ },
+
+ setupStackForMustache: function(mustache) {
+ var params = mustache.params;
+
+ this.pushParams(params);
+
+ if(mustache.hash) {
+ this.hash(mustache.hash);
+ }
+
+ this.ID(mustache.id);
+
+ return params;
+ }
+ };
+
+ JavaScriptCompiler.prototype = {
+ // PUBLIC API: You can override these methods in a subclass to provide
+ // alternative compiled forms for name lookup and buffering semantics
+ nameLookup: function(parent, name, type) {
+ if (/^[0-9]+$/.test(name)) {
+ return parent + "[" + name + "]";
+ } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
+ return parent + "." + name;
+ }
+ else {
+ return parent + "['" + name + "']";
+ }
+ },
+
+ appendToBuffer: function(string) {
+ if (this.environment.isSimple) {
+ return "return " + string + ";";
+ } else {
+ return "buffer += " + string + ";";
+ }
+ },
+
+ initializeBuffer: function() {
+ return this.quotedString("");
+ },
+
+ namespace: "Handlebars",
+ // END PUBLIC API
+
+ compile: function(environment, options, context, asObject) {
+ this.environment = environment;
+ this.options = options || {};
+
+ this.name = this.environment.name;
+ this.isChild = !!context;
+ this.context = context || {
+ programs: [],
+ aliases: { self: 'this' },
+ registers: {list: []}
+ };
+
+ this.preamble();
+
+ this.stackSlot = 0;
+ this.stackVars = [];
+
+ this.compileChildren(environment, options);
+
+ var opcodes = environment.opcodes, opcode;
+
+ this.i = 0;
+
+ for(l=opcodes.length; this.i<l; this.i++) {
+ opcode = this.nextOpcode(0);
+
+ if(opcode[0] === 'DECLARE') {
+ this.i = this.i + 2;
+ this[opcode[1]] = opcode[2];
+ } else {
+ this.i = this.i + opcode[1].length;
+ this[opcode[0]].apply(this, opcode[1]);
+ }
+ }
+
+ return this.createFunctionContext(asObject);
+ },
+
+ nextOpcode: function(n) {
+ var opcodes = this.environment.opcodes, opcode = opcodes[this.i + n], name, val;
+ var extraParams, codes;
+
+ if(opcode === 'DECLARE') {
+ name = opcodes[this.i + 1];
+ val = opcodes[this.i + 2];
+ return ['DECLARE', name, val];
+ } else {
+ name = Compiler.DISASSEMBLE_MAP[opcode];
+
+ extraParams = Compiler.multiParamSize(opcode);
+ codes = [];
+
+ for(var j=0; j<extraParams; j++) {
+ codes.push(opcodes[this.i + j + 1 + n]);
+ }
+
+ return [name, codes];
+ }
+ },
+
+ eat: function(opcode) {
+ this.i = this.i + opcode.length;
+ },
+
+ preamble: function() {
+ var out = [];
+
+ // this register will disambiguate helper lookup from finding a function in
+ // a context. This is necessary for mustache compatibility, which requires
+ // that context functions in blocks are evaluated by blockHelperMissing, and
+ // then proceed as if the resulting value was provided to blockHelperMissing.
+ this.useRegister('foundHelper');
+
+ if (!this.isChild) {
+ var namespace = this.namespace;
+ var copies = "helpers = helpers || " + namespace + ".helpers;";
+ if(this.environment.usePartial) { copies = copies + " partials = partials || " + namespace + ".partials;"; }
+ out.push(copies);
+ } else {
+ out.push('');
+ }
+
+ if (!this.environment.isSimple) {
+ out.push(", buffer = " + this.initializeBuffer());
+ } else {
+ out.push("");
+ }
+
+ // track the last context pushed into place to allow skipping the
+ // getContext opcode when it would be a noop
+ this.lastContext = 0;
+ this.source = out;
+ },
+
+ createFunctionContext: function(asObject) {
+ var locals = this.stackVars;
+ if (!this.isChild) {
+ locals = locals.concat(this.context.registers.list);
+ }
+
+ if(locals.length > 0) {
+ this.source[1] = this.source[1] + ", " + locals.join(", ");
+ }
+
+ // Generate minimizer alias mappings
+ if (!this.isChild) {
+ var aliases = []
+ for (var alias in this.context.aliases) {
+ this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias];
+ }
+ }
+
+ if (this.source[1]) {
+ this.source[1] = "var " + this.source[1].substring(2) + ";";
+ }
+
+ // Merge children
+ if (!this.isChild) {
+ this.source[1] += '\n' + this.context.programs.join('\n') + '\n';
+ }
+
+ if (!this.environment.isSimple) {
+ this.source.push("return buffer;");
+ }
+
+ var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"];
+
+ for(var i=0, l=this.environment.depths.list.length; i<l; i++) {
+ params.push("depth" + this.environment.depths.list[i]);
+ }
+
+ if (asObject) {
+ params.push(this.source.join("\n "));
+
+ return Function.apply(this, params);
+ } else {
+ var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + this.source.join("\n ") + '}';
+ Handlebars.log(Handlebars.logger.DEBUG, functionSource + "\n\n");
+ return functionSource;
+ }
+ },
+
+ appendContent: function(content) {
+ this.source.push(this.appendToBuffer(this.quotedString(content)));
+ },
+
+ append: function() {
+ var local = this.popStack();
+ this.source.push("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }");
+ if (this.environment.isSimple) {
+ this.source.push("else { " + this.appendToBuffer("''") + " }");
+ }
+ },
+
+ appendEscaped: function() {
+ var opcode = this.nextOpcode(1), extra = "";
+ this.context.aliases.escapeExpression = 'this.escapeExpression';
+
+ if(opcode[0] === 'appendContent') {
+ extra = " + " + this.quotedString(opcode[1][0]);
+ this.eat(opcode);
+ }
+
+ this.source.push(this.appendToBuffer("escapeExpression(" + this.popStack() + ")" + extra));
+ },
+
+ getContext: function(depth) {
+ if(this.lastContext !== depth) {
+ this.lastContext = depth;
+ }
+ },
+
+ lookupWithHelpers: function(name, isScoped) {
+ if(name) {
+ var topStack = this.nextStack();
+
+ this.usingKnownHelper = false;
+
+ var toPush;
+ if (!isScoped && this.options.knownHelpers[name]) {
+ toPush = topStack + " = " + this.nameLookup('helpers', name, 'helper');
+ this.usingKnownHelper = true;
+ } else if (isScoped || this.options.knownHelpersOnly) {
+ toPush = topStack + " = " + this.nameLookup('depth' + this.lastContext, name, 'context');
+ } else {
+ this.register('foundHelper', this.nameLookup('helpers', name, 'helper'));
+ toPush = topStack + " = foundHelper || " + this.nameLookup('depth' + this.lastContext, name, 'context');
+ }
+
+ toPush += ';';
+ this.source.push(toPush);
+ } else {
+ this.pushStack('depth' + this.lastContext);
+ }
+ },
+
+ lookup: function(name) {
+ var topStack = this.topStack();
+ this.source.push(topStack + " = (" + topStack + " === null || " + topStack + " === undefined || " + topStack + " === false ? " +
+ topStack + " : " + this.nameLookup(topStack, name, 'context') + ");");
+ },
+
+ pushStringParam: function(string) {
+ this.pushStack('depth' + this.lastContext);
+ this.pushString(string);
+ },
+
+ pushString: function(string) {
+ this.pushStack(this.quotedString(string));
+ },
+
+ push: function(name) {
+ this.pushStack(name);
+ },
+
+ invokeMustache: function(paramSize, original, hasHash) {
+ this.populateParams(paramSize, this.quotedString(original), "{}", null, hasHash, function(nextStack, helperMissingString, id) {
+ if (!this.usingKnownHelper) {
+ this.context.aliases.helperMissing = 'helpers.helperMissing';
+ this.context.aliases.undef = 'void 0';
+ this.source.push("else if(" + id + "=== undef) { " + nextStack + " = helperMissing.call(" + helperMissingString + "); }");
+ if (nextStack !== id) {
+ this.source.push("else { " + nextStack + " = " + id + "; }");
+ }
+ }
+ });
+ },
+
+ invokeProgram: function(guid, paramSize, hasHash) {
+ var inverse = this.programExpression(this.inverse);
+ var mainProgram = this.programExpression(guid);
+
+ this.populateParams(paramSize, null, mainProgram, inverse, hasHash, function(nextStack, helperMissingString, id) {
+ if (!this.usingKnownHelper) {
+ this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
+ this.source.push("else { " + nextStack + " = blockHelperMissing.call(" + helperMissingString + "); }");
+ }
+ });
+ },
+
+ populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) {
+ var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data;
+ var id = this.popStack(), nextStack;
+ var params = [], param, stringParam, stringOptions;
+
+ if (needsRegister) {
+ this.register('tmp1', program);
+ stringOptions = 'tmp1';
+ } else {
+ stringOptions = '{ hash: {} }';
+ }
+
+ if (needsRegister) {
+ var hash = (hasHash ? this.popStack() : '{}');
+ this.source.push('tmp1.hash = ' + hash + ';');
+ }
+
+ if(this.options.stringParams) {
+ this.source.push('tmp1.contexts = [];');
+ }
+
+ for(var i=0; i<paramSize; i++) {
+ param = this.popStack();
+ params.push(param);
+
+ if(this.options.stringParams) {
+ this.source.push('tmp1.contexts.push(' + this.popStack() + ');');
+ }
+ }
+
+ if(inverse) {
+ this.source.push('tmp1.fn = tmp1;');
+ this.source.push('tmp1.inverse = ' + inverse + ';');
+ }
+
+ if(this.options.data) {
+ this.source.push('tmp1.data = data;');
+ }
+
+ params.push(stringOptions);
+
+ this.populateCall(params, id, helperId || id, fn, program !== '{}');
+ },
+
+ populateCall: function(params, id, helperId, fn, program) {
+ var paramString = ["depth0"].concat(params).join(", ");
+ var helperMissingString = ["depth0"].concat(helperId).concat(params).join(", ");
+
+ var nextStack = this.nextStack();
+
+ if (this.usingKnownHelper) {
+ this.source.push(nextStack + " = " + id + ".call(" + paramString + ");");
+ } else {
+ this.context.aliases.functionType = '"function"';
+ var condition = program ? "foundHelper && " : ""
+ this.source.push("if(" + condition + "typeof " + id + " === functionType) { " + nextStack + " = " + id + ".call(" + paramString + "); }");
+ }
+ fn.call(this, nextStack, helperMissingString, id);
+ this.usingKnownHelper = false;
+ },
+
+ invokePartial: function(context) {
+ params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"];
+
+ if (this.options.data) {
+ params.push("data");
+ }
+
+ this.pushStack("self.invokePartial(" + params.join(", ") + ");");
+ },
+
+ assignToHash: function(key) {
+ var value = this.popStack();
+ var hash = this.topStack();
+
+ this.source.push(hash + "['" + key + "'] = " + value + ";");
+ },
+
+ // HELPERS
+
+ compiler: JavaScriptCompiler,
+
+ compileChildren: function(environment, options) {
+ var children = environment.children, child, compiler;
+
+ for(var i=0, l=children.length; i<l; i++) {
+ child = children[i];
+ compiler = new this.compiler();
+
+ this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
+ var index = this.context.programs.length;
+ child.index = index;
+ child.name = 'program' + index;
+ this.context.programs[index] = compiler.compile(child, options, this.context);
+ }
+ },
+
+ programExpression: function(guid) {
+ if(guid == null) { return "self.noop"; }
+
+ var child = this.environment.children[guid],
+ depths = child.depths.list;
+ var programParams = [child.index, child.name, "data"];
+
+ for(var i=0, l = depths.length; i<l; i++) {
+ depth = depths[i];
+
+ if(depth === 1) { programParams.push("depth0"); }
+ else { programParams.push("depth" + (depth - 1)); }
+ }
+
+ if(depths.length === 0) {
+ return "self.program(" + programParams.join(", ") + ")";
+ } else {
+ programParams.shift();
+ return "self.programWithDepth(" + programParams.join(", ") + ")";
+ }
+ },
+
+ register: function(name, val) {
+ this.useRegister(name);
+ this.source.push(name + " = " + val + ";");
+ },
+
+ useRegister: function(name) {
+ if(!this.context.registers[name]) {
+ this.context.registers[name] = true;
+ this.context.registers.list.push(name);
+ }
+ },
+
+ pushStack: function(item) {
+ this.source.push(this.nextStack() + " = " + item + ";");
+ return "stack" + this.stackSlot;
+ },
+
+ nextStack: function() {
+ this.stackSlot++;
+ if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
+ return "stack" + this.stackSlot;
+ },
+
+ popStack: function() {
+ return "stack" + this.stackSlot--;
+ },
+
+ topStack: function() {
+ return "stack" + this.stackSlot;
+ },
+
+ quotedString: function(str) {
+ return '"' + str
+ .replace(/\\/g, '\\\\')
+ .replace(/"/g, '\\"')
+ .replace(/\n/g, '\\n')
+ .replace(/\r/g, '\\r') + '"';
+ }
+ };
+
+ var reservedWords = (
+ "break else new var" +
+ " case finally return void" +
+ " catch for switch while" +
+ " continue function this with" +
+ " default if throw" +
+ " delete in try" +
+ " do instanceof typeof" +
+ " abstract enum int short" +
+ " boolean export interface static" +
+ " byte extends long super" +
+ " char final native synchronized" +
+ " class float package throws" +
+ " const goto private transient" +
+ " debugger implements protected volatile" +
+ " double import public let yield"
+ ).split(" ");
+
+ var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
+
+ for(var i=0, l=reservedWords.length; i<l; i++) {
+ compilerWords[reservedWords[i]] = true;
+ }
+
+ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
+ if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(name)) {
+ return true;
+ }
+ return false;
+ }
+
+})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
+
+Handlebars.precompile = function(string, options) {
+ options = options || {};
+
+ var ast = Handlebars.parse(string);
+ var environment = new Handlebars.Compiler().compile(ast, options);
+ return new Handlebars.JavaScriptCompiler().compile(environment, options);
+};
+
+Handlebars.compile = function(string, options) {
+ options = options || {};
+
+ var compiled;
+ function compile() {
+ var ast = Handlebars.parse(string);
+ var environment = new Handlebars.Compiler().compile(ast, options);
+ var templateSpec = new Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
+ return Handlebars.template(templateSpec);
+ }
+
+ // Template is only compiled on first use and cached after that point.
+ return function(context, options) {
+ if (!compiled) {
+ compiled = compile();
+ }
+ return compiled.call(this, context, options);
+ };
+};
+;
+// lib/handlebars/runtime.js
+Handlebars.VM = {
+ template: function(templateSpec) {
+ // Just add water
+ var container = {
+ escapeExpression: Handlebars.Utils.escapeExpression,
+ invokePartial: Handlebars.VM.invokePartial,
+ programs: [],
+ program: function(i, fn, data) {
+ var programWrapper = this.programs[i];
+ if(data) {
+ return Handlebars.VM.program(fn, data);
+ } else if(programWrapper) {
+ return programWrapper;
+ } else {
+ programWrapper = this.programs[i] = Handlebars.VM.program(fn);
+ return programWrapper;
+ }
+ },
+ programWithDepth: Handlebars.VM.programWithDepth,
+ noop: Handlebars.VM.noop
+ };
+
+ return function(context, options) {
+ options = options || {};
+ return templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data);
+ };
+ },
+
+ programWithDepth: function(fn, data, $depth) {
+ var args = Array.prototype.slice.call(arguments, 2);
+
+ return function(context, options) {
+ options = options || {};
+
+ return fn.apply(this, [context, options.data || data].concat(args));
+ };
+ },
+ program: function(fn, data) {
+ return function(context, options) {
+ options = options || {};
+
+ return fn(context, options.data || data);
+ };
+ },
+ noop: function() { return ""; },
+ invokePartial: function(partial, name, context, helpers, partials, data) {
+ options = { helpers: helpers, partials: partials, data: data };
+
+ if(partial === undefined) {
+ throw new Handlebars.Exception("The partial " + name + " could not be found");
+ } else if(partial instanceof Function) {
+ return partial(context, options);
+ } else if (!Handlebars.compile) {
+ throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
+ } else {
+ partials[name] = Handlebars.compile(partial);
+ return partials[name](context, options);
+ }
+ }
+};
+
+Handlebars.template = Handlebars.VM.template;
+;
diff --git a/src/components/HMI/lib/iscroll-lite.js b/src/components/HMI/lib/iscroll-lite.js
new file mode 100644
index 0000000000..3a6cab7d2c
--- /dev/null
+++ b/src/components/HMI/lib/iscroll-lite.js
@@ -0,0 +1,594 @@
+/*!
+ * iScroll Lite base on iScroll v4.1.6 ~ Copyright (c) 2011 Matteo Spinelli, http://cubiq.org
+ * Released under MIT license, http://cubiq.org/license
+ */
+
+(function(){
+var m = Math,
+ mround = function (r) { return r >> 0; },
+ vendor = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
+ (/firefox/i).test(navigator.userAgent) ? 'Moz' :
+ 'opera' in window ? 'O' : '',
+
+ // Browser capabilities
+ isAndroid = (/android/gi).test(navigator.appVersion),
+ isIDevice = (/iphone|ipad/gi).test(navigator.appVersion),
+ isPlaybook = (/playbook/gi).test(navigator.appVersion),
+ isTouchPad = (/hp-tablet/gi).test(navigator.appVersion),
+
+ has3d = 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix(),
+ hasTouch = 'ontouchstart' in window && !isTouchPad,
+ hasTransform = vendor + 'Transform' in document.documentElement.style,
+ hasTransitionEnd = isIDevice || isPlaybook,
+
+ nextFrame = (function() {
+ return window.requestAnimationFrame
+ || window.webkitRequestAnimationFrame
+ || window.mozRequestAnimationFrame
+ || window.oRequestAnimationFrame
+ || window.msRequestAnimationFrame
+ || function(callback) { return setTimeout(callback, 17); }
+ })(),
+ cancelFrame = (function () {
+ return window.cancelRequestAnimationFrame
+ || window.webkitCancelAnimationFrame
+ || window.webkitCancelRequestAnimationFrame
+ || window.mozCancelRequestAnimationFrame
+ || window.oCancelRequestAnimationFrame
+ || window.msCancelRequestAnimationFrame
+ || clearTimeout
+ })(),
+
+ // Events
+ RESIZE_EV = 'onorientationchange' in window ? 'orientationchange' : 'resize',
+ START_EV = hasTouch ? 'touchstart' : 'mousedown',
+ MOVE_EV = hasTouch ? 'touchmove' : 'mousemove',
+ END_EV = hasTouch ? 'touchend' : 'mouseup',
+ CANCEL_EV = hasTouch ? 'touchcancel' : 'mouseup',
+
+ // Helpers
+ trnOpen = 'translate' + (has3d ? '3d(' : '('),
+ trnClose = has3d ? ',0)' : ')',
+
+ // Constructor
+ iScroll = function (el, options) {
+ var that = this,
+ doc = document,
+ i;
+
+ that.wrapper = typeof el == 'object' ? el : doc.getElementById(el);
+ that.wrapper.style.overflow = 'hidden';
+ that.scroller = that.wrapper.children[0];
+
+ // Default options
+ that.options = {
+ hScroll: true,
+ vScroll: true,
+ x: 0,
+ y: 0,
+ bounce: true,
+ bounceLock: false,
+ momentum: true,
+ lockDirection: true,
+ useTransform: true,
+ useTransition: false,
+
+ // Events
+ onRefresh: null,
+ onBeforeScrollStart: function (e) { e.preventDefault(); },
+ onScrollStart: null,
+ onBeforeScrollMove: null,
+ onScrollMove: null,
+ onBeforeScrollEnd: null,
+ onScrollEnd: null,
+ onTouchEnd: null,
+ onDestroy: null
+ };
+
+ // User defined options
+ for (i in options) that.options[i] = options[i];
+
+ // Set starting position
+ that.x = that.options.x;
+ that.y = that.options.y;
+
+ // Normalize options
+ that.options.useTransform = hasTransform ? that.options.useTransform : false;
+ that.options.hScrollbar = that.options.hScroll && that.options.hScrollbar;
+ that.options.vScrollbar = that.options.vScroll && that.options.vScrollbar;
+ that.options.useTransition = hasTransitionEnd && that.options.useTransition;
+
+ // Set some default styles
+ that.scroller.style[vendor + 'TransitionProperty'] = that.options.useTransform ? '-' + vendor.toLowerCase() + '-transform' : 'top left';
+ that.scroller.style[vendor + 'TransitionDuration'] = '0';
+ that.scroller.style[vendor + 'TransformOrigin'] = '0 0';
+ if (that.options.useTransition) that.scroller.style[vendor + 'TransitionTimingFunction'] = 'cubic-bezier(0.33,0.66,0.66,1)';
+
+ if (that.options.useTransform) that.scroller.style[vendor + 'Transform'] = trnOpen + that.x + 'px,' + that.y + 'px' + trnClose;
+ else that.scroller.style.cssText += ';position:absolute;top:' + that.y + 'px;left:' + that.x + 'px';
+
+ that.refresh();
+
+ that._bind(RESIZE_EV, window);
+ that._bind(START_EV);
+ if (!hasTouch) that._bind('mouseout', that.wrapper);
+ };
+
+// Prototype
+iScroll.prototype = {
+ enabled: true,
+ x: 0,
+ y: 0,
+ steps: [],
+ scale: 1,
+
+ handleEvent: function (e) {
+ var that = this;
+ switch(e.type) {
+ case START_EV:
+ if (!hasTouch && e.button !== 0) return;
+ that._start(e);
+ break;
+ case MOVE_EV: that._move(e); break;
+ case END_EV:
+ case CANCEL_EV: that._end(e); break;
+ case RESIZE_EV: that._resize(); break;
+ case 'mouseout': that._mouseout(e); break;
+ case 'webkitTransitionEnd': that._transitionEnd(e); break;
+ }
+ },
+
+ _resize: function () {
+ this.refresh();
+ },
+
+ _pos: function (x, y) {
+ x = this.hScroll ? x : 0;
+ y = this.vScroll ? y : 0;
+
+ if (this.options.useTransform) {
+ this.scroller.style[vendor + 'Transform'] = trnOpen + x + 'px,' + y + 'px' + trnClose + ' scale(' + this.scale + ')';
+ } else {
+ x = mround(x);
+ y = mround(y);
+ this.scroller.style.left = x + 'px';
+ this.scroller.style.top = y + 'px';
+ }
+
+ this.x = x;
+ this.y = y;
+ },
+
+ _start: function (e) {
+ var that = this,
+ point = hasTouch ? e.touches[0] : e,
+ matrix, x, y;
+
+ if (!that.enabled) return;
+
+ if (that.options.onBeforeScrollStart) that.options.onBeforeScrollStart.call(that, e);
+
+ if (that.options.useTransition) that._transitionTime(0);
+
+ that.moved = false;
+ that.animating = false;
+ that.zoomed = false;
+ that.distX = 0;
+ that.distY = 0;
+ that.absDistX = 0;
+ that.absDistY = 0;
+ that.dirX = 0;
+ that.dirY = 0;
+
+ if (that.options.momentum) {
+ if (that.options.useTransform) {
+ // Very lame general purpose alternative to CSSMatrix
+ matrix = getComputedStyle(that.scroller, null)[vendor + 'Transform'].replace(/[^0-9-.,]/g, '').split(',');
+ x = matrix[4] * 1;
+ y = matrix[5] * 1;
+ } else {
+ x = getComputedStyle(that.scroller, null).left.replace(/[^0-9-]/g, '') * 1;
+ y = getComputedStyle(that.scroller, null).top.replace(/[^0-9-]/g, '') * 1;
+ }
+
+ if (x != that.x || y != that.y) {
+ if (that.options.useTransition) that._unbind('webkitTransitionEnd');
+ else cancelFrame(that.aniTime);
+ that.steps = [];
+ that._pos(x, y);
+ }
+ }
+
+ that.startX = that.x;
+ that.startY = that.y;
+ that.pointX = point.pageX;
+ that.pointY = point.pageY;
+
+ that.startTime = e.timeStamp || Date.now();
+
+ if (that.options.onScrollStart) that.options.onScrollStart.call(that, e);
+
+ that._bind(MOVE_EV);
+ that._bind(END_EV);
+ that._bind(CANCEL_EV);
+ },
+
+ _move: function (e) {
+ var that = this,
+ point = hasTouch ? e.touches[0] : e,
+ deltaX = point.pageX - that.pointX,
+ deltaY = point.pageY - that.pointY,
+ newX = that.x + deltaX,
+ newY = that.y + deltaY,
+ timestamp = e.timeStamp || Date.now();
+
+ if (that.options.onBeforeScrollMove) that.options.onBeforeScrollMove.call(that, e);
+
+ that.pointX = point.pageX;
+ that.pointY = point.pageY;
+
+ // Slow down if outside of the boundaries
+ if (newX > 0 || newX < that.maxScrollX) {
+ newX = that.options.bounce ? that.x + (deltaX / 2) : newX >= 0 || that.maxScrollX >= 0 ? 0 : that.maxScrollX;
+ }
+ if (newY > 0 || newY < that.maxScrollY) {
+ newY = that.options.bounce ? that.y + (deltaY / 2) : newY >= 0 || that.maxScrollY >= 0 ? 0 : that.maxScrollY;
+ }
+
+ that.distX += deltaX;
+ that.distY += deltaY;
+ that.absDistX = m.abs(that.distX);
+ that.absDistY = m.abs(that.distY);
+
+ if (that.absDistX < 6 && that.absDistY < 6) {
+ return;
+ }
+
+ // Lock direction
+ if (that.options.lockDirection) {
+ if (that.absDistX > that.absDistY + 5) {
+ newY = that.y;
+ deltaY = 0;
+ } else if (that.absDistY > that.absDistX + 5) {
+ newX = that.x;
+ deltaX = 0;
+ }
+ }
+
+ that.moved = true;
+ that._pos(newX, newY);
+ that.dirX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
+ that.dirY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
+
+ if (timestamp - that.startTime > 300) {
+ that.startTime = timestamp;
+ that.startX = that.x;
+ that.startY = that.y;
+ }
+
+ if (that.options.onScrollMove) that.options.onScrollMove.call(that, e);
+ },
+
+ _end: function (e) {
+ if (hasTouch && e.touches.length != 0) return;
+
+ var that = this,
+ point = hasTouch ? e.changedTouches[0] : e,
+ target, ev,
+ momentumX = { dist:0, time:0 },
+ momentumY = { dist:0, time:0 },
+ duration = (e.timeStamp || Date.now()) - that.startTime,
+ newPosX = that.x,
+ newPosY = that.y,
+ newDuration;
+
+ that._unbind(MOVE_EV);
+ that._unbind(END_EV);
+ that._unbind(CANCEL_EV);
+
+ if (that.options.onBeforeScrollEnd) that.options.onBeforeScrollEnd.call(that, e);
+
+ if (!that.moved) {
+ if (hasTouch) {
+ // Find the last touched element
+ target = point.target;
+ while (target.nodeType != 1) target = target.parentNode;
+
+ if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA') {
+ ev = document.createEvent('MouseEvents');
+ ev.initMouseEvent('click', true, true, e.view, 1,
+ point.screenX, point.screenY, point.clientX, point.clientY,
+ e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
+ 0, null);
+ ev._fake = true;
+ target.dispatchEvent(ev);
+ }
+ }
+
+ that._resetPos(200);
+
+ if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
+ return;
+ }
+
+ if (duration < 300 && that.options.momentum) {
+ momentumX = newPosX ? that._momentum(newPosX - that.startX, duration, -that.x, that.scrollerW - that.wrapperW + that.x, that.options.bounce ? that.wrapperW : 0) : momentumX;
+ momentumY = newPosY ? that._momentum(newPosY - that.startY, duration, -that.y, (that.maxScrollY < 0 ? that.scrollerH - that.wrapperH + that.y : 0), that.options.bounce ? that.wrapperH : 0) : momentumY;
+
+ newPosX = that.x + momentumX.dist;
+ newPosY = that.y + momentumY.dist;
+
+ if ((that.x > 0 && newPosX > 0) || (that.x < that.maxScrollX && newPosX < that.maxScrollX)) momentumX = { dist:0, time:0 };
+ if ((that.y > 0 && newPosY > 0) || (that.y < that.maxScrollY && newPosY < that.maxScrollY)) momentumY = { dist:0, time:0 };
+ }
+
+ if (momentumX.dist || momentumY.dist) {
+ newDuration = m.max(m.max(momentumX.time, momentumY.time), 10);
+
+ that.scrollTo(mround(newPosX), mround(newPosY), newDuration);
+
+ if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
+ return;
+ }
+
+ that._resetPos(200);
+ if (that.options.onTouchEnd) that.options.onTouchEnd.call(that, e);
+ },
+
+ _resetPos: function (time) {
+ var that = this,
+ resetX = that.x >= 0 ? 0 : that.x < that.maxScrollX ? that.maxScrollX : that.x,
+ resetY = that.y >= 0 || that.maxScrollY > 0 ? 0 : that.y < that.maxScrollY ? that.maxScrollY : that.y;
+
+ if (resetX == that.x && resetY == that.y) {
+ if (that.moved) {
+ if (that.options.onScrollEnd) that.options.onScrollEnd.call(that); // Execute custom code on scroll end
+ that.moved = false;
+ }
+
+ return;
+ }
+
+ that.scrollTo(resetX, resetY, time || 0);
+ },
+
+ _mouseout: function (e) {
+ var t = e.relatedTarget;
+
+ if (!t) {
+ this._end(e);
+ return;
+ }
+
+ while (t = t.parentNode) if (t == this.wrapper) return;
+
+ this._end(e);
+ },
+
+ _transitionEnd: function (e) {
+ var that = this;
+
+ if (e.target != that.scroller) return;
+
+ that._unbind('webkitTransitionEnd');
+
+ that._startAni();
+ },
+
+ /**
+ *
+ * Utilities
+ *
+ */
+ _startAni: function () {
+ var that = this,
+ startX = that.x, startY = that.y,
+ startTime = Date.now(),
+ step, easeOut,
+ animate;
+
+ if (that.animating) return;
+
+ if (!that.steps.length) {
+ that._resetPos(400);
+ return;
+ }
+
+ step = that.steps.shift();
+
+ if (step.x == startX && step.y == startY) step.time = 0;
+
+ that.animating = true;
+ that.moved = true;
+
+ if (that.options.useTransition) {
+ that._transitionTime(step.time);
+ that._pos(step.x, step.y);
+ that.animating = false;
+ if (step.time) that._bind('webkitTransitionEnd');
+ else that._resetPos(0);
+ return;
+ }
+
+ animate = function () {
+ var now = Date.now(),
+ newX, newY;
+
+ if (now >= startTime + step.time) {
+ that._pos(step.x, step.y);
+ that.animating = false;
+ if (that.options.onAnimationEnd) that.options.onAnimationEnd.call(that); // Execute custom code on animation end
+ that._startAni();
+ return;
+ }
+
+ now = (now - startTime) / step.time - 1;
+ easeOut = m.sqrt(1 - now * now);
+ newX = (step.x - startX) * easeOut + startX;
+ newY = (step.y - startY) * easeOut + startY;
+ that._pos(newX, newY);
+ if (that.animating) that.aniTime = nextFrame(animate);
+ };
+
+ animate();
+ },
+
+ _transitionTime: function (time) {
+ this.scroller.style[vendor + 'TransitionDuration'] = time + 'ms';
+ },
+
+ _momentum: function (dist, time, maxDistUpper, maxDistLower, size) {
+ var deceleration = 0.0006,
+ speed = m.abs(dist) / time,
+ newDist = (speed * speed) / (2 * deceleration),
+ newTime = 0, outsideDist = 0;
+
+ // Proportinally reduce speed if we are outside of the boundaries
+ if (dist > 0 && newDist > maxDistUpper) {
+ outsideDist = size / (6 / (newDist / speed * deceleration));
+ maxDistUpper = maxDistUpper + outsideDist;
+ speed = speed * maxDistUpper / newDist;
+ newDist = maxDistUpper;
+ } else if (dist < 0 && newDist > maxDistLower) {
+ outsideDist = size / (6 / (newDist / speed * deceleration));
+ maxDistLower = maxDistLower + outsideDist;
+ speed = speed * maxDistLower / newDist;
+ newDist = maxDistLower;
+ }
+
+ newDist = newDist * (dist < 0 ? -1 : 1);
+ newTime = speed / deceleration;
+
+ return { dist: newDist, time: mround(newTime) };
+ },
+
+ _offset: function (el) {
+ var left = -el.offsetLeft,
+ top = -el.offsetTop;
+
+ while (el = el.offsetParent) {
+ left -= el.offsetLeft;
+ top -= el.offsetTop;
+ }
+
+ return { left: left, top: top };
+ },
+
+ _bind: function (type, el, bubble) {
+ (el || this.scroller).addEventListener(type, this, !!bubble);
+ },
+
+ _unbind: function (type, el, bubble) {
+ (el || this.scroller).removeEventListener(type, this, !!bubble);
+ },
+
+
+ /**
+ *
+ * Public methods
+ *
+ */
+ destroy: function () {
+ var that = this;
+
+ that.scroller.style[vendor + 'Transform'] = '';
+
+ // Remove the event listeners
+ that._unbind(RESIZE_EV, window);
+ that._unbind(START_EV);
+ that._unbind(MOVE_EV);
+ that._unbind(END_EV);
+ that._unbind(CANCEL_EV);
+ that._unbind('mouseout', that.wrapper);
+ if (that.options.useTransition) that._unbind('webkitTransitionEnd');
+
+ if (that.options.onDestroy) that.options.onDestroy.call(that);
+ },
+
+ refresh: function () {
+ var that = this,
+ offset;
+
+ that.wrapperW = that.wrapper.clientWidth;
+ that.wrapperH = that.wrapper.clientHeight;
+
+ that.scrollerW = that.scroller.offsetWidth;
+ that.scrollerH = that.scroller.offsetHeight;
+ that.maxScrollX = that.wrapperW - that.scrollerW;
+ that.maxScrollY = that.wrapperH - that.scrollerH;
+ that.dirX = 0;
+ that.dirY = 0;
+
+ that.hScroll = that.options.hScroll && that.maxScrollX < 0;
+ that.vScroll = that.options.vScroll && (!that.options.bounceLock && !that.hScroll || that.scrollerH > that.wrapperH);
+
+ offset = that._offset(that.wrapper);
+ that.wrapperOffsetLeft = -offset.left;
+ that.wrapperOffsetTop = -offset.top;
+
+
+ that.scroller.style[vendor + 'TransitionDuration'] = '0';
+
+ that._resetPos(200);
+ },
+
+ scrollTo: function (x, y, time, relative) {
+ var that = this,
+ step = x,
+ i, l;
+
+ that.stop();
+
+ if (!step.length) step = [{ x: x, y: y, time: time, relative: relative }];
+
+ for (i=0, l=step.length; i<l; i++) {
+ if (step[i].relative) { step[i].x = that.x - step[i].x; step[i].y = that.y - step[i].y; }
+ that.steps.push({ x: step[i].x, y: step[i].y, time: step[i].time || 0 });
+ }
+
+ that._startAni();
+ },
+
+ scrollToElement: function (el, time) {
+ var that = this, pos;
+ el = el.nodeType ? el : that.scroller.querySelector(el);
+ if (!el) return;
+
+ pos = that._offset(el);
+ pos.left += that.wrapperOffsetLeft;
+ pos.top += that.wrapperOffsetTop;
+
+ pos.left = pos.left > 0 ? 0 : pos.left < that.maxScrollX ? that.maxScrollX : pos.left;
+ pos.top = pos.top > 0 ? 0 : pos.top < that.maxScrollY ? that.maxScrollY : pos.top;
+ time = time === undefined ? m.max(m.abs(pos.left)*2, m.abs(pos.top)*2) : time;
+
+ that.scrollTo(pos.left, pos.top, time);
+ },
+
+ disable: function () {
+ this.stop();
+ this._resetPos(0);
+ this.enabled = false;
+
+ // If disabled after touchstart we make sure that there are no left over events
+ this._unbind(MOVE_EV);
+ this._unbind(END_EV);
+ this._unbind(CANCEL_EV);
+ },
+
+ enable: function () {
+ this.enabled = true;
+ },
+
+ stop: function () {
+ cancelFrame(this.aniTime);
+ this.steps = [];
+ this.moved = false;
+ this.animating = false;
+ }
+};
+
+if (typeof exports !== 'undefined') exports.iScroll = iScroll;
+else window.iScroll = iScroll;
+
+})();
diff --git a/src/components/HMI/lib/jquery-1.7.2.js b/src/components/HMI/lib/jquery-1.7.2.js
new file mode 100644
index 0000000000..0073dfc8c3
--- /dev/null
+++ b/src/components/HMI/lib/jquery-1.7.2.js
@@ -0,0 +1,9404 @@
+/*!
+ * jQuery JavaScript Library v1.7.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Wed Mar 21 12:46:34 2012 -0700
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document,
+ navigator = window.navigator,
+ location = window.location;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z]|[0-9])/ig,
+ rmsPrefix = /^-ms-/,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = quickExpr.exec( selector );
+ }
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+ doc = ( context ? context.ownerDocument || context : document );
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.7.2",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = this.constructor();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // Add the callback
+ readyList.add( fn );
+
+ return this;
+ },
+
+ eq: function( i ) {
+ i = +i;
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+ // Either a released hold or an DOMready/load event and not yet ready
+ if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.fireWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).off( "ready" );
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyList ) {
+ return;
+ }
+
+ readyList = jQuery.Callbacks( "once memory" );
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+
+ }
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+ var xml, tmp;
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction( object );
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return object;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
+
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ var type = jQuery.type( array );
+
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array, i ) {
+ var len;
+
+ if ( array ) {
+ if ( indexOf ) {
+ return indexOf.call( array, elem, i );
+ }
+
+ len = array.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in array && array[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var i = first.length,
+ j = 0;
+
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [], retVal;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value, key, ret = [],
+ i = 0,
+ length = elems.length,
+ // jquery objects are treated as arrays
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( key in elems ) {
+ value = callback( elems[ key ], key, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ if ( typeof context === "string" ) {
+ var tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ var args = slice.call( arguments, 2 ),
+ proxy = function() {
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Mutifunctional method to get and set values to a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
+ var exec,
+ bulk = key == null,
+ i = 0,
+ length = elems.length;
+
+ // Sets many values
+ if ( key && typeof key === "object" ) {
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
+ }
+ chainable = 1;
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = pass === undefined && jQuery.isFunction( value );
+
+ if ( bulk ) {
+ // Bulk operations only iterate when executing function values
+ if ( exec ) {
+ exec = fn;
+ fn = function( elem, key, value ) {
+ return exec.call( jQuery( elem ), value );
+ };
+
+ // Otherwise they run against the entire set
+ } else {
+ fn.call( elems, value );
+ fn = null;
+ }
+ }
+
+ if ( fn ) {
+ for (; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+ }
+
+ chainable = 1;
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ },
+
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ ua = ua.toLowerCase();
+
+ var match = rwebkit.exec( ua ) ||
+ ropera.exec( ua ) ||
+ rmsie.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
+ [];
+
+ return { browser: match[1] || "", version: match[2] || "0" };
+ },
+
+ sub: function() {
+ function jQuerySub( selector, context ) {
+ return new jQuerySub.fn.init( selector, context );
+ }
+ jQuery.extend( true, jQuerySub, this );
+ jQuerySub.superclass = this;
+ jQuerySub.fn = jQuerySub.prototype = this();
+ jQuerySub.fn.constructor = jQuerySub;
+ jQuerySub.sub = this.sub;
+ jQuerySub.fn.init = function init( selector, context ) {
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+ context = jQuerySub( context );
+ }
+
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+ };
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
+ var rootjQuerySub = jQuerySub(document);
+ return jQuerySub;
+ },
+
+ browser: {}
+});
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
+
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
+
+// IE doesn't match non-breaking spaces with \s
+if ( rnotwhite.test( "\xA0" ) ) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+}
+
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch(e) {
+ setTimeout( doScrollCheck, 1 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+}
+
+return jQuery;
+
+})();
+
+
+// String to Object flags format cache
+var flagsCache = {};
+
+// Convert String-formatted flags into Object-formatted ones and store in cache
+function createFlags( flags ) {
+ var object = flagsCache[ flags ] = {},
+ i, length;
+ flags = flags.split( /\s+/ );
+ for ( i = 0, length = flags.length; i < length; i++ ) {
+ object[ flags[i] ] = true;
+ }
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * flags: an optional list of space-separated flags that will change how
+ * the callback list behaves
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible flags:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( flags ) {
+
+ // Convert flags from String-formatted to Object-formatted
+ // (we check in cache first)
+ flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
+
+ var // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = [],
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // Add one or several callbacks to the list
+ add = function( args ) {
+ var i,
+ length,
+ elem,
+ type,
+ actual;
+ for ( i = 0, length = args.length; i < length; i++ ) {
+ elem = args[ i ];
+ type = jQuery.type( elem );
+ if ( type === "array" ) {
+ // Inspect recursively
+ add( elem );
+ } else if ( type === "function" ) {
+ // Add if not in unique mode and callback is not in
+ if ( !flags.unique || !self.has( elem ) ) {
+ list.push( elem );
+ }
+ }
+ }
+ },
+ // Fire callbacks
+ fire = function( context, args ) {
+ args = args || [];
+ memory = !flags.memory || [ context, args ];
+ fired = true;
+ firing = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
+ memory = true; // Mark as halted
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( !flags.once ) {
+ if ( stack && stack.length ) {
+ memory = stack.shift();
+ self.fireWith( memory[ 0 ], memory[ 1 ] );
+ }
+ } else if ( memory === true ) {
+ self.disable();
+ } else {
+ list = [];
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ var length = list.length;
+ add( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away, unless previous
+ // firing was halted (stopOnFalse)
+ } else if ( memory && memory !== true ) {
+ firingStart = length;
+ fire( memory[ 0 ], memory[ 1 ] );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ var args = arguments,
+ argIndex = 0,
+ argLength = args.length;
+ for ( ; argIndex < argLength ; argIndex++ ) {
+ for ( var i = 0; i < list.length; i++ ) {
+ if ( args[ argIndex ] === list[ i ] ) {
+ // Handle firingIndex and firingLength
+ if ( firing ) {
+ if ( i <= firingLength ) {
+ firingLength--;
+ if ( i <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ // Remove the element
+ list.splice( i--, 1 );
+ // If we have some unicity property then
+ // we only need to do this once
+ if ( flags.unique ) {
+ break;
+ }
+ }
+ }
+ }
+ }
+ return this;
+ },
+ // Control if a given callback is in the list
+ has: function( fn ) {
+ if ( list ) {
+ var i = 0,
+ length = list.length;
+ for ( ; i < length; i++ ) {
+ if ( fn === list[ i ] ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory || memory === true ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ if ( stack ) {
+ if ( firing ) {
+ if ( !flags.once ) {
+ stack.push( [ context, args ] );
+ }
+ } else if ( !( flags.once && memory ) ) {
+ fire( context, args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+
+
+
+
+var // Static reference to slice
+ sliceDeferred = [].slice;
+
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var doneList = jQuery.Callbacks( "once memory" ),
+ failList = jQuery.Callbacks( "once memory" ),
+ progressList = jQuery.Callbacks( "memory" ),
+ state = "pending",
+ lists = {
+ resolve: doneList,
+ reject: failList,
+ notify: progressList
+ },
+ promise = {
+ done: doneList.add,
+ fail: failList.add,
+ progress: progressList.add,
+
+ state: function() {
+ return state;
+ },
+
+ // Deprecated
+ isResolved: doneList.fired,
+ isRejected: failList.fired,
+
+ then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
+ deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
+ return this;
+ },
+ always: function() {
+ deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
+ return this;
+ },
+ pipe: function( fnDone, fnFail, fnProgress ) {
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( {
+ done: [ fnDone, "resolve" ],
+ fail: [ fnFail, "reject" ],
+ progress: [ fnProgress, "notify" ]
+ }, function( handler, data ) {
+ var fn = data[ 0 ],
+ action = data[ 1 ],
+ returned;
+ if ( jQuery.isFunction( fn ) ) {
+ deferred[ handler ](function() {
+ returned = fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+ }
+ });
+ } else {
+ deferred[ handler ]( newDefer[ action ] );
+ }
+ });
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ if ( obj == null ) {
+ obj = promise;
+ } else {
+ for ( var key in promise ) {
+ obj[ key ] = promise[ key ];
+ }
+ }
+ return obj;
+ }
+ },
+ deferred = promise.promise({}),
+ key;
+
+ for ( key in lists ) {
+ deferred[ key ] = lists[ key ].fire;
+ deferred[ key + "With" ] = lists[ key ].fireWith;
+ }
+
+ // Handle state
+ deferred.done( function() {
+ state = "resolved";
+ }, failList.disable, progressList.lock ).fail( function() {
+ state = "rejected";
+ }, doneList.disable, progressList.lock );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( firstParam ) {
+ var args = sliceDeferred.call( arguments, 0 ),
+ i = 0,
+ length = args.length,
+ pValues = new Array( length ),
+ count = length,
+ pCount = length,
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
+ firstParam :
+ jQuery.Deferred(),
+ promise = deferred.promise();
+ function resolveFunc( i ) {
+ return function( value ) {
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ if ( !( --count ) ) {
+ deferred.resolveWith( deferred, args );
+ }
+ };
+ }
+ function progressFunc( i ) {
+ return function( value ) {
+ pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ deferred.notifyWith( promise, pValues );
+ };
+ }
+ if ( length > 1 ) {
+ for ( ; i < length; i++ ) {
+ if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
+ args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
+ } else {
+ --count;
+ }
+ }
+ if ( !count ) {
+ deferred.resolveWith( deferred, args );
+ }
+ } else if ( deferred !== firstParam ) {
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
+ }
+ return promise;
+ }
+});
+
+
+
+
+jQuery.support = (function() {
+
+ var support,
+ all,
+ a,
+ select,
+ opt,
+ input,
+ fragment,
+ tds,
+ events,
+ eventName,
+ i,
+ isSupported,
+ div = document.createElement( "div" ),
+ documentElement = document.documentElement;
+
+ // Preliminary tests
+ div.setAttribute("className", "t");
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ all = div.getElementsByTagName( "*" );
+ a = div.getElementsByTagName( "a" )[ 0 ];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return {};
+ }
+
+ // First batch of supports tests
+ select = document.createElement( "select" );
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName( "input" )[ 0 ];
+
+ support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: ( a.getAttribute("href") === "/a" ),
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: ( input.value === "on" ),
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // Tests for enctype support on a form(#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+ // Will be defined later
+ submitBubbles: true,
+ changeBubbles: true,
+ focusinBubbles: false,
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ pixelMargin: true
+ };
+
+ // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
+ jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+ div.attachEvent( "onclick", function() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ support.noCloneEvent = false;
+ });
+ div.cloneNode( true ).fireEvent( "onclick" );
+ }
+
+ // Check if a radio maintains its value
+ // after being appended to the DOM
+ input = document.createElement("input");
+ input.value = "t";
+ input.setAttribute("type", "radio");
+ support.radioValue = input.value === "t";
+
+ input.setAttribute("checked", "checked");
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "name", "t" );
+
+ div.appendChild( input );
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( div.lastChild );
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ fragment.removeChild( input );
+ fragment.appendChild( div );
+
+ // Technique from Juriy Zaytsev
+ // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+ // We only care about the case where non-standard event systems
+ // are used, namely in IE. Short-circuiting here helps us to
+ // avoid an eval call (in setAttribute) which can cause CSP
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+ if ( div.attachEvent ) {
+ for ( i in {
+ submit: 1,
+ change: 1,
+ focusin: 1
+ }) {
+ eventName = "on" + i;
+ isSupported = ( eventName in div );
+ if ( !isSupported ) {
+ div.setAttribute( eventName, "return;" );
+ isSupported = ( typeof div[ eventName ] === "function" );
+ }
+ support[ i + "Bubbles" ] = isSupported;
+ }
+ }
+
+ fragment.removeChild( div );
+
+ // Null elements to avoid leaks in IE
+ fragment = select = opt = div = input = null;
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, outer, inner, table, td, offsetSupport,
+ marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
+ paddingMarginBorderVisibility, paddingMarginBorder,
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ conMarginTop = 1;
+ paddingMarginBorder = "padding:0;margin:0;border:";
+ positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
+ paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
+ style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
+ html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
+ "<table " + style + "' cellpadding='0' cellspacing='0'>" +
+ "<tr><td></td></tr></table>";
+
+ container = document.createElement("div");
+ container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
+ body.insertBefore( container, body.firstChild );
+
+ // Construct the test element
+ div = document.createElement("div");
+ container.appendChild( div );
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName( "td" );
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE <= 8 fail this test)
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ if ( window.getComputedStyle ) {
+ div.innerHTML = "";
+ marginDiv = document.createElement( "div" );
+ marginDiv.style.width = "0";
+ marginDiv.style.marginRight = "0";
+ div.style.width = "2px";
+ div.appendChild( marginDiv );
+ support.reliableMarginRight =
+ ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
+ }
+
+ if ( typeof div.style.zoom !== "undefined" ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.innerHTML = "";
+ div.style.width = div.style.padding = "1px";
+ div.style.border = 0;
+ div.style.overflow = "hidden";
+ div.style.display = "inline";
+ div.style.zoom = 1;
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "block";
+ div.style.overflow = "visible";
+ div.innerHTML = "<div style='width:5px;'></div>";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+ }
+
+ div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
+ div.innerHTML = html;
+
+ outer = div.firstChild;
+ inner = outer.firstChild;
+ td = outer.nextSibling.firstChild.firstChild;
+
+ offsetSupport = {
+ doesNotAddBorder: ( inner.offsetTop !== 5 ),
+ doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
+ };
+
+ inner.style.position = "fixed";
+ inner.style.top = "20px";
+
+ // safari subtracts parent border width here which is 5px
+ offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
+ inner.style.position = inner.style.top = "";
+
+ outer.style.overflow = "hidden";
+ outer.style.position = "relative";
+
+ offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
+ offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
+
+ if ( window.getComputedStyle ) {
+ div.style.marginTop = "1%";
+ support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
+ }
+
+ if ( typeof container.style.zoom !== "undefined" ) {
+ container.style.zoom = 1;
+ }
+
+ body.removeChild( container );
+ marginDiv = div = container = null;
+
+ jQuery.extend( support, offsetSupport );
+ });
+
+ return support;
+})();
+
+
+
+
+var rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+jQuery.extend({
+ cache: {},
+
+ // Please use with caution
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var privateCache, thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
+ isEvents = name === "events";
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = ++jQuery.uuid;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ privateCache = thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Users should not attempt to inspect the internal events object using jQuery.data,
+ // it is undocumented and subject to change. But does anyone listen? No.
+ if ( isEvents && !thisCache[ name ] ) {
+ return privateCache.events;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+ },
+
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, i, l,
+
+ // Reference to internal data cache key
+ internalKey = jQuery.expando,
+
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+
+ // See jQuery.data for more information
+ id = isNode ? elem[ internalKey ] : internalKey;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split( " " );
+ }
+ }
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject(cache[ id ]) ) {
+ return;
+ }
+ }
+
+ // Browsers that fail expando deletion also refuse to delete expandos on
+ // the window, but it will allow it on all other JS objects; other browsers
+ // don't care
+ // Ensure that `cache` is not a window object #10080
+ if ( jQuery.support.deleteExpando || !cache.setInterval ) {
+ delete cache[ id ];
+ } else {
+ cache[ id ] = null;
+ }
+
+ // We destroyed the cache and need to eliminate the expando on the node to avoid
+ // false lookups in the cache for entries that no longer exist
+ if ( isNode ) {
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( jQuery.support.deleteExpando ) {
+ delete elem[ internalKey ];
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( internalKey );
+ } else {
+ elem[ internalKey ] = null;
+ }
+ }
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return jQuery.data( elem, name, data, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ if ( elem.nodeName ) {
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ if ( match ) {
+ return !(match === true || elem.getAttribute("classid") !== match);
+ }
+ }
+
+ return true;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var parts, part, attr, name, l,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attr = elem.attributes;
+ for ( l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ parts = key.split( ".", 2 );
+ parts[1] = parts[1] ? "." + parts[1] : "";
+ part = parts[1] + "!";
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ data = this.triggerHandler( "getData" + part, [ parts[0] ] );
+
+ // Try to fetch any internally stored data first
+ if ( data === undefined && elem ) {
+ data = jQuery.data( elem, key );
+ data = dataAttr( elem, key, data );
+ }
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+ }
+
+ parts[1] = value;
+ this.each(function() {
+ var self = jQuery( this );
+
+ self.triggerHandler( "setData" + part, parts );
+ jQuery.data( this, key, value );
+ self.triggerHandler( "changeData" + part, parts );
+ });
+ }, null, value, arguments.length > 1, null, false );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ jQuery.isNumeric( data ) ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ for ( var name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
+
+function handleQueueMarkDefer( elem, type, src ) {
+ var deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ defer = jQuery._data( elem, deferDataKey );
+ if ( defer &&
+ ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
+ ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
+ // Give room for hard-coded callbacks to fire first
+ // and eventually mark/queue something else on the element
+ setTimeout( function() {
+ if ( !jQuery._data( elem, queueDataKey ) &&
+ !jQuery._data( elem, markDataKey ) ) {
+ jQuery.removeData( elem, deferDataKey, true );
+ defer.fire();
+ }
+ }, 0 );
+ }
+}
+
+jQuery.extend({
+
+ _mark: function( elem, type ) {
+ if ( elem ) {
+ type = ( type || "fx" ) + "mark";
+ jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
+ }
+ },
+
+ _unmark: function( force, elem, type ) {
+ if ( force !== true ) {
+ type = elem;
+ elem = force;
+ force = false;
+ }
+ if ( elem ) {
+ type = type || "fx";
+ var key = type + "mark",
+ count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
+ if ( count ) {
+ jQuery._data( elem, key, count );
+ } else {
+ jQuery.removeData( elem, key, true );
+ handleQueueMarkDefer( elem, type, "mark" );
+ }
+ }
+ },
+
+ queue: function( elem, type, data ) {
+ var q;
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ q = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ q.push( data );
+ }
+ }
+ return q || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift(),
+ hooks = {};
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
+
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ jQuery._data( elem, type + ".run", hooks );
+ fn.call( elem, function() {
+ jQuery.dequeue( elem, type );
+ }, hooks );
+ }
+
+ if ( !queue.length ) {
+ jQuery.removeData( elem, type + "queue " + type + ".run", true );
+ handleQueueMarkDefer( elem, type, "queue" );
+ }
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, object ) {
+ if ( typeof type !== "string" ) {
+ object = type;
+ type = undefined;
+ }
+ type = type || "fx";
+ var defer = jQuery.Deferred(),
+ elements = this,
+ i = elements.length,
+ count = 1,
+ deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ tmp;
+ function resolve() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ }
+ while( i-- ) {
+ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
+ jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
+ count++;
+ tmp.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( object );
+ }
+});
+
+
+
+
+var rclass = /[\n\t\r]/g,
+ rspace = /\s+/,
+ rreturn = /\r/g,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea)?$/i,
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ nodeHook, boolHook, fixSpecified;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classNames, i, l, elem,
+ setClass, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ classNames = value.split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className && classNames.length === 1 ) {
+ elem.className = value;
+
+ } else {
+ setClass = " " + elem.className + " ";
+
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
+ setClass += classNames[ c ] + " ";
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classNames, i, l, elem, className, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( (value && typeof value === "string") || value === undefined ) {
+ classNames = ( value || "" ).split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ className = (" " + elem.className + " ").replace( rclass, " " );
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[ c ] + " ", " ");
+ }
+ elem.className = jQuery.trim( className );
+
+ } else {
+ elem.className = "";
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.split( rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var self = jQuery(this), val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, i, max, option,
+ index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ i = one ? index : 0;
+ max = one ? index + 1 : options.length;
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
+ if ( one && !values.length && options.length ) {
+ return jQuery( options[ index ] ).val();
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
+ attr: function( elem, name, value, pass ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery( elem )[ name ]( value );
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === "undefined" ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+ return;
+
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, "" + value );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ ret = elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret === null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var propName, attrNames, name, l, isBool,
+ i = 0;
+
+ if ( value && elem.nodeType === 1 ) {
+ attrNames = value.toLowerCase().split( rspace );
+ l = attrNames.length;
+
+ for ( ; i < l; i++ ) {
+ name = attrNames[ i ];
+
+ if ( name ) {
+ propName = jQuery.propFix[ name ] || name;
+ isBool = rboolean.test( name );
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ // Do not do this for boolean attributes (see #10870)
+ if ( !isBool ) {
+ jQuery.attr( elem, name, "" );
+ }
+ elem.removeAttribute( getSetAttribute ? name : propName );
+
+ // Set corresponding property to false for boolean attributes
+ if ( isBool && propName in elem ) {
+ elem[ propName ] = false;
+ }
+ }
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to it's default in case type is set after value
+ // This is for element creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ },
+ // Use the value property for back compat
+ // Use the nodeHook for button elements in IE6/7 (#1954)
+ value: {
+ get: function( elem, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.get( elem, name );
+ }
+ return name in elem ?
+ elem.value :
+ null;
+ },
+ set: function( elem, value, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.set( elem, value, name );
+ }
+ // Does not return so that setAttribute is also used
+ elem.value = value;
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
+jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ // Align boolean attributes with corresponding properties
+ // Fall back to attribute presence where some booleans are not supported
+ var attrNode,
+ property = jQuery.prop( elem, name );
+ return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ var propName;
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ // value is true since we know at this point it's type boolean and not false
+ // Set boolean attributes to the same name and set the DOM property
+ propName = jQuery.propFix[ name ] || name;
+ if ( propName in elem ) {
+ // Only set the IDL specifically if it already exists on the element
+ elem[ propName ] = true;
+ }
+
+ elem.setAttribute( name, name.toLowerCase() );
+ }
+ return name;
+ }
+};
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ fixSpecified = {
+ name: true,
+ id: true,
+ coords: true
+ };
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret;
+ ret = elem.getAttributeNode( name );
+ return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
+ ret.nodeValue :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ ret = document.createAttribute( name );
+ elem.setAttributeNode( ret );
+ }
+ return ( ret.nodeValue = value + "" );
+ }
+ };
+
+ // Apply the nodeHook to tabindex
+ jQuery.attrHooks.tabindex.set = nodeHook.set;
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ if ( value === "" ) {
+ value = "false";
+ }
+ nodeHook.set( elem, value, name );
+ }
+ };
+}
+
+
+// Some attributes require a special call on IE
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret === null ? undefined : ret;
+ }
+ });
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Normalize to lowercase since IE uppercases css property names
+ return elem.style.cssText.toLowerCase() || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = "" + value );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+
+
+
+
+var rformElems = /^(?:textarea|input|select)$/i,
+ rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
+ rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
+ quickParse = function( selector ) {
+ var quick = rquickIs.exec( selector );
+ if ( quick ) {
+ // 0 1 2 3
+ // [ _, tag, id, class ]
+ quick[1] = ( quick[1] || "" ).toLowerCase();
+ quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
+ }
+ return quick;
+ },
+ quickIs = function( elem, m ) {
+ var attrs = elem.attributes || {};
+ return (
+ (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
+ (!m[2] || (attrs.id || {}).value === m[2]) &&
+ (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
+ );
+ },
+ hoverHack = function( events ) {
+ return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+ };
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ add: function( elem, types, handler, data, selector ) {
+
+ var elemData, eventHandle, events,
+ t, tns, type, namespaces, handleObj,
+ handleObjIn, quick, handlers, special;
+
+ // Don't attach events to noData or text/comment nodes (allow plain objects tho)
+ if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ events = elemData.events;
+ if ( !events ) {
+ elemData.events = events = {};
+ }
+ eventHandle = elemData.handle;
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = jQuery.trim( hoverHack(types) ).split( " " );
+ for ( t = 0; t < types.length; t++ ) {
+
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = tns[1];
+ namespaces = ( tns[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: tns[1],
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ quick: selector && quickParse( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ handlers = events[ type ];
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+
+ var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
+ t, tns, type, origType, namespaces, origCount,
+ j, events, special, handle, eventType, handleObj;
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
+ for ( t = 0; t < types.length; t++ ) {
+ tns = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tns[1];
+ namespaces = tns[2];
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector? special.delegateType : special.bindType ) || type;
+ eventType = events[ type ] || [];
+ origCount = eventType.length;
+ namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
+
+ // Remove matching events
+ for ( j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ eventType.splice( j--, 1 );
+
+ if ( handleObj.selector ) {
+ eventType.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( eventType.length === 0 && origCount !== eventType.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ handle = elemData.handle;
+ if ( handle ) {
+ handle.elem = null;
+ }
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery.removeData( elem, [ "events", "handle" ], true );
+ }
+ },
+
+ // Events that are safe to short-circuit if no handlers are attached.
+ // Native DOM events should not be added, they may have inline handlers.
+ customEvent: {
+ "getData": true,
+ "setData": true,
+ "changeData": true
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ // Don't do events on text and comment nodes
+ if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
+ return;
+ }
+
+ // Event object or event type
+ var type = event.type || event,
+ namespaces = [],
+ cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf( "!" ) >= 0 ) {
+ // Exclusive events trigger only for the exact event (no namespaces)
+ type = type.slice(0, -1);
+ exclusive = true;
+ }
+
+ if ( type.indexOf( "." ) >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+ // No jQuery handlers for this event type, and it can't have inline handlers
+ return;
+ }
+
+ // Caller can pass in an Event, Object, or just an event type string
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[ jQuery.expando ] ? event :
+ // Object literal
+ new jQuery.Event( type, event ) :
+ // Just the event type (string)
+ new jQuery.Event( type );
+
+ event.type = type;
+ event.isTrigger = true;
+ event.exclusive = exclusive;
+ event.namespace = namespaces.join( "." );
+ event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
+ ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
+
+ // Handle a global trigger
+ if ( !elem ) {
+
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
+ cache = jQuery.cache;
+ for ( i in cache ) {
+ if ( cache[ i ].events && cache[ i ].events[ type ] ) {
+ jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
+ }
+ }
+ return;
+ }
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data != null ? jQuery.makeArray( data ) : [];
+ data.unshift( event );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ eventPath = [[ elem, special.bindType || type ]];
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
+ old = null;
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push([ cur, bubbleType ]);
+ old = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( old && old === elem.ownerDocument ) {
+ eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
+ }
+ }
+
+ // Fire handlers on the event path
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
+
+ cur = eventPath[i][0];
+ event.type = eventPath[i][1];
+
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+ // Note that this is a bare JS function and not a jQuery handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ // IE<9 dies on focus/blur to hidden element (#1486)
+ if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ old = elem[ ontype ];
+
+ if ( old ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ elem[ type ]();
+ jQuery.event.triggered = undefined;
+
+ if ( old ) {
+ elem[ ontype ] = old;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event || window.event );
+
+ var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
+ delegateCount = handlers.delegateCount,
+ args = [].slice.call( arguments, 0 ),
+ run_all = !event.exclusive && !event.namespace,
+ special = jQuery.event.special[ event.type ] || {},
+ handlerQueue = [],
+ i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers that should run if there are delegated events
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && !(event.button && event.type === "click") ) {
+
+ // Pregenerate a single jQuery object for reuse with .is()
+ jqcur = jQuery(this);
+ jqcur.context = this.ownerDocument || this;
+
+ for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't process events on disabled elements (#6911, #8165)
+ if ( cur.disabled !== true ) {
+ selMatch = {};
+ matches = [];
+ jqcur[0] = cur;
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+ sel = handleObj.selector;
+
+ if ( selMatch[ sel ] === undefined ) {
+ selMatch[ sel ] = (
+ handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
+ );
+ }
+ if ( selMatch[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, matches: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( handlers.length > delegateCount ) {
+ handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
+ }
+
+ // Run delegates first; they may want to stop propagation beneath us
+ for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
+ matched = handlerQueue[ i ];
+ event.currentTarget = matched.elem;
+
+ for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
+ handleObj = matched.matches[ j ];
+
+ // Triggered event must either 1) be non-exclusive and have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
+ props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var eventDoc, doc, body,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop,
+ originalEvent = event,
+ fixHook = jQuery.event.fixHooks[ event.type ] || {},
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = jQuery.Event( originalEvent );
+
+ for ( i = copy.length; i; ) {
+ prop = copy[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Target should not be a text node (#504, Safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
+ if ( event.metaKey === undefined ) {
+ event.metaKey = event.ctrlKey;
+ }
+
+ return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady
+ },
+
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+
+ focus: {
+ delegateType: "focusin"
+ },
+ blur: {
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( jQuery.isWindow( this ) ) {
+ this.onbeforeunload = eventHandle;
+ }
+ },
+
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+// Some plugins are using, but it's undocumented/deprecated and will be removed.
+// The 1.7 special event interface should provide all the hooks needed now.
+jQuery.event.handle = jQuery.event.dispatch;
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj,
+ selector = handleObj.selector,
+ ret;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !form._submit_attached ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ form._submit_attached = true;
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ jQuery.event.simulate( "change", this, event, true );
+ }
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ elem._change_attached = true;
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var origFn, type;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) { // && selector != null
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ var handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( var type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ live: function( types, data, fn ) {
+ jQuery( this.context ).on( types, this.selector, data, fn );
+ return this;
+ },
+ die: function( types, fn ) {
+ jQuery( this.context ).off( types, this.selector || "**", fn );
+ return this;
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ return jQuery.event.trigger( type, data, this[0], true );
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ guid = fn.guid || jQuery.guid++,
+ i = 0,
+ toggler = function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ };
+
+ // link all the functions, so any of them can unbind this click handler
+ toggler.guid = guid;
+ while ( i < args.length ) {
+ args[ i++ ].guid = guid;
+ }
+
+ return this.click( toggler );
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+
+ if ( rkeyEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+ }
+
+ if ( rmouseEvent.test( name ) ) {
+ jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+ }
+});
+
+
+
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ expando = "sizcache" + (Math.random() + '').replace('.', ''),
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true,
+ rBackslash = /\\/g,
+ rReturn = /\r\n/g,
+ rNonWord = /\W/;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+
+ var origContext = context;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+ } while ( m );
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context, seed );
+
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set, seed );
+ }
+ }
+
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
+ }
+
+ if ( context ) {
+ ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray( set );
+
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ cur = parts.pop();
+ pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ Sizzle.error( cur || selector );
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+
+ } else if ( context && context.nodeType === 1 ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+
+ } else {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+ var set, i, len, match, type, left;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( i = 0, len = Expr.order.length; i < len; i++ ) {
+ type = Expr.order[i];
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ left = match[1];
+ match.splice( 1, 1 );
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace( rBackslash, "" );
+ set = Expr.find[ type ]( match, context, isXML );
+
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = typeof context.getElementsByTagName !== "undefined" ?
+ context.getElementsByTagName( "*" ) :
+ [];
+ }
+
+ return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ type, found, item, filter, left,
+ i, pass,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+ while ( expr && set.length ) {
+ for ( type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ filter = Expr.filter[ type ];
+ left = match[1];
+
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ pass = not ^ found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+
+ } else {
+ curLoop[i] = false;
+ }
+
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ Sizzle.error( expr );
+
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Utility function for retreiving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+var getText = Sizzle.getText = function( elem ) {
+ var i, node,
+ nodeType = elem.nodeType,
+ ret = "";
+
+ if ( nodeType ) {
+ if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent || innerText for elements
+ if ( typeof elem.textContent === 'string' ) {
+ return elem.textContent;
+ } else if ( typeof elem.innerText === 'string' ) {
+ // Replace IE's carriage returns
+ return elem.innerText.replace( rReturn, '' );
+ } else {
+ // Traverse it's children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ } else {
+
+ // If no nodeType, this is expected to be an array
+ for ( i = 0; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ if ( node.nodeType !== 8 ) {
+ ret += getText( node );
+ }
+ }
+ }
+ return ret;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+
+ leftMatch: {},
+
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+
+ attrHandle: {
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
+ },
+ type: function( elem ) {
+ return elem.getAttribute( "type" );
+ }
+ },
+
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !rNonWord.test( part ),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+
+ } else {
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+
+ "": function(checkSet, part, isXML){
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+ },
+
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+ }
+ },
+
+ find: {
+ ID: function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ },
+
+ NAME: function( match, context ) {
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [],
+ results = context.getElementsByName( match[1] );
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+
+ TAG: function( match, context ) {
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
+ return context.getElementsByTagName( match[1] );
+ }
+ }
+ },
+ preFilter: {
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+ match = " " + match[1].replace( rBackslash, "" ) + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ ID: function( match ) {
+ return match[1].replace( rBackslash, "" );
+ },
+
+ TAG: function( match, curLoop ) {
+ return match[1].replace( rBackslash, "" ).toLowerCase();
+ },
+
+ CHILD: function( match ) {
+ if ( match[1] === "nth" ) {
+ if ( !match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ match[2] = match[2].replace(/^\+|\s*/g, '');
+
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+ else if ( match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+ var name = match[1] = match[1].replace( rBackslash, "" );
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ // Handle if an un-quoted value was used
+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+
+ return false;
+ }
+
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+
+ POS: function( match ) {
+ match.unshift( true );
+
+ return match;
+ }
+ },
+
+ filters: {
+ enabled: function( elem ) {
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+
+ disabled: function( elem ) {
+ return elem.disabled === true;
+ },
+
+ checked: function( elem ) {
+ return elem.checked === true;
+ },
+
+ selected: function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ parent: function( elem ) {
+ return !!elem.firstChild;
+ },
+
+ empty: function( elem ) {
+ return !elem.firstChild;
+ },
+
+ has: function( elem, i, match ) {
+ return !!Sizzle( match[3], elem ).length;
+ },
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
+ },
+
+ text: function( elem ) {
+ var attr = elem.getAttribute( "type" ), type = elem.type;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
+ },
+
+ radio: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
+ },
+
+ checkbox: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
+ },
+
+ file: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
+ },
+
+ password: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
+ },
+
+ submit: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "submit" === elem.type;
+ },
+
+ image: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
+ },
+
+ reset: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "reset" === elem.type;
+ },
+
+ button: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && "button" === elem.type || name === "button";
+ },
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
+ },
+
+ focus: function( elem ) {
+ return elem === elem.ownerDocument.activeElement;
+ }
+ },
+ setFilters: {
+ first: function( elem, i ) {
+ return i === 0;
+ },
+
+ last: function( elem, i, match, array ) {
+ return i === array.length - 1;
+ },
+
+ even: function( elem, i ) {
+ return i % 2 === 0;
+ },
+
+ odd: function( elem, i ) {
+ return i % 2 === 1;
+ },
+
+ lt: function( elem, i, match ) {
+ return i < match[3] - 0;
+ },
+
+ gt: function( elem, i, match ) {
+ return i > match[3] - 0;
+ },
+
+ nth: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ },
+
+ eq: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ } else {
+ Sizzle.error( name );
+ }
+ },
+
+ CHILD: function( elem, match ) {
+ var first, last,
+ doneName, parent, cache,
+ count, diff,
+ type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ /* falls through */
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ case "nth":
+ first = match[2];
+ last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ doneName = match[0];
+ parent = elem.parentNode;
+
+ if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
+ count = 0;
+
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+
+ parent[ expando ] = doneName;
+ }
+
+ diff = elem.nodeIndex - last;
+
+ if ( first === 0 ) {
+ return diff === 0;
+
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+
+ ID: function( elem, match ) {
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+
+ TAG: function( elem, match ) {
+ return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
+ },
+
+ CLASS: function( elem, match ) {
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+
+ ATTR: function( elem, match ) {
+ var name = match[1],
+ result = Sizzle.attr ?
+ Sizzle.attr( elem, name ) :
+ Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ !type && Sizzle.attr ?
+ result != null :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+// Expose origPOS
+// "global" as in regardless of relation to brackets/parens
+Expr.match.globalPOS = origPOS;
+
+var makeArray = function( array, results ) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+
+ } else {
+ for ( ; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return a.sourceIndex - b.sourceIndex;
+ }
+
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+ };
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
+ form.innerHTML = "<a name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+
+ Expr.filter.ID = function( elem, match ) {
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+
+ // release memory in IE
+ root = form = null;
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function( match, context ) {
+ var results = context.getElementsByTagName( match[1] );
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+
+ Expr.attrHandle.href = function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ };
+ }
+
+ // release memory in IE
+ div = null;
+})();
+
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle,
+ div = document.createElement("div"),
+ id = "__sizzle__";
+
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function( query, context, extra, seed ) {
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && !Sizzle.isXML(context) ) {
+ // See if we find a selector to speed up
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
+
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
+ // Speed-up: Sizzle("TAG")
+ if ( match[1] ) {
+ return makeArray( context.getElementsByTagName( query ), extra );
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
+ return makeArray( context.getElementsByClassName( match[2] ), extra );
+ }
+ }
+
+ if ( context.nodeType === 9 ) {
+ // Speed-up: Sizzle("body")
+ // The body element only exists once, optimize finding it
+ if ( query === "body" && context.body ) {
+ return makeArray( [ context.body ], extra );
+
+ // Speed-up: Sizzle("#ID")
+ } else if ( match && match[3] ) {
+ var elem = context.getElementById( match[3] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id === match[3] ) {
+ return makeArray( [ elem ], extra );
+ }
+
+ } else {
+ return makeArray( [], extra );
+ }
+ }
+
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(qsaError) {}
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ var oldContext = context,
+ old = context.getAttribute( "id" ),
+ nid = old || id,
+ hasParent = context.parentNode,
+ relativeHierarchySelector = /^\s*[+~]/.test( query );
+
+ if ( !old ) {
+ context.setAttribute( "id", nid );
+ } else {
+ nid = nid.replace( /'/g, "\\$&" );
+ }
+ if ( relativeHierarchySelector && hasParent ) {
+ context = context.parentNode;
+ }
+
+ try {
+ if ( !relativeHierarchySelector || hasParent ) {
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
+ }
+
+ } catch(pseudoError) {
+ } finally {
+ if ( !old ) {
+ oldContext.removeAttribute( "id" );
+ }
+ }
+ }
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
+
+ // release memory in IE
+ div = null;
+ })();
+}
+
+(function(){
+ var html = document.documentElement,
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
+
+ if ( matches ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9 fails this)
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
+ pseudoWorks = false;
+
+ try {
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( document.documentElement, "[test!='']:sizzle" );
+
+ } catch( pseudoError ) {
+ pseudoWorks = true;
+ }
+
+ Sizzle.matchesSelector = function( node, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ if ( !Sizzle.isXML( node ) ) {
+ try {
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+ var ret = matches.call( node, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || !disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9, so check for that
+ node.document && node.document.nodeType !== 11 ) {
+ return ret;
+ }
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle(expr, null, null, [node]).length > 0;
+ };
+ }
+})();
+
+(function(){
+ var div = document.createElement("div");
+
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+ return;
+ }
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 ) {
+ return;
+ }
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function( match, context, isXML ) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+
+ // release memory in IE
+ div = null;
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem[ expando ] === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem[ expando ] = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName.toLowerCase() === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem[ expando ] === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem[ expando ] = doneName;
+ elem.sizset = i;
+ }
+
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+if ( document.documentElement.contains ) {
+ Sizzle.contains = function( a, b ) {
+ return a !== b && (a.contains ? a.contains(b) : true);
+ };
+
+} else if ( document.documentElement.compareDocumentPosition ) {
+ Sizzle.contains = function( a, b ) {
+ return !!(a.compareDocumentPosition(b) & 16);
+ };
+
+} else {
+ Sizzle.contains = function() {
+ return false;
+ };
+}
+
+Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function( selector, context, seed ) {
+ var match,
+ tmpSet = [],
+ later = "",
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet, seed );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+Sizzle.selectors.attrMap = {};
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})();
+
+
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ slice = Array.prototype.slice,
+ POS = jQuery.expr.match.globalPOS,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var self = this,
+ i, l;
+
+ if ( typeof selector !== "string" ) {
+ return jQuery( selector ).filter(function() {
+ for ( i = 0, l = self.length; i < l; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ });
+ }
+
+ var ret = this.pushStack( "", "find", selector ),
+ length, n, r;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( n = length; n < ret.length; n++ ) {
+ for ( r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ POS.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var ret = [], i, l, cur = this[0];
+
+ // Array (deprecated as of jQuery 1.7)
+ if ( jQuery.isArray( selectors ) ) {
+ var level = 1;
+
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( i = 0; i < selectors.length; i++ ) {
+
+ if ( jQuery( cur ).is( selectors[ i ] ) ) {
+ ret.push({ selector: selectors[ i ], elem: cur, level: level });
+ }
+ }
+
+ cur = cur.parentNode;
+ level++;
+ }
+
+ return ret;
+ }
+
+ // String
+ var pos = POS.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+
+ } else {
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
+ break;
+ }
+ }
+ }
+ }
+
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, slice.call( arguments ).join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+
+
+
+
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style)/i,
+ rnocache = /<(?:script|object|embed|option|style)/i,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /\/(java|ecma)script/i,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ area: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ },
+ safeFragment = createSafeFragment( document );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE can't serialize <link> and <script> tags normally
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
+}
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ } else if ( arguments.length ) {
+ var set = jQuery.clean( arguments );
+ set.push.apply( set, this.toArray() );
+ return this.pushStack( set, "before", arguments );
+ }
+ },
+
+ after: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ } else if ( arguments.length ) {
+ var set = this.pushStack( this, "after", arguments );
+ set.push.apply( set, jQuery.clean(arguments) );
+ return set;
+ }
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ jQuery.cleanData( [ elem ] );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ null;
+ }
+
+
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName( "*" ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ if ( this[0] && this[0].parentNode ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this), old = self.html();
+ self.replaceWith( value.call( this, i, old ) );
+ });
+ }
+
+ if ( typeof value !== "string" ) {
+ value = jQuery( value ).detach();
+ }
+
+ return this.each(function() {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ } else {
+ return this.length ?
+ this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
+ this;
+ }
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+ var results, first, fragment, parent,
+ value = args[0],
+ scripts = [];
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
+ return this.each(function() {
+ jQuery(this).domManip( args, table, callback, true );
+ });
+ }
+
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call(this, i, table ? self.html() : undefined);
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( this[0] ) {
+ parent = value && value.parentNode;
+
+ // If we're in a fragment, just use that instead of building a new one
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+ results = { fragment: parent };
+
+ } else {
+ results = jQuery.buildFragment( args, this, scripts );
+ }
+
+ fragment = results.fragment;
+
+ if ( fragment.childNodes.length === 1 ) {
+ first = fragment = fragment.firstChild;
+ } else {
+ first = fragment.firstChild;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
+ callback.call(
+ table ?
+ root(this[i], first) :
+ this[i],
+ // Make sure that we do not leak memory by inadvertently discarding
+ // the original fragment (which might have attached data) instead of
+ // using it; in addition, use the original fragment object for the last
+ // item instead of first because it can end up being emptied incorrectly
+ // in certain situations (Bug #8070).
+ // Fragments from the fragment cache must always be cloned and never used
+ // in place.
+ results.cacheable || ( l > 1 && i < lastIndex ) ?
+ jQuery.clone( fragment, true, true ) :
+ fragment
+ );
+ }
+ }
+
+ if ( scripts.length ) {
+ jQuery.each( scripts, function( i, elem ) {
+ if ( elem.src ) {
+ jQuery.ajax({
+ type: "GET",
+ global: false,
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+ } else {
+ jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ });
+ }
+ }
+
+ return this;
+ }
+});
+
+function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function cloneFixAttributes( src, dest ) {
+ var nodeName;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ // clearAttributes removes the attributes, which we don't want,
+ // but also removes the attachEvent events, which we *do* want
+ if ( dest.clearAttributes ) {
+ dest.clearAttributes();
+ }
+
+ // mergeAttributes, in contrast, only merges back on the
+ // original attributes, not the events
+ if ( dest.mergeAttributes ) {
+ dest.mergeAttributes( src );
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 fail to clone children inside object elements that use
+ // the proprietary classid attribute value (rather than the type
+ // attribute) to identify the type of content to display
+ if ( nodeName === "object" ) {
+ dest.outerHTML = src.outerHTML;
+
+ } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+ if ( src.checked ) {
+ dest.defaultChecked = dest.checked = src.checked;
+ }
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+
+ // IE blanks contents when cloning scripts
+ } else if ( nodeName === "script" && dest.text !== src.text ) {
+ dest.text = src.text;
+ }
+
+ // Event data gets referenced instead of copied if the expando
+ // gets copied too
+ dest.removeAttribute( jQuery.expando );
+
+ // Clear flags for bubbling special change/submit events, they must
+ // be reattached when the newly cloned events are first activated
+ dest.removeAttribute( "_submit_attached" );
+ dest.removeAttribute( "_change_attached" );
+}
+
+jQuery.buildFragment = function( args, nodes, scripts ) {
+ var fragment, cacheable, cacheresults, doc,
+ first = args[ 0 ];
+
+ // nodes may contain either an explicit document object,
+ // a jQuery collection or context object.
+ // If nodes[0] contains a valid object to assign to doc
+ if ( nodes && nodes[0] ) {
+ doc = nodes[0].ownerDocument || nodes[0];
+ }
+
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
+ // Chrome and Firefox seem to allow this to occur and will throw exception
+ // Fixes #8950
+ if ( !doc.createDocumentFragment ) {
+ doc = document;
+ }
+
+ // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
+ // Cloning options loses the selected state, so don't cache them
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+ // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
+ if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
+ first.charAt(0) === "<" && !rnocache.test( first ) &&
+ (jQuery.support.checkClone || !rchecked.test( first )) &&
+ (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
+
+ cacheable = true;
+
+ cacheresults = jQuery.fragments[ first ];
+ if ( cacheresults && cacheresults !== 1 ) {
+ fragment = cacheresults;
+ }
+ }
+
+ if ( !fragment ) {
+ fragment = doc.createDocumentFragment();
+ jQuery.clean( args, doc, fragment, scripts );
+ }
+
+ if ( cacheable ) {
+ jQuery.fragments[ first ] = cacheresults ? fragment : 1;
+ }
+
+ return { fragment: fragment, cacheable: cacheable };
+};
+
+jQuery.fragments = {};
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [],
+ insert = jQuery( selector ),
+ parent = this.length === 1 && this[0].parentNode;
+
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ insert[ original ]( this[0] );
+ return this;
+
+ } else {
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = ( i > 0 ? this.clone(true) : this ).get();
+ jQuery( insert[i] )[ original ]( elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, insert.selector );
+ }
+ };
+});
+
+function getAll( elem ) {
+ if ( typeof elem.getElementsByTagName !== "undefined" ) {
+ return elem.getElementsByTagName( "*" );
+
+ } else if ( typeof elem.querySelectorAll !== "undefined" ) {
+ return elem.querySelectorAll( "*" );
+
+ } else {
+ return [];
+ }
+}
+
+// Used in clean, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( elem.type === "checkbox" || elem.type === "radio" ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+// Finds all inputs and passes them to fixDefaultChecked
+function findInputs( elem ) {
+ var nodeName = ( elem.nodeName || "" ).toLowerCase();
+ if ( nodeName === "input" ) {
+ fixDefaultChecked( elem );
+ // Skip scripts, get other children
+ } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
+ jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
+ }
+}
+
+// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
+function shimCloneNode( elem ) {
+ var div = document.createElement( "div" );
+ safeFragment.appendChild( div );
+
+ div.innerHTML = elem.outerHTML;
+ return div.firstChild;
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var srcElements,
+ destElements,
+ i,
+ // IE<=8 does not properly clone detached, unknown element nodes
+ clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
+ elem.cloneNode( true ) :
+ shimCloneNode( elem );
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+ // IE copies events bound via attachEvent when using cloneNode.
+ // Calling detachEvent on the clone will also remove the events
+ // from the original. In order to get around this, we use some
+ // proprietary methods to clear the events. Thanks to MooTools
+ // guys for this hotness.
+
+ cloneFixAttributes( elem, clone );
+
+ // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
+ srcElements = getAll( elem );
+ destElements = getAll( clone );
+
+ // Weird iteration because IE will replace the length property
+ // with an element if you are cloning the body and one of the
+ // elements on the page has a name or id of "length"
+ for ( i = 0; srcElements[i]; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ cloneFixAttributes( srcElements[i], destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ cloneCopyEvent( elem, clone );
+
+ if ( deepDataAndEvents ) {
+ srcElements = getAll( elem );
+ destElements = getAll( clone );
+
+ for ( i = 0; srcElements[i]; ++i ) {
+ cloneCopyEvent( srcElements[i], destElements[i] );
+ }
+ }
+ }
+
+ srcElements = destElements = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ clean: function( elems, context, fragment, scripts ) {
+ var checkScriptType, script, j,
+ ret = [];
+
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" ) {
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+ }
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( typeof elem === "number" ) {
+ elem += "";
+ }
+
+ if ( !elem ) {
+ continue;
+ }
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" ) {
+ if ( !rhtml.test( elem ) ) {
+ elem = context.createTextNode( elem );
+ } else {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
+ wrap = wrapMap[ tag ] || wrapMap._default,
+ depth = wrap[0],
+ div = context.createElement("div"),
+ safeChildNodes = safeFragment.childNodes,
+ remove;
+
+ // Append wrapper element to unknown element safe doc fragment
+ if ( context === document ) {
+ // Use the fragment we've already created for this document
+ safeFragment.appendChild( div );
+ } else {
+ // Use a fragment created with the owner document
+ createSafeFragment( context ).appendChild( div );
+ }
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( depth-- ) {
+ div = div.lastChild;
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = rtbody.test(elem),
+ tbody = tag === "table" && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( j = tbody.length - 1; j >= 0 ; --j ) {
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ }
+ }
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+ }
+
+ elem = div.childNodes;
+
+ // Clear elements from DocumentFragment (safeFragment or otherwise)
+ // to avoid hoarding elements. Fixes #11356
+ if ( div ) {
+ div.parentNode.removeChild( div );
+
+ // Guard against -1 index exceptions in FF3.6
+ if ( safeChildNodes.length > 0 ) {
+ remove = safeChildNodes[ safeChildNodes.length - 1 ];
+
+ if ( remove && remove.parentNode ) {
+ remove.parentNode.removeChild( remove );
+ }
+ }
+ }
+ }
+ }
+
+ // Resets defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ var len;
+ if ( !jQuery.support.appendChecked ) {
+ if ( elem[0] && typeof (len = elem.length) === "number" ) {
+ for ( j = 0; j < len; j++ ) {
+ findInputs( elem[j] );
+ }
+ } else {
+ findInputs( elem );
+ }
+ }
+
+ if ( elem.nodeType ) {
+ ret.push( elem );
+ } else {
+ ret = jQuery.merge( ret, elem );
+ }
+ }
+
+ if ( fragment ) {
+ checkScriptType = function( elem ) {
+ return !elem.type || rscriptType.test( elem.type );
+ };
+ for ( i = 0; ret[i]; i++ ) {
+ script = ret[i];
+ if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
+ scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
+
+ } else {
+ if ( script.nodeType === 1 ) {
+ var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
+
+ ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
+ }
+ fragment.appendChild( script );
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ cleanData: function( elems ) {
+ var data, id,
+ cache = jQuery.cache,
+ special = jQuery.event.special,
+ deleteExpando = jQuery.support.deleteExpando;
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ continue;
+ }
+
+ id = elem[ jQuery.expando ];
+
+ if ( id ) {
+ data = cache[ id ];
+
+ if ( data && data.events ) {
+ for ( var type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+
+ // Null the DOM reference to avoid IE6/7/8 leak (#7054)
+ if ( data.handle ) {
+ data.handle.elem = null;
+ }
+ }
+
+ if ( deleteExpando ) {
+ delete elem[ jQuery.expando ];
+
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
+
+ delete cache[ id ];
+ }
+ }
+ }
+});
+
+
+
+
+var ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity=([^)]*)/,
+ // fixed for IE9, see #8346
+ rupper = /([A-Z]|^ms)/g,
+ rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
+ rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
+ rrelNum = /^([\-+])=([\-+.\de]+)/,
+ rmargin = /^margin/,
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+
+ // order is important!
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+
+ curCSS,
+
+ getComputedStyle,
+ currentStyle;
+
+jQuery.fn.css = function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+};
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+
+ } else {
+ return elem.style.opacity;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, origName = jQuery.camelCase( name ),
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
+
+ name = jQuery.cssProps[ origName ] || origName;
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra ) {
+ var ret, hooks;
+
+ // Make sure that we're working with the right name
+ name = jQuery.camelCase( name );
+ hooks = jQuery.cssHooks[ name ];
+ name = jQuery.cssProps[ name ] || name;
+
+ // cssFloat needs a special treatment
+ if ( name === "cssFloat" ) {
+ name = "float";
+ }
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
+ return ret;
+
+ // Otherwise, if a way to get the computed value exists, use that
+ } else if ( curCSS ) {
+ return curCSS( elem, name );
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {},
+ ret, name;
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.call( elem );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// DEPRECATED in 1.3, Use jQuery.css() instead
+jQuery.curCSS = jQuery.css;
+
+if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ getComputedStyle = function( elem, name ) {
+ var ret, defaultView, computedStyle, width,
+ style = elem.style;
+
+ name = name.replace( rupper, "-$1" ).toLowerCase();
+
+ if ( (defaultView = elem.ownerDocument.defaultView) &&
+ (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
+
+ ret = computedStyle.getPropertyValue( name );
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
+ // which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
+ width = style.width;
+ style.width = ret;
+ ret = computedStyle.width;
+ style.width = width;
+ }
+
+ return ret;
+ };
+}
+
+if ( document.documentElement.currentStyle ) {
+ currentStyle = function( elem, name ) {
+ var left, rsLeft, uncomputed,
+ ret = elem.currentStyle && elem.currentStyle[ name ],
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && (uncomputed = style[ name ]) ) {
+ ret = uncomputed;
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( rnumnonpx.test( ret ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ elem.runtimeStyle.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+curCSS = getComputedStyle || currentStyle;
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ i = name === "width" ? 1 : 0,
+ len = 4;
+
+ if ( val > 0 ) {
+ if ( extra !== "border" ) {
+ for ( ; i < len; i += 2 ) {
+ if ( !extra ) {
+ val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
+ } else {
+ val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+ }
+ }
+ }
+
+ return val + "px";
+ }
+
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+
+ // Add padding, border, margin
+ if ( extra ) {
+ for ( ; i < len; i += 2 ) {
+ val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
+ if ( extra !== "padding" ) {
+ val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
+ }
+ }
+ }
+
+ return val + "px";
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ if ( elem.offsetWidth !== 0 ) {
+ return getWidthOrHeight( elem, name, extra );
+ } else {
+ return jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ });
+ }
+ }
+ },
+
+ set: function( elem, value ) {
+ return rnum.test( value ) ?
+ value + "px" :
+ value;
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( parseFloat( RegExp.$1 ) / 100 ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there there is no filter style applied in a css rule, we are done
+ if ( currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+jQuery(function() {
+ // This hook cannot be added until DOM ready because the support test
+ // for it is not run until after DOM ready
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" }, function() {
+ if ( computed ) {
+ return curCSS( elem, "margin-right" );
+ } else {
+ return elem.style.marginRight;
+ }
+ });
+ }
+ };
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ var width = elem.offsetWidth,
+ height = elem.offsetHeight;
+
+ return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i,
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ],
+ expanded = {};
+
+ for ( i = 0; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+});
+
+
+
+
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rhash = /#.*$/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rquery = /\?/,
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+ rselectTextarea = /^(?:select|textarea)/i,
+ rspacesAjax = /\s+/,
+ rts = /([?&])_=[^&]*/,
+ rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Document location
+ ajaxLocation,
+
+ // Document location segments
+ ajaxLocParts,
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = ["*/"] + ["*"];
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ if ( jQuery.isFunction( func ) ) {
+ var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
+ i = 0,
+ length = dataTypes.length,
+ dataType,
+ list,
+ placeBefore;
+
+ // For each dataType in the dataTypeExpression
+ for ( ; i < length; i++ ) {
+ dataType = dataTypes[ i ];
+ // We control if we're asked to add before
+ // any existing element
+ placeBefore = /^\+/.test( dataType );
+ if ( placeBefore ) {
+ dataType = dataType.substr( 1 ) || "*";
+ }
+ list = structure[ dataType ] = structure[ dataType ] || [];
+ // then we add to the structure accordingly
+ list[ placeBefore ? "unshift" : "push" ]( func );
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
+ dataType /* internal */, inspected /* internal */ ) {
+
+ dataType = dataType || options.dataTypes[ 0 ];
+ inspected = inspected || {};
+
+ inspected[ dataType ] = true;
+
+ var list = structure[ dataType ],
+ i = 0,
+ length = list ? list.length : 0,
+ executeOnly = ( structure === prefilters ),
+ selection;
+
+ for ( ; i < length && ( executeOnly || !selection ); i++ ) {
+ selection = list[ i ]( options, originalOptions, jqXHR );
+ // If we got redirected to another dataType
+ // we try there if executing only and not done already
+ if ( typeof selection === "string" ) {
+ if ( !executeOnly || inspected[ selection ] ) {
+ selection = undefined;
+ } else {
+ options.dataTypes.unshift( selection );
+ selection = inspectPrefiltersOrTransports(
+ structure, options, originalOptions, jqXHR, selection, inspected );
+ }
+ }
+ }
+ // If we're only executing or nothing was selected
+ // we try the catchall dataType if not done already
+ if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
+ selection = inspectPrefiltersOrTransports(
+ structure, options, originalOptions, jqXHR, "*", inspected );
+ }
+ // unnecessary when only executing (prefilters)
+ // but it'll be ignored by the caller in that case
+ return selection;
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+}
+
+jQuery.fn.extend({
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+
+ // Don't do a request if no elements are being requested
+ } else if ( !this.length ) {
+ return this;
+ }
+
+ var off = url.indexOf( " " );
+ if ( off >= 0 ) {
+ var selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params ) {
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( typeof params === "object" ) {
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
+ type = "POST";
+ }
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ // Complete callback (responseText is used internally)
+ complete: function( jqXHR, status, responseText ) {
+ // Store the response as specified by the jqXHR object
+ responseText = jqXHR.responseText;
+ // If successful, inject the HTML into all the matched elements
+ if ( jqXHR.isResolved() ) {
+ // #4825: Get the actual response in case
+ // a dataFilter is present in ajaxSettings
+ jqXHR.done(function( r ) {
+ responseText = r;
+ });
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(responseText.replace(rscript, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ responseText );
+ }
+
+ if ( callback ) {
+ self.each( callback, [ responseText, status, jqXHR ] );
+ }
+ }
+ });
+
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+
+ serializeArray: function() {
+ return this.map(function(){
+ return this.elements ? jQuery.makeArray( this.elements ) : this;
+ })
+ .filter(function(){
+ return this.name && !this.disabled &&
+ ( this.checked || rselectTextarea.test( this.nodeName ) ||
+ rinput.test( this.type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val, i ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
+ jQuery.fn[ o ] = function( f ){
+ return this.on( o, f );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ type: method,
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ };
+});
+
+jQuery.extend({
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ if ( settings ) {
+ // Building a settings object
+ ajaxExtend( target, jQuery.ajaxSettings );
+ } else {
+ // Extending ajaxSettings
+ settings = target;
+ target = jQuery.ajaxSettings;
+ }
+ ajaxExtend( target, settings );
+ return target;
+ },
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ text: "text/plain",
+ json: "application/json, text/javascript",
+ "*": allTypes
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // List of data converters
+ // 1) key format is "source_type destination_type" (a single space in-between)
+ // 2) the catchall symbol "*" can be used for source_type
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ context: true,
+ url: true
+ }
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events
+ // It's the callbackContext if one was provided in the options
+ // and if it's a DOM node or a jQuery collection
+ globalEventContext = callbackContext !== s &&
+ ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
+ jQuery( callbackContext ) : jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks( "once memory" ),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // ifModified key
+ ifModifiedKey,
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // Response headers
+ responseHeadersString,
+ responseHeaders,
+ // transport
+ transport,
+ // timeout handle
+ timeoutTimer,
+ // Cross-domain detection vars
+ parts,
+ // The jqXHR state
+ state = 0,
+ // To know if global events are to be dispatched
+ fireGlobals,
+ // Loop variable
+ i,
+ // Fake xhr
+ jqXHR = {
+
+ readyState: 0,
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ if ( !state ) {
+ var lname = name.toLowerCase();
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while( ( match = rheaders.exec( responseHeadersString ) ) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match === undefined ? null : match;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ statusText = statusText || "abort";
+ if ( transport ) {
+ transport.abort( statusText );
+ }
+ done( 0, statusText );
+ return this;
+ }
+ };
+
+ // Callback for when everything is done
+ // It is defined here because jslint complains if it is declared
+ // at the end of the function (which would be more logical and readable)
+ function done( status, nativeStatusText, responses, headers ) {
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ var isSuccess,
+ success,
+ error,
+ statusText = nativeStatusText,
+ response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
+ lastModified,
+ etag;
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+
+ if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
+ jQuery.lastModified[ ifModifiedKey ] = lastModified;
+ }
+ if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
+ jQuery.etag[ ifModifiedKey ] = etag;
+ }
+ }
+
+ // If not modified
+ if ( status === 304 ) {
+
+ statusText = "notmodified";
+ isSuccess = true;
+
+ // If we have data
+ } else {
+
+ try {
+ success = ajaxConvert( s, response );
+ statusText = "success";
+ isSuccess = true;
+ } catch(e) {
+ // We have a parsererror
+ statusText = "parsererror";
+ error = e;
+ }
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( !statusText || status ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = "" + ( nativeStatusText || statusText );
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ }
+ }
+
+ // Attach deferreds
+ deferred.promise( jqXHR );
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+ jqXHR.complete = completeDeferred.add;
+
+ // Status-dependent callbacks
+ jqXHR.statusCode = function( map ) {
+ if ( map ) {
+ var tmp;
+ if ( state < 2 ) {
+ for ( tmp in map ) {
+ statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
+ }
+ } else {
+ tmp = map[ jqXHR.status ];
+ jqXHR.then( tmp, tmp );
+ }
+ }
+ return this;
+ };
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
+
+ // Determine if a cross-domain request is in order
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return false;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger( "ajaxStart" );
+ }
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Get ifModifiedKey before adding the anti-cache parameter
+ ifModifiedKey = s.url;
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+
+ var ts = jQuery.now(),
+ // try replacing _= if it is there
+ ret = s.url.replace( rts, "$1_=" + ts );
+
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ ifModifiedKey = ifModifiedKey || s.url;
+ if ( jQuery.lastModified[ ifModifiedKey ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
+ }
+ if ( jQuery.etag[ ifModifiedKey ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
+ }
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already
+ jqXHR.abort();
+ return false;
+
+ }
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout( function(){
+ jqXHR.abort( "timeout" );
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch (e) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a, traditional ) {
+ var s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : value;
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( var prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+ }
+});
+
+function buildParams( prefix, obj, traditional, add ) {
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( var name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+
+// This is still on the jQuery object... for now
+// Want to move this to jQuery.ajax some day
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {}
+
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+ var contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields,
+ ct,
+ type,
+ finalDataType,
+ firstDataType;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ var dataTypes = s.dataTypes,
+ converters = {},
+ i,
+ key,
+ length = dataTypes.length,
+ tmp,
+ // Current and previous dataTypes
+ current = dataTypes[ 0 ],
+ prev,
+ // Conversion expression
+ conversion,
+ // Conversion function
+ conv,
+ // Conversion functions (transitive conversion)
+ conv1,
+ conv2;
+
+ // For each dataType in the chain
+ for ( i = 1; i < length; i++ ) {
+
+ // Create converters map
+ // with lowercased keys
+ if ( i === 1 ) {
+ for ( key in s.converters ) {
+ if ( typeof key === "string" ) {
+ converters[ key.toLowerCase() ] = s.converters[ key ];
+ }
+ }
+ }
+
+ // Get the dataTypes
+ prev = current;
+ current = dataTypes[ i ];
+
+ // If current is auto dataType, update it to prev
+ if ( current === "*" ) {
+ current = prev;
+ // If no auto and dataTypes are actually different
+ } else if ( prev !== "*" && prev !== current ) {
+
+ // Get the converter
+ conversion = prev + " " + current;
+ conv = converters[ conversion ] || converters[ "* " + current ];
+
+ // If there is no direct converter, search transitively
+ if ( !conv ) {
+ conv2 = undefined;
+ for ( conv1 in converters ) {
+ tmp = conv1.split( " " );
+ if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
+ conv2 = converters[ tmp[1] + " " + current ];
+ if ( conv2 ) {
+ conv1 = converters[ conv1 ];
+ if ( conv1 === true ) {
+ conv = conv2;
+ } else if ( conv2 === true ) {
+ conv = conv1;
+ }
+ break;
+ }
+ }
+ }
+ }
+ // If we found no converter, dispatch an error
+ if ( !( conv || conv2 ) ) {
+ jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
+ }
+ // If found converter is not an equivalence
+ if ( conv !== true ) {
+ // Convert with 1 or 2 converters accordingly
+ response = conv ? conv( response ) : conv2( conv1(response) );
+ }
+ }
+ }
+ return response;
+}
+
+
+
+
+var jsc = jQuery.now(),
+ jsre = /(\=)\?(&|$)|\?\?/i;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ return jQuery.expando + "_" + ( jsc++ );
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
+
+ if ( s.dataTypes[ 0 ] === "jsonp" ||
+ s.jsonp !== false && ( jsre.test( s.url ) ||
+ inspectData && jsre.test( s.data ) ) ) {
+
+ var responseContainer,
+ jsonpCallback = s.jsonpCallback =
+ jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
+ previous = window[ jsonpCallback ],
+ url = s.url,
+ data = s.data,
+ replace = "$1" + jsonpCallback + "$2";
+
+ if ( s.jsonp !== false ) {
+ url = url.replace( jsre, replace );
+ if ( s.url === url ) {
+ if ( inspectData ) {
+ data = data.replace( jsre, replace );
+ }
+ if ( s.data === data ) {
+ // Add callback manually
+ url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
+ }
+ }
+ }
+
+ s.url = url;
+ s.data = data;
+
+ // Install callback
+ window[ jsonpCallback ] = function( response ) {
+ responseContainer = [ response ];
+ };
+
+ // Clean-up function
+ jqXHR.always(function() {
+ // Set callback back to previous value
+ window[ jsonpCallback ] = previous;
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( previous ) ) {
+ window[ jsonpCallback ]( responseContainer[ 0 ] );
+ }
+ });
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( jsonpCallback + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Delegate to script
+ return "script";
+ }
+});
+
+
+
+
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /javascript|ecmascript/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement( "script" );
+
+ script.async = "async";
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( head && script.parentNode ) {
+ head.removeChild( script );
+ }
+
+ // Dereference the script
+ script = undefined;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709 and #4378).
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( 0, 1 );
+ }
+ }
+ };
+ }
+});
+
+
+
+
+var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject ? function() {
+ // Abort all pending requests
+ for ( var key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( 0, 1 );
+ }
+ } : false,
+ xhrId = 0,
+ xhrCallbacks;
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+(function( xhr ) {
+ jQuery.extend( jQuery.support, {
+ ajax: !!xhr,
+ cors: !!xhr && ( "withCredentials" in xhr )
+ });
+})( jQuery.ajaxSettings.xhr() );
+
+// Create transport if the browser can provide an xhr
+if ( jQuery.support.ajax ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var xhr = s.xhr(),
+ handle,
+ i;
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers[ "X-Requested-With" ] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( _ ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+
+ var status,
+ statusText,
+ responseHeaders,
+ responses,
+ xml;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occured
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+ responses = {};
+ xml = xhr.responseXML;
+
+ // Construct response list
+ if ( xml && xml.documentElement /* #4958 */ ) {
+ responses.xml = xml;
+ }
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ try {
+ responses.text = xhr.responseText;
+ } catch( _ ) {
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ // if we're in sync mode or it's in cache
+ // and has been retrieved directly (IE6 & IE7)
+ // we need to manually fire the callback
+ if ( !s.async || xhr.readyState === 4 ) {
+ callback();
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback(0,1);
+ }
+ }
+ };
+ }
+ });
+}
+
+
+
+
+var elemdisplay = {},
+ iframe, iframeDoc,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ],
+ fxNow;
+
+jQuery.fn.extend({
+ show: function( speed, easing, callback ) {
+ var elem, display;
+
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("show", 3), speed, easing, callback );
+
+ } else {
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.style ) {
+ display = elem.style.display;
+
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
+ display = elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( (display === "" && jQuery.css(elem, "display") === "none") ||
+ !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.style ) {
+ display = elem.style.display;
+
+ if ( display === "" || display === "none" ) {
+ elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
+ }
+ }
+ }
+
+ return this;
+ }
+ },
+
+ hide: function( speed, easing, callback ) {
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("hide", 3), speed, easing, callback);
+
+ } else {
+ var elem, display,
+ i = 0,
+ j = this.length;
+
+ for ( ; i < j; i++ ) {
+ elem = this[i];
+ if ( elem.style ) {
+ display = jQuery.css( elem, "display" );
+
+ if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
+ jQuery._data( elem, "olddisplay", display );
+ }
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ if ( this[i].style ) {
+ this[i].style.display = "none";
+ }
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2, callback ) {
+ var bool = typeof fn === "boolean";
+
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
+ this._toggle.apply( this, arguments );
+
+ } else if ( fn == null || bool ) {
+ this.each(function() {
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ });
+
+ } else {
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
+ }
+
+ return this;
+ },
+
+ fadeTo: function( speed, to, easing, callback ) {
+ return this.filter(":hidden").css("opacity", 0).show().end()
+ .animate({opacity: to}, speed, easing, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed( speed, easing, callback );
+
+ if ( jQuery.isEmptyObject( prop ) ) {
+ return this.each( optall.complete, [ false ] );
+ }
+
+ // Do not change referenced properties as per-property easing will be lost
+ prop = jQuery.extend( {}, prop );
+
+ function doAnimation() {
+ // XXX 'this' does not always have a nodeName when running the
+ // test suite
+
+ if ( optall.queue === false ) {
+ jQuery._mark( this );
+ }
+
+ var opt = jQuery.extend( {}, optall ),
+ isElement = this.nodeType === 1,
+ hidden = isElement && jQuery(this).is(":hidden"),
+ name, val, p, e, hooks, replace,
+ parts, start, end, unit,
+ method;
+
+ // will store per property easing and be used to determine when an animation is complete
+ opt.animatedProperties = {};
+
+ // first pass over propertys to expand / normalize
+ for ( p in prop ) {
+ name = jQuery.camelCase( p );
+ if ( p !== name ) {
+ prop[ name ] = prop[ p ];
+ delete prop[ p ];
+ }
+
+ if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
+ replace = hooks.expand( prop[ name ] );
+ delete prop[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'p' from above because we have the correct "name"
+ for ( p in replace ) {
+ if ( ! ( p in prop ) ) {
+ prop[ p ] = replace[ p ];
+ }
+ }
+ }
+ }
+
+ for ( name in prop ) {
+ val = prop[ name ];
+ // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
+ if ( jQuery.isArray( val ) ) {
+ opt.animatedProperties[ name ] = val[ 1 ];
+ val = prop[ name ] = val[ 0 ];
+ } else {
+ opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
+ }
+
+ if ( val === "hide" && hidden || val === "show" && !hidden ) {
+ return opt.complete.call( this );
+ }
+
+ if ( isElement && ( name === "height" || name === "width" ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( this, "display" ) === "inline" &&
+ jQuery.css( this, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
+ this.style.display = "inline-block";
+
+ } else {
+ this.style.zoom = 1;
+ }
+ }
+ }
+ }
+
+ if ( opt.overflow != null ) {
+ this.style.overflow = "hidden";
+ }
+
+ for ( p in prop ) {
+ e = new jQuery.fx( this, opt, p );
+ val = prop[ p ];
+
+ if ( rfxtypes.test( val ) ) {
+
+ // Tracks whether to show or hide based on private
+ // data attached to the element
+ method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
+ if ( method ) {
+ jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
+ e[ method ]();
+ } else {
+ e[ val ]();
+ }
+
+ } else {
+ parts = rfxnum.exec( val );
+ start = e.cur();
+
+ if ( parts ) {
+ end = parseFloat( parts[2] );
+ unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" ) {
+ jQuery.style( this, p, (end || 1) + unit);
+ start = ( (end || 1) / e.cur() ) * start;
+ jQuery.style( this, p, start + unit);
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] ) {
+ end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
+ }
+
+ e.custom( start, end, unit );
+
+ } else {
+ e.custom( start, val, "" );
+ }
+ }
+ }
+
+ // For JS strict compliance
+ return true;
+ }
+
+ return optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+
+ stop: function( type, clearQueue, gotoEnd ) {
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var index,
+ hadTimers = false,
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ // clear marker counters if we know they won't be
+ if ( !gotoEnd ) {
+ jQuery._unmark( true, this );
+ }
+
+ function stopQueue( elem, data, index ) {
+ var hooks = data[ index ];
+ jQuery.removeData( elem, index, true );
+ hooks.stop( gotoEnd );
+ }
+
+ if ( type == null ) {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
+ stopQueue( this, data, index );
+ }
+ }
+ } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
+ stopQueue( this, data, index );
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ if ( gotoEnd ) {
+
+ // force the next step to be the last
+ timers[ index ]( true );
+ } else {
+ timers[ index ].saveState();
+ }
+ hadTimers = true;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( !( gotoEnd && hadTimers ) ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ }
+
+});
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout( clearFxNow, 0 );
+ return ( fxNow = jQuery.now() );
+}
+
+function clearFxNow() {
+ fxNow = undefined;
+}
+
+// Generate parameters to create a standard animation
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx( "show", 1 ),
+ slideUp: genFx( "hide", 1 ),
+ slideToggle: genFx( "toggle", 1 ),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.extend({
+ speed: function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function( noUnmark ) {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ } else if ( noUnmark !== false ) {
+ jQuery._unmark( this );
+ }
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ) {
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ options.orig = options.orig || {};
+ }
+
+});
+
+jQuery.fx.prototype = {
+ // Simple function for setting a style value
+ update: function() {
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
+ },
+
+ // Get the current size
+ cur: function() {
+ if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
+ return this.elem[ this.prop ];
+ }
+
+ var parsed,
+ r = jQuery.css( this.elem, this.prop );
+ // Empty strings, null, undefined and "auto" are converted to 0,
+ // complex values such as "rotate(1rad)" are returned as is,
+ // simple values such as "10px" are parsed to Float.
+ return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
+ },
+
+ // Start an animation from one number to another
+ custom: function( from, to, unit ) {
+ var self = this,
+ fx = jQuery.fx;
+
+ this.startTime = fxNow || createFxNow();
+ this.end = to;
+ this.now = this.start = from;
+ this.pos = this.state = 0;
+ this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
+
+ function t( gotoEnd ) {
+ return self.step( gotoEnd );
+ }
+
+ t.queue = this.options.queue;
+ t.elem = this.elem;
+ t.saveState = function() {
+ if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
+ if ( self.options.hide ) {
+ jQuery._data( self.elem, "fxshow" + self.prop, self.start );
+ } else if ( self.options.show ) {
+ jQuery._data( self.elem, "fxshow" + self.prop, self.end );
+ }
+ }
+ };
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval( fx.tick, fx.interval );
+ }
+ },
+
+ // Simple 'show' function
+ show: function() {
+ var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
+
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any flash of content
+ if ( dataShow !== undefined ) {
+ // This show is picking up where a previous hide or show left off
+ this.custom( this.cur(), dataShow );
+ } else {
+ this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
+ }
+
+ // Start by showing the element
+ jQuery( this.elem ).show();
+ },
+
+ // Simple 'hide' function
+ hide: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom( this.cur(), 0 );
+ },
+
+ // Each step of an animation
+ step: function( gotoEnd ) {
+ var p, n, complete,
+ t = fxNow || createFxNow(),
+ done = true,
+ elem = this.elem,
+ options = this.options;
+
+ if ( gotoEnd || t >= options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ options.animatedProperties[ this.prop ] = true;
+
+ for ( p in options.animatedProperties ) {
+ if ( options.animatedProperties[ p ] !== true ) {
+ done = false;
+ }
+ }
+
+ if ( done ) {
+ // Reset the overflow
+ if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
+
+ jQuery.each( [ "", "X", "Y" ], function( index, value ) {
+ elem.style[ "overflow" + value ] = options.overflow[ index ];
+ });
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( options.hide ) {
+ jQuery( elem ).hide();
+ }
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( options.hide || options.show ) {
+ for ( p in options.animatedProperties ) {
+ jQuery.style( elem, p, options.orig[ p ] );
+ jQuery.removeData( elem, "fxshow" + p, true );
+ // Toggle data is no longer needed
+ jQuery.removeData( elem, "toggle" + p, true );
+ }
+ }
+
+ // Execute the complete function
+ // in the event that the complete function throws an exception
+ // we must ensure it won't be called twice. #5684
+
+ complete = options.complete;
+ if ( complete ) {
+
+ options.complete = false;
+ complete.call( elem );
+ }
+ }
+
+ return false;
+
+ } else {
+ // classical easing cannot be used with an Infinity duration
+ if ( options.duration == Infinity ) {
+ this.now = t;
+ } else {
+ n = t - this.startTime;
+ this.state = n / options.duration;
+
+ // Perform the easing function, defaults to swing
+ this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
+ this.now = this.start + ( (this.end - this.start) * this.pos );
+ }
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+};
+
+jQuery.extend( jQuery.fx, {
+ tick: function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ },
+
+ interval: 13,
+
+ stop: function() {
+ clearInterval( timerId );
+ timerId = null;
+ },
+
+ speeds: {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+
+ step: {
+ opacity: function( fx ) {
+ jQuery.style( fx.elem, "opacity", fx.now );
+ },
+
+ _default: function( fx ) {
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ } else {
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+ }
+});
+
+// Ensure props that can't be negative don't go there on undershoot easing
+jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
+ // exclude marginTop, marginLeft, marginBottom and marginRight from this list
+ if ( prop.indexOf( "margin" ) ) {
+ jQuery.fx.step[ prop ] = function( fx ) {
+ jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
+ };
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+
+// Try to restore the default display value of an element
+function defaultDisplay( nodeName ) {
+
+ if ( !elemdisplay[ nodeName ] ) {
+
+ var body = document.body,
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
+ display = elem.css( "display" );
+ elem.remove();
+
+ // If the simple way fails,
+ // get element's real default display by attaching it to a temp iframe
+ if ( display === "none" || display === "" ) {
+ // No iframe to use yet, so create it
+ if ( !iframe ) {
+ iframe = document.createElement( "iframe" );
+ iframe.frameBorder = iframe.width = iframe.height = 0;
+ }
+
+ body.appendChild( iframe );
+
+ // Create a cacheable copy of the iframe document on first call.
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
+ if ( !iframeDoc || !iframe.createElement ) {
+ iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
+ iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
+ iframeDoc.close();
+ }
+
+ elem = iframeDoc.createElement( nodeName );
+
+ iframeDoc.body.appendChild( elem );
+
+ display = jQuery.css( elem, "display" );
+ body.removeChild( iframe );
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return elemdisplay[ nodeName ];
+}
+
+
+
+
+var getOffset,
+ rtable = /^t(?:able|d|h)$/i,
+ rroot = /^(?:body|html)$/i;
+
+if ( "getBoundingClientRect" in document.documentElement ) {
+ getOffset = function( elem, doc, docElem, box ) {
+ try {
+ box = elem.getBoundingClientRect();
+ } catch(e) {}
+
+ // Make sure we're not dealing with a disconnected DOM node
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
+ return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
+ }
+
+ var body = doc.body,
+ win = getWindow( doc ),
+ clientTop = docElem.clientTop || body.clientTop || 0,
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
+ scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
+ top = box.top + scrollTop - clientTop,
+ left = box.left + scrollLeft - clientLeft;
+
+ return { top: top, left: left };
+ };
+
+} else {
+ getOffset = function( elem, doc, docElem ) {
+ var computedStyle,
+ offsetParent = elem.offsetParent,
+ prevOffsetParent = elem,
+ body = doc.body,
+ defaultView = doc.defaultView,
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
+ top = elem.offsetTop,
+ left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
+ break;
+ }
+
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
+ top -= elem.scrollTop;
+ left -= elem.scrollLeft;
+
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop;
+ left += elem.offsetLeft;
+
+ if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevOffsetParent = offsetParent;
+ offsetParent = elem.offsetParent;
+ }
+
+ if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
+ top += body.offsetTop;
+ left += body.offsetLeft;
+ }
+
+ if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
+ top += Math.max( docElem.scrollTop, body.scrollTop );
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
+ }
+
+ return { top: top, left: left };
+ };
+}
+
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var elem = this[0],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return null;
+ }
+
+ if ( elem === doc.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ return getOffset( elem, doc, doc.documentElement );
+};
+
+jQuery.offset = {
+
+ bodyOffset: function( body ) {
+ var top = body.offsetTop,
+ left = body.offsetLeft;
+
+ if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
+ }
+
+ return { top: top, left: left };
+ },
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[0] ) {
+ return null;
+ }
+
+ var elem = this[0],
+
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
+
+ // Add offsetParent borders
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
+
+ // Subtract the two offsets
+ return {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.body;
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
+ win.document.body[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+
+
+
+
+// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ var clientProp = "client" + name,
+ scrollProp = "scroll" + name,
+ offsetProp = "offset" + name;
+
+ // innerHeight and innerWidth
+ jQuery.fn[ "inner" + name ] = function() {
+ var elem = this[0];
+ return elem ?
+ elem.style ?
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
+ this[ type ]() :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn[ "outer" + name ] = function( margin ) {
+ var elem = this[0];
+ return elem ?
+ elem.style ?
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
+ this[ type ]() :
+ null;
+ };
+
+ jQuery.fn[ type ] = function( value ) {
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc, docElemProp, orig, ret;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
+ doc = elem.document;
+ docElemProp = doc.documentElement[ clientProp ];
+ return jQuery.support.boxModel && docElemProp ||
+ doc.body && doc.body[ clientProp ] || docElemProp;
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ doc = elem.documentElement;
+
+ // when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
+ // so we can't use max, as it'll choose the incorrect offset[Width/Height]
+ // instead we use the correct client[Width/Height]
+ // support:IE6
+ if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
+ return doc[ clientProp ];
+ }
+
+ return Math.max(
+ elem.body[ scrollProp ], doc[ scrollProp ],
+ elem.body[ offsetProp ], doc[ offsetProp ]
+ );
+ }
+
+ // Get width or height on the element
+ if ( value === undefined ) {
+ orig = jQuery.css( elem, type );
+ ret = parseFloat( orig );
+ return jQuery.isNumeric( ret ) ? ret : orig;
+ }
+
+ // Set the width or height on the element
+ jQuery( elem ).css( type, value );
+ }, type, value, arguments.length, null );
+ };
+});
+
+
+
+
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+
+
+})( window );
diff --git a/src/components/HMI/lib/jquery-1.7.2.min.js b/src/components/HMI/lib/jquery-1.7.2.min.js
new file mode 100644
index 0000000000..1775c9c031
--- /dev/null
+++ b/src/components/HMI/lib/jquery-1.7.2.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.7.2 jquery.com | jquery.org/license */
+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(
+a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f
+.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file
diff --git a/src/components/HMI/locale/eng.js b/src/components/HMI/locale/eng.js
new file mode 100644
index 0000000000..75c7e200d1
--- /dev/null
+++ b/src/components/HMI/locale/eng.js
@@ -0,0 +1,62 @@
+SDL.eng = {
+
+ view_warning: 'WARNING!',
+ view_warning_paragraph1: 'This application is intended to be used as a demonstrative aid only, while the vehicle is parked. Don&apos;t use it while driving.',
+ view_warning_paragraph2: 'Use extreme caution when using any device that takes your attention off the road. Ford recommends against the use of any hand-held device while driving and that you comply with all applicable laws. Your primary responsibility is the safe operation of the vehicle.',
+
+ view_mediaStatus_entertainment: 'Entertainment',
+
+ view_info_alerts_sort: 'Sort By',
+
+ view_info_alerts_dateIcon: [
+ 'Date', 'Icon'
+ ],
+ view_info_alerts_911Assist: '911 Assist Set To OFF 2012',
+ view_info_alerts_view: 'View',
+ view_info_alerts_delete: 'Delete',
+ view_info_alerts_deleteAll: 'Delete All',
+ view_info_apps_911Assist: '911 Assist',
+ view_info_apps_vehicle_VehicleHealthReport: 'Vehicle Health Report',
+ view_info_apps_vehicle_InstallApplicationsUp: 'Install Applications/Up',
+ view_info_apps_vehicle_FindNewApplications: 'Find New Apps',
+ view_info_apps_vehicle_GetDeviceList: 'Change Devices',
+
+ view_info_calendar_date: 'Jul, 2012',
+ view_info_calendar_today: 'Go to Today',
+ view_info_calendar_day1: 'SUN',
+ view_info_calendar_day2: 'MON',
+ view_info_calendar_day3: 'TUE',
+ view_info_calendar_day4: 'WED',
+ view_info_calendar_day5: 'THU',
+ view_info_calendar_day6: 'FRI',
+ view_info_calendar_day7: 'SAT',
+
+ view_info_services_syncServices: 'SYNC Services',
+ view_info_services_trafficDirectionsAndInformation: 'TRAFFIC, DIRECTIONS AND INFORMATION',
+ view_info_services_getTheLatestTrafficRreport: 'Get the latest traffic report',
+ view_info_services_findBusinessesAndDownloadSaved: 'Find Businesses and Download Saved ',
+ view_info_services_hearPersonalizedInformationMore: 'Hear Personalized Information & More',
+ view_info_services_connecttoServices: 'Connect to Services',
+ view_info_services_toActivate: 'To activate, log onto www.SyncMyRide.com',
+
+ view_info_travelLink_trafficOnRoute: 'Traffic on Route',
+ view_info_travelLink_trafficNearby: 'Traffic Nearby',
+ view_info_travelLink_fuelPrices: 'Fuel Prices',
+ view_info_travelLink_movieListings: 'Movie Listings',
+ view_info_travelLink_subscriptionInfo: 'Subscription Info',
+ view_info_travelLink_weather: 'Weather',
+ view_info_travelLink_sportsInfo: 'Sports Info',
+ view_info_travelLink_skiConditions: 'Ski Conditions',
+
+ view_info_leftmenu_services: 'Services',
+ view_info_leftmenu_travelLink: 'Travel Link',
+ view_info_leftmenu_alerts: 'Alerts',
+ view_info_leftmenu_calendar: 'Calendar',
+ view_info_leftmenu_apps: 'Apps',
+
+ view_media_cd: 'CD',
+ view_phone_dial: 'Dial',
+ view_phone_end: 'End',
+ view_phone_phone: 'Phone',
+ view_phone_popUp_callEnded: 'Call Ended'
+}; \ No newline at end of file
diff --git a/src/components/HMI/locale/locale.js b/src/components/HMI/locale/locale.js
new file mode 100644
index 0000000000..486fe75260
--- /dev/null
+++ b/src/components/HMI/locale/locale.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: ·
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. · Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. · Neither the name of the Ford Motor Company nor the
+ * names of its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @name SDL.locale
+ * @desc SDL localization object
+ * @category Localization
+ * @filesource locale/locale.js
+ * @version 1.0
+ */
+
+SDL.locale = Em.Object.create( {
+
+ label: SDL[SDL.localization],
+
+ setLang: function(lang) {
+
+ this.set('label', SDL[SDL.localization]);
+ }.observes('SDL.localization')
+}); \ No newline at end of file