| author | Edwin Razafimahatratra <edwin@robotalismsoft.com> |
| Fri, 08 Feb 2013 17:07:34 +0100 | |
| changeset 124 | 8d2376eb825c |
| parent 93 | 7c37aaa2a8ae |
| permissions | -rw-r--r-- |
| 42 | 1 |
var effectSpeed = 8; |
2 |
||
3 |
function IncChoice() |
|
4 |
{ |
|
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
5 |
this.currentWorldIndex = 0; |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
6 |
this.canSelectWord = true; |
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
7 |
this.image1; |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
8 |
this.image2; |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
9 |
this.image3; |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
10 |
this.prefixCookieChosenWords = "niv1_ChosenWords"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
11 |
this.prefixCookieChosenVideos = "niv1_ChosenVideos"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
12 |
this.prefixCookiePlayedVideos = "niv1_PlayedVideos"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
13 |
this.prefixCookieSingleVideo = "niv1_SingleVideo"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
14 |
this.prefixCookieHD = "niv1_HD"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
15 |
this.prefixCookieSeekTime = "niv1_SeekTime"; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
16 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
17 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
18 |
// Words display |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
19 |
//---------------------------------------------------------------------------------------------------------------------------- |
| 42 | 20 |
|
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
21 |
this.setMosaicImages = function(images1, images2, images3, postFirstImageCallback) |
| 42 | 22 |
{ |
23 |
// Choose 2 image for the effect |
|
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
24 |
this.image1 = images1[incMosaic.randomInt(0, images1.length)]; |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
25 |
this.image2 = images2[incMosaic.randomInt(0, images2.length)]; |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
26 |
this.image3 = images3[incMosaic.randomInt(0, images3.length)]; |
| 42 | 27 |
|
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
28 |
incMosaic.addImageUrl("static/res/img/" + this.image1); |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
29 |
incMosaic.addImageUrl("static/res/img/" + this.image2); |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
30 |
incMosaic.addImageUrl("static/res/img/" + this.image3); |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
31 |
|
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
32 |
incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();}, postFirstImageCallback); |
| 42 | 33 |
}; |
34 |
||
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
35 |
this.setWordsAndEffect = function(choiceIndex) |
| 42 | 36 |
{ |
| 124 | 37 |
if (choiceIndex === 0) { |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
38 |
$("#mot1").html("famille"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
39 |
$("#mot2").html("amour"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
40 |
$("#mot3").html("travail"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
41 |
$("#mot4").html("international"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
42 |
$("#mot5").html("dieu"); |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
43 |
$("#mot6").html("président"); |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
44 |
|
| 46 | 45 |
// class |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
46 |
// by default there is the class blue |
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
47 |
|
| 124 | 48 |
} else if (choiceIndex === 1) { |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
49 |
$("#mot1").html("actif"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
50 |
$("#mot2").html("passif"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
51 |
$("#mot3").html("corps"); |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
52 |
$("#mot4").html("charité"); |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
53 |
$("#mot5").html("patrie"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
54 |
$("#mot6").html("politique"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
55 |
|
| 46 | 56 |
// class |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
57 |
$("#choice").removeClass("blue").addClass("whiteN"); |
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
58 |
|
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
59 |
} else { |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
60 |
$("#mot1").html("spleen"); |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
61 |
$("#mot2").html("idéal"); |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
62 |
$("#mot3").html("origines"); |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
63 |
$("#mot4").html("peur"); |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
64 |
$("#mot5").html("désir"); |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
65 |
$("#mot6").html("bonheur"); |
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
66 |
|
| 46 | 67 |
// class |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
68 |
$("#choice").removeClass("whiteN").addClass("red"); |
| 48 | 69 |
} |
| 42 | 70 |
}; |
71 |
||
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
72 |
this.effectIsDone = function() |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
73 |
{ |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
74 |
this.canSelectWord = true; |
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
75 |
|
|
45
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
76 |
// Set the list of words and the mosaic effect |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
77 |
this.setWordsAndEffect(this.currentWorldIndex); |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
78 |
|
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
79 |
// Stop the mosaic effect |
|
f7bfdc49982b
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
43
diff
changeset
|
80 |
incMosaic.UnpauseEffect(false); |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
81 |
|
|
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
82 |
// Fade the text |
| 46 | 83 |
$('.big_txt').animate({opacity: 1}, 10000 * 1 / effectSpeed); |
84 |
}; |
|
85 |
||
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
86 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
87 |
// Selected Words |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
88 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
89 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
90 |
this.selectWord = function(wordIndex) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
91 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
92 |
if (!this.canSelectWord) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
93 |
// Don't set the word 2 times |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
94 |
return; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
95 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
96 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
97 |
this.canSelectWord = false; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
98 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
99 |
// Save the word |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
100 |
var allWorldIndex = this.currentWorldIndex * 6 + wordIndex; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
101 |
this.setCookie(this.prefixCookieChosenWords + this.currentWorldIndex, allWorldIndex); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
102 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
103 |
++this.currentWorldIndex; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
104 |
|
| 124 | 105 |
// FTV Tag |
106 |
xt_click(this,"F" ,"5", "Creation_Film::Choix_mot_" + this.currentWorldIndex); |
|
107 |
||
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
108 |
if (this.currentWorldIndex == 3) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
109 |
// The 3 words get choosen |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
110 |
location.href = "film-aleatoire-the-end-etc.html"; |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
111 |
} else { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
112 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
113 |
// Start the mosaic effect |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
114 |
incMosaic.UnpauseEffect(true); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
115 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
116 |
// Fade the text |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
117 |
$('.big_txt').animate({opacity: 0}, 20000 * 1 / effectSpeed); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
118 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
119 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
120 |
|
| 46 | 121 |
this.getChoosenWords = function() |
122 |
{ |
|
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
123 |
var words = []; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
124 |
for (var i = 0; i < 3; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
125 |
words.push(this.getCookie(this.prefixCookieChosenWords + i)); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
126 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
127 |
return words; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
128 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
129 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
130 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
131 |
// Random Chosen Videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
132 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
133 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
134 |
this.saveChosenVideos = function(indexs) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
135 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
136 |
for (var i = 0; i < indexs.length; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
137 |
this.setCookie(this.prefixCookieChosenVideos + i, indexs[i]); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
138 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
139 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
140 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
141 |
this.getChosenVideos = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
142 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
143 |
var indexs = []; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
144 |
for (var i = 0; i < 3; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
145 |
var n = this.getCookie(this.prefixCookieChosenVideos + i); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
146 |
if (n !== null) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
147 |
n = parseInt(n); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
148 |
if (n != -1) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
149 |
indexs.push(n); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
150 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
151 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
152 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
153 |
return indexs; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
154 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
155 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
156 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
157 |
// All time played videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
158 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
159 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
160 |
this.getChoosenVideosFlags = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
161 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
162 |
var var32bits = []; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
163 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
164 |
// Get previous used videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
165 |
for (var i = 0; i < 3; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
166 |
var v32 = this.getCookie(this.prefixCookiePlayedVideos + i); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
167 |
v32 = v32 === null ? 0 : parseInt(v32); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
168 |
var32bits.push(v32); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
169 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
170 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
171 |
return var32bits; |
| 46 | 172 |
}; |
|
43
21a791340354
ecrant choix unique
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
42
diff
changeset
|
173 |
|
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
174 |
this.savePlayedVideos = function(indexs, markPlayed) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
175 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
176 |
// This function used 3 values of 32 bits to records used videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
177 |
// This means we can record the state of 32 * 3 = 96 videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
178 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
179 |
// Get previous used videos |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
180 |
var var32bits = this.getChoosenVideosFlags(); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
181 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
182 |
// Update 32 bits flags var |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
183 |
var i; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
184 |
for (i = 0; i < indexs.length; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
185 |
var index = indexs[i]; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
186 |
for (var j = 0; j < var32bits.length; ++j) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
187 |
var indexMax = (j+1)*32; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
188 |
if (index < indexMax) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
189 |
var flag = 1 << (index - indexMax + 32); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
190 |
if (markPlayed) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
191 |
var32bits[j] = var32bits[j] | flag; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
192 |
} else { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
193 |
var32bits[j] = var32bits[j] & ~flag; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
194 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
195 |
break; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
196 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
197 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
198 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
199 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
200 |
// Save updated flags |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
201 |
for (i = 0; i < 3; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
202 |
this.setCookie(this.prefixCookiePlayedVideos + i, var32bits[i]); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
203 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
204 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
205 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
206 |
this.IsThisVideoWasPlayed = function(var32bits, index) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
207 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
208 |
for (var j = 0; j < var32bits.length; ++j) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
209 |
var indexMax = (j+1)*32; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
210 |
if (index < indexMax) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
211 |
return var32bits[j] & (1 << (index - indexMax + 32)); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
212 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
213 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
214 |
return false; |
| 124 | 215 |
}; |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
216 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
217 |
this.clearAllVideosChoices = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
218 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
219 |
for (i = 0; i < 3; ++i) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
220 |
this.removeCookie(this.prefixCookiePlayedVideos + i); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
221 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
222 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
223 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
224 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
225 |
// Single video |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
226 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
227 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
228 |
this.saveSingleVideo = function(name) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
229 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
230 |
this.setCookie(this.prefixCookieSingleVideo, name); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
231 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
232 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
233 |
this.getSingleVideo = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
234 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
235 |
return this.getCookie(this.prefixCookieSingleVideo); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
236 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
237 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
238 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
239 |
// Hd |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
240 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
241 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
242 |
this.setHD = function(state) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
243 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
244 |
this.setCookie(this.prefixCookieHD, state); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
245 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
246 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
247 |
this.getHD = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
248 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
249 |
var hd = this.getCookie(this.prefixCookieHD); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
250 |
if (hd == "0") { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
251 |
return false; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
252 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
253 |
return true; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
254 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
255 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
256 |
this.setSeekTime = function(time) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
257 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
258 |
this.setCookie(this.prefixCookieSeekTime, time); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
259 |
}; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
260 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
261 |
this.getSeekTime = function() |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
262 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
263 |
var time = this.getCookie(this.prefixCookieSeekTime); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
264 |
if (time === null) { |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
265 |
return 0; |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
266 |
} |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
267 |
return time; |
| 88 | 268 |
}; |
269 |
||
270 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
271 |
// Url share |
|
272 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
273 |
||
274 |
this.createShareUrl = function(index1, index2, index3) |
|
275 |
{ |
|
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
276 |
var index = this.getChosenVideos(); |
| 124 | 277 |
var code = index[0] + index[2]; |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
278 |
var param = (index[0] << 24) | (index[1] << 16) | (index[2] << 8) | code; |
| 88 | 279 |
var urlBase = document.URL; |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
280 |
urlBase = urlBase.replace("partage-du-film-aleatoire-the-end-etc", "film-aleatoire-the-end-etc"); |
| 88 | 281 |
var url = urlBase + "?" + param; |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
282 |
|
| 88 | 283 |
return url; |
| 124 | 284 |
}; |
| 88 | 285 |
|
286 |
this.readUrlVideosIndex = function() |
|
287 |
{ |
|
288 |
var query = window.location.search.substring(1); |
|
| 124 | 289 |
if (query.length === 0) { |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
290 |
return []; |
| 88 | 291 |
} |
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
292 |
return this.decodeUrlIndex(query); |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
293 |
}; |
| 88 | 294 |
|
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
295 |
this.decodeUrlIndex = function(query) |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
296 |
{ |
| 88 | 297 |
var number = parseInt(query); |
298 |
||
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
299 |
var code = number & 255; |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
300 |
number >>= 8; |
| 88 | 301 |
var index3 = number & 255; |
302 |
number >>= 8; |
|
303 |
var index2 = number & 255; |
|
304 |
number >>= 8; |
|
305 |
var index1 = number & 255; |
|
306 |
||
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
307 |
if (code != index1 + index3) { |
| 88 | 308 |
return []; |
309 |
} |
|
310 |
||
|
93
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
311 |
if (typeof( incPlayer ) != "undefined") { |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
312 |
var maxVideoIndex = incPlayer.allSequencesData.videos.length - 1; |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
313 |
if (index1 > maxVideoIndex || index2 > maxVideoIndex || index3 > maxVideoIndex) { |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
314 |
return []; |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
315 |
} |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
316 |
} |
|
7c37aaa2a8ae
netoyage update du rep static
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
88
diff
changeset
|
317 |
|
| 88 | 318 |
return [index1, index2, index3]; |
| 124 | 319 |
}; |
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
320 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
321 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
322 |
// Cookies tools |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
323 |
//---------------------------------------------------------------------------------------------------------------------------- |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
324 |
|
| 42 | 325 |
this.setCookie = function(name, value) |
326 |
{ |
|
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
327 |
this.removeCookie(name); |
| 46 | 328 |
$.cookie(name, value, { expires: 7, path: '/' }); |
| 42 | 329 |
}; |
330 |
||
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
331 |
this.getCookie = function(name) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
332 |
{ |
| 42 | 333 |
return $.cookie(name); |
334 |
}; |
|
|
78
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
335 |
|
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
336 |
this.removeCookie = function(name) |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
337 |
{ |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
338 |
$.removeCookie(name, { path: '/' }); |
|
8c3f0b94d056
big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
48
diff
changeset
|
339 |
}; |
| 42 | 340 |
} |
341 |
||
342 |
var incChoice = new IncChoice(); |