537 if(_this.currentMode == "SEARCH" && _this.playerIsReady) |
535 if(_this.currentMode == "SEARCH" && _this.playerIsReady) |
538 { |
536 { |
539 _this.player.widgets[0].searchByGesture(gesture_match); |
537 _this.player.widgets[0].searchByGesture(gesture_match); |
540 _this.isCurrentlyInASearchByGesture = _this.player.widgets[0].isCurrentlyInASearchByGesture; |
538 _this.isCurrentlyInASearchByGesture = _this.player.widgets[0].isCurrentlyInASearchByGesture; |
541 |
539 |
542 $('.notifications').remove(); |
540 if(_this.player && _this.player.widgets[0] && _this.timeToGoAt[_this.centerId] === 0 && _this.player.widgets[0].atLeastOneSearchMarker(_this.currentSearchGesture[_this.centerId])) |
|
541 { |
|
542 _this.player.widgets[0].goToFirstSearchedMarker(_this.currentSearchGesture[_this.centerId]); |
|
543 } |
|
544 |
|
545 _this.removeNotifications(); |
|
546 _this.currentSearchGesture[_this.centerId] = gesture_match; |
543 _this.searchGesture(gesture_match, 'valid'); |
547 _this.searchGesture(gesture_match, 'valid'); |
544 _this.curvesGesturesFound = false; |
548 _this.curvesGesturesFound = false; |
545 } |
549 } |
546 else if(_this.currentMode == "FILTER") |
550 else if(_this.currentMode == "FILTER") |
547 { |
551 { |
548 if(_this.isMosaicFiltered) |
552 if(_this.isMosaicFiltered) |
549 { |
553 { |
550 $('.notifications').remove(); |
554 _this.removeNotifications(); |
551 _this.filterSearchedType = gesture_match; |
555 _this.filterSearchedType = gesture_match; |
552 _this.filterGesture(gesture_match, 'valid'); |
556 _this.filterGesture(gesture_match, 'valid'); |
553 _this.searchFilter(gesture_match); |
557 _this.searchFilter(gesture_match); |
554 _this.curvesGesturesFound = false; |
558 _this.curvesGesturesFound = false; |
555 } |
559 } |
730 //Si il y a plus d'un snapshot à afficher, on entre dans le mode INCOMING avec en paramètre le nombre à afficher. |
733 //Si il y a plus d'un snapshot à afficher, on entre dans le mode INCOMING avec en paramètre le nombre à afficher. |
731 if(n > 1 && n < this.config['imagesToShow']) |
734 if(n > 1 && n < this.config['imagesToShow']) |
732 { |
735 { |
733 this.currentMode = "INCOMING-" + n; |
736 this.currentMode = "INCOMING-" + n; |
734 this.unzoom(); |
737 this.unzoom(); |
735 this.currentSearchGesture = ''; |
738 |
736 $('.notifications').remove(); |
739 for(var i = 0 ; i < this.config['imagesToShow'] ; i++) |
|
740 { |
|
741 this.currentSearchGesture[i] = ''; |
|
742 } |
|
743 |
|
744 this.removeNotifications(); |
737 this.isMosaicFiltered = false; |
745 this.isMosaicFiltered = false; |
738 this.isCurrentlyInASearchByGesture = false; |
746 this.isCurrentlyInASearchByGesture = false; |
739 $('#mainPointer').fadeTo(this.config['timePrezoom'], 0); |
747 $('#mainPointer').fadeTo(this.config['timePrezoom'], 0); |
740 $('#secondPointer').fadeTo(this.config['timePrezoom'], 0); |
748 $('#secondPointer').fadeTo(this.config['timePrezoom'], 0); |
741 $('#spinner').remove(); |
749 $('#spinner').remove(); |
867 { |
875 { |
868 if(this.player && this.player.widgets && this.playerIsReady && !this.isSwipe) |
876 if(this.player && this.player.widgets && this.playerIsReady && !this.isSwipe) |
869 { |
877 { |
870 this.isSwipe = true; |
878 this.isSwipe = true; |
871 |
879 |
872 if(this.currentMode == 'SEARCH' && this.isMosaicFiltered && !this.player.widgets[0].isAMarkerAhead(this.currentSearchGesture)) |
880 if(this.currentMode == 'SEARCH' && this.isMosaicFiltered && !this.player.widgets[0].isAMarkerAhead(this.currentSearchGesture[this.centerId])) |
873 { |
881 { |
874 this.playNextVideo(); |
882 this.playNextVideo(); |
875 } |
883 } |
876 |
884 |
877 //L'utilisateur a fait un swipe left. |
885 //L'utilisateur a fait un swipe left. |
878 if(event.indexOf("LEFT") != -1) |
886 if(event.indexOf("LEFT") != -1) |
879 { |
887 { |
880 this.player.widgets[0].switchToMarker(true, this.currentSearchGesture); |
888 this.player.widgets[0].switchToMarker(true, this.currentSearchGesture[this.centerId]); |
881 if(this.currentMode == 'VIDEO') |
889 if(this.currentMode == 'VIDEO') |
882 { |
890 { |
883 $('.notifications').remove(); |
891 this.removeNotifications(); |
884 this.videoSwipe('left'); |
892 this.videoSwipe('left'); |
885 } |
893 } |
886 else if(this.currentMode == 'SEARCH' && !this.currentSearchGesture) |
894 else if(this.currentMode == 'SEARCH' && !this.currentSearchGesture[this.centerId]) |
887 { |
895 { |
888 $('.notifications').remove(); |
896 this.removeNotifications(); |
889 this.searchSearchAndSwipe('left'); |
897 this.searchSearchAndSwipe('left'); |
890 } |
898 } |
891 else if(this.currentMode == 'SEARCH' && this.currentSearchGesture) |
899 else if(this.currentMode == 'SEARCH' && this.currentSearchGesture[this.centerId]) |
892 { |
900 { |
893 $('.notifications').remove(); |
901 this.removeNotifications(); |
894 this.searchGestureAndSwipe(this.currentSearchGesture, 'valid', 'left'); |
902 this.searchGestureAndSwipe(this.currentSearchGesture[this.centerId], 'valid', 'left'); |
895 } |
903 } |
896 } |
904 } |
897 //L'utilisateur a fait un swipe right. |
905 //L'utilisateur a fait un swipe right. |
898 else if(event.indexOf("RIGHT") != -1) |
906 else if(event.indexOf("RIGHT") != -1) |
899 { |
907 { |
900 this.player.widgets[0].switchToMarker(false, this.currentSearchGesture); |
908 this.player.widgets[0].switchToMarker(false, this.currentSearchGesture[this.centerId]); |
901 if(this.currentMode == 'VIDEO') |
909 if(this.currentMode == 'VIDEO') |
902 { |
910 { |
903 $('.notifications').remove(); |
911 this.removeNotifications(); |
904 this.videoSwipe('right'); |
912 this.videoSwipe('right'); |
905 } |
913 } |
906 else if(this.currentMode == 'SEARCH' && !this.currentSearchGesture) |
914 else if(this.currentMode == 'SEARCH' && !this.currentSearchGesture[this.centerId]) |
907 { |
915 { |
908 $('.notifications').remove(); |
916 this.removeNotifications(); |
909 this.searchSearchAndSwipe('right'); |
917 this.searchSearchAndSwipe('right'); |
910 } |
918 } |
911 else if(this.currentMode == 'SEARCH' && this.currentSearchGesture) |
919 else if(this.currentMode == 'SEARCH' && this.currentSearchGesture[this.centerId]) |
912 { |
920 { |
913 $('.notifications').remove(); |
921 this.removeNotifications(); |
914 this.searchGestureAndSwipe(this.currentSearchGesture, 'valid', 'right'); |
922 this.searchGestureAndSwipe(this.currentSearchGesture[this.centerId], 'valid', 'right'); |
915 } |
923 } |
916 } |
924 } |
917 |
925 |
918 //On le fait disparaitre au bout d'un certain temps. |
926 //On le fait disparaitre au bout d'un certain temps. |
919 this.notifySwipeTimeout = setTimeout(function() |
927 this.notifySwipeTimeout = setTimeout(function() |
920 { |
928 { |
921 _this.isSwipe = false; |
929 _this.isSwipe = false; |
922 |
930 |
923 // /!\ // |
931 // /!\ // |
924 $('.notifications').remove(); |
932 _this.removeNotifications(); |
925 |
933 |
926 if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture) |
934 if(_this.currentMode == 'SEARCH' && !_this.currentSearchGesture[_this.centerId]) |
927 { |
935 { |
928 _this.searchSearch(); |
936 _this.searchSearch(); |
929 } |
937 } |
930 else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture) |
938 else if(_this.currentMode == 'SEARCH' && _this.currentSearchGesture[_this.centerId]) |
931 { |
939 { |
932 _this.searchGesture(_this.currentSearchGesture, 'valid'); |
940 _this.searchGesture(_this.currentSearchGesture[_this.centerId], 'valid'); |
933 } |
941 } |
934 |
942 |
935 }, this.config['timeoutNotifySwipe']); |
943 }, this.config['timeoutNotifySwipe']); |
936 } |
944 } |
937 } |
945 } |
938 else if(event.indexOf("BEND") != -1 || event.indexOf('KNEE-UP') != -1 || event.indexOf('FALL') != -1 || event.indexOf('JUMP') != -1) |
946 else if(event.indexOf("BEND") != -1 || event.indexOf('KNEE-UP') != -1 || event.indexOf('FALL') != -1 || event.indexOf('JUMP') != -1) |
939 { |
947 { |
940 gestureReceived = event.toLowerCase(); |
948 gestureReceived = event.toLowerCase(); |
941 gestureReceived = gestureReceived.replace('wave', 'hello'); |
949 gestureReceived = gestureReceived.replace('wave', 'hello'); |
942 this.currentSearchGesture = gestureReceived; |
950 this.currentSearchGesture[centerId] = gestureReceived; |
943 } |
951 } |
944 else if(event.indexOf("HELLO") != -1 && this.canNotifyHelp && !this.areBothPointersHere) |
952 else if(event.indexOf("HELLO") != -1 && this.canNotifyHelp && !this.areBothPointersHere) |
945 { |
953 { |
946 if(this.currentMode == 'SEARCH') |
954 if(this.currentMode == 'SEARCH') |
947 { |
955 { |
958 if(this.currentMode == "SEARCH" && this.playerIsReady) |
966 if(this.currentMode == "SEARCH" && this.playerIsReady) |
959 { |
967 { |
960 this.player.widgets[0].searchByGesture(gestureReceived); |
968 this.player.widgets[0].searchByGesture(gestureReceived); |
961 this.isCurrentlyInASearchByGesture = this.player.widgets[0].isCurrentlyInASearchByGesture; |
969 this.isCurrentlyInASearchByGesture = this.player.widgets[0].isCurrentlyInASearchByGesture; |
962 |
970 |
963 $('.notifications').remove(); |
971 this.removeNotifications(); |
964 this.searchGesture(gestureReceived, 'valid'); |
972 this.searchGesture(gestureReceived, 'valid'); |
965 } |
973 } |
966 else if(this.currentMode == "FILTER") |
974 else if(this.currentMode == "FILTER") |
967 { |
975 { |
968 if(this.isMosaicFiltered) |
976 if(this.isMosaicFiltered) |
969 { |
977 { |
970 // console.log('FILTER !!!'); |
978 // console.log('FILTER !!!'); |
971 // this.notifySearch1Gesture(gestureReceived, 'valid'); |
979 // this.notifySearch1Gesture(gestureReceived, 'valid'); |
972 $('.notifications').remove(); |
980 this.removeNotifications(); |
973 this.filterGesture(gestureReceived, 'valid'); |
981 this.filterGesture(gestureReceived, 'valid'); |
974 this.searchFilter(gestureReceived); |
982 this.searchFilter(gestureReceived); |
975 } |
983 } |
976 } |
984 } |
977 |
985 |
1117 _this.canSwipe = true; |
1125 _this.canSwipe = true; |
1118 } |
1126 } |
1119 |
1127 |
1120 console.log('TIME TO GO AT : ' + _this.timeToGoAt[_this.centerId], _this.centerId, _this.imgs[_this.centerId]); |
1128 console.log('TIME TO GO AT : ' + _this.timeToGoAt[_this.centerId], _this.centerId, _this.imgs[_this.centerId]); |
1121 |
1129 |
1122 if(_this.isMosaicFiltered) |
1130 // if(_this.isMosaicFiltered) |
1123 { |
1131 // { |
1124 if(_this.currentSearchGesture == '') |
1132 if(_this.currentSearchGesture[_this.centerId] == '') |
1125 { |
1133 { |
1126 _this.removeFilter(); |
1134 _this.removeFilter(); |
1127 } |
1135 } |
1128 else |
1136 else |
1129 { |
1137 { |
1130 _this.currentMode = 'SEARCH'; |
1138 _this.currentMode = 'SEARCH'; |
1131 // console.log(_this.currentSearchGesture); |
1139 // console.log(_this.currentSearchGesture); |
1132 _this.player.widgets[0].searchByGesture(_this.currentSearchGesture); |
1140 _this.player.widgets[0].searchByGesture(_this.currentSearchGesture[_this.centerId]); |
1133 _this.isCurrentlyInASearchByGesture = _this.player.widgets[0].isCurrentlyInASearchByGesture; |
1141 _this.isCurrentlyInASearchByGesture = _this.player.widgets[0].isCurrentlyInASearchByGesture; |
1134 |
1142 |
1135 if(_this.timeToGoAt[_this.centerId] === 0 && _this.player.widgets[0].atLeastOneSearchMarker(_this.currentSearchGesture)) |
1143 if(_this.timeToGoAt[_this.centerId] === 0 && _this.player.widgets[0].atLeastOneSearchMarker(_this.currentSearchGesture[_this.centerId])) |
1136 { |
1144 { |
1137 _this.player.widgets[0].goToFirstSearchedMarker(_this.currentSearchGesture); |
1145 _this.player.widgets[0].goToFirstSearchedMarker(_this.currentSearchGesture[_this.centerId]); |
1138 } |
1146 } |
1139 else |
1147 else |
1140 { |
1148 { |
1141 _this.player.popcorn.currentTime(_this.timeToGoAt[_this.centerId]); |
1149 _this.player.popcorn.currentTime(_this.timeToGoAt[_this.centerId]); |
1142 } |
1150 } |
1143 } |
1151 } |
1144 } |
1152 // } |
1145 // /!\ // |
1153 // /!\ // |
1146 else |
1154 /*else |
1147 { |
1155 { |
1148 if(_this.player.popcorn) |
1156 if(_this.player.popcorn) |
1149 { |
1157 { |
1150 _this.player.popcorn.currentTime(_this.timeToGoAt[_this.centerId]); |
1158 _this.player.popcorn.currentTime(_this.timeToGoAt[_this.centerId]); |
1151 } |
1159 } |
1152 } |
1160 }*/ |
1153 }); |
1161 }); |
1154 } |
1162 } |
1155 }); |
1163 }); |
1156 } |
1164 } |
1157 |
1165 |